本文整理汇总了PHP中Filters类的典型用法代码示例。如果您正苦于以下问题:PHP Filters类的具体用法?PHP Filters怎么用?PHP Filters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Filters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:remarco-mif,项目名称:ppos,代码行数:11,代码来源:ManageAdmin.php
示例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);
}
开发者ID:xcdam,项目名称:flyspray,代码行数:27,代码来源:index.php
示例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);
}
开发者ID:p-m-d,项目名称:infiltrate,代码行数:10,代码来源:FilterableInstanceTrait.php
示例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>';
}
}
开发者ID:negram,项目名称:flyspray,代码行数:8,代码来源:class.flyspraysyntax.php
示例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;
}
开发者ID:Woofem,项目名称:woofem,代码行数:15,代码来源:BaseController.php
示例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);
}
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:59,代码来源:Feed.php
示例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);
}
开发者ID:kirygithub,项目名称:chatNow,代码行数:13,代码来源:Filters.class.php
示例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;
}
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:55,代码来源:Kills.php
示例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];
}
}
开发者ID:negram,项目名称:flyspray,代码行数:16,代码来源:class.mediasyntax.php
示例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'));
}
开发者ID:negram,项目名称:flyspray,代码行数:46,代码来源:pm.php
示例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;
}
开发者ID:negram,项目名称:flyspray,代码行数:44,代码来源:class.project.php
示例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;
}
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:24,代码来源:adminpanelevents.class.php
示例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');
}
}
}
开发者ID:alecgorge,项目名称:TopHat,代码行数:24,代码来源:cc-users.php
示例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)
开发者ID:negram,项目名称:flyspray,代码行数:31,代码来源:.langedit.php
示例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';
}
开发者ID:kirygithub,项目名称:chatNow,代码行数:29,代码来源:load_users.php
示例16: instance
/**
* Uses service location (i.e. `Libraries::locate()`) to look up a named class of a particular
* type, and creates an instance of it, and passes an array of parameters to the constructor.
*
* If the given class can't be found, an exception is thrown.
*
* @param string $type The type of class as defined by `Libraries::$_paths`.
* @param string $name The un-namespaced name of the class to instantiate.
* @param array $options An array of constructor parameters to pass to the class.
* @return object If the class is found, returns an instance of it, otherwise throws an
* exception.
* @throws lithium\core\ClassNotFoundException Throws an exception if the class can't be found.
* @filter
*/
public static function instance($type, $name, array $options = array())
{
$params = compact('type', 'name', 'options');
$_paths =& static::$_paths;
$implementation = function ($self, $params) use(&$_paths) {
$name = $params['name'];
$type = $params['type'];
if (!$name && !$type) {
$message = "Invalid class lookup: `\$name` and `\$type` are empty.";
throw new ClassNotFoundException($message);
}
if (!is_string($type) && $type !== null && !isset($_paths[$type])) {
throw new ClassNotFoundException("Invalid class type `{$type}`.");
}
if (!($class = $self::locate($type, $name))) {
throw new ClassNotFoundException("Class `{$name}` of type `{$type}` not found.");
}
if (is_object($class)) {
return $class;
}
if (!(is_string($class) && class_exists($class))) {
throw new ClassNotFoundException("Class `{$name}` of type `{$type}` not defined.");
}
return new $class($params['options']);
};
if (!isset(static::$_methodFilters[__FUNCTION__])) {
return $implementation(get_called_class(), $params);
}
$class = get_called_class();
$method = __FUNCTION__;
$data = array_merge(static::$_methodFilters[__FUNCTION__], array($implementation));
return Filters::run($class, $params, compact('data', 'class', 'method'));
}
开发者ID:ncud,项目名称:sagalaya,代码行数:47,代码来源:Libraries.php
示例17: get_task_list
//.........这里部分代码省略.........
$temp .= ' product_category = ? OR';
$sql_params[] = $row['category_id'];
}
}
}
if ($temp) {
$where[] = '(' . substr($temp, 0, -3) . ')';
}
}
/// }}}
$order_keys = array('id' => 't.task_id', 'project' => 'project_title', 'tasktype' => 'tasktype_name', 'dateopened' => 'date_opened', 'summary' => 'item_summary', 'severity' => 'task_severity', 'category' => 'lc.category_name', 'status' => 'is_closed, item_status', 'dueversion' => 'lvc.list_position', 'duedate' => 'due_date', 'progress' => 'percent_complete', 'lastedit' => 'max_date', 'priority' => 'task_priority', 'openedby' => 'uo.real_name', 'reportedin' => 't.product_version', 'assignedto' => 'u.real_name', 'dateclosed' => 't.date_closed', 'os' => 'los.os_name', 'votes' => 'num_votes', 'attachments' => 'num_attachments', 'comments' => 'num_comments', 'private' => 'mark_private', 'supertask' => 't.supertask_id');
// make sure that only columns can be sorted that are visible (and task severity, since it is always loaded)
$order_keys = array_intersect_key($order_keys, array_merge(array_flip($visible), array('severity' => 'task_severity')));
// Implementing setting "Default order by"
if (!array_key_exists('order', $args)) {
# now also for $proj->id=0 (allprojects)
$orderBy = $proj->prefs['sorting'][0]['field'];
$sort = $proj->prefs['sorting'][0]['dir'];
if (count($proj->prefs['sorting']) > 1) {
$orderBy2 = $proj->prefs['sorting'][1]['field'];
$sort2 = $proj->prefs['sorting'][1]['dir'];
} else {
$orderBy2 = 'severity';
$sort2 = 'DESC';
}
} else {
$orderBy = $args['order'];
$sort = $args['sort'];
$orderBy2 = 'severity';
$sort2 = 'desc';
}
// TODO: Fix this! If something is already ordered by task_id, there's
// absolutely no use to even try to order by something else also.
$order_column[0] = $order_keys[Filters::enum(array_get($args, 'order', $orderBy), array_keys($order_keys))];
$order_column[1] = $order_keys[Filters::enum(array_get($args, 'order2', $orderBy2), array_keys($order_keys))];
$sortorder = sprintf('%s %s, %s %s, t.task_id ASC', $order_column[0], Filters::enum(array_get($args, 'sort', $sort), array('asc', 'desc')), $order_column[1], Filters::enum(array_get($args, 'sort2', $sort2), array('asc', 'desc')));
$having = array();
$dates = array('duedate' => 'due_date', 'changed' => $maxdatesql, 'opened' => 'date_opened', 'closed' => 'date_closed');
foreach ($dates as $post => $db_key) {
$var = $post == 'changed' ? 'having' : 'where';
if ($date = array_get($args, $post . 'from')) {
${$var}[] = '(' . $db_key . ' >= ' . Flyspray::strtotime($date) . ')';
}
if ($date = array_get($args, $post . 'to')) {
${$var}[] = '(' . $db_key . ' <= ' . Flyspray::strtotime($date) . ' AND ' . $db_key . ' > 0)';
}
}
if (array_get($args, 'string')) {
$words = explode(' ', strtr(array_get($args, 'string'), '()', ' '));
$comments = '';
$where_temp = array();
if (array_get($args, 'search_in_comments')) {
$comments .= " OR c.comment_text {$LIKEOP} ?";
}
if (array_get($args, 'search_in_details')) {
$comments .= " OR t.detailed_desc {$LIKEOP} ?";
}
foreach ($words as $word) {
$likeWord = '%' . str_replace('+', ' ', trim($word)) . '%';
$where_temp[] = "(t.item_summary {$LIKEOP} ? OR t.task_id = ? {$comments})";
array_push($sql_params, $likeWord, intval($word));
if (array_get($args, 'search_in_comments')) {
array_push($sql_params, $likeWord);
}
if (array_get($args, 'search_in_details')) {
array_push($sql_params, $likeWord);
开发者ID:canneverbe,项目名称:flyspray,代码行数:67,代码来源:class.backend.php
示例18: AdminModel
<?php
require 'app/inc/autoload.php';
if (isset($_POST) && !empty($_POST)) {
$user = Filters::anti_sql_injection($_POST['user']);
$password = md5($_POST['password']);
$admin_model = new AdminModel();
$admin_model->setCond('user = "' . $user . '"');
$admin_model->setCond('password = "' . $password . '"');
$load = $admin_model->load();
if (!empty($load)) {
$_SESSION['id_admin'] = $load[0]['id'];
$_SESSION['user_admin'] = $load[0]['user'];
$_SESSION['password_admin'] = $load[0]['password'];
}
}
// Check login
if (isset($_SESSION['user_admin']) && isset($_SESSION['password_admin'])) {
header('location: index.php');
exit;
}
Template::getHeader();
?>
<div id="content">
<form method="post" name="login" action="login.php">
<div class="block_field">
<label for="user">User<label>
<input type="text" name="user" id="user" size="30" />
</div>
<div class="block_field">
<label for="password">Password<label>
开发者ID:kirygithub,项目名称:chatNow,代码行数:31,代码来源:login.php
示例19: get_task_list
/**
* Returns an array of tasks (respecting pagination) and an ID list (all tasks)
* @param array $args call by reference because we have to modifiy $_GET if we use default values from a user profile
* @param array $visible
* @param integer $offset
* @param integer $comment
* @param bool $perpage
* @access public
* @return array
* @version 1.0
*/
function get_task_list(&$args, $visible, $offset = 0, $perpage = null)
{
global $proj, $db, $user, $conf, $fs;
/* build SQL statement {{{ */
// Original SQL courtesy of Lance Conry http://www.rhinosw.com/
$where = $sql_params = array();
$select = '';
$groupby = 't.task_id, ';
$from = ' {tasks} t
LEFT JOIN {projects} p ON t.project_id = p.project_id
LEFT JOIN {list_items} lr ON t.resolution_reason = lr.list_item_id
LEFT JOIN {redundant} r ON t.task_id = r.task_id ';
// Only join tables which are really necessary to speed up the db-query
$from .= ' LEFT JOIN {assigned} ass ON t.task_id = ass.task_id ';
$from .= ' LEFT JOIN {users} u ON ass.user_id = u.user_id ';
if (array_get($args, 'dev') || in_array('assignedto', $visible)) {
$select .= ' MIN(u.real_name) AS assigned_to_name, ';
$select .= ' COUNT(ass.user_id) AS num_assigned, ';
}
if (array_get($args, 'only_primary')) {
$from .= ' LEFT JOIN {dependencies} dep ON dep.dep_task_id = t.task_id ';
$where[] = 'dep.depend_id IS null';
}
if (array_get($args, 'has_attachment')) {
$where[] = 'attachment_count > 0';
}
// sortable default fields
$order_keys = array('id' => 't.task_id %s', 'project' => 'project_title %s', 'dateopened' => 'date_opened %s', 'summary' => 'item_summary %s', 'progress' => 'percent_complete %s', 'lastedit' => 'last_changed_time %s', 'openedby' => 'r.opened_by_real_name %s', 'closedby' => 'r.closed_by_real_name %s', 'changedby' => 'r.last_changed_by_real_name %s', 'assignedto' => 'u.real_name %s', 'dateclosed' => 't.date_closed %s', 'votes' => 'vote_count %s', 'attachments' => 'attachment_count %s', 'comments' => 'comment_count %s', 'state' => 'closed_by %1$s, is_closed %1$s', 'projectlevelid' => 'prefix_id %s', 'private' => 'mark_private %s');
// custom sortable fields
foreach ($proj->fields as $field) {
if ($field->prefs['list_type'] == LIST_CATEGORY) {
// consider hierarchical structure of categories
$order_keys['field' . $field->id] = 'lcfield' . $field->id . '.lft %1$s, field' . $field->id . ' %1$s';
} else {
$order_keys['field' . $field->id] = 'field' . $field->id . ' %s';
}
}
// Default user sort column and order
if (!$user->isAnon()) {
if (!isset($args['sort'])) {
$args['sort'] = $user->infos['defaultorder'];
}
if (!isset($args['order'])) {
$usercolumns = explode(' ', $user->infos['defaultsortcolumn']);
foreach ($usercolumns as $column) {
if (isset($order_keys[$column])) {
$args['order'] = $column;
break;
}
}
}
}
// make sure that only columns can be sorted that are visible
$order_keys = array_intersect_key($order_keys, array_flip($visible));
$order_column[0] = $order_keys[Filters::enum(array_get($args, 'order', 'id'), array_keys($order_keys))];
$order_column[1] = $order_keys[Filters::enum(array_get($args, 'order2', 'project'), array_keys($order_keys))];
$order_column[0] = sprintf($order_column[0], strtoupper(Filters::enum(array_get($args, 'sort', 'desc'), array('asc', 'desc'))));
$order_column[1] = sprintf($order_column[1], strtoupper(Filters::enum(array_get($args, 'sort2', 'desc'), array('asc', 'desc'))));
$sortorder = sprintf('%s, %s, t.task_id ASC', $order_column[0], $order_column[1]);
// search custom fields
$custom_fields_joined = array();
foreach ($proj->fields as $field) {
$ref = 'field' . $field->id;
if ($field->prefs['field_type'] == FIELD_DATE) {
if (!array_get($args, 'field' . $field->id . 'from') && !array_get($args, 'field' . $field->id . 'to')) {
continue;
}
$from .= " LEFT JOIN {field_values} {$ref} ON t.task_id = {$ref}.task_id AND {$ref}.field_id = {$field->id} ";
$custom_fields_joined[] = $field->id;
if ($date = array_get($args, 'field' . $field->id . 'from')) {
$where[] = "({$ref}.field_value >= ?)";
$sql_params[] = Flyspray::strtotime($date);
}
if ($date = array_get($args, 'field' . $field->id . 'to')) {
$where[] = "({$ref}.field_value <= ? AND {$ref}.field_value > 0)";
$sql_params[] = Flyspray::strtotime($date);
}
} elseif ($field->prefs['field_type'] == FIELD_LIST) {
if (in_array('', (array) array_get($args, 'field' . $field->id, array('')))) {
continue;
}
$from .= " LEFT JOIN {field_values} {$ref} ON t.task_id = {$ref}.task_id AND {$ref}.field_id = {$field->id} ";
$custom_fields_joined[] = $field->id;
$fwhere = array();
foreach ($args['field' . $field->id] as $val) {
$fwhere[] = " {$ref}.field_value = ? ";
$sql_params[] = $val;
}
if (count($fwhere)) {
//.........这里部分代码省略.........
开发者ID:negram,项目名称:flyspray,代码行数:101,代码来源:class.backend.php
示例20: getQueryParameters
/**
* Filter and return $_GET.
* @return object
*/
private function getQueryParameters()
{
return Filters::filterKeyValuePairs($_GET);
}
开发者ID:Woofem,项目名称:woofem,代码行数:8,代码来源:Request.php
注:本文中的Filters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论