當前位置: 首頁>>代碼示例>>PHP>>正文


PHP tform_actions::onBeforeInsert方法代碼示例

本文整理匯總了PHP中tform_actions::onBeforeInsert方法的典型用法代碼示例。如果您正苦於以下問題:PHP tform_actions::onBeforeInsert方法的具體用法?PHP tform_actions::onBeforeInsert怎麽用?PHP tform_actions::onBeforeInsert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tform_actions的用法示例。


在下文中一共展示了tform_actions::onBeforeInsert方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     $app->uses('getconf,tools_sites');
     $global_config = $app->getconf->get_global_config('sites');
     $ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
     $this->dataRecord['username_prefix'] = $ftpuser_prefix;
     if ($app->tform->errorMessage == '') {
         $this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
     }
     parent::onBeforeInsert();
 }
開發者ID:istrwei,項目名稱:ISPCluster,代碼行數:12,代碼來源:ftp_user_edit.php

示例2: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     // check if the username is not blacklisted
     $blacklist = file(ISPC_LIB_PATH . '/shelluser_blacklist');
     foreach ($blacklist as $line) {
         if (strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))) {
             $app->tform->errorMessage .= 'The username is not allowed.';
         }
     }
     unset($blacklist);
     /*
      * If the names should be restricted -> do it!
      */
     if ($app->tform->errorMessage == '') {
         $app->uses('getconf,tools_sites');
         $global_config = $app->getconf->get_global_config('sites');
         $shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
         $this->dataRecord['username_prefix'] = $shelluser_prefix;
         /* restrict the names */
         $this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
     }
     parent::onBeforeInsert();
 }
開發者ID:shoaibali,項目名稱:ispconfig3,代碼行數:24,代碼來源:shell_user_edit.php

示例3: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     //* Site shell not be empty
     if ($this->dataRecord['parent_domain_id'] == 0) {
         $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty") . '<br />';
     }
     //* Database username and database name shall not be empty
     if ($this->dataRecord['database_name'] == '') {
         $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"] . '<br />';
     }
     //* Get the database name and database user prefix
     $app->uses('getconf,tools_sites');
     $global_config = $app->getconf->get_global_config('sites');
     $dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
     $this->dataRecord['database_name_prefix'] = $dbname_prefix;
     if (strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) {
         $app->tform->errorMessage .= str_replace('{db}', $dbname_prefix . $this->dataRecord['database_name'], $app->tform->wordbook["database_name_error_len"]) . '<br />';
     }
     //* Check database name and user against blacklist
     $dbname_blacklist = array($conf['db_database'], 'mysql');
     if (in_array($dbname_prefix . $this->dataRecord['database_name'], $dbname_blacklist)) {
         $app->tform->errorMessage .= $app->lng('Database name not allowed.') . '<br />';
     }
     /* restrict the names */
     /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
     if ($app->tform->errorMessage == '') {
         $this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
     }
     //* Check for duplicates
     $tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '" . $this->dataRecord['database_name'] . "' AND server_id = '" . $this->dataRecord["server_id"] . "'");
     if ($tmp['dbnum'] > 0) {
         $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique') . '<br />';
     }
     // get the web server ip (parent domain)
     $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '" . $this->dataRecord['parent_domain_id'] . "'");
     if ($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
         // we need remote access rights for this server, so get it's ip address
         $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
         if ($server_config['ip_address'] != '') {
             if ($this->dataRecord['remote_access'] != 'y') {
                 $this->dataRecord['remote_ips'] = '';
             }
             $this->dataRecord['remote_access'] = 'y';
             if (preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
                 $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
             }
         }
     }
     parent::onBeforeInsert();
 }
開發者ID:shoaibali,項目名稱:ispconfig3,代碼行數:51,代碼來源:database_edit.php

示例4: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     $app->uses('getconf');
     $global_config = $app->getconf->get_global_config('sites');
     //$ftpuser_prefix = ($global_config['ftpuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['ftpuser_prefix']);
     $ftpuser_prefix = replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
     if ($app->tform->errorMessage == '') {
         $this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
     }
     parent::onBeforeInsert();
 }
開發者ID:falkbizz,項目名稱:ispconfig3,代碼行數:12,代碼來源:ftp_user_edit.php

示例5: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     /*
      * If the names should be restricted -> do it!
      */
     if ($app->tform->errorMessage == '') {
         $app->uses('getconf');
         $global_config = $app->getconf->get_global_config('sites');
         $webdavuser_prefix = replacePrefix($global_config['webdavuser_prefix'], $this->dataRecord);
         /* restrict the names */
         $this->dataRecord['username'] = $webdavuser_prefix . $this->dataRecord['username'];
         /*
          * We shall not save the pwd in plaintext, so we store it as the hash, the apache-moule needs
          */
         $hash = md5($this->dataRecord["username"] . ':' . $this->dataRecord["dir"] . ':' . $this->dataRecord["password"]);
         $this->dataRecord["password"] = $hash;
         /*
          *  Get the data of the domain, owning the webdav user
          */
         $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = " . intval($this->dataRecord["parent_domain_id"]));
         /* The server is the server of the domain */
         $this->dataRecord["server_id"] = $web["server_id"];
         /* The Webdav user shall be owned by the same group then the website */
         $this->dataRecord["sys_groupid"] = $web['sys_groupid'];
     }
     parent::onBeforeInsert();
 }
