本文整理汇总了PHP中add_warning函数的典型用法代码示例。如果您正苦于以下问题:PHP add_warning函数的具体用法?PHP add_warning怎么用?PHP add_warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_warning函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mcp_warn_user_view
/**
* Handles warning the user
*/
function mcp_warn_user_view($action)
{
global $phpEx, $phpbb_root_path, $config, $module;
global $template, $db, $user, $auth;
$user_id = request_var('u', 0);
$username = request_var('username', '', true);
$notify = (isset($_REQUEST['notify_user'])) ? true : false;
$warning = utf8_normalize_nfc(request_var('warning', '', true));
$sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $sql_where;
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row)
{
trigger_error('NO_USER');
}
// Prevent someone from warning themselves
if ($user_row['user_id'] == $user->data['user_id'])
{
trigger_error('CANNOT_WARN_SELF');
}
$user_id = $user_row['user_id'];
if (strpos($this->u_action, "&u=$user_id") === false)
{
$this->p_master->adjust_url('&u=' . $user_id);
$this->u_action .= "&u=$user_id";
}
if ($warning && $action == 'add_warning')
{
if (check_form_key('mcp_warn'))
{
add_warning($user_row, $warning, $notify);
$msg = $user->lang['USER_WARNING_ADDED'];
}
else
{
$msg = $user->lang['FORM_INVALID'];
}
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id");
meta_refresh(2, $redirect);
trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
// Generate the appropriate user information for the user we are looking at
if (!function_exists('get_user_avatar'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
$rank_title = $rank_img = '';
$avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
// OK, they didn't submit a warning so lets build the page for them to do so
$template->assign_vars(array(
'U_POST_ACTION' => $this->u_action,
'USERNAME' => $user_row['username'],
'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
'RANK_TITLE' => $rank_title,
'JOINED' => $user->format_date($user_row['user_regdate']),
'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
'AVATAR_IMG' => $avatar_img,
'RANK_IMG' => $rank_img,
));
return $user_id;
}
示例2: add_warning
case rectype_daily:
case rectype_weekly:
break;
// Everything else gets ignored
// Everything else gets ignored
default:
$_POST['record'] = 0;
}
// Cancelling a schedule?
if ($_POST['record'] == 0) {
// Cancel this schedule
if ($schedule && $schedule->recordid) {
// Delete the schedule
$schedule->delete();
// Redirect back to the schedule list
add_warning(t('The requested recording schedule has been deleted.'));
save_session_errors();
header('Location: ' . root_url . 'tv/schedules');
exit;
}
} else {
// Set things as the user requested
$schedule->profile = $_POST['profile'];
$schedule->recgroup = $_POST['recgroup'];
$schedule->storagegroup = $_POST['storagegroup'];
$schedule->playgroup = $_POST['playgroup'];
$schedule->autoexpire = $_POST['autoexpire'] ? 1 : 0;
$schedule->autocommflag = $_POST['autocommflag'] ? 1 : 0;
$schedule->autouserjob1 = $_POST['autouserjob1'] ? 1 : 0;
$schedule->autouserjob2 = $_POST['autouserjob2'] ? 1 : 0;
$schedule->autouserjob3 = $_POST['autouserjob3'] ? 1 : 0;
示例3: elseif
$query .= " {$compare} {$search}";
}
$query .= ')';
}
}
} elseif (preg_match('/^\\s*canned:\\s*(.+)\\s*$/i', $_SESSION['search']['s'], $search_name)) {
$search_name = $search_name[1];
// Load the canned searches
require_once 'modules/tv/canned_searches.conf.php';
// Load the local canned searches (if it exists)
if (file_exists('configuration/canned_searches.conf.php')) {
include 'configuration/canned_searches.conf.php';
}
// Find the query
if (empty($Canned_Searches[$search_name])) {
add_warning("Unknown canned query: {$search_name}");
} else {
$query = $Canned_Searches[$search_name];
}
} else {
// Make a backup so we can edit it without affecting the original
$search_str = $_SESSION['search']['s'];
// If it starts with hd: it's an hd-only search
if (preg_match('/^hd:\\s*(.+)$/', $search_str, $match)) {
$extra_query[] = 'program.hdtv & 1';
$search_str = $match[1];
}
// If the next thing starts with stars, it's a movie rating query
if (preg_match('#(\\*+\\s*(1/2\\b|0?\\.5\\b|-)?)\\s*(.*?)$#', $search_str, $match)) {
$starcount = substr_count($match[1], '*') / 4;
if (preg_match('/1\\/2|\\.5|-/', $match[1])) {
示例4: unset
unset($_SESSION['recorded_title']);
continue;
}
// Catch anything else
$_REQUEST['refresh'] = true;
$warning = t('Showing all programs.');
unset($_REQUEST['title'], $_REQUEST['recgroup']);
unset($_SESSION['recorded_title'], $_SESSION['recorded_recgroup']);
continue;
}
// Did the best we could to find some programs; let's move on.
break;
}
// Warning?
if (!empty($warning)) {
add_warning(t('No matching programs found.') . "\n" . $warning);
}
// Now that we've selected only certain shows, load them into objects
$All_Shows = array();
foreach ($Programs as $title => $shows) {
foreach ($shows as $key => $record) {
// Create a new program object
$show =& new Program($record);
// Assign a reference to this show to the various arrays
$All_Shows[] =& $show;
$Programs[$title][$key] =& $show;
$channel =& Channel::find($show->chanid);
$channel->programs[] =& $show;
unset($show);
}
}
示例5: mcp_warn_user_view
/**
* Handles warning the user
*/
function mcp_warn_user_view($action)
{
global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $phpbb_dispatcher;
$user_id = $request->variable('u', 0);
$username = $request->variable('username', '', true);
$notify = isset($_REQUEST['notify_user']) ? true : false;
$warning = $request->variable('warning', '', true);
$sql_where = $user_id ? "user_id = {$user_id}" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $sql_where;
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
// Prevent someone from warning themselves
if ($user_row['user_id'] == $user->data['user_id']) {
trigger_error('CANNOT_WARN_SELF');
}
$user_id = $user_row['user_id'];
if (strpos($this->u_action, "&u={$user_id}") === false) {
$this->p_master->adjust_url('&u=' . $user_id);
$this->u_action .= "&u={$user_id}";
}
// Check if can send a notification
if ($config['allow_privmsg']) {
$auth2 = new \phpbb\auth\auth();
$auth2->acl($user_row);
$s_can_notify = $auth2->acl_get('u_readpm') ? true : false;
unset($auth2);
} else {
$s_can_notify = false;
}
// Prevent against clever people
if ($notify && !$s_can_notify) {
$notify = false;
}
if ($warning && $action == 'add_warning') {
if (check_form_key('mcp_warn')) {
$s_mcp_warn_user = true;
/**
* Event for before warning a user from MCP.
*
* @event core.mcp_warn_user_before
* @var array user_row The entire user row
* @var string warning The warning message
* @var bool notify If true, we notify the user for the warning
* @var bool s_mcp_warn_user If true, we add the warning else we omit it
* @since 3.1.0-b4
*/
$vars = array('user_row', 'warning', 'notify', 's_mcp_warn_user');
extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars)));
if ($s_mcp_warn_user) {
add_warning($user_row, $warning, $notify);
$message = $user->lang['USER_WARNING_ADDED'];
/**
* Event for after warning a user from MCP.
*
* @event core.mcp_warn_user_after
* @var array user_row The entire user row
* @var string warning The warning message
* @var bool notify If true, the user was notified for the warning
* @var string message Message displayed to the moderator
* @since 3.1.0-b4
*/
$vars = array('user_row', 'warning', 'notify', 'message');
extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars)));
}
} else {
$message = $user->lang['FORM_INVALID'];
}
if (!empty($message)) {
$redirect = append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=notes&mode=user_notes&u={$user_id}");
meta_refresh(2, $redirect);
trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
}
// Generate the appropriate user information for the user we are looking at
if (!function_exists('phpbb_get_user_rank')) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
}
$user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']);
$avatar_img = phpbb_get_user_avatar($user_row);
// OK, they didn't submit a warning so lets build the page for them to do so
$template->assign_vars(array('U_POST_ACTION' => $this->u_action, 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => $user_row['user_posts'] ? $user_row['user_posts'] : 0, 'WARNINGS' => $user_row['user_warnings'] ? $user_row['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $user_rank_data['img'], 'S_CAN_NOTIFY' => $s_can_notify));
return $user_id;
}
示例6: mcp_warn_user_view
/**
* Handles warning the user
*/
function mcp_warn_user_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth;
$user_id = request_var('u', 0);
$username = request_var('username', '', true);
$notify = isset($_REQUEST['notify_user']) ? true : false;
$warning = request_var('warning', '', true);
$sql_where = $user_id ? "user_id = {$user_id}" : "username = '" . $db->sql_escape($username) . "'";
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $sql_where;
$result = $db->sql_query($sql);
$userrow = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$userrow) {
trigger_error('NO_USER');
}
$user_id = $userrow['user_id'];
if ($warning && $action == 'add_warning') {
add_warning($userrow, $warning, $notify);
$redirect = append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=notes&mode=user_notes&u={$user_id}");
meta_refresh(2, $redirect);
trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
// Generate the appropriate user information for the user we are looking at
$rank_title = $rank_img = '';
// get_user_rank($userrow['user_rank'], $userrow['user_posts'], $rank_title, $rank_img);
$avatar_img = '';
if (!empty($userrow['user_avatar'])) {
switch ($userrow['user_avatar_type']) {
case AVATAR_UPLOAD:
$avatar_img = $config['avatar_path'] . '/';
break;
case AVATAR_GALLERY:
$avatar_img = $config['avatar_gallery_path'] . '/';
break;
}
$avatar_img .= $userrow['user_avatar'];
$avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" alt="" />';
}
// OK, they didn't submit a warning so lets build the page for them to do so
$template->assign_vars(array('U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&mode={$mode}&u={$user_id}"), 'USERNAME' => $userrow['username'], 'USER_COLOR' => !empty($userrow['user_colour']) ? $userrow['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($userrow['user_regdate']), 'POSTS' => $userrow['user_posts'] ? $userrow['user_posts'] : 0, 'WARNINGS' => $userrow['user_warnings'] ? $userrow['user_warnings'] : 0, 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img));
}
示例7: gen_docs
function gen_docs($name, $type)
{
/* {{{ */
global $OPTION, $INFO;
if ($type & DOC_EXTENSION) {
try {
$extension = new ReflectionExtension($name);
$INFO['actual_extension'] = $name;
write_doc($extension, DOC_EXTENSION);
foreach ($extension->getClasses() as $class) {
gen_docs($class->name, DOC_CLASS);
}
foreach ($extension->getFunctions() as $function) {
gen_docs($function->name, DOC_FUNCTION);
}
} catch (Exception $e) {
die('Error: ' . $e->getMessage() . "\n");
}
} else {
if ($type & DOC_FUNCTION) {
try {
$function = new ReflectionFunction($name);
if (!$INFO['actual_extension']) {
if ($extname = $function->getExtensionName()) {
$INFO['actual_extension'] = $extname;
} else {
add_warning("The function {$name} lacks Reflection information");
}
}
write_doc($function, DOC_FUNCTION);
} catch (Exception $e) {
die('Error: ' . $e->getMessage() . "\n");
}
} else {
if ($type & DOC_METHOD) {
try {
$class = new ReflectionClass($OPTION['class']);
if (!$INFO['actual_extension']) {
if ($extname = $class->getExtensionName()) {
$INFO['actual_extension'] = $extname;
} else {
add_warning("The method {$name} lacks Reflection information");
}
}
foreach ($class->getMethods() as $method) {
/* Don't get the inherited methods */
if ($method->getDeclaringClass()->name == $class->name && (is_array($OPTION['method']) && in_array(strtolower($method->getName()), $OPTION['method']) || $OPTION['method'] == strtolower($method->getName()))) {
write_doc($method, $method->isConstructor() ? DOC_CONSTRUCTOR : DOC_METHOD);
}
}
} catch (Exception $e) {
die('Error: ' . $e->getMessage() . "\n");
}
} else {
if ($type & DOC_CLASS) {
try {
$class = new ReflectionClass($name);
if (!$INFO['actual_extension']) {
if ($extname = $class->getExtensionName()) {
$INFO['actual_extension'] = $extname;
} else {
add_warning("The class {$name} lacks Reflection information");
}
}
write_doc($class, DOC_CLASS);
foreach ($class->getMethods() as $method) {
/* Don't get the inherited methods */
if ($method->getDeclaringClass()->name == $class->name) {
write_doc($method, $method->isConstructor() ? DOC_CONSTRUCTOR : DOC_METHOD);
}
}
} catch (Exception $e) {
die('Error: ' . $e->getMessage() . "\n");
}
}
}
}
}
}
示例8: elseif
} elseif ($_REQUEST['never_record']) {
$program->rec_never_record();
} elseif ($_REQUEST['default']) {
$program->rec_default();
} elseif ($_REQUEST['dontrec']) {
$program->rec_override(rectype_dontrec);
} elseif ($_REQUEST['record']) {
$program->rec_override(rectype_override);
} elseif ($_REQUEST['activate']) {
$program->activate();
}
} else {
if ($_REQUEST['dontrec']) {
$schedule =& Schedule::find($_GET['chanid'], $_GET['starttime'])->save(rectype_dontrec);
} else {
add_warning('Unknown program.');
}
}
// Redirect back to the page again, but without the query string, so reloads are cleaner
redirect_browser(root_url . 'tv/upcoming');
}
// Ignore certain shows?
if ($_POST['change_display']) {
$_SESSION['scheduled_recordings']['disp_scheduled'] = $_POST['disp_scheduled'] ? true : false;
$_SESSION['scheduled_recordings']['disp_duplicates'] = $_POST['disp_duplicates'] ? true : false;
$_SESSION['scheduled_recordings']['disp_deactivated'] = $_POST['disp_deactivated'] ? true : false;
$_SESSION['scheduled_recordings']['disp_conflicts'] = $_POST['disp_conflicts'] ? true : false;
$_SESSION['scheduled_recordings']['disp_recgroup'] = $_POST['disp_recgroup'];
$_SESSION['scheduled_recordings']['disp_title'] = $_POST['disp_title'];
}
// Defaults
示例9: rdm
function rdm($miles, $carrier, $fare)
{
$miles = segment_min($miles, $carrier);
$multiplier = 0;
$elite_bonus_multiplier = 1.0;
$fare = trim($fare);
switch ($carrier) {
case "DL":
$multiplier = get_multiplier_by_fare($fare, "FAPGJCDIZWYBM", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "SHQKLUTXVE", 1.0, $multiplier);
break;
case "SV":
$multiplier = get_multiplier_by_fare($fare, "FPAR", 1.6, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "JCD", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YWOBMKHTQLXVG", 1.0, $multiplier);
break;
case "SU":
$multiplier = get_multiplier_by_fare($fare, "JCDIYS", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "BMHKVT", 1.0, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "LQW", 0.75, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "NU", 0.25, $multiplier);
break;
case "AM":
$multiplier = get_multiplier_by_fare($fare, "AJD", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBMKNQSTX", 1.0, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "VLWP", 0.75, $multiplier);
break;
case "AF":
$multiplier = get_multiplier_by_fare($fare, "PFJCDZI", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "SWA", 1.25, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBMUKHLQEGNTR", 1.0, $multiplier);
break;
case "AS":
$multiplier = get_multiplier_by_fare($fare, "F", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YSBMHQLVKGTU", 1.0, $multiplier);
break;
case "AZ":
$multiplier = get_multiplier_by_fare($fare, "JCDIAP", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBMHKVTQNLOXWSRG", 1.0, $multiplier);
break;
case "OK":
$multiplier = get_multiplier_by_fare($fare, "JCD", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBMTHK", 1.0, $multiplier);
break;
case "KL":
$multiplier = get_multiplier_by_fare($fare, "JCDIZ", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "A", 1.25, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBMUKHLQEGNTR", 1.0, $multiplier);
break;
case "KE":
$multiplier = get_multiplier_by_fare($fare, "FPR", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "J", 1.35, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "CDI", 1.25, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "ZYWMHEKB", 1.0, $multiplier);
break;
case "RO":
# TAROM
$multiplier = get_multiplier_by_fare($fare, "CDJS", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBMEGHNTWKRLQUV", 1.0, $multiplier);
break;
case "NW":
$multiplier = get_multiplier_by_fare($fare, "PJCZF", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YBIMHQVSKTL", 1.0, $multiplier);
break;
case "UX":
# Air Europa
$multiplier = get_multiplier_by_fare($fare, "CDI", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YMBKWXOUVSR", 1.0, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "Q", 1.0, $multiplier);
break;
case "HA":
# Hawaiian
add_warning("Mileage credit for Hawaiian Airlines depends on the route flown, which this calculator is not smart enough to figure out. The results for this trip may be wrong.");
$multiplier = get_multiplier_by_fare($fare, "FJP", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "XYVWQMIBS", 1.0, $multiplier);
break;
case "CI":
# China Airlines
$multiplier = get_multiplier_by_fare($fare, "F", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "AJ", 1.3, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "C", 1.25, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "DYBMT", 1.0, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "KVW", 0.8, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "RQHNZ", 0.5, $multiplier);
break;
case "MU":
# China Eastern
$multiplier = get_multiplier_by_fare($fare, "FP", 1.5, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "CJO", 1.3, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "YKBH", 1.0, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "ELMNRV", 0.7, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "STQWXG", 0.3, $multiplier);
add_warning("Despite what is reported here, there is no Medallion elite bonus for RDMs for China Eastern flights.");
add_warning("Mileage credit varies depending on route. Don't trust these results.");
break;
case "CZ":
# China Southern
$multiplier = get_multiplier_by_fare($fare, "FAPJCDI", 1.25, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "WSYBMHUK", 1.0, $multiplier);
$multiplier = get_multiplier_by_fare($fare, "LQEVKUTN", 0.4, $multiplier);
//.........这里部分代码省略.........