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


PHP Filter::cleanSqlFieldNames方法代碼示例

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


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

示例1: GetMail

 /**
  * Constructor
  *
  * @param array $args
  * @return void
  */
 function GetMail($args = array())
 {
     global $domains;
     $this->mailer = null;
     foreach ($args as $k => $v) {
         $this->{$k} = $v;
     }
     $this->init_sql($args['Username']);
     $this->Account = "{$this->Username}@{$this->Pop3host}";
     // See if the user has defined another MailServer to connect and access the MailAuth type
     $UserSettings = Filter::cleanSqlFieldNames($this->sql->UserSettings);
     $query = "select MailServer, MailAuth, DateFormat, TimeFormat, Language, TimeZone, UseSSL from {$UserSettings} where Account=?";
     list($this->MailServer, $this->MailAuth, $this->DateFormat, $this->TimeFormat, $this->Language, $this->TimeZone, $this->UseSSL) = $this->sql->sqlarray($query, $this->Account);
     $this->MailDir = $this->sql->getvalue("select MailDir from Users where Account=?", $this->Account);
     $this->SessionID = session_id();
     $this->tree = array();
     $this->months = array('Jan' => '01', 'Feb' => '02', 'Mar' => '03', 'Apr' => '04', 'May' => '05', 'Jun' => '06', 'Jul' => '07', 'Aug' => '08', 'Sep' => '09', 'Oct' => '10', 'Nov' => '11', 'Dec' => '12');
 }
開發者ID:BigBlueHat,項目名稱:atmailopen,代碼行數:24,代碼來源:GetMail.php

