本文整理汇总了PHP中system_messages函数的典型用法代码示例。如果您正苦于以下问题:PHP system_messages函数的具体用法?PHP system_messages怎么用?PHP system_messages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system_messages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: embed_page_handler
/**
* Page handler for embeds
*
* @param array $page
*/
function embed_page_handler($page)
{
$params = array('output' => '', 'status' => 0, 'system_messages' => array('error' => array(), 'success' => array()));
$container_guid = get_input('container_guid');
if ($container_guid && get_entity($container_guid)) {
elgg_set_page_owner_guid($container_guid);
}
switch ($page[0]) {
default:
case 'tab':
$default_tab = elgg_is_active_plugin('file') ? 'file' : 'content_items';
$embed_tab = elgg_extract(1, $page, $default_tab);
$title = elgg_echo("embed:embed");
$filter = elgg_view('embed/filter', array('filter_context' => $embed_tab));
$view = "embed/tab/{$embed_tab}";
if (elgg_view_exists($view)) {
$content = elgg_view($view);
} else {
$embed_tab = elgg_get_config('embed_tab');
if ($embed_tab instanceof \ElggMenuItem) {
$view = $embed_tab->getData('view');
$options = $embed_tab->getData('options');
if ($view) {
$content = elgg_view($view);
} else {
if ($options) {
$content = elgg_view('embed/get_list', array('options' => $options));
}
}
}
}
if (empty($content)) {
$content = elgg_autop(elgg_echo('embed:section:invalid'));
}
$params['output'] = elgg_view_layout('one_column', array('title' => $title, 'content' => $filter . $content, 'class' => 'embed-wrapper'));
break;
}
$system_messages = system_messages(NULL, "");
if (isset($system_messages['success'])) {
$params['system_messages']['success'] = $system_messages['success'];
}
if (isset($system_messages['error'])) {
$params['system_messages']['error'] = $system_messages['error'];
$params['status'] = -1;
}
// We do not want to serve this page via non-xhr requests
if (!elgg_is_xhr()) {
register_error(elgg_echo('embed:error:non_xhr_request'));
return false;
}
echo json_encode($params);
exit;
}
示例2: CheckLTIUser
function CheckLTIUser($user_id)
{
// Check that user_id is present; if not all we can do is forward
// to login page
if (empty($user_id)) {
system_messages(elgg_echo('LTI:info:noid'));
forward();
}
// Is there a user with username $user_id
$user = get_user_by_username($user_id);
if (!empty($user->username)) {
return $user;
}
// No such user
return null;
}
示例3: elgg_load_library
<?php
/*
* Create a new backup file
*/
elgg_load_library("backup_tool");
$backup_file_name = get_input("file");
if (backup_tool_restore_backup(array("file_name" => $backup_file_name))) {
system_messages(elgg_echo("backup-tool:restore:success", array($filename)));
} else {
register_error(elgg_echo("backup-tool:restore:fail"));
}
forward(REFERRER);
示例4: loadEditMatchForm
/**
* Show the edit match form
*/
function loadEditMatchForm()
{
global $db, $_pre;
if (!isset($_GET['m_id'])) {
system_messages(0, 'No match given');
return;
}
if ($_GET['m_id'] == 'none') {
system_messages(0, 'Please select a match to edit');
return;
}
$match_id = $_GET['m_id'];
settype($match_id, 'integer');
$query = "SELECT * FROM {$_pre}matches WHERE id={$match_id} ORDER BY start_time DESC";
$db->setQuery($query);
if ($db->foundRows == 0) {
system_messages(0, 'No such match!');
return;
}
$row = $db->fetch_assoc();
?>
<span class="dark10">Editing CodeZone match <?php
echo "{$match_id} .::. {$row['title']}";
?>
</span><br />
<form class='admin-panel-form' name='global-conf' method='POST' action='index.php?a=su&a1=edit-match-details'>
<table class='admin-panel-forms-table' cellpadding="2" cellspacing="2" border="0">
<tr><td class='form-field-label'><span class='form-field-label-text'>Match Name</span></td>
<td><input type="text" name="edm-title" class="admin-panel-text-input" value="<?php
echo $row['title'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Match duration (sec)</span></td><td><input type="text" name="edm-duration" class="admin-panel-text-input" value="<?php
echo $row['duration'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Start date (yyyy-mm-dd)</span></td><td><input type="text" name="edm-start_date" class="admin-panel-text-input" value="<?php
echo get_date($row['start_time']);
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Start time (hh:mm:ss)</span></td><td><input type="text" name="edm-start_time" class="admin-panel-text-input" value="<?php
echo get_time($row['start_time']);
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Difficulty</span></td><td><input type="text" name="edm-difficulty" class="admin-panel-text-input" value="<?php
echo $row['difficulty'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Match points</span></td><td><input type="text" name="edm-match_points" class="admin-panel-text-input" value="<?php
echo $row['match_points'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Ranked match</span></td><td>Yes <input type="radio" name="edm-ranked_match" value="1" <?php
if ($row['match_ranked'] == 1) {
echo "checked='true'";
}
?>
/> No <input type="radio" name="edm-ranked_match" value="0" <?php
if ($row['match_ranked'] == 0) {
echo "checked='true'";
}
?>
/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Analysis <i>(Allowed tags are: <p>,<a>,<strong>,<i>,<br>. To highlight code blocks enclose the code in a div tag with class code_block e.g <div class="code_block"><pre>echo CONSTANT;</pre></div></i></span></td><td><textarea name="edm-analysis" class="admin-panel-textarea" style="width:400px;" rows="15" cols="45"><?php
echo stripslashes($row['analysis']);
?>
</textarea></td></tr>
<tr><td><input type="hidden" name="adm" value="<?php
echo base64_encode('su');
?>
" /><input type="hidden" name="f" value="<?php
echo base64_encode('edit_match');
?>
" /><input type="hidden" name="m_id" value="<?php
echo base64_encode($match_id);
?>
" /></td><td><input type="submit" name="save" class="admin-panel-submit-button" value="save" /> <input type="submit" name='delete_match' class="admin-panel-submit-button" value='Delete this match?' class="admin-panel-submit-button" onclick="return confirm('WARNING: Are you sure you want to delete this match? this action cannot be reversed!!');" /></td></tr>
</table>
</form>
<br />
<br />
<?php
$query = "SELECT COUNT(*) FROM {$_pre}{$row['match_table_name']} WHERE 1";
$db->setQuery($query);
$tmp_row = $db->fetch_assoc();
$st_total_registered = $tmp_row['COUNT(*)'];
//Total users registered for the match
$query = "SELECT * FROM {$_pre}user_match_log WHERE match_id={$row['id']} AND participated=1";
$db->setQuery($query);
$st_total_participated = $db->foundRows;
$query = "SELECT SUM(downloads_count) FROM {$_pre}{$row['match_table_name']} WHERE 1";
$db->setQuery($query);
$tmp_row = $db->fetch_assoc();
$st_downloads = $tmp_row['SUM(downloads_count)'];
$query = "SELECT SUM(submissions) FROM {$_pre}{$row['match_table_name']} WHERE 1";
$db->setQuery($query);
$tmp_row = $db->fetch_assoc();
//.........这里部分代码省略.........
示例5: system_messages
<link type="text/css" media="screen" rel="stylesheet" href="theme/jquery.colorbox/colorbox.css" />
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
<script src="js/jquery.countdown.min.js" type="text/javascript"></script>
<script src="js/countdown.custom.js" type="text/javascript"></script>
<script src="js/server.time.js" type="text/javascript"></script>
<?php
//Check if there's an active match
if (!$arn->active_match()) {
system_messages(0, "There is no active match");
return;
}
//Check if user logged in i.e to entice him/her to login
if (!$login) {
system_messages(0, "To participate in the arena, you must login");
return;
}
//Initialize arena validation
require_once 'ajphp' . DS . 'arenaValidatorHelper.php';
$arnv = new arenaValidatorHelper(time(), $_pre, $db, $arn, $_max_submissions, $_submission_timeout);
//Is this user registered...?
if (!$arnv->isUserRegistered() && !$su) {
system_messages(0, 'You are not registered to participate in this match');
return;
}
//Set participated column to 1 in user_match_log table
$arn->set_participate();
/**
There's an active match... Now we need to render the match arena ie. the problem statement plus the relevant ajax scripts to handle data transfer, countdown timing, scoreboard refreshes ...
*/
$arn->render_arena();
}
示例6: elgg_view_page
/**
* Assembles and outputs a full page.
*
* A "page" in Elgg is determined by the current view type and
* can be HTML for a browser, RSS for a feed reader, or
* Javascript, PHP and a number of other formats.
*
* @param string $title Title
* @param string $body Body
* @param string $page_shell Optional page shell to use. See page/shells view directory
* @param array $vars Optional vars array to pass to the page
* shell. Automatically adds title, body, and sysmessages
*
* @return string The contents of the page
* @since 1.8
*/
function elgg_view_page($title, $body, $page_shell = 'default', $vars = array())
{
$messages = null;
if (count_messages()) {
// get messages - try for errors first
$messages = system_messages(NULL, "error");
if (count($messages["error"]) == 0) {
// no errors so grab rest of messages
$messages = system_messages(null, "");
} else {
// we have errors - clear out remaining messages
system_messages(null, "");
}
}
$vars['title'] = $title;
$vars['body'] = $body;
$vars['sysmessages'] = $messages;
// check for deprecated view
if ($page_shell == 'default' && elgg_view_exists('pageshells/pageshell')) {
elgg_deprecated_notice("pageshells/pageshell is deprecated by page/{$page_shell}", 1.8);
global $CONFIG;
$vars['config'] = $CONFIG;
$output = elgg_view('pageshells/pageshell', $vars);
} else {
$output = elgg_view("page/{$page_shell}", $vars);
}
$vars['page_shell'] = $page_shell;
// Allow plugins to mod output
return elgg_trigger_plugin_hook('output', 'page', $vars, $output);
}
示例7: elgg_get_ini_setting_in_bytes
//You can add more than one receipients.
$formproc->AddRecipient($email);
//<<---Put your email address here
//2. For better security. Get a random tring from this link: http://tinyurl.com/randstr
// and put it here
$formproc->SetFormRandomKey('CnRrspl1FyEylUj');
$formproc->AddFileUploadField('photo', 'jpg,jpeg,gif,png,pdf,doc,docx,rar.zip,', 5120);
// Get post_max_size and upload_max_filesize
$post_max_size = elgg_get_ini_setting_in_bytes('post_max_size');
$upload_max_filesize = elgg_get_ini_setting_in_bytes('upload_max_filesize');
// Determine the correct value
$max_upload = $upload_max_filesize > $post_max_size ? $post_max_size : $upload_max_filesize;
$upload_limit = elgg_echo('file:upload_limit', array(elgg_format_bytes($max_upload)));
if (isset($_POST['submitted'])) {
if ($formproc->ProcessForm()) {
system_messages(elgg_echo('contactform:thankyoumsg'));
forward("mod/contactform");
// forward(elgg_get_site_url());
}
}
?>
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<script>
$(document).ready(function (){
$("#reason").change(function() {
// foo is the id of the other select box
if ($(this).val() == "Autres$Other") {
$("#subject").show();
}else{
示例8: system_messages
<?php
$messages = null;
if (count_messages()) {
// get messages - try for errors first
$messages = system_messages(NULL, 'error');
if (count($messages['error']) == 0) {
// no errors so grab rest of messages
$messages = system_messages(null, '');
} else {
// we have errors - clear out remaining messages
system_messages(null, '');
}
}
$type = elgg_extract('type', $vars, 'view');
$entity = elgg_extract('entity', $vars);
echo elgg_view_menu('newsletter_buttons', ['entity' => $entity, 'type' => $type, 'class' => 'newsletter-buttons', 'sort_by' => 'priority']);
echo elgg_view('page/elements/messages', ['object' => $messages]);
echo elgg_format_element('style', ['type' => 'text/css'], elgg_view('css/newsletter/buttons.css'));
elgg_load_css('newsletter_buttons');
示例9: ajax_forward_hook
/**
* Catch calls to forward() in ajax request and force an exit.
*
* Forces response is json of the following form:
* <pre>
* {
* "current_url": "the.url.we/were/coming/from",
* "forward_url": "the.url.we/were/going/to",
* "system_messages": {
* "messages": ["msg1", "msg2", ...],
* "errors": ["err1", "err2", ...]
* },
* "status": -1 //or 0 for success if there are no error messages present
* }
* </pre>
* where "system_messages" is all message registers at the point of forwarding
*
* @param string $hook
* @param string $type
* @param string $reason
* @param array $params
*
*/
function ajax_forward_hook($hook, $type, $reason, $params)
{
if (elgg_is_xhr()) {
//grab any data echo'd in the action
$output = ob_get_clean();
//Avoid double-encoding in case data is json
$json = json_decode($output);
if (isset($json)) {
$params['output'] = $json;
} else {
$params['output'] = $output;
}
//Grab any system messages so we can inject them via ajax too
$params['system_messages'] = system_messages(NULL, "");
if (isset($params['system_messages']['error'])) {
$params['status'] = -1;
} else {
$params['status'] = 0;
}
header("Content-type: application/json");
echo json_encode($params);
exit;
}
}
示例10: get_input
<?php
/*
* Do the redirect to previous trip
*
* Plugin: myTripsTeranga from previous version of @package ElggGroup
* Author: Rosana Montes Soldado
* Universidad de Granada
* Licence: CC-ByNCSA
* Reference: Microproyecto CEI BioTIC Ref. 11-2015
* Project coordinator: @rosanamontes
* Website: http://lsi.ugr.es/rosana
* Project colaborator: Antonio Moles
*
* Project Derivative:
* TFG: Desarrollo de un sistema de gestión de paquetería para Teranga Go
* Advisor: Rosana Montes
* Student: Ricardo Luzón Fernández
*
*/
$trip_guid = (int) get_input('trip_guid');
$trip = get_entity($trip_guid);
system_messages(elgg_echo('mytrips:manageOrders:saved'));
forward($trip->getUrl());
示例11: defined
defined('IN_APP') or die('Restricted Access!');
?>
<?php
if ($expire) {
system_messages(0, "Session expired, Please login again!");
}
if ($reg_pass_no) {
system_messages(0, "Reg No and password did not match");
}
if ($acc_active) {
system_messages(2, "Please activate this account to access CodeZone");
}
if ($acc_disabled) {
system_messages(2, "Your account has been disabled by CodeZone. Please contact an administrator");
}
if ($login_notify) {
system_messages(1, "Thank you for logging in {$user_row_data['nick_name']}");
}
if ($logout_notify) {
system_messages(1, "You are logged out, Bye bye!");
}
if ($request_expired) {
system_messages(0, "Request expired, please try again!");
}
if ($request_toofast) {
system_messages(0, 'Request too fast, Slow down and try again!');
}
?>
示例12: get_input
<?php
$schedule_action = get_input("schedule-action");
$enable_schedule = get_input("enable-schedule");
$schedule_period = get_input("schedule-period");
$schedule_delete = get_input("schedule-delete");
$backup_options = get_input("backup_options");
$ftp_enable = get_input("ftp-enable", false);
$ftp = get_input("ftp", false);
if (!$backup_options) {
register_error(elgg_echo('backup-tool:settings:error:backup_options'));
} else {
elgg_set_plugin_setting('backup_options', serialize($backup_options), 'backup-tool');
if ($schedule_action == elgg_echo("backuptool:schedule:button:enable")) {
$enable_schedule = true;
elgg_set_plugin_setting('enable_schedule', $enable_schedule, 'backup-tool');
system_messages(elgg_echo("backup-tool:settings:success:enable"));
} elseif ($schedule_action == elgg_echo("backuptool:schedule:button:disable")) {
$enable_schedule = false;
elgg_set_plugin_setting('enable_schedule', $enable_schedule, 'backup-tool');
system_messages(elgg_echo("backup-tool:settings:success:disable"));
} else {
system_messages(elgg_echo("backup-tool:settings:success"));
}
elgg_set_plugin_setting('schedule_period', $schedule_period, 'backup-tool');
elgg_set_plugin_setting('schedule_delete', $schedule_delete, 'backup-tool');
//save ftp settings
elgg_set_plugin_setting('ftp_enable', $ftp_enable[0], 'backup-tool');
elgg_set_plugin_setting('ftp', serialize($ftp), 'backup-tool');
}
示例13: defined
| links clicked on the frontpage |
| |
*----------------------------------------------------------*
*/
//Is in application...?
defined('IN_APP') or die('Restricted access');
if ($action == 'showstory') {
if (!isset($_GET['s_id'])) {
system_messages(0, 'Requested story unknown');
return;
}
$story_id = (int) $_GET['s_id'];
$query = "SELECT {$_pre}stories.*,{$_pre}users.nick_name FROM {$_pre}stories LEFT JOIN {$_pre}users ON {$_pre}stories.registration_no = {$_pre}users.registration_no WHERE {$_pre}stories.published=1 AND {$_pre}stories.id={$story_id}";
$db->setQuery($query);
if ($db->foundRows < 1) {
system_messages(0, 'Invalid story requested');
return;
}
$data = $db->fetch_assoc();
?>
<h3 class='arena-match-title'>Title:: <?php
echo ucfirst($data['title']);
?>
</h3>
<hr class='h3-bottom-line' />
<div id="showstories">
<?php
echo stripslashes(preg_replace("/<rmore>/", "", $data['content']));
//Remove the read more tag and strip any splashes
echo "<p class='article_details'><span class='light1'>" . time_stamp_to_readable($data['create_time']) . "</span> .::. Author: <span class='admin_orange'>{$data['nick_name']}</span></p>";
//Get next and previous stories if any
示例14: render_arena
/**
* Render the arena
*/
function render_arena()
{
global $arnv, $_max_submissions;
$match_details = $this->get_match_details();
//Verify if there's actually an active match
if (!$match_details) {
system_messages(0, "There is no active match or match over");
return;
}
//Compute remaining time
$seconds_rem = $match_details['start_time'] + $match_details['duration'] - time();
?>
<div id="arena-applet-container">
<div id="arena-applet-left">
<?php
echo "<h3 class='arena-match-title'>Problem Statement ..::.. " . strtoupper($match_details['title']) . "</h3>";
echo "<hr class='h3-bottom-line' />";
echo "<p class='arena-match-subtitle'>Maximum points: {$match_details['match_points']} .::. Difficulty: {$match_details['difficulty']} .::. Max downloads allowed: {$_max_submissions}</p>";
?>
<div id="match-rem-time" align="right">
<!--Match remaining time-->
</div>
<?php
/**Only show the downloads link if there is remaining downloads*/
if ($arnv->downloads_over()) {
echo "<h4 class='contact-link'><a class='load-iframe' title='CodeZone solution submission' href='ajphp/arenaValidator.php?a=arenaval&v=render_submission_form'>Submit solution</a></h4>";
}
//Print the problem Statement
$this->print_problem();
?>
</div>
<div id="arena-applet-right">
<span class='arena-general'>Live Scoreboard</span>
<!--Live scoreboard goes here-->
<div id="live-scoreboard"></div>
</div>
<div id="clear"></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({ cache:false });$(".load-iframe").colorbox({width:"60%", height:"45%", iframe:true,overlayClose:false});
var seconds=<?php
echo $seconds_rem;
?>
;
//Show match remaining time
$(function(){
$('#match-rem-time').countdown({ layout:"<span class='timer-rem-time'>Remaining time: {hnn} {hl}, {mnn} {ml}, {snn} {sl}</span>",until:+seconds, serverSync:serverTime,onExpiry:function(){alert('Match over!');window.location.href='index.php';}});
});
});
//Code to load scoreboard every 30 seconds
$('#live-scoreboard').load('ajphp/arenaValidator.php?a=arenaval&v=partial_scoreboard'); //Load it for the first time on page load
setInterval(function(){
$('#live-scoreboard').load('ajphp/arenaValidator.php?a=arenaval&v=partial_scoreboard');
}, 30000);
</script>
<?php
}
示例15: doContentHandler
function doContentHandler($tool_provider)
{
LoginUser($tool_provider);
system_messages('Forwarded to Group creation page');
forward(elgg_get_config('wwwroot') . '/groups/new/');
return;
}