本文整理汇总了PHP中tpl_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_redirect函数的具体用法?PHP tpl_redirect怎么用?PHP tpl_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpl_redirect
tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id));
exit;
}
if (isset($_POST['save'])) {
$cnote = $_POST['note_content'];
$cn = strlen($cnote);
if (mysql_num_rows($notes_rs) != 0) {
$n_record = sql_fetch_array($notes_rs);
$note_id = $n_record['note_id'];
sql("UPDATE `cache_notes` SET `date`=NOW(),`desc`='&1', `desc_html`='&2' WHERE `note_id`='&3'", $cnote, '0', $note_id);
}
if (mysql_num_rows($notes_rs) == 0 && $cn != 0) {
sql("INSERT INTO `cache_notes` (\n `note_id`,\n `cache_id`,\n `user_id`,\n `date`,\n `desc_html`,\n `desc`\n ) VALUES (\n '', '&1', '&2',NOW(),'&3', '&4')", $cache_id, $usr['userid'], '0', $cnote);
}
//display cache-page
tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id) . '#cache_note2');
exit;
}
if (mysql_num_rows($notes_rs) != 0 && (!isset($_POST['edit']) || !isset($_REQUEST['edit']))) {
tpl_set_var('CacheNoteE', '');
tpl_set_var('CacheNoteS', '');
tpl_set_var('EditCacheNoteE', '-->');
tpl_set_var('EditCacheNoteS', '<!--');
$notes_record = sql_fetch_array($notes_rs);
$note_desc = $notes_record['desc'];
if ($notes_record['desc_html'] == '0') {
$note_desc = htmlspecialchars($note_desc, ENT_COMPAT, 'UTF-8');
} else {
require_once $rootpath . 'lib/class.inputfilter.php';
$myFilter = new InputFilter($allowedtags, $allowedattr, 0, 0, 1);
$note_desc = $myFilter->process($note_desc);
示例2: isset
<?php
use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
$cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : '';
$target = isset($_REQUEST['target']) ? $_REQUEST['target'] : 'myignores.php';
if ($usr !== false) {
//add to caches
$rs = XDb::xQuery('SELECT ignorer_count FROM caches WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
if ($record = Xdb::xFetchArray($rs)) {
XDb::xSql('UPDATE caches SET ignorer_count=\'' . ($record['ignorer_count'] + 1) . '\'
WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
//add watch
XDb::xSql('INSERT INTO `cache_ignore` (`cache_id`, `user_id`)
VALUES (\'' . XDb::xEscape($cache_id) . '\', \'' . XDb::xEscape($usr['userid']) . '\')');
//add to user
$rs = XDb::xSql('SELECT cache_ignores FROM user WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
$record = XDb::xFetchArray($rs);
XDb::xSql('UPDATE user SET cache_ignores=\'' . ($record['cache_ignores'] + 1) . '\' WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
tpl_redirect($target);
}
}
}
tpl_BuildTemplate();
示例3: urlencode
<?php
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
global $stat_menu;
//Preprocessing
if ($error == false) {
//user logged in?
if ($usr == false) {
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target=' . $target);
} else {
// check for old-style parameters
if (isset($_REQUEST['userid'])) {
$user_id = $_REQUEST['userid'];
}
if ($user_id != $usr['userid']) {
// do not highlight My stats menu item if browsing other users stats
$mnu_siteid = 'start';
}
$tplname = 'ustat';
$stat_menu = array('title' => 'Statystyka', 'menustring' => 'Statystyka', 'siteid' => 'statlisting', 'navicolor' => '#E8DDE4', 'visible' => false, 'filename' => 'viewprofile.php?userid=' . $user_id, 'submenu' => array(array('title' => tr('generla_stat'), 'menustring' => tr('general_stat'), 'visible' => true, 'filename' => 'viewprofile.php?userid=' . $user_id, 'newwindow' => false, 'siteid' => 'general_stat', 'icon' => 'images/actions/stat'), array('title' => tr('graph_find'), 'menustring' => tr('graph_find'), 'visible' => true, 'filename' => 'ustatsg2.php?userid=' . $user_id, 'newwindow' => false, 'siteid' => 'findstat', 'icon' => 'images/actions/stat')));
$content = "";
$rsGeneralStat = sql("SELECT hidden_count, founds_count, log_notes_count, notfounds_count, username FROM `user` WHERE user_id=&1 ", $user_id);
$user_record = sql_fetch_array($rsGeneralStat);
tpl_set_var('username', $user_record['username']);
if ($user_record['hidden_count'] == 0) {
$content .= '<p> </p><p> </p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1"> <img src="tpl/stdstyle/images/blue/cache.png" class="icon32" alt="Caches created" title="Caches created" /> ' . tr("graph_created") . '</p></div><br /><br /><p> <b>' . tr("there_is_no_caches_registered") . '</b></p>';
} else {
// calculate diif days between date of register on OC to current date
$rdd = sql("select TO_DAYS(NOW()) - TO_DAYS(`date_created`) `diff` from `user` WHERE user_id=&1 ", $user_id);
示例4: mysql_free_result
mysql_free_result($rs);
tpl_set_var('desclangs', $languages);
if ($show_all_langs == false) {
$show_all_langs_submit = ' <input type="submit" name="show_all_langs" value="' . tr('edDescShowAll') . '" />';
tpl_set_var('show_all_langs_submit', $show_all_langs_submit);
} else {
tpl_set_var('show_all_langs_submit', '');
}
tpl_set_var('show_all_langs_value', $show_all_langs == false ? 0 : 1);
tpl_set_var('short_desc', htmlspecialchars($short_desc, ENT_COMPAT, 'UTF-8'));
tpl_set_var('hints', $hints);
tpl_set_var('descid', $descid);
tpl_set_var('cacheid', htmlspecialchars($desc_record['cache_id'], ENT_COMPAT, 'UTF-8'));
tpl_set_var('desclang', htmlspecialchars($desc_lang, ENT_COMPAT, 'UTF-8'));
tpl_set_var('desclang_name', htmlspecialchars(db_LanguageFromShort($desc_lang), ENT_COMPAT, 'UTF-8'));
tpl_set_var('cachename', htmlspecialchars($desc_record['name'], ENT_COMPAT, 'UTF-8'));
// TinyMCE
$headers = tpl_get_var('htmlheaders') . "\n";
//$headers .= '<script language="javascript" type="text/javascript" src="lib/phpfuncs.js"></script>' . "\n";
tpl_set_var('htmlheaders', $headers);
} else {
tpl_redirect('');
}
} else {
tpl_errorMsg('editdesc', $error_desc_not_found);
}
}
}
//make the template and send it out
tpl_set_var('language4js', $lang);
tpl_BuildTemplate();
示例5: array
$options['username'] = '';
}
if ($options['username'] != '') {
$query = "SELECT user_id, username, date_created FROM user WHERE username LIKE :username ORDER BY username ASC";
$params = array("username" => array("value" => '%' . XDb::xEscape($options['username']) . '%', "data_type" => "string"));
$dbc = OcDb::instance();
$s = $dbc->paramQuery($query, $params);
$bgcolor1 = '#eeeeee';
$bgcolor2 = '#ffffff';
$line = '<tr bgcolor={bgcolor}><td><a href=viewprofile.php?userid={user_id}>{username}</a></td><td> </td><td nowrap style="text-align:center;">{date_created}</td><td nowrap style="text-align:center;"></td></tr>';
$lines = "";
$ilosc = $dbc->rowCount($s);
if ($ilosc != 0) {
if ($ilosc == 1) {
$record = $dbc->dbResultFetch($s);
tpl_redirect("viewprofile.php?userid=" . $record['user_id']);
} else {
$i = 0;
while ($record = $dbc->dbResultFetch($s)) {
$tmp_line = $line;
$tmp_line = mb_ereg_replace('{bgcolor}', $i % 2 == 0 ? $bgcolor1 : $bgcolor2, $tmp_line);
$tmp_line = mb_ereg_replace('{username}', htmlspecialchars($record['username'], ENT_COMPAT, 'UTF-8'), $tmp_line);
$tmp_line = mb_ereg_replace('{user_id}', htmlspecialchars($record['user_id'], ENT_COMPAT, 'UTF-8'), $tmp_line);
$tmp_line = mb_ereg_replace('{date_created}', htmlspecialchars(fixPlMonth(strftime($dateformat, strtotime($record['date_created']))), ENT_COMPAT, 'UTF-8'), $tmp_line);
$lines .= $tmp_line . "\n";
$i++;
}
tpl_set_var('lines', $lines);
tpl_set_var('username', '');
tpl_set_var('not_found', '');
}
示例6: handleUserLogged
function handleUserLogged()
{
// check if user logged in - $usr is set in common.inc.php
global $usr;
if ($usr == false) {
// user not logged - redirect to login page...
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target=' . $target);
exit;
}
}
示例7: iconv
$desc = iconv("ISO-8859-1", "UTF-8", $desc);
}
}
if (isset($_POST['submitform'])) {
// prüfen, ob sprache nicht schon vorhanden
$rs = sql("SELECT COUNT(*) `count` FROM `cache_desc` WHERE `cache_id`='&1' AND `id` != '&2' AND `language`='&3'", $desc_record['cache_id'], $descid, $desclang);
$r = sql_fetch_array($rs);
if ($r['count'] > 0) {
tpl_errorMsg('editdesc', $error_desc_exists);
}
mysql_free_result($rs);
sql("UPDATE `cache_desc` SET \r\n \t\t\t\t\t `desc_html`='&1',\r\n \t\t\t\t\t `desc_htmledit`='&2',\r\n\t\t\t\t\t\t\t `desc`='&3', \r\n\t\t\t\t\t\t\t `short_desc`='&4', \r\n\t\t\t\t\t\t\t `hint`='&5',\r\n\t\t\t\t\t\t\t `language`='&6'\r\n\t\t\t\t\t\t\t WHERE `id`='&7'", $desc_html == 1 ? '1' : '0', $desc_htmledit == 1 ? '1' : '0', $desc_html == 1 ? $desc : nl2br($desc), $short_desc, nl2br($hint), $desclang, $descid);
// do not use slave server for the next time ...
db_slave_exclude();
// redirect to cachepage
tpl_redirect('editcache.php?cacheid=' . urlencode($desc_record['cache_id']));
exit;
} else {
if (isset($_POST['show_all_langs'])) {
$show_all_langs = true;
}
}
} else {
//here we read all used information from the DB
$short_desc = strip_tags($desc_record['short_desc']);
$hint = strip_tags($desc_record['hint']);
$desc_htmledit = $desc_record['desc_htmledit'];
$desc_html = $desc_record['desc_html'];
$desc_lang = $desc_record['language'];
if ($desc_html == 1) {
$desc = $desc_record['desc'];
示例8: tpl_redirect
<?php
use Utils\Database\XDb;
require_once './lib/common.inc.php';
$no_tpl_build = false;
if ($usr == false || !isset($_FILES['userfile']) && !isset($_SESSION['log_cache_multi_data'])) {
tpl_redirect('log_cache_multi_send.php');
} else {
require_once $rootpath . 'lib/caches.inc.php';
require $stylepath . '/log_cache.inc.php';
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" media="screen,projection" href="tpl/stdstyle/css/style_screen.css" />
<link rel="stylesheet" type="text/css" media="print" href="tpl/stdstyle/css/style_print.css" />
<link rel="stylesheet" type="text/css" media="screen,projection" href="tpl/stdstyle/css/style_autumn.css" />
</head>
<body>
<style>
a:link {
color:inherit;
text-decoration: none;
}
a:visited {
color:inherit;
text-decoration: none;
}
a:hover {
color:inherit;
font-weight: bold;
示例9: IN
$query .= ' WHERE `caches`.`cache_id` IN (' . $queryFilter . ')';
/* ,AVG(`caches`.`longitude`) AS avglongitude, AVG(`caches`.`latitude`) AS avglatitude */
$sortby = $options['sort'];
if (isset($lat_rad) && isset($lon_rad) && $sortby == 'bydistance') {
$query .= ' ORDER BY distance ASC';
} else {
if ($sortby == 'bycreated') {
$query .= ' ORDER BY date_created DESC';
} else {
$query .= ' ORDER BY name ASC';
}
}
$rs = $dbcSearch->simpleQuery('SELECT MAX(`caches`.`longitude`) AS maxlongitude, MAX(`caches`.`latitude`) AS maxlatitude,
MIN(`caches`.`longitude`) AS minlongitude, MIN(`caches`.`latitude`) AS minlatitude
FROM `caches` WHERE `caches`.`cache_id` IN (' . $queryFilter . ')');
$r = $dbcSearch->dbResultFetchOneRowOnly($rs);
$minlat = $r['minlatitude'];
$minlon = $r['minlongitude'];
$maxlat = $r['maxlatitude'];
$maxlon = $r['maxlongitude'];
$stmt = $dbcSearch->simpleQuery($query);
$cnt = 0;
$hash = uniqid();
$f = fopen($dynbasepath . "searchdata/" . $hash, "w");
while ($r = $dbcSearch->dbResultFetch($stmt)) {
++$cnt;
fprintf($f, "%s\n", $r['cache_id']);
}
fclose($f);
tpl_redirect("cachemap3.php?searchdata=" . $hash . "&fromlat=" . $minlat . "&fromlon=" . $minlon . "&tolat=" . $maxlat . "&tolon=" . $maxlon);
示例10: isset
//load datas from form
$statpic_text = isset($_POST['statpic_text']) ? mb_substr($_POST['statpic_text'], 0, 30) : 'Opencaching';
$statpic_logo = isset($_POST['statpic_logo']) ? $_POST['statpic_logo'] + 0 : 0;
tpl_set_var('statpic_text', $statpic_text);
tpl_set_var('statpic_logo', $statpic_logo);
//validate data
$statpic_text_not_ok = mb_ereg_match(regex_statpic_text, $statpic_text) ? false : true;
//try to save
if (!$statpic_text_not_ok) {
//in DB updaten
sql("UPDATE `user` SET `statpic_text`='&1', `statpic_logo`='&2' WHERE `user_id`='&3'", $statpic_text, $statpic_logo, $usr['userid']);
//call eventhandler
require_once $rootpath . 'lib/eventhandler.inc.php';
event_change_statpic($usr['userid'] + 0);
//wieder normal anzeigen
tpl_redirect('myprofile.php');
} else {
tpl_set_var('statpic_text_message', $error_statpic_text);
}
} else {
//load from database
$statpic_text = $record['statpic_text'];
$stmp = '';
$rs2 = sql('SELECT `id`, `previewpath`, `description` FROM `statpics`');
while ($record2 = sql_fetch_array($rs2)) {
$logo_temp = '<tr><td class="content-title-noshade">{statpic_desc}</td><td><input type="radio" name="statpic_logo" class="radio" value={statpic_id}{statpic_selected}/><img src="{statpic_preview}" align=middle /></td></tr><tr><td class="spacer" colspan="2"></td></tr>';
$logo_temp = mb_ereg_replace('{statpic_id}', $record2['id'], $logo_temp);
if ($record2['id'] == $using_logo) {
$logo_temp = mb_ereg_replace('{statpic_selected}', ' checked="checked"', $logo_temp);
} else {
$logo_temp = mb_ereg_replace('{statpic_selected}', '', $logo_temp);
示例11: sql
// to the last edited record. While this may not always be what the user
// expects, it makes sense for two reasons:
// 1. It is a safeguard for the case that the log date and rating_date
// have gotten out of sync for some reason (which has happend in the
// past, probably due to a log-deletion related bug).
// 2. It can be used as a tweak to control which log's date is relevant
// for the rating, e.g. when logging a second found on a recycled or
// renewed cache [listing].
} else {
sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $log_record['cache_id']);
}
}
// do not use slave server for the next time ...
db_slave_exclude();
//display cache page
tpl_redirect('viewcache.php?cacheid=' . urlencode($log_record['cache_id']) . '&log=A#log' . urlencode($log_id));
exit;
}
// build logtype options
$disable_statuschange = $log_record['cache_user_id'] == $login->userid && !is_latest_log($log_record['cache_id'], $log_record['log_id']);
$logtype_names = get_logtype_names();
$allowed_logtypes = get_cache_log_types($log_record['cache_id'], $log_record['logtype'], !$disable_statuschange);
$logtypeoptions = '';
foreach ($allowed_logtypes as $logtype) {
$selected = $log_record['logtype'] == $logtype ? ' selected="selected"' : '';
$logtypeoptions .= '<option value="' . $logtype . '"' . $selected . '>';
$logtypeoptions .= htmlspecialchars($logtype_names[$logtype], ENT_COMPAT, 'UTF-8');
$logtypeoptions .= '</option>' . "\n";
}
$disable_typechange = $disable_statuschange && $log_record['is_status_log'];
tpl_set_var('type_edit_disabled', $disable_typechange ? $type_edit_disabled : '');
示例12: sql
}
}
/*
*/
sql("INSERT INTO pictures (`uuid`,\n `url`,\n `last_modified`,\n `title`,\n `description`,\n `desc_html`,\n `date_created`,\n `last_url_check`,\n `object_id`,\n `object_type`,\n `user_id`,\n `local`,\n `spoiler`,\n `display`,\n `node`\n ) VALUES ('&1', '&2', NOW(), '&3', '', 0, NOW(), NOW(),'&4', '&5', '&6', 1, '&7', '&8', '&9')", $uuid, $picurl . '/' . $uuid . '.' . $extension, $title, $objectid, $type, $usr['userid'], $bSpoiler == 1 ? '1' : '0', $bNoDisplay == 1 ? '0' : '1', $oc_nodeid);
switch ($type) {
// log
case 1:
sql("UPDATE `cache_logs` SET `picturescount`=`picturescount`+1 WHERE `id`='&1'", $objectid);
tpl_redirect('viewcache.php?cacheid=' . urlencode($cacheid));
break;
// cache
// cache
case 2:
sql("UPDATE `caches` SET `picturescount`=`picturescount`+1 WHERE `cache_id`='&1'", $objectid);
tpl_redirect('editcache.php?cacheid=' . urlencode($objectid));
break;
}
tpl_redirect_absolute($picurl . '/' . $uuid . '.' . $extension);
exit;
}
}
tpl_set_var('notdisplaychecked', $bNoDisplay == 1 ? ' checked="checked"' : '');
tpl_set_var('spoilerchecked', $bSpoiler == 1 ? ' checked="checked"' : '');
tpl_set_var('type', htmlspecialchars($type, ENT_COMPAT, 'UTF-8'));
tpl_set_var('objectid', htmlspecialchars($objectid, ENT_COMPAT, 'UTF-8'));
tpl_set_var('title', htmlspecialchars($title, ENT_COMPAT, 'UTF-8'));
tpl_set_var('maxpicsize', $maxpicsize);
tpl_set_var('submit', $submit);
tpl_set_var('errnotitledesc', '');
tpl_set_var('errnopicgivendesc', '');
示例13: unset
unset($record);
} else {
if ($count == 0) {
$tplname = 'searchplugin';
tpl_set_var('error_msg', mb_ereg_replace('{wp}', $searchfor, $errmsg_no_cache_found));
tpl_BuildTemplate();
exit;
} else {
if ($count > 1) {
$tplname = 'searchplugin';
tpl_set_var('error_msg', mb_ereg_replace('{wp}', $searchfor, $errmsg_many_caches_found));
tpl_BuildTemplate();
exit;
}
}
}
XDb::xFreeResults($rs);
unset($count);
} else {
// wrong waypoint format
$tplname = 'searchplugin';
tpl_set_var('error_msg', $errmsg_unknown_format);
tpl_BuildTemplate();
exit;
}
break;
}
}
}
tpl_redirect($targeturl);
示例14: session_start
//login ok
session_start();
$_SESSION['print_list'] = array();
$usr['userid'] = $retval;
$usr['username'] = auth_UsernameFromID($usr['userid']);
tpl_redirect('login.php?action=cookieverify&target=' . urlencode($target));
//echo 't='.$target;
exit;
}
} else {
if (isset($_REQUEST['target'])) {
//$message = $emptyform;
}
}
} else {
tpl_redirect('login.php?action=cookieverify&target=' . urlencode($target));
//logout before login
/* $tplname = 'message';
tpl_set_var('messagetitle', $message_logout_before_login_title);
$message = $message_logout_before_login; */
}
}
if ($message != '') {
tpl_set_var('message_start', $message_start);
tpl_set_var('message_end', $message_end);
tpl_set_var('message', $message);
} else {
tpl_set_var('message_start', '');
tpl_set_var('message_end', '');
tpl_set_var('message', '');
}
示例15: array
//we get the point data in to an array called $points:
if (!$error) {
for ($i = 0; $i < count($coords) - 1; $i = $i + 2) {
$points[] = array("lon" => $coords[$i], "lat" => $coords[$i + 1]);
if ($coords[$i] + 0 == 0 or $coords[$i + 1] + 0 == 0) {
$error .= "Invalid Co-ords found in import file.<br>\n";
break;
}
}
}
// add it to the route_points database:
$point_num = 0;
foreach ($points as $point) {
$point_num++;
$result = XDb::xSql('INSERT into route_points (route_id, point_nr, lat, lon)
VALUES ( ?, ?, ?, ?)', $route_id, $route_id, $point['lat'], $point['lon']);
}
}
//end update points
tpl_redirect('myroutes.php');
exit;
}
//end submit
tpl_set_var('name', htmlspecialchars($record['name'], ENT_COMPAT, 'UTF-8'));
tpl_set_var('desc', htmlspecialchars($record['description'], ENT_COMPAT, 'UTF-8'));
tpl_set_var('radius', $record['radius']);
tpl_set_var('routeid', $route_id);
}
}
//make the template and send it out
tpl_BuildTemplate();