示例2: createuser

 function createuser($user = null)
 {
     global $pref, $atmail, $settings, $domains;
     // If we are using LDAP, grab the user details via the LDAP server
     if ($pref['ldap_auth']) {
         $ldapuser = $this->ldap_auth_populate($this->username);
         // LDAP mod ---  changed user[FirstName], & user[LastName] to user[Industry], & user[Occupation]
         $user['Industry'] = $ldapuser['FirstName'];
         $user['Occupation'] = $ldapuser['LastName'];
         $user['RealName'] = $ldapuser['RealName'];
         //echo $user['FirstName'] . ":" . $user['LastName'] . "\n";
     }
     if (!$pref['crypt'] || !$atmail->isset_chk($domains[$this->pop3host])) {
         // Plaintext password
         $pass = $this->password;
     } else {
         // Encrypt the password
         $pass = crypt($this->password);
     }
     $this->SessionID = session_id();
     // Load our table names
     $atmail->db->table_names($this->Account);
     // Log the time we created the account
     $time = time();
     // Specify the 'default' user group if none exists
     if (!$user['UGroup']) {
         $user['UGroup'] = 'Default';
     }
     // Purge any invalid entries in the DB
     $atmail->db->sqldo("delete from UserSession where Account=?", $this->Account);
     // Create a new SessionID for the user
     $query = "INSERT INTO UserSession (Account, Password, SessionID, LastLogin, PasswordMD5, SessionData) VALUES(?, ?, ?, ?, ?, ?)";
     $data = array($this->Account, $pass, $this->SessionID, $time, md5($pass), '');
     $res = $atmail->db->sqldo($query, $data);
     if ($res != 1) {
         return -1;
     }
     $settings['UseSSL'] = 0;
     // Select the MailType - SQL or Flatfile
     // All functions are based on what type of account the user has
     if (!$domains[$this->pop3host]) {
         $settings['MailType'] = $_REQUEST['MailType'];
         if (strpos($settings['MailType'], 's')) {
             $settings['UseSSL'] = 1;
             $settings['MailType'] = str_replace('s', '', $settings['MailType']);
         }
     } elseif ($pref['sql_type'] && $domains[$this->pop3host]) {
         $settings['MailType'] = 'sql';
     } elseif (!$pref['sql_type'] && $domains[$this->pop3host]) {
         $settings['MailType'] = 'file';
     }
     if ($pref['sql_type']) {
         $settings['Mode'] = 'sql';
     } else {
         $settings['Mode'] = 'file';
     }
     if (!$user['UserQuota']) {
         $user['UserQuota'] = $settings['UserQuota'];
     }
     // Build an SQL query for the new User
     $query = "INSERT INTO Users (UGroup, Address, BirthDay, BirthMonth, BirthYear, City, Country, TelHome,\r\n\t\t\t\t  FaxHome, TelWork, FaxWork, TelMobile, TelPager, FirstName, Gender, Industry, LastName,\r\n\t\t\t\t  Occupation, OtherEmail, PasswordQuestion, PostCode, State, DateCreate, UserStatus,\r\n\t\t\t\t  Account, MailDir, UserQuota) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, {$atmail->db->NOW},\r\n\t\t\t\t  ?, ?, ?, ?)";
     if (empty($user['BirthYear'])) {
         $user['BirthYear'] = 0;
     }
     $data = array($user['UGroup'], $user['Address'], $user['BirthDay'], $user['BirthMonth'], $user['BirthYear'], $user['City'], $user['Country'], $user['TelHome'], $user['FaxHome'], $user['TelWork'], $user['FaxWork'], $user['TelMobile'], $user['TelPager'], $user['FirstName'], $user['Gender'], $user['Industry'], $user['LastName'], $user['Occupation'], $user['OtherEmail'], $user['PasswordQuestion'], $user['PostCode'], $user['State'], $pref['UserStatus'], $this->Account, $user['MailDir'], $user['UserQuota']);
     if ($atmail->db->sqldo($query, $data) != 1) {
         return -1;
     }
     // Build the query
     $insert = '';
     $values = '';
     $data = array();
     // Insert the users settings
     foreach ($settings as $key => $value) {
         if ($key == 'UserQuota') {
             continue;
         }
         $insert .= Filter::cleanSqlFieldNames($key) . ',';
         $values .= '?,';
         // Insert custom preferences for account, depending on the
         // new user form
         if ($key == "RealName") {
             $data[] = $user['FirstName'] . ' ' . $user['LastName'];
         } elseif ($key == "LoginType") {
             $data[] = $user['LoginType'];
         } elseif ($key == "Service") {
             $data[] = $user['Service'];
         } elseif ($key == "ReplyTo" && $atmail->isset_chk($_REQUEST['email'])) {
             $data[] = $_REQUEST['email'];
         } elseif ($key == "ReplyTo" && !$atmail->isset_chk($_REQUEST['email'])) {
             $data[] = $this->Account;
         } elseif ($key == "Language" && $atmail->isset_chk($_REQUEST['Language'])) {
             $data[] = $_REQUEST['Language'];
         } else {
             $data[] = $value;
         }
     }
     $user_settings = $atmail->db->get('UserSettings');
     $query = "INSERT INTO {$user_settings} ({$insert} Account) values ({$values} ?)";
     $data[] = $this->Account;
//.........這裏部分代碼省略.........
開發者ID:BigBlueHat,項目名稱:atmailopen,代碼行數:101,代碼來源:Auth.php

示例3: checkgroup

 function checkgroup($group)
 {
     global $atmail;
     $abookGroup = Filter::cleanSqlFieldNames($this->db->AbookGroup);
     $group = $this->db->sqlgetfield("select GroupName from {$abookGroup} where GroupName={$this->Ugroup}\n\t\tand Account={$this->Account_Escape}");
     return $group;
 }
開發者ID:BigBlueHat,項目名稱:atmailopen,代碼行數:7,代碼來源:Abook.class.php

示例4: optimize_table

 function optimize_table($table)
 {
     $table = Filter::cleanSqlFieldNames($table);
     if ($this->type == 'mysql') {
         $this->dbh->query("optimize table {$table}");
     }
 }
開發者ID:huluwa,項目名稱:zz_atmailopen,代碼行數:7,代碼來源:SQL.php

示例5: generatepermissions

 function generatepermissions($user, $db, $field, $accounts)
 {
     global $pref;
     $user = str_replace("'", '', $user);
     $user = $this->db->quote($user);
     $db = Filter::cleanSqlFieldNames($db);
     $field = Filter::cleanSqlFieldNames($field);
     // Create a string containing the list of permissions for Javascript to use
     if (is_array($accounts)) {
         foreach ($accounts as $account) {
             $account = $this->db->quote($account);
             // If the element is an email-address
             if (strpos($account, '@') != false) {
                 $value = $this->db->getvalue("select CONCAT({$db}.Account, ':', Users.id, ':', {$db}.Permissions) from {$db}, Users where {$db}.Account={$account} and Users.Account={$account} and {$db}.{$field}={$user} ");
                 if (!$value) {
                     $value = $this->db->getvalue("select CONCAT(Account, ':', id, ':', Permissions) from {$db} where Account={$account}");
                 }
                 $permissions .= $value . ",";
             } else {
                 $account = str_replace("'", '', $account);
                 // Otherwise the reference points to a group, load the group-name
                 $users = $this->findgroups($account);
                 if ($account == "All Users" && $pref['GlobalAbook'] && $this->param('frames') != "To,Cc,Bcc") {
                     $users[0] = "All Users";
                 }
                 // If users exist in the group, append the action
                 if (!$users[0]) {
                     $users[0] = "{$account}";
                 }
                 $grouppermissions .= "GroupNames[\"{$account}\"] = \"{$account}\";";
                 $permission = $this->db->sqlgetfield("select {$db}.Permissions from {$db} where {$db}.Account=? and {$field}={$user}", array($account));
                 if ($permission) {
                     $grouppermissions .= "AddedGroups[\"{$account}\"] = 'Write';";
                 } else {
                     $grouppermissions .= "AddedGroups[\"{$account}\"] = 'Read';";
                 }
                 $grouppermissions .= "Groups[\"{$account}\"] = \"";
                 $grouppermissions .= implode(',', $users);
                 $grouppermissions .= "\";\n";
             }
         }
     }
     if ($grouppermissions && !$permissions) {
         $permissions = " ";
     }
     return array($permissions, $grouppermissions);
 }
開發者ID:huluwa,項目名稱:zz_atmailopen,代碼行數:47,代碼來源:Global.php


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