/** * Assign content and render layout * * @param string $layout_path Path to the layout file * @param string $content Value that will be assigned to the $content_for_layout * variable * @return boolean * @throws FileDnxError */ function renderLayout($layout_path, $content = null) { tpl_assign('content_for_layout', $content); return tpl_display($layout_path); }
// 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');
// 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'); }
<?php include 'viewer.php'; $data = array('title' => 'hello world', 'h1text' => 'hello smarty'); if (rand(0, 9) < 5) { $data['debug'] = true; } tpl_display('page', $data);
/** * Contruct controller and execute specific action * * @access public * @param string $controller_name * @param string $action * @return null */ static function executeAction($controller_name, $action) { $max_users = config_option('max_users'); if ($max_users && Contacts::count() > $max_users) { echo lang("error").": ".lang("maximum number of users exceeded error"); return; } ajx_check_login(); Env::useController($controller_name); $controller_class = Env::getControllerClass($controller_name); if(!class_exists($controller_class, false)) { throw new ControllerDnxError($controller_name); } // if $controller = new $controller_class(); if(!instance_of($controller, 'Controller')) { throw new ControllerDnxError($controller_name); } // if if (is_ajax_request()) { // if request is an ajax request return a json response // execute the action $controller->setAutoRender(false); $controller->execute($action); // fill the response $response = AjaxResponse::instance(); if (!$response->hasCurrent()) { // set the current content $response->setCurrentContent("html", $controller->getContent(), page_actions(), ajx_get_panel()); } $response->setEvents(evt_pop()); $error = flash_pop('error'); $success = flash_pop('success'); if (!is_null($error)) { $response->setError(1, clean($error)); } else if (!is_null($success)) { $response->setError(0, clean($success)); } // display the object as json tpl_assign("object", $response); $content = tpl_fetch(Env::getTemplatePath("json")); tpl_assign("content_for_layout", $content); TimeIt::start("Transfer"); if (is_iframe_request()) { tpl_display(Env::getLayoutPath("iframe")); } else { tpl_display(Env::getLayoutPath("json")); } TimeIt::stop(); } else { return $controller->execute($action); } } // executeAction
localnet_or_die(); // multiuser permission check permission_or_die(PERM_WRITE, get_owner_id($id)); /* // remove old cover image from cache $SQL = 'SELECT imgurl FROM '.TBL_DATA.' WHERE id = '.$id; $res = runSQL($SQL); if (count($res)) { removeCacheFile($res[0]['imgurl']); } */ // remove actual data runSQL('DELETE FROM ' . TBL_DATA . ' WHERE id = ' . $id); runSQL('DELETE FROM ' . TBL_VIDEOGENRE . ' WHERE video_id = ' . $id); //2015-10-6 Alex ADD start runSQL('DELETE FROM ' . TBL_VIDEOSTUDIO . ' WHERE video_id = ' . $id); //2015-10-6 Alex ADD end // clear smarty cache for this item #!! this does not work- at least not with Smarty3 #$smarty->cache->clear($id); // goto index instead of delete template if ($redirect) { header("Location: index.php?deleteid={$id}"); exit; } // prepare templates tpl_page(); // display templates tpl_display('delete.tpl');
/** * Help Page * * Browses the manual * * @package videoDB * @author Andreas Gohr <*****@*****.**> * @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');
/** * Contruct controller and execute specific action * * @access public * @param string $controller_name * @param string $action * @return null */ static function executeAction($controller_name, $action) { $max_users = config_option('max_users'); if ($max_users && Users::count() > $max_users) { echo lang("error") . ": " . lang("maximum number of users exceeded error"); return; } ajx_check_login(); if (isset($_GET['active_project']) && logged_user() instanceof User) { $dont_update = false; if (GlobalCache::isAvailable()) { $option_value = GlobalCache::get('user_config_option_' . logged_user()->getId() . '_lastAccessedWorkspace', $success); if ($success) { $dont_update = $option_value == $_GET['active_project']; } } if (!$dont_update) { set_user_config_option('lastAccessedWorkspace', $_GET['active_project'], logged_user()->getId()); if (GlobalCache::isAvailable()) { GlobalCache::update('user_config_option_' . logged_user()->getId() . '_lastAccessedWorkspace', $_GET['active_project']); } } } Env::useController($controller_name); $controller_class = Env::getControllerClass($controller_name); if (!class_exists($controller_class, false)) { throw new ControllerDnxError($controller_name); } // if $controller = new $controller_class(); if (!instance_of($controller, 'Controller')) { throw new ControllerDnxError($controller_name); } // if if (is_ajax_request()) { // if request is an ajax request return a json response // execute the action $controller->setAutoRender(false); $controller->execute($action); // fill the response $response = AjaxResponse::instance(); if (!$response->hasCurrent()) { // set the current content $response->setCurrentContent("html", $controller->getContent(), page_actions(), ajx_get_panel()); } $response->setEvents(evt_pop()); $error = flash_pop('error'); $success = flash_pop('success'); if (!is_null($error)) { $response->setError(1, clean($error)); } else { if (!is_null($success)) { $response->setError(0, clean($success)); } } // display the object as json tpl_assign("object", $response); $content = tpl_fetch(Env::getTemplatePath("json")); tpl_assign("content_for_layout", $content); TimeIt::start("Transfer"); if (is_iframe_request()) { tpl_display(Env::getLayoutPath("iframe")); } else { tpl_display(Env::getLayoutPath("json")); } TimeIt::stop(); } else { return $controller->execute($action); } }
/** * Execute specific step * * @access public * @param integer $step_number * @return null */ function executeStep($step_number) { $step = $this->getStep($step_number); if (!$step instanceof ScriptInstallerStep) { die("Step '{$step_number}' does not exist in the installation process"); } // if tpl_assign('installer', $this); tpl_assign('current_step', $step); tpl_assign('installation_name', $this->getInstallationName()); tpl_assign('installation_description', $this->getInstallationDescription()); $execution_result = $step->execute(); // If execute() returns true redirect to next step (if exists) if ($execution_result) { $this->addExecutedStep($step_number); $next_step = $step->getNextStep(); if ($next_step instanceof ScriptInstallerStep) { $this->goToStep($next_step->getStepNumber()); } // if } else { tpl_display(get_template_path('layout.php')); } // if }
/** * Assign content and render layout * * @param string $layout_path Path to the layout file * @param string $content Value that will be assigned to the $content_for_layout * variable * @return boolean * @throws FileDnxError */ function renderLayout($layout_path, $content = null, $die = false) { tpl_assign('content_for_layout', $content); $display = tpl_display($layout_path); if ($die) { die; } // if return $display; }
<?php trace(__FILE__, 'begin'); $login_show_options = config_option('login_show_options', false); if ($login_show_options) { tpl_display(get_template_path('login1', 'access')); } else { tpl_display(get_template_path('login2', 'access')); } trace(__FILE__, 'end');
* 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');
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');
// build html select box $all = $lang['filter_any']; $smarty->assign('owners', out_owners(array($all => $all), PERM_READ)); $smarty->assign('owner', $owner); // if we don't have read all permissions, limit visibility using cross-user permissions if (!check_permission(PERM_READ)) { $JOINS = ' LEFT JOIN ' . TBL_PERMISSIONS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_PERMISSIONS . '.to_uid'; $WHERES .= ' AND ' . TBL_PERMISSIONS . '.from_uid = ' . get_current_user_id() . ' AND ' . TBL_PERMISSIONS . '.permissions & ' . PERM_READ . ' != 0'; } // further limit to single owner if ($owner != $all) { $WHERES .= " AND " . TBL_USERS . ".name = '" . addslashes($owner) . "'"; } } // overview on lent disks $SQL = "SELECT who, DATE_FORMAT(dt,'%d.%m.%Y') as dt, " . TBL_LENT . ".diskid,\n CASE WHEN subtitle = '' THEN title ELSE CONCAT(title,' - ',subtitle) END AS title,\n " . TBL_DATA . ".id, COUNT(" . TBL_LENT . ".diskid) AS count, " . TBL_USERS . ".name AS owner\n FROM " . TBL_LENT . ", " . TBL_DATA . "\n LEFT JOIN " . TBL_USERS . " ON owner_id = " . TBL_USERS . ".id\n {$JOINS}\n WHERE " . TBL_LENT . ".diskid = " . TBL_DATA . ".diskid \n {$WHERES}\n GROUP BY " . TBL_LENT . ".diskid\n ORDER BY who, " . TBL_LENT . ".diskid"; $result = runSQL($SQL); // check permissions for ($i = 0; $i < count($result); $i++) { $result[$i]['editable'] = check_permission(PERM_WRITE, get_userid($result[$i]['owner'])); } // prepare templates tpl_page(); $smarty->assign('diskid', $diskid); $smarty->assign('who', $who); $smarty->assign('dt', $dt); $smarty->assign('editable', $editable); $smarty->assign('borrowlist', $result); // display templates tpl_display('borrow.tpl');
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() . ' WHERE ' . TBL_DATA . '.id = ' . $id; $video = runSQL($SELECT); // diskid to global scope: $diskid = $video[0]['diskid']; } else { $video[0]['language'] = $config['langdefault']; } // assign automatic disk id if ($config['autoid'] && (empty($diskid) || $add_flag) && $mediatype != MEDIA_WISHLIST) { $video[0]['diskid'] = getDiskId(); // Fix for Bugreport [1122052] Automatic DiskID generation problem $smarty->assign('autoid', $result[0]['max']); } if (empty($video[0]['owner_id']) && !empty($owner_id)) { $video[0]['owner_id'] = $owner_id; } // prepare templates tpl_page(); tpl_edit($video[0]); $smarty->assign('lookup_id', $lookup); $smarty->assign('http_error', $CLIENTERROR); // allow XML import if ($config['xml'] && empty($id)) { $smarty->assign('xmlimport', true); } // display templates tpl_display('edit.tpl');
if ($filename == 'index.php') { continue; } $info = array('contrib/' . $filename); $file = $dirpath . '/' . $filename; $content = file_get_contents($file); // title if (preg_match('/<TITLE.*?>(.+?)</msi', $content, $title)) { $info[1] = $title[1]; } else { $info[1] = preg_replace('/\\.php$/', '', $filename); } // access if (preg_match('/^.*?\\*[\\t ]+@meta[\\t ]+ACCESS:(.*?)\\n/i', $content, $access)) { $info[2] = trim($access[1]); } // add to list of access rights are valid if (empty($info[2]) || check_permission($info[2])) { $files[] = $info; } } closedir($dh); } // sort by title $files = multidimsort($files, 1); // prepare templates tpl_page(); $smarty->assign('files', $files); // display templates tpl_display('contrib.tpl');
<div class="mail-account-item dataBlock" id="<?php echo $genid; ?> sync_folders" style="padding:5px;<?php ?> "> <div id="<?php echo $genid; ?> imap_folders_sync"><?php tpl_assign('imap_folders_sync', isset($imap_folders_sync) ? $imap_folders_sync : array()); tpl_assign('genid', $genid); tpl_assign('mail_acc_id', $mail_acc_id); tpl_display(get_template_path("fetch_imap_folders_sync", "mail")); ?> </div> </div> </div> <?php } ?> <?php } ?>
/** * Checks whether the user is logged in and if not returns an error response. * */ function ajx_check_login() { if (is_ajax_request() && !logged_user() instanceof Contact && (array_var($_GET, 'c') != 'access' || array_var($_GET, 'a') != 'relogin')) { // error, user not logged in => return error message $response = AjaxResponse::instance(); $response->setCurrentContent("empty"); $response->setError(SESSION_EXPIRED_ERROR_CODE, lang("session expired error")); // display the object as json tpl_assign("object", $response); $content = tpl_fetch(Env::getTemplatePath("json")); tpl_assign("content_for_layout", $content); tpl_display(Env::getLayoutPath("json")); exit(); } }
function core_dimensions_quickadd_extra_fields($dimId) { if ($dimId == Dimensions::findByCode("feng_persons")->getId()) { tpl_display(PLUGIN_PATH . "/core_dimensions/templates/quickadd_extra_fields.php"); } }
?> </label> <input id="first_name" style="width: 292px;" type="text" class="add-person-field"/> </div> <div class="field email"> <label><?php echo lang('email'); ?> </label> <input id="email" style="width: 292px;" type="email" name="contact[email]"/> </div> <div class="clear"></div> <div id="company"> <?php tpl_display(get_template_path("add_contact/access_data_company", "contact")); ?> </div> <button class="add-person-button add-first-btn"> <img src="public/assets/themes/default/images/16x16/add.png"> <?php echo lang('add'); ?> </button> <a href='#' style="float: right;" class='internalLink ContactFormShowAll' ><b><?php echo lang('View and edit all details'); ?> </b></a>
define('ROOT', dirname(__FILE__) . '/../..'); define('PRODUCT_NAME', 'Feng Office'); define('PRODUCT_URL', 'http://www.fengoffice.com'); require_once dirname(__FILE__) . '/include.php'; $upgrader = new ScriptUpgrader(new Output_Html(), lang('upgrade fengoffice'), lang('upgrade your fengoffice installation')); $form_data = array_var($_POST, 'form_data'); $upgrade_to = array_var($_GET, 'upgrade_to'); if (!is_array($form_data) && isset($upgrade_to)) { $form_data = array( 'upgrade_from' => installed_version(), 'upgrade_to' => $upgrade_to ); } tpl_assign('upgrader', $upgrader); tpl_assign('form_data', $form_data); if(is_array($form_data)) { ob_start(); $upgrader->upgrade(trim(array_var($form_data, 'upgrade_from')), trim(array_var($form_data, 'upgrade_to'))); $status_messages = explode("\n", trim(ob_get_clean())); tpl_assign('status_messages', $status_messages); } // if tpl_display(get_template_path('layout')); ?>
$stats['count_acodec'] = $result; // year statistics $result = runSQL('SELECT year, COUNT(*) AS count FROM ' . TBL_DATA . ' WHERE year > 0' . $WHERES . ' GROUP BY year ORDER BY year'); $minyear = $result[0]['year']; $maxyear = $result[count($result) - 1]['year']; for ($i = $minyear; $i <= $maxyear; $i++) { $years[$i] = 0; } $maxcount = 0; if (is_array($result)) { foreach ($result as $year) { $years[$year['year']] = $year['count']; if ($year['count'] > $maxcount) { $maxcount = $year['count']; } } } $stats['count_year'] = $years; $stats['first_year'] = $minyear; $stats['last_year'] = $maxyear; $stats['max_count'] = $maxcount; // prepare templates tpl_page(); $smarty->assign('stats', $stats); // display templates tpl_display('stats.tpl');
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');
function core_dimensions_quickadd_extra_fields($parameters) { if (array_var($parameters, 'dimension_id') == Dimensions::findByCode("feng_persons")->getId()) { tpl_display(PLUGIN_PATH."/core_dimensions/templates/quickadd_extra_fields.php"); } }
} else { ?> <a class="logo" href="http://www.fengoffice.com"></a> <?php } ?> </div> </div> <div class="login-body"> <form class="internalForm" action="<?php echo get_url('access', 'forgot_password'); ?> " method="post"> <?php tpl_display(get_template_path('form_errors')); ?> <div class="form-container"> <?php if (!isset($_GET['instructions_sent']) || !$_GET['instructions_sent']) { ?> <div class="input"> <?php echo label_tag(lang('email address'), 'forgotPasswordEmail'); ?> <?php echo text_field('your_email', $your_email, array('class' => 'long', 'id' => 'forgotPasswordEmail')); ?> </div> <input type="hidden" name="submited" value="submited" />
$perm['write'] = 0; } else { // update $newperm = PERM_READ * getStateOfCheckbox('readflag_'.$perm['to_uid']) + PERM_WRITE * getStateOfCheckbox('writeflag_'.$perm['to_uid']); $UPDATE = "UPDATE ".TBL_PERMISSIONS." SET permissions=".$newperm." WHERE from_uid=".$from_uid." AND to_uid=".$perm['to_uid']; runSQL($UPDATE); $perm['read'] = getStateOfCheckbox('readflag_'.$perm['to_uid']); $perm['write'] = getStateOfCheckbox('writeflag_'.$perm['to_uid']); } } */ } // clear permission cache clear_permission_cache(); } $permlist[] = $perm; } } // prepare templates tpl_page(); $smarty->assign('permlist', $permlist); //$smarty->assign('from_name', $permlist[0]['from_name']); $smarty->assign('from_uid', $permlist[0]['from_uid']); $smarty->assign('owners', out_owners(false, false, true)); $smarty->assign('message', $message); // display templates tpl_display('permissions.tpl');