当前位置: 首页>>代码示例>>PHP>>正文


PHP sotf_Utils::magicQuotes方法代码示例

本文整理汇总了PHP中sotf_Utils::magicQuotes方法的典型用法代码示例。如果您正苦于以下问题:PHP sotf_Utils::magicQuotes方法的具体用法?PHP sotf_Utils::magicQuotes怎么用?PHP sotf_Utils::magicQuotes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sotf_Utils的用法示例。


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

示例1: findByName

 /** static */
 function findByName($name)
 {
     global $db;
     $name = sotf_Utils::magicQuotes($name);
     $res = $db->getOne("SELECT id FROM sotf_contacts WHERE name='{$name}'");
     // what happens when there are 2 matches? but name field is unique...
     return $res;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:9,代码来源:sotf_Contact.class.php

示例2: findByName

 /** static */
 function findByName($name)
 {
     global $db, $config;
     $name = sotf_Utils::magicQuotes($name);
     // first find the local contact, then any other...
     //$id = sotf_Contact::findByNameLocal($name);
     //if(!$id)
     $id = $db->getOne("SELECT id FROM sotf_contacts WHERE name='{$name}'");
     // what happens when there are 2 matches? returns first match...
     return $id;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:12,代码来源:sotf_Contact.class.php

示例3: save

 function save()
 {
     global $db, $user;
     $data = serialize($this);
     $count = $db->getOne("SELECT count(*) FROM sotf_user_prefs WHERE id = '{$this->id}'");
     if ($count == 1) {
         $db->query("UPDATE sotf_user_prefs SET prefs='{$data}' WHERE id = '{$this->id}'");
     } else {
         $name = sotf_Utils::magicQuotes($user->name);
         $db->query("INSERT INTO sotf_user_prefs (id, username, prefs) VALUES('{$user->id}','{$name}','{$data}')");
     }
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:12,代码来源:sotf_UserPrefs.class.php

示例4: getByName

 /** static: finds a station by its name
  */
 function getByName($stationName)
 {
     global $db;
     $stationName = sotf_Utils::magicQuotes($stationName);
     $id = $db->getOne("SELECT id FROM sotf_stations WHERE name = '{$stationName}'");
     if (DB::isError($id)) {
         raiseError($id);
     }
     if ($id) {
         return new sotf_Station($id);
     } else {
         return NULL;
     }
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:16,代码来源:sotf_Station.class.php

示例5: set

 /** Sets the value of a persistent variable. */
 function set($name, $val)
 {
     $name = sotf_Utils::magicQuotes($name);
     $val = sotf_Utils::magicQuotes($val);
     if (isset($this->vars[$name])) {
         $update = 1;
     }
     $this->vars[$name] = $val;
     if ($update) {
         $result = $this->db->query("UPDATE {$this->table} SET value='{$val}' WHERE name='{$name}'");
     } else {
         $result = $this->db->query("INSERT INTO {$this->table} (name,value) VALUES('{$name}', '{$val}')");
     }
     if (DB::isError($result)) {
         raiseError($result);
     }
     debug("setvar", "{$name}={$val}");
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:19,代码来源:sotf_Vars.class.php

示例6: getUsername

 function getUsername($user_id)
 {
     global $userdb;
     static $userNameCache;
     $storage =& sotf_User::getStorageObject();
     if (is_numeric($user_id)) {
         if ($userNameCache[$user_id]) {
             return $userNameCache[$user_id];
         }
         $data = $storage->userDbSelect(array('userid' => sotf_Utils::magicQuotes($user_id)));
         if (!$data) {
             return false;
         }
         $name = $data['username'];
         $userNameCache[$user_id] = $name;
         return $name;
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:19,代码来源:sotf_Metadata.class.php

示例7: listGroupsOfUser

 function listGroupsOfUser($uid)
 {
     global $db;
     if (!$uid) {
         return array();
     }
     $uid = sotf_Utils::magicQuotes($uid);
     $sql = "SELECT group_id, id FROM sotf_user_groups WHERE user_id='{$uid}'";
     $res = $db->getAssoc($sql);
     if (DB::isError($res)) {
         raiseError($res);
     }
     return $res;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:14,代码来源:sotf_Group.class.php

示例8: mySeriesData

 /** returns series (id,title) within given station owned/edited by current user */
 function mySeriesData($stationId)
 {
     global $page, $db, $user;
     if (!$page->loggedIn()) {
         return NULL;
     }
     // not logged in yet
     $stationId = sotf_Utils::magicQuotes($stationId);
     $sql = "SELECT s.id AS id, s.title AS title FROM sotf_series s, sotf_user_permissions u" . " WHERE u.user_id = '{$user->id}' AND u.object_id=s.id";
     if ($stationId) {
         $sql .= " AND s.station_id='{$stationId}'";
     }
     $sql .= " ORDER BY s.title";
     $sdata = $db->getAll($sql);
     return $sdata;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:17,代码来源:sotf_Permission.class.php

示例9: find

 function find()
 {
     global $db;
     reset($this->data);
     while (list($key, $val) = each($this->data)) {
         //if($key != $this->idKey && !in_array($key, $this->binaryFields)) {
         if (!in_array($key, $this->binaryFields)) {
             $my_sql[] = $key . " = '" . sotf_Utils::magicQuotes($val) . "'";
         }
     }
     $my_sql = implode(" AND ", $my_sql);
     //execute the query
     $res = $db->getCol("SELECT {$this->idKey} FROM {$this->tablename} WHERE {$my_sql} ");
     if (count($res) > 1) {
         raiseError("not unique");
     }
     if (count($res) == 1) {
         //debug("find()", $res[0]);
         $this->id = $res[0];
         $this->load();
         $this->exists = true;
     } else {
         $this->exists = false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:25,代码来源:sotf_Object.class.php

示例10: getRoleId

 function getRoleId($name, $language)
 {
     $this->loadRoles();
     $name = sotf_Utils::magicQuotes($name);
     $language = sotf_Utils::magicQuotes($language);
     return $this->db->getOne("SELECT role_id FROM sotf_role_names WHERE name='{$name}' AND language='{$language}'");
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:7,代码来源:sotf_Vocabularies.class.php

示例11: setBlob

 /**
  * sotf :: setBlob()
  * 
  * purpose: to set a binary property.
  * 
  * @return (void)
  */
 function setBlob($prop_name, $prop_value)
 {
     if (empty($prop_value)) {
         $v = 'NULL';
     } else {
         $v = "'" . sotf_Utils::magicQuotes($this->db->escape_bytea($prop_value)) . "'";
     }
     $res = $this->db->query("UPDATE " . $this->tablename . " SET {$prop_name} = {$v} WHERE " . $this->idKey . "='" . $this->id . "' ");
     if (DB::isError($res)) {
         raiseError("Error in setBlob: {$res}");
     }
     $this->data[$prop_name] = $v;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:20,代码来源:sotf_Object.class.php

示例12: listStations

 /**
  * @method static listStations
  * @return array of sotf_Station objects
  */
 function listStations($start, $hitsPerPage, $mode = '', $language = '')
 {
     global $db;
     if (empty($start)) {
         $start = 0;
     }
     if (empty($mode)) {
         $mode = 'newest';
     }
     if (empty($language)) {
         $language = 'none';
     }
     if ($mode == 'newest') {
         $sortExpr = '  ORDER BY entry_date DESC ';
     } else {
         $sortExpr = '  ORDER BY name ';
     }
     $language = sotf_Utils::magicQuotes($language);
     if ($language != 'none') {
         $whereExpr = " WHERE language LIKE '%{$language}%' ";
     } else {
         $whereExpr = "";
     }
     $res = $db->limitQuery("SELECT * FROM sotf_stations {$whereExpr} {$sortExpr}", $start, $hitsPerPage);
     if (DB::isError($res)) {
         raiseError($res);
     }
     while (DB_OK === $res->fetchInto($st)) {
         $slist[] = new sotf_Station($st['id'], $st);
     }
     return $slist;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:36,代码来源:sotf_Station.class.php

示例13: simpleSearch

 function simpleSearch($words, $language = false, $stationId = '')
 {
     global $db;
     $this->allid = array();
     $words = sotf_Utils::magicQuotes(strip_tags($words));
     //remove special chars
     $word = split(" ", $words);
     //split into separate words
     $max = count($word);
     //count words
     for ($i = 0; $i < $max; $i++) {
         $word[$i] = trim($word[$i]);
         //trim word
         if ($word[$i] == "") {
             continue;
         }
         //in empty get next
         //find word at the most common places
         $serial = str_replace("XXX", $word[$i], "production_date|Bstation|AAND|Bperson|Bcontains|BXXX|Bstring|AOR|Btitle|Bcontains|BXXX|Bstring|AOR|Bkeywords|Bcontains|BXXX|Bstring|AOR|Babstract|Bcontains|BXXX|Bstring|AOR|Bspatial_coverage|Bcontains|BXXX|Bstring");
         if ($language) {
             $serial .= "|AAND|Blanguage|Bis|B" . $language . "|Blang";
         }
         //if language given add to search options
         if ($stationId) {
             $serial .= "|AAND|Bstation|Bis|B" . $stationId . "|Bstation";
         }
         $this->Deserialize($serial);
         //deserialize query
         $query = $this->GetSQLCommand();
         //get desrialized query
         $query = "SELECT id FROM (" . $query . ") as a";
         $result = $db->getAll($query);
         $maxk = count($result);
         //count words
         for ($k = 0; $k < $maxk; $k++) {
             if (array_key_exists($result[$k]["id"], $this->allid)) {
                 $this->allid[$result[$k]["id"]] += 1;
             } else {
                 $this->allid[$result[$k]["id"]] = 1;
             }
         }
     }
     return count($this->allid);
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:44,代码来源:sotf_AdvSearch.class.php

示例14: findUsers

 /** Search for users. */
 function findUsers($pattern, $prefix = false)
 {
     global $userdb;
     $storage =& sotf_User::getStorageObject();
     $fields['pattern'] = sotf_Utils::magicQuotes($pattern);
     if ($prefix) {
         $fields['prefix'] = 1;
     }
     $res = $storage->userDbFind($fields);
     if (DB::isError($res)) {
         raiseError($res);
     }
     return $res;
 }
开发者ID:BackupTheBerlios,项目名称:sotf,代码行数:15,代码来源:sotf_User.class.php

示例15: login

 function login($name, $password)
 {
     global $user, $userdb, $page;
     $res = $userdb->getRow("SELECT auth_id, passwd FROM authenticate WHERE username='" . sotf_Utils::magicQuotes($name) . "'");
     if (DB::isError($res)) {
         raiseError($res);
     }
     if ($res['passwd'] != $password) {
         error_log("Login failed for {$name} from " . getHostName(), 0);
         return $page->getlocalized("invalid_login");
     } else {
         $user = new sotf_User($res['auth_id']);
         debug("Login successful", $user->name . ' = ' . $user->id);
         $userdb->query("UPDATE user_preferences SET num_logins=num_logins+1, last_visit='" . db_Wrap::getSQLDate() . "' WHERE auth_id='" . $user->id . "' ");
         $_SESSION['currentUserId'] = $user->id;
     }
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:17,代码来源:sotf_User.class.php


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