本文整理汇总了PHP中Filters类的典型用法代码示例。如果您正苦于以下问题:PHP Filters类的具体用法?PHP Filters怎么用?PHP Filters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Filters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duom_anal
public function duom_anal()
{
$page = new AdminPage();
$panel = new DuomenuAnalizePanel();
$panel1 = new Lenteles1();
$panel2 = new Filters();
$page->addToContainer(1, $panel1->getHtml());
$page->addToContainer(2, $panel->getHtml());
$page->addToContainer(2, $panel2->getHtml());
$page->pagePrint();
}
示例2: tpl_list_heading
function tpl_list_heading($colname, $format = "<th%s>%s</th>")
{
global $proj, $page;
$imgbase = '<img src="%s" alt="%s" />';
$class = '';
$html = eL($colname);
if ($colname == 'comments' || $colname == 'attachments') {
$html = sprintf($imgbase, $page->get_image(substr($colname, 0, -1)), $html);
}
if (Get::val('order') == $colname) {
$class = ' class="orderby"';
$sort1 = Get::safe('sort', 'desc') == 'desc' ? 'asc' : 'desc';
$sort2 = Get::safe('sort2', 'desc');
$order2 = Get::safe('order2');
$html .= ' ' . sprintf($imgbase, $page->get_image(Get::val('sort')), Get::safe('sort'));
} else {
$sort1 = 'desc';
if (in_array($colname, array('project', 'tasktype', 'category', 'openedby', 'assignedto'))) {
$sort1 = 'asc';
}
$sort2 = Get::safe('sort', 'desc');
$order2 = Get::safe('order');
}
$new_order = array('order' => $colname, 'sort' => $sort1, 'order2' => $order2, 'sort2' => $sort2);
$html = sprintf('<a title="%s" href="%s">%s</a>', eL('sortthiscolumn'), Filters::noXSS(CreateURL('index', $proj->id, null, array_merge($_GET, $new_order))), $html);
return sprintf($format, $class, $html);
}
示例3: omitFilter
/**
* @deprecated
*/
public static function omitFilter($method, $filter)
{
$message = '%s is deprecated, please use %::removeMethodFilter()';
trigger_error(sprintf($message, __METHOD__, __CLASS__), E_USER_DEPRECATED);
list(, $method) = Filters::target($method);
return $this->removeMethodFilter($method, $filter);
}
示例4: beforeCache
function beforeCache(&$input, $plugins)
{
$input = preg_replace('|[[:space:]]+[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]|', '<a href="\\0">\\0</a>', $input);
$input = preg_replace('/[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]{2,5}/', '<a href="mailto:\\0">\\0</a>', $input);
if (!in_array('WikiSyntax', $plugins)) {
$input = '<p>' . nl2br(Filters::noXSS($input)) . '</p>';
}
}
示例5: filterData
/**
* Filter data.
* @param $data string|int|array|object
* @return mixed Filtered data
*/
public function filterData($data)
{
$data_type = gettype($data);
if ($data_type == 'array' || $data_type == 'object') {
$data = Filters::filterKeyValuePairs($data);
} elseif ($data_type == 'string') {
$data = Filters::filterString($data);
}
return $data;
}
示例6: getKills
/**
* Returns kills in json format according to the specified parameters
*
* @static
* @param array $parameters
* @return array
*/
public static function getKills($parameters = array())
{
$ip = IP::get();
$userAgent = @$_SERVER["HTTP_USER_AGENT"];
Log::log("API Fetch: " . $_SERVER["REQUEST_URI"] . " (" . $ip . " / " . $userAgent . ")");
$tables = array();
$orWhereClauses = array();
$andWhereClauses = array();
Filters::buildFilters($tables, $orWhereClauses, $andWhereClauses, $parameters, true);
$tables = array_unique($tables);
//if (sizeof($tables) > 1) throw new Exception("Advanced multi-table searching is currently disabled");
if (sizeof($tables) == 0) {
$tables[] = "zz_participants p";
}
if (sizeof($tables) == 2) {
$tablePrefix = "k";
} else {
$tablePrefix = substr($tables[0], strlen($tables[0]) - 1, 1);
}
$query = "select distinct {$tablePrefix}.killID from ";
$query .= implode(" left join ", array_unique($tables));
if (sizeof($tables) == 2) {
$query .= " on (k.killID = p.killID) ";
}
if (sizeof($andWhereClauses) || sizeof($orWhereClauses)) {
$query .= " where ";
if (sizeof($orWhereClauses) > 0) {
$andOr = array_key_exists("combined", $parameters) && $parameters["combined"] == true ? " or " : " and ";
$query .= " ( " . implode($andOr, $orWhereClauses) . " ) ";
if (sizeof($andWhereClauses)) {
$query .= " and ";
}
}
if (sizeof($andWhereClauses)) {
$query .= implode(" and ", $andWhereClauses);
}
}
if (array_key_exists("limit", $parameters) && $parameters["limit"] < 200) {
$limit = $parameters["limit"];
$offset = 0;
} else {
$limit = 200;
// Hardcoded, yes. This number should never change. -- Squizz
$page = array_key_exists("page", $parameters) ? (int) $parameters["page"] : 1;
$offset = ($page - 1) * $limit;
}
$orderDirection = array_key_exists("orderDirection", $parameters) ? $parameters["orderDirection"] : "desc";
$query .= " order by {$tablePrefix}.dttm {$orderDirection} limit {$offset}, {$limit}";
$cacheTime = 3600;
$kills = Db::query($query, array(), $cacheTime);
return self::getJSON($kills, $parameters);
}
示例7: getUrlImage
public static function getUrlImage($str)
{
//removendo os acentos
$str = trim($str);
$str = Filters::remove_accents($str);
//trocando espaço em branco por underline
$str = eregi_replace('( )', '_', $str);
//tirando outros caracteres invalidos
$str = eregi_replace('[^a-z0-9\\_]', '', $str);
//trocando duplo,tripo,quadrupo... espaço (underline) por 1 underline só
$str = eregi_replace('[\\_]{2,}', '', $str);
return strtolower($str);
}
示例8: getKills
/**
* Gets killmails
*
* @param $parameters an array of parameters to fetch mails for
* @param $allTime gets all mails from the beginning of time or not
* @return array
*/
public static function getKills($parameters = array(), $allTime = true)
{
$tables = array();
$orWhereClauses = array();
$andWhereClauses = array();
Filters::buildFilters($tables, $orWhereClauses, $andWhereClauses, $parameters, $allTime);
$tables = array_unique($tables);
if (sizeof($tables) == 0) {
$tables[] = "zz_participants p";
}
if (sizeof($tables) == 2) {
$tablePrefix = "k";
} else {
$tablePrefix = substr($tables[0], strlen($tables[0]) - 1, 1);
}
$query = "select distinct {$tablePrefix}.killID from ";
$query .= implode(" left join ", array_unique($tables));
if (sizeof($tables) == 2) {
$query .= " on (k.killID = p.killID) ";
}
if (sizeof($andWhereClauses) || sizeof($orWhereClauses)) {
$query .= " where ";
if (sizeof($orWhereClauses) > 0) {
$andOr = array_key_exists("combined", $parameters) && $parameters["combined"] == true ? " or " : " and ";
$query .= " ( " . implode($andOr, $orWhereClauses) . " ) ";
if (sizeof($andWhereClauses)) {
$query .= " and ";
}
}
if (sizeof($andWhereClauses)) {
$query .= implode(" and ", $andWhereClauses);
}
}
$limit = array_key_exists("limit", $parameters) ? (int) $parameters["limit"] : 50;
$page = array_key_exists("page", $parameters) ? (int) $parameters["page"] : 1;
$offset = ($page - 1) * $limit;
$orderBy = array_key_exists("orderBy", $parameters) ? $parameters["orderBy"] : "{$tablePrefix}.dttm";
$orderDirection = array_key_exists("orderDirection", $parameters) ? $parameters["orderDirection"] : "desc";
$query .= " order by {$orderBy} {$orderDirection} limit {$offset}, {$limit}";
$cacheTime = array_key_exists("cacheTime", $parameters) ? (int) $parameters["cacheTime"] : 120;
$cacheTime = max(120, $cacheTime);
if (array_key_exists("log", $parameters)) {
Db::log($query, array());
}
$kills = Db::query($query, array(), $cacheTime);
$merged = self::getKillsDetails($kills);
return $merged;
}
示例9: imageAttachment
function imageAttachment($matches)
{
global $db, $baseurl, $user;
// we'll not blindly make images out of all attachments
$ext = substr($matches[1], -3);
if (!in_array($ext, array('png', 'jpg', 'gif'))) {
return $matches[0];
}
$att = $db->x->getRow('SELECT * FROM {attachments} WHERE orig_name = ?', null, $matches[1]);
$task = Flyspray::GetTaskDetails($att['task_id']);
if ($att && $user->can_view_task($task)) {
return sprintf('<img src="%s" alt="%s" />', Filters::noXSS($baseurl . '?getfile=' . $att['attachment_id']), Filters::noXSS($att['orig_name']));
} else {
return $matches[0];
}
}
示例10: action_updateproject
function action_updateproject()
{
global $proj, $db, $baseurl;
if (Post::val('delete_project')) {
$url = Post::val('move_to') ? CreateURL(array('pm', 'proj' . Post::num('move_to'), 'prefs')) : $baseurl;
if (Backend::delete_project($proj->id, Post::val('move_to'))) {
return array(SUBMIT_OK, L('projectdeleted'), $url);
} else {
return array(ERROR_INPUT, L('projectnotdeleted'), $url);
}
}
if (!Post::val('project_title')) {
return array(ERROR_RECOVER, L('emptytitle'));
}
$cols = array('project_title', 'theme_style', 'lang_code', 'default_task', 'default_entry', 'intro_message', 'notify_email', 'notify_jabber', 'notify_subject', 'notify_reply', 'feed_description', 'feed_img_url', 'svn_user', 'svn_url', 'svn_password', 'mail_headers');
$args = array_map('Post_to0', $cols);
foreach (array('others_view', 'anon_open', 'send_digest', 'anon_view_tasks', 'anon_group', 'comment_closed', 'auto_assign', 'roadmap_field', 'override_user_lang') as $name) {
$cols[] = $name;
$args[] = Post::num($name);
}
foreach (array('notify_types', 'changelog_reso', 'syntax_plugins') as $name) {
$cols[] = $name;
$args[] = implode(' ', (array) Post::val($name));
}
// invalidate the cache if necessary
if (implode(' ', (array) Post::val('syntax_plugins')) != $proj->prefs['syntax_plugins']) {
$db->execParam('DELETE FROM {cache} WHERE project_id = ?', $proj->id);
}
// carefully check the project prefix...
$prefix = Post::val('project_prefix');
// already in use?
$use = $db->x->GetOne('SELECT project_id FROM {projects} WHERE project_prefix = ? AND project_id != ?', null, array($prefix, $proj->id));
if (Filters::isAlnum($prefix) && $prefix != 'FS' && !$use) {
$cols[] = 'project_prefix';
$args[] = $prefix;
} else {
return array(ERROR_RECOVER, L('badprefix'));
}
$cols[] = 'last_updated';
$args[] = time();
$cols[] = 'default_cat_owner';
$args[] = Flyspray::UserNameToId(Post::val('default_cat_owner'));
$db->x->autoExecute('{projects}', array_combine($cols, $args), MDB2_AUTOQUERY_UPDATE, sprintf('project_id = %d', $proj->id));
$db->x->execParam('UPDATE {projects} SET visible_columns = ? WHERE project_id = ?', array(trim(Post::val('visible_columns')), $proj->id));
return array(SUBMIT_OK, L('projectupdated'));
}
示例11: Project
function Project($id)
{
global $db, $fs;
// Get custom fields
$fields = $db->x->getAll('SELECT f.*, l.list_type
FROM {fields} f
LEFT JOIN {lists} l ON f.list_id = l.list_id
WHERE f.project_id IN (0, ?) ORDER BY field_name', null, array($id));
foreach ($fields as $field) {
$f = new Field($field);
if ($f->id == $fs->prefs['color_field']) {
$f->values = $this->get_list($f->prefs, $f->id);
}
$this->fields['field' . $field['field_id']] = $f;
}
$this->columns = array_combine($this->columns, array_map('L', $this->columns));
foreach ($this->fields as $field) {
$this->columns['field' . $field->id] = $field->prefs['field_name'];
}
if (is_numeric($id) && $id > 0) {
$this->prefs = $db->x->getRow("SELECT p.*, c.content AS pm_instructions, c.last_updated AS cache_update\n FROM {projects} p\n LEFT JOIN {cache} c ON c.topic = p.project_id AND c.type = 'msg'\n WHERE p.project_id = ?", null, array($id));
if (is_array($this->prefs)) {
$this->id = (int) $this->prefs['project_id'];
$this->prefs['visible_columns'] = implode(' ', array_intersect(explode(' ', $this->prefs['visible_columns']), array_keys($this->columns)));
$this->prefs['theme_style'] = Filters::enum($this->prefs['theme_style'], Flyspray::listThemes());
return;
}
}
$this->id = 0;
$this->prefs = array();
$this->prefs['project_title'] = L('allprojects');
$this->prefs['feed_description'] = L('feedforall');
$this->prefs['theme_style'] = $fs->prefs['global_theme'];
$this->prefs['theme_style'] = Filters::enum($this->prefs['theme_style'], Flyspray::listThemes());
$this->prefs['lang_code'] = $fs->prefs['lang_code'];
$this->prefs['others_view'] = 1;
$this->prefs['intro_message'] = '';
$this->prefs['anon_open'] = $this->prefs['override_user_lang'] = 0;
$this->prefs['feed_img_url'] = '';
$this->prefs['default_entry'] = $fs->prefs['default_entry'];
$this->prefs['notify_reply'] = '';
$fs->prefs['visible_columns'] = implode(' ', array_intersect(explode(' ', $fs->prefs['visible_columns']), array_keys($this->columns)));
return;
}
示例12: get_userlist_by_filter
public function get_userlist_by_filter()
{
if (!empty($this->postData['filter_set'])) {
$filter_set = \Filters::getInstance();
$filter_set->setResellerID(array_key_exists('reseller', $this->postData) ? $this->postData['reseller'] : 0);
$filter_set->initData('users', 'id');
$curr_filter_set = \Mysql::getInstance()->from('filter_set')->where(array('id' => $this->postData['filter_set']))->get()->first();
if (!empty($curr_filter_set) && ($unserialize_data = @unserialize($curr_filter_set['filter_set']))) {
$filter_data = array();
foreach ($unserialize_data as $row) {
$filter_data[$row[0]] = $row;
}
$filters_with_cond = array_filter(array_map(function ($row) use($filter_data) {
if (array_key_exists($row['text_id'], $filter_data)) {
$value = $row['text_id'] == 'status' || $row['text_id'] == 'state' ? (int) ($filter_data[$row['text_id']][2] - 1 > 0) : $filter_data[$row['text_id']][2];
return array($row['method'], $filter_data[$row['text_id']][1], $value);
}
}, $filter_set->getFilters()));
$filter_set->setFilters($filters_with_cond);
$this->user_list = $filter_set->getData();
}
}
return $this;
}
示例13: loginHandle
public static function loginHandle()
{
if (check_post('cc_login_uname', 'cc_login_passwd', 'cc_login_login')) {
// for security, we don't want session fixation :(
session_regenerate_id();
$_SESSION['uname'] = $_POST['cc_login_uname'];
$_SESSION['pword'] = hash('whirlpool', $_POST['cc_login_passwd']);
$_SESSION['last_ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['last_user_agent'] = $_SERVER['HTTP_USER_AGENT'];
if (self::checkSession()) {
//var_dump(TH_PUB_ADMIN);exit();
if ($_POST['cc_login_remember'] == "yes") {
$host = $_SERVER['HTTP_HOST'];
if (substr($host, 0, 4) == "www.") {
$host = substr($host, 3);
}
setcookie('ln', self::packCookie(), time() + 60 * 60 * 24 * 30 * 12);
}
cc_redirect(TH_PUB_ADMIN, true);
} else {
Filters::bind('post_output_login', 'Users::outputError');
}
}
}
示例14: chdir
if(checkbox)
checkbox.checked = true;
var hidden = document.getElementById('id_hidden_' + id);
if(hidden)
hidden.disabled = false;
var conf = document.getElementById('id_confirm');
if(conf)
conf.disabled = true;
}
</script>
<?php
// Set current directory to where the language files are
chdir("../lang");
$lang = @$_GET['lang'];
$fail = '';
if (!$lang || !Filters::isAlnum($lang)) {
$fail .= "Language code not supplied correctly<br/>\n";
}
if (!file_exists('en.php')) {
$fail .= "The english language file <code>en.php</code> is missing. Make sure this script is run from the same directory as the language files <code>.../flyspray/lang/</code><br/>\n";
}
if ($fail) {
die($fail . "<b>Usage:</b> <a href='.langedit.php?lang='>.langedit.php?lang=<lang code></a> where <lang code> should be replaced by your languge, e.g. <b>de</b> for German.");
}
// Read english language file in array $language (assumed to be UTF-8 encoded)
require_once 'en.php';
if (!is_array(@$language)) {
die("Invalid language file for english");
}
$count = count($language);
// Read the translation file in array $translation (assumed to be UTF-8 encoded)
示例15: UsersModel
<?php
require_once 'app/autoload.php';
if (isset($_SESSION['chat_login']['id_user'])) {
// Return
$return = '';
// Update dos users
$users = new UsersModel();
$users->setFields(array('timestamp'));
$users->setData(array('timestamp' => date('Y-m-d H:i:s')));
$users->update($_SESSION['chat_login']['id_user']);
// Lendo as messages
$users = new UsersModel();
$users->setCond('id_room = ' . $_SESSION['chat_login']['id_room']);
$users->setCond('id != ' . $_SESSION['chat_login']['id_user']);
$users->setCond('active = 1');
$users->setOrderBy('user asc');
$load = $users->load_all();
$json = array();
foreach ($load as $line) {
// Retorno
$user = Filters::convert(htmlentities($line['user']));
$return .= '<a href="#" id="user_' . $line['id'] . '" rel="' . $line['id'] . '">' . $user . '</a>';
$json[] = '["' . $line['id'] . '", "' . $user . '"]';
}
echo '[' . implode(',', $json) . ']';
} else {
echo 'error';
}