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


PHP PMF_Db::escape_string方法代码示例

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


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

示例1: addQuestion

 /**
  * Adds a new question
  *
  * @param    array  $questionData
  * @return   boolean
  * @access   public
  * @since    2006-09-09
  * @author   Thorsten Rinne <thorsten@phpmyfaq.de>
  */
 function addQuestion($questionData)
 {
     if (!is_array($questionData)) {
         return false;
     }
     $query = sprintf("\n            INSERT INTO\n                %sfaqquestions\n            VALUES\n                (%d, '%s', '%s', %d, '%s', '%s', '%s')", SQLPREFIX, $this->db->nextID(SQLPREFIX . 'faqquestions', 'id'), $this->db->escape_string($questionData['ask_username']), $this->db->escape_string($questionData['ask_usermail']), $questionData['ask_category'], $this->db->escape_string($questionData['ask_content']), $questionData['ask_date'], $questionData['is_visible']);
     $this->db->query($query);
     return true;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:18,代码来源:Faq.php

示例2: logSearchTerm

 /**
  * Logging of search terms for improvements
  *
  * @param  string $searchterm Search term
  * @return void
  */
 public function logSearchTerm($searchterm)
 {
     if (PMF_String::strlen($searchterm) == 0) {
         return;
     }
     $date = new DateTime();
     $query = sprintf("\n            INSERT INTO\n                %s\n            (id, lang, searchterm, searchdate)\n                VALUES\n            (%d, '%s', '%s', '%s')", $this->_table, $this->db->nextID($this->_table, 'id'), $this->language->getLanguage(), $this->db->escape_string($searchterm), $date->format('Y-m-d H:i:s'));
     $this->db->query($query);
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:15,代码来源:Search.php

示例3: logAdmin

 /**
  * Adds a new adminlog entry
  * 
  * @param PMF_User $user    PMF_User object
  * @param string   $logText Logged string
  * 
  * @return boolean
  */
 public function logAdmin(PMF_User $user, $logText = '')
 {
     if (PMF_Configuration::getInstance()->get('main.enableAdminLog')) {
         $query = sprintf("\n                INSERT INTO\n                    %sfaqadminlog\n                (id, time, usr, text, ip)\n                    VALUES \n                (%d, %d, %d, '%s', '%s')", SQLPREFIX, $this->db->nextID(SQLPREFIX . 'faqadminlog', 'id'), $_SERVER['REQUEST_TIME'], $user->userdata->get('user_id'), $this->db->escape_string(nl2br($logText)), $_SERVER['REMOTE_ADDR']);
         return $this->db->query($query);
     } else {
         return false;
     }
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:17,代码来源:Logging.php

示例4: getRecordsByTagName

 /**
  * Returns all FAQ record IDs where all tags are included
  *
  * @param  string $tagName The name of the tag
  * @return array
  */
 public function getRecordsByTagName($tagName)
 {
     if (!is_string($tagName)) {
         return false;
     }
     $query = sprintf("\n            SELECT\n                d.record_id AS record_id\n            FROM\n                %sfaqdata_tags d, %sfaqtags t\n            WHERE\n                t.tagging_id = d.tagging_id\n            AND \n                t.tagging_name = '%s'", SQLPREFIX, SQLPREFIX, $this->db->escape_string($tagName));
     $records = array();
     $result = $this->db->query($query);
     while ($row = $this->db->fetch_object($result)) {
         $records[] = $row->record_id;
     }
     return $records;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:19,代码来源:Tags.php

示例5: update

 /**
  * Updates all configuration items
  *
  * @param  array $newconfig Array with new configuration values
  * @return bool
  */
 public function update(array $newconfig)
 {
     if (is_array($newconfig)) {
         foreach ($newconfig as $name => $value) {
             if ($name != 'main.phpMyFAQToken') {
                 $update = sprintf("\n                        UPDATE\n                            %sfaqconfig\n                        SET\n                            config_value = '%s'\n                        WHERE\n                            config_name = '%s'", SQLPREFIX, $this->db->escape_string(trim($value)), $name);
                 $this->db->query($update);
                 if (isset($this->config[$name])) {
                     unset($this->config[$name]);
                 }
             }
         }
         return true;
     }
     return false;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:22,代码来源:Configuration.php

示例6: getRecordsFromLetter

 /**
  * Returns all records from the current first letter
  *
  * @param  string $letter Letter
  * @return array
  * @since  2007-03-30
  * @author Thorsten Rinne <thorsten@phpmyfaq.de>
  */
 public function getRecordsFromLetter($letter = 'A')
 {
     global $sids, $PMF_LANG;
     if ($this->groupSupport) {
         $permPart = sprintf("( fdg.group_id IN (%s)\n            OR\n                (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
     } else {
         $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
     }
     $letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));
     $writeMap = '';
     switch ($this->type) {
         case 'db2':
         case 'sqlite':
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTR(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
         default:
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTRING(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
     }
     $result = $this->db->query($query);
     $oldId = 0;
     while ($row = $this->db->fetch_object($result)) {
         if ($oldId != $row->id) {
             $title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
             $url = sprintf('%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
             $oLink->itemTitle = $row->thema;
             $oLink->text = $title;
             $oLink->tooltip = $title;
             $writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n";
             $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n";
         }
         $oldId = $row->id;
     }
     $writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>';
     return $writeMap;
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:45,代码来源:Sitemap.php

示例7: addQuestion

 /**
  * Adds a new question
  *
  * @param  array $questionData
  *
  * @return boolean
  */
 function addQuestion(array $questionData)
 {
     $query = sprintf("\n            INSERT INTO\n                %sfaqquestions\n            VALUES\n                (%d, '%s', '%s', %d, '%s', '%s', '%s')", SQLPREFIX, $this->db->nextID(SQLPREFIX . 'faqquestions', 'id'), $this->db->escape_string($questionData['username']), $this->db->escape_string($questionData['email']), $questionData['category_id'], $this->db->escape_string($questionData['question']), date('YmdHis'), $questionData['is_visible']);
     $this->db->query($query);
     return true;
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:13,代码来源:Faq.php


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