本文整理匯總了PHP中Flyspray::ValidUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flyspray::ValidUserId方法的具體用法?PHP Flyspray::ValidUserId怎麽用?PHP Flyspray::ValidUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Flyspray
的用法示例。
在下文中一共展示了Flyspray::ValidUserId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: area_user
/**
* area_user
*
* @access public
* @return void
*/
function area_user()
{
global $db, $page;
$id = Flyspray::ValidUserId(Req::val('user_id'));
$theuser = new User($id);
if ($theuser->isAnon()) {
FlysprayDo::error(array(ERROR_INPUT, L('error5')));
}
$page->assign('all_groups', Flyspray::listallGroups($theuser->id));
$page->assign('groups', Flyspray::listGroups());
$page->assign('theuser', $theuser);
}
示例2: add_reminder
/**
* Adds a reminder to a task
* @param integer $task_id
* @param string $message
* @param integer $how_often send a reminder every ~ seconds
* @param integer $start_time time when the reminder starts
* @param $user_id the user who is reminded. by default (null) all users assigned to the task are reminded.
* @access public
* @return bool
* @version 1.0
*/
public static function add_reminder($task_id, $message, $how_often, $start_time, $user_id = null)
{
global $user, $db;
$task = Flyspray::GetTaskDetails($task_id);
if (!$user->perms('manage_project', $task['project_id'])) {
return false;
}
if (is_null($user_id)) {
// Get all users assigned to a task
$user_id = Flyspray::GetAssignees($task_id);
} else {
$user_id = array(Flyspray::ValidUserId($user_id));
if (!reset($user_id)) {
return false;
}
}
foreach ($user_id as $id) {
$sql = $db->Replace('{reminders}', array('task_id' => $task_id, 'to_user_id' => $id, 'from_user_id' => $user->id, 'start_time' => $start_time, 'how_often' => $how_often, 'reminder_message' => $message), array('task_id', 'to_user_id', 'how_often', 'reminder_message'));
if (!$sql) {
// query has failed :(
return false;
}
}
// 2 = no record has found and was INSERT'ed correclty
if (isset($sql) && $sql == 2) {
Flyspray::logEvent($task_id, 17, $task_id);
}
return true;
}
示例3: UserNameOrId
/**
* Tries to determine a user ID from a user name. If the
* user name does not exist, it assumes an user ID as input.
* @param mixed $user (string or int)
* @access public static
* @return integer 0 if the user does not exist
* @version 1.0
*/
function UserNameOrId($user)
{
$val = Flyspray::UserNameToId($user);
return $val ? $val : Flyspray::ValidUserId($user);
}
示例4: die
<?php
/*********************************************************\
| View a user's profile |
| ~~~~~~~~~~~~~~~~~~~~ |
\*********************************************************/
if (!defined('IN_FS')) {
die('Do not access this file directly.');
}
$page->assign('groups', Flyspray::ListGroups());
if ($proj->id) {
$page->assign('project_groups', Flyspray::ListGroups($proj->id));
}
$id = Flyspray::ValidUserId(Get::val('id', Get::val('uid')));
if (!$id) {
$id = Flyspray::UserNameToId(Get::val('user_name'));
}
$theuser = new User($id);
if ($theuser->isAnon()) {
Flyspray::show_error(19);
}
// Some possibly interesting information about the user
$sql = $db->Query('SELECT count(*) FROM {comments} WHERE user_id = ?', array($theuser->id));
$page->assign('comments', $db->fetchOne($sql));
$sql = $db->Query('SELECT count(*) FROM {tasks} WHERE opened_by = ?', array($theuser->id));
$page->assign('tasks', $db->fetchOne($sql));
$sql = $db->Query('SELECT count(*) FROM {assigned} WHERE user_id = ?', array($theuser->id));
$page->assign('assigned', $db->fetchOne($sql));
$page->assign('theuser', $theuser);
$page->setTitle($fs->prefs['page_title'] . L('viewprofile'));
$page->pushTpl('profile.tpl');
示例5: is_accessible
function is_accessible()
{
$id = Flyspray::ValidUserId(Get::val('id', Get::val('uid')));
$this->user = new User($id);
return !$this->user->isAnon();
}