本文整理汇总了PHP中tpl_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_redirect函数的具体用法?PHP tpl_redirect怎么用?PHP tpl_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_redirect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:viewcache.php
示例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();
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:27,代码来源:addignore.php
示例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);
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:ustatsg1.php
示例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();
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:editdesc.php
示例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', '');
}
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:31,代码来源:searchuser.php
示例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;
}
}
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:11,代码来源:cachemap3_common.php
示例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'];
开发者ID:RH-Code,项目名称:opencaching,代码行数:31,代码来源:editdesc.php
示例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;
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:31,代码来源:log_cache_multi_panel.php
示例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);
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:30,代码来源:search.map.inc.php
示例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);
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:change_statpic.php
示例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 : '');
开发者ID:kratenko,项目名称:oc-server3,代码行数:31,代码来源:editlog.php
示例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', '');
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:newpic-gps.php
示例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);
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:30,代码来源:searchplugin.php
示例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', '');
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:login.php
示例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();
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:31,代码来源:myroutes_edit.php
示例16: outputXmlFile
//.........这里部分代码省略.........
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
if ($ocxmlversion >= 14) {
fwrite($f, $t2 . '<log_lastmodified>' . date($sDateformat, strtotime($r['log_last_modified'])) . '</log_lastmodified>' . "\n");
}
if ($bLicense) {
$lang = $sLanguage != "" ? $sLanguage : $r['language'];
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $lang, false, true);
fwrite($f, $t2 . '<license>' . xmlcdata($disclaimer) . '</license>' . "\n");
}
fwrite($f, $t1 . '</cachelog>' . "\n");
}
mysql_free_result($rs);
$rs = sql('SELECT SQL_BUFFER_RESULT `pictures`.`id` `id`, `pictures`.`url` `url`, `pictures`.`title` `title`,
`pictures`.`object_id` `object_id`, `pictures`.`object_type` `object_type`,
`pictures`.`date_created` `date_created`, `pictures`.`uuid` `uuid`,
`pictures`.`last_modified` `last_modified`, `pictures`.`display` `display`,
`pictures`.`spoiler` `spoiler`, `pictures`.`node` `node`,
`pictures`.`mappreview`,
IFNULL(`c1`.`cache_id`,`c2`.`cache_id`) AS `cache_id`,
IFNULL(`c1`.`country`,`c2`.`country`) AS `language`, /* hack */
IFNULL(`cs1`.`allow_user_view`, `cs2`.`allow_user_view`) AS `auv`,
IFNULL(`u1`.`user_id`,`u2`.`user_id`) AS `user_id`,
IFNULL(`u1`.`username`,`u2`.`username`) AS `username`,
IFNULL(`u1`.`data_license`,`u2`.`data_license`) AS `data_license`
FROM `tmpxml_pictures`
INNER JOIN `pictures` ON `tmpxml_pictures`.`id`=`pictures`.`id`
LEFT JOIN `caches` AS `c1` ON `pictures`.`object_type`=2 AND `pictures`.`object_id`=`c1`.`cache_id`
LEFT JOIN `cache_logs` ON `pictures`.`object_type`=1 AND `pictures`.`object_id`=`cache_logs`.`id`
LEFT JOIN `caches` AS `c2` ON `cache_logs`.`cache_id`=`c2`.`cache_id`
LEFT JOIN `cache_status` AS `cs1` ON `c1`.`status`=`cs1`.`id`
LEFT JOIN `cache_status` AS `cs2` ON `c2`.`status`=`cs2`.`id`
LEFT JOIN `user` `u1` ON `u1`.`user_id`=`cache_logs`.`user_id`
LEFT JOIN `user` `u2` ON `u2`.`user_id`=`c1`.`user_id`');
while ($r = sql_fetch_array($rs)) {
$bAllowView = $r['auv'] == 1;
fwrite($f, $t1 . '<picture>' . "\n");
fwrite($f, $t2 . '<id id="' . $r['id'] . '" node="' . $r['node'] . '">' . $r['uuid'] . '</id>' . "\n");
fwrite($f, $t2 . '<url>' . xmlcdata($bAllowView ? $r['url'] : '') . '</url>' . "\n");
fwrite($f, $t2 . '<title>' . xmlcdata($bAllowView ? $r['title'] : '') . '</title>' . "\n");
fwrite($f, $t2 . '<object id="' . $r['object_id'] . '" type="' . $r['object_type'] . '" typename="' . xmlentities($objecttypes[$r['object_type']]) . '">' . object_id2uuid($r['object_id'], $r['object_type']) . '</object>' . "\n");
if ($ocxmlversion >= 13) {
fwrite($f, $t2 . '<picattr spoiler="' . $r['spoiler'] . '" display="' . $r['display'] . '" preview="' . $r['mappreview'] . '" />' . "\n");
} else {
fwrite($f, $t2 . '<attributes spoiler="' . $r['spoiler'] . '" display="' . $r['display'] . '" />' . "\n");
}
fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
if ($bLicense) {
$lang = $sLanguage != "" ? $sLanguage : $r['language'];
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $lang, false, true);
fwrite($f, $t2 . '<license>' . xmlcdata($disclaimer) . '</license>' . "\n");
}
fwrite($f, $t1 . '</picture>' . "\n");
}
mysql_free_result($rs);
$rs = sql('SELECT SQL_BUFFER_RESULT `removed_objects`.`id` `id`, `removed_objects`.`localid` `localid`, `removed_objects`.`uuid` `uuid`,
`removed_objects`.`type` `type`, `removed_objects`.`removed_date` `removed_date`, `removed_objects`.`node` `node`
FROM `tmpxml_removedobjects`, `removed_objects` WHERE `removed_objects`.`id`=`tmpxml_removedobjects`.`id`');
while ($r = sql_fetch_array($rs)) {
fwrite($f, $t1 . '<removedobject>' . "\n");
fwrite($f, $t2 . '<id id="' . $r['id'] . '" node="' . $r['node'] . '" />' . "\n");
fwrite($f, $t2 . '<object id="' . $r['localid'] . '" type="' . $r['type'] . '" typename="' . xmlentities($objecttypes[$r['type']]) . '">' . $r['uuid'] . '</object>' . "\n");
fwrite($f, $t2 . '<removeddate>' . date($sDateformat, strtotime($r['removed_date'])) . '</removeddate>' . "\n");
fwrite($f, $t1 . '</removedobject>' . "\n");
}
mysql_free_result($rs);
if ($bOcXmlTag == '1') {
fwrite($f, '</oc11xml>' . "\n");
}
fclose($f);
$rel_xmlfile = 'ocxml11/' . $sessionid . '/' . $sessionid . '-' . $filenr . '-' . $fileid . '.xml';
$rel_zipfile = 'ocxml11/' . $sessionid . '/' . $sessionid . '-' . $filenr . '-' . $fileid;
// zippen und url-redirect
if ($ziptype == '0') {
tpl_redirect($zip_wwwdir . $rel_xmlfile);
exit;
} else {
if ($ziptype == 'zip') {
$rel_zipfile .= '.zip';
} else {
if ($ziptype == 'bzip2') {
$rel_zipfile .= '.bz2';
} else {
if ($ziptype == 'gzip') {
$rel_zipfile .= '.gz';
} else {
die('unknown zip type');
}
}
}
}
$call = $safemode_zip . ' --type=' . escapeshellcmd($ziptype) . ' --src=' . escapeshellcmd($rel_xmlfile) . ' --dst=' . escapeshellcmd($rel_zipfile);
system($call);
// datei vorhanden?
if (!file_exists($zip_basedir . $rel_zipfile)) {
die('all ok, but zip failed - internal server error');
}
tpl_redirect($zip_wwwdir . $rel_zipfile);
exit;
}
开发者ID:4Vs,项目名称:oc-server3,代码行数:101,代码来源:ocxml11.php
示例17: savequery
function savequery($queryid, $queryname, $saveas, $submit, $saveas_queryid)
{
global $usr, $tplname;
global $error_empty_name, $nosaveastext, $saveastext, $error_queryname_exists;
$displayform = $submit == false;
$error_no_name = false;
$error_duplicate_name = false;
// ok ... checken, ob die query uns gehört und dann speichern
$rs = sql("SELECT `user_id` FROM `queries` WHERE `id`='&1' AND (`user_id`=0 OR `user_id`='&2')", $queryid, $usr['userid']);
if (mysql_num_rows($rs) == 0) {
echo 'fatal error: query not found or permission denied';
exit;
}
mysql_free_result($rs);
if ($saveas == false) {
if ($displayform == false && $queryname == '') {
$displayform = true;
$error_no_name = true;
} else {
// prüfen ob name bereits vorhanden
$rs = sql("SELECT COUNT(*) `c` FROM `queries` WHERE `user_id`='&1' AND `name`='&2'", $usr['userid'], $queryname);
$r = sql_fetch_array($rs);
mysql_free_result($rs);
if ($r['c'] > 0) {
$displayform = true;
$error_duplicate_name = true;
}
}
} else {
if ($saveas_queryid == 0) {
$displayform = true;
} else {
// prüfen ob saveas_queryid existiert und uns gehört
$rs = sql("SELECT `user_id` FROM `queries` WHERE `id`='&1' AND (`user_id`=0 OR `user_id`='&2')", $saveas_queryid, $usr['userid']);
if (mysql_num_rows($rs) == 0) {
echo 'fatal error: saveas_query not found or permission denied';
exit;
}
mysql_free_result($rs);
}
}
if ($displayform == true) {
// abfrageform für name
$tplname = 'savequery';
if ($error_no_name == true) {
tpl_set_var('nameerror', $error_empty_name);
} else {
if ($error_duplicate_name == true) {
tpl_set_var('nameerror', $error_queryname_exists);
} else {
tpl_set_var('nameerror', '');
}
}
tpl_set_var('queryname', htmlspecialchars($queryname, ENT_COMPAT, 'UTF-8'));
tpl_set_var('queryid', htmlspecialchars($queryid, ENT_COMPAT, 'UTF-8'));
// oldqueries auslesen
$options = '';
$rs = sql("SELECT `id`, `name` FROM `queries` WHERE `user_id`='&1' ORDER BY `name` ASC", $usr['userid']);
if (mysql_num_rows($rs) == 0) {
tpl_set_var('selecttext', $nosaveastext);
tpl_set_var('oldqueries', '');
} else {
tpl_set_var('selecttext', $saveastext);
while ($r = sql_fetch_array($rs)) {
if ($r['id'] == $queryid) {
$options .= '<option value="' . $r['id'] . '" selected="selected">' . htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
} else {
$options .= '<option value="' . $r['id'] . '">' . htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
}
}
mysql_free_result($rs);
tpl_set_var('oldqueries', $options);
}
tpl_BuildTemplate();
exit;
}
$rs = sql("SELECT `options` FROM `queries` WHERE `id`='&1'", $queryid);
$r = sql_fetch_array($rs);
mysql_free_result($rs);
// ok, speichern
if ($saveas == true) {
sql("UPDATE `queries` SET `options`='&1', `last_queried`=NOW() WHERE `id`='&2'", $r['options'], $saveas_queryid);
} else {
sql("INSERT INTO `queries` (`user_id`, `last_queried`, `name`, `uuid`, `options`) VALUES ( '&1', NOW(), '&2', '&3', '&4')", $usr['userid'], $queryname, create_uuid(), $r['options']);
}
tpl_redirect('query.php?action=view');
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:87,代码来源:query.php
示例18: intval
$log_id = intval($_REQUEST['logid']);
}
//user logged in?
if ($usr == false) {
tpl_redirect('login.php');
} else {
if (!isset($_REQUEST["logid"]) or !isset($_REQUEST["target"]) or !isset($_REQUEST["cacheid"]) or !isset($_REQUEST["posY"])) {
tpl_redirect("index.php");
} else {
$nLogId = $_REQUEST["logid"];
$sTarget = $_REQUEST["target"];
$sCacheId = $_REQUEST["cacheid"];
$nPosY = $_REQUEST["posY"];
$query = "SELECT 1 FROM log_rating WHERE log_id =:1 and user_id=:2";
$dbc = new dataBase();
$dbc->multiVariableQuery($query, $nLogId, $usr["userid"]);
if ($dbc->rowCount() == 0) {
//add
$cDT = new DateTime();
$currDate = $cDT->format('Y-m-d H:m:s');
$query = "INSERT INTO log_rating (log_id, user_id, date) VALUES( :1, :2, :3 )";
$dbc->multiVariableQuery($query, $nLogId, $usr["userid"], $currDate);
} else {
$query = "DELETE FROM log_rating WHERE log_id =:1 and user_id=:2";
$dbc->multiVariableQuery($query, $nLogId, $usr["userid"]);
}
}
}
$sTarget .= "?cacheid=" . $sCacheId . "&posY=" . $nPosY;
tpl_redirect($sTarget);
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:changelograting.php
示例19: mb_ereg_replace
}
if ($text <= "") {
$message_errnotext = $errnotext;
$allOk = false;
}
if ($allOk) {
$subject = mb_ereg_replace('{subject}', $subject, $mailsubject);
$subject = mb_ereg_replace('{from_username}', $
|
请发表评论