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


PHP PMF_Filter类代码示例

本文整理汇总了PHP中PMF_Filter的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Filter类的具体用法?PHP PMF_Filter怎么用?PHP PMF_Filter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setLanguage

 /**
  * Sets the current language for phpMyFAQ user session
  *
  * @param   bool    $config_detection Configuration detection
  * @param   string  $config_language  Language from configuration
  * @return  string
  */
 public function setLanguage($config_detection, $config_language)
 {
     global $sid;
     $_lang = array();
     self::_getUserAgentLanguage();
     // Get language from: _POST, _GET, _COOKIE, phpMyFAQ configuration and the automatic language detection
     $_lang['post'] = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
     if (!is_null($_lang['post']) && !self::isASupportedLanguage($_lang['post'])) {
         $_lang['post'] = null;
     }
     // Get the user language
     $_lang['get'] = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING);
     if (!is_null($_lang['get']) && !self::isASupportedLanguage($_lang['get'])) {
         $_lang['get'] = null;
     }
     // Get the faq record language
     $_lang['artget'] = PMF_Filter::filterInput(INPUT_GET, 'artlang', FILTER_SANITIZE_STRING);
     if (!is_null($_lang['artget']) && !self::isASupportedLanguage($_lang['artget'])) {
         $_lang['get'] = null;
     }
     // Get the language from the session
     if (isset($_SESSION['pmf_lang']) && self::isASupportedLanguage($_SESSION['pmf_lang'])) {
         $_lang['session'] = trim($_SESSION['pmf_lang']);
     }
     // Get the language from the config
     if (isset($config_language)) {
         $confLangCode = str_replace(array("language_", ".php"), "", $config_language);
         if (self::isASupportedLanguage($confLangCode)) {
             $_lang['config'] = $confLangCode;
         }
     }
     // Detect the browser's language
     if (true === $config_detection && self::isASupportedLanguage($this->acceptedLanguage)) {
         $_lang['detection'] = $this->acceptedLanguage;
     }
     // Select the language
     if (isset($_lang['post'])) {
         self::$language = $_lang['post'];
         $_lang = null;
         unset($_lang);
     } elseif (isset($_lang['get'])) {
         self::$language = $_lang['get'];
     } elseif (isset($_lang['session'])) {
         self::$language = $_lang['session'];
         $_lang = null;
         unset($_lang);
     } elseif (isset($_lang['detection'])) {
         self::$language = $_lang['detection'];
         $_lang = null;
         unset($_lang);
     } elseif (isset($_lang['config'])) {
         self::$language = $_lang['config'];
         $_lang = null;
         unset($_lang);
     } else {
         self::$language = 'en';
         // just a fallback
     }
     return $_SESSION['pmf_lang'] = self::$language;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:67,代码来源:Language.php

示例2: sendAskedQuestion

function sendAskedQuestion($username, $usermail, $usercat, $content)
{
    global $IDN, $category, $PMF_LANG, $faq, $faqconfig;
    $retval = false;
    $cat = new PMF_Category();
    $categories = $cat->getAllCategories();
    if ($faqconfig->get('records.enableVisibilityQuestions')) {
        $visibility = 'N';
    } else {
        $visibility = 'Y';
    }
    $questionData = array('ask_username' => $username, 'ask_usermail' => $IDN->encode($usermail), 'ask_category' => $usercat, 'ask_content' => $content, 'ask_date' => date('YmdHis'), 'is_visible' => $visibility);
    list($user, $host) = explode("@", $questionData['ask_usermail']);
    if (PMF_Filter::filterVar($questionData['ask_usermail'], FILTER_VALIDATE_EMAIL) != false) {
        $faq->addQuestion($questionData);
        $questionMail = "User: " . $questionData['ask_username'] . ", mailto:" . $questionData['ask_usermail'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['ask_category']]["name"] . "\n\n" . wordwrap($content, 72);
        $userId = $category->getCategoryUser($questionData['ask_category']);
        $oUser = new PMF_User();
        $oUser->getUserById($userId);
        $userEmail = $oUser->getUserData('email');
        $mainAdminEmail = $faqconfig->get('main.administrationMail');
        $mail = new PMF_Mail();
        $mail->unsetFrom();
        $mail->setFrom($questionData['ask_usermail'], $questionData['ask_username']);
        $mail->addTo($mainAdminEmail);
        // Let the category owner get a copy of the message
        if ($userEmail && $mainAdminEmail != $userEmail) {
            $mail->addCc($userEmail);
        }
        $mail->subject = '%sitename%';
        $mail->message = $questionMail;
        $retval = $mail->send();
    }
    return $retval;
}
开发者ID:noon,项目名称:phpMyFAQ,代码行数:35,代码来源:savequestion.php