開發者ID:falkbizz,項目名稱:ispconfig3,代碼行數:28,代碼來源:webdav_user_edit.php

示例6: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     /*
      * If the names should be restricted -> do it!
      */
     if ($app->tform->errorMessage == '') {
         $app->uses('getconf,tools_sites');
         $global_config = $app->getconf->get_global_config('sites');
         $webdavuser_prefix = $app->tools_sites->replacePrefix($global_config['webdavuser_prefix'], $this->dataRecord);
         $this->dataRecord['username_prefix'] = $webdavuser_prefix;
         /* restrict the names */
         $this->dataRecord['username'] = $webdavuser_prefix . $this->dataRecord['username'];
         /*
          *  Get the data of the domain, owning the webdav user
          */
         $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = " . $app->functions->intval($this->dataRecord["parent_domain_id"]));
         /* The server is the server of the domain */
         $this->dataRecord["server_id"] = $web["server_id"];
         /* The Webdav user shall be owned by the same group then the website */
         $this->dataRecord["sys_groupid"] = $web['sys_groupid'];
     }
     parent::onBeforeInsert();
 }
開發者ID:chhomreaksmey,項目名稱:ispconfig_ovh_hosting,代碼行數:24,代碼來源:webdav_user_edit.php

示例7: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     //* Database username and database name shall not be empty
     if ($this->dataRecord['database_name'] == '') {
         $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"] . '<br />';
     }
     if ($this->dataRecord['database_user'] == '') {
         $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"] . '<br />';
     }
     //* Get the database name and database user prefix
     $app->uses('getconf');
     $global_config = $app->getconf->get_global_config('sites');
     $dbname_prefix = replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
     $dbuser_prefix = replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
     if (strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) {
         $app->tform->errorMessage .= str_replace('{db}', $dbname_prefix . $this->dataRecord['database_name'], $app->tform->wordbook["database_name_error_len"]) . '<br />';
     }
     if (strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) {
         $app->tform->errorMessage .= str_replace('{user}', $dbuser_prefix . $this->dataRecord['database_user'], $app->tform->wordbook["database_user_error_len"]) . '<br />';
     }
     //* Check database name and user against blacklist
     $dbname_blacklist = array($conf['db_database'], 'mysql');
     if (in_array($dbname_prefix . $this->dataRecord['database_name'], $dbname_blacklist)) {
         $app->tform->errorMessage .= $app->lng('Database name not allowed.') . '<br />';
     }
     $dbuser_blacklist = array($conf['db_user'], 'mysql', 'root');
     if (in_array($dbname_prefix . $this->dataRecord['database_user'], $dbname_blacklist)) {
         $app->tform->errorMessage .= $app->lng('Database user not allowed.') . '<br />';
     }
     /* restrict the names */
     /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
     if ($app->tform->errorMessage == '') {
         $this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
         $this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
     }
     //* Check for duplicates
     $tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '" . $this->dataRecord['database_name'] . "' AND server_id = '" . $this->dataRecord["server_id"] . "'");
     if ($tmp['dbnum'] > 0) {
         $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique') . '<br />';
     }
     parent::onBeforeInsert();
 }
開發者ID:falkbizz,項目名稱:ispconfig3,代碼行數:43,代碼來源:database_edit.php

示例8: onBeforeInsert

 function onBeforeInsert()
 {
     global $app, $conf, $interfaceConf;
     //* Database username shall not be empty
     if ($this->dataRecord['database_user'] == '') {
         $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"] . '<br />';
     }
     //* Get the database name and database user prefix
     $app->uses('getconf,tools_sites');
     $global_config = $app->getconf->get_global_config('sites');
     $dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
     $this->dataRecord['database_user_prefix'] = $dbuser_prefix;
     if (strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) {
         $app->tform->errorMessage .= str_replace('{user}', $dbuser_prefix . $this->dataRecord['database_user'], $app->tform->wordbook["database_user_error_len"]) . '<br />';
     }
     //* Check database user against blacklist
     $dbuser_blacklist = array($conf['db_user'], 'mysql', 'root');
     if (is_array($dbuser_blacklist) && in_array($dbuser_prefix . $this->dataRecord['database_user'], $dbuser_blacklist)) {
         $app->tform->errorMessage .= $app->lng('Database user not allowed.') . '<br />';
     }
     /* restrict the names */
     /* crop user names if they are too long -> mysql: user: 16 chars / db: 64 chars */
     if ($app->tform->errorMessage == '') {
         $this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
     }
     $this->dataRecord['server_id'] = 0;
     // we need this on all servers
     parent::onBeforeInsert();
 }
開發者ID:istrwei,項目名稱:ISPCluster,代碼行數:29,代碼來源:database_user_edit.php


注:本文中的tform_actions::onBeforeInsert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。