• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP tform_actions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中tform_actions的典型用法代码示例。如果您正苦于以下问题:PHP tform_actions类的具体用法?PHP tform_actions怎么用?PHP tform_actions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了tform_actions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: onShowEnd

 function onShowEnd()
 {
     global $app, $conf;
     $rec = $app->tform->getDataRecord($_SESSION['s']['user']['mailuser_id']);
     $app->tpl->setVar("email", $rec['email']);
     parent::onShowEnd();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:7,代码来源:mail_user_password_edit.php


示例2: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Check the client limits, if user is not the admin
     if ($_SESSION["s"]["user"]["typ"] != 'admin') {
         // if user is not admin
         // Get the limits of the client
         $client_group_id = $_SESSION["s"]["user"]["default_group"];
         $client = $app->db->queryOneRecord("SELECT limit_fetchmail FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = {$client_group_id}");
         // Check if the user may add another transport.
         if ($this->id == 0 && $client["limit_fetchmail"] >= 0) {
             $tmp = $app->db->queryOneRecord("SELECT count(mailget_id) as number FROM mail_get WHERE sys_groupid = {$client_group_id}");
             if ($tmp["number"] >= $client["limit_fetchmail"]) {
                 $app->tform->errorMessage .= $app->tform->wordbook["limit_fetchmail_txt"] . "<br>";
             }
             unset($tmp);
         }
     }
     // end if user is not admin
     // Set the server ID according to the selected destination
     $tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE email = '" . $app->db->quote($this->dataRecord["destination"]) . "'");
     $this->dataRecord["server_id"] = $tmp["server_id"];
     unset($tmp);
     parent::onSubmit();
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:25,代码来源:mail_get_edit.php


示例3: onShowEnd

 function onShowEnd()
 {
     global $app, $conf;
     $rec = $app->tform->getDataRecord($this->id);
     $app->tpl->setVar("email", $rec['email']);
     parent::onShowEnd();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:7,代码来源:mail_user_cc_edit.php


示例4: onShow

 function onShow()
 {
     global $app;
     // Translate the items, very bad trick... :( because the language file is not loaded yet when the form file gets parsed
     foreach ($app->tform->formDef["tabs"]['remote_user']['fields']['remote_functions']['value'] as $key => $val) {
         $app->tform->formDef["tabs"]['remote_user']['fields']['remote_functions']['value'][$key] = $app->tform->lng($val) . '<br>';
     }
     parent::onShow();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:9,代码来源:remote_user_edit.php


示例5: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Get the record of the parent domain
     $parent_domain = $app->db->queryOneRecord("select server_id FROM web_domain WHERE domain_id = " . intval(@$this->dataRecord["parent_domain_id"]));
     // Set a few fixed values
     $this->dataRecord["server_id"] = $parent_domain["server_id"];
     parent::onSubmit();
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:9,代码来源:web_folder_edit.php


示例6: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Get the record of the parent domain
     $folder = $app->db->queryOneRecord("select server_id FROM web_folder WHERE web_folder_id = " . $app->functions->intval(@$this->dataRecord["web_folder_id"]));
     // Set a few fixed values
     $this->dataRecord["server_id"] = $folder["server_id"];
     parent::onSubmit();
 }
开发者ID:shoaibali,项目名称:ispconfig3,代码行数:9,代码来源:web_folder_user_edit.php


示例7: onSubmit

 function onSubmit()
 {
     global $app;
     //* We do not want to mirror the the server itself
     if ($this->id == $this->dataRecord['mirror_server_id']) {
         $this->dataRecord['mirror_server_id'] = 0;
     }
     parent::onSubmit();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:9,代码来源:server_edit.php


示例8: onSubmit

 function onSubmit()
 {
     global $app;
     //* Resellers shall not be able to create another reseller or set reseller specific settings
     if ($_SESSION["s"]["user"]["typ"] == 'user') {
         $this->dataRecord['limit_client'] = 0;
         $this->dataRecord['limit_domainmodule'] = 0;
     }
     parent::onSubmit();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:10,代码来源:client_template_edit.php


示例9: onShowEnd

 function onShowEnd()
 {
     global $app;
     // Is autoresponder set?
     if ($this->dataRecord['autoresponder'] == 'y') {
         $app->tpl->setVar("ar_active", 'checked="checked"');
     } else {
         $app->tpl->setVar("ar_active", '');
     }
     parent::onShowEnd();
 }
开发者ID:shoaibali,项目名称:ispconfig3,代码行数:11,代码来源:mail_user_autoresponder_edit.php


示例10: onShow

 function onShow()
 {
     global $app, $conf;
     //* We do not want that messages get edited, so we switch to a
     //*  read only template  if a existing message is loaded
     if ($this->id > 0) {
         $app->tform->formDef['tabs']['message']['template'] = 'templates/support_message_view.htm';
     }
     //* call the onShow function of the parent class
     parent::onShow();
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:11,代码来源:support_message_edit.php


示例11: onDelete

 function onDelete()
 {
     global $app, $conf, $list_def_file, $tform_def_file;
     // Loading tform framework
     if (!is_object($app->tform)) {
         $app->uses('tform');
     }
     if ($_POST["confirm"] == 'yes') {
         parent::onDelete();
     } else {
         $app->uses('tpl');
         $app->tpl->newTemplate("form.tpl.htm");
         $app->tpl->setInclude('content_tpl', 'templates/client_del.htm');
         include_once $list_def_file;
         // Load table definition from file
         $app->tform->loadFormDef($tform_def_file);
         $this->id = $app->functions->intval($_REQUEST["id"]);
         $this->dataRecord = $app->tform->getDataRecord($this->id);
         $client_id = $app->functions->intval($this->dataRecord['client_id']);
         //$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
         //$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
         $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = {$client_id}");
         // Get all records (sub-clients, mail, web, etc....)  of this client.
         $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain';
         $tables_array = explode(',', $tables);
         $client_group_id = $app->functions->intval($client_group['groupid']);
         $table_list = array();
         if ($client_group_id > 1) {
             foreach ($tables_array as $table) {
                 if ($table != '') {
                     $records = $app->db->queryAllRecords("SELECT * FROM {$table} WHERE sys_groupid = " . $client_group_id);
                     $number = count($records);
                     if ($number > 0) {
                         $table_list[] = array('table' => $table . "(" . $number . ")");
                     }
                 }
             }
         }
         $app->tpl->setVar('id', $this->id);
         $app->tpl->setVar('number_records', $number);
         $app->tpl->setLoop('records', $table_list);
         //* load language file
         $lng_file = 'lib/lang/' . $_SESSION['s']['language'] . '_client_del.lng';
         include $lng_file;
         $app->tpl->setVar($wb);
         $app->tpl_defaults();
         $app->tpl->pparse();
     }
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:49,代码来源:client_del.php


示例12: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Get the record of the parent domain
     $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = " . intval(@$this->dataRecord["parent_domain_id"]));
     // Set a few fixed values
     $this->dataRecord["type"] = 'subdomain';
     $this->dataRecord["server_id"] = $parent_domain["server_id"];
     $this->dataRecord["domain"] = $this->dataRecord["domain"] . '.' . $parent_domain["domain"];
     $this->parent_domain_record = $parent_domain;
     //* make sure that the email domain is lowercase
     if (isset($this->dataRecord["domain"])) {
         $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
     }
     parent::onSubmit();
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:16,代码来源:web_subdomain_edit.php


示例13: onSubmit

 function onSubmit()
 {
     global $app;
     $app->uses('ini_parser,getconf');
     $section = $app->tform->getCurrentTab();
     $server_config_array = $app->getconf->get_global_config();
     $new_config = $app->tform->encode($this->dataRecord, $section);
     if ($section == 'mail') {
         if ($new_config['smtp_pass'] == '') {
             $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
         }
         if ($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) {
             $app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt");
         }
     }
     parent::onSubmit();
 }
开发者ID:shoaibali,项目名称:ispconfig3,代码行数:17,代码来源:system_config_edit.php


示例14: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Get the record of the parent domain
     $folder = $app->db->queryOneRecord("select * FROM web_folder WHERE web_folder_id = " . $app->functions->intval(@$this->dataRecord["web_folder_id"]) . " AND " . $app->tform->getAuthSQL('r'));
     if (!$folder || $folder['web_folder_id'] != @$this->dataRecord['web_folder_id']) {
         $app->tform->errorMessage .= $app->tform->lng("no_folder_perm");
     }
     // Set a few fixed values
     $this->dataRecord["server_id"] = $folder["server_id"];
     // make sure this folder/user combination does not exist already
     if ($this->id > 0) {
         $user = $app->db->queryOneRecord("SELECT * FROM web_folder_user WHERE web_folder_id = " . $this->dataRecord['web_folder_id'] . " AND username = '" . $this->dataRecord['username'] . "' AND web_folder_user_id != " . $this->id);
     } else {
         $user = $app->db->queryOneRecord("SELECT * FROM web_folder_user WHERE web_folder_id = " . $this->dataRecord['web_folder_id'] . " AND username = '" . $this->dataRecord['username'] . "'");
     }
     if (is_array($user) && !empty($user)) {
         $app->tform->errorMessage .= $app->tform->lng('error_user_exists_already_txt');
     }
     parent::onSubmit();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:21,代码来源:web_folder_user_edit.php


示例15: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Check the client limits, if user is not the admin
     if ($_SESSION["s"]["user"]["typ"] != 'admin') {
         // if user is not admin
         // Get the limits of the client
         $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
         $client = $app->db->queryOneRecord("SELECT limit_spamfilter_policy FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = {$client_group_id}");
         // Check if the user may add another mailbox.
         if ($this->id == 0 && $client["limit_spamfilter_policy"] >= 0) {
             $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM spamfilter_policy WHERE sys_groupid = {$client_group_id}");
             if ($tmp["number"] >= $client["limit_spamfilter_policy"]) {
                 $app->tform->errorMessage .= $app->tform->wordbook["limit_spamfilter_policy_txt"] . "<br>";
             }
             unset($tmp);
         }
     }
     // end if user is not admin
     parent::onSubmit();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:21,代码来源:spamfilter_policy_edit.php


示例16: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     // Get the record of the parent domain
     $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = " . $app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND " . $app->tform->getAuthSQL('r'));
     if (!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) {
         $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
     }
     // Set a few fixed values
     $this->dataRecord["server_id"] = $parent_domain["server_id"];
     // make sure this folder isn't protected already
     if ($this->id > 0) {
         $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE parent_domain_id = " . $this->dataRecord['parent_domain_id'] . " AND path = '" . $this->dataRecord['path'] . "' AND web_folder_id != " . $this->id);
     } else {
         $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE parent_domain_id = " . $this->dataRecord['parent_domain_id'] . " AND path = '" . $this->dataRecord['path'] . "'");
     }
     if (is_array($folder) && !empty($folder)) {
         $app->tform->errorMessage .= $app->tform->lng('error_folder_already_protected_txt');
     }
     parent::onSubmit();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:21,代码来源:web_folder_edit.php


示例17: onShowEnd

 function onShowEnd()
 {
     global $app, $conf;
     //message variables
     $message_variables = '';
     $sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'";
     $field_names = $app->db->queryAllRecords($sql);
     if (!empty($field_names) && is_array($field_names)) {
         foreach ($field_names as $field_name) {
             if ($field_name['Field'] != '') {
                 if ($field_name['Field'] == 'gender') {
                     $message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{salutation}</a> ';
                 } else {
                     $message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{' . $field_name['Field'] . '}</a> ';
                 }
             }
         }
     }
     $app->tpl->setVar('message_variables', trim($message_variables));
     parent::onShowEnd();
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:21,代码来源:message_template_edit.php


示例18: onAfterUpdate

 function onAfterUpdate()
 {
     global $app;
     // username changed
     if ($conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
         $username = $app->db->quote($this->dataRecord["username"]);
         $client_id = $this->id;
         $sql = "UPDATE sys_user SET username = '{$username}' WHERE client_id = {$client_id}";
         $app->db->query($sql);
         $tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = {$client_id}");
         $app->db->datalogUpdate("sys_group", "name = '{$username}'", 'groupid', $tmp['groupid']);
         unset($tmp);
     }
     // password changed
     if ($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
         $password = $app->db->quote($this->dataRecord["password"]);
         $salt = "\$1\$";
         $base64_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
         for ($n = 0; $n < 8; $n++) {
             $salt .= $base64_alphabet[mt_rand(0, 63)];
         }
         $salt .= "\$";
         $password = crypt(stripslashes($password), $salt);
         $client_id = $this->id;
         $sql = "UPDATE sys_user SET passwort = '{$password}' WHERE client_id = {$client_id}";
         $app->db->query($sql);
     }
     // language changed
     if ($conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
         $language = $app->db->quote($this->dataRecord["language"]);
         $client_id = $this->id;
         $sql = "UPDATE sys_user SET language = '{$language}' WHERE client_id = {$client_id}";
         $app->db->query($sql);
     }
     // reseller status changed
     if (isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
         $modules = $conf['interface_modules_enabled'];
         if ($this->dataRecord["limit_client"] > 0) {
             $modules .= ',client';
         }
         $modules = $app->db->quote($modules);
         $client_id = $this->id;
         $sql = "UPDATE sys_user SET modules = '{$modules}' WHERE client_id = {$client_id}";
         $app->db->query($sql);
     }
     /*
      *  If there is a client-template, process it */
     applyClientTemplates($this->id);
     parent::onAfterUpdate();
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:50,代码来源:client_edit.php


示例19: onAfterUpdate

 function onAfterUpdate()
 {
     global $app, $conf;
     // username changed
     if (isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
         $username = $app->db->quote($this->dataRecord["username"]);
         $client_id = $this->id;
         $sql = "UPDATE sys_user SET username = '{$username}' WHERE client_id = {$client_id}";
         $app->db->query($sql);
         $tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = {$client_id}");
         $app->db->datalogUpdate("sys_group", "name = '{$username}'", 'groupid', $tmp['groupid']);
         unset($tmp);
     }
     // password changed
     if (isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
         $password = $app->db->quote($this->dataRecord["password"]);
         $salt = "\$1\$";
         $base64_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
         for ($n = 0; $n < 8; $n++) {
             $salt .= $base64_alphabet[mt_rand(0, 63)];
         }
         $salt .= "\$";
         $password = crypt(stripslashes($password), $salt);
         $client_id = $this->id;
         $sql = "UPDATE sys_user SET passwort = '{$password}' WHERE client_id = {$client_id}";
         $app->db->query($sql);
     }
     if (!isset($this->dataRecord['locked'])) {
         $this->dataRecord['locked'] = 'n';
     }
     if (isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["locked"] != $this->oldDataRecord['locked']) {
         /** lock all the things like web, mail etc. - easy to extend */
         // get tmp_data of client
         $client_data = $app->db->queryOneRecord('SELECT `tmp_data` FROM `client` WHERE `client_id` = ' . $this->id);
         if ($client_data['tmp_data'] == '') {
             $tmp_data = array();
         } else {
             $tmp_data = unserialize($client_data['tmp_data']);
         }
         if (!is_array($tmp_data)) {
             $tmp_data = array();
         }
         // database tables with their primary key columns
         $to_disable = array('cron' => 'id', 'ftp_user' => 'ftp_user_id', 'mail_domain' => 'domain_id', 'mail_user' => 'mailuser_id', 'mail_user_smtp' => 'mailuser_id', 'mail_forwarding' => 'forwarding_id', 'mail_get' => 'mailget_id', 'openvz_vm' => 'vm_id', 'shell_user' => 'shell_user_id', 'webdav_user' => 'webdav_user_id', 'web_database' => 'database_id', 'web_domain' => 'domain_id', 'web_folder' => 'web_folder_id', 'web_folder_user' => 'web_folder_user_id');
         $udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user` WHERE `client_id` = ' . $this->id);
         $gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_group` WHERE `client_id` = ' . $this->id);
         $sys_groupid = $gdata['groupid'];
         $sys_userid = $udata['userid'];
         $entries = array();
         if ($this->dataRecord['locked'] == 'y') {
             $prev_active = array();
             $prev_sysuser = array();
             foreach ($to_disable as $current => $keycolumn) {
                 $active_col = 'active';
                 $reverse = false;
                 if ($current == 'mail_user') {
                     $active_col = 'postfix';
                 } elseif ($current == 'mail_user_smtp') {
                     $current = 'mail_user';
                     $active_col = 'disablesmtp';
                     $reverse = true;
                 }
                 if (!isset($prev_active[$current])) {
                     $prev_active[$current] = array();
                 }
                 if (!isset($prev_sysuser[$current])) {
                     $prev_sysuser[$current] = array();
                 }
                 $entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id`, `sys_userid`, `' . $active_col . '` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
                 foreach ($entries as $item) {
                     if ($item[$active_col] != 'y' && $reverse == false) {
                         $prev_active[$current][$item['id']][$active_col] = 'n';
                     } elseif ($item[$active_col] == 'y' && $reverse == true) {
                         $prev_active[$current][$item['id']][$active_col] = 'y';
                     }
                     if ($item['sys_userid'] != $sys_userid) {
                         $prev_sysuser[$current][$item['id']] = $item['sys_userid'];
                     }
                     // we don't have to store these if y, as everything without previous state gets enabled later
                     $app->db->datalogUpdate($current, array($active_col => $reverse == true ? 'y' : 'n', 'sys_userid' => $_SESSION["s"]["user"]["userid"]), $keycolumn, $item['id']);
                 }
             }
             $tmp_data['prev_active'] = $prev_active;
             $tmp_data['prev_sys_userid'] = $prev_sysuser;
             $app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
             unset($prev_active);
             unset($prev_sysuser);
         } elseif ($this->dataRecord['locked'] == 'n') {
             foreach ($to_disable as $current => $keycolumn) {
                 $active_col = 'active';
                 $reverse = false;
                 if ($current == 'mail_user') {
                     $active_col = 'postfix';
                 } elseif ($current == 'mail_user_smtp') {
                     $current = 'mail_user';
                     $active_col = 'disablesmtp';
                     $reverse = true;
                 }
                 $entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
                 foreach ($entries as $item) {
//.........这里部分代码省略.........
开发者ID:istrwei,项目名称:ISPCluster,代码行数:101,代码来源:client_edit.php


示例20: onSubmit

 function onSubmit()
 {
     global $app, $conf;
     /* check if the domain module is used - and check if the selected domain can be used! */
     if ($app->tform->getCurrentTab() == 'domain') {
         $app->uses('ini_parser,getconf');
         $settings = $app->getconf->get_global_config('domains');
         if ($settings['use_domain_module'] == 'y') {
             $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
             if (!$domain_check) {
                 // invalid domain selected
                 $app->tform->errorMessage .= $app->tform->lng("domain_error_empty") . "<br />";
             } else {
                 $this->dataRecord['domain'] = $domain_check;
             }
         }
     }
     // nginx: if redirect type is proxy and redirect path is no URL, display error
     //if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
     // $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
     //}
     // Set a few fixed values
     $this->dataRecord["parent_domain_id"] = 0;
     $this->dataRecord["type"] = 'vhost';
     $this->dataRecord["vhost_type"] = 'name';
     $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
     if ($_SESSION["s"]["user"]["typ"] != 'admin') {
         // Get the limits of the client
         $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
         $client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = {$client_group_id}");
         if ($client['limit_cgi'] != 'y') {
             $this->dataRecord['cgi'] = 'n';
         }
         if ($client['limit_ssi'] != 'y') {
             $this->dataRecord['ssi'] = 'n';
         }
         if ($client['limit_perl'] != 'y') {
             $this->dataRecord['perl'] = 'n';
         }
         if ($client['limit_ruby'] != 'y') {
             $this->dataRecord['ruby'] = 'n';
         }
         if ($client['limit_python'] != 'y') {
             $this->dataRecord['python'] = 'n';
         }
         if ($client['force_suexec'] == 'y') {
             $this->dataRecord['suexec'] = 'y';
         }
         if ($client['limit_hterror'] != 'y') {
             $this->dataRecord['errordocs'] = 'n';
         }
         if ($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') {
             $this->dataRecord['subdomain'] = 'n';
         }
         if ($client['limit_ssl'] != 'y') {
             $this->dataRecord['ssl'] = 'n';
         }
         // only generate quota and traffic warnings if value has changed
         if ($this->id > 0) {
             $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = " . $app->functions->intval($this->id));
         } else {
             $old_web_values = array();
         }
         //* Check the website quota of the client
         if (isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
             $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != " . $app->functions->intval($this->id) . " AND type = 'vhost' AND " . $app->tform->getAuthSQL('u'));
             $webquota = $tmp["webquota"];
             $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
             if ($webquota + $new_web_quota > $client["limit_web_quota"] || $new_web_quota < 0 && $client["limit_web_quota"] >= 0) {
                 $max_free_quota = floor($client["limit_web_quota"] - $webquota);
                 if ($max_free_quota < 0) {
                     $max_free_quota = 0;
                 }
                 $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt") . ": " . $max_free_quota . " MB<br>";
                 // Set the quota field to the max free space
                 $this->dataRecord["hd_quota"] = $max_free_quota;
             }
             unset($tmp);
             unset($tmp_quota);
         }
         //* Check the traffic quota of the client
         if (isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
             $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != " . $app->functions->intval($this->id) . " AND " . $app->tform->getAuthSQL('u'));
             $trafficquota = $tmp["trafficquota"];
             $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
             if ($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"] || $new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0) {
                 $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota);
                 if ($max_free_quota < 0) {
                     $max_free_quota = 0;
                 }
                 $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt") . ": " . $max_free_quota . " MB<br>";
                 // Set the quota field to the max free space
                 $this->dataRecord["traffic_quota"] = $max_free_quota;
             }
             unset($tmp);
             unset($tmp_quota);
         }
         if ($client['parent_client_id'] > 0) {
             // Get the limits of the reseller
             $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, limit_web_quota FROM client WHERE client_id = " . $app->functions->intval($client['parent_client_id']));
//.........这里部分代码省略.........
开发者ID:istrwei,项目名称:ISPCluster,代码行数:101,代码来源:web_domain_edit.php



注:本文中的tform_actions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP theme类代码示例发布时间:2022-05-23
下一篇:
PHP textlib类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap