/** * genHTMLform function. * * @access public * @static * @param array $formdata (default: array()) * @param array $data (default: array()) * @return void */ public static function genHTMLform($formdata = array(), $data = false) { global $lng, $theme; self::$_form = ''; // Parse each group foreach ($formdata as $groupdata) { if (!isset($groupdata['visible']) || $groupdata['visible'] !== false) { // Output Section Heading if (isset($groupdata['title'])) { $grouptitle = $groupdata['title']; eval("self::\$_form .= \"" . getTemplate("htmlform/group_heading", "1") . "\";"); } // Generate Group Fields foreach ($groupdata['fields'] as $fieldname => $fielddata) { if (isset($fielddata['visible'])) { if ($fielddata['visible'] == false) { continue; } elseif ($fielddata['visible'] === 'new' && is_array($data)) { continue; } elseif ($fielddata['visible'] === 'edit' && !is_array($data)) { continue; } } // Set value if given if (!empty($data)) { $fielddata = self::_setValue($fieldname, $fielddata, $data); } $field = self::_parseDataField($fieldname, $fielddata); $label = $fielddata['label'] . self::_getMandatoryFlag($fielddata); if (isset($fielddata['desc']) && $fielddata['desc'] != "") { $desc = $fielddata['desc']; } else { $desc = ''; } switch ($fielddata['type']) { case 'checkbox': eval("self::\$_form .= \"" . getTemplate("htmlform/skeleton_checkbox", "1") . "\";"); break; default: eval("self::\$_form .= \"" . getTemplate("htmlform/skeleton", "1") . "\";"); break; } } } } eval("self::\$_form .= \"" . getTemplate("htmlform/form_end", "1") . "\";"); return self::$_form; }
$admin_update_query .= " - 0" . (int) $result['diskspace'] . " "; } } $admin_update_query .= " WHERE `adminid` = '" . (int) $result['adminid'] . "'"; Database::query($admin_update_query); $log->logAction(ADM_ACTION, LOG_INFO, "edited user '" . $result['loginname'] . "'"); /* * move customer to another admin/reseller; #1166 */ if ($move_to_admin > 0 && $move_to_admin != $result['adminid']) { $move_result = moveCustomerToAdmin($id, $move_to_admin); if ($move_result != true) { standard_error('moveofcustomerfailed', $move_result); } } $redirect_props = array('page' => $page, 's' => $s); redirectTo($filename, $redirect_props); } } else { $dec_places = Settings::Get('panel.decimal_places'); $result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places); $result['diskspace'] = round($result['diskspace'] / 1024, $dec_places); $result['email'] = $idna_convert->decode($result['email']); $result = htmlentities_array($result); $customer_edit_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/formfield.customer.php'); $customer_edit_form = HTMLform2::genHTMLform($customer_edit_data, $result); eval("echo \"" . getTemplate("customers/customers_edit") . "\";"); } } } }
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile); } if (strlen(trim($docroot)) > 0) { $docroot = makeCorrectDir($docroot); } else { $docroot = ''; } if ($result['ip'] != $ip && $result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport['id'] == '') { standard_error('cantchangesystemip'); } elseif ($result_checkfordouble['id'] != '' && $result_checkfordouble['id'] != $id) { standard_error('myipnotdouble'); } else { $upd_stmt = Database::prepare("\n\t\t\t\t\t\tUPDATE `" . TABLE_PANEL_IPSANDPORTS . "`\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t`ip` = :ip, `port` = :port, `listen_statement` = :ls,\n\t\t\t\t\t\t\t`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,\n\t\t\t\t\t\t\t`vhostcontainer_servername_statement` = :vhcss,\n\t\t\t\t\t\t\t`specialsettings` = :ss, `ssl` = :ssl,\n\t\t\t\t\t\t\t`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,\n\t\t\t\t\t\t\t`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,\n\t\t\t\t\t\t\t`default_vhostconf_domain` = :dvhd, `docroot` = :docroot\n\t\t\t\t\t\tWHERE `id` = :id;\n\t\t\t\t\t"); $upd_data = array('ip' => $ip, 'port' => $port, 'ls' => $listen_statement, 'nvhs' => $namevirtualhost_statement, 'vhc' => $vhostcontainer, 'vhcss' => $vhostcontainer_servername_statement, 'ss' => $specialsettings, 'ssl' => $ssl, 'ssl_cert' => $ssl_cert_file, 'ssl_key' => $ssl_key_file, 'ssl_ca' => $ssl_ca_file, 'ssl_chain' => $ssl_cert_chainfile, 'dvhd' => $default_vhostconf_domain, 'docroot' => $docroot, 'id' => $id); Database::pexecute($upd_stmt, $upd_data); $log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'"); inserttask('1'); // Using nameserver, insert a task which rebuilds the server config inserttask('4'); redirectTo($filename, array('page' => $page, 's' => $s)); } } else { $result = htmlentities_array($result); $ipsandports_edit_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/formfield.ipsandports.php'); $ipsandports_edit_form = HTMLform2::genHTMLForm($ipsandports_edit_data, $result); $title = $lng['admin']['ipsandports']['edit']; eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";"); } } } }
} elseif (Settings::Get('phpfpm.enabled') == 1) { $fpm_enableslowlog = isset($_POST['fpm_slowlog']) ? (int) $_POST['fpm_slowlog'] : 0; $fpm_reqtermtimeout = validate($_POST['fpm_reqterm'], 'fpm_reqterm', '/^([0-9]+)(|s|m|h|d)$/'); $fpm_reqslowtimeout = validate($_POST['fpm_reqslow'], 'fpm_reqslow', '/^([0-9]+)(|s|m|h|d)$/'); // disable fcgid stuff $binary = '/usr/bin/php-cgi'; $file_extensions = 'php'; $mod_fcgid_starter = 0; $mod_fcgid_maxrequests = 0; $mod_fcgid_umask = "022"; } if (strlen($description) == 0 || strlen($description) > 50) { standard_error('descriptioninvalid'); } $upd_stmt = Database::prepare("\n\t\t\t\t\tUPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET\n\t\t\t\t\t\t`description` = :desc,\n\t\t\t\t\t\t`binary` = :binary,\n\t\t\t\t\t\t`file_extensions` = :fext,\n\t\t\t\t\t\t`mod_fcgid_starter` = :starter,\n\t\t\t\t\t\t`mod_fcgid_maxrequests` = :mreq,\n\t\t\t\t\t\t`mod_fcgid_umask` = :umask,\n\t\t\t\t\t\t`fpm_slowlog` = :fpmslow,\n\t\t\t\t\t\t`fpm_reqterm` = :fpmreqterm,\n\t\t\t\t\t\t`fpm_reqslow` = :fpmreqslow,\n\t\t\t\t\t\t`phpsettings` = :phpsettings\n\t\t\t\t\tWHERE `id` = :id"); $upd_data = array('desc' => $description, 'binary' => $binary, 'fext' => $file_extensions, 'starter' => $mod_fcgid_starter, 'mreq' => $mod_fcgid_maxrequests, 'umask' => $mod_fcgid_umask, 'fpmslow' => $fpm_enableslowlog, 'fpmreqterm' => $fpm_reqtermtimeout, 'fpmreqslow' => $fpm_reqslowtimeout, 'phpsettings' => $phpsettings, 'id' => $id); Database::pexecute($upd_stmt, $upd_data); inserttask('1'); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'"); redirectTo($filename, array('page' => $page, 's' => $s)); } else { $phpconfig_edit_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/formfield.phpconfig.php'); $phpconfig_edit_form = HTMLform2::genHTMLForm($phpconfig_edit_data, $result); $title = $lng['admin']['phpsettings']['editsettings']; eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";"); } } else { standard_error('nopermissionsorinvalidid'); } } }
} if ($res_warning != "") { $link = ''; $error = $res_warning; eval("echo \"" . getTemplate('misc/error', '1') . "\";"); exit; } $upd_data = array('password' => $password, 'name' => $name, 'email' => $email, 'lang' => $def_language, 'change_serversettings' => $change_serversettings, 'customers' => $customers, 'customers_see_all' => $customers_see_all, 'domains' => $domains, 'domains_see_all' => $domains_see_all, 'caneditphpsettings' => $caneditphpsettings, 'diskspace' => $diskspace, 'traffic' => $traffic, 'subdomains' => $subdomains, 'emails' => $emails, 'accounts' => $email_accounts, 'forwarders' => $email_forwarders, 'quota' => $email_quota, 'ftps' => $ftps, 'tickets' => $tickets, 'tickets_see_all' => $tickets_see_all, 'mysqls' => $mysqls, 'ip' => $ipaddress, 'deactivated' => $deactivated, 'custom_notes' => $custom_notes, 'custom_notes_show' => $custom_notes_show, 'adminid' => $id); $upd_stmt = Database::prepare("\n\t\t\t\t\t\tUPDATE `" . TABLE_PANEL_ADMINS . "` SET\n\t\t\t\t\t\t`password` = :password,\n\t\t\t\t\t\t`name` = :name,\n\t\t\t\t\t\t`email` = :email,\n\t\t\t\t\t\t`def_language` = :lang,\n\t\t\t\t\t\t`change_serversettings` = :change_serversettings,\n\t\t\t\t\t\t`customers` = :customers,\n\t\t\t\t\t\t`customers_see_all` = :customers_see_all,\n\t\t\t\t\t\t`domains` = :domains,\n\t\t\t\t\t\t`domains_see_all` = :domains_see_all,\n\t\t\t\t\t\t`caneditphpsettings` = :caneditphpsettings,\n\t\t\t\t\t\t`diskspace` = :diskspace,\n\t\t\t\t\t\t`traffic` = :traffic,\n\t\t\t\t\t\t`subdomains` = :subdomains,\n\t\t\t\t\t\t`emails` = :emails,\n\t\t\t\t\t\t`email_accounts` = :accounts,\n\t\t\t\t\t\t`email_forwarders` = :forwarders,\n\t\t\t\t\t\t`email_quota` = :quota,\n\t\t\t\t\t\t`ftps` = :ftps,\n\t\t\t\t\t\t`tickets` = :tickets,\n\t\t\t\t\t\t`tickets_see_all` = :tickets_see_all,\n\t\t\t\t\t\t`mysqls` = :mysqls,\n\t\t\t\t\t\t`ip` = :ip,\n\t\t\t\t\t\t`deactivated` = :deactivated,\n\t\t\t\t\t\t`custom_notes` = :custom_notes,\n\t\t\t\t\t\t`custom_notes_show` = :custom_notes_show\n\t\t\t\t\t\tWHERE `adminid` = :adminid\n\t\t\t\t\t"); Database::pexecute($upd_stmt, $upd_data); $log->logAction(ADM_ACTION, LOG_INFO, "edited admin '#" . $id . "'"); redirectTo($filename, array('page' => $page, 's' => $s)); } } else { $dec_places = Settings::Get('panel.decimal_places'); $result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places); $result['diskspace'] = round($result['diskspace'] / 1024, $dec_places); $result['email'] = $idna_convert->decode($result['email']); $ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']); $ipsandports_stmt = Database::query("\n\t\t\t\t\tSELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip`, `port` ASC\n\t\t\t\t"); while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) { $ipaddress .= makeoption($row['ip'], $row['id'], $result['ip']); } $result = htmlentities_array($result); $admin_edit_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/formfield.admin.php'); $admin_edit_form = HTMLform2::genHTMLForm($admin_edit_data, $result); eval("echo \"" . getTemplate("admins/admins_edit") . "\";"); } } } }
$upd = Database::prepare("\n\t\t\t\t\tUPDATE `" . TABLE_PANEL_CRONRUNS . "`\n\t\t\t\t\tSET `isactive` = :isactive, `interval` = :int\n\t\t\t\t\tWHERE `id` = :id"); Database::pexecute($upd, array('isactive' => $isactive, 'int' => $interval, 'id' => $id)); // insert task to re-generate the cron.d-file inserttask('99'); redirectTo($filename, array('page' => $page, 's' => $s)); } else { // interval $interval_nfo = explode(' ', $result['interval']); $result['interval_value'] = $interval_nfo[0]; $interval_interval = ''; $interval_interval .= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]); $interval_interval .= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]); $interval_interval .= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]); $interval_interval .= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]); $interval_interval .= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]); // end of interval $change_cronfile = false; if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor') { $change_cronfile = true; } $cronjobs_edit_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/formfield.cronjobs.php'); $cronjobs_edit_form = HTMLform2::genHTMLForm($cronjobs_edit_data, $result); eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";"); } } } elseif ($action == 'delete' && $id != 0) { /* * @TODO later */ } }
$stmt = Database::prepare("SET PASSWORD FOR :dbname@:host = PASSWORD(:password)"); $params = array("dbname" => $result['databasename'], "host" => $mysql_access_host, "password" => $password); Database::pexecute($stmt, $params); } $stmt = Database::prepare("FLUSH PRIVILEGES"); Database::pexecute($stmt); Database::needRoot(false); // End root-session } // Update the Database description -- PH 2004-11-29 $log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'"); $databasedescription = validate($_POST['description'], 'description'); $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DATABASES . "`\n\t\t\t\t\tSET `description` = :desc\n\t\t\t\t\tWHERE `customerid` = :customerid\n\t\t\t\t\tAND `id` = :id"); Database::pexecute($stmt, array("desc" => $databasedescription, "customerid" => $userinfo['customerid'], "id" => $id)); redirectTo($filename, array('page' => $page, 's' => $s)); } else { $dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `" . TABLE_PANEL_DATABASES . "`"); $dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC); $count_mysqlservers = $dbserver['numservers']; Database::needRoot(true, $result['dbserver']); Database::needSqlData(); $sql_root = Database::getSqlData(); Database::needRoot(false); $result['mysql_servers'] = isset($sql_root['caption']) ? $sql_root['caption'] : ''; $mysql_edit_data = (include_once dirname(__FILE__) . '/lib/formfields/customer/formfield.mysql.php'); $mysql_edit_form = HTMLform2::genHTMLForm($mysql_edit_data, $result); eval("echo \"" . getTemplate('mysql/mysqls_edit') . "\";"); } } } }