本文整理汇总了PHP中tpl_page函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_page函数的具体用法?PHP tpl_page怎么用?PHP tpl_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_page函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore
function restore()
{
global $config, $lang;
if (!isset($_POST['file'])) {
$_POST['file'] = $_GET['file'];
}
@set_error_handler("SXD_errorHandler", E_ALL ^ E_NOTICE);
$buttons = "";
echo tpl_page(tpl_process($lang['dumper_18']), $buttons);
$this->SET['last_action'] = 1;
$this->SET['last_db_restore'] = DBNAMES;
$file = isset($_POST['file']) ? $_POST['file'] : '';
$file = str_replace("\\", "/", $file);
$file = str_replace("..", "", $file);
$file = str_replace("/", "", $file);
if (stripos($file, "php") !== false) {
die("Hacking attempt!");
}
$db = $this->SET['last_db_restore'];
if (!$db) {
echo tpl_l($lang['dumper_19'], C_ERROR);
exit;
}
echo tpl_l("{$lang['dumper_20']} `{$db}`.");
mysql_select_db($db) or trigger_error($lang['dumper_4'] . mysql_error(), E_USER_ERROR);
// Определение формата файла
if (preg_match("/^(.+?)\\.sql(\\.(bz2|gz))?\$/", $file, $matches)) {
if (isset($matches[3]) && $matches[3] == 'bz2') {
$this->SET['comp_method'] = 2;
} elseif (isset($matches[2]) && $matches[3] == 'gz') {
$this->SET['comp_method'] = 1;
} else {
$this->SET['comp_method'] = 0;
}
$this->SET['comp_level'] = '';
if (!file_exists(PATH . "/{$file}")) {
echo tpl_l($lang['dumper_21'], C_ERROR);
exit;
}
echo tpl_l("{$lang['dumper_22']} `{$file}`.");
$file = $matches[1];
} else {
echo tpl_l($lang['dumper_21'], C_ERROR);
exit;
}
echo tpl_l(str_repeat("-", 60));
$fp = $this->fn_open($file, "r");
$this->file_cache = $sql = $table = $insert = '';
$is_skd = $query_len = $execute = $q = $t = $i = $aff_rows = 0;
$limit = 300;
$index = 4;
$tabs = 0;
$cache = '';
$info = array();
$convert = false;
// Установка кодировки соединения
if ($this->mysql_version > 40101 && (CHARSET != 'auto' || $this->forced_charset)) {
// Кодировка по умолчанию, если в дампе не указана кодировка
mysql_query("SET NAMES '" . $this->restore_charset . "'") or trigger_error($lang['dumper_6'] . mysql_error(), E_USER_ERROR);
echo tpl_l("{$lang['dumper_7']} `" . $this->restore_charset . "`.", C_WARNING);
$last_charset = $this->restore_charset;
} else {
$last_charset = '';
}
$last_showed = '';
while (($str = $this->fn_read_str($fp)) !== false) {
if (empty($str) || preg_match("/^(#|--)/", $str)) {
if (!$is_skd && preg_match("/^#SKD101\\|/", $str)) {
$info = explode("|", $str);
echo tpl_s(0, $t / $info[4]);
$is_skd = 1;
}
continue;
}
$query_len += strlen($str);
if (!$insert && preg_match("/^(INSERT INTO `?([^` ]+)`? .*?VALUES)(.*)\$/i", $str, $m)) {
if ($table != $m[2]) {
$table = $m[2];
$tabs++;
$cache .= tpl_l("Таблица `{$table}`.");
$last_showed = $table;
$i = 0;
if ($is_skd) {
echo tpl_s(100, $t / $info[4]);
}
}
$insert = $m[1] . ' ';
$sql .= $m[3];
$index++;
$info[$index] = isset($info[$index]) ? $info[$index] : 0;
$limit = round($info[$index] / 20);
$limit = $limit < 300 ? 300 : $limit;
if ($info[$index] > $limit) {
echo $cache;
$cache = '';
echo tpl_s(0 / $info[$index], $t / $info[4]);
}
} else {
$sql .= $str;
if ($insert) {
//.........这里部分代码省略.........
示例2: main
function main()
{
$this->comp_levels = array('9' => 'Level 9 (Cao nhất)', '8' => 'Level 8', '7' => 'Level 7', '6' => 'Level 6', '5' => 'Level 5 (Trung bình)', '4' => 'Level 4', '3' => 'Level 3', '2' => 'Level 2', '1' => 'Level 1 (Bình thường)', '0' => 'Không tối ưu hóa ');
if (function_exists("bzopen")) {
$this->comp_methods[2] = 'BZip2';
}
if (function_exists("gzopen")) {
$this->comp_methods[1] = 'GZip';
}
$this->comp_methods[0] = 'No compression';
if (count($this->comp_methods) == 1) {
$this->comp_levels = array('0' => 'No compression');
}
$dbs = $this->db_select();
$this->vars['db_backup'] = $this->fn_select($dbs, $this->SET['last_db_backup']);
$this->vars['db_restore'] = $this->fn_select($dbs, $this->SET['last_db_restore']);
$this->vars['comp_levels'] = $this->fn_select($this->comp_levels, $this->SET['comp_level']);
$this->vars['comp_methods'] = $this->fn_select($this->comp_methods, $this->SET['comp_method']);
$this->vars['tables'] = $this->SET['tables'];
$this->vars['files'] = $this->fn_select($this->file_select(), '');
$buttons = "<INPUT TYPE=submit VALUE=Okie><INPUT TYPE=button VALUE='Thoát' onClick=\"location.href = '" . $_SERVER['PHP_SELF'] . "?reload'\">";
echo tpl_page(tpl_main(), $buttons);
}
示例3: runSQL
// clear permissions
runSQL('DELETE FROM ' . TBL_PERMISSIONS . ' WHERE from_uid = ' . $del);
$message = $lang['msg_userdel'];
$smarty->assign('alert', true);
}
// current user permissions
$result = runSQL('SELECT id, name, permissions, email
FROM ' . TBL_USERS . '
ORDER BY name');
foreach ($result as $user) {
// is guest ?
$user['guest'] = $user['id'] == $config['guestid'] ? 1 : 0;
// don't show guest user if guest is disabled
if ($config['denyguest'] && $user['guest']) {
continue;
}
// collect and separate permission information
$user['read'] = $user['permissions'] & PERM_READ;
$user['write'] = $user['permissions'] & PERM_WRITE;
$user['admin'] = $user['permissions'] & PERM_ADMIN;
$user['adult'] = $user['permissions'] & PERM_ADULT;
$userlist[] = $user;
}
// make sure caches are clean
clear_permission_cache();
// prepare templates
tpl_page('usermanager');
$smarty->assign('userlist', $userlist);
$smarty->assign('message', $message);
// display templates
tpl_display('users.tpl');
示例4: _replace_anchors_callback
/**
* Help Page
*
* Browses the manual
*
* @package videoDB
* @author Andreas Gohr <a.gohr@web.de>
* @version $Id: help.php,v 1.10 2004/09/20 15:15:41 andig2 Exp $
*/
require_once './core/functions.php';
function _replace_anchors_callback($matches)
{
if (!preg_match('=^https?://=', $matches[2])) {
$matches[2] = 'help.php?page=' . $matches[2];
}
return $matches[1] . $matches[2] . $matches[3];
}
if (empty($page)) {
$page = 'index.html';
}
$page = 'doc/manual/' . $page;
$html = file_get_contents($page);
$html = preg_replace_callback("/(<a\\s+.*?href\\s*=\\s*\")(.*?)(\".*?>)/is", '_replace_anchors_callback', $html);
preg_match('=<body.*?>(.*)</body>=is', $html, $matches);
$html = $matches[1];
// prepare templates
tpl_page();
$smarty->assign('helptext', $html);
// display templates
tpl_display('help.tpl');
示例5: main
function main()
{
$this->comp_levels = array('9' => '9 (максимальная)', '8' => '8', '7' => '7', '6' => '6', '5' => '5 (средняя)', '4' => '4', '3' => '3', '2' => '2', '1' => '1 (минимальная)', '0' => 'Без сжатия');
if (function_exists("bzopen")) {
$this->comp_methods[2] = 'BZip2';
}
if (function_exists("gzopen")) {
$this->comp_methods[1] = 'GZip';
}
$this->comp_methods[0] = 'Без сжатия';
if (count($this->comp_methods) == 1) {
$this->comp_levels = array('0' => 'Без сжатия');
}
$dbs = $this->db_select();
$this->vars['db_backup'] = $this->fn_select($dbs, $this->SET['last_db_backup']);
$this->vars['db_restore'] = $this->fn_select($dbs, $this->SET['last_db_restore']);
$this->vars['comp_levels'] = $this->fn_select($this->comp_levels, $this->SET['comp_level']);
$this->vars['comp_methods'] = $this->fn_select($this->comp_methods, $this->SET['comp_method']);
$this->vars['tables'] = $this->SET['tables'];
$this->vars['files'] = $this->fn_select($this->file_select(), '');
$buttons = "<INPUT TYPE=submit VALUE=Применить><INPUT TYPE=button VALUE=Выход onClick=\"location.href = 'dumper.php?reload'\">";
echo tpl_page(tpl_main(), $buttons);
}
示例6: main
function main()
{
$this->comp_levels = array('9' => '9 (Maximum)', '8' => '8', '7' => '7', '6' => '6', '5' => '5 (Medium)', '4' => '4', '3' => '3', '2' => '2', '1' => '1 (Minimum)', '0' => 'No compression ');
if (function_exists("bzopen")) {
$this->comp_methods[2] = 'BZip2';
}
if (function_exists("gzopen")) {
$this->comp_methods[1] = 'GZip';
}
$this->comp_methods[0] = 'No compression';
if (count($this->comp_methods) == 1) {
$this->comp_levels = array('0' => 'No compression');
}
$dbs = $this->db_select();
$this->vars['db_backup'] = $this->fn_select($dbs, $this->SET['last_db_backup']);
$this->vars['db_restore'] = $this->fn_select($dbs, $this->SET['last_db_restore']);
$this->vars['comp_levels'] = $this->fn_select($this->comp_levels, $this->SET['comp_level']);
$this->vars['comp_methods'] = $this->fn_select($this->comp_methods, $this->SET['comp_method']);
$this->vars['tables'] = $this->SET['tables'];
$this->vars['files'] = $this->fn_select($this->file_select(), '');
$buttons = "<INPUT TYPE=submit VALUE=Apply><INPUT TYPE=button VALUE='Cancel' onClick=\"location.href = '" . $_SERVER['PHP_SELF'] . "?reload'\">";
echo tpl_page(tpl_main(), $buttons);
}
示例7: preg_replace
$title = preg_replace('/(' . $q . ')/Ui', '<em>\\1</em>', $title);
$ret .= "<li id='" . $item['id'] . "'>" . $title . "</li>";
}
$ret = "<ul>{$ret}</ul>";
echo $ret;
exit;
}
// store query result in session for prev/next navigation
session_set('query_result', array_extract($result, 'id'));
}
// process asynchronous refresh
if ($ajax_render) {
ajax_render();
}
// prepare templates
tpl_page('search', $q);
tpl_list($result);
$smarty->assign('q', $q);
$smarty->assign('q_q', formvar($q));
$smarty->assign('search_fields', $search_fields);
$smarty->assign('genreselect', out_genres($genres));
$smarty->assign('genres', out_genres2($genres));
//2015-10-6 Alex ADD start
$smarty->assign('studioselect', out_studios($studios));
$smarty->assign('studios', out_studios2($studios));
//2015-10-6 Alex ADD end
$smarty->assign('engine', $config['engine']);
$smarty->assign('actors', prepare_cast($actors));
// person search?
if ($isname && $config['actorpics']) {
$smarty->assign('imgurl', getActorThumbnail(urldecode(preg_replace('/"|"/', '', formvar($q)))));
示例8: get_current_user_id
created, !ISNULL(' . TBL_USERSEEN . '.video_id) AS seen,
' . TBL_MEDIATYPES . '.name AS mediatypename
FROM ' . TBL_DATA . '
LEFT JOIN ' . TBL_USERS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_USERS . '.id
LEFT JOIN ' . TBL_USERSEEN . ' ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . '
LEFT JOIN ' . TBL_LENT . ' ON ' . TBL_DATA . '.diskid = ' . TBL_LENT . '.diskid
LEFT JOIN ' . TBL_MEDIATYPES . ' ON ' . TBL_DATA . '.mediatype = ' . TBL_MEDIATYPES . '.id' . "\n {$JOINS} \n WHERE {$WHERES}\n ORDER BY {$ORDER}\n\t\t {$LIMIT}";
$result = runSQL($SQL);
// store query result in session for prev/next navigation
session_set('query_result', array_extract($result, 'id'));
// process asynchronous refresh
if ($ajax_render) {
ajax_render();
}
// prepare
tpl_page('browse');
tpl_list($result);
tpl_filters($filter, $showtv);
// caching enabled?
if ($config['http_caching']) {
require_once './core/httpcache.php';
httpCacheCaptureStart();
}
$smarty->assign('moreless', true);
// show more/less control in list view
// allow data export
foreach (array('xls', 'pdf', 'xml', 'rss') as $export) {
if ($config[$export]) {
$smarty->assign($export, 'index.php?');
}
}
示例9: runSQL
// Check that user entered stuff in username and password boxes
if (!empty($username) && !empty($password)) {
// Lets check the format of username to make sure its ok
if (!preg_match('/[a-z]/i', $username)) {
$error = $lang['msg_invalidchar'];
} else {
$res = runSQL("SELECT passwd, id FROM " . TBL_USERS . " WHERE name='{$username}'");
// if the md5 of the entered password = whats in the database then
// set all the cookies up again
if (md5($password) == $res[0]['passwd']) {
$userid = $res[0]['id'];
login_as($userid, $permanent);
$login = true;
} else {
$error = $lang['msg_loginfailed'];
}
}
}
if ($login) {
if (empty($refer)) {
$refer = 'index.php';
}
redirect(urldecode($refer));
} else {
// prepare templates
tpl_page('multiuser');
$smarty->assign('error', $error);
$smarty->assign('refer', $refer);
// display templates
tpl_display('login.tpl');
}
示例10: request
* iframe modes
* 0: "classic" mode - no use of iframes
* 1: "iframe" mode
* used to display template containing iframe
* 2: "iframe" mode
* used to display iframe contents
*/
if ($iframe == 1) {
// mode 1: display template with url
$url = request(true);
} else {
// mode 0 or 2: fetch data for display
// fetch URL
$fetchtime = time();
$page = request();
$fetchtime = time() - $fetchtime;
// convert HTML for output
$page = fixup_HTML($page);
}
if ($iframe == 2) {
// mode 2: display data into iframe
echo $page;
exit;
}
// mode 0 or 1: prepare templates
tpl_page('imdbbrowser');
$smarty->assign('url', $url);
$smarty->assign('page', $page);
$smarty->assign('fetchtime', $fetchtime);
// display templates
tpl_display('trace.tpl');
示例11: array_slice
if (sizeof($breadcrumbs['crumbs']) > 10) {
$breadcrumbs['crumbs'] = array_slice($breadcrumbs['crumbs'], 0, -10);
}
$breadcrumbs['current'] = $id;
$breadcrumbs['crumbs'][] = array('id' => $id, 'title' => $video['title']);
$size = sizeof($breadcrumbs['crumbs']);
for ($i; $i < $size - 1; $i++) {
if ($breadcrumbs['crumbs'][$i]['id'] == $id) {
unset($breadcrumbs['crumbs'][$size - 1]);
break;
}
}
session_set('breadcrumbs', $breadcrumbs);
}
// prepare templates
tpl_page('detailview', $video['title']);
if (!empty($id)) {
tpl_show($video);
}
// caching enabled?
if ($config['http_caching']) {
require_once './core/httpcache.php';
httpCacheCaptureStart();
}
// display templates
smarty_display('header.tpl');
if (!$config['http_caching']) {
flush();
}
if (!empty($id)) {
smarty_display('show.tpl', $id);
示例12: redirect
// set default engine to imdb if not set
if (empty($config['enginedefault'])) {
$config['enginedefault'] = 'imdb';
}
// check permissions again - they may have changed
if (!check_permission(PERM_ADMIN)) {
redirect('login.php');
}
// destroy cookies if required
if ($_COOKIE['VDBusername'] && !$config['multiuser']) {
setcookie('VDBpassword', '', time() - 7200);
setcookie('VDBusername', '', time() - 7200);
setcookie('VDBuserid', '', time() - 7200);
}
// cache maintenance
if ($cacheempty) {
// clear thumbnail cache
runSQL('DELETE FROM ' . TBL_CACHE);
// clean HTTP cache
cache_prune_folders(CACHE . '/' . CACHE_HTML . '/', 0, true, false, '*', (int) $config['hierarchical']);
// clean Smarty as well
$smarty->clearAllCache();
}
// prepare options
$setup = setup_mkOptions(false);
// prepare templates
tpl_page('configview');
$smarty->assign('setup', $setup);
$smarty->assign('cacheclear', $cacheempty);
// display templates
tpl_display('setup.tpl');
示例13: get_current_user_id
$user_id = get_current_user_id();
// really shouldn't happen
if (empty($user_id)) {
errorpage('Access denied', 'You don\'t have enough permissions to access this ' . 'page. Please <a href="login.php">login</a> first. ' . '(This feature is not available in Single User Mode)');
}
// save data
if ($save) {
// convert languages array back into string
$languageflags = @join('::', $languages);
// insert data
foreach ($SETUP_USER as $opt) {
$SQL = "REPLACE INTO " . TBL_USERCONFIG . " (user_id, opt, value) \n VALUES ('" . addslashes($user_id) . "', '{$opt}', '" . addslashes(${$opt}) . "')";
runSQL($SQL);
}
// update session variables
update_session();
// reload config
load_config(true);
/*
// clear compiled templates for new template
AG: should not be required
$smarty->clear_compiled_tpl(null, $config['cacheid']);
*/
}
// prepare options
$setup = setup_mkOptions(true);
// prepare templates
tpl_page('profile');
$smarty->assign('setup', $setup);
// display templates
tpl_display('profile.tpl');
示例14: main
function main()
{
$this->comp_levels = array('9' => TEXT_DUMPER_MAX, '8' => '8', '7' => '7', '6' => '6', '5' => TEXT_DUMPER_MED, '4' => '4', '3' => '3', '2' => '2', '1' => TEXT_DUMPER_MIN, '0' => TEXT_DUMPER_NO);
// if (function_exists("bzopen")) {
// $this->comp_methods[2] = 'BZip2';
// }
if (function_exists("gzopen")) {
$this->comp_methods[1] = 'GZip';
}
$this->comp_methods[0] = TEXT_DUMPER_NO;
if (count($this->comp_methods) == 1) {
$this->comp_levels = array('0' => TEXT_DUMPER_NO);
}
$dbs = $this->db_select();
$this->vars['db_backup'] = $this->fn_select($dbs, $this->SET['last_db_backup']);
$this->vars['db_restore'] = $this->fn_select($dbs, $this->SET['last_db_restore']);
$this->vars['comp_levels'] = $this->fn_select($this->comp_levels, $this->SET['comp_level']);
$this->vars['comp_methods'] = $this->fn_select($this->comp_methods, $this->SET['comp_method']);
$this->vars['tables'] = $this->SET['tables'];
$this->vars['files'] = $this->fn_select($this->file_select(), '');
$buttons = "<span class=button><button type=submit value=" . TEXT_DUMPER_SUBMIT . ">" . TEXT_DUMPER_SUBMIT . "</button></span>";
echo tpl_page(tpl_main(), $buttons);
}