本文整理汇总了PHP中tpl_BuildTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_BuildTemplate函数的具体用法?PHP tpl_BuildTemplate怎么用?PHP tpl_BuildTemplate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_BuildTemplate函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sql
sql("INSERT INTO `removed_objects` (`localID`, `uuid`, `type`, `removed_date`, `node`) VALUES ('&1', '&2', 6, NOW(), '&3')", $localid, $uuid, $oc_nodeid);
switch ($type) {
// log
case 1:
sql("UPDATE `cache_logs` SET `mp3count`=`mp3count`-1 WHERE `id`='&1'", $objectid);
$rs = sql("SELECT `cache_id` FROM `cache_logs` WHERE `deleted`=0 AND `id`='&1'", $objectid);
$r = sql_fetch_array($rs);
mysql_free_result($rs);
tpl_redirect('viewlogs.php?cacheid=' . urlencode($r['cache_id']));
break;
// cache
// cache
case 2:
sql("UPDATE `caches` SET `mp3count`=`mp3count`-1 WHERE `cache_id`='&1'", $objectid);
tpl_redirect('editcache.php?cacheid=' . urlencode($objectid));
break;
}
tpl_redirect('index.php');
exit;
} else {
$tplname = 'message';
tpl_set_var('messagetitle', $message_title_internal);
tpl_set_var('message_start', '');
tpl_set_var('message_end', '');
tpl_set_var('message', $message_internal);
}
}
}
//make the template and send it out
tpl_BuildTemplate();
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:30,代码来源:removemp3.php
示例2: tpl_errorMsg
function tpl_errorMsg($tplnameError, $msg)
{
global $tplname;
$tplname = 'error';
tpl_set_var('error_msg', $msg);
tpl_set_var('tplname', $tplnameError);
tpl_BuildTemplate();
exit;
}
开发者ID:kirstenko,项目名称:oc-server3,代码行数:9,代码来源:common.inc.php
示例3: endzik
public function endzik()
{
tpl_BuildTemplate();
exit;
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:5,代码来源:opensprawdzacz_classes.php
示例4: tr
$pattern = "<span style='font-size:13px'><img src='{cacheIcon}' class='icon16' alt='Cache' title='Cache' />\n <a href='viewcache.php?cacheid={cacheId}'><b>{cacheName}</b></a></span> \n \n <span style='font-size:11px'> " . tr('hidden_by') . "</span>\n <span style='font-size:13px'><a href='viewprofile.php?userid={userId}'><b>{userName}</b></a></span><br>\n \n <span style='font-size:11px;font-style:italic'>{cacheShortDesc}</span><br>\n \n <span class='content-title-noshade' style='font-size:11px'>{country} > {region}</span>\n <br><br> \n <table class='CacheTitledLog' >\n <tr><td>{logText}\n <br><br><img src='images/rating-star.png'/> Autor: <a href='viewprofile.php?userid={logUserId}'><b>{logUserName}<b></a></td></tr>\n </table>";
for ($i = 0; $i < $dbc->rowCount(); $i++) {
$rec = $dbc->dbResultFetch();
$line = $pattern;
$line = mb_ereg_replace('{cacheIcon}', myninc::checkCacheStatusByUser($rec, $usrid), $line);
$line = mb_ereg_replace('{dateAlg}', $rec["date_alg"], $line);
$line = mb_ereg_replace('{cacheName}', $rec["cacheName"], $line);
$line = mb_ereg_replace('{userId}', $rec["user_id"], $line);
$line = mb_ereg_replace('{userName}', $rec["userName"], $line);
$line = mb_ereg_replace('{cacheId}', $rec["cache_id"], $line);
$line = mb_ereg_replace('{country}', $rec["cacheCountry"], $line);
$line = mb_ereg_replace('{region}', $rec["cacheRegion"], $line);
$line = mb_ereg_replace('{cacheShortDesc}', $rec["short_desc"], $line);
$line = mb_ereg_replace('{logUserId}', $rec["logUserId"], $line);
$line = mb_ereg_replace('{logUserName}', $rec["logUserName"], $line);
$text = mb_ereg_replace('<p>', '', $rec["text"]);
$text = mb_ereg_replace('</p>', '<br>', $text);
$line = mb_ereg_replace('{logText}', $text, $line);
$TitledCaches .= $line;
}
$is_titled = $dbc->rowCount() ? '1' : '0';
if ($is_titled == '0') {
$TitledCaches = '';
}
tpl_set_var('TitledCaches', $TitledCaches);
tpl_set_var('is_titled', $is_titled);
unset($dbc);
//make the template and send it out
tpl_BuildTemplate(false);
//not neccessary, call tpl_BuildTemplate with true as argument and the db will be closed there
db_disconnect();
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:index.php
示例5: outputLocidSelectionForm
function outputLocidSelectionForm($locSql, $urlparams)
{
global $tplname, $locline, $stylepath, $bgcolor1, $bgcolor2;
require_once $stylepath . '/selectlocid.inc.php';
unset($urlparams['queryid']);
unset($urlparams['locid']);
$urlparams['searchto'] = 'search' . $urlparams['searchtype'];
unset($urlparams['searchtype']);
$tplname = 'selectlocid';
// urlparams zusammenbauen
$urlparamString = '';
foreach ($urlparams as $name => $param) {
// workaround for attribs
if (is_array($param)) {
$pnew = '';
foreach ($param as $p) {
if ($pnew != '') {
$pnew .= ';' . $p;
} else {
$pnew .= $p;
}
}
$param = $pnew;
}
if ($urlparamString != '') {
$urlparamString .= '&' . $name . '=' . urlencode($param);
} else {
$urlparamString = $name . '=' . urlencode($param);
}
}
$urlparamString .= '&locid={locid}';
sql('CREATE TEMPORARY TABLE `locids` ENGINE=MEMORY ' . $locSql);
sql('ALTER TABLE `locids` ADD PRIMARY KEY (`loc_id`)');
$rs = sql('SELECT `geodb_textdata`.`loc_id` `loc_id`, `geodb_textdata`.`text_val` `text_val` FROM `geodb_textdata`, `locids` WHERE `locids`.`loc_id`=`geodb_textdata`.`loc_id` AND `geodb_textdata`.`text_type`=500100000 ORDER BY `text_val`');
$nr = 1;
$locations = '';
while ($r = sql_fetch_array($rs)) {
$thislocation = $locline;
// locationsdings zusammenbauen
$locString = '';
$land = landFromLocid($r['loc_id']);
if ($land != '') {
$locString .= htmlspecialchars($land, ENT_COMPAT, 'UTF-8');
}
$rb = regierungsbezirkFromLocid($r['loc_id']);
if ($rb != '') {
$locString .= ' > ' . htmlspecialchars($rb, ENT_COMPAT, 'UTF-8');
}
$lk = landkreisFromLocid($r['loc_id']);
if ($lk != '') {
$locString .= ' > ' . htmlspecialchars($lk, ENT_COMPAT, 'UTF-8');
}
$thislocation = mb_ereg_replace('{parentlocations}', $locString, $thislocation);
// koordinaten ermitteln
$r['loc_id'] = $r['loc_id'] + 0;
$rsCoords = sql('SELECT `lon`, `lat` FROM `geodb_coordinates` WHERE loc_id=' . $r['loc_id'] . ' LIMIT 1');
if ($rCoords = sql_fetch_array($rsCoords)) {
$coordString = help_latToDegreeStr($rCoords['lat']) . ' ' . help_lonToDegreeStr($rCoords['lon']);
} else {
$coordString = '[keine Koordinaten vorhanden]';
}
$thislocation = mb_ereg_replace('{coords}', htmlspecialchars($coordString, ENT_COMPAT, 'UTF-8'), $thislocation);
$thislocation = mb_ereg_replace('{locationname}', htmlspecialchars($r['text_val'], ENT_COMPAT, 'UTF-8'), $thislocation);
$thislocation = mb_ereg_replace('{urlparams}', $urlparamString, $thislocation);
$thislocation = mb_ereg_replace('{locid}', urlencode($r['loc_id']), $thislocation);
$thislocation = mb_ereg_replace('{nr}', $nr, $thislocation);
$thislocation = mb_ereg_replace('{secondlocationname}', '', $thislocation);
if ($nr % 2) {
$thislocation = mb_ereg_replace('{bgcolor}', $bgcolor1, $thislocation);
} else {
$thislocation = mb_ereg_replace('{bgcolor}', $bgcolor2, $thislocation);
}
$nr++;
$locations .= $thislocation . "\n";
}
tpl_set_var('locations', $locations);
tpl_set_var('resultscount', mysql_num_rows($rs));
tpl_set_var('pages', $first_img_inactive . ' ' . $prev_img_inactive . ' 1 ' . $next_img_inactive . ' ' . $last_img_inactive);
tpl_BuildTemplate();
exit;
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:81,代码来源:search.php
示例6: 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
示例7: htmlFormat
/**
* Call OKAPI, parse response and display the results
* @param array $params - params of the cache to search and display
*/
private function htmlFormat(array $params)
{
//call OKAPI
$okapi_resp = \okapi\Facade::service_call('services/caches/shortcuts/search_and_retrieve', $this->user_id, $params);
if (!is_a($okapi_resp, "ArrayObject")) {
// strange OKAPI return !?
error_log(__METHOD__ . ": ERROR: strange OKAPI response - not an ArrayObject");
exit(0);
}
\okapi\OkapiErrorHandler::disable();
if ($okapi_resp->count() == 0) {
// no caches found
exit(0);
}
// get the first object from the list
$arrayCopy = $okapi_resp->getArrayCopy();
$geoCache = new \lib\Objects\GeoCache\GeoCache(array('okapiRow' => array_pop($arrayCopy)));
//generate the results
if ($this->screenWidth < 400) {
tpl_set_tplname('map/map_cacheinfo_small');
} else {
tpl_set_tplname('map/map_cacheinfo');
}
tpl_set_var('cache_lat', $geoCache->getCoordinates()->getLatitude());
tpl_set_var('cache_lon', $geoCache->getCoordinates()->getLongitude());
tpl_set_var('cache_name', $geoCache->getCacheName());
tpl_set_var('cache_icon', $geoCache->getCacheIcon());
$is_event = $geoCache->getCacheType() == $geoCache::TYPE_EVENT ? '1' : '0';
// be aware: booleans not working here
tpl_set_var('is_event', $is_event, false);
$is_scored = $geoCache->getRatingId() != 0 && $geoCache->getRatingVotes() > 2 ? '1' : '0';
tpl_set_var('is_scored', $is_scored, false);
tpl_set_var('rating_desc', tr($geoCache->getRatingDesc()));
$is_recommended = $geoCache->getRecommendations() > 0 ? '1' : '0';
tpl_set_var('is_recommended', $is_recommended, false);
tpl_set_var('cache_recommendations', $geoCache->getRecommendations(), false);
tpl_set_var('cache_code', $geoCache->getWaypointId());
tpl_set_var('cache_founds', $geoCache->getFounds());
tpl_set_var('cache_not_founds', $geoCache->getNotFounds());
tpl_set_var('cache_rating_votes', $geoCache->getRatingVotes());
tpl_set_var('cache_willattends', $geoCache->getWillattends());
tpl_set_var('cache_url', $geoCache->getCacheUrl());
tpl_set_var('user_name', $geoCache->getOwner()->getUserName());
tpl_set_var('user_profile', $geoCache->getOwner()->getProfileUrl());
tpl_set_var('cache_size_desc', tr($geoCache->getSizeDesc()));
$is_powertrail_part = $geoCache->isPowerTrailPart() ? '1' : '0';
tpl_set_var('is_powertrail_part', $is_powertrail_part, false);
if ($geoCache->isPowerTrailPart()) {
tpl_set_var('pt_name', $geoCache->getPowerTrail()->getName());
tpl_set_var('pt_image', $geoCache->getPowerTrail()->getImage());
tpl_set_var('pt_icon', $geoCache->getPowerTrail()->getFootIcon());
tpl_set_var('pt_url', $geoCache->getPowerTrail()->getPowerTrailUrl());
}
$is_titled = $geoCache->isTitled() ? 'true' : 'false';
tpl_set_var('is_titled', $is_titled, false);
//tpl_set_var('is_titled', $geoCache->isTitled(), false);
// make the template and send it out
tpl_BuildTemplate(false, false, true);
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:63,代码来源:xmlmap.php
示例8: handleUserLogged
*
* visualization of the search results:
* @param searchdata + ... -
*
*/
require_once './lib/common.inc.php';
require_once './lib/cachemap3_common.php';
//check if user logged in
handleUserLogged();
$tplname = 'cachemap-full';
// locate user for which map is displayed
$mapForUserObj = getMapUserObj();
tpl_set_var('userid', $mapForUserObj->getUserId());
// parse cords and zoom setings
parseCordsAndZoom($mapForUserObj);
// parse eventually printList changes
parsePrintList();
//parse PowerTrail filter in url
parsePowerTrailFilter(true);
//read from DB map settings and apply to the map
$filter = getDBFilter($usr['userid']);
//logged user or preview user?
setFilterSettings($filter);
//handle search-data - visualization of search results
parseSearchData();
tpl_set_var('username', $mapForUserObj->getUserName());
//actually not used in map-full now...
setTheRestOfCommonVars();
//...and lest run template in fullscrean mode...
tpl_BuildTemplate(true, true);
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:30,代码来源:cachemap-full.php
示例9: removelog
//.........这里部分代码省略.........
if ($old_xy['longitude'] != '' && $old_xy['latitude'] != '') {
sql("UPDATE `caches` SET `last_modified`=NOW(), `longitude`='&1', `latitude`='&2' WHERE `cache_id`='&3'", $old_xy['longitude'], $old_xy['latitude'], $log_record['cache_id']);
}
} else {
sql("DELETE FROM `cache_moved` WHERE `log_id`='&1' LIMIT 1", $log_id);
}
} else {
sql("DELETE FROM `cache_moved` WHERE `log_id`='&1' LIMIT 1", $log_id);
}
}
}
if ($log_record['log_type'] == 1 || $log_record['log_type'] == 7) {
// remove cache from users top caches, because the found log was deleted for some reason
sql("DELETE FROM `cache_rating` WHERE `user_id` = '&1' AND `cache_id` = '&2'", $log_record['log_user_id'], $log_record['cache_id']);
// Notify OKAPI's replicate module of the change.
// Details: https://github.com/opencaching/okapi/issues/265
require_once $rootpath . 'okapi/facade.php';
\okapi\Facade::schedule_user_entries_check($log_record['cache_id'], $log_record['log_user_id']);
\okapi\Facade::disable_error_handling();
// recalc scores for this cache
sql("DELETE FROM `scores` WHERE `user_id` = '&1' AND `cache_id` = '&2'", $log_record['log_user_id'], $log_record['cache_id']);
$sql = "SELECT count(*) FROM scores WHERE cache_id='" . sql_escape($log_record['cache_id']) . "'";
$liczba = mysql_result(mysql_query($sql), 0);
$sql = "SELECT SUM(score) FROM scores WHERE cache_id='" . sql_escape($log_record['cache_id']) . "'";
$suma = @mysql_result(@mysql_query($sql), 0) + 0;
// obliczenie nowej sredniej
if ($liczba != 0) {
$srednia = $suma / $liczba;
} else {
$srednia = 0;
}
$sql = "UPDATE caches SET votes='" . sql_escape($liczba) . "', score='" . sql_escape($srednia) . "' WHERE cache_id='" . sql_escape($log_record['cache_id']) . "'";
mysql_query($sql);
}
//call eventhandler
require_once $rootpath . 'lib/eventhandler.inc.php';
event_remove_log($cacheid, $usr['userid'] + 0);
//update cache-stat if type or log_date changed
$cache_rs = sql("SELECT `founds`, `notfounds`, `notes` FROM `caches` WHERE `cache_id`='&1'", $log_record['cache_id']);
$cache_record = sql_fetch_array($cache_rs);
mysql_free_result($cache_rs);
if ($log_record['log_type'] == 1 || $log_record['log_type'] == 7) {
$cache_record['founds']--;
} elseif ($log_record['log_type'] == 2 || $log_record['log_type'] == 8) {
$cache_record['notfounds']--;
} elseif ($log_record['log_type'] == 3) {
$cache_record['notes']--;
}
//Update last found
$last_tmp = $log_record['cache_id'];
$lastfound_rs = sql("SELECT MAX(`cache_logs`.`date`) AS `date` FROM `cache_logs` WHERE ((cache_logs.`type`=1) AND (cache_logs.`cache_id`='{$last_tmp}'))");
$lastfound_record = sql_fetch_array($lastfound_rs);
if ($lastfound_record['date'] === NULL) {
$lastfound = 'NULL';
} else {
$lastfound = $lastfound_record['date'];
}
sql("UPDATE `caches` SET `last_found`='&1', `founds`='&2', `notfounds`='&3', `notes`='&4' WHERE `cache_id`='&5'", $lastfound, $cache_record['founds'], $cache_record['notfounds'], $cache_record['notes'], $log_record['cache_id']);
unset($cache_record);
if (!isset($_POST['userid'])) {
//cache anzeigen
$_GET['cacheid'] = $log_record['cache_id'];
$_REQUEST['cacheid'] = $log_record['cache_id'];
require 'viewcache.php';
}
} else {
tpl_set_var('cachename', htmlspecialchars($log_record['cache_name'], ENT_COMPAT, 'UTF-8'));
tpl_set_var('cacheid', htmlspecialchars($log_record['cache_id'], ENT_COMPAT, 'UTF-8'));
tpl_set_var('logid_urlencode', htmlspecialchars(urlencode($log_id), ENT_COMPAT, 'UTF-8'));
tpl_set_var('logid', htmlspecialchars($log_id, ENT_COMPAT, 'UTF-8'));
$log = read_file($stylepath . '/viewcache_log.tpl.php');
$log = mb_ereg_replace('{date}', htmlspecialchars(strftime("%d %B %Y", strtotime($log_record['log_date'])), ENT_COMPAT, 'UTF-8'), $log);
if (isset($log_record['recommended']) && $log_record['recommended'] == 1) {
$log = mb_ereg_replace('{ratingimage}', $rating_picture, $log);
} else {
$log = mb_ereg_replace('{ratingimage}', '', $log);
}
$log = mb_ereg_replace('{username}', htmlspecialchars($log_record['log_username'], ENT_COMPAT, 'UTF-8'), $log);
$log = mb_ereg_replace('{userid}', htmlspecialchars($log_record['log_user_id'] + 0, ENT_COMPAT, 'UTF-8'), $log);
tpl_set_var('log_user_name', htmlspecialchars($log_record['log_username'], ENT_COMPAT, 'UTF-8'));
$log = mb_ereg_replace('{type}', htmlspecialchars($log_record['text_listing'], ENT_COMPAT, 'UTF-8'), $log);
$log = mb_ereg_replace('{logimage}', icon_log_type($log_record['icon_small'], ""), $log);
$log = mb_ereg_replace('{logfunctions}', '', $log);
$log = mb_ereg_replace('{logpictures}', '', $log);
$log = mb_ereg_replace('{logtext}', $log_record['log_text'], $log);
$log = mb_ereg_replace('{username_aktywnosc}', '', $log);
$log = mb_ereg_replace('{kordy_mobilniaka}', '', $log);
tpl_set_var('log', $log);
//make the template and send it out
tpl_BuildTemplate();
}
} else {
//TODO: hm ... no permission to remove the log
d('no permission to remove the log');
}
} else {
//TODO: log doesn't exist
d('log doesn\'t exist');
}
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:101,代码来源:removelog.php
注:本文中的tpl_BuildTemplate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论