本文整理汇总了PHP中Req::val方法的典型用法代码示例。如果您正苦于以下问题:PHP Req::val方法的具体用法?PHP Req::val怎么用?PHP Req::val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Req
的用法示例。
在下文中一共展示了Req::val方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
global $page, $db, $user, $fs, $proj;
$page->setTitle($fs->prefs['page_title'] . L('reports'));
$events = array(1 => L('taskopened'), 13 => L('taskreopened'), 2 => L('taskclosed'), 3 => L('taskedited'), 14 => L('assignmentchanged'), 29 => L('events.useraddedtoassignees'), 4 => L('commentadded'), 5 => L('commentedited'), 6 => L('commentdeleted'), 7 => L('attachmentadded'), 8 => L('attachmentdeleted'), 11 => L('relatedadded'), 12 => L('relateddeleted'), 9 => L('notificationadded'), 10 => L('notificationdeleted'), 17 => L('reminderadded'), 18 => L('reminderdeleted'));
$user_events = array(30 => L('created'), 31 => L('deleted'));
$page->assign('events', $events);
$page->assign('user_events', $user_events);
$sort = strtoupper(Get::enum('sort', array('desc', 'asc')));
$where = array();
$params = array();
$orderby = '';
switch (Get::val('order')) {
case 'type':
$orderby = "h.event_type {$sort}, h.event_date {$sort}";
break;
case 'user':
$orderby = "user_id {$sort}, h.event_date {$sort}";
break;
case 'date':
default:
$orderby = "h.event_date {$sort}, h.event_type {$sort}";
}
foreach (Get::val('events', array()) as $eventtype) {
$where[] = 'h.event_type = ?';
$params[] = $eventtype;
}
$where = '(' . implode(' OR ', $where) . ')';
if ($proj->id) {
$where = $where . 'AND (t.project_id = ? OR h.event_type > 29) ';
$params[] = $proj->id;
}
if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
$where .= ' AND ';
$todate = Req::val('todate');
if ($fromdate) {
$where .= ' h.event_date > ?';
$params[] = Flyspray::strtotime($fromdate) + 0;
}
if ($todate && $fromdate) {
$where .= ' AND h.event_date < ?';
$params[] = Flyspray::strtotime($todate) + 86400;
} else {
if ($todate) {
$where .= ' h.event_date < ?';
$params[] = Flyspray::strtotime($todate) + 86400;
}
}
}
$histories = array();
if (count(Get::val('events'))) {
if (Get::num('event_number') > 0) {
$db->setLimit(Get::num('event_number'));
}
$histories = $db->x->getAll("SELECT h.*, t.*, p.project_prefix\n FROM {history} h\n LEFT JOIN {tasks} t ON h.task_id = t.task_id\n LEFT JOIN {projects} p ON t.project_id = p.project_id\n WHERE {$where}\n ORDER BY {$orderby}", null, $params);
}
$page->assign('histories', $histories);
$page->assign('sort', $sort);
$page->pushTpl('reports.tpl');
}
示例2: _onsubmit
function _onsubmit()
{
global $proj;
// only meant for global fields...
if (!count(Get::val('ids', array()))) {
return array(ERROR_RECOVER, L('notasksselected'), CreateUrl('index'));
}
$proj = new Project(0);
$return = $this->handle('action', Req::val('action'));
$proj = new Project(0);
return $return;
}
示例3: show
function show($area = null)
{
global $page, $fs, $db, $proj, $user, $conf;
$perpage = '20';
if (isset($user->infos['tasks_perpage'])) {
$perpage = $user->infos['tasks_perpage'];
}
$pagenum = max(1, Get::num('pagenum', 1));
$offset = $perpage * ($pagenum - 1);
// Get the visibility state of all columns
$visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns']));
if (!is_array($visible) || !count($visible) || !$visible[0]) {
$visible = array('id');
}
list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage);
$page->assign('tasks', $tasks);
$page->assign('offset', $offset);
$page->assign('perpage', $perpage);
$page->assign('pagenum', $pagenum);
$page->assign('visible', $visible);
// List of task IDs for next/previous links
$_SESSION['tasklist'] = $id_list;
$page->assign('total', count($id_list));
// Javascript replacement
if (Get::val('toggleadvanced')) {
$advanced_search = intval(!Req::val('advancedsearch'));
Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30);
$_COOKIE['advancedsearch'] = $advanced_search;
}
// Update check {{{
if (Get::has('hideupdatemsg')) {
unset($_SESSION['latest_version']);
} else {
if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) {
if (!isset($_SESSION['latest_version'])) {
$latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS);
//if for some silly reason we get and empty response, we use the actual version
$_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest;
$db->x->execParam('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check'));
}
}
}
if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) {
$page->assign('updatemsg', true);
}
// }}}
$page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist'));
$page->pushTpl('index.tpl');
}
示例4: define
define('IN_FS', true);
define('IN_FEED', true);
require_once dirname(__FILE__) . '/header.php';
$page = new FSTpl();
// Set up the basic XML head
header('Content-type: text/html; charset=utf-8');
$max_items = Req::num('num', 10) == 10 ? 10 : 20;
$sql_project = ' 1=1 ';
if ($proj->id) {
$sql_project = sprintf(' p.project_id = %d', $proj->id);
}
$feed_type = Req::val('feed_type', 'rss2');
if ($feed_type != 'rss1' && $feed_type != 'rss2') {
$feed_type = 'atom';
}
switch (Req::val('topic')) {
case 'clo':
$orderby = 'date_closed';
$closed = 't.is_closed = 1 ';
$topic = 1;
$title = 'Recently closed tasks';
break;
case 'edit':
$orderby = 'last_edited_time';
$closed = '1=1';
$topic = 2;
$title = 'Recently edited tasks';
break;
default:
$orderby = 'date_opened';
$closed = '1=1';
示例5: header
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=' . $outfile);
header('Content-Transfer-Encoding: text');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($result));
ob_clean();
flush();
// finally send out our data
printf("%s", $result);
}
// } }}
// Javascript replacement
if (Get::val('toggleadvanced')) {
$advanced_search = intval(!Req::val('advancedsearch'));
Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30);
$_COOKIE['advancedsearch'] = $advanced_search;
}
// Update check {{{
if (Get::has('hideupdatemsg')) {
unset($_SESSION['latest_version']);
} else {
if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) {
if (!isset($_SESSION['latest_version'])) {
$latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS);
//if for some silly reason we get and empty response, we use the actual version
$_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest;
$db->Query('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check'));
}
}
示例6: FlySprayCommand
private function &get_command_from_url()
{
$out = new FlySprayCommand();
if (($action = Req::val('action', false)) === false) {
$null = null;
return $null;
}
$out->action = $action;
$out->id = Req::val('id');
switch ($out->action) {
case 'close_task':
$out->ids['comment'] = Req::val('comment', '');
$out->ids['mark100'] = intval(Req::val('mark100', 1));
break;
case 'add_comment':
$out->ids[0] = Req::val('text');
break;
case 'edit_task':
$out->ids[Req::val('param', '___')] = Req::val('value');
break;
case 'assign_to_me':
$ids_str = Req::val('task_ids', '');
$ids_arr = explode(',', $ids_str);
$out->ids = $ids_arr;
break;
case 'get_task_details':
break;
}
return $out;
}
示例7: array
// ##################
// denying a PM request
// ##################
// ##################
// denying a PM request
// ##################
case 'denypmreq':
$result = $db->Query("SELECT task_id, project_id\n FROM {admin_requests}\n WHERE request_id = ?", array(Req::val('req_id')));
$req_details = $db->FetchRow($result);
if (!$user->perms('manage_project', $req_details['project_id'])) {
break;
}
// Mark the PM request as 'resolved'
$db->Query("UPDATE {admin_requests}\n SET resolved_by = ?, time_resolved = ?, deny_reason = ?\n WHERE request_id = ?", array($user->id, time(), Req::val('deny_reason'), Req::val('req_id')));
Flyspray::logEvent($req_details['task_id'], 28, Req::val('deny_reason'));
$notify->Create(NOTIFY_PM_DENY_REQUEST, $req_details['task_id'], Req::val('deny_reason'));
$_SESSION['SUCCESS'] = L('pmreqdeniedmsg');
break;
// ##################
// adding a dependency
// ##################
// ##################
// adding a dependency
// ##################
case 'details.newdep':
if (!$user->can_edit_task($task)) {
break;
}
if (!Post::val('dep_task_id')) {
Flyspray::show_error(L('formnotcomplete'));
break;
示例8: _onsubmit
function _onsubmit()
{
global $fs, $db, $proj, $user;
$proj = new Project(0);
return $this->handle('action', Req::val('action'));
}
示例9: array
box-shadow: 0 1px 1px #ddd;
color: #565656;
cursor: pointer;
display: inline-block;
font-family: sans-serif;
font-size: 100%;
font-weight: bold;
line-height: 130%;
padding: 8px 13px 8px 10px;
text-decoration: none;
">Remove the folder ' . DIRECTORY_SEPARATOR . 'setup</a> before you start using Flyspray</p>
');
}
// Any "do" mode that accepts a task_id or id field should be added here.
if (in_array(Req::val('do'), array('details', 'depends', 'editcomment'))) {
if (Req::num('task_id')) {
$result = $db->Query('SELECT project_id
FROM {tasks} WHERE task_id = ?', array(Req::num('task_id')));
$project_id = $db->FetchOne($result);
}
}
if (!isset($project_id)) {
// Determine which project we want to see
if (($project_id = Cookie::val('flyspray_project')) == '') {
$project_id = $fs->prefs['default_project'];
}
$project_id = Req::val('project', Req::val('project_id', $project_id));
}
$proj = new Project($project_id);
# no more project cookie!
#$proj->setCookie();
示例10: edit
/**
* Returns (safe) HTML which displays a field to edit a value
* @access public
* @param bool $use_default use default field value or not
* @param bool $lock lock the field depending on the users perms ornot
* @param array $task task data
* @param array $add_options add options to the select?
* @param array $attrs add attributes to the select
* @return string
*/
function edit($use_default = true, $lock = false, $task = array(), $add_options = array(), $attrs = array(), $prefix = '')
{
global $user, $proj;
if ($use_default) {
$task['field' . $this->id] = $this->prefs['default_value'];
} else {
if (!isset($task['field' . $this->id])) {
$task['field' . $this->id] = '';
}
}
// determine whether or not to lock inputs
$lock = $lock && $this->prefs['force_default'] && (count($task) > 3 && !$user->can_edit_task($task) || !$user->perms('modify_all_tasks'));
$html = '';
switch ($this->prefs['field_type']) {
case FIELD_LIST:
if (!$this->prefs['list_id']) {
return '';
}
$html .= sprintf('<select id="%sfield%d" name="%sfield%d%s" %s ', $prefix, $this->id, $prefix, $this->id, isset($attrs['multiple']) ? '[]' : '', join_attrs($attrs));
$html .= tpl_disableif($lock) . '>';
$html .= tpl_options(array_merge($add_options, $proj->get_list($this->prefs, $task['field' . $this->id])), Req::val('field' . $this->id, $task['field' . $this->id]));
$html .= '</select>';
break;
case FIELD_DATE:
$attrs = array();
if ($lock) {
$attrs = array('readonly' => 'readonly');
}
$html .= tpl_datepicker($prefix . 'field' . $this->id, '', Req::val('field' . $this->id, $task['field' . $this->id]), $attrs);
break;
case FIELD_TEXT:
$html .= sprintf('<input type="text" class="text" id="%sfield%d" name="%sfield%d" value="%s"/>', $prefix, $this->id, $prefix, $this->id, Filters::noXSS(Req::val('field' . $this->id, $task['field' . $this->id])));
break;
case FIELD_USER:
$html .= tpl_userselect($prefix . 'field' . $this->id, Req::val('field' . $this->id, $task['field' . $this->id]));
break;
}
return $html;
}
示例11: header
/*******************************************************************************/
/* Here begins the deep flyspray : html rendering */
/*******************************************************************************/
# no cache headers are now in header.php!
// see http://www.w3.org/TR/html401/present/styles.html#h-14.2.1
header('Content-Style-Type: text/css');
header('Content-type: text/html; charset=utf-8');
if ($conf['general']['output_buffering'] == 'gzip' && extension_loaded('zlib')) {
// Start Output Buffering and gzip encoding if setting is present.
ob_start('ob_gzhandler');
} else {
ob_start();
}
$page = new FSTpl();
// make sure people are not attempting to manually fiddle with projects they are not allowed to play with
if (Req::has('project') && Req::val('project') != 0 && !$user->can_view_project(Req::val('project'))) {
Flyspray::show_error(L('nopermission'));
exit;
}
if ($show_task = Get::val('show_task')) {
// If someone used the 'show task' form, redirect them
if (is_numeric($show_task)) {
Flyspray::Redirect(CreateURL('details', $show_task));
} else {
Flyspray::Redirect($baseurl . '?string=' . $show_task);
}
}
if (Flyspray::requestDuplicated()) {
// Check that this page isn't being submitted twice
Flyspray::show_error(3);
}
示例12: define
define('IN_FS', true);
header('Content-type: text/html; charset=utf-8');
require_once '../../header.php';
$baseurl = dirname(dirname($baseurl)) . '/';
if (Cookie::has('flyspray_userid') && Cookie::has('flyspray_passhash')) {
$user = new User(Cookie::val('flyspray_userid'));
$user->check_account_ok();
} else {
$user = new User(0, $proj);
}
// don't allow anonymous users to access this page at all
if ($user->isAnon()) {
die;
}
if (Req::has('name')) {
$searchterm = strtolower(Req::val('name'));
}
// Get the list of users from the global groups above
$get_users = $db->Query(' SELECT count(u.user_name) AS anz_u_user,
count(r.user_name) AS anz_r_user
FROM {users} u
LEFT JOIN {registrations} r ON u.user_name = r.user_name
WHERE Lower(u.user_name) = ?
OR
Lower(r.user_name) = ?', array($searchterm, $searchterm));
while ($row = $db->FetchRow($get_users)) {
if ($row['anz_u_user'] > '0' || $row['anz_r_user'] > '0') {
$html = 'false|' . eL('usernametaken');
} else {
$html = 'true';
}
示例13: show
/**
* show
*
* @access public
* @return void
*/
function show()
{
global $page, $fs, $db;
$page->setTitle($fs->prefs['page_title'] . L('lostpw'));
if (!Req::has('magic_url')) {
// Step One: user requests magic url
$page->pushTpl('lostpw.step1.tpl');
} else {
// Step Two: user enters new password
$check_magic = $db->x->getRow('SELECT user_id, user_name FROM {users} WHERE magic_url = ?', null, array(Req::val('magic_url')));
if ($check_magic) {
$page->assign('userinfo', $check_magic);
$page->pushTpl('lostpw.step2.tpl');
} else {
$page->pushTpl('lostpw.step1.tpl');
}
}
}
示例14: isAlnum
function isAlnum($key)
{
return Filters::isAlnum(Req::val($key));
}
示例15: show
function show()
{
global $page, $db, $user, $fs;
$page->setTitle($fs->prefs['page_title'] . L('registernewuser'));
if (Get::val('regdone')) {
$page->pushTpl('register.ok.tpl');
} else {
if ($user->can_register()) {
// 32 is the length of the magic_url
if (Req::has('magic_url')) {
// If the user came here from their notification link
$sql = $db->x->GetOne('SELECT reg_id FROM {registrations} WHERE magic_url = ?', null, Req::val('magic_url'));
if (!$sql) {
FlysprayDo::error(array(ERROR_INPUT, L('error18')));
}
$page->pushTpl('register.magic.tpl');
} else {
$page->pushTpl('register.no-magic.tpl');
}
} else {
$page->pushTpl('common.newuser.tpl');
}
}
}