本文整理汇总了PHP中param_variable函数的典型用法代码示例。如果您正苦于以下问题:PHP param_variable函数的具体用法?PHP param_variable怎么用?PHP param_variable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了param_variable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleredirect
/**
* Handle requests to the redirect URL.
*
* @return mixed Determined by loginflow.
*/
public function handleredirect()
{
$state = param_variable('state', null);
$promptlogin = (bool) param_variable('promptlogin', 0);
if (!empty($state)) {
// Response from OP.
$this->handleauthresponse($_REQUEST);
} else {
// Initial login request.
$this->initiateauthrequest($promptlogin, array('forceflow' => 'authcode'));
}
}
示例2: delete_all_notifications_submit
function delete_all_notifications_submit()
{
global $USER, $SESSION;
$userid = $USER->get('id');
$type = param_variable('type', 'all');
$typesql = '';
if ($type != 'all') {
// Treat as comma-separated list of activity type names
$types = explode(',', preg_replace('/[^a-z,]+/', '', $type));
if ($types) {
$typesql = ' at.name IN (' . join(',', array_map('db_quote', $types)) . ')';
if (in_array('adminmessages', $types)) {
$typesql = '(' . $typesql . ' OR at.admin = 1)';
}
$typesql = ' AND ' . $typesql;
}
}
$from = "\n FROM {notification_internal_activity} a\n JOIN {activity_type} at ON a.type = at.id\n WHERE a.usr = ? {$typesql}";
$values = array($userid);
db_begin();
$count = 0;
$records = get_records_sql_array('SELECT a.id ' . $from, $values);
if ($records) {
$count = sizeof($records);
$ids = array();
foreach ($records as $row) {
$ids[] = $row->id;
}
// Remove parent pointers to messages we're about to delete
execute_sql('
UPDATE {notification_internal_activity}
SET parent = NULL
WHERE parent IN (
' . join(',', array_map('db_quote', $ids)) . '
)');
// delete
execute_sql('
DELETE FROM {notification_internal_activity}
WHERE id IN (
' . join(',', array_map('db_quote', $ids)) . '
)');
// The update_unread_delete db trigger on notification_internal_activity
// will update the unread column on the usr table.
}
db_commit();
$SESSION->add_ok_msg(get_string('deletednotifications1', 'activity', $count));
safe_require('module', 'multirecipientnotification');
if (PluginModuleMultirecipientnotification::is_active()) {
redirect(get_config('wwwroot') . 'module/multirecipientnotification/inbox.php?type=' . $type);
} else {
redirect(get_config('wwwroot') . 'account/activity/index.php?type=' . $type);
}
}
示例3: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
global $USER;
if ($editing) {
$smarty = smarty_core();
$smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment'));
$html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html;
}
// Feedback list pagination requires limit/offset params
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$showcomment = param_integer('showcomment', null);
// Create the "make feedback private form" now if it's been submitted
if (param_variable('make_public_submit', null)) {
pieform(ArtefactTypeComment::make_public_form(param_integer('comment')));
} else {
if (param_variable('delete_comment_submit_x', null)) {
pieform(ArtefactTypeComment::delete_comment_form(param_integer('comment')));
}
}
$view = new View($instance->get('view'));
$submittedgroup = (int) $view->get('submittedgroup');
if ($USER->is_logged_in() && $submittedgroup && group_user_can_assess_submitted_views($submittedgroup, $USER->get('id'))) {
$releaseform = true;
} else {
$releaseform = false;
}
// If the view has comments turned off, tutors can still leave
// comments if the view is submitted to their group.
if (!empty($releaseform) || $view->user_comments_allowed($USER)) {
$addfeedbackpopup = true;
}
safe_require('artefact', 'comment');
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = $limit;
$commentoptions->offset = $offset;
$commentoptions->showcomment = $showcomment;
$commentoptions->view = $instance->get_view();
$feedback = ArtefactTypeComment::get_comments($commentoptions);
$smarty = smarty_core();
$smarty->assign('feedback', $feedback);
if (isset($addfeedbackpopup)) {
$smarty->assign('enablecomments', 1);
$smarty->assign('addfeedbackpopup', $addfeedbackpopup);
}
$html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html;
}
示例4: search_submit
function search_submit(Pieform $form, $values)
{
// Convert (query,type) parameters from form to (query,tag)
global $queryparams, $tag, $query, $share;
if (isset($queryparams['query'])) {
unset($queryparams['query']);
$query = null;
}
if (isset($queryparams['tag'])) {
unset($queryparams['tag']);
$tag = null;
}
if (isset($values['query']) && $values['query'] != '') {
if ($values['type'] == 'tagsonly') {
$queryparams['tag'] = $tag = $values['query'];
} else {
$queryparams['query'] = $query = $values['query'];
}
}
$share = $queryparams['share'] = param_variable('share', array());
}
示例5: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
require_once get_config('docroot') . 'artefact/lib.php';
global $USER;
$smarty = smarty_core();
$filter = param_alpha('filter', 'canjoin');
$query = param_variable('query', '');
// check that the filter is valid, if not default to 'all'
if (in_array($filter, array('member', 'notmember', 'canjoin'))) {
$type = $filter;
} else {
// all or some other text
$filter = 'all';
$type = 'all';
}
$filter_elements = array();
$filter_elements['query'] = array('title' => get_string('search'), 'defaultvalue' => $query);
$filter_elements['filter'] = array('title' => get_string('filter'), 'options' => array('canjoin' => get_string('groupsicanjoin', 'group'), 'notmember' => get_string('groupsnotin', 'group'), 'member' => get_string('groupsimin', 'group'), 'all' => get_string('allgroups', 'group')), 'defaultvalue' => $filter);
$filter_elements['search'] = array('type' => 'submit', 'value' => get_string('search'));
$smarty->assign('filter_elements', $filter_elements);
return $smarty->fetch('blocktype:eselmasearchgroup:content.tpl');
}
示例6: pieform_element_filebrowser_changefolder
function pieform_element_filebrowser_changefolder(Pieform $form, $element, $folder)
{
$owner = $ownerid = $group = $institution = $user = null;
$prefix = $form->get_name() . '_' . $element['name'];
if (isset($element['tabs'])) {
if ($owner = param_variable($prefix . '_owner', null)) {
if ($owner == 'site') {
$owner = 'institution';
$institution = $ownerid = 'mahara';
} else {
if ($ownerid = param_variable($prefix . '_ownerid', null)) {
if ($owner == 'group') {
$group = (int) $ownerid;
} else {
if ($owner == 'institution') {
$institution = $ownerid;
} else {
if ($owner == 'user') {
$user = true;
}
}
}
}
}
}
}
// If changing to a group folder, check whether the user can edit it
if ($g = $owner ? $group : $form->get_property('group')) {
if (!pieform_element_filebrowser_view_group_folder($g, $folder)) {
return array('error' => true, 'message' => get_string('cannotviewfolder', 'artefact.file'));
}
$editgroupfolder = pieform_element_filebrowser_edit_group_folder($g, $folder);
}
return array('error' => false, 'changedfolder' => true, 'folder' => $folder, 'disableedit' => isset($editgroupfolder) && $editgroupfolder == false, 'newlist' => pieform_element_filebrowser_build_filelist($form, $element, $folder, null, $user, $group, $institution), 'newpath' => pieform_element_filebrowser_build_path($form, $element, $folder, $owner, $ownerid));
}
示例7: define
* @subpackage artefact-blog
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
define('PUBLIC', 1);
require dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php';
safe_require('artefact', 'blog');
json_headers();
$id = param_integer('id');
$limit = param_integer('limit', ArtefactTypeBlog::pagination);
$offset = param_integer('offset', 0);
$options = json_decode(param_variable('options'));
$viewid = isset($options->viewid) ? $options->viewid : null;
if ($viewid) {
if (!can_view_view($viewid)) {
throw new AccessDeniedException();
}
} else {
if (!$USER->is_logged_in()) {
throw new AccessDeniedException();
}
if (!$viewid && get_field('artefact', 'owner', 'id', $id) != $USER->get('id')) {
throw new AccessDeniedException();
}
}
list($count, $data) = ArtefactTypeBlogPost::render_posts(FORMAT_ARTEFACT_RENDERFULL, $options, $id, $limit, $offset);
if (!$count) {
示例8: get_data
protected static function get_data($groupid)
{
global $USER;
if (!defined('GROUP')) {
define('GROUP', $groupid);
}
// get the currently requested group
$group = group_current_group();
$group->ctime = strftime(get_string('strftimedate'), $group->ctime);
// if the user isn't logged in an the group isn't public don't show anything
if (!is_logged_in() && !$group->public) {
throw new AccessDeniedException();
}
// find the group administrators
$group->admins = get_column_sql("SELECT \"member\"\n FROM {group_member}\n WHERE \"group\" = ?\n AND \"role\" = 'admin'", array($group->id));
$role = group_user_access($group->id);
$group->role = $role;
// logged in user can do stuff
if (is_logged_in()) {
$afterjoin = param_variable('next', 'view');
if ($role) {
if ($role == 'admin') {
$group->membershiptype = 'admin';
$group->requests = count_records('group_member_request', 'group', $group->id);
} else {
$group->membershiptype = 'member';
}
$group->canleave = group_user_can_leave($group->id);
} else {
if ($group->jointype == 'invite' and $invite = get_record('group_member_invite', 'group', $group->id, 'member', $USER->get('id'))) {
$group->membershiptype = 'invite';
$group->invite = group_get_accept_form('invite', $group->id, $afterjoin);
} else {
if ($group->jointype == 'request' and $request = get_record('group_member_request', 'group', $group->id, 'member', $USER->get('id'))) {
$group->membershiptype = 'request';
} else {
if ($group->jointype == 'open') {
$group->groupjoin = group_get_join_form('joingroup', $group->id, $afterjoin);
}
}
}
}
}
$group->settingsdescription = group_display_settings($group);
if (get_config('allowgroupcategories')) {
$group->categorytitle = $group->category ? get_field('group_category', 'title', 'id', $group->category) : '';
}
$filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
return array('group' => $group, 'filecounts' => $filecounts);
}
示例9: define
/**
*
* @package mahara
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once dirname(__FILE__) . '/lib/multirecipientnotification.php';
require_once get_config('docroot') . '/lib/searchlib.php';
global $USER;
$request = param_variable('q');
$page = param_integer('page');
if ($page < 1) {
$page = 1;
}
$usersperpage = 10;
$more = true;
$tmpuser = array();
while ($more && count($tmpuser) < $usersperpage) {
$users = search_user($request, $usersperpage, $usersperpage * ($page - 1));
$more = $users['count'] > $usersperpage * $page;
if (!$users['data']) {
$users['data'] = array();
}
foreach ($users['data'] as $user) {
if (count($tmpuser) >= $usersperpage) {
示例10: get_users_data
/**
* used by user/myfriends.php and user/find.php to get the data (including pieforms etc) for display
* @param $userlist the ids separated by commas
* @return array containing the users in the order from $userlist
*/
function get_users_data($userlist, $getviews = true)
{
global $USER;
// $userlist is only used by build_userlist_html() in this file and is sanitised there
$sql = 'SELECT u.id, u.username, u.preferredname, u.firstname, u.lastname, u.admin, u.staff, u.deleted,
u.profileicon, u.email,
0 AS pending, ap.value AS hidenamepref,
COALESCE((SELECT ap.value FROM {usr_account_preference} ap WHERE ap.usr = u.id AND ap.field = \'messages\'), \'allow\') AS messages,
COALESCE((SELECT ap.value FROM {usr_account_preference} ap WHERE ap.usr = u.id AND ap.field = \'friendscontrol\'), \'auth\') AS friendscontrol,
(SELECT 1 FROM {usr_friend} WHERE ((usr1 = ? AND usr2 = u.id) OR (usr2 = ? AND usr1 = u.id))) AS friend,
(SELECT 1 FROM {usr_friend_request} fr WHERE fr.requester = ? AND fr.owner = u.id) AS requestedfriendship,
(SELECT title FROM {artefact} WHERE artefacttype = \'introduction\' AND owner = u.id) AS introduction,
NULL AS message
FROM {usr} u
LEFT JOIN {usr_account_preference} ap ON (u.id = ap.usr AND ap.field = \'hiderealname\')
WHERE u.id IN (' . $userlist . ')
UNION
SELECT u.id, u.username, u.preferredname, u.firstname, u.lastname, u.admin, u.staff, u.deleted,
u.profileicon, u.email,
1 AS pending, ap.value AS hidenamepref,
COALESCE((SELECT ap.value FROM {usr_account_preference} ap WHERE ap.usr = u.id AND ap.field = \'messages\'), \'allow\') AS messages,
NULL AS friendscontrol,
NULL AS friend,
NULL AS requestedfriendship,
(SELECT title FROM {artefact} WHERE artefacttype = \'introduction\' AND owner = u.id) AS introduction,
message
FROM {usr} u
LEFT JOIN {usr_account_preference} ap ON (u.id = ap.usr AND ap.field = \'hiderealname\')
JOIN {usr_friend_request} fr ON fr.requester = u.id
WHERE fr.owner = ?
AND u.id IN (' . $userlist . ')';
$userid = $USER->get('id');
$data = get_records_sql_assoc($sql, array($userid, $userid, $userid, $userid));
$allowhidename = get_config('userscanhiderealnames');
$showusername = get_config('searchusernames');
foreach ($data as &$record) {
$record->messages = $record->messages == 'allow' || $record->friend && $record->messages == 'friends' || $USER->get('admin') ? 1 : 0;
$record->institutions = get_institution_string_for_user($record->id);
$record->display_name = display_name($record, null, false, !$allowhidename || !$record->hidenamepref, $showusername);
}
if (!$data || !$getviews || !($views = get_views(array_keys($data), null, null))) {
$views = array();
}
if ($getviews) {
$viewcount = array_map('count', $views);
// since php is so special and inconsistent, we can't use array_map for this because it breaks the top level indexes.
$cleanviews = array();
foreach ($views as $userindex => $viewarray) {
$cleanviews[$userindex] = array_slice($viewarray, 0, 5);
// Don't reveal any more about the view than necessary
foreach ($cleanviews as $userviews) {
foreach ($userviews as &$view) {
foreach (array_keys(get_object_vars($view)) as $key) {
if ($key != 'id' && $key != 'title') {
unset($view->{$key});
}
}
}
}
}
}
foreach ($data as $friend) {
if ($getviews && isset($cleanviews[$friend->id])) {
$friend->views = $cleanviews[$friend->id];
}
if ($friend->pending) {
$friend->accept = pieform(array('name' => 'acceptfriend' . $friend->id, 'successcallback' => 'acceptfriend_submit', 'renderer' => 'div', 'autofocus' => 'false', 'elements' => array('submit' => array('type' => 'submit', 'value' => get_string('approverequest', 'group')), 'id' => array('type' => 'hidden', 'value' => $friend->id))));
}
if (!$friend->friend && !$friend->pending && !$friend->requestedfriendship && $friend->friendscontrol == 'auto') {
$friend->makefriend = pieform(array('name' => 'addfriend' . $friend->id, 'successcallback' => 'addfriend_submit', 'renderer' => 'div', 'autofocus' => 'false', 'elements' => array('submit' => array('type' => 'submit', 'value' => get_string('addtofriendslist', 'group')), 'id' => array('type' => 'hidden', 'value' => $friend->id), 'query' => array('type' => 'hidden', 'value' => param_variable('query', '')), 'offset' => array('type' => 'hidden', 'value' => param_integer('offset', 0)))));
}
}
$order = explode(',', $userlist);
$ordereddata = array();
foreach ($order as $id) {
if (isset($data[$id])) {
$ordereddata[] = $data[$id];
}
}
return $ordereddata;
}
示例11: param_integer
$markasread = param_integer('markasread', 0);
$delete = param_integer('delete', 0);
if ($readone) {
if ('notification_internal_activity' === $table) {
set_field($table, 'read', 1, 'id', $readone, 'usr', $USER->get('id'));
} else {
if ('artefact_multirecipient_notification' === $table) {
mark_as_read_mr(array($readone), $USER->get('id'));
}
}
$unread = $USER->add_unread(-1);
$data = array('newunreadcount' => $unread, 'newimage' => $THEME->get_url($unread ? 'images/newmail.png' : 'images/message.png'));
json_reply(false, array('data' => $data));
}
require_once get_config('libroot') . 'activity.php';
$type = param_variable('type', 'all');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$message = false;
if ($markasread) {
$ids = array();
$m = array();
foreach ($_GET as $k => $v) {
if (preg_match('/^unread\\-([a-zA-Z_]+)\\-(\\d+)$/', $k, $m)) {
$table = $m[1];
$ids[$table][] = $m[2];
}
}
foreach ($ids as $table => $idspertable) {
if ($idspertable) {
if ('artefact_multirecipient_notification' === $table) {
示例12: define
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'collection');
define('SECTION_PAGE', 'views');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'collection.php';
require_once 'view.php';
$id = param_integer('id');
// view addition/displayorder values
$view = param_integer('view', 0);
$direction = param_variable('direction', '');
$collection = new Collection($id);
if (!$USER->can_edit_collection($collection)) {
throw new AccessDeniedException(get_string('canteditcollection', 'collection'));
}
$sesskey = $USER->get('sesskey');
$inlinejs = '';
if ($accesschanged = $SESSION->get('pageaccesschanged')) {
$alertstr = get_string('viewsaddedaccesschanged', 'collection');
foreach ($accesschanged as $viewid) {
$changedview = new View($viewid);
$alertstr .= " " . json_encode($changedview->get('title')) . ",";
}
$alertstr = substr($alertstr, 0, -1) . '.';
$alertstr = get_string('viewsaddedtocollection1', 'collection', $SESSION->get('pagesadded')) . ' ' . $alertstr;
$inlinejs = <<<EOF
示例13: param_variable
$remove = param_variable('removeuser', null);
$member = param_integer('member', null);
if ($remove && $member) {
// Create the remove user pieform for the user that's being removed.
// The form's submit function will be called as soon as the form
// is generated.
//
// We do this now because the user could be on the 2nd page of
// results, so their remove form might never get generated on
// this page. And also because generating the rest of the page
// would be a waste of time -- the submit function just redirects
// back here.
group_get_removeuser_form($member, $group->id);
}
// Search related stuff for member pager
$query = trim(param_variable('query', ''));
// pagination params
$setlimit = true;
//Enable choosing page size; list of page sizes has been predefined in function build_pagination()
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
// Sort options index and list of sort options
// ORDER BY statements defined in group_user_search function need to be matched
$sortoptions = array('adminfirst' => get_string('adminfirst'), 'nameatoz' => get_string('nameatoz'), 'nameztoa' => get_string('nameztoa'), 'firstjoined' => get_string('firstjoined'), 'lastjoined' => get_string('lastjoined'));
$sortoptionidx = param_alpha('sortoption', 'adminfirst');
if ($membershiptype == 'request') {
array_shift($sortoptions);
$sortoptionidx = param_alpha('sortoption', 'nameatoz');
}
$results = get_group_user_search_results($group->id, $query, $offset, $limit, $membershiptype, null, null, $sortoptionidx);
list($html, $pagination, $count, $offset, $membershiptype) = group_get_membersearch_data($results, $group->id, $query, $membershiptype, $setlimit, $sortoptionidx);
示例14: define
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
// NOTE: this JSON script is used by the 'viewacl' element. It could probably
// be moved elsewhere without harm if necessary (e.g. if the 'viewacl' element
// was used in more places
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'searchlib.php';
$type = param_variable('type');
$query = param_variable('query', '');
$page = param_integer('page');
$limit = 10;
if ($page < 1) {
$page = 1;
}
$offset = ($page - 1) * $limit;
switch ($type) {
case 'friend':
$data = search_user($query, $limit, $offset, array('exclude' => $USER->get('id'), 'friends' => true));
break;
case 'user':
$data = search_user($query, $limit, $offset, array('exclude' => $USER->get('id')));
break;
case 'group':
require_once 'group.php';
示例15: param_alphanumext
$sp = param_alphanumext('as', 'default-sp');
if (!in_array($sp, SimpleSAML_Auth_Source::getSources())) {
$sp = 'default-sp';
}
$as = new SimpleSAML_Auth_Simple($sp);
// Check the SimpleSAMLphp config is compatible
$saml_config = SimpleSAML_Configuration::getInstance();
$session_handler = $saml_config->getString('session.handler', false);
$store_type = $saml_config->getString('store.type', false);
if ($store_type == 'phpsession' || $session_handler == 'phpsession' || empty($store_type) && empty($session_handler)) {
throw new AuthInstanceException(get_string('errorbadssphp', 'auth.saml'));
}
// what is the session like?
$valid_saml_session = $saml_session->isValid($sp);
// figure out what the returnto URL should be
$wantsurl = param_variable("wantsurl", false);
if (!$wantsurl) {
if (isset($_SESSION['wantsurl'])) {
$wantsurl = $_SESSION['wantsurl'];
} else {
if (!$saml_session->getIdP()) {
$wantsurl = array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : $CFG->wwwroot;
} else {
$wantsurl = $CFG->wwwroot;
}
}
}
// taken from Moodle clean_param - make sure the wantsurl is correctly formed
include_once 'validateurlsyntax.php';
if (!validateUrlSyntax($wantsurl, 's?H?S?F?E?u-P-a?I?p?f?q?r?')) {
$wantsurl = $CFG->wwwroot;