本文整理汇总了PHP中param_alpha函数的典型用法代码示例。如果您正苦于以下问题:PHP param_alpha函数的具体用法?PHP param_alpha怎么用?PHP param_alpha使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了param_alpha函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
require_once get_config('docroot') . 'artefact/lib.php';
$smarty = smarty_core();
$filter = param_alpha('filter', 'all');
$offset = param_integer('offset', 0);
$limit = 1000;
//get list online friend
$result_friend_online_id = get_onlinefriends($limit, $offset);
$str_eselma_online = implode(',', $result_friend_online_id['data']);
if ($str_eselma_online) {
$query_result_friend_online = "\n SELECT *\n FROM {usr}\n WHERE id in ({$str_eselma_online})\n ";
$result_friend_online = get_records_sql_array($query_result_friend_online);
}
//get list offline friend
$result_friend_offline_id = get_offlinefriends($limit, $offset);
$str_eselma_offline = implode(',', $result_friend_offline_id['data']);
if ($str_eselma_offline) {
$query_result_friend_offline = "\n SELECT *\n FROM {usr}\n WHERE id in ({$str_eselma_offline})\n ";
$result_friend_offline = get_records_sql_array($query_result_friend_offline);
}
$smarty->assign('eselma_get_online', $result_friend_online);
$smarty->assign('eselma_get_offline', $result_friend_offline);
$smarty->assign('lastminutes', floor(get_config('accessidletimeout') / 60));
$smarty->assign('eselma_count_online', $result_friend_online_id['count']);
$smarty->assign('eselma_count_offline', $result_friend_offline_id['count']);
return $smarty->fetch('blocktype:eselmaonoff:content.tpl');
}
示例2: sendmessage_submit
function sendmessage_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id;
$user = get_record('usr', 'id', $id);
send_user_message($user, $values['message']);
$SESSION->add_ok_msg(get_string('messagesent', 'group'));
switch (param_alpha('returnto', 'myfriends')) {
case 'find':
redirect('/user/find.php');
break;
case 'view':
redirect('/user/view.php?id=' . $id);
break;
default:
redirect('/user/myfriends.php');
break;
}
}
示例3: denyrequest_submit
function denyrequest_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id;
$loggedinid = $USER->get('id');
$user = get_record('usr', 'id', $id);
// friend db record
$f = new StdClass();
$f->ctime = db_format_timestamp(time());
// notification info
$n = new StdClass();
$n->url = profile_url($USER, false);
$n->users = array($user->id);
$n->fromuser = $USER->get('id');
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $id);
$n->subject = get_string_from_language($lang, 'friendrequestrejectedsubject', 'group');
if (isset($values['reason']) && !empty($values['reason'])) {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessagereason', 'group', $displayname) . $values['reason'];
} else {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('removefriendrequest', array('owner' => $loggedinid, 'requester' => $id));
$SESSION->add_ok_msg(get_string('friendformrejectsuccess', 'group'));
$offset = param_integer('offset', 0);
switch (param_alpha('returnto', 'myfriends')) {
case 'find':
$goto = 'user/find.php';
break;
case 'view':
$goto = profile_url($user, false);
break;
default:
$goto = 'user/myfriends.php';
break;
}
$goto .= strpos($goto, '?') ? '&offset=' . $offset : '?offset=' . $offset;
$goto = get_config('wwwroot') . $goto;
redirect($goto);
}
示例4: requestfriendship_submit
function requestfriendship_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id;
$loggedinid = $USER->get('id');
$user = get_record('usr', 'id', $id);
// friend db record
$f = new StdClass();
$f->ctime = db_format_timestamp(time());
// notification info
$n = new StdClass();
$n->url = get_config('wwwroot') . 'user/view.php?id=' . $loggedinid;
$n->users = array($user->id);
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$f->owner = $id;
$f->requester = $loggedinid;
$f->message = $values['message'];
insert_record('usr_friend_request', $f);
$n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
if (isset($values['message']) && !empty($values['message'])) {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessagereason', 'group', $displayname) . $values['message'];
} else {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
$SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
switch (param_alpha('returnto', 'myfriends')) {
case 'find':
redirect('/user/find.php');
break;
case 'view':
redirect('/user/view.php?id=' . $id);
break;
default:
redirect('/user/myfriends.php');
break;
}
}
示例5: define
<?php
/**
*
* @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.
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'searchlib.php';
$tag = param_variable('tag', null);
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$sort = param_alpha('sort', 'name');
$type = param_alpha('type', null);
$owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type);
build_portfolio_search_html($data);
$data->tagdisplay = is_null($tag) ? get_string('alltags') : hsc(str_shorten_text($tag, 50));
$data->tagurl = urlencode($tag);
json_reply(false, array('data' => $data));
示例6: define
* @subpackage skin
* @author Gregor Anzelj
* @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.
* @copyright (C) 2010-2013 Gregor Anzelj <gregor.anzelj@gmail.com>
*
*/
define('INTERNAL', true);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'skin');
define('SECTION_PAGE', 'design');
require_once dirname(dirname(__FILE__)) . '/init.php';
require_once 'skin.php';
require_once 'pieforms/pieform.php';
safe_require('artefact', 'file');
$fieldset = param_alpha('fs', 'viewskin');
$designsiteskin = param_boolean('site', false);
if (!can_use_skins(null, $designsiteskin)) {
throw new FeatureNotEnabledException();
}
if ($designsiteskin) {
define('ADMIN', 1);
if (!$USER->get('admin')) {
$SESSION->add_error_msg(get_string('accessforbiddentoadminsection'));
redirect();
}
define('MENUITEM', 'configsite/siteskins');
$goto = '/admin/site/skins.php';
$redirect = '/admin/site/skins.php';
} else {
define('MENUITEM', 'myportfolio/skins');
示例7: define
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @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('MENUITEM', 'groups');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require 'group.php';
$groupid = param_integer('id');
$returnto = param_alpha('returnto', 'mygroups');
define('GROUP', $groupid);
$group = group_current_group();
define('TITLE', $group->name);
if (!group_user_access($group->id)) {
throw new AccessDeniedException(get_string('notamember', 'group'));
}
if (!group_user_can_leave($group)) {
throw new AccessDeniedException(get_string('cantleavegroup', 'group'));
}
$goto = get_config('wwwroot') . 'group/' . $returnto . '.php' . ($returnto == 'view' ? '?id=' . $groupid : '');
$views = count_records_sql('SELECT COUNT(*)
FROM {view} v
INNER JOIN {view_access_group} a
ON a.group = ?
AND a.view = v.id
示例8: 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.
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups/members');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'group.php';
require_once get_config('docroot') . 'interaction/lib.php';
define('GROUP', param_integer('group'));
$group = group_current_group();
$userid = param_integer('user');
$newrole = param_alpha('role', null);
if (!($user = get_record('usr', 'id', $userid, 'deleted', 0))) {
throw new UserNotFoundException("Couldn't find user with id {$userid}");
}
$currentrole = group_user_access($group->id, $userid);
if (!$currentrole) {
throw new UserNotFoundException("Couldn't find user with id {$userid} in group {$group->id}");
}
$role = group_user_access($group->id);
if ($role != 'admin') {
throw new AccessDeniedException();
}
$roles = group_get_role_info($group->id);
$rolechange_available = false;
foreach ($roles as &$r) {
$disabled = !group_can_change_role($group->id, $userid, $r->role);
示例9: edit_interaction_submit
function edit_interaction_submit(Pieform $form, $values)
{
safe_require('interaction', $values['plugin']);
$classname = generate_interaction_instance_class_name($values['plugin']);
$instance = new $classname($values['id']);
$instance->set('creator', $values['creator']);
$instance->set('title', $values['title']);
$instance->set('description', $values['description']);
if (empty($values['id'])) {
$instance->set('group', $values['group']);
}
$instance->commit();
call_static_method(generate_class_name('interaction', $values['plugin']), 'instance_config_save', $instance, $values);
global $SESSION;
$SESSION->add_ok_msg(get_string('interactionsaved', 'group', get_string('name', 'interaction.' . $values['plugin'])));
$returnto = param_alpha('returnto', 'view');
if ($returnto == 'index') {
redirect('/interaction/' . $values['plugin'] . '/index.php?group=' . $instance->get('group'));
} else {
redirect('/interaction/' . $values['plugin'] . '/view.php?id=' . $instance->get('id'));
}
}
示例10: define
* @package mahara
* @subpackage interaction
* @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('MENUITEM', 'groups');
require dirname(dirname(__FILE__)) . '/init.php';
require_once get_config('docroot') . 'interaction/lib.php';
require_once 'pieforms/pieform.php';
require_once 'group.php';
$id = param_integer('id');
$instance = interaction_instance_from_id($id);
define('GROUP', $instance->get('group'));
$group = group_current_group();
$membership = group_user_access((int) $group->id);
if ($membership != 'admin') {
throw new AccessDeniedException(get_string('notallowedtodeleteinteractions', 'group'));
}
define('TITLE', get_string('deleteinteraction', 'group', get_string('name', 'interaction.' . $instance->get('plugin')), $instance->get('title')));
// submit handler in interaction/lib.php
$returnto = param_alpha('returnto', 'view');
$form = pieform(array('name' => 'delete_interaction', 'renderer' => 'div', 'elements' => array('id' => array('type' => 'hidden', 'value' => $id), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('yes'), get_string('no')), 'goto' => get_config('wwwroot') . 'interaction/' . $instance->get('plugin') . ($returnto == 'index' ? '/index.php?group=' . $instance->get('group') : '/view.php?id=' . $instance->get('id'))))));
$smarty = smarty(array('tablerenderer'));
$smarty->assign('form', $form);
$smarty->assign('heading', $group->name);
$smarty->assign('subheading', TITLE);
$smarty->assign('message', get_string('deleteinteractionsure', 'group'));
$smarty->display('interaction/delete.tpl');
示例11: define
* @subpackage admin
* @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.
*
*/
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'managegroups/archives');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('archivedsubmissions', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'archives');
require_once 'searchlib.php';
$search = (object) array('query' => trim(param_variable('query', '')), 'sortby' => param_alpha('sortby', 'firstname'), 'sortdir' => param_alpha('sortdir', 'asc'));
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
if ($USER->get('admin')) {
$institutions = get_records_array('institution', '', '', 'displayname');
$search->institution = param_alphanum('institution', 'all');
} else {
$institutionnames = array_keys($USER->get('admininstitutions'));
$institutions = get_records_select_array('institution', 'suspended = 0 AND name IN (' . join(',', array_fill(0, count($institutionnames), '?')) . ')', $institutionnames, 'displayname');
}
list($html, $columns, $pagination, $search) = build_admin_archived_submissions_results($search, $offset, $limit);
$js = <<<EOF
addLoadEvent(function() {
var p = {$pagination['javascript']}
new UserSearch(p);
示例12: edittopic_submit
function edittopic_submit(Pieform $form, $values)
{
global $SESSION, $USER, $topic;
$topicid = param_integer('id');
$returnto = param_alpha('returnto', 'topic');
$groupid = get_field_sql("SELECT DISTINCT i.group FROM {interaction_instance} i\n INNER JOIN {interaction_forum_topic} t ON i.id = t.forum\n WHERE t.id =?", array($topicid));
db_begin();
// check the post content actually changed
// otherwise topic could have been set as sticky/closed
$postchanged = $values['subject'] != $topic->subject || $values['body'] != $topic->body;
if ($postchanged) {
$newbody = EmbeddedImage::prepare_embedded_images($values['body'], 'topic', $topicid, $groupid);
update_record('interaction_forum_post', array('subject' => $values['subject'], 'body' => PluginInteractionForum::prepare_post_body($newbody, $values['post'])), array('id' => $values['post']));
}
if ($values['editrecord'] && $postchanged) {
insert_record('interaction_forum_edit', (object) array('user' => $USER->get('id'), 'post' => $values['post'], 'ctime' => db_format_timestamp(time())));
}
if (isset($values['sticky'])) {
update_record('interaction_forum_topic', array('sticky' => isset($values['sticky']) && $values['sticky'] == 1 ? 1 : 0, 'closed' => isset($values['closed']) && $values['closed'] == 1 ? 1 : 0), array('id' => $topicid));
}
db_commit();
$SESSION->add_ok_msg(get_string('edittopicsuccess', 'interaction.forum'));
if ($returnto == 'view') {
redirect('/interaction/forum/view.php?id=' . $topic->forum);
} else {
redirect('/interaction/forum/topic.php?id=' . $topicid);
}
}
示例13: define
}
define('TITLE', get_string('sendmessageto', 'module.multirecipientnotification'));
$returnto = param_alpha('returnto', 'myfriends');
$offset = param_integer('offset', 0);
switch ($returnto) {
case 'find':
$goto = 'user/find.php';
break;
case 'view':
$goto = profile_url($user, false);
break;
case 'inbox':
$goto = 'account/activity';
break;
case 'institution':
$goto = ($inst = param_alpha('inst', null)) ? 'institution/index.php?institution=' . $inst : 'account/activity';
break;
default:
$goto = 'module/multirecipientnotification/outbox.php';
break;
}
if ($offset > 0) {
$goto .= strpos($goto, '?') ? '&offset=' . $offset : '?offset=' . $offset;
}
$form = pieform(array('name' => 'sendmessage', 'autofocus' => false, 'validatecallback' => 'sendmessage_validate', 'elements' => array('recipients' => array('type' => 'autocomplete', 'title' => get_string('titlerecipient', 'module.multirecipientnotification'), 'defaultvalue' => $users, 'ajaxurl' => get_config('wwwroot') . 'module/multirecipientnotification/sendmessage.json.php', 'initfunction' => 'translate_ids_to_names', 'multiple' => true, 'ajaxextraparams' => array(), 'rules' => array('required' => true)), 'subject' => array('title' => get_string('titlesubject', 'module.multirecipientnotification'), 'type' => 'text', 'name' => 'subject', 'size' => '40', 'defaultvalue' => $subject, 'rules' => array('required' => true)), 'message' => array('type' => 'textarea', 'title' => $messages ? get_string('Reply', 'group') : get_string('message'), 'cols' => 80, 'rows' => 10, 'rules' => array('maxlength' => 65536, 'required' => true)), 'goto' => array('type' => 'hidden', 'value' => $goto), 'submit' => array('type' => 'submitcancel', 'class' => 'btn-success', 'value' => array($messages ? get_string('Reply', 'group') : get_string('sendmessage', 'group'), get_string('cancel')), 'goto' => get_config('wwwroot') . $goto))));
$javascripts = array('module/multirecipientnotification/js/sendmessage.js');
$smarty = smarty($javascripts);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('form', $form);
$smarty->assign('user', $USER);
$smarty->assign('messages', $messages);
示例14: get_config
require_once get_config('libroot') . 'view.php';
$query = param_variable('query', null);
$tag = param_variable('tag', null);
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$queryparams = array();
if (!empty($tag)) {
$queryparams['tag'] = $tag;
$query = null;
} else {
if ($query != '') {
$queryparams['query'] = $query;
}
}
$sortoptions = array('lastchanged', 'mtime', 'ownername', 'title');
if (!in_array($sort = param_alpha('sort', 'lastchanged'), $sortoptions)) {
$sort = 'lastchanged';
}
if ($sort !== 'lastchanged') {
$queryparams['sort'] = $sort;
}
$sortdir = $sort == 'lastchanged' || $sort == 'mtime' ? 'desc' : 'asc';
$shareoptions = array('user', 'friend', 'group', 'institution', 'loggedin', 'public');
$share = param_variable('share', array());
if (is_array($share)) {
$share = $queryparams['share'] = array_intersect($share, $shareoptions);
} else {
$share = null;
}
$data = View::shared_to_user($query, $tag, $limit, $offset, $sort, $sortdir, $share);
$pagination = build_pagination(array('id' => 'sharedviews_pagination', 'url' => get_config('wwwroot') . 'view/sharedviews.php' . (empty($queryparams) ? '' : '?' . http_build_query($queryparams)), 'jsonscript' => '/json/sharedviews.php', 'datatable' => 'sharedviewlist', 'count' => $data->count, 'limit' => $limit, 'offset' => $offset, 'setlimit' => true, 'jumplinks' => 8, 'numbersincludeprevnext' => 2));
示例15: define
* @subpackage admin
* @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.
*
*/
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/suspendedusers');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('suspendeduserstitle', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'suspendedusers');
require_once 'pieforms/pieform.php';
$type = param_alpha('type', 'suspended') == 'expired' ? 'expired' : 'suspended';
$enc_type = json_encode($type);
$typeform = pieform(array('name' => 'usertype', 'class' => 'with-heading with-label-widthauto form-condensed', 'elements' => array('type' => array('type' => 'select', 'title' => get_string('show'), 'options' => array('suspended' => get_string('suspendedusers', 'admin'), 'expired' => get_string('expiredusers', 'admin')), 'defaultvalue' => $type), 'typesubmit' => array('type' => 'submit', 'class' => 'js-hidden', 'value' => get_string('change')))));
$smarty = smarty(array('tablerenderer'));
setpageicon($smarty, 'icon-user-times');
$smarty->assign('typeform', $typeform);
$smarty->assign('INLINEJAVASCRIPT', <<<EOF
var suspendedlist = new TableRenderer(
'suspendedlist',
'suspended.json.php',
[
'name',
function (r) {
return TD(null, r.institutions ? map(partial(DIV, null), r.institutions) : null);
},
function (r) {