示例3: userTracking

 /**
  * Tracks the user and log what he did
  *
  * @param  string  $action Action string
  * @param  integer $id     Current ID
  *
  * @return void
  */
 public function userTracking($action, $id = 0)
 {
     global $sid, $user, $botBlacklist;
     if ($this->_config->get('main.enableUserTracking')) {
         $bots = 0;
         $banned = false;
         $agent = $_SERVER['HTTP_USER_AGENT'];
         $sid = PMF_Filter::filterInput(INPUT_GET, PMF_GET_KEY_NAME_SESSIONID, FILTER_VALIDATE_INT);
         $sidc = PMF_Filter::filterInput(INPUT_COOKIE, self::PMF_COOKIE_NAME_SESSIONID, FILTER_VALIDATE_INT);
         if (!is_null($sidc)) {
             $sid = $sidc;
         }
         if ($action == 'old_session') {
             $sid = null;
         }
         foreach ($botBlacklist as $bot) {
             if ((bool) PMF_String::strstr($agent, $bot)) {
                 $bots++;
             }
         }
         $network = new PMF_Network($this->_config);
         // if we're running behind a reverse proxy like nginx/varnish, fix the client IP
         $remoteAddr = $_SERVER['REMOTE_ADDR'];
         $localAddresses = array('127.0.0.1', '::1');
         if (in_array($remoteAddr, $localAddresses) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             $remoteAddr = $_SERVER['HTTP_X_FORWARDED_FOR'];
         }
         // clean up as well
         $remoteAddr = preg_replace('([^0-9a-z:\\.]+)i', '', $remoteAddr);
         if (!$network->checkIp($remoteAddr)) {
             $banned = true;
         }
         if (0 == $bots && false == $banned) {
             if (!isset($sid)) {
                 $sid = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix() . 'faqsessions', 'sid');
                 // Sanity check: force the session cookie to contains the current $sid
                 if (!is_null($sidc) && !$sidc != $sid) {
                     self::setCookie(self::PMF_COOKIE_NAME_SESSIONID, $sid);
                 }
                 $query = sprintf("\n                        INSERT INTO \n                            %sfaqsessions\n                        (sid, user_id, ip, time)\n                            VALUES\n                        (%d, %d, '%s', %d)", PMF_Db::getTablePrefix(), $sid, $user ? $user->getUserId() : -1, $remoteAddr, $_SERVER['REQUEST_TIME']);
                 $this->_config->getDb()->query($query);
             }
             $data = $sid . ';' . str_replace(';', ',', $action) . ';' . $id . ';' . $remoteAddr . ';' . str_replace(';', ',', isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '') . ';' . str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . ';' . str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])) . ';' . $_SERVER['REQUEST_TIME'] . ";\n";
             $file = './data/tracking' . date('dmY');
             if (is_writeable($file)) {
                 file_put_contents($file, $data, FILE_APPEND);
             } else {
                 throw new PMF_Exception('Cannot write to ' . $file);
             }
         }
     }
 }
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:60,代码来源:Session.php

示例4: userTracking

 /**
  * Tracks the user and log what he did
  * 
  * @param  string  $action Action string
  * @param  integer $id     Current ID
  * 
  * @return void
  */
 public function userTracking($action, $id = 0)
 {
     global $sid, $user, $botBlacklist;
     if (PMF_Configuration::getInstance()->get('main.enableUserTracking')) {
         $bots = 0;
         $banned = false;
         $agent = $_SERVER['HTTP_USER_AGENT'];
         $sid = PMF_Filter::filterInput(INPUT_GET, PMF_GET_KEY_NAME_SESSIONID, FILTER_VALIDATE_INT);
         $sidc = PMF_Filter::filterInput(INPUT_COOKIE, PMF_COOKIE_NAME_SESSIONID, FILTER_VALIDATE_INT);
         if (!is_null($sidc)) {
             $sid = $sidc;
         }
         if ($action == 'old_session') {
             $sid = null;
         }
         foreach ($botBlacklist as $bot) {
             if ((bool) PMF_String::strstr($agent, $bot)) {
                 $bots++;
             }
         }
         $network = new PMF_Network();
         if (!$network->checkIp($_SERVER['REMOTE_ADDR'])) {
             $banned = true;
         }
         if (0 == $bots && false == $banned) {
             if (!isset($sid)) {
                 $sid = $this->db->nextID(SQLPREFIX . 'faqsessions', 'sid');
                 // Sanity check: force the session cookie to contains the current $sid
                 if (!is_null($sidc) && !$sidc != $sid) {
                     self::setCookie($sid);
                 }
                 $query = sprintf("\n                        INSERT INTO \n                            %sfaqsessions\n                        (sid, user_id, ip, time)\n                            VALUES\n                        (%d, %d, '%s', %d)", SQLPREFIX, $sid, $user ? $user->getUserId() : -1, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_TIME']);
                 $this->db->query($query);
             }
             $data = $sid . ';' . str_replace(';', ',', $action) . ';' . $id . ';' . $_SERVER['REMOTE_ADDR'] . ';' . str_replace(';', ',', $_SERVER['QUERY_STRING']) . ';' . str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . ';' . str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])) . ';' . $_SERVER['REQUEST_TIME'] . ";\n";
             $file = './data/tracking' . date('dmY');
             file_put_contents($file, $data, FILE_APPEND);
         }
     }
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:48,代码来源:Session.php

示例5: sendAskedQuestion

function sendAskedQuestion($username, $usermail, $usercat, $content)
{
    global $PMF_LANG, $faq;
    $retval = false;
    $faqconfig = PMF_Configuration::getInstance();
    $categoryNode = new PMF_Category_Node();
    if ($faqconfig->get('records.enableVisibilityQuestions')) {
        $visibility = 'N';
    } else {
        $visibility = 'Y';
    }
    $questionData = array('id' => null, 'username' => $username, 'email' => $usermail, 'category_id' => $usercat, 'question' => $content, 'date' => date('YmdHis'), 'is_visible' => $visibility);
    list($user, $host) = explode("@", $questionData['email']);
    if (PMF_Filter::filterVar($questionData['email'], FILTER_VALIDATE_EMAIL) != false) {
        $faqQuestions = new PMF_Faq_Questions();
        $faqQuestions->create($questionData);
        $categoryData = $categoryNode->fetch($questionData['category_id']);
        $questionMail = "User: " . $questionData['username'] . ", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categoryData->name . "\n\n" . wordwrap($content, 72);
        $userId = $categoryData->user_id;
        $oUser = new PMF_User();
        $oUser->getUserById($userId);
        $userEmail = $oUser->getUserData('email');
        $mainAdminEmail = $faqconfig->get('main.administrationMail');
        $mail = new PMF_Mail();
        $mail->unsetFrom();
        $mail->setFrom($questionData['email'], $questionData['username']);
        $mail->addTo($mainAdminEmail);
        // Let the category owner get a copy of the message
        if ($userEmail && $mainAdminEmail != $userEmail) {
            $mail->addCc($userEmail);
        }
        $mail->subject = '%sitename%';
        $mail->message = $questionMail;
        $retval = $mail->send();
    }
    return $retval;
}
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:37,代码来源:savequestion.php

示例6: header

 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN') || !$permission['editconfig']) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING);
$stopword_id = PMF_Filter::filterInput(INPUT_GET, 'stopword_id', FILTER_VALIDATE_INT);
$stopword = PMF_Filter::filterInput(INPUT_GET, 'stopword', FILTER_SANITIZE_STRING);
$stopwords_lang = PMF_Filter::filterInput(INPUT_GET, 'stopwords_lang', FILTER_SANITIZE_STRING);
switch ($ajax_action) {
    case 'load_stop_words_by_lang':
        if (PMF_Language::isASupportedLanguage($stopwords_lang)) {
            $stop_words_list = PMF_Stopwords::getInstance()->getByLang($stopwords_lang);
            header('Content-Type: application/json');
            print json_encode($stop_words_list);
        }
        break;
    case 'delete_stop_word':
        if (null != $stopword_id && PMF_Language::isASupportedLanguage($stopwords_lang)) {
            $pmf_sw = PMF_Stopwords::getInstance();
            $pmf_sw->setLanguage($stopwords_lang);
            $pmf_sw->remove($stopword_id);
        }
        break;
开发者ID:noon,项目名称:phpMyFAQ,代码行数:31,代码来源:ajax.config.php

示例7: header

 * @link      http://www.phpmyfaq.de
 * @since     2002-08-29
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $Language);
$captcha->setSessionId($sids);
$type = PMF_Filter::filterInput(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
$faqid = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT, 0);
$newsid = PMF_Filter::filterInput(INPUT_POST, 'newsid', FILTER_VALIDATE_INT);
$user = PMF_Filter::filterInput(INPUT_POST, 'user', FILTER_SANITIZE_STRING);
$mail = PMF_Filter::filterInput(INPUT_POST, 'mail', FILTER_VALIDATE_EMAIL);
$comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRIPPED);
$message = '';
switch ($type) {
    case 'news':
        $id = $newsid;
        $msgWriteComment = $PMF_LANG['newsWriteComment'];
        break;
    case 'faq':
    default:
        $id = $faqid;
        $msgWriteComment = $PMF_LANG['msgWriteComment'];
        break;
}
// If e-mail address is set to optional
if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($mail)) {
    $mail = PMF_Configuration::getInstance()->get('main.administrationMail');
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:31,代码来源:savecomment.php

示例8: sprintf

        }
        $userError = $user->error();
        if ($userError != "") {
            $message .= sprintf('<p class="alert alert-danger">%s</p>', $userError);
        }
    }
}
if ($groupAction == 'addsave' && $user->perm->checkRight($user->getUserId(), 'addgroup')) {
    $user = new PMF_User($faqConfig);
    $message = '';
    $messages = [];
    $group_name = PMF_Filter::filterInput(INPUT_POST, 'group_name', FILTER_SANITIZE_STRING, '');
    $group_description = PMF_Filter::filterInput(INPUT_POST, 'group_description', FILTER_SANITIZE_STRING, '');
    $group_auto_join = PMF_Filter::filterInput(INPUT_POST, 'group_auto_join', FILTER_SANITIZE_STRING, '');
    $csrfOkay = true;
    $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
    if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
        $csrfOkay = false;
    }
    // check group name
    if ($group_name == '') {
        $messages[] = $PMF_LANG['ad_group_error_noName'];
    }
    // ok, let's go
    if (count($messages) == 0 && $csrfOkay) {
        // create group
        $group_data = array('name' => $group_name, 'description' => $group_description, 'auto_join' => $group_auto_join);
        if ($user->perm->addGroup($group_data) <= 0) {
            $messages[] = $PMF_LANG['ad_adus_dberr'];
        }
    }
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:31,代码来源:group.php

示例9: header

    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
?>
    <header>
        <h2><i class="icon-wrench"></i> <?php 
echo $PMF_LANG['ad_menu_instances'];
?>
</h2>
    </header>
<?php 
if ($permission['editinstances']) {
    $instanceId = PMF_Filter::filterInput(INPUT_GET, 'instance_id', FILTER_VALIDATE_INT);
    $instance = new PMF_Instance($faqConfig);
    $instanceData = $instance->getInstanceById($instanceId);
    ?>
    <form class="form-horizontal" action="?action=updateinstance" method="post" accept-charset="utf-8">
        <input type="hidden" name="instance_id" value="<?php 
    echo $instanceData->id;
    ?>
" />
        <div class="control-group">
            <label class="control-label"><?php 
    echo $PMF_LANG["ad_instance_url"];
    ?>
:</label>
            <div class="controls">
                <input type="url" name="url" id="url" required="required" value="<?php 
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:31,代码来源:instances.edit.php

示例10: header

 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING);
$user_id = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT);
$usersearch = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
if ($permission['adduser'] || $permission['edituser'] || $permission['deluser']) {
    $user = new PMF_User();
    if ('get_user_list' == $ajax_action) {
        foreach ($user->searchUsers($usersearch) as $single_user) {
            print $single_user['login'] . '|' . $single_user['user_id'] . "\n";
        }
    }
    $user->getUserById($user_id);
    // Return the user data
    if ('get_user_data' == $ajax_action) {
        $userdata = array();
        $userdata = $user->userdata->get('*');
        $userdata['status'] = $user->getStatus();
        print json_encode(array_map('utf8_encode', $userdata));
    }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:31,代码来源:ajax.user.php

示例11: printf

<h1 id="header">phpMyFAQ <?php 
print NEWVERSION;
?>
 Update</h1>

<?php 
if (version_compare(PHP_VERSION, MINIMUM_PHP_VERSION, '<')) {
    printf("<p class=\"center\">Sorry, but you need PHP %s or later!</p>\n", MINIMUM_PHP_VERSION);
    HTMLFooter();
    die;
}
require_once PMF_ROOT_DIR . '/inc/autoLoader.php';
require_once PMF_ROOT_DIR . '/config/constants.php';
$step = PMF_Filter::filterInput(INPUT_GET, 'step', FILTER_VALIDATE_INT, 1);
$version = PMF_Filter::filterInput(INPUT_POST, 'version', FILTER_SANITIZE_STRING);
$query = array();
$templateDir = '../template';
/**
 * Print out the HTML Footer
 *
 * @return void
 */
function HTMLFooter()
{
    printf('<p class="center">%s</p></body></html>', COPYRIGHT);
}
if (!is_readable(PMF_ROOT_DIR . '/inc/data.php') && !is_readable(PMF_ROOT_DIR . '/config/database.php')) {
    print '<p class="center">It seems you never run a version of phpMyFAQ.<br />' . 'Please use the <a href="setup.php">install script</a>.</p>';
    HTMLFooter();
    die;
开发者ID:rybal06,项目名称:phpMyFAQ,代码行数:30,代码来源:update.php

示例12: header

 * @since     2005-12-15
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    $protocol = 'http';
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
// Send headers
$http = new PMF_Helper_Http();
$http->setContentType('application/json');
$http->addHeader();
$oTag = new PMF_Tags($faqConfig);
$autoCompleteValue = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED);
if (!is_null($autoCompleteValue)) {
    if (strpos($autoCompleteValue, ',')) {
        $arrayOfValues = explode(',', $autoCompleteValue);
        $autoCompleteValue = end($arrayOfValues);
    }
    $tags = $oTag->getAllTags(strtolower($autoCompleteValue), PMF_TAGS_CLOUD_RESULT_SET_SIZE, true);
} else {
    $tags = $oTag->getAllTags();
}
if ($permission['editbt']) {
    $i = 0;
    $tagNames = array();
    foreach ($tags as $tagName) {
        $i++;
        if ($i <= PMF_TAGS_AUTOCOMPLETE_RESULT_SET_SIZE) {
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:31,代码来源:ajax.tags_list.php

示例13: array_merge

 $sortby = null;
 $linkState = PMF_Filter::filterInput(INPUT_POST, 'linkstate', FILTER_SANITIZE_STRING);
 $searchcat = PMF_Filter::filterInput(INPUT_POST, 'searchcat', FILTER_VALIDATE_INT);
 $searchterm = PMF_Filter::filterInput(INPUT_POST, 'searchterm', FILTER_SANITIZE_STRIPPED);
 if (!is_null($linkState)) {
     $cond[SQLPREFIX . 'faqdata.links_state'] = 'linkbad';
     $linkState = ' checked="checked" ';
     $internalSearch .= '&amp;linkstate=linkbad';
 }
 if (!is_null($searchcat)) {
     $internalSearch .= "&amp;searchcat=" . $searchcat;
     $cond[SQLPREFIX . 'faqcategoryrelations.category_id'] = array_merge(array($searchcat), $category->getChildNodes($searchcat));
 }
 $currentcategory = PMF_Filter::filterInput(INPUT_GET, 'category', FILTER_VALIDATE_INT);
 $orderby = PMF_Filter::filterInput(INPUT_GET, 'orderby', FILTER_SANITIZE_STRING, 1);
 $sortby = PMF_Filter::filterInput(INPUT_GET, 'sortby', FILTER_SANITIZE_STRING);
 if ($orderby != 1) {
     switch ($orderby) {
         case 'id':
             $orderby = 1;
             break;
         case 'title':
             $orderby = 2;
             break;
         case 'date':
             $orderby = 3;
             break;
     }
 }
 ?>
 <form action="?action=view" method="post">
开发者ID:rybal06,项目名称:phpMyFAQ,代码行数:31,代码来源:record.show.php

示例14: PMF_Auth

?>
</h2>
        </header>
<?php 
if ($permission["passwd"]) {
    // If we have to save a new password, do that first
    $save = PMF_Filter::filterInput(INPUT_POST, 'save', FILTER_SANITIZE_STRING);
    if (!is_null($save)) {
        // Define the (Local/Current) Authentication Source
        $auth = new PMF_Auth($faqConfig);
        $authSource = $auth->selectAuth($user->getAuthSource('name'));
        $authSource->selectEncType($user->getAuthData('encType'));
        $authSource->setReadOnly($user->getAuthData('readOnly'));
        $oldPassword = PMF_Filter::filterInput(INPUT_POST, 'opass', FILTER_SANITIZE_STRING);
        $newPassword = PMF_Filter::filterInput(INPUT_POST, 'npass', FILTER_SANITIZE_STRING);
        $retypedPassword = PMF_Filter::filterInput(INPUT_POST, 'bpass', FILTER_SANITIZE_STRING);
        if ($authSource->checkPassword($user->getLogin(), $oldPassword) && $newPassword == $retypedPassword) {
            if (!$user->changePassword($newPassword)) {
                printf('<p class="alert alert-error">%s</p>', $PMF_LANG["ad_passwd_fail"]);
            }
            printf('<p class="alert alert-success">%s</p>', $PMF_LANG["ad_passwdsuc"]);
        } else {
            printf('<p class="alert alert-error">%s</p>', $PMF_LANG["ad_passwd_fail"]);
        }
    }
    ?>
        <form class="form-horizontal" action="?action=passwd" method="post" accept-charset="utf-8">
        <input type="hidden" name="save" value="newpassword" />
            <div class="control-group">
                <label class="control-label" for="opass"><?php 
    echo $PMF_LANG["ad_passwd_old"];
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:31,代码来源:pwd.change.php

示例15: sprintf

    $faq->getRecordBySolutionId($solution_id);
}
$faqvisits = PMF_Visits::getInstance();
$faqvisits->logViews($faq->faqRecord['id']);
$content = $faq->faqRecord['content'];
$thema = $faq->getRecordTitle($faq->faqRecord['id']);
// Add Glossary entries
$content = $oGlossary->insertItemsIntoContent($content);
$thema = $oGlossary->insertItemsIntoContent($thema);
// Set the path of the current category
$categoryName = $categoryLayout->renderBreadcrumb($categoryPath);
$changeLanguagePath = PMF_Link::getSystemRelativeUri() . sprintf('?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $currentCategory, $id, $LANGCODE);
$oLink = new PMF_Link($changeLanguagePath);
$oLink->itemTitle = $faq->getRecordTitle($record_id, false);
$changeLanguagePath = $oLink->toString();
$highlight = PMF_Filter::filterInput(INPUT_GET, 'highlight', FILTER_SANITIZE_STRIPPED);
if (!is_null($highlight) && $highlight != "/" && $highlight != "<" && $highlight != ">" && PMF_String::strlen($highlight) > 3) {
    $highlight = str_replace("'", "´", $highlight);
    $highlight = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']'), '', $highlight);
    $highlight = preg_quote($highlight, '/');
    $searchItems = explode(' ', $highlight);
    $attributes = array('href', 'src', 'title', 'alt', 'class', 'style', 'id', 'name', 'face', 'size', 'dir', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup');
    foreach ($searchItems as $item) {
        $thema = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((' . implode('|', $attributes) . ')="[^"]*' . $item . '[^"]*")|' . '(\\s+)(' . $item . ')(\\s+)' . '/mis', 'highlight_no_links', $thema);
        $content = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((' . implode('|', $attributes) . ')="[^"]*' . $item . '[^"]*")|' . '(\\s+)(' . $item . ')(\\s+)' . '/mis', 'highlight_no_links', $content);
    }
}
// Hack: Apply the new SEO schema to those HTML anchors to
//       other faq records (Internal Links) added with WYSIWYG Editor:
//         href="index.php?action=artikel&cat=NNN&id=MMM&artlang=XYZ"
// Search for href attribute links
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:31,代码来源:artikel.php


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