本文整理汇总了PHP中generate_link函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_link函数的具体用法?PHP generate_link怎么用?PHP generate_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: page_contact
function page_contact()
{
// Add departments
global $_CLASS;
$_CLASS['core_user']->user_setup();
$_CLASS['core_user']->add_lang();
$this->error = '';
$this->preview = !empty($_POST['preview']);
if ($this->preview || !empty($_POST['contact'])) {
$this->data['MESSAGE'] = trim(get_variable('message', 'POST', ''));
$this->data['NAME'] = get_variable('sender_name', 'POST', '');
$this->data['EMAIL'] = get_variable('sender_email', 'POST', '');
foreach ($this->data as $field => $value) {
if (!$value) {
$this->error .= $_CLASS['core_user']->lang['ERROR_' . $field] . '<br />';
unset($field, $value, $lang);
} elseif ($field == 'EMAIL' && !check_email($value)) {
$this->error .= $_CLASS['core_user']->lang['BAD_EMAIL'] . '<br />';
}
}
if (!$this->error) {
$this->send_feedback();
}
} else {
$this->data['NAME'] = $_CLASS['core_user']->is_user ? $_CLASS['core_user']->data['username'] : '';
$this->data['EMAIL'] = $_CLASS['core_user']->is_user ? $_CLASS['core_user']->data['user_email'] : '';
$this->data['MESSAGE'] = '';
}
$_CLASS['core_template']->assign_array(array('ERROR' => $this->error, 'MESSAGE' => $this->data['MESSAGE'], 'ACTION' => generate_link($_CLASS['core_display']->page['page_name']), 'SENDER_EMAIL' => $this->data['EMAIL'], 'SENDER_NAME' => $this->data['NAME']));
$_CLASS['core_template']->display('modules/contact/index.html');
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:index.php
示例2: compile_markdown_files_metadata
function compile_markdown_files_metadata($folder, $output_file)
{
$data = array();
foreach (file_list($folder) as $file) {
$data[$file] = parse_file($file);
$data[$file]['link'] = generate_link($file);
unset($data[$file]['content']);
}
$data_before = <<<EOT
<?php
/*
===== This file is auto-generated. It contains the compiled metadata from the markdown. =====
*/
function compiled_metadata(\$file = null) {
\$data =
EOT;
$data_after = <<<EOT
;
\tif (\$file == null || !isset(\$data[\$file])) {
\t\treturn \$data;
\t} else {
\t\treturn \$data[\$file];
\t}
}
EOT;
$complete_data = $data_before . var_export($data, true) . $data_after;
$file_handle = fopen($output_file, "w");
if ($file_handle == false) {
die('Could not open compiled file to write.');
}
if (!fwrite($file_handle, $complete_data)) {
die('Could not write to file');
}
}
开发者ID:bet0x,项目名称:smartstrap,代码行数:35,代码来源:metadata.php
示例3: ucp_calender
function ucp_calender($id, $mode)
{
global $_CLASS, $table_prefix, $site_file_root;
if (!defined('CALENDER_TABLE')) {
define('CALENDER_TABLE', $table_prefix . 'calender');
}
$link = 'Control_Panel&i=' . $id;
$day = get_variable('day', 'REQUEST', false, 'integer');
$month = get_variable('month', 'REQUEST', false, 'integer');
$year = get_variable('year', 'REQUEST', false, 'integer');
load_class($site_file_root . 'includes/display/calender.php', 'calender');
$_CLASS['calender']->table = CALENDER_TABLE;
$_CLASS['calender']->set_date($day, $month, $year);
if (isset($_GET['mode']) && $_GET['mode'] === 'details') {
$mode = 'details';
}
switch ($mode) {
case 'day_view':
$_CLASS['calender']->month_view($link);
$_CLASS['calender']->get_events_day($link);
$day_flanks = $_CLASS['calender']->flank_days();
$month_flanks = $_CLASS['calender']->flank_months();
$previous_day = generate_link($link . '&mode=day_view&year=' . $day_flanks['previous_day']['year'] . '&month=' . $day_flanks['previous_day']['month'] . '&day=' . $day_flanks['previous_day']['day']);
$next_day = generate_link($link . '&mode=day_view&year=' . $day_flanks['next_day']['year'] . '&month=' . $day_flanks['next_day']['month'] . '&day=' . $day_flanks['next_day']['day']);
$previous_month = generate_link($link . '&mode=day_view&year=' . $month_flanks['previous_month']['year'] . '&month=' . $month_flanks['previous_month']['month']);
$next_month = generate_link($link . '&mode=day_view&year=' . $month_flanks['next_month']['year'] . '&month=' . $month_flanks['next_month']['month']);
$_CLASS['core_template']->assign_array(array('L_SUNDAY' => $_CLASS['core_user']->lang['datetime']['Sun'], 'L_MONDAY' => $_CLASS['core_user']->lang['datetime']['Mon'], 'L_TUESDAY' => $_CLASS['core_user']->lang['datetime']['Tue'], 'L_WEDNESDAY' => $_CLASS['core_user']->lang['datetime']['Wed'], 'L_THURSDAY' => $_CLASS['core_user']->lang['datetime']['Thu'], 'L_FRIDAY' => $_CLASS['core_user']->lang['datetime']['Fri'], 'L_SATURDAY' => $_CLASS['core_user']->lang['datetime']['Sat'], 'L_TODAY' => $_CLASS['core_user']->lang['datetime']['TODAY'], 'THIS_DAY' => date('F j, Y', mktime(0, 0, 0, $_CLASS['calender']->month, $_CLASS['calender']->day, $_CLASS['calender']->year)), 'PREVIOUS_DAY_LINK' => $previous_day, 'NEXT_DAY_LINK' => $next_day));
$this->display($_CLASS['core_user']->lang['UCP_MAIN'], 'ucp_calender_day.html');
break;
case 'add_event':
if (isset($_POST['submit'])) {
if ($this->add_event() !== false) {
trigger_error('EVENT_ADDED');
}
}
$_CLASS['core_template']->assign_array(array('ERROR' => empty($this->error) ? '' : implode('<br/>', $this->error), 'S_UCP_ACTION' => generate_link("Control_Panel&i={$id}&mode={$mode}")));
$this->display($_CLASS['core_user']->lang['UCP_MAIN'], 'ucp_calender_add.html');
break;
case 'details':
$id = get_variable('id', 'GET', false, 'integer');
$data = false;
$data = $_CLASS['calender']->get_events_details($id);
$_CLASS['core_template']->assign_array(array('CAL_TITLE' => $data['calender_title'], 'CAL_DESCRIPTION' => $data['calender_text'], 'CAL_START_TIME' => $_CLASS['core_user']->format_date($data['start_time']), 'CAL_END_TIME' => $_CLASS['core_user']->format_date($data['end_time'])));
$_CLASS['core_display']->display(false, 'modules/Control_Panel/ucp_calender_details.html');
break;
//case 'month_view':
//case 'month_view':
default:
$_CLASS['calender']->get_events_month($link);
$_CLASS['calender']->month_view($link);
$month_flanks = $_CLASS['calender']->flank_months();
$_CLASS['core_template']->assign_array(array('L_SUNDAY' => $_CLASS['core_user']->lang['datetime']['Sunday'], 'L_MONDAY' => $_CLASS['core_user']->lang['datetime']['Monday'], 'L_TUESDAY' => $_CLASS['core_user']->lang['datetime']['Tuesday'], 'L_WEDNESDAY' => $_CLASS['core_user']->lang['datetime']['Wednesday'], 'L_THURSDAY' => $_CLASS['core_user']->lang['datetime']['Thursday'], 'L_FRIDAY' => $_CLASS['core_user']->lang['datetime']['Friday'], 'L_SATURDAY' => $_CLASS['core_user']->lang['datetime']['Saturday'], 'L_TODAY' => $_CLASS['core_user']->lang['datetime']['TODAY'], 'THIS_MONTH_NAME' => $_CLASS['core_user']->lang['datetime'][date('F', mktime(0, 0, 0, $_CLASS['calender']->month, 1, $_CLASS['calender']->year))], 'NEXT_MONTH_NAME' => $_CLASS['core_user']->lang['datetime'][date('F', mktime(0, 0, 0, $month_flanks['next_month']['month'], 1, $_CLASS['calender']->year))], 'PREVIOUS_MONTH_NAME' => $_CLASS['core_user']->lang['datetime'][date('F', mktime(0, 0, 0, $month_flanks['previous_month']['month'], 1, $_CLASS['calender']->year))], 'NEXT_MONTH_YEAR' => $month_flanks['next_month']['year'], 'PREVIOUS_MONTH_YEAR' => $month_flanks['previous_month']['year'], 'CURRENT_YEAR' => $_CLASS['calender']->year, 'PREVIOUS_MONTH' => generate_link($link . '&mode=month_view&year=' . $month_flanks['previous_month']['year'] . '&month=' . $month_flanks['previous_month']['month']), 'NEXT_MONTH' => generate_link($link . '&mode=month_view&year=' . $month_flanks['next_month']['year'] . '&month=' . $month_flanks['next_month']['month'])));
$this->display($_CLASS['core_user']->lang['UCP_MAIN'], 'ucp_calender_main.html');
break;
}
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:56,代码来源:ucp_calender.php
示例4: theme_header
function theme_header()
{
global $_CORE_CONFIG, $_CORE_MODULE, $_CLASS;
$_CLASS['core_template']->assign_array(array('THEME_MAININDEX' => generate_link(), 'THEME_SITENAME' => $_CORE_CONFIG['global']['site_name'], 'THEME_MARGINRIGHT' => $_CLASS['core_blocks']->check_side(BLOCK_RIGHT) ? '180px' : '0px', 'THEME_MARGINLEFT' => $_CLASS['core_blocks']->check_side(BLOCK_LEFT) ? '180px' : '0px'));
if ($_CLASS['core_display']->homepage) {
$_CLASS['core_template']->assign('PAGE_TITLE', $_CLASS['core_user']->lang['HOME']);
} else {
$_CLASS['core_template']->assign('PAGE_TITLE', $_CLASS['core_user']->lang['HOME'] . ' > ' . (is_array($_CORE_MODULE['module_title']) ? implode(' > ', $_CORE_MODULE['module_title']) : $_CORE_MODULE['module_title']));
}
$_CLASS['core_blocks']->generate(BLOCK_LEFT);
$_CLASS['core_template']->display('header.html');
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:12,代码来源:index.php
示例5: check_type
function check_type(&$type, $redirect = true)
{
$appoved_type = array(PAGE_TEMPLATE);
$type = (int) $type;
if (!in_array($type, $appoved_type, true)) {
if ($redirect) {
redirect(generate_link('pages', array('admin' => true, 'full' => true)));
}
return false;
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:12,代码来源:pages.php
示例6: check_type
function check_type($type, $redirect = true)
{
$appoved_type = array(MODULE_NORMAL);
$type = (int) $type;
if (!in_array($type, $appoved_type, true)) {
if ($redirect) {
redirect(generate_link('modules', array('admin' => true, 'full' => true)));
}
return false;
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:12,代码来源:modules.php
示例7: admin_system
function admin_system($save)
{
if ($save) {
if (!empty($_POST['maintenance_start'])) {
$expires = strtotime($_POST['maintenance_start']);
$_POST['maintenance_start'] = !$expires || $expires == -1 ? '' : $expires;
}
$data = array('maintenance' => array('active' => array('post_name' => 'maintenance'), 'text' => array('post_name' => 'maintenance_text'), 'start' => array('post_name' => 'maintenance_start')), 'server' => array('cookie_domain' => array('post_name' => 'cookie_domain'), 'cookie_name' => array('post_name' => 'cookie_name'), 'cookie_path' => array('post_name' => 'cookie_path'), 'error_options' => array('post_name' => 'error_options'), 'site_domain' => array('post_name' => 'site_domain'), 'site_port' => array('post_name' => 'site_port'), 'site_path' => array('post_name' => 'site_path'), 'site_secure' => array('post_name' => 'site_secure'), 'ip_check' => array('post_name' => 'ip_check'), 'limit_load' => array('post_name' => 'limit_load'), 'limit_sessions' => array('post_name' => 'limit_sessions'), 'session_length' => array('post_name' => 'session_length')));
admin_save($data);
}
global $_CLASS, $_CORE_CONFIG;
$_CLASS['core_template']->assign_array(array('A_OPTION' => 'system', 'ACTION' => generate_link('system&mode=system', array('admin' => true)), 'COOKIE_DOMAIN' => $_CORE_CONFIG['server']['cookie_domain'], 'COOKIE_NAME' => $_CORE_CONFIG['server']['cookie_name'], 'COOKIE_PATH' => $_CORE_CONFIG['server']['cookie_path'], 'ERROR' => $_CORE_CONFIG['server']['error_options'], 'MAINTENANCE' => $_CORE_CONFIG['maintenance']['active'], 'MAINTENANCE_MSG' => $_CORE_CONFIG['maintenance']['text'], 'MAINTENANCE_START' => is_numeric($_CORE_CONFIG['maintenance']['start']) ? $_CLASS['core_user']->format_date($_CORE_CONFIG['maintenance']['start'], 'M d, Y h:i a') : '', 'IP_CHECK' => $_CORE_CONFIG['server']['ip_check'], 'SITE_DOMAIN' => $_CORE_CONFIG['server']['site_domain'], 'SITE_PATH' => $_CORE_CONFIG['server']['site_path'], 'SITE_PORT' => $_CORE_CONFIG['server']['site_port'], 'SITE_SECURE' => $_CORE_CONFIG['server']['site_secure'], 'LIMIT_LOAD' => $_CORE_CONFIG['server']['limit_load'], 'LIMIT_SESSIONS' => $_CORE_CONFIG['server']['limit_sessions'], 'SESSION_LENGTH' => $_CORE_CONFIG['server']['session_length']));
$_CLASS['core_template']->display('admin/system/index.html');
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:14,代码来源:system.php
示例8: qm_block_content
function qm_block_content()
{
global $_CLASS, $_CORE_CONFIG;
$content = '<div style="width: 100%; height: ' . $_CORE_CONFIG['quick_message']['height'] . 'px; overflow: auto;">';
$result = $_CLASS['core_db']->query_limit('SELECT * from ' . QUICK_MESSAGE_TABLE . ' ORDER BY message_time DESC', 10);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$words_array = explode(' ', $row['message_text']);
$row['message_text'] = '';
foreach ($words_array as $words) {
if (substr($words, 0, 4) != '[url') {
$row['message_text'] .= ' ' . wordwrap($words, 18, "\n", 1);
} else {
$row['message_text'] .= $words;
}
}
$row['message_text'] = htmlentities($row['message_text'], ENT_QUOTES, 'UTF-8');
unset($words_array, $words);
$content .= '<div style="padding: 4px;">';
if ($row['poster_name']) {
$row['poster_name'] = htmlentities($row['poster_name'], ENT_QUOTES, 'UTF-8');
if ($row['poster_id']) {
$content .= '<a href="' . generate_link('Members_List&mode=viewprofile&u=' . $row['poster_id']) . '"><b>' . $row['poster_name'] . ': </b></a>';
} else {
$content .= '<b>' . $row['poster_name'] . ': </b>';
}
} else {
$content .= '<b>' . $_CLASS['core_user']->lang['ANONYMOUS'] . ': </b>';
}
if ($row['poster_id']) {
$row['message_text'] = preg_replace('#\\[url=([^\\[]+?)\\](.*?)\\[/url\\]#s', '<a href="$1" target="_blank">$2</a>', $row['message_text']);
}
$content .= $row['message_text'] . '<br />' . $_CLASS['core_user']->format_date($row['message_time']) . '</div><hr/>';
}
$_CLASS['core_db']->free_result($result);
$content .= '</div>';
return $content;
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:37,代码来源:functions.php
示例9: do_login
function do_login($login_options, $template)
{
global $_CLASS, $_CORE_CONFIG;
$user_name = !empty($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : getenv('PHP_AUTH_USER');
$user_password = !empty($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : getenv('PHP_AUTH_PW');
//list($user_name, $user_password) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
$error = '';
$login_array = array('redirect' => false, 'explain' => false, 'success' => '', 'admin_login' => false, 'full_login' => true, 'full_screen' => false);
if (is_array($login_options)) {
$login_array = array_merge($login_array, $login_options);
}
if ($user_name || $user_password) {
if (!$user_name || !$user_password) {
$error = 'INCOMPLETE_LOGIN_INFO';
}
if (!$error) {
$result = $this->user_auth($user_name, $user_password);
if (is_numeric($result)) {
$_CLASS['core_user']->login($result, $login_array['admin_login'], false);
$login_array['redirect'] = generate_link(get_variable('redirect', 'POST', $login_array['redirect']), array('admin' => $data['admin_login']));
$_CLASS['core_display']->meta_refresh(5, $login_array['redirect']);
$message = ($login_array['success'] ? $_CLASS['core_user']->get_lang($login_array['success']) : $_CLASS['core_user']->lang['LOGIN_REDIRECT']) . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $login_array['redirect'] . '">', '</a> ');
trigger_error($message);
}
$error = is_string($result) ? $result : 'LOGIN_ERROR';
}
}
if (!$login_array['redirect']) {
$login_array['redirect'] = htmlspecialchars($_CLASS['core_user']->url);
}
// better realm needed, logout support needed
// Random realm for spoofers ?
header('WWW-Authenticate: Basic realm="Site Login"');
header('HTTP/1.0 401 Unauthorized');
//echo $error
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:36,代码来源:auth_http.php
示例10: enable_graphs
$graph_enable[$section][$graph['graph']] = $graph['graph'];
}
}
enable_graphs($device, $graph_enable);
$sep = '';
foreach ($graph_enable as $section => $nothing) {
if (isset($graph_enable) && is_array($graph_enable[$section])) {
$type = strtolower($section);
if (!$vars['group']) {
$vars['group'] = $type;
}
echo $sep;
if ($vars['group'] == $type) {
echo '<span class="pagemenu-selected">';
}
echo generate_link(ucwords($type), $link_array, array('group' => $type));
if ($vars['group'] == $type) {
echo '</span>';
}
$sep = ' | ';
}
}
unset($sep);
print_optionbar_end();
$graph_enable = $graph_enable[$vars['group']];
foreach ($graph_enable as $graph => $entry) {
$graph_array = array();
if ($graph_enable[$graph]) {
$graph_title = $config['graph_types']['device'][$graph]['descr'];
$graph_array['type'] = 'device_' . $graph;
include 'includes/print-device-graph.php';
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:graphs.inc.php
示例11: sanitize_text
<?php
require "../includes/conf.inc.php";
require "../includes/functions.inc.php";
$sq = $_POST['search'];
$sqn = sanitize_text($sq);
$searchResult = post::searchPosts($sqn, '');
if ($searchResult == false) {
echo $e;
} else {
if ($searchResult == 'empty') {
echo '<span class="search-wait">No Results Found</span>';
} else {
$srOutput = '';
foreach ($searchResult as $sr) {
$srOutput .= '<a href="' . generate_link($sr['postTitle'], $sr['postId']) . '">' . $sr['postTitle'] . '</a>';
}
echo $srOutput;
}
}
开发者ID:amriterry,项目名称:ptn,代码行数:20,代码来源:ajax.php
示例12: array
$result = $_CLASS['core_db']->query($sql);
$legend = array();
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$legend[] .= '<a style="color:#' . $row['group_colour'] . '" href="' . generate_link('Members_List&mode=group&g=' . $row['group_id']) . '">' . (isset($_CLASS['core_user']->lang['G_' . $row['group_name']]) ? $_CLASS['core_user']->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
}
$_CLASS['core_db']->free_result($result);
$legend = implode(', ', $legend);
// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays']) {
$now = getdate();
$now = explode(':', gmdate('j:m'));
$sql = 'SELECT user_id, username, user_colour, user_birthday
FROM ' . USERS_TABLE . " \n\t\tWHERE user_birthday LIKE '" . sprintf('%2d-%2d-', $now[0], $now[1]) . "%'\n\t\t\tAND user_type = " . USER_NORMAL;
$result = $_CLASS['core_db']->query($sql);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$user_colour = $row['user_colour'] ? ' style="color:#' . $row['user_colour'] . '"' : '';
$birthday_list .= ($birthday_list != '' ? ', ' : '') . '<a' . $user_colour . ' href="' . generate_link('Members_List&mode=viewprofile&u=' . $row['user_id']) . '">' . $row['username'] . '</a>';
if ($age = (int) substr($row['user_birthday'], -4)) {
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
}
$_CLASS['core_db']->free_result($result);
}
$l_total_user_s = $config['num_users'] == 0 ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = $config['num_posts'] == 0 ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = $config['num_topics'] == 0 ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
// Assign index specific vars
$_CLASS['core_template']->assign_array(array('TOTAL_POSTS' => sprintf($_CLASS['core_user']->get_lang($l_total_post_s), $config['num_posts']), 'TOTAL_TOPICS' => sprintf($_CLASS['core_user']->get_lang($l_total_topic_s), $config['num_topics']), 'TOTAL_USERS' => sprintf($_CLASS['core_user']->get_lang($l_total_user_s), $config['num_users']), 'NEWEST_USER' => sprintf($_CLASS['core_user']->get_lang('NEWEST_USER'), '<a href="' . generate_link('Members_List&mode=viewprofile&u=' . $config['newest_user_id']) . '">', $config['newest_username'], '</a>'), 'LEGEND' => $legend, 'BIRTHDAY_LIST' => $birthday_list, 'FORUM_IMG' => $_CLASS['core_user']->img('forum', 'NO_NEW_POSTS'), 'FORUM_NEW_IMG' => $_CLASS['core_user']->img('forum_new', 'NEW_POSTS'), 'FORUM_LOCKED_IMG' => $_CLASS['core_user']->img('forum_locked', 'NO_NEW_POSTS_LOCKED'), 'S_LOGIN_ACTION' => generate_link('Control_Panel&mode=login'), 'S_DISPLAY_BIRTHDAY_LIST' => $config['load_birthdays'], 'U_MARK_FORUMS' => generate_link('Forums&mark=forums')));
page_header();
$_CLASS['core_template']->display('modules/Forums/index_body.html');
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:main.php
示例13: generate_link
}
echo generate_link($type_text[$metric], $link_array, array('metric' => $metric, 'view' => $vars['view']));
if ($vars['metric'] == $metric) {
echo "</span>";
}
$sep = ' | ';
}
unset($sep);
echo '<div style="float: right;">';
if ($vars['view'] == "graphs") {
echo '<span class="pagemenu-selected">';
}
echo generate_link("Graphs", $link_array, array('metric' => $vars['metric'], 'view' => "graphs"));
if ($vars['view'] == "graphs") {
echo '</span>';
}
echo ' | ';
if ($vars['view'] != "graphs") {
echo '<span class="pagemenu-selected">';
}
echo generate_link("No Graphs", $link_array, array('metric' => $vars['metric'], 'view' => "detail"));
if ($vars['view'] != "graphs") {
echo '</span>';
}
echo '</div>';
print_optionbar_end();
if (in_array($vars['metric'], array_keys($used_sensors)) || $vars['metric'] == 'processor' || $vars['metric'] == 'storage' || $vars['metric'] == 'toner' || $vars['metric'] == 'mempool') {
include 'pages/health/' . $vars['metric'] . '.inc.php';
} else {
echo "No sensors of type " . $vars['metric'] . " found.";
}
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:health.inc.php
示例14: do_login
function do_login($login_options, $template)
{
global $_CLASS, $_CORE_CONFIG;
$error = '';
$login_array = array('redirect' => false, 'explain' => false, 'success' => '', 'admin_login' => false, 'full_login' => true, 'full_screen' => false);
if (is_array($login_options)) {
$login_array = array_merge($login_array, $login_options);
}
if (isset($_POST['login'])) {
$user_name = get_variable('username', 'POST');
$user_password = get_variable('password', 'POST');
if (!$user_name || !$user_password) {
$error = 'INCOMPLETE_LOGIN_INFO';
}
if (!$error && $_CORE_CONFIG['user']['enable_confirm']) {
$code = $_CLASS['core_user']->session_data_get('confirmation_code');
$confirm_code = get_variable('confirm_code', 'POST', false);
if (!$code || !$confirm_code || $code !== $confirm_code) {
// $error = 'CONFIRM_CODE_WRONG';
}
}
if (!$error) {
$result = $this->user_auth($user_name, $user_password);
if (is_numeric($result)) {
$_CLASS['core_user']->login($result, $login_array['admin_login'], !empty($_POST['hidden']), !empty($_POST['auto_login']));
$login_array['redirect'] = generate_link(get_variable('redirect', 'POST', $login_array['redirect']), array('admin' => $login_array['admin_login']));
$_CLASS['core_display']->meta_refresh(5, $login_array['redirect']);
$message = ($login_array['success'] ? $_CLASS['core_user']->get_lang($login_array['success']) : $_CLASS['core_user']->lang['LOGIN_REDIRECT']) . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $login_array['redirect'] . '">', '</a> ');
trigger_error($message);
}
$error = is_string($result) ? $result : 'LOGIN_ERROR';
}
}
if (!$login_array['redirect']) {
$login_array['redirect'] = htmlspecialchars($_CLASS['core_user']->url);
}
$s_hidden_fields = '<input type="hidden" name="redirect" value="' . $login_array['redirect'] . '" />';
if ($_CORE_CONFIG['user']['enable_confirm']) {
$confirm_image = '<img src="' . generate_link('system&mode=confirmation_image') . '" alt="" title="" />';
$_CLASS['core_user']->session_data_set('confirmation_code', generate_string(6));
} else {
$confirm_image = false;
}
$_CLASS['core_template']->assign_array(array('LOGIN_ERROR' => $_CLASS['core_user']->get_lang($error), 'LOGIN_EXPLAIN' => $_CLASS['core_user']->get_lang($login_array['explain']), 'U_SEND_PASSWORD' => $_CORE_CONFIG['email']['email_enable'] ? generate_link('Control_Panel&mode=sendpassword') : '', 'U_RESEND_ACTIVATION' => $_CORE_CONFIG['user']['activation'] != USER_ACTIVATION_NONE && $_CORE_CONFIG['email']['email_enable'] ? generate_link('Control_Panel&mode=resend_act') : '', 'U_TERMS_USE' => generate_link('Control_Panel&mode=terms'), 'U_PRIVACY' => generate_link('Control_Panel&mode=privacy'), 'U_REGISTER' => generate_link('Control_Panel&mode=register'), 'U_CONFIRM_IMAGE' => $confirm_image, 'USERNAME' => isset($data['user_name']) ? $data['user_name'] : '', 'S_DISPLAY_FULL_LOGIN' => $login_array['full_login'], 'S_LOGIN_ACTION' => !$login_array['admin_login'] ? generate_link($_CLASS['core_user']->url) : generate_link(false, array('admin' => true)), 'S_HIDDEN_FIELDS' => $s_hidden_fields));
if (!$template && $login_array['full_screen']) {
$template = 'login_body_full.html';
}
$_CLASS['core_template']->display($template ? $template : 'login_body.html');
script_close();
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:50,代码来源:auth.php
示例15: generate_link
if ($vars['view'] == 'prefixes_ipv6unicast') {
echo '</span>';
}
echo ' | Traffic: ';
if ($vars['view'] == 'macaccounting_bits') {
echo "<span class='pagemenu-selected'>";
}
echo generate_link('Bits', $link_array, array('view' => 'macaccounting_bits'));
if ($vars['view'] == 'macaccounting_bits') {
echo '</span>';
}
echo ' | ';
if ($vars['view'] == 'macaccounting_pkts') {
echo "<span class='pagemenu-selected'>";
}
echo generate_link('Packets', $link_array, array('view' => 'macaccounting_pkts'));
if ($vars['view'] == 'macaccounting_pkts') {
echo '</span>';
}
print_optionbar_end();
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
echo '<tr style="height: 30px"><td width=1></td><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>';
$i = '1';
foreach (dbFetchRows('SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `bgpPEerRemoteAs`, `bgpPeerIdentifier`', array($device['device_id'])) as $peer) {
$has_macaccounting = dbFetchCell('SELECT COUNT(*) FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = ? AND M.mac = I.mac_address', array($peer['bgpPeerIdentifier']));
unset($bg_image);
if (!is_integer($i / 2)) {
$bg_colour = $list_colour_a;
} else {
$bg_colour = $list_colour_b;
}
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:bgp.inc.php
示例16: set_read_status
// Update unread status
if ($message_row['pm_unread']) {
set_read_status(true, $message_row['msg_id'], $_CLASS['core_user']->data['user_id'], $folder_id);
}
}
$folder = get_folder($_CLASS['core_user']->data['user_id'], $folder_id);
$s_folder_options = $s_to_folder_options = '';
foreach ($folder as $f_id => $folder_ary) {
$option = '<option' . (!in_array($f_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) ? ' class="blue"' : '') . ' value="' . $f_id . '"' . ($f_id == $folder_id ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ($folder_ary['unread_messages'] ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
$s_to_folder_options .= $f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX ? $option : '';
$s_folder_options .= $option;
}
clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']);
// Header for message view - folder and so on
$folder_status = get_folder_status($folder_id, $folder);
$_CLASS['core_template']->assign_array(array('CUR_FOLDER_ID' => $folder_id, 'CUR_FOLDER_NAME' => $folder_status['folder_name'], 'NUM_NOT_MOVED' => $num_not_moved, 'RELEASE_MESSAGE_INFO' => sprintf($_CLASS['core_user']->lang['RELEASE_MESSAGES'], '<a href="' . generate_link($this->link_parent . '&folder=' . $folder_id . '&release=1') . '">', '</a>'), 'NOT_MOVED_MESSAGES' => $num_not_moved == 1 ? $_CLASS['core_user']->lang['NOT_MOVED_MESSAGE'] : sprintf($_CLASS['core_user']->lang['NOT_MOVED_MESSAGES'], $num_not_moved), 'S_FOLDER_OPTIONS' => $s_folder_options, 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, 'S_FOLDER_ACTION' => generate_link($this->link_parent . '&mode=view&action=view_folder'), 'S_PM_ACTION' => generate_link($this->link_parent . '&mode=$mode&action=' . $action), 'U_INBOX' => generate_link($this->link_parent . '&folder=inbox'), 'U_OUTBOX' => generate_link($this->link_parent . '&folder=outbox'), 'U_SENTBOX' => generate_link($this->link_parent . '&folder=sentbox'), 'U_CREATE_FOLDER' => generate_link($this->link_parent . '&mode=options'), 'S_IN_INBOX' => $folder_id == PRIVMSGS_INBOX, 'S_IN_OUTBOX' => $folder_id == PRIVMSGS_OUTBOX, 'S_IN_SENTBOX' => $folder_id == PRIVMSGS_SENTBOX, 'FOLDER_STATUS' => $folder_status['message'], 'FOLDER_MAX_MESSAGES' => $folder_status['max'], 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'], 'FOLDER_PERCENT' => $folder_status['percent']));
$_CLASS['core_template']->assign('S_VIEW_MESSAGE', false);
if ($action === 'view_folder') {
require SITE_FILE_ROOT . 'modules/control_panel/modules/ucp_pm_viewfolder.php';
view_folder($this, $folder_id, $folder, $mode === 'unread' ? 'unread' : 'folder');
$_CLASS['core_display']->display(false, 'modules/control_panel/ucp_pm_viewfolder.html');
} elseif ($action == 'view_message') {
$_CLASS['core_template']->assign_array(array('S_VIEW_MESSAGE' => true, 'MSG_ID' => $msg_id));
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
require SITE_FILE_ROOT . 'modules/control_panel/modules/ucp_pm_viewmessage.php';
view_message($this, $folder_id, $msg_id, $folder, $message_row);
$_CLASS['core_display']->display(false, 'modules/control_panel/' . ($view === 'print' ? 'ucp_pm_viewmessage_print.html' : 'ucp_pm_viewmessage.html'));
}
break;
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:ucp_pm.php
示例17: generate_link
$show_menu .= '</span>';
} else {
$show_menu .= generate_link('Latest', array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig'));
}
if (check_extension_exists('svn')) {
$sep = ' | ';
$svnlogs = svn_log($device_config_file, SVN_REVISION_HEAD, NULL, 8);
$revlist = array();
foreach ($svnlogs as $svnlog) {
$show_menu .= $sep;
$revlist[] = $svnlog['rev'];
if ($vars['rev'] == $svnlog['rev']) {
$show_menu .= '<span class="pagemenu-selected">';
}
$linktext = 'r' . $svnlog['rev'] . ' <small>' . format_timestamp($svnlog['date']) . '</small>';
$show_menu .= generate_link($linktext, array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig', 'rev' => $svnlog['rev']));
if ($vars['rev'] == $svnlog['rev']) {
$show_menu .= '</span>' . PHP_EOL;
}
}
}
echo $show_menu;
print_optionbar_end();
if (check_extension_exists('svn') && in_array($vars['rev'], $revlist)) {
list($diff, $errors) = svn_diff($device_config_file, $vars['rev'] - 1, $device_config_file, $vars['rev']);
if (!$diff) {
$text = '没有区别';
} else {
$text = '';
while (!feof($diff)) {
$text .= fread($diff, 8192);
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:showconfig.inc.php
示例18: mcp_notes_user_view
/**
* Display user notes
*/
function mcp_notes_user_view($action)
{
global $_CLASS, $_CORE_CONFIG, $config;
$user_id = request_var('u', 0);
$username = request_var('username', '');
$start = request_var('start', 0);
$st = request_var('st', 0);
$sk = request_var('sk', 'b');
$sd = request_var('sd', 'd');
$url = 'forums&file=mcp&i=notes&mode=user_notes';
$sql_where = $user_id ? "user_id = {$user_id}" : "username = '" . $db->sql_escape($username) . "'";
$sql = 'SELECT *
FROM ' . CORE_USERS_TABLE . "\n\t\tWHERE {$sql_where}";
$result = $_CLASS['core_db']->query($sql);
$userrow = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
if (!$userrow) {
trigger_error('NO_USER');
}
$user_id = $userrow['user_id'];
$deletemark = $action === 'del_marked';
$deleteall = $action === 'del_all';
$marked = get_variable('marknote', 'REQUEST', false, 'array:int');
$usernote = request_var('usernote', '', true);
// Handle any actions
if (($deletemark || $deleteall) && $_CLASS['forums_auth']->acl_get('a_clearlogs')) {
$where_sql = '';
if ($deletemark && !empty($marked)) {
$where_sql = ' AND log_id IN (' . implode(', ', $marked) . ')';
}
if ($where_sql || $deleteall) {
$sql = 'DELETE FROM ' . FORUMS_LOG_TABLE . '
WHERE log_type = ' . LOG_USERS . " \n\t\t\t\t\tAND reportee_id = {$user_id}\n\t\t\t\t\t{$where_sql}";
$_CLASS['core_db']->query($sql);
add_log('admin', 'LOG_CLEAR_USER', $userrow['username']);
$msg = $deletemark ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED';
$redirect = generate_link($url . '&u=' . $user_id);
$_CLASS['core_display']->meta_refresh(3, $redirect);
trigger_error($_CLASS['core_user']->lang[$msg] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
}
if ($usernote && $action === 'add_feedback') {
add_log('admin', 'LOG_USER_FEEDBACK', $userrow['username']);
add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote);
$redirect = generate_link($url . '&u=' . $user_id);
$_CLASS['core_display']->meta_refresh(3, $redirect);
trigger_error($_CLASS['core_user']->lang['USER_FEEDBACK_ADDED'] . '<br /><br />' . sprintf($_CLASS['core_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 = $_CORE_CONFIG['global']['path_avatar_upload'] . '/';
break;
case AVATAR_GALLERY:
$avatar_img = $_CORE_CONFIG['global']['path_avatar_gallery'] . '/';
break;
}
$avatar_img .= $userrow['user_avatar'];
$avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" alt="" />';
}
$limit_days = array(0 => $_CLASS['core_user']->lang['ALL_ENTRIES'], 1 => $_CLASS['core_user']->lang['1_DAY'], 7 => $_CLASS['core_user']->lang['7_DAYS'], 14 => $_CLASS['core_user']->lang['2_WEEKS'], 30 => $_CLASS['core_user']->lang['1_MONTH'], 90 => $_CLASS['core_user']->lang['3_MONTHS'], 180 => $_CLASS['core_user']->lang['6_MONTHS'], 365 => $_CLASS['core_user']->lang['1_YEAR']);
$sort_by_text = array('a' => $_CLASS['core_user']->lang['SORT_USERNAME'], 'b' => $_CLASS['core_user']->lang['SORT_DATE'], 'c' => $_CLASS['core_user']->lang['SORT_IP'], 'd' => $_CLASS['core_user']->lang['SORT_ACTION']);
$sort_by_sql = array('a' => 'l.username', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
// Define where and sort sql for use in displaying logs
$sql_where = $st ? $_CLASS['core_user']->time - $st * 86400 : 0;
$sql_sort = $sort_by_sql[$sk] . ' ' . ($sd == 'd' ? 'DESC' : 'ASC');
$log_data = array();
$log_count = 0;
view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
$_CLASS['core_template']->assign('S_USER_NOTES', false);
if ($log_count) {
$_CLASS['core_template']->assign('S_USER_NOTES', true);
foreach ($log_data as $row) {
$_CLASS['core_template']->assign_vars_array('usernotes', array('REPORT_BY' => $row['username'], 'REPORT_AT' => $_CLASS['core_user']->format_date($row['time']), 'ACTION' => $row['action'], 'IP' => $row['ip'], 'ID' => $row['id']));
}
}
$pagination = generate_pagination($url . "&u={$user_id}&st={$st}&sk={$sk}&sd={$sd}", $log_count, $config['posts_per_page'], $start);
|
请发表评论