当前位置: 首页>>代码示例>>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;未经允许,请勿转载。