本文整理汇总了PHP中user_set_preference函数的典型用法代码示例。如果您正苦于以下问题:PHP user_set_preference函数的具体用法?PHP user_set_preference怎么用?PHP user_set_preference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_set_preference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePreferences
function updatePreferences($request)
{
$request->valid(new Valid_String('cancel'));
$vShow = new Valid_WhiteList('show', array('A', 'S', 'N', 'AS'));
$vShow->required();
if (!$request->exist('cancel')) {
if ($request->valid($vShow)) {
switch ($request->get('show')) {
case 'A':
$this->_artifact_show = 'A';
break;
case 'S':
$this->_artifact_show = 'S';
break;
case 'N':
$this->_artifact_show = 'N';
break;
case 'AS':
default:
$this->_artifact_show = 'AS';
}
user_set_preference('my_artifacts_show', $this->_artifact_show);
}
}
return true;
}
示例2: hide_url
/**
* Generate url to Expend/Collapse a part of a page
* @see my_hide_url
*/
function hide_url($svc, $db_item_id, $defaultHide = false, $hide = null)
{
$pref_name = 'hide_' . $svc . $db_item_id;
if (empty($hide)) {
$hide = $_REQUEST['hide_' . $svc];
}
$noPref = false;
$old_hide = user_get_preference($pref_name);
// Make sure they are both 0 if never set before
if ($old_hide == false) {
$noPref = true;
$old_hide = 0;
}
// If no given value for hide, keep the old one
if (!isset($hide)) {
$hide = $old_hide;
}
// Update pref value if needed
if ($old_hide != $hide) {
user_set_preference($pref_name, $hide);
}
if ($hide == 2 || $noPref && $defaultHide) {
$hide_url = 'hide_' . $svc . '=1&hide_item_id=' . $db_item_id;
$hide_img = '<img src="' . util_get_image_theme("pointer_right.png") . '" align="middle" border="0" alt="Expand">';
$hide_now = true;
} else {
$hide_url = 'hide_' . $svc . '=2&hide_item_id=' . $db_item_id;
$hide_img = '<img src="' . util_get_image_theme("pointer_down.png") . '" align="middle" border="0" alt="Collapse">';
$hide_now = false;
}
return array($hide_now, $hide_url, $hide_img);
}
示例3: displayParse
/**
* Permit CSV file input,parse the CSV file and show the parse report
*
*
*/
function displayParse($csv_filename)
{
global $Language;
if (!file_exists($csv_filename) || !is_readable($csv_filename)) {
exit_missing_param();
}
$is_tmp = false;
//}
if (array_key_exists('notify', $_REQUEST) && $_REQUEST['notify']) {
user_set_preference('tracker_import_notify_' . $this->ath->getID(), 1);
} else {
user_set_preference('tracker_import_notify_' . $this->ath->getID(), 0);
}
$ok = $this->parse($csv_filename, $is_tmp, $artifacts_data, $number_inserts, $number_updates);
$this->ath->header(array('title' => $Language->getText('tracker_import', 'art_import') . $this->ath->getID() . ' - ' . $this->ath->getName(), 'pagename' => 'tracker', 'atid' => $this->ath->getID(), 'sectionvals' => array($this->group->getPublicName()), 'help' => 'tracker-v3.html#tracker-artifact-import'));
echo '<div id="tracker_toolbar_clear"></div>' . PHP_EOL;
echo '<h2>' . $Language->getText('tracker_import', 'parse_report') . '</h2>';
if (!$ok) {
$this->showErrors();
} else {
echo $Language->getText('tracker_import', 'ready', array($number_inserts + $number_updates, $number_inserts, $number_updates)) . "<br><br>\n";
echo $Language->getText('tracker_import', 'check_data');
$this->showParseResults($this->parsed_labels, $artifacts_data);
}
$this->ath->footer(array());
}
示例4: _content
function _content($params)
{
if (isset($params['redirect_to'])) {
$url = $params['redirect_to'];
} else {
if (isset($params['default_url_params'])) {
$url = $this->buildUrl($params['default_url'], $params['default_url_params'], false);
} else {
$url = $params['default_url'];
}
}
user_set_preference('plugin_docman_flash', serialize($this->_controller->feedback));
$GLOBALS['Response']->redirect($url);
}
示例5: my_hide_url
function my_hide_url($svc, $db_item_id, $item_id, $count, $hide)
{
global $Language;
$pref_name = 'my_hide_' . $svc . $db_item_id;
$old_hide = $old_count = $old_pref_value = user_get_preference($pref_name);
if ($old_pref_value) {
list($old_hide, $old_count) = explode('|', $old_pref_value);
}
// Make sure they are both 0 if never set before
if ($old_count == false) {
$old_count = 0;
}
if ($old_hide == false) {
$old_hide = 0;
}
if ($item_id == $db_item_id) {
if (isset($hide)) {
$pref_value = "{$hide}|{$count}";
} else {
$pref_value = "{$old_hide}|{$count}";
$hide = $old_hide;
}
} else {
if ($old_hide) {
// if items are hidden keep the old count and keep pref as is
$pref_value = $old_pref_value;
} else {
// only update the item count if the items are visible
// if they are hidden keep reporting the old count
$pref_value = "{$old_hide}|{$count}";
}
$hide = $old_hide;
}
// Update pref value if needed
if ($old_pref_value != $pref_value) {
user_set_preference($pref_name, $pref_value);
}
if ($hide) {
$hide_url = '<a href="?hide_' . $svc . '=0&hide_item_id=' . $db_item_id . '"><img src="' . util_get_image_theme("pointer_right.png") . '" align="middle" border="0" title="' . $Language->getText('my_utils', 'expand') . '" alt="' . $Language->getText('my_utils', 'expand') . '"></a> ';
$hide_now = true;
} else {
$hide_url = '<a href="?hide_' . $svc . '=1&hide_item_id=' . $db_item_id . '"><img src="' . util_get_image_theme("pointer_down.png") . '" align="middle" border="0" title="' . $Language->getText('my_utils', 'collapse') . '" alt="' . $Language->getText('my_utils', 'collapse') . '"></a> ';
$hide_now = false;
}
return array($hide_now, $count - $old_count, $hide_url);
}
示例6: _adminPageUpdate_Service
function _adminPageUpdate_Service($_REQUEST)
{
global $Language, $feedback;
$group_id = (int) $_REQUEST['group_id'];
switch ($_REQUEST['func']) {
case 'pl_config_update':
if (isset($_REQUEST['EnableProjectLink'])) {
user_set_preference("pl_GroupId_master", $group_id);
} else {
user_del_preference("pl_GroupId_master");
}
$feedback .= ' ' . $Language->getText('plugin_plinks', 'update_ok');
break;
case 'pl_link_delete':
// delete project link
$link_id = (int) $_REQUEST['link_id'];
// NB: use group_id to defend against malicious use
if (db_query("DELETE FROM plugin_projectlinks_relationship\n WHERE (master_group_id=" . db_ei($group_id) . ")\n AND (link_id=" . db_ei($link_id) . ");")) {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'project_link_deleted_OK');
} else {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error());
}
break;
case 'pl_type_delete':
// delete project link type and all links using the type
$link_type_id = (int) $_REQUEST['link_type_id'];
// delete project relationship instances
// NB: use group_id to defend against malicious use
if (!db_query("DELETE FROM plugin_projectlinks_relationship\n WHERE (master_group_id=" . db_ei($group_id) . ")\n AND (link_type_id=" . db_ei($link_type_id) . ");")) {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error());
} else {
//delete the relationship type if no error deleting instances
if (!db_query("DELETE FROM plugin_projectlinks_link_type\n WHERE (group_id=" . db_ei($group_id) . ")\n AND (link_type_id=" . db_ei($link_type_id) . ");")) {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error());
} else {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'project_link_deleted_OK');
}
if (user_get_preference("pl_GroupId_master") == $group_id) {
// switch off linking to this project - it would be better
// to check if no types left, but this works well
user_del_preference("pl_GroupId_master");
}
}
break;
case 'pl_type_update':
$q_name = "'" . db_es($_REQUEST['name']) . "'";
$q_reverse_name = "'" . db_es(nz($_REQUEST['reverse_name'], $_REQUEST['name'])) . "'";
$q_description = "'" . db_es($_REQUEST['description']) . "'";
/** **1 commented out for now - until we can decide how to deal with project links functionality
$q_uri_plus = db_es($_REQUEST['uri_plus']);
**/
$q_uri_plus = "'" . db_es('/projects/$projname/') . "'";
// $link_type_id is not set when submitting a new link
if (isset($_REQUEST['link_type_id'])) {
$link_type_id = (int) $_REQUEST['link_type_id'];
} else {
$link_type_id = NULL;
}
// check the change would not create a duplicate
$pfcheck = db_query("SELECT name\n FROM plugin_projectlinks_link_type\n WHERE (((name=" . $q_name . ")\n OR (reverse_name=" . $q_reverse_name . "))\n AND ((group_id=" . db_ei($group_id) . ")" . (is_null($link_type_id) ? "" : " AND (link_type_id<>" . db_ei($link_type_id) . ")") . ")\n );");
if (db_numrows($pfcheck) > 0) {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'project_link_type_change_makes_duplicate');
} elseif (update_database("plugin_projectlinks_link_type", array("name" => $q_name, "reverse_name" => $q_reverse_name, "description" => $q_description, "uri_plus" => $q_uri_plus, "group_id" => $group_id), is_null($link_type_id) ? NULL : "link_type_id={$link_type_id}")) {
$this->addWidgetOnSummaryPage($group_id);
$feedback .= ' ' . $Language->getText('plugin_plinks', 'update_ok') . ' ';
} else {
$feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error());
}
break;
case 'pl_link_update':
$link_type_id = (int) $_REQUEST['link_type_id'];
if (isset($_REQUEST['target_group_id'])) {
$target_group_id = (int) $_REQUEST['target_group_id'];
} else {
$prjManager = ProjectManager::instance();
$trgProject = $prjManager->getProjectFromAutocompleter($_REQUEST['target_group']);
if ($trgProject !== false) {
$target_group_id = $trgProject->getId();
} else {
return;
}
}
$group_id = (int) $_REQUEST['group_id'];
// NB: $link_id is not set when submitting a new link
if (isset($_REQUEST['link_id'])) {
$link_id = (int) $_REQUEST['link_id'];
} else {
$link_id = NULL;
// if this is a new link to a template:
// add links to all projects already created from the template
$db_res = db_query("SELECT group_id\n FROM groups\n WHERE (built_from_template = " . db_ei($target_group_id) . ");");
while ($row = db_fetch_array($db_res)) {
$feedback .= ' ' . $this->_link_unique_update($group_id, $row['group_id'], $link_type_id);
}
}
$feedback .= ' ' . $this->_link_unique_update($group_id, $target_group_id, $link_type_id, $link_id);
break;
case 'template_sync_type_add':
$template_type_id = (int) $_REQUEST['template_type_id'];
$db_res = db_query("SELECT * FROM plugin_projectlinks_link_type\n WHERE (link_type_id = " . db_ei($template_type_id) . ");");
//.........这里部分代码省略.........
示例7: request
function request()
{
if ($this->request->exist('action') && ($this->request->get('action') == 'plugin_docman_approval_reviewer' || $this->request->get('action') == 'plugin_docman_approval_requester')) {
if ($this->request->get('hide')) {
user_set_preference('hide_' . $this->request->get('action'), 1);
} else {
user_del_preference('hide_' . $this->request->get('action'));
}
exit;
}
if (!$this->request->exist('group_id')) {
$this->feedback->log('error', 'Project is missing.');
$this->_setView('Error');
} else {
$_groupId = (int) $this->request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($_groupId);
if ($project == false) {
$this->feedback->log('error', 'Project is missing.');
$this->_setView('Error');
return;
}
// Browser alert
$this->_checkBrowserCompliance();
//token for redirection
$tok =& new Docman_Token();
$this->_viewParams['docman'] =& $this;
$this->_viewParams['user'] =& $this->getUser();
$this->_viewParams['token'] = $tok->getToken();
$this->_viewParams['default_url'] = $this->getDefaultUrl();
$this->_viewParams['theme_path'] = $this->getThemePath();
$this->_viewParams['group_id'] = (int) $this->request->get('group_id');
if ($this->request->exist('version_number')) {
$this->_viewParams['version_number'] = (int) $this->request->get('version_number');
}
if ($this->request->exist('section')) {
$this->_viewParams['section'] = $this->request->get('section');
} else {
if ($this->request->get('action') == 'permissions') {
$this->_viewParams['section'] = 'permissions';
}
}
$view = $this->request->exist('action') ? $this->request->get('action') : 'show';
$this->_viewParams['action'] = $view;
// Start is used by Table view (like LIMIT start,offset)
if ($this->request->exist('start')) {
$this->_viewParams['start'] = (int) $this->request->get('start');
}
if ($this->request->exist('pv')) {
$this->_viewParams['pv'] = (int) $this->request->get('pv');
}
if ($this->request->exist('report')) {
$this->_viewParams['report'] = $this->request->get('report');
$views = Docman_View_Browse::getDefaultViews();
$validator = new Valid_WhiteList('report', $views);
$views_keys = array_keys($views);
$default_view = $views[$views_keys[0]];
$this->_viewParams['report'] = $this->request->getValidated('report', $validator, $default_view);
}
$item_factory =& $this->_getItemFactory();
$root =& $item_factory->getRoot($this->request->get('group_id'));
if (!$root) {
// Install
$_gid = (int) $this->request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($_gid);
$tmplGroupId = (int) $project->getTemplate();
$this->_cloneDocman($tmplGroupId, $_gid, false);
if (!$item_factory->getRoot($_gid)) {
$item_factory->createRoot($_gid, 'roottitle_lbl_key');
}
$this->_viewParams['redirect_to'] = $_SERVER['REQUEST_URI'];
$this->view = 'Redirect';
} else {
$id = $this->request->get('id');
if (!$id && $this->request->exist('item')) {
$i = $this->request->get('item');
if (isset($i['id'])) {
$id = $i['id'];
}
}
if ($id) {
$item =& $item_factory->getItemFromDb($id);
if (!$item) {
$this->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_item_deleted'));
$this->_setView('DocmanError');
}
} else {
$item =& $root;
}
if ($item) {
// Load report
// If the item (folder) defined in the report is not the
// same than the current one, replace it.
$this->_initReport($item);
if ($this->_viewParams['filter'] !== null && $this->_viewParams['filter']->getItemId() !== null && $this->_viewParams['filter']->getItemId() != $item->getId()) {
$reportItem = $item_factory->getItemFromDb($this->_viewParams['filter']->getItemId());
// If item defined in the report exists, use it
// otherwise raise an error
if (!$reportItem) {
//.........这里部分代码省略.........
示例8: user_getid
}
if ($set == 'my') {
/*
My patches - backwards compat can be removed 9/10
*/
$_status = 1;
$_assigned_to = user_getid();
} else {
if ($set == 'custom') {
/*
if this custom set is different than the stored one, reset preference
*/
$pref_ = $_assigned_to . '|' . $_status . '|' . $_category;
if ($pref_ != user_get_preference('patch_browcust' . $group_id)) {
//echo 'setting pref';
user_set_preference('patch_browcust' . $group_id, $pref_);
}
} else {
if ($set == 'postponed') {
/*
postponed patches
*/
$_assigned_to = 0;
$_status = '4';
} else {
if ($set == 'closed') {
/*
Closed patches - backwards compat can be removed 9/10
*/
$_assigned_to = 0;
$_status = '2';
示例9: user_getname
if ($set == 'my') {
/*
My commits - backwards compat can be removed 9/10
*/
$_tag = 100;
$_commiter = user_getname();
$_branch = 100;
} else {
if ($set == 'custom') {
/*
if this custom set is different than the stored one, reset preference
*/
$pref_ = $_commit_id . '|' . $_commiter . '|' . $_tag . '|' . $_branch . '|' . $_srch . '|' . $chunksz;
if ($pref_ != user_get_preference('commits_browcust' . $group_id)) {
//echo 'setting pref';
user_set_preference('commits_browcust' . $group_id, $pref_);
}
} else {
if ($set == 'any') {
/*
Closed commits - backwards compat can be removed 9/10
*/
$tag = $branch = $_commiter = 100;
}
}
}
/*
Display commits based on the form post - by user or status or both
*/
$_tag = isset($_tag) ? $_tag : 100;
$_branch = isset($_branch) ? $_branch : 100;
示例10: user_getid
}
if ($set == 'my') {
/*
My requests - backwards compat can be removed 9/10
*/
$_status = 1;
$_assigned_to = user_getid();
} else {
if ($set == 'custom') {
/*
if this custom set is different than the stored one, reset preference
*/
$pref_ = $_assigned_to . '|' . $_status . '|' . $_category;
if ($pref_ != user_get_preference('sup_brow_cust' . $group_id)) {
//echo 'setting pref';
user_set_preference('sup_brow_cust' . $group_id, $pref_);
}
} else {
if ($set == 'closed') {
/*
Closed requests - backwards compat can be removed 9/10
*/
$_assigned_to = 0;
$_status = '2';
} else {
/*
Open requests - backwards compat can be removed 9/10
*/
$_assigned_to = 0;
$_status = '1';
}
示例11: updatePreferences
function updatePreferences(&$request)
{
$request->valid(new Valid_String('cancel'));
if (!$request->exist('cancel')) {
$monitored_jobs = $request->get('myhudsonjobs');
$user = UserManager::instance()->getCurrentUser();
$job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
$dar = $job_dao->searchByUserID($user->getId());
$not_monitored_jobs = array();
while ($dar->valid()) {
$row = $dar->current();
if (!in_array($row['job_id'], $monitored_jobs)) {
$not_monitored_jobs[] = $row['job_id'];
}
$dar->next();
}
$this->_not_monitored_jobs = $not_monitored_jobs;
user_set_preference('plugin_hudson_my_not_monitored_jobs', implode(",", $this->_not_monitored_jobs));
$use_global_status = $request->get('use_global_status');
$this->_use_global_status = $use_global_status !== false ? "true" : "false";
user_set_preference('plugin_hudson_use_global_status', $this->_use_global_status);
}
return true;
}
示例12: expand
/**
* Set a expand preference for given folder for current user.
*
* @param Folder
*/
function expand($folder)
{
user_set_preference(PLUGIN_DOCMAN_EXPAND_FOLDER_PREF . '_' . $folder->getGroupId() . '_' . $folder->getId(), PLUGIN_DOCMAN_EXPAND_FOLDER);
}
示例13: user_set_preference
$pref_stg .= '&' . $field . '[]=' . $value_id;
}
}
// build part of the HTML title of this page for more friendly bookmarking
// Do not add the criteria in the header if value is "Any"
if ($value_id != 0) {
$hdr .= $Language->getText('global', 'by') . $field->getLabel() . ': ' . $field->getValue($group_id, $value_id);
}
}
$pref_stg .= '&advsrch=' . ($advsrch ? 1 : 0);
$pref_stg .= '&msort=' . ($msort ? 1 : 0);
$pref_stg .= '&chunksz=' . (int) $chunksz;
$pref_stg .= '&report_id=' . (int) $report_id;
if ($pref_stg != user_get_preference('artifact_brow_cust' . $atid)) {
//echo "<br> DBG setting pref = $pref_stg";
user_set_preference('artifact_brow_cust' . $atid, $pref_stg);
}
} else {
if ($set == 'all') {
// Any value for very field
$prefs['status_id'][] = 0;
$prefs['assigned_to'][] = 0;
$prefs['multi_assigned_to'][] = 0;
} else {
// Open artifacts - backwards compat can be removed 9/10
$prefs['status_id'][] = 1;
// Any value for assigned to
$prefs['assigned_to'][] = 0;
$prefs['multi_assigned_to'][] = 0;
}
}
示例14: user_set_preference
if it was a custom set just posted && logged in, set pref if it's changed
*/
if (user_isloggedin()) {
$_pref = $style . '|' . $max_rows;
if (isset($set) && $set == 'custom') {
if (user_get_preference('forum_style')) {
$_pref = $style . '|' . $max_rows;
if ($_pref == user_get_preference('forum_style')) {
//do nothing - pref already stored
} else {
//set the pref
user_set_preference('forum_style', $_pref);
}
} else {
//set the pref
user_set_preference('forum_style', $_pref);
}
} else {
if (user_get_preference('forum_style')) {
$_pref_arr = explode('|', user_get_preference('forum_style'));
$style = $_pref_arr[0];
$max_rows = $_pref_arr[1];
} else {
//no saved pref and we're not setting
//one because this is all default settings
}
}
}
/*
Set up navigation vars
*/
示例15: updatePreferences
function updatePreferences(&$request)
{
$request->valid(new Valid_String('cancel'));
$nbShow = new Valid_UInt('nb_svn_commits');
$nbShow->required();
if (!$request->exist('cancel')) {
if ($request->valid($nbShow)) {
$this->_nb_svn_commits = $request->get('nb_svn_commits');
} else {
$this->_nb_svn_commits = self::NB_COMMITS_TO_DISPLAY;
}
user_set_preference('my_latests_svn_commits_nb_display', $this->_nb_svn_commits);
}
return true;
}