Merge branch 'mergebranch' into 'master'
Feature merge
See merge request !256
2 files added
41 files modified
| | |
| | | |
| | | if($install_mode == 'standard') { |
| | | |
| | | $inst->dbmaster = $inst->db; |
| | | |
| | | //* Create the MySQL database |
| | | $inst->configure_database(); |
| | | |
| | |
| | | $inst->install_crontab(); |
| | | } else swriteln('[ERROR] Cron not found'); |
| | | |
| | | swriteln('Detect IP addresses'); |
| | | $inst->detect_ips(); |
| | | |
| | | swriteln('Restarting services ...'); |
| | | if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); |
| | | if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
| | |
| | | swriteln('Configuring Pureftpd'); |
| | | $inst->configure_pureftpd(); |
| | | } |
| | | |
| | | swriteln('Detect IP addresses'); |
| | | $inst->detect_ips(); |
| | | |
| | | //** Configure DNS |
| | | if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') { |
| | |
| | | if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
| | | if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
| | | } |
| | | |
| | | swriteln('Detect IP addresses'); |
| | | $inst->detect_ips(); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | public function detect_ips(){ |
| | | global $conf; |
| | | |
| | | exec("ip addr show | awk '/global/ { print $2 }' | cut -d '/' -f 1", $output, $retval); |
| | | |
| | | if($retval == 0){ |
| | | if(is_array($output) && !empty($output)){ |
| | | foreach($output as $line){ |
| | | $line = trim($line); |
| | | $ip_type = ''; |
| | | if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { |
| | | $ip_type = 'IPv4'; |
| | | } |
| | | if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
| | | $ip_type = 'IPv6'; |
| | | } |
| | | if($ip_type == '') continue; |
| | | if($this->db->dbHost != $this->dbmaster->dbHost){ |
| | | $this->dbmaster->query('INSERT INTO server_ip ( |
| | | sys_userid, sys_groupid, sys_perm_user, sys_perm_group, |
| | | sys_perm_other, server_id, client_id, ip_type, ip_address, |
| | | virtualhost, virtualhost_port |
| | | ) VALUES ( |
| | | 1, |
| | | 1, |
| | | "riud", |
| | | "riud", |
| | | "", |
| | | ?, |
| | | 0, |
| | | ?, |
| | | ?, |
| | | "y", |
| | | "80,443" |
| | | )', $conf['server_id'], $ip_type, $line); |
| | | $server_ip_id = $this->dbmaster->insertID(); |
| | | $this->db->query('INSERT INTO server_ip ( |
| | | server_php_id, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, |
| | | sys_perm_other, server_id, client_id, ip_type, ip_address, |
| | | virtualhost, virtualhost_port |
| | | ) VALUES ( |
| | | ?, |
| | | 1, |
| | | 1, |
| | | "riud", |
| | | "riud", |
| | | "", |
| | | ?, |
| | | 0, |
| | | ?, |
| | | ?, |
| | | "y", |
| | | "80,443" |
| | | )', $server_ip_id, $conf['server_id'], $ip_type, $line); |
| | | } else { |
| | | $this->db->query('INSERT INTO server_ip ( |
| | | sys_userid, sys_groupid, sys_perm_user, sys_perm_group, |
| | | sys_perm_other, server_id, client_id, ip_type, ip_address, |
| | | virtualhost, virtualhost_port |
| | | ) VALUES ( |
| | | 1, |
| | | 1, |
| | | "riud", |
| | | "riud", |
| | | "", |
| | | ?, |
| | | 0, |
| | | ?, |
| | | ?, |
| | | "y", |
| | | "80,443" |
| | | )', $conf['server_id'], $ip_type, $line); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public function grant_master_database_rights($verbose = false) { |
| | | global $conf; |
| | |
| | | `customer_no_counter` int(11) NOT NULL DEFAULT '0', |
| | | `added_date` date NOT NULL DEFAULT '0000-00-00', |
| | | `added_by` varchar(255) DEFAULT NULL, |
| | | `validation_status` enum('accept','review','reject') NOT NULL DEFAULT 'accept', |
| | | `risk_score` int(10) unsigned NOT NULL DEFAULT '0', |
| | | `activation_code` varchar(10) NOT NULL DEFAULT '', |
| | | PRIMARY KEY (`client_id`) |
| | | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; |
| | | |
| | |
| | | `customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n', |
| | | `required_php_snippets` varchar(255) NOT NULL DEFAULT '', |
| | | `active` enum('n','y') NOT NULL DEFAULT 'y', |
| | | `master_directive_snippets_id` int(11) unsigned NOT NULL DEFAULT '0', |
| | | PRIMARY KEY (`directive_snippets_id`) |
| | | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; |
| | | |
| | |
| | | `enable_pagespeed` ENUM('y','n') NOT NULL DEFAULT 'n', |
| | | `http_port` int(11) unsigned NOT NULL DEFAULT '80', |
| | | `https_port` int(11) unsigned NOT NULL DEFAULT '443', |
| | | `folder_directive_snippets` text NOT NULL, |
| | | PRIMARY KEY (`domain_id`), |
| | | UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` ) |
| | | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; |
| | |
| | | backup_dir=/var/backup |
| | | backup_dir_is_mount=n |
| | | backup_mode=rootgz |
| | | backup_time=0:00 |
| | | backup_delete=n |
| | | monit_url= |
| | | monit_user= |
| | |
| | | mailbox_size_limit=0 |
| | | message_size_limit=0 |
| | | mailbox_quota_stats=y |
| | | realtime_blackhole_list= |
| | | realtime_blackhole_list=zen.spamhaus.org |
| | | overquota_notify_admin=y |
| | | overquota_notify_client=y |
| | | overquota_notify_freq=7 |
| | |
| | | apps_vhost_servername= |
| | | php_open_basedir=[website_path]/web:[website_path]/private:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin |
| | | htaccess_allow_override=All |
| | | enable_spdy=y |
| | | awstats_conf_dir=/etc/awstats |
| | | awstats_data_dir=/var/lib/awstats |
| | | awstats_pl=/usr/lib/cgi-bin/awstats.pl |
| | |
| | | [jailkit] |
| | | jailkit_chroot_home=/home/[username] |
| | | jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh |
| | | jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch |
| | | jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /usr/bin/which /usr/lib/x86_64-linux-gnu/libmemcached.so.11 /usr/lib/x86_64-linux-gnu/libmemcachedutil.so.2 /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.2 /opt/php-5.6.8/bin/php /opt/php-5.6.8/include /opt/php-5.6.8/lib |
| | | jailkit_chroot_cron_programs=/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php |
| | | |
| | | [vlogger] |
| | |
| | | return getimagesizefromstring($string); |
| | | } |
| | | } |
| | | |
| | | public function password($minLength = 10, $special = false){ |
| | | global $app; |
| | | |
| | | $iteration = 0; |
| | | $password = ""; |
| | | $maxLength = $minLength + 5; |
| | | $length = $this->getRandomInt($minLength, $maxLength); |
| | | |
| | | while($iteration < $length){ |
| | | $randomNumber = (floor(((mt_rand() / mt_getrandmax()) * 100)) % 94) + 33; |
| | | if(!$special){ |
| | | if (($randomNumber >=33) && ($randomNumber <=47)) { continue; } |
| | | if (($randomNumber >=58) && ($randomNumber <=64)) { continue; } |
| | | if (($randomNumber >=91) && ($randomNumber <=96)) { continue; } |
| | | if (($randomNumber >=123) && ($randomNumber <=126)) { continue; } |
| | | } |
| | | $iteration++; |
| | | $password .= chr($randomNumber); |
| | | } |
| | | $app->uses('validate_password'); |
| | | if($app->validate_password->password_check('', $password, '') !== false) $password = $this->password($minLength, $special); |
| | | return $password; |
| | | } |
| | | |
| | | public function getRandomInt($min, $max){ |
| | | return floor((mt_rand() / mt_getrandmax()) * ($max - $min + 1)) + $min; |
| | | } |
| | | |
| | | public function generate_customer_no(){ |
| | | global $app; |
| | | // generate customer no. |
| | | $customer_no = mt_rand(100000, 999999); |
| | | while($app->db->queryOneRecord("SELECT client_id FROM client WHERE customer_no = ?", $customer_no)) { |
| | | $customer_no = mt_rand(100000, 999999); |
| | | } |
| | | |
| | | return $customer_no; |
| | | } |
| | | } |
| | | |
| | | ?> |
| | |
| | | $searchval = $year.'-'.$month.'-'.$day; |
| | | } |
| | | } |
| | | |
| | | if($i['datatype'] == 'BOOLEAN' && $searchval != ''){ |
| | | if (!function_exists('boolval')) { |
| | | $searchval = (bool) $searchval; |
| | | if($searchval === true){ |
| | | $searchval = 'TRUE'; |
| | | } else { |
| | | $searchval = 'FALSE'; |
| | | } |
| | | } else { |
| | | $searchval = boolval($searchval)? 'TRUE' : 'FALSE'; |
| | | } |
| | | } |
| | | |
| | | // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and"; |
| | | if(isset($searchval) && $searchval != ''){ |
| | | $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and"; |
| | | $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." ".($i['datatype'] == 'BOOLEAN'? "" : "'").$app->db->quote($i['prefix'].$searchval.$i['suffix']).($i['datatype'] == 'BOOLEAN'? "" : "'")." and"; |
| | | } |
| | | } |
| | | } |
| | |
| | | if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){ |
| | | $content .= '<li><a href="#" data-load-content="'.$vars['list_file'].'?page=0'.$vars['page_params'].'" aria-label="First"> |
| | | <span aria-hidden="true">«</span></a></li>'; |
| | | $content .= '<li><a href="#" data-load-content='.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'" aria-label="Previous"> |
| | | $content .= '<li><a href="#" data-load-content="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'" aria-label="Previous"> |
| | | <span aria-hidden="true">‹</span></a></li>'; |
| | | } |
| | | $prev = -1; |
| | |
| | | case 'CURRENCY': |
| | | $record[$key] = $app->functions->currency_format($record[$key]); |
| | | break; |
| | | |
| | | case 'BOOLEAN': |
| | | if (!function_exists('boolval')) { |
| | | $record[$key] = (bool) $record[$key]; |
| | | } else { |
| | | $record[$key] = boolval($record[$key]); |
| | | } |
| | | break; |
| | | |
| | | default: |
| | | $record[$key] = htmlentities(stripslashes($record[$key]), ENT_QUOTES, $conf["html_content_encoding"]); |
| | |
| | | case 'CURRENCY': |
| | | $record[$key] = str_replace(',', '.', $record[$key]); |
| | | break; |
| | | |
| | | case 'BOOLEAN': |
| | | if (!function_exists('boolval')) { |
| | | $record[$key] = (bool) $record[$key]; |
| | | } else { |
| | | $record[$key] = boolval($record[$key]); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param int client id |
| | | * @param string new password |
| | | * @return bool true if success |
| | | * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010 |
| | | * |
| | | */ |
| | | public function client_change_password($session_id, $client_id, $new_password) { |
| | | global $app; |
| | | |
| | | $app->uses('auth'); |
| | | |
| | | if(!$this->checkPerm($session_id, 'client_change_password')) { |
| | | throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); |
| | | return false; |
| | | } |
| | | $client_id = $app->functions->intval($client_id); |
| | | |
| | | $client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ?", $client_id); |
| | | if($client['client_id'] > 0) { |
| | | $sql = "UPDATE client SET password = md5(?) WHERE client_id = ?"; |
| | | $new_password = $app->auth->crypt_password($new_password); |
| | | $sql = "UPDATE client SET password = ? WHERE client_id = ?"; |
| | | $app->db->query($sql, $new_password, $client_id); |
| | | $sql = "UPDATE sys_user SET passwort = md5(?) WHERE client_id = ?"; |
| | | $sql = "UPDATE sys_user SET passwort = ? WHERE client_id = ?"; |
| | | $app->db->query($sql, $new_password, $client_id); |
| | | return true; |
| | | } else { |
| | |
| | | |
| | | return $returnval; |
| | | } |
| | | |
| | | } |
| | | |
| | | ?> |
| | |
| | | case 'TRIM': |
| | | $returnval = trim($returnval); |
| | | break; |
| | | case 'NOWHITESPACE': |
| | | $returnval = preg_replace('/\s+/', '', $returnval); |
| | | break; |
| | | default: |
| | | $this->errorMessage .= "Unknown Filter: ".$filter['type']; |
| | | break; |
| | |
| | | |
| | | private function _get_password_strength($password) { |
| | | $length = strlen($password); |
| | | |
| | | $points = 0; |
| | | if ($length < 5) { |
| | | return 1; |
| | |
| | | $different += 1; |
| | | } |
| | | |
| | | if (preg_match('/[`~!@#$%^&*()_+|\\=-\[\]}{\';:\/?.>,<" ]/', $password)) { |
| | | if (preg_match('/[`~!@#$%^&*()_+|\\=\-\[\]}{\';:\/?.>,<" ]/', $password)) { |
| | | $points += 1; |
| | | $different += 1; |
| | | } |
| | |
| | | // Loading classes |
| | | $app->uses('tpl,tform,tform_actions'); |
| | | |
| | | // let tform_actions handle the page |
| | | $app->tform_actions->onLoad(); |
| | | class page_action extends tform_actions { |
| | | |
| | | function onShow() { |
| | | global $app, $conf; |
| | | |
| | | if($this->id > 0){ |
| | | $record = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ?", $this->id); |
| | | if($record['master_directive_snippets_id'] > 0){ |
| | | unset($app->tform->formDef["tabs"]['directive_snippets']['fields']['name'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['type'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['snippet'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['required_php_snippets']); |
| | | } |
| | | unset($record); |
| | | } |
| | | |
| | | parent::onShow(); |
| | | } |
| | | |
| | | function onShowEnd() { |
| | | global $app, $conf; |
| | | |
| | | $is_master = false; |
| | | if($this->id > 0){ |
| | | if($this->dataRecord['master_directive_snippets_id'] > 0){ |
| | | $is_master = true; |
| | | $app->tpl->setVar("name", $this->dataRecord['name']); |
| | | $app->tpl->setVar("type", $this->dataRecord['type']); |
| | | $app->tpl->setVar("snippet", $this->dataRecord['snippet']); |
| | | } |
| | | } |
| | | $app->tpl->setVar("is_master", $is_master); |
| | | |
| | | parent::onShowEnd(); |
| | | } |
| | | |
| | | function onSubmit() { |
| | | global $app, $conf; |
| | | |
| | | if($this->id > 0){ |
| | | $record = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ?", $this->id); |
| | | if($record['master_directive_snippets_id'] > 0){ |
| | | unset($app->tform->formDef["tabs"]['directive_snippets']['fields']['name'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['type'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['snippet'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['required_php_snippets']); |
| | | } |
| | | unset($record); |
| | | } |
| | | |
| | | parent::onSubmit(); |
| | | } |
| | | |
| | | } |
| | | |
| | | $page = new page_action; |
| | | $page->onLoad(); |
| | | |
| | | ?> |
| | |
| | | |
| | | $app->uses('listform_actions'); |
| | | |
| | | class list_action extends listform_actions { |
| | | |
| | | public function prepareDataRow($rec) |
| | | { |
| | | global $app; |
| | | |
| | | $rec = $app->listform->decode($rec); |
| | | |
| | | //* Alternating datarow colors |
| | | $this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'; |
| | | $rec['bgcolor'] = $this->DataRowColor; |
| | | |
| | | $rec['is_master'] = $rec['master_directive_snippets_id']; |
| | | |
| | | //* substitute value for select fields |
| | | if(is_array($app->listform->listDef['item']) && count($app->listform->listDef['item']) > 0) { |
| | | foreach($app->listform->listDef['item'] as $field) { |
| | | $key = $field['field']; |
| | | if(isset($field['formtype']) && $field['formtype'] == 'SELECT') { |
| | | if(strtolower($rec[$key]) == 'y' or strtolower($rec[$key]) == 'n') { |
| | | // Set a additional image variable for bolean fields |
| | | $rec['_'.$key.'_'] = (strtolower($rec[$key]) == 'y')?'x16/tick_circle.png':'x16/cross_circle.png'; |
| | | } |
| | | //* substitute value for select field |
| | | $rec[$key] = @$field['value'][$rec[$key]]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //* The variable "id" contains always the index variable |
| | | $rec['id'] = $rec[$this->idx_key]; |
| | | return $rec; |
| | | } |
| | | |
| | | } |
| | | $list = new list_action; |
| | | $list->SQLOrderBy = 'ORDER BY directive_snippets.name'; |
| | | $list->onLoad(); |
| | | |
| | | //$app->listform_actions->SQLExtWhere = 'master_directive_snippets_id = 0'; |
| | | /* |
| | | $app->listform_actions->SQLOrderBy = 'ORDER BY directive_snippets.name'; |
| | | $app->listform_actions->onLoad(); |
| | | |
| | | |
| | | */ |
| | | ?> |
| | |
| | | 'formtype' => 'CHECKBOXARRAY', |
| | | 'default' => '', |
| | | 'datasource' => array ( 'type' => 'SQL', |
| | | 'querystring' => "SELECT directive_snippets_id,name FROM directive_snippets WHERE type = 'php' AND active = 'y'ORDER BY name", |
| | | 'querystring' => "SELECT directive_snippets_id,name FROM directive_snippets WHERE type = 'php' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name", |
| | | 'keyfield' => 'directive_snippets_id', |
| | | 'valuefield' => 'name' |
| | | ), |
| | |
| | | 'width' => '40', |
| | | 'maxlength' => '255' |
| | | ), |
| | | 'backup_time' => array( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '0:00', |
| | | 'value' => array( '0:00' => '0:00h', |
| | | '0:15' => '0:15h', |
| | | '0:30' => '0:30h', |
| | | '0:45' => '0:45h', |
| | | '1:00' => '1:00h', |
| | | '1:15' => '1:15h', |
| | | '1:30' => '1:30h', |
| | | '1:45' => '1:45h', |
| | | '2:00' => '2:00h', |
| | | '2:15' => '2:15h', |
| | | '2:30' => '2:30h', |
| | | '2:45' => '2:45h', |
| | | '3:00' => '3:00h', |
| | | '3:15' => '3:15h', |
| | | '3:30' => '3:30h', |
| | | '3:45' => '3:45h', |
| | | '4:00' => '4:00h', |
| | | '4:15' => '4:15h', |
| | | '4:30' => '4:30h', |
| | | '4:45' => '4:45h', |
| | | '5:00' => '5:00h', |
| | | '5:15' => '5:15h', |
| | | '5:30' => '5:30h', |
| | | '5:45' => '5:45h', |
| | | '6:00' => '6:00h', |
| | | '6:15' => '6:15h', |
| | | '6:30' => '6:30h', |
| | | '6:45' => '6:45h', |
| | | '7:00' => '7:00h', |
| | | '7:15' => '7:15h', |
| | | '7:30' => '7:30h', |
| | | '7:45' => '7:45h', |
| | | '8:00' => '8:00h', |
| | | '8:15' => '8:15h', |
| | | '8:30' => '8:30h', |
| | | '8:45' => '8:45h', |
| | | '9:00' => '9:00h', |
| | | '9:15' => '9:15h', |
| | | '9:30' => '9:30h', |
| | | '9:45' => '9:45h', |
| | | '10:00' => '10:00h', |
| | | '10:15' => '10:15h', |
| | | '10:30' => '10:30h', |
| | | '10:45' => '10:45h', |
| | | '11:00' => '11:00h', |
| | | '11:15' => '11:15h', |
| | | '11:30' => '11:30h', |
| | | '11:45' => '11:45h', |
| | | '12:00' => '12:00h', |
| | | '12:15' => '12:15h', |
| | | '12:30' => '12:30h', |
| | | '12:45' => '12:45h', |
| | | '13:00' => '13:00h', |
| | | '13:15' => '13:15h', |
| | | '13:30' => '13:30h', |
| | | '13:45' => '13:45h', |
| | | '14:00' => '14:00h', |
| | | '14:15' => '14:15h', |
| | | '14:30' => '14:30h', |
| | | '14:45' => '14:45h', |
| | | '15:00' => '15:00h', |
| | | '15:15' => '15:15h', |
| | | '15:30' => '15:30h', |
| | | '15:45' => '15:45h', |
| | | '16:00' => '16:00h', |
| | | '16:15' => '16:15h', |
| | | '16:30' => '16:30h', |
| | | '16:45' => '16:45h', |
| | | '17:00' => '17:00h', |
| | | '17:15' => '17:15h', |
| | | '17:30' => '17:30h', |
| | | '17:45' => '17:45h', |
| | | '18:00' => '18:00h', |
| | | '18:15' => '18:15h', |
| | | '18:30' => '18:30h', |
| | | '18:45' => '18:45h', |
| | | '19:00' => '19:00h', |
| | | '19:15' => '19:15h', |
| | | '19:30' => '19:30h', |
| | | '19:45' => '19:45h', |
| | | '20:00' => '20:00h', |
| | | '20:15' => '20:15h', |
| | | '20:30' => '20:30h', |
| | | '20:45' => '20:45h', |
| | | '21:00' => '21:00h', |
| | | '21:15' => '21:15h', |
| | | '21:30' => '21:30h', |
| | | '21:45' => '21:45h', |
| | | '22:00' => '22:00h', |
| | | '22:15' => '22:15h', |
| | | '22:30' => '22:30h', |
| | | '22:45' => '22:45h', |
| | | '23:00' => '23:00h', |
| | | '23:15' => '23:15h', |
| | | '23:30' => '23:30h', |
| | | '23:45' => '23:45h', |
| | | ), |
| | | 'width' => '40', |
| | | 'maxlength' => '255' |
| | | ), |
| | | 'backup_delete' => array( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'CHECKBOX', |
| | |
| | | 'suffix' => "", |
| | | 'width' => "", |
| | | 'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>")); |
| | | |
| | | $liste["item"][] = array( 'field' => "master_directive_snippets_id", |
| | | 'datatype' => "BOOLEAN", |
| | | 'formtype' => "SELECT", |
| | | 'op' => "IS", |
| | | 'prefix' => "", |
| | | 'suffix' => "", |
| | | 'width' => "", |
| | | 'value' => array(0 => $app->lng('select_directive_snippet_txt'), 1 => $app->lng('select_master_directive_snippet_txt'))); |
| | | |
| | | ?> |
| | |
| | | |
| | | <div class="form-group"> |
| | | <label for="name" class="col-sm-3 control-label">{tmpl_var name='name_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="name" id="name" value="{tmpl_var name='name'}" class="form-control" /></div></div> |
| | | <tmpl_if name='is_master'><div class="col-sm-9 col-text">{tmpl_var name='name'}</div></tmpl_else><div class="col-sm-9"><input type="text" name="name" id="name" value="{tmpl_var name='name'}" class="form-control" /></div></tmpl_if> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label for="type" class="col-sm-3 control-label">{tmpl_var name='type_txt'}</label> |
| | | <div class="col-sm-9"><select name="type" id="type" class="form-control"> |
| | | <tmpl_if name='is_master'><div class="col-sm-9 col-text">{tmpl_var name='type'}</div></tmpl_else><div class="col-sm-9"><select name="type" id="type" class="form-control"> |
| | | {tmpl_var name='type'} |
| | | </select></div> |
| | | </select></div></tmpl_if> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label for="snippet" class="col-sm-3 control-label">{tmpl_var name='snippet_txt'}</label> |
| | | <div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div><span> {tmpl_var name='variables_txt'}: </span><a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT_CLIENT}</a><span class="nginx">, </span><a href="javascript:void(0);" class="addPlaceholder nginx">{FASTCGIPASS}</a> |
| | | <tmpl_if name='is_master'><div class="col-sm-9 col-text"><pre>{tmpl_var name='snippet'}</pre></div></tmpl_else><div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div> |
| | | <div class="col-sm-3 col-text nginx"></div><div class="col-sm-9 col-text nginx"> {tmpl_var name='variables_txt'}: <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{FASTCGIPASS}</a>, <a href="javascript:void(0);" class="addPlaceholder">{PHPFALLBACKFASTCGIPASS}</a></div></tmpl_if> |
| | | </div> |
| | | <tmpl_if name='is_master'></tmpl_else> |
| | | <div class="form-group php"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='required_php_snippets_txt'}</label> |
| | | <div class="col-sm-9"> |
| | | {tmpl_var name='required_php_snippets'} |
| | | </div> |
| | | </div> |
| | | </tmpl_if> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='customer_viewable_txt'}</label> |
| | | <div class="col-sm-9"> |
| | |
| | | <th data-column="name"><tmpl_var name="name_txt"></th> |
| | | <th data-column="type"><tmpl_var name="type_txt"></th> |
| | | <th data-column="customer_viewable"><tmpl_var name="customer_viewable_txt"></th> |
| | | <th data-column="master_directive_snippets_id"><tmpl_var name="master_directive_snippets_id_txt"></th> |
| | | <th class="small-col text-right">{tmpl_var name='search_limit'}</th> |
| | | </tr> |
| | | <tr> |
| | |
| | | <td><input class="form-control" type="text" name="search_name" value="{tmpl_var name='search_name'}" /></td> |
| | | <td><select class="form-control" name="search_type">{tmpl_var name='search_type'}</select></td> |
| | | <td><select class="form-control" name="search_customer_viewable">{tmpl_var name='search_customer_viewable'}</select></td> |
| | | <td><select class="form-control" name="search_master_directive_snippets_id">{tmpl_var name='search_master_directive_snippets_id'}</select></td> |
| | | <td class="text-right"> |
| | | <button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="admin/directive_snippets_list.php"><span class="icon icon-filter"></span></button> |
| | | </td> |
| | |
| | | <td><a href="#" data-load-content="admin/directive_snippets_edit.php?id={tmpl_var name='id'}">{tmpl_var name="name"}</a></td> |
| | | <td><a href="#" data-load-content="admin/directive_snippets_edit.php?id={tmpl_var name='id'}">{tmpl_var name="type"}</a></td> |
| | | <td><a href="#" data-load-content="admin/directive_snippets_edit.php?id={tmpl_var name='id'}">{tmpl_var name="customer_viewable"}</a></td> |
| | | <td><a href="#" data-load-content="admin/directive_snippets_edit.php?id={tmpl_var name='id'}">{tmpl_var name="master_directive_snippets_id"}</a></td> |
| | | <td class="text-right"> |
| | | <a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('admin/directive_snippets_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a> |
| | | <tmpl_if name='is_master'></tmpl_else><a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('admin/directive_snippets_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a></tmpl_if> |
| | | </td> |
| | | </tr> |
| | | </tmpl_loop> |
| | | <tmpl_unless name="records"> |
| | | <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> |
| | | <td colspan="5">{tmpl_var name='globalsearch_noresults_text_txt'}</td> |
| | | <td colspan="6">{tmpl_var name='globalsearch_noresults_text_txt'}</td> |
| | | </tr> |
| | | </tmpl_unless> |
| | | </tbody> |
| | | |
| | | <tfoot> |
| | | <tr> |
| | | <td colspan="5"><tmpl_var name="paging"></td> |
| | | <td colspan="6"><tmpl_var name="paging"></td> |
| | | </tr> |
| | | </tfoot> |
| | | </table> |
| | |
| | | {tmpl_var name='backup_mode'} |
| | | </select></div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label for="backup_time" class="col-sm-3 control-label">{tmpl_var name='backup_time_txt'}</label> |
| | | <div class="col-sm-3"><select name="backup_time" id="backup_time" class="form-control"> |
| | | {tmpl_var name='backup_time'} |
| | | </select></div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='backup_delete_txt'}</label> |
| | | <div class="col-sm-9"> |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | $activation_letter_filename = ISPC_ROOT_PATH.'/pdf/activation_letters/c'.$client_id.'-'.$this->dataRecord['activation_code'].'.pdf'; |
| | | if(is_file($activation_letter_filename)) unlink($activation_letter_filename); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | $app->uses('listform_actions'); |
| | | |
| | | $app->listform_actions->SQLOrderBy = 'ORDER BY client.company_name, client.contact_name, client.client_id'; |
| | | $app->listform_actions->SQLExtWhere = "client.limit_client = 0"; |
| | | $app->listform_actions->SQLExtSelect = ', LOWER(client.country) as countryiso'; |
| | | $app->listform_actions->onLoad(); |
| | | class list_action extends listform_actions { |
| | | function onShow() { |
| | | global $app; |
| | | |
| | | if(is_file(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php')){ |
| | | $app->tpl->setVar('has_robot', true); |
| | | } |
| | | |
| | | parent::onShow(); |
| | | } |
| | | |
| | | } |
| | | |
| | | $list = new list_action; |
| | | $list->SQLOrderBy = 'ORDER BY client.company_name, client.contact_name, client.client_id'; |
| | | $list->SQLExtWhere = "client.limit_client = 0"; |
| | | $list->SQLExtSelect = ', LOWER(client.country) as countryiso'; |
| | | $list->onLoad(); |
| | | ?> |
| | |
| | | 'filters' => array( 0 => array( 'event' => 'SAVE', |
| | | 'type' => 'TRIM'), |
| | | 1 => array( 'event' => 'SAVE', |
| | | 'type' => 'TOUPPER') |
| | | 'type' => 'TOUPPER'), |
| | | 2 => array( 'event' => 'SAVE', |
| | | 'type' => 'NOWHITESPACE') |
| | | ), |
| | | ), |
| | | 'company_id' => array ( |
| | |
| | | 'filters' => array( 0 => array( 'event' => 'SAVE', |
| | | 'type' => 'TRIM'), |
| | | 1 => array( 'event' => 'SAVE', |
| | | 'type' => 'TOUPPER') |
| | | 'type' => 'TOUPPER'), |
| | | 2 => array( 'event' => 'SAVE', |
| | | 'type' => 'NOWHITESPACE') |
| | | ), |
| | | ), |
| | | 'bank_account_swift' => array ( |
| | |
| | | 'filters' => array( 0 => array( 'event' => 'SAVE', |
| | | 'type' => 'TRIM'), |
| | | 1 => array( 'event' => 'SAVE', |
| | | 'type' => 'TOUPPER') |
| | | 'type' => 'TOUPPER'), |
| | | 2 => array( 'event' => 'SAVE', |
| | | 'type' => 'NOWHITESPACE') |
| | | ), |
| | | ), |
| | | 'notes' => array ( |
| | |
| | | 1 => array ( 'type' => 'NOTEMPTY', |
| | | 'errmsg'=> 'email_error_empty'), |
| | | ), |
| | | 'validators' => array ( 0 => array ( 'type' => 'REGEX', |
| | | 'regex' => '/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}$/i', |
| | | 'errmsg'=> 'email_error_isemail'), |
| | | ), |
| | | 'default' => '', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | |
| | | 'filters' => array( 0 => array( 'event' => 'SAVE', |
| | | 'type' => 'TRIM'), |
| | | 1 => array( 'event' => 'SAVE', |
| | | 'type' => 'TOUPPER') |
| | | 'type' => 'TOUPPER'), |
| | | 2 => array( 'event' => 'SAVE', |
| | | 'type' => 'NOWHITESPACE') |
| | | ), |
| | | ), |
| | | 'company_id' => array ( |
| | |
| | | 'filters' => array( 0 => array( 'event' => 'SAVE', |
| | | 'type' => 'TRIM'), |
| | | 1 => array( 'event' => 'SAVE', |
| | | 'type' => 'TOUPPER') |
| | | 'type' => 'TOUPPER'), |
| | | 2 => array( 'event' => 'SAVE', |
| | | 'type' => 'NOWHITESPACE') |
| | | ), |
| | | ), |
| | | 'bank_account_swift' => array ( |
| | |
| | | 'filters' => array( 0 => array( 'event' => 'SAVE', |
| | | 'type' => 'TRIM'), |
| | | 1 => array( 'event' => 'SAVE', |
| | | 'type' => 'TOUPPER') |
| | | 'type' => 'TOUPPER'), |
| | | 2 => array( 'event' => 'SAVE', |
| | | 'type' => 'NOWHITESPACE') |
| | | ), |
| | | ), |
| | | 'notes' => array ( |
| | |
| | | ), |
| | | 'width' => "", |
| | | 'value' => ""); |
| | | |
| | | if(is_file(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php')){ |
| | | $liste["item"][] = array( 'field' => "validation_status", |
| | | 'datatype' => "VARCHAR", |
| | | 'formtype' => "SELECT", |
| | | 'op' => "=", |
| | | 'prefix' => "", |
| | | 'suffix' => "", |
| | | 'width' => "", |
| | | 'value' => array('accept' => 'accept', 'review' => 'review', 'reject' => 'reject')); |
| | | } |
| | | |
| | | ?> |
| | |
| | | <th data-column="username"><tmpl_var name="username_txt"></th> |
| | | <th data-column="city"><tmpl_var name="city_txt"></th> |
| | | <th data-column="country"><tmpl_var name="country_txt"></th> |
| | | <tmpl_if name="has_robot"><th data-column="validation_status"><tmpl_var name="validation_status_txt"></th></tmpl_if> |
| | | <th class="small-col text-right">{tmpl_var name='search_limit'}</th> |
| | | </tr> |
| | | <tr> |
| | |
| | | <td><input class="form-control" type="text" name="search_username" value="{tmpl_var name='search_username'}" /></td> |
| | | <td><input class="form-control" type="text" name="search_city" value="{tmpl_var name='search_city'}" /></td> |
| | | <td><select class="form-control" name="search_country">{tmpl_var name='search_country'}</select></td> |
| | | <tmpl_if name="has_robot"><td><select class="form-control" name="search_validation_status">{tmpl_var name='search_validation_status'}</select></td></tmpl_if> |
| | | <td class="text-right"> |
| | | <button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="client/client_list.php"><span class="icon icon-filter"></span></button> |
| | | </td> |
| | |
| | | <td><a href="#" data-load-content="client/client_edit.php?id={tmpl_var name='id'}">{tmpl_var name="username"}</a></td> |
| | | <td><a href="#" data-load-content="client/client_edit.php?id={tmpl_var name='id'}">{tmpl_var name="city"}</a></td> |
| | | <td><a href="#" data-load-content="client/client_edit.php?id={tmpl_var name='id'}"><span class="flags flag-{tmpl_var name="countryiso"}">{tmpl_var name="country"}</span></a></td> |
| | | <tmpl_if name="has_robot"><td><a href="#" data-load-content="client/client_edit.php?id={tmpl_var name='id'}">{tmpl_var name="validation_status"}</a></td></tmpl_if> |
| | | <td class="text-right"> |
| | | <tmpl_if name="has_robot"> |
| | | <a class="btn btn-default formbutton-default formbutton-narrow" href="#" data-load-content="client/client_action.php?id={tmpl_var name='id'}" title="{tmpl_var name='client_actions_txt'}" style="background: no-repeat center url('themes/default/assets/images/arrow.png');"><span class="icon"> </span></a> |
| | | <tmpl_if name='activation_code' op='!=' value=''> |
| | | <tmpl_if name='validation_status' op='==' value='review'> |
| | | <a class="btn btn-default formbutton-default formbutton-narrow" href="client/client_get_activation_pdf.php?id={tmpl_var name='id'}" style="background: no-repeat center url('billing/lib/icon/pdficon_small.gif');" title="{tmpl_var name='show_pdf_txt'}"><span class="icon"> </span></a> |
| | | </tmpl_if> |
| | | </tmpl_if> |
| | | </tmpl_if> |
| | | <tmpl_if name="is_admin"> |
| | | <a class="btn btn-default formbutton-success formbutton-narrow" data-load-content="login/login_as.php?cid={tmpl_var name='id'}"><span class="icon icon-loginas"></span></a> |
| | | <tmpl_elseif name="is_reseller"> |
| | |
| | | </tr> |
| | | </tmpl_loop> |
| | | <tmpl_unless name="records"> |
| | | <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> |
| | | <td colspan="8">{tmpl_var name='globalsearch_noresults_text_txt'}</td> |
| | | <tr class="tbl_row_noresults tbl_row_{tmpl_if name='__EVEN__'}even{tmpl_else}uneven{/tmpl_if}"> |
| | | <td colspan="{tmpl_if name="has_robot"}9{tmpl_else}8{/tmpl_if}">{tmpl_var name='globalsearch_noresults_text_txt'}</td> |
| | | </tr> |
| | | </tmpl_unless> |
| | | </tbody> |
| | | <tfoot> |
| | | <tr> |
| | | <td colspan="8"><tmpl_var name="paging"></td> |
| | | <td colspan="{tmpl_if name="has_robot"}9{tmpl_else}8{/tmpl_if}"><tmpl_var name="paging"></td> |
| | | </tr> |
| | | </tfoot> |
| | | </table> |
| | |
| | | <tmpl_else> |
| | | <input type="hidden" name="domain_module" value="0" id="domain_module" /> |
| | | </tmpl_if> |
| | | <div class="col-sm-12"><button class="btn btn-default formbutton-default" type="button" data-toggle="collapse" data-target="#toggle-dkim" aria-expanded="false" aria-controls="toggle-dkim">{tmpl_var name='dkim_settings_txt'}</button></div> |
| | | <div class="col-sm-12" style="padding:0"><button class="btn btn-default formbutton-default" type="button" data-toggle="collapse" data-target="#toggle-dkim" aria-expanded="false" aria-controls="toggle-dkim">{tmpl_var name='dkim_settings_txt'}</button></div> |
| | | <div id="toggle-dkim" class="collapse"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='dkim_txt'}</label> |
| | |
| | | $sql_where .= ")"; |
| | | } |
| | | |
| | | if($php_type == 'php-fpm'){ |
| | | if($php_type == 'php-fpm' || ($php_type == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where, $server_id); |
| | | } elseif($php_type == 'fast-cgi'){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where, $server_id); |
| | |
| | | $php_select = ""; |
| | | if(is_array($php_records) && !empty($php_records)) { |
| | | foreach( $php_records as $php_record) { |
| | | if($php_type == 'php-fpm'){ |
| | | if($php_type == 'php-fpm' || ($php_type == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; |
| | | } else { |
| | | $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; |
| | |
| | | if ($type == 'getdirectivesnippet') { |
| | | $server_type = 'apache'; |
| | | $web_config = $app->getconf->get_server_config($server_id, 'web'); |
| | | if (!empty($web_config['server_type'])) |
| | | $server_type = $web_config['server_type']; |
| | | if (!empty($web_config['server_type'])) $server_type = $web_config['server_type']; |
| | | |
| | | $snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND type = ? ORDER BY name ASC", $server_type); |
| | | $m_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id > 0 AND type = ? ORDER BY name ASC", $server_type); |
| | | |
| | | $snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type); |
| | | |
| | | $json = json_encode($snippets); |
| | | $json = json_encode(array('m_snippets' => $m_snippets, 'snippets' => $snippets)); |
| | | } |
| | | |
| | | if($type == 'getclientssldata'){ |
| | |
| | | |
| | | $app->load('listform_actions'); |
| | | |
| | | $tmp_rec = $app->db->queryOneRecord("SELECT data from monitor_data WHERE type = 'database_size' ORDER BY created DESC"); |
| | | $tmp_rec = $app->db->queryAllRecords("SELECT server_id, data from monitor_data WHERE type = 'database_size' ORDER BY created DESC"); |
| | | $monitor_data = array(); |
| | | $tmp_array = unserialize($tmp_rec['data']); |
| | | if(is_array($tmp_rec)) { |
| | | for($i = 0; $i < count($tmp_rec); $i++) { |
| | | $tmp_array = unserialize($tmp_rec[$i]['data']); |
| | | $server_id = $tmp_rec[$i]['server_id']; |
| | | |
| | | foreach($tmp_array as $database_name => $data) { |
| | | $db_name = $data['database_name']; |
| | | foreach($tmp_array as $database_name => $data) { |
| | | $db_name = $data['database_name']; |
| | | |
| | | $temp = $app->db->queryOneRecord("SELECT client.username, web_database.database_quota FROM web_database, sys_group, client WHERE web_database.sys_groupid = sys_group.groupid AND sys_group.client_id = client.client_id AND web_database.database_name = ?", $db_name); |
| | | |
| | | $monitor_data[$db_name]['database_name'] = $data['database_name']; |
| | | $monitor_data[$db_name]['client'] = isset($temp['username']) ? $temp['username'] : ''; |
| | | $monitor_data[$db_name]['used'] = isset($data['size']) ? $data['size'] : 0; |
| | | $monitor_data[$db_name]['quota'] = isset($temp['database_quota']) ? $temp['database_quota'] : 0; |
| | | |
| | | unset($temp); |
| | | $temp = $app->db->queryOneRecord("SELECT client.username, web_database.database_quota FROM web_database, sys_group, client WHERE web_database.sys_groupid = sys_group.groupid AND sys_group.client_id = client.client_id AND web_database.database_name = ?", $db_name); |
| | | if(is_array($temp) && !empty($temp)) { |
| | | $monitor_data[$server_id.'.'.$db_name]['database_name'] = $data['database_name']; |
| | | $monitor_data[$server_id.'.'.$db_name]['client'] = isset($temp['username']) ? $temp['username'] : ''; |
| | | $monitor_data[$server_id.'.'.$db_name]['used'] = isset($data['size']) ? $data['size'] : 0; |
| | | $monitor_data[$server_id.'.'.$db_name]['quota'] = isset($temp['database_quota']) ? $temp['database_quota'] : 0; |
| | | } |
| | | unset($temp); |
| | | } |
| | | } |
| | | } |
| | | |
| | | class list_action extends listform_actions { |
| | |
| | | $rec['bgcolor'] = $this->DataRowColor; |
| | | |
| | | $database_name = $rec['database_name']; |
| | | |
| | | if(!empty($monitor_data[$rec['server_id'].'.'.$database_name])){ |
| | | $rec['database'] = $monitor_data[$rec['server_id'].'.'.$database_name]['database_name']; |
| | | $rec['client'] = $monitor_data[$rec['server_id'].'.'.$database_name]['client']; |
| | | $rec['server_name'] = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $rec['server_id'])['server_name']; |
| | | $rec['used'] = $monitor_data[$rec['server_id'].'.'.$database_name]['used']; |
| | | $rec['quota'] = $monitor_data[$rec['server_id'].'.'.$database_name]['quota']; |
| | | |
| | | $rec['database'] = $monitor_data[$database_name]['database_name']; |
| | | $rec['client'] = $monitor_data[$database_name]['client']; |
| | | $rec['server_name'] = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $rec['server_id'])['server_name']; |
| | | $rec['used'] = $monitor_data[$database_name]['used']; |
| | | $rec['quota'] = $monitor_data[$database_name]['quota']; |
| | | if($rec['quota'] == 0){ |
| | | $rec['quota'] = $app->lng('unlimited'); |
| | | $rec['percentage'] = ''; |
| | | } else { |
| | | if ($rec['used'] > 0 ) $rec['percentage'] = round(100 * intval($rec['used']) / ( intval($rec['quota'])*1024*1024) ).'%'; |
| | | $rec['quota'] .= ' MB'; |
| | | } |
| | | |
| | | if($rec['quota'] == 0){ |
| | | $rec['quota'] = $app->lng('unlimited'); |
| | | $rec['percentage'] = ''; |
| | | if ($rec['used'] > 0) $rec['used'] = $app->functions->formatBytes($rec['used']); |
| | | } else { |
| | | if ($rec['used'] > 0 ) $rec['percentage'] = round(100 * intval($rec['used']) / ( intval($rec['quota'])*1024*1024) ).'%'; |
| | | $rec['quota'] .= ' MB'; |
| | | $web_database = $app->db->queryOneRecord("SELECT * FROM web_database WHERE database_id = ?", $rec[$this->idx_key]); |
| | | $rec['database'] = $rec['database_name']; |
| | | $rec['server_name'] = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $web_database['server_id'])['server_name']; |
| | | $sys_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE groupid = ?", $web_database['sys_groupid']); |
| | | $client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", $sys_group['client_id']); |
| | | $rec['client'] = $client['username']; |
| | | $rec['used'] = 'n/a'; |
| | | $rec['quota'] = 'n/a'; |
| | | } |
| | | |
| | | if ($rec['used'] > 0) $rec['used'] = $app->functions->formatBytes($rec['used']); |
| | | |
| | | $rec['id'] = $rec[$this->idx_key]; |
| | | return $rec; |
| | | |
| | | return $rec; |
| | | } |
| | | |
| | | } |
| | |
| | | 'formtype' => 'SELECT', |
| | | 'default' => 'mysql', |
| | | 'value' => array( |
| | | 'mongo' => 'MongoDB', |
| | | /*'mongo' => 'MongoDB',*/ |
| | | 'mysql' => 'MySQL' |
| | | ) |
| | | ), |
| | |
| | | $vhostdomain_type = 'subdomain'; |
| | | $form_title = "Subdomain"; |
| | | $validator_function = 'sub_domain'; |
| | | $first_tab_title = "Subomain"; |
| | | $first_tab_title = "Subdomain"; |
| | | } elseif($_SESSION['s']['var']['vhostdomain_type'] == 'aliasdomain') { |
| | | $vhostdomain_type = 'aliasdomain'; |
| | | $form_title = "Aliasdomain"; |
| | | $validator_function = 'alias_domain'; |
| | | $first_tab_title = "Aliasomain"; |
| | | $first_tab_title = "Aliasdomain"; |
| | | } |
| | | } |
| | | |
| | |
| | | 'errmsg'=> 'domain_error_autosub' |
| | | ), |
| | | ); |
| | | $form['tabs']['domain']['fields']['web_folder'] = array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'validators' => array ( 0 => array ( 'type' => 'REGEX', |
| | | 'regex' => '@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@', |
| | | 'errmsg'=> 'web_folder_error_regex'), |
| | | ), |
| | | 'formtype' => 'TEXT', |
| | | 'default' => '', |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | | ); |
| | | } else { |
| | | $form['tabs']['domain']['fields']['parent_domain_id']['datasource'] = array ( |
| | | 'type' => 'SQL', |
| | |
| | | $form['tabs']['domain']['fields']['web_folder'] = array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'validators' => array ( 0 => array ( 'type' => 'REGEX', |
| | | 'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@', |
| | | 'regex' => '@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@', |
| | | 'errmsg'=> 'web_folder_error_regex'), |
| | | ), |
| | | 'formtype' => 'TEXT', |
| | |
| | | <tr> |
| | | <tmpl_if name="vhostdomain_type" value="domain"><th class="small-col" data-column="domain_id"><tmpl_var name="domain_id_txt"></th></tmpl_if> |
| | | <th class="tiny-col" data-column="active"><tmpl_var name="active_txt"></th> |
| | | <th data-column="sys_groupid"><tmpl_var name="sys_groupid_txt"></th> |
| | | <tmpl_if name="vhostdomain_type" value="domain"><th data-column="sys_groupid"><tmpl_var name="sys_groupid_txt"></th></tmpl_if> |
| | | <th data-column="server_id"><tmpl_var name="server_id_txt"></th> |
| | | <tmpl_if name="vhostdomain_type" op="!=" value="domain"><th data-column="parent_domain_id"><tmpl_var name="parent_domain_id_txt"></th></tmpl_if> |
| | | <th data-column="domain"><tmpl_if name='vhostdomain_type' op='==' value='domain'>{tmpl_var name="domain_txt"}</tmpl_if><tmpl_if name='vhostdomain_type' op='==' value='subdomain'>{tmpl_var name="subdomain_txt"}</tmpl_if><tmpl_if name='vhostdomain_type' op='==' value='aliasdomain'>{tmpl_var name="aliasdomain_txt"}</tmpl_if></th> |
| | |
| | | <tr> |
| | | <tmpl_if name="vhostdomain_type" value="domain"><td><input class="form-control" type="text" name="search_domain_id" value="{tmpl_var name='search_domain_id'}" /></td></tmpl_if> |
| | | <td><select class="form-control" name="search_active">{tmpl_var name='search_active'}</select></td> |
| | | <td><select class="form-control" name="search_sys_groupid">{tmpl_var name='search_sys_groupid'}</select></td> |
| | | <tmpl_if name="vhostdomain_type" value="domain"><td><select class="form-control" name="search_sys_groupid">{tmpl_var name='search_sys_groupid'}</select></td></tmpl_if> |
| | | <td><select class="form-control" name="search_server_id">{tmpl_var name='search_server_id'}</select></td> |
| | | <tmpl_if name="vhostdomain_type" op="!=" value="domain"><td><select class="form-control" name="search_parent_domain_id">{tmpl_var name='search_parent_domain_id'}</select></td></tmpl_if> |
| | | <td><input class="form-control" type="text" name="search_domain" value="{tmpl_var name='search_domain'}" /></td> |
| | |
| | | <tr> |
| | | <tmpl_if name="vhostdomain_type" value="domain"><td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="domain_id"}</a></td></tmpl_if> |
| | | <td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="active"}</a></td> |
| | | <td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="sys_groupid"}</a></td> |
| | | <tmpl_if name="vhostdomain_type" value="domain"><td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="sys_groupid"}</a></td></tmpl_if> |
| | | <td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="server_id"}</a></td> |
| | | <tmpl_if name="vhostdomain_type" op="!=" value="domain"><td><a href="#" data-load-content="sites/web_vhost_aliasdomain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="parent_domain_id"}</a></td></tmpl_if> |
| | | <td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="domain"}</a></td> |
| | |
| | | </tmpl_loop> |
| | | <tmpl_unless name="records"> |
| | | <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> |
| | | <td colspan="6">{tmpl_var name='globalsearch_noresults_text_txt'}</td> |
| | | <td colspan="{tmpl_if name="vhostdomain_type" value="domain"}6{/tmpl_else}5{/tmpl_if}">{tmpl_var name='globalsearch_noresults_text_txt'}</td> |
| | | </tr> |
| | | </tmpl_unless> |
| | | </tbody> |
| | | <tfoot> |
| | | <tr> |
| | | <td colspan="6"><tmpl_var name="paging"></td> |
| | | <td colspan="{tmpl_if name="vhostdomain_type" value="domain"}6{/tmpl_else}5{/tmpl_if}"><tmpl_var name="paging"></td> |
| | | </tr> |
| | | </tfoot> |
| | | </table> |
| | |
| | | <div class="form-group apache"> |
| | | <label for="allow_override" class="col-sm-3 control-label">{tmpl_var name='allow_override_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="allow_override" id="allow_override" value="{tmpl_var name='allow_override'}" class="form-control" /></div></div> |
| | | <div class="form-group nginx"> |
| | | <label for="http_port" class="col-sm-3 control-label">{tmpl_var name='http_port_txt'}</label> |
| | | <div class="col-sm-9"><input name="http_port" id="http_port" value="{tmpl_var name='http_port'}" type="text" class="form-control" /></div> |
| | | </div> |
| | | <div class="form-group nginx"> |
| | | <label for="https_port" class="col-sm-3 control-label">{tmpl_var name='https_port_txt'}</label> |
| | | <div class="col-sm-9"><input name="https_port" id="https_port" value="{tmpl_var name='https_port'}" type="text" class="form-control" /></div> |
| | | </div> |
| | | <div class="phpfpm"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='php_fpm_use_socket_txt'}</label> |
| | |
| | | <div class="form-group nginx"> |
| | | <label for="nginx_directives" class="col-sm-3 control-label">{tmpl_var name='nginx_directives_txt'}</label> |
| | | <div class="col-sm-9"><textarea class="form-control" name="nginx_directives" id="nginx_directives" rows='10' cols='50'>{tmpl_var name='nginx_directives'}</textarea> |
| | | <b>{tmpl_var name="available_nginx_directive_snippets_txt"}</b><br><br> {tmpl_var name="nginx_directive_snippets_txt"}<br>----<br><b> {tmpl_var name='variables_txt'}:</b> <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{FASTCGIPASS}</a> |
| | | <b>{tmpl_var name="available_nginx_directive_snippets_txt"}</b><br><br> {tmpl_var name="nginx_directive_snippets_txt"}<br>----<br><b> {tmpl_var name='variables_txt'}:</b> <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{FASTCGIPASS}</a>, <a href="javascript:void(0);" class="addPlaceholder">{PHPFALLBACKFASTCGIPASS}</a> |
| | | </div> |
| | | </div> |
| | | <div class="form-group proxy"> |
| | |
| | | {tmpl_var name='ip_address'} |
| | | </select></div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group" style="display:none"> |
| | | <label for="ipv6_address" class="col-sm-3 control-label">{tmpl_var name='ipv6_address_txt'}</label> |
| | | <div class="col-sm-9"><select name="ipv6_address" id="ipv6_address" class="form-control"> |
| | | {tmpl_var name='ipv6_address'} |
| | |
| | | {tmpl_var name='fastcgi_php_version'} |
| | | </select></div> |
| | | </div> |
| | | {tmpl_var name="directive_snippets_id"} |
| | | <div class="form-group"> |
| | | <label for="directive_snippets_id" class="col-sm-3 control-label">{tmpl_var name='directive_snippets_id_txt'}</label> |
| | | <div class="col-sm-9"><select name="directive_snippets_id" id="directive_snippets_id" class="form-control"> |
| | | {tmpl_var name='directive_snippets_id'} |
| | | </select></div> |
| | | </div> |
| | | {tmpl_hook name="field_enable_pagespeed"} |
| | | <div class="form-group nginx pagespeed"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='enable_pagespeed_txt'}</label> |
| | |
| | | var serverId; |
| | | var clientGroupId = jQuery('#client_group_id').val(); |
| | | var serverIdDisabled = jQuery('#server_id_disabled').val(); |
| | | var serverType; |
| | | if(serverIdDisabled > 0){ |
| | | serverId = serverIdDisabled; |
| | | } else { |
| | |
| | | } |
| | | adjustForm(true); |
| | | reloadFastcgiPHPVersions(true); |
| | | |
| | | |
| | | jQuery('#client_group_id').change(function(){ |
| | | clientGroupId = $(this).val(); |
| | | reloadWebIP(); |
| | | reloadFastcgiPHPVersions(); |
| | | }); |
| | | |
| | | if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm'){ |
| | | if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm' || (jQuery('#php').val() == 'hhvm' && serverType == 'nginx')){ |
| | | jQuery('.fastcgi_php_version:hidden').show(); |
| | | if(jQuery('#php').val() == 'hhvm'){ |
| | | jQuery('#fastcgi_php_version_txt').hide(); |
| | | jQuery('#fastcgi_php_fallback_version_txt').show(); |
| | | } else { |
| | | jQuery('#fastcgi_php_version_txt').show(); |
| | | jQuery('#fastcgi_php_fallback_version_txt').hide(); |
| | | } |
| | | } else { |
| | | jQuery('.fastcgi_php_version:visible').hide(); |
| | | } |
| | |
| | | |
| | | jQuery('#php').change(function(){ |
| | | reloadFastcgiPHPVersions(); |
| | | if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm'){ |
| | | if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm' || (jQuery(this).val() == 'hhvm' && serverType == 'nginx')){ |
| | | jQuery('.fastcgi_php_version:hidden').show(); |
| | | if(jQuery(this).val() == 'hhvm'){ |
| | | jQuery('#fastcgi_php_version_txt').hide(); |
| | | jQuery('#fastcgi_php_fallback_version_txt').show(); |
| | | } else { |
| | | jQuery('#fastcgi_php_version_txt').show(); |
| | | jQuery('#fastcgi_php_fallback_version_txt').hide(); |
| | | } |
| | | } else { |
| | | jQuery('.fastcgi_php_version:visible').hide(); |
| | | } |
| | |
| | | function adjustForm(noFormChange){ |
| | | jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) { |
| | | if(data.servertype == "nginx"){ |
| | | serverType = 'nginx'; |
| | | var selected = jQuery('#php').val(); |
| | | jQuery('.apache').hide(); |
| | | jQuery('.nginx').show(); |
| | |
| | | jQuery('#php option[value="mod"]').hide(); |
| | | jQuery('#php option[value="suphp"]').hide(); |
| | | } else { |
| | | serverType = 'apache'; |
| | | jQuery('.nginx').hide(); |
| | | jQuery('.apache').show(); |
| | | jQuery('#php option[value="fast-cgi"]').show(); |
| | |
| | | |
| | | function reloadDirectiveSnippets() { |
| | | jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getdirectivesnippet"}, function(data) { |
| | | var options = '<option value="0"></option>'; |
| | | for (var i = 0, len = data.length; i < len; i++) { |
| | | var options = '<option value="0">-</option>'; |
| | | options += "<optgroup label=\"{tmpl_var name='select_master_directive_snippet_txt'}\">"; |
| | | for (var i = 0, len = data['m_snippets'].length; i < len; i++) { |
| | | var isSelected = ''; |
| | | |
| | | if ($('#directive_snippets_id').val() == i + 1) { |
| | | isSelected = 'selected="selected"'; |
| | | } |
| | | |
| | | options += '<option ' + isSelected + ' value="' + data[i]['directive_snippets_id'] + '">' + data[i]['name'] + '</option>'; |
| | | options += '<option ' + isSelected + ' value="' + data['m_snippets'][i]['directive_snippets_id'] + '">' + data['m_snippets'][i]['name'] + '</option>'; |
| | | } |
| | | options += '</optgroup>'; |
| | | |
| | | options += "<optgroup label=\"{tmpl_var name='select_directive_snippet_txt'}\">"; |
| | | for (var i = 0, len = data['snippets'].length; i < len; i++) { |
| | | var isSelected = ''; |
| | | |
| | | if ($('#directive_snippets_id').val() == i + 1) { |
| | | isSelected = 'selected="selected"'; |
| | | } |
| | | |
| | | options += '<option ' + isSelected + ' value="' + data['snippets'][i]['directive_snippets_id'] + '">' + data['snippets'][i]['name'] + '</option>'; |
| | | } |
| | | options += '</optgroup>'; |
| | | |
| | | $('#directive_snippets_id').html(options).change(); |
| | | }); |
| | |
| | | ISPConfig.submitForm('pageForm','sites/web_vhost_domain_edit.php'); |
| | | }); |
| | | </tmpl_if> |
| | | |
| | | if($('#domain').val() == ''){ |
| | | $('#web_folder_domain').text('[DOMAIN]'); |
| | | } else { |
| | | $('#web_folder_domain').text($('#domain').val()); |
| | | } |
| | | $('#domain').bind('change keyup', function(){ |
| | | if($(this).val() == ''){ |
| | | $('#web_folder_domain').text('[DOMAIN]'); |
| | | } else { |
| | | $('#web_folder_domain').text($('#domain').val()); |
| | | } |
| | | }); |
| | | |
| | | $('#more_folder_directive_snippets').click(function(){ |
| | | $('.folder_directive_snippets:hidden:first').removeClass('hidden'); |
| | | }); |
| | | |
| | | </script> |
| | |
| | | if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; |
| | | |
| | | if($this->_vhostdomain_type == 'domain') { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']); |
| | | } |
| | | if($this->dataRecord['php'] == 'fast-cgi'){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']); |
| | | } |
| | | } else { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']); |
| | | } |
| | | if($this->dataRecord['php'] == 'fast-cgi'){ |
| | |
| | | $php_select = "<option value=''>Default</option>"; |
| | | if(is_array($php_records) && !empty($php_records)) { |
| | | foreach( $php_records as $php_record) { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; |
| | | } else { |
| | | $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; |
| | |
| | | $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id); |
| | | $sql_where = " AND (client_id = 0 OR client_id = ?)"; |
| | | if($this->_vhostdomain_type == 'domain') { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where, ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']); |
| | | } |
| | | if($this->dataRecord['php'] == 'fast-cgi') { |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where, ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']); |
| | | } |
| | | } else { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']); |
| | | } |
| | | if($this->dataRecord['php'] == 'fast-cgi') { |
| | |
| | | $php_select = "<option value=''>Default</option>"; |
| | | if(is_array($php_records) && !empty($php_records)) { |
| | | foreach( $php_records as $php_record) { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; |
| | | } else { |
| | | $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; |
| | |
| | | $sites_config = $app->getconf->get_global_config('sites'); |
| | | if($sites_config['reseller_can_use_options']) { |
| | | // Directive Snippets |
| | | $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); |
| | | $php_directive_snippets_txt = ''; |
| | | $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ |
| | | $php_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($php_directive_snippets as $php_directive_snippet){ |
| | | $php_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $php_directive_snippet['snippet'] . PHP_EOL; |
| | | $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> '; |
| | | $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $php_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ |
| | | $php_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($php_directive_snippets as $php_directive_snippet){ |
| | | $php_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $php_directive_snippet['snippet'] . PHP_EOL; |
| | | $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; |
| | | $app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt); |
| | | |
| | | if($server_type == 'apache'){ |
| | | $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); |
| | | $apache_directive_snippets_txt = ''; |
| | | $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ |
| | | $apache_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($apache_directive_snippets as $apache_directive_snippet){ |
| | | $apache_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $apache_directive_snippet['snippet'] . PHP_EOL; |
| | | $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> '; |
| | | $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $apache_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ |
| | | $apache_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($apache_directive_snippets as $apache_directive_snippet){ |
| | | $apache_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $apache_directive_snippet['snippet'] . PHP_EOL; |
| | | $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; |
| | |
| | | } |
| | | |
| | | if($server_type == 'nginx'){ |
| | | $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); |
| | | $nginx_directive_snippets_txt = ''; |
| | | $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ |
| | | $nginx_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($nginx_directive_snippets as $nginx_directive_snippet){ |
| | | $nginx_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $nginx_directive_snippet['snippet'] . PHP_EOL; |
| | | $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> '; |
| | | $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $nginx_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ |
| | | $nginx_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($nginx_directive_snippets as $nginx_directive_snippet){ |
| | | $nginx_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $nginx_directive_snippet['snippet'] . PHP_EOL; |
| | | $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; |
| | | $app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt); |
| | | } |
| | | |
| | | $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); |
| | | $proxy_directive_snippets_txt = ''; |
| | | $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ |
| | | $proxy_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($proxy_directive_snippets as $proxy_directive_snippet){ |
| | | $proxy_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $proxy_directive_snippet['snippet'] . PHP_EOL; |
| | | $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> '; |
| | | $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $proxy_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ |
| | | $proxy_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($proxy_directive_snippets as $proxy_directive_snippet){ |
| | | $proxy_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $proxy_directive_snippet['snippet'] . PHP_EOL; |
| | | $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; |
| | |
| | | unset($ips); |
| | | |
| | | if ($settings['use_domain_module'] != 'y') { |
| | | if(!isset($this->dataRecord["sys_groupid"])){ |
| | | $tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); |
| | | $this->dataRecord["sys_groupid"] = $tmp["sys_groupid"]; |
| | | } |
| | | // Fill the client select field |
| | | $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name"; |
| | | $clients = $app->db->queryAllRecords($sql); |
| | |
| | | $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id); |
| | | $sql_where = " AND (client_id = 0 OR client_id = ?)"; |
| | | if($this->_vhostdomain_type == 'domain') { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where, $server_id, $selected_client['client_id']); |
| | | } |
| | | if($this->dataRecord['php'] == 'fast-cgi') { |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where, $server_id, $selected_client['client_id']); |
| | | } |
| | | } else { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $parent_domain['server_id']); |
| | | } |
| | | if($this->dataRecord['php'] == 'fast-cgi') { |
| | |
| | | $php_select = "<option value=''>Default</option>"; |
| | | if(is_array($php_records) && !empty($php_records)) { |
| | | foreach( $php_records as $php_record) { |
| | | if($this->dataRecord['php'] == 'php-fpm'){ |
| | | if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ |
| | | $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; |
| | | } else { |
| | | $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; |
| | |
| | | foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y')); |
| | | |
| | | // Directive Snippets |
| | | $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); |
| | | $php_directive_snippets_txt = ''; |
| | | $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ |
| | | $php_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($php_directive_snippets as $php_directive_snippet){ |
| | | $php_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $php_directive_snippet['snippet'] . PHP_EOL; |
| | | $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> '; |
| | | $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $php_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ |
| | | $php_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($php_directive_snippets as $php_directive_snippet){ |
| | | $php_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $php_directive_snippet['snippet'] . PHP_EOL; |
| | | $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; |
| | | $app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt); |
| | | |
| | | if($server_type == 'apache'){ |
| | | $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); |
| | | $apache_directive_snippets_txt = ''; |
| | | $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ |
| | | $apache_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($apache_directive_snippets as $apache_directive_snippet){ |
| | | $apache_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $apache_directive_snippet['snippet'] . PHP_EOL; |
| | | $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> '; |
| | | $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $apache_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ |
| | | $apache_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($apache_directive_snippets as $apache_directive_snippet){ |
| | | $apache_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $apache_directive_snippet['snippet'] . PHP_EOL; |
| | | $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; |
| | |
| | | } |
| | | |
| | | if($server_type == 'nginx'){ |
| | | $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); |
| | | $nginx_directive_snippets_txt = ''; |
| | | $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ |
| | | $nginx_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($nginx_directive_snippets as $nginx_directive_snippet){ |
| | | $nginx_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $nginx_directive_snippet['snippet'] . PHP_EOL; |
| | | $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> '; |
| | | $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $nginx_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ |
| | | $nginx_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($nginx_directive_snippets as $nginx_directive_snippet){ |
| | | $nginx_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $nginx_directive_snippet['snippet'] . PHP_EOL; |
| | | $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; |
| | | $app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt); |
| | | } |
| | | |
| | | $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); |
| | | $proxy_directive_snippets_txt = ''; |
| | | $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y' AND master_directive_snippets_id > 0 ORDER BY name"); |
| | | if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ |
| | | $proxy_directive_snippets_txt .= $app->tform->wordbook["select_master_directive_snippet_txt"].'<br>'; |
| | | foreach($proxy_directive_snippets as $proxy_directive_snippet){ |
| | | $proxy_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $proxy_directive_snippet['snippet'] . PHP_EOL; |
| | | $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> '; |
| | | $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | $proxy_directive_snippets_txt .= '<br><br>'; |
| | | } |
| | | |
| | | $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y' AND master_directive_snippets_id = 0 ORDER BY name"); |
| | | if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ |
| | | $proxy_directive_snippets_txt .= $app->tform->wordbook["select_directive_snippet_txt"].'<br>'; |
| | | foreach($proxy_directive_snippets as $proxy_directive_snippet){ |
| | | $proxy_directive_snippet['snippet'] = PHP_EOL . PHP_EOL . $proxy_directive_snippet['snippet'] . PHP_EOL; |
| | | $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> '; |
| | | } |
| | | } |
| | | if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; |
| | |
| | | if($sys_config['use_combobox'] == 'y') { |
| | | $app->tpl->setVar('use_combobox', 'y'); |
| | | } |
| | | |
| | | $directive_snippets_id_select = '<option value="0"'.($this->dataRecord['directive_snippets_id'] == 0? ' selected="selected"' : '').'>-</option>'; |
| | | $server_type = $app->getconf->get_server_config($server_id, 'web'); |
| | | $server_type = $server_type['server_type']; |
| | | |
| | | $m_directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id > 0 AND type = ? ORDER BY name ASC", $server_type); |
| | | if(is_array($m_directive_snippets) && !empty($m_directive_snippets)){ |
| | | $directive_snippets_id_select .= '<optgroup label="'.$app->tform->wordbook["select_master_directive_snippet_txt"].'">'; |
| | | foreach($m_directive_snippets as $m_directive_snippet){ |
| | | $directive_snippets_id_select .= '<option value="'.$m_directive_snippet['directive_snippets_id'].'"'.($this->dataRecord['directive_snippets_id'] == $m_directive_snippet['directive_snippets_id']? ' selected="selected"' : '').'>'.$m_directive_snippet['name'].'</option>'; |
| | | } |
| | | $directive_snippets_id_select .= '</optgroup>'; |
| | | } |
| | | |
| | | $directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type); |
| | | if(is_array($directive_snippets) && !empty($directive_snippets)){ |
| | | $directive_snippets_id_select .= '<optgroup label="'.$app->tform->wordbook["select_directive_snippet_txt"].'">'; |
| | | foreach($directive_snippets as $directive_snippet){ |
| | | $directive_snippets_id_select .= '<option value="'.$directive_snippet['directive_snippets_id'].'"'.($this->dataRecord['directive_snippets_id'] == $directive_snippet['directive_snippets_id']? ' selected="selected"' : '').'>'.$directive_snippet['name'].'</option>'; |
| | | } |
| | | $directive_snippets_id_select .= '</optgroup>'; |
| | | } |
| | | $app->tpl->setVar("directive_snippets_id", $directive_snippets_id_select); |
| | | |
| | | // folder_directive_snippets |
| | | if(isset($_POST['folder_directive_snippets']) && !isset($this->dataRecord['folder_directive_snippets'])){ |
| | | $this->dataRecord['folder_directive_snippets'] = ''; |
| | | if(is_array($_POST['folder_directive_snippets']) && !empty($_POST['folder_directive_snippets'])){ |
| | | foreach($_POST['folder_directive_snippets'] as $folder_directive_snippet){ |
| | | if(trim($folder_directive_snippet['folder']) != '' && intval($folder_directive_snippet['snippets_id']) > 0) $this->dataRecord['folder_directive_snippets'] .= trim($folder_directive_snippet['folder']).':'.intval($folder_directive_snippet['snippets_id'])."\n"; |
| | | } |
| | | } |
| | | $this->dataRecord['folder_directive_snippets'] = trim($this->dataRecord['folder_directive_snippets']); |
| | | } |
| | | |
| | | $master_directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND snippet LIKE '%{FOLDER}%' AND master_directive_snippets_id > 0 AND type = ? ORDER BY name ASC", $server_type); |
| | | $c_directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND snippet LIKE '%{FOLDER}%' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type); |
| | | |
| | | $folder_directive_snippets = array(); |
| | | $this->dataRecord['folder_directive_snippets'] = str_replace("\r\n", "\n", $this->dataRecord['folder_directive_snippets']); |
| | | $this->dataRecord['folder_directive_snippets'] = str_replace("\r", "\n", $this->dataRecord['folder_directive_snippets']); |
| | | $folder_directive_snippets_lines = explode("\n", trim($this->dataRecord['folder_directive_snippets'])); |
| | | for($i=0;$i<sizeof($folder_directive_snippets_lines)+50;$i++){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_index'] = $i; |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_index_plus_1'] = $i + 1; |
| | | if($i > sizeof($folder_directive_snippets_lines)){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_css'] = 'hidden'; |
| | | } else { |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_css'] = ''; |
| | | } |
| | | if(trim($folder_directive_snippets_lines[$i]) != ''){ |
| | | list($folder_directive_snippets[$i]['folder_directive_snippets_folder'], $selected_snippet) = explode(':', trim($folder_directive_snippets_lines[$i])); |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] = '<option value="0">-</option>'; |
| | | if(is_array($master_directive_snippets) && !empty($master_directive_snippets)){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<optgroup label="'.$app->tform->wordbook["select_master_directive_snippet_txt"].'">'; |
| | | foreach($master_directive_snippets as $master_directive_snippet){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<option value="'.$master_directive_snippet['directive_snippets_id'].'"'.($master_directive_snippet['directive_snippets_id'] == $selected_snippet ? ' selected="selected"' : '').'>'.$master_directive_snippet['name'].'</option>'; |
| | | } |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '</optgroup>'; |
| | | } |
| | | |
| | | if(is_array($c_directive_snippets) && !empty($c_directive_snippets)){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<optgroup label="'.$app->tform->wordbook["select_directive_snippet_txt"].'">'; |
| | | foreach($c_directive_snippets as $c_directive_snippet){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<option value="'.$c_directive_snippet['directive_snippets_id'].'"'.($c_directive_snippet['directive_snippets_id'] == $selected_snippet? ' selected="selected"' : '').'>'.$c_directive_snippet['name'].'</option>'; |
| | | } |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '</optgroup>'; |
| | | } |
| | | } else { |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_folder'] = ''; |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] = '<option value="0">-</option>'; |
| | | if(is_array($master_directive_snippets) && !empty($master_directive_snippets)){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<optgroup label="'.$app->tform->wordbook["select_master_directive_snippet_txt"].'">'; |
| | | foreach($master_directive_snippets as $master_directive_snippet){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<option value="'.$master_directive_snippet['directive_snippets_id'].'">'.$master_directive_snippet['name'].'</option>'; |
| | | } |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '</optgroup>'; |
| | | } |
| | | |
| | | if(is_array($c_directive_snippets) && !empty($c_directive_snippets)){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<optgroup label="'.$app->tform->wordbook["select_directive_snippet_txt"].'">'; |
| | | foreach($c_directive_snippets as $c_directive_snippet){ |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '<option value="'.$c_directive_snippet['directive_snippets_id'].'">'.$c_directive_snippet['name'].'</option>'; |
| | | } |
| | | $folder_directive_snippets[$i]['folder_directive_snippets_id'] .= '</optgroup>'; |
| | | } |
| | | } |
| | | } |
| | | $app->tpl->setLoop('folder_directive_snippets', $folder_directive_snippets); |
| | | |
| | | parent::onShowEnd(); |
| | | } |
| | | |
| | |
| | | // restore the server ID if the user is not admin and record is edited |
| | | $tmp = $app->db->queryOneRecord("SELECT server_id, `system_user`, `system_group`, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ?", $this->id); |
| | | $this->dataRecord["server_id"] = $tmp["server_id"]; |
| | | $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed! |
| | | if($this->_vhostdomain_type != 'domain') $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed! |
| | | $this->dataRecord['system_user'] = $tmp['system_user']; |
| | | $this->dataRecord['system_group'] = $tmp['system_group']; |
| | | |
| | |
| | | unset($app->tform->formDef["tabs"]['ssl']['fields']['enable_spdy']); |
| | | } |
| | | if($this->dataRecord["directive_snippets_id"] < 1) $this->dataRecord["enable_pagespeed"] = 'n'; |
| | | |
| | | |
| | | //print_r($_POST['folder_directive_snippets']); |
| | | //print_r($_POST['folder_directive_snippets_id']); |
| | | if(isset($_POST['folder_directive_snippets'])){ |
| | | $this->dataRecord['folder_directive_snippets'] = ''; |
| | | if(is_array($_POST['folder_directive_snippets']) && !empty($_POST['folder_directive_snippets'])){ |
| | | $existing_directive_snippets_folders = array(); |
| | | foreach($_POST['folder_directive_snippets'] as $folder_directive_snippet){ |
| | | $folder_directive_snippet['folder'] = trim($folder_directive_snippet['folder']); |
| | | if($folder_directive_snippet['folder'] != '' && intval($folder_directive_snippet['snippets_id']) > 0){ |
| | | if(substr($folder_directive_snippet['folder'], -1) != '/') $folder_directive_snippet['folder'] .= '/'; |
| | | if(substr($folder_directive_snippet['folder'], 0, 1) == '/') $folder_directive_snippet['folder'] = substr($folder_directive_snippet['folder'], 1); |
| | | if(in_array($folder_directive_snippet['folder'], $existing_directive_snippets_folders)){ |
| | | $app->tform->errorMessage .= $app->tform->lng("config_for_folder_exists_already_txt").'<br>'; |
| | | } else { |
| | | $existing_directive_snippets_folders[] = $folder_directive_snippet['folder']; |
| | | } |
| | | $this->dataRecord['folder_directive_snippets'] .= $folder_directive_snippet['folder'].':'.intval($folder_directive_snippet['snippets_id'])."\n"; |
| | | } |
| | | if(!preg_match('@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@', $folder_directive_snippet['folder'])) $app->tform->errorMessage .= $app->tform->lng("web_folder_error_regex").'<br>'; |
| | | } |
| | | } |
| | | $this->dataRecord['folder_directive_snippets'] = trim($this->dataRecord['folder_directive_snippets']); |
| | | } |
| | | |
| | | parent::onSubmit(); |
| | | } |
| | | |
| | |
| | | $sql = "UPDATE web_domain SET sys_groupid = ?, system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = ?, added_by = ? WHERE domain_id = ?"; |
| | | $app->db->query($sql, $this->parent_domain_record['sys_groupid'], $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_date, $added_by, $this->id); |
| | | } |
| | | |
| | | if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); |
| | | } |
| | | |
| | | function onBeforeUpdate () { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | function onAfterUpdate() { |
| | | global $app, $conf; |
| | | |
| | | if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); |
| | | } |
| | | } |
| | | |
| | | $page = new page_action; |
| | |
| | | <tmpl_loop name="nav_left"> |
| | | <tmpl_if name="title"><header><tmpl_if name="startpage"><a href="#" class="subnav-header" data-load-content="<tmpl_var name='startpage'>"></tmpl_if><tmpl_var name="title"><tmpl_if name="startpage"></a></tmpl_if></header></tmpl_if> |
| | | <tmpl_if name="title"><header><tmpl_if name="is_link" op="!=" value="no"><tmpl_if name="startpage"><a href="#" onclick="return false;" class="subnav-header" data-load-content="<tmpl_var name='startpage'>"></tmpl_if></tmpl_if><tmpl_var name="title"><tmpl_if name="is_link" op="!=" value="no"><tmpl_if name="startpage"></a></tmpl_if></tmpl_if></header></tmpl_if> |
| | | <ul id="sub-navigation"> |
| | | <tmpl_loop name="items"> |
| | | <li<tmpl_if name="html_id"> id='<tmpl_var name="html_id">' </tmpl_if>> |
| | | <tmpl_if name="link"> |
| | | <tmpl_if name="target" op="==" value="_blank"> |
| | | <a href="<tmpl_var name='link'>" target="_blank"> |
| | | <tmpl_elseif name="target" op="==" value="_top"> |
| | | <a href="<tmpl_var name='link'>" target="_top"> |
| | | <tmpl_else> |
| | | <a href="#" data-load-content="<tmpl_var name='link'>"> |
| | | <a href="#" onclick="return false;" data-load-content="<tmpl_var name='link'>"> |
| | | </tmpl_if> |
| | | </tmpl_if> |
| | | <div> |
| | | <strong><tmpl_var name="title"></strong> |
| | | <div{tmpl_if name="css"} style="{tmpl_var name='css'}"{/tmpl_if}> |
| | | <tmpl_if name="title"><strong><tmpl_var name="title"></strong></tmpl_if> |
| | | <tmpl_if name="image"><div align="center"><tmpl_var name="image"></div></tmpl_if> |
| | | </div> |
| | | <tmpl_if name="link"> |
| | | </a> |
| | |
| | | ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock ; |
| | | fi |
| | | |
| | | umask 017 |
| | | umask 022 |
| | | sudo -u {SYSTEM_USER} touch /var/run/hhvm/hhvm_{SYSTEM_USER}.pid |
| | | |
| | | BASEINIFILE="" |
| | |
| | | server { |
| | | listen <tmpl_var name='ip_address'>:80; |
| | | listen <tmpl_var name='ip_address'>:<tmpl_var name='http_port'>; |
| | | <tmpl_if name='ipv6_enabled'> |
| | | listen [<tmpl_var name='ipv6_address'>]:80; |
| | | listen [<tmpl_var name='ipv6_address'>]:<tmpl_var name='http_port'>; |
| | | </tmpl_if> |
| | | |
| | | <tmpl_if name='ssl_enabled'> |
| | | listen <tmpl_var name='ip_address'>:443 ssl{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if}; |
| | | listen <tmpl_var name='ip_address'>:<tmpl_var name='https_port'> ssl{tmpl_if name='enable_http2' op='==' value='y'} http2{/tmpl_if}{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if}; |
| | | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
| | | <tmpl_if name='ipv6_enabled'> |
| | | listen [<tmpl_var name='ipv6_address'>]:443 ssl{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if}; |
| | | listen [<tmpl_var name='ipv6_address'>]:<tmpl_var name='https_port'> ssl{tmpl_if name='enable_http2' op='==' value='y'} http2{/tmpl_if}{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if}; |
| | | </tmpl_if> |
| | | ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt; |
| | | ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key; |
| | |
| | | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| | | #fastcgi_param PATH_INFO $fastcgi_script_name; |
| | | fastcgi_intercept_errors on; |
| | | error_page 500 501 502 503 = @phpfallback; |
| | | } |
| | | |
| | | location @phpfallback { |
| | | try_files $uri =404; |
| | | include /etc/nginx/fastcgi_params; |
| | | <tmpl_if name='use_tcp'> |
| | | fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>; |
| | | </tmpl_if> |
| | | <tmpl_if name='use_socket'> |
| | | fastcgi_pass unix:<tmpl_var name='fpm_socket'>; |
| | | </tmpl_if> |
| | | fastcgi_index index.php; |
| | | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| | | #fastcgi_param PATH_INFO $fastcgi_script_name; |
| | | fastcgi_intercept_errors on; |
| | | } |
| | | </tmpl_else> |
| | | |
| | |
| | | |
| | | </tmpl_loop> |
| | | <tmpl_if name='ssl_enabled'> |
| | | <tmpl_else> |
| | | <tmpl_if name='rewrite_to_https' op='==' value='y'> |
| | | RewriteCond %{HTTPS} off |
| | | RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
| | |
| | | |
| | | |
| | | public function getSchedule() { |
| | | return $this->_schedule; |
| | | global $app, $conf; |
| | | |
| | | $class = get_class($this); |
| | | |
| | | switch ($class) { |
| | | case 'cronjob_backup': |
| | | $app->uses('ini_parser,getconf'); |
| | | $server_id = $conf['server_id']; |
| | | $server_conf = $app->getconf->get_server_config($server_id, 'server'); |
| | | if(isset($server_conf['backup_time']) && $server_conf['backup_time'] != ''){ |
| | | list($hour, $minute) = explode(':', $server_conf['backup_time']); |
| | | $schedule = $minute.' '.$hour.' * * *'; |
| | | } else { |
| | | $schedule = '0 0 * * *'; |
| | | } |
| | | break; |
| | | /*case 'cronjob_backup_mail': |
| | | $schedule = '1 0 * * *'; |
| | | break;*/ |
| | | default: |
| | | $schedule = $this->_schedule; |
| | | } |
| | | |
| | | return $schedule; |
| | | } |
| | | |
| | | |
| | |
| | | public function run() { |
| | | |
| | | print "Called run() for class " . get_class($this) . "\n"; |
| | | print "Job has schedule: " . $this->_schedule . "\n"; |
| | | print "Job has schedule: " . $this->getSchedule() . "\n"; |
| | | $this->onPrepare(); |
| | | $run_it = $this->onBeforeRun(); |
| | | if($run_it == true) { |
| | |
| | | if($this->_run_at_new == true) { |
| | | $this->_next_run = ISPConfigDateTime::dbtime(); // run now. |
| | | } else { |
| | | $app->cron->parseCronLine($this->_schedule); |
| | | $app->cron->parseCronLine($this->getSchedule()); |
| | | $next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime()); |
| | | $this->_next_run = $next_run; |
| | | |
| | |
| | | // next_run time reached (reached === 0 or -1) |
| | | |
| | | // calculare next run time based on last_run or current time |
| | | $app->cron->parseCronLine($this->_schedule); |
| | | $app->cron->parseCronLine($this->getSchedule()); |
| | | if($this->_no_skip == true) { |
| | | // we need to calculare the next run based on the previous next_run, as we may not skip one. |
| | | $next_run = $app->cron->getNextRun($this->_next_run); |
| | |
| | | } else { |
| | | $cmd = $app->system->getinitcommand($daemon, 'reload'); |
| | | } |
| | | |
| | | if($web_config['server_type'] == 'nginx'){ |
| | | $app->log("Checking nginx configuration...", LOGLEVEL_DEBUG); |
| | | exec('nginx -t 2>&1', $retval['output'], $retval['retval']); |
| | | if($retval['retval'] == 0){ |
| | | $app->log("nginx configuration ok!", LOGLEVEL_DEBUG); |
| | | } else { |
| | | $app->log("nginx config test failed!", LOGLEVEL_DEBUG); |
| | | return $retval; |
| | | } |
| | | } |
| | | |
| | | exec($cmd.' 2>&1', $retval['output'], $retval['retval']); |
| | | |
| | | // if restart failed despite successful syntax check => try again |
| | | if($web_config['server_type'] == 'nginx' && $retval['retval'] > 0){ |
| | | sleep(2); |
| | | exec($cmd.' 2>&1', $retval['output'], $retval['retval']); |
| | | } |
| | | $app->log("Restarting httpd: $cmd", LOGLEVEL_DEBUG); |
| | | |
| | | // nginx: do a syntax check because on some distributions, the init script always returns 0 - even if the syntax is not ok (how stupid is that?) |
| | | if($web_config['server_type'] == 'nginx' && $retval['retval'] == 0){ |
| | | exec('nginx -t 2>&1', $retval['output'], $retval['retval']); |
| | | } |
| | | //if($web_config['server_type'] == 'nginx' && $retval['retval'] == 0){ |
| | | //exec('nginx -t 2>&1', $retval['output'], $retval['retval']); |
| | | //} |
| | | return $retval; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if(intval($web_data['directive_snippets_id']) > 0){ |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($web_data['directive_snippets_id'])); |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($web_data['directive_snippets_id'])); |
| | | if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ |
| | | $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); |
| | | if(is_array($required_php_snippets) && !empty($required_php_snippets)){ |
| | |
| | | $php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini'])); |
| | | |
| | | if(intval($data['new']['directive_snippets_id']) > 0){ |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); |
| | | if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ |
| | | $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); |
| | | if(is_array($required_php_snippets) && !empty($required_php_snippets)){ |
| | |
| | | $monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master'); |
| | | } |
| | | |
| | | if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) { |
| | | if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || (isset($data['old']['custom_php_ini']) && $data['new']['custom_php_ini'] != $data['old']['custom_php_ini'])) { |
| | | |
| | | // Custom php.ini settings |
| | | $custom_php_ini_settings = trim($data['new']['custom_php_ini']); |
| | | if(intval($data['new']['directive_snippets_id']) > 0){ |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); |
| | | if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ |
| | | $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); |
| | | if(is_array($required_php_snippets) && !empty($required_php_snippets)){ |
| | | foreach($required_php_snippets as $required_php_snippet){ |
| | | $required_php_snippet = intval($required_php_snippet); |
| | | if($required_php_snippet > 0){ |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet['snippet'] = trim($php_snippet['snippet']); |
| | | if($php_snippet['snippet'] != ''){ |
| | | $custom_php_ini_settings .= "\n".$php_snippet['snippet']; |
| | |
| | | $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); |
| | | file_put_contents('/etc/hhvm/'.$data['new']['system_user'].'.ini', $custom_php_ini_settings); |
| | | } else { |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | if($data['old']['system_user'] != '' && is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | } |
| | | |
| | | $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); |
| | |
| | | } |
| | | |
| | | } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { |
| | | exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); |
| | | exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); |
| | | unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | if($data['old']['system_user'] != ''){ |
| | | exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); |
| | | exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); |
| | | unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | } |
| | | |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ |
| | |
| | | foreach($required_php_snippets as $required_php_snippet){ |
| | | $required_php_snippet = intval($required_php_snippet); |
| | | if($required_php_snippet > 0){ |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet['snippet'] = trim($php_snippet['snippet']); |
| | | if($php_snippet['snippet'] != ''){ |
| | | $custom_php_ini_settings .= "\n".$php_snippet['snippet']; |
| | |
| | | $log_folder = 'log'; |
| | | $old_web_folder = 'web'; |
| | | $old_log_folder = 'log'; |
| | | if($data['new']['type'] == 'vhost'){ |
| | | if($data['new']['web_folder'] != ''){ |
| | | if(substr($data['new']['web_folder'],0,1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],1); |
| | | if(substr($data['new']['web_folder'],-1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],0,-1); |
| | | } |
| | | $web_folder .= '/'.$data['new']['web_folder']; |
| | | |
| | | if($data['old']['web_folder'] != ''){ |
| | | if(substr($data['old']['web_folder'],0,1) == '/') $data['old']['web_folder'] = substr($data['old']['web_folder'],1); |
| | | if(substr($data['old']['web_folder'],-1) == '/') $data['old']['web_folder'] = substr($data['old']['web_folder'],0,-1); |
| | | } |
| | | $old_web_folder .= '/'.$data['old']['web_folder']; |
| | | } |
| | | if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { |
| | | // new one |
| | | $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['new']['parent_domain_id']); |
| | |
| | | } |
| | | |
| | | //* Unmount the old log directory bfore we move the log dir |
| | | //exec('fuser -km '.escapeshellcmd($old_dir.'/log')); |
| | | exec('umount '.escapeshellcmd($data['old']['document_root'].'/log')); |
| | | exec('umount '.escapeshellcmd($old_dir.'/log')); |
| | | |
| | | //* Create new base directory, if it does not exist yet |
| | | if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); |
| | |
| | | if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user'])); |
| | | |
| | | //* If the security level is set to high |
| | | if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) { |
| | | if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost') or ($web_folder != $old_web_folder && $data['new']['type'] == 'vhost')) { |
| | | |
| | | $app->system->web_folder_protection($data['new']['document_root'], false); |
| | | |
| | |
| | | //$app->system->chmod($data['new']['document_root'].'/webdav',0710); |
| | | $app->system->chmod($data['new']['document_root'].'/private', 0710); |
| | | $app->system->chmod($data['new']['document_root'].'/ssl', 0755); |
| | | if($web_folder != 'web') $app->system->chmod($data['new']['document_root'].'/'.$web_folder, 0751); |
| | | |
| | | // make tmp directory writable for nginx and the website users |
| | | $app->system->chmod($data['new']['document_root'].'/tmp', 0770); |
| | |
| | | //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); |
| | | $app->system->chown($data['new']['document_root'].'/private', $username); |
| | | $app->system->chgrp($data['new']['document_root'].'/private', $groupname); |
| | | |
| | | if($web_folder != 'web'){ |
| | | $app->system->chown($data['new']['document_root'].'/'.$web_folder, $username); |
| | | $app->system->chgrp($data['new']['document_root'].'/'.$web_folder, $groupname); |
| | | } |
| | | |
| | | // If the security Level is set to medium |
| | | } else { |
| | |
| | | //$app->system->chmod($data['new']['document_root'].'/webdav',0755); |
| | | $app->system->chmod($data['new']['document_root'].'/ssl', 0755); |
| | | $app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755); |
| | | if($web_folder != 'web') $app->system->chmod($data['new']['document_root'].'/'.$web_folder, 0755); |
| | | |
| | | // make temp directory writable for nginx and the website users |
| | | $app->system->chmod($data['new']['document_root'].'/tmp', 0770); |
| | |
| | | $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); |
| | | //$app->system->chown($data['new']['document_root'].'/webdav',$username); |
| | | //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); |
| | | |
| | | if($web_folder != 'web'){ |
| | | $app->system->chown($data['new']['document_root'].'/'.$web_folder, $username); |
| | | $app->system->chgrp($data['new']['document_root'].'/'.$web_folder, $groupname); |
| | | } |
| | | } |
| | | } elseif((($data['new']['type'] == 'vhostsubdomain') || ($data['new']['type'] == 'vhostalias')) && |
| | | (($this->action == 'insert') || ($web_config['set_folder_permissions_on_update'] == 'y'))) { |
| | |
| | | $default_php_fpm = true; |
| | | } |
| | | */ |
| | | if($data['new']['php'] == 'php-fpm'){ |
| | | if($data['new']['php'] == 'php-fpm' || $data['new']['php'] == 'hhvm'){ |
| | | if(trim($data['new']['fastcgi_php_version']) != ''){ |
| | | $default_php_fpm = false; |
| | | list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); |
| | |
| | | $nginx_directives = $data['new']['nginx_directives']; |
| | | $vhost_data['enable_pagespeed'] = false; |
| | | } |
| | | |
| | | // folder_directive_snippets |
| | | if(trim($data['new']['folder_directive_snippets']) != ''){ |
| | | $data['new']['folder_directive_snippets'] = trim($data['new']['folder_directive_snippets']); |
| | | $data['new']['folder_directive_snippets'] = str_replace("\r\n", "\n", $data['new']['folder_directive_snippets']); |
| | | $data['new']['folder_directive_snippets'] = str_replace("\r", "\n", $data['new']['folder_directive_snippets']); |
| | | $folder_directive_snippets_lines = explode("\n", $data['new']['folder_directive_snippets']); |
| | | |
| | | if(is_array($folder_directive_snippets_lines) && !empty($folder_directive_snippets_lines)){ |
| | | foreach($folder_directive_snippets_lines as $folder_directive_snippets_line){ |
| | | list($folder_directive_snippets_folder, $folder_directive_snippets_snippets_id) = explode(':', $folder_directive_snippets_line); |
| | | |
| | | $folder_directive_snippets_folder = trim($folder_directive_snippets_folder); |
| | | $folder_directive_snippets_snippets_id = trim($folder_directive_snippets_snippets_id); |
| | | |
| | | if($folder_directive_snippets_folder != '' && intval($folder_directive_snippets_snippets_id) > 0 && preg_match('@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@', $folder_directive_snippets_folder)){ |
| | | if(substr($folder_directive_snippets_folder, -1) != '/') $folder_directive_snippets_folder .= '/'; |
| | | if(substr($folder_directive_snippets_folder, 0, 1) == '/') $folder_directive_snippets_folder = substr($folder_directive_snippets_folder, 1); |
| | | |
| | | $master_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($folder_directive_snippets_snippets_id)); |
| | | if(isset($master_snippet['snippet'])){ |
| | | $folder_directive_snippets_trans = array('{FOLDER}' => $folder_directive_snippets_folder, '{FOLDERMD5}' => md5($folder_directive_snippets_folder)); |
| | | $master_snippet['snippet'] = strtr($master_snippet['snippet'], $folder_directive_snippets_trans); |
| | | $nginx_directives .= "\n\n".$master_snippet['snippet']; |
| | | |
| | | // create folder it it does not exist |
| | | if(!is_dir($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder)){ |
| | | $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder); |
| | | $app->system->chown($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder, $username); |
| | | $app->system->chgrp($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder, $groupname); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // use vLib for template logic |
| | | $nginx_directives_new = ''; |
| | | $ngx_conf_tpl = new tpl(); |
| | | $ngx_conf_tpl_tmp_file = tempnam($conf['temppath'], "ngx"); |
| | | file_put_contents($ngx_conf_tpl_tmp_file, $nginx_directives); |
| | | $ngx_conf_tpl->newTemplate($ngx_conf_tpl_tmp_file); |
| | | $ngx_conf_tpl->setVar('use_tcp', $use_tcp); |
| | | $ngx_conf_tpl->setVar('use_socket', $use_socket); |
| | | $ngx_conf_tpl->setVar('fpm_socket', $fpm_socket); |
| | | $ngx_conf_tpl->setVar($vhost_data); |
| | | $nginx_directives_new = $ngx_conf_tpl->grab(); |
| | | if(is_file($ngx_conf_tpl_tmp_file)) unlink($ngx_conf_tpl_tmp_file); |
| | | if($nginx_directives_new != '') $nginx_directives = $nginx_directives_new; |
| | | unset($nginx_directives_new); |
| | | |
| | | // Make sure we only have Unix linebreaks |
| | | $nginx_directives = str_replace("\r\n", "\n", $nginx_directives); |
| | | $nginx_directives = str_replace("\r", "\n", $nginx_directives); |
| | |
| | | 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), |
| | | 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); |
| | | } |
| | | } |
| | | |
| | | // http2 or spdy? |
| | | $vhost_data['enable_http2'] = 'n'; |
| | | if($vhost_data['enable_spdy'] == 'y'){ |
| | | // check if nginx support http_v2; if so, use that instead of spdy |
| | | exec("2>&1 nginx -V | tr -- - '\n' | grep http_v2_module", $tmp_output, $tmp_retval); |
| | | if($tmp_retval == 0){ |
| | | $vhost_data['enable_http2'] = 'y'; |
| | | $vhost_data['enable_spdy'] = 'n'; |
| | | } |
| | | unset($tmp_output, $tmp_retval); |
| | | } |
| | | |
| | | $tpl->setVar($vhost_data); |
| | |
| | | $this->php_fpm_pool_delete($data, $web_config); |
| | | } elseif($data['old']['php'] == 'hhvm') { |
| | | $this->hhvm_update($data, $web_config); |
| | | $this->php_fpm_pool_delete($data, $web_config); |
| | | } |
| | | |
| | | //remove the php cgi starter script if available |
| | |
| | | $monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master'); |
| | | } |
| | | |
| | | if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) { |
| | | if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || (isset($data['old']['custom_php_ini']) && isset($data['new']['custom_php_ini']) && $data['new']['custom_php_ini'] != $data['old']['custom_php_ini'])) { |
| | | |
| | | // Custom php.ini settings |
| | | $custom_php_ini_settings = trim($data['new']['custom_php_ini']); |
| | |
| | | foreach($required_php_snippets as $required_php_snippet){ |
| | | $required_php_snippet = intval($required_php_snippet); |
| | | if($required_php_snippet > 0){ |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet['snippet'] = trim($php_snippet['snippet']); |
| | | if($php_snippet['snippet'] != ''){ |
| | | $custom_php_ini_settings .= "\n".$php_snippet['snippet']; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if($custom_php_ini_settings != ''){ |
| | | // Make sure we only have Unix linebreaks |
| | | $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); |
| | | $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); |
| | | file_put_contents('/etc/hhvm/'.$data['new']['system_user'].'.ini', $custom_php_ini_settings); |
| | | } else { |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | if($data['old']['system_user'] != '' && is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | } |
| | | |
| | | $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); |
| | |
| | | } |
| | | |
| | | } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { |
| | | exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); |
| | | exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); |
| | | unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | if($data['old']['system_user'] != ''){ |
| | | exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); |
| | | exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); |
| | | unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | } |
| | | |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['old']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user'])){ |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['old']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/hhvm_' . $data['old']['system_user']); |
| | | } |
| | | if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user']); |
| | | if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user']); |
| | | } |
| | | exec('/etc/init.d/monit restart >/dev/null 2>&1'); |
| | | } |
| | |
| | | $default_php_fpm = true; |
| | | } |
| | | */ |
| | | if($data['new']['php'] == 'php-fpm'){ |
| | | // HHVM => PHP-FPM-Fallback |
| | | if($data['new']['php'] == 'php-fpm' || $data['new']['php'] == 'hhvm'){ |
| | | if(trim($data['new']['fastcgi_php_version']) != ''){ |
| | | $default_php_fpm = false; |
| | | list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); |
| | |
| | | $app->uses("getconf"); |
| | | $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); |
| | | |
| | | if($data['new']['php'] != 'php-fpm'){ |
| | | // HHVM => PHP-FPM-Fallback |
| | | if($data['new']['php'] != 'php-fpm' && $data['new']['php'] != 'hhvm'){ |
| | | if(@is_file($pool_dir.$pool_name.'.conf')){ |
| | | $app->system->unlink($pool_dir.$pool_name.'.conf'); |
| | | //$reload = true; |
| | |
| | | foreach($required_php_snippets as $required_php_snippet){ |
| | | $required_php_snippet = intval($required_php_snippet); |
| | | if($required_php_snippet > 0){ |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); |
| | | $php_snippet['snippet'] = trim($php_snippet['snippet']); |
| | | if($php_snippet['snippet'] != ''){ |
| | | $custom_php_ini_settings .= "\n".$php_snippet['snippet']; |
| | |
| | | file_put_contents($bashrc, $tpl->grab()); |
| | | unset($tpl); |
| | | |
| | | $this->app->log("Added bashrc script : ".$bashrc, LOGLEVEL_DEBUG); |
| | | $this->app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); |
| | | |
| | | $tpl = new tpl(); |
| | | $tpl->newTemplate("motd.master"); |
| | |
| | | |
| | | function _add_jailkit_programs() |
| | | { |
| | | //copy over further programs and its libraries |
| | | $command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh'; |
| | | $command .= ' '.escapeshellcmd($this->data['new']['dir']); |
| | | $command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\''; |
| | | exec($command.' 2>/dev/null'); |
| | | $jailkit_chroot_app_programs = preg_split("/[\s,]+/", $this->jailkit_config['jailkit_chroot_app_programs']); |
| | | if(is_array($jailkit_chroot_app_programs) && !empty($jailkit_chroot_app_programs)){ |
| | | foreach($jailkit_chroot_app_programs as $jailkit_chroot_app_program){ |
| | | $jailkit_chroot_app_program = trim($jailkit_chroot_app_program); |
| | | if(is_file($jailkit_chroot_app_program) || is_dir($jailkit_chroot_app_program)){ |
| | | //copy over further programs and its libraries |
| | | $command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh'; |
| | | $command .= ' '.escapeshellcmd($this->data['new']['dir']); |
| | | $command .= ' '.$jailkit_chroot_app_program; |
| | | exec($command.' 2>/dev/null'); |
| | | |
| | | $this->app->log("Added programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG); |
| | | $this->app->log("Added programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | function _get_home_dir($username) |