Example #1
0
 public function Render()
 {
     include_once 'libs/smartylibs/Smarty.class.php';
     $smarty = new Smarty();
     $smarty->template_dir = 'components/templates';
     $smarty->assign_by_ref('Page', $this);
     $users = $this->tableBasedGrantsManager->GetAllUsersAsJson();
     $smarty->assign_by_ref('Users', $users);
     $localizerCaptions = $this->GetLocalizerCaptions();
     $smarty->assign_by_ref('Captions', $localizerCaptions);
     /* $roles = $this->tableBasedGrantsManager->GetAllRolesAsJson();
        $smarty->assign_by_ref('Roles', $roles); */
     $headerString = 'Content-Type: text/html';
     if ($this->GetContentEncoding() != null) {
         StringUtils::AddStr($headerString, 'charset=' . $this->GetContentEncoding(), ';');
     }
     header($headerString);
     $pageInfos = GetPageInfos();
     $pageListViewData = array('Pages' => array(), 'CurrentPageOptions' => array());
     foreach ($pageInfos as $pageInfo) {
         $pageListViewData['Pages'][] = array('Caption' => $this->RenderText($pageInfo['caption']), 'Hint' => $this->RenderText($pageInfo['short_caption']), 'Href' => $pageInfo['filename'], 'GroupName' => $this->RenderText($pageInfo['group_name']), 'BeginNewGroup' => $pageInfo['add_separator']);
     }
     $pageGroups = GetPageGroups();
     foreach ($pageGroups as &$pageGroup) {
         $pageGroup = $this->RenderText($pageGroup);
     }
     $pageListViewData['Groups'] = $pageGroups;
     $smarty->assign_by_ref('PageList', $pageListViewData);
     $authenticationViewData = $this->GetAuthenticationViewData();
     $smarty->assign_by_ref('Authentication', $authenticationViewData);
     $smarty->display('admin_panel.tpl');
 }
Example #2
0
 /**
  * fetch a template, echos the result,
  *
  * @see Zend_View_Abstract::render()
  * @param string $name the template
  * @return void
  */
 protected function _run()
 {
     $this->strictVars(true);
     //assign variables to the template engine
     $vars = get_object_vars($this);
     foreach ($vars as $key => $value) {
         if ('_' != substr($key, 0, 1)) {
             $this->_smarty->assign($key, $value);
         }
     }
     //why 'this'?
     //to emulate standard zend view functionality
     //doesn't mess up smarty in any way
     $this->_smarty->assign_by_ref('this', $this);
     //smarty needs a template_dir, and can only use templates,
     //found in that directory, so we have to strip it from the
     // filename
     //This checks the default application/smarty/template directory
     // as well as the module views/scripts directory to find the
     // template
     $paths = $this->getScriptPaths();
     $arg = func_get_arg(0);
     foreach ($paths as $path) {
         if (0 === strpos($arg, $path)) {
             if ($file = substr($arg, strlen($path))) {
                 $this->_smarty->template_dir = $path;
                 break;
             }
         }
     }
     //process the template (and filter the output)
     echo $this->_smarty->fetch($file);
 }
Example #3
0
 /**
  * sfSmarty::renderFile()
  * render template file using Smarty
  *
  * @param sfSmartyView $view
  * @param mixed $file
  * @return 
  * @access protected
  **/
 public function renderFile($view, $file)
 {
     $sf_context = sfContext::getInstance();
     $sf_request = $sf_context->getRequest();
     $sf_params = $sf_request->getParameterHolder();
     $sf_user = $sf_context->getUser();
     if ($view->getAttribute('sf_type') == 'layout') {
         self::$smarty->compile_id = $view->getDecoratorTemplate();
     } else {
         self::$smarty->compile_id = $view->getModuleName();
     }
     $this->loadCoreAndStandardHelpers();
     $_escaping = $view->getAttributeHolder()->getEscaping();
     if ($_escaping === true || $_escaping == 'on') {
         $sf_data = $this->getSfData($view, $view->getAttributeHolder()->getEscapingMethod());
     } elseif ($_escaping === false || $_escaping == 'off') {
         $sf_data = $this->getSfData($view);
         $data =& $view->getAttributeHolder()->getAll();
         foreach ($data as $key => &$value) {
             self::$smarty->assign_by_ref($key, $value);
         }
     }
     // we need to add the data to smarty
     self::$smarty->assign_by_ref('sf_data', $sf_data);
     // we need to add the context to smarty
     self::$smarty->assign_by_ref('sf_context', $sf_context);
     // we need to add the request to smarty
     self::$smarty->assign_by_ref('sf_request', $sf_request);
     // we need to add the params to smarty
     self::$smarty->assign_by_ref('sf_params', $sf_params);
     // we need to add the user to smarty
     self::$smarty->assign_by_ref('sf_user', $sf_user);
     return self::$smarty->fetch("file:{$file}");
 }
Example #4
0
 /**
  * fetch a template, echos the result,
  *
  * @see Zend_View_Abstract::render()
  * @param string $name the template
  * @return void
  */
 protected function _run()
 {
     $this->strictVars(true);
     //assign variables to the template engine
     $vars = get_object_vars($this);
     foreach ($vars as $key => $value) {
         if ('_' != substr($key, 0, 1)) {
             $this->_smarty->assign($key, $value);
         }
     }
     //why 'this'?
     //to emulate standard zend view functionality
     //doesn't mess up smarty in any way
     $this->_smarty->assign_by_ref('this', $this);
     //smarty needs a template_dir, and can only use templates,
     //found in that directory, so we have to strip it from the filename
     $file = func_get_arg(0);
     echo $this->_smarty->fetch($file);
     //process the template (and filter the output)
 }
Example #5
0
 public static function smarty_factory()
 {
     if (!isset($_SERVER['smartybase'])) {
         $_SERVER['smartybase'] = "/var/tmp/smarty-" . md5($_SERVER['SCRIPT_FILENAME']);
     }
     if (!lib::$appvars) {
         lib::$appvars = array('filebase' => $_SERVER['filebase'], 'mediabase' => $_SERVER['mediabase'], 'uribase' => $_SERVER['uribase'], 'urirequest' => $_SERVER['urirequest']);
     }
     $smbase = $_SERVER['smartybase'];
     #@mkdir("$smbase/templates", 0777, true);
     @mkdir("{$smbase}/templates_c", 0777, true);
     @mkdir("{$smbase}/cache", 0777, true);
     $smarty = new Smarty();
     $smarty->template_dir = "./views";
     $smarty->compile_dir = "{$smbase}/templates_c";
     $smarty->cache_dir = "{$smbase}/cache";
     # we don't set config dir, we most likely won't use it initially
     $smext = array('smarty_extensions', 'smarty_custom');
     foreach ($smext as $smo) {
         $mnames = get_class_methods($smo);
         foreach ($mnames as $method) {
             if (preg_match('/^func_(\\w+)$/', $method, $m)) {
                 $smarty->register_function($m[1], array($smo, $method));
             } elseif (preg_match('/^modifier_(\\w+)$/', $method, $m)) {
                 $smarty->register_modifier($m[1], array($smo, $method));
             } elseif (preg_match('/^block_(\\w+)$/', $method, $m)) {
                 $smarty->register_block($m[1], array($smo, $method));
             }
         }
     }
     # these are order dependent
     $smarty->register_prefilter(array('smarty_extensions', 'prefilter_convert_loop_breaks'));
     $smarty->register_prefilter(array('smarty_extensions', 'prefilter_convert_loop_continue'));
     $smarty->assign_by_ref('app', lib::$appvars);
     if (file_exists("setup/template_conf.php")) {
         include "setup/template_conf.php";
     }
     return $smarty;
 }
Example #6
0
$C_list = new CORE_list();
$C_block = new CORE_block();
for ($i = 0; $i < count(@$_SERVER["argv"]); $i++) {
    if (@$_SERVER["argv"][$i] == "_task=1") {
        $VAR['_task'] = 1;
    }
}
if (isset($VAR['_task'])) {
    require_once PATH_MODULES . 'task/task.inc.php';
    $task = new task();
    $task->run_all();
    exit;
}
$C_method->do_all();
if (isset($C_auth2) && $C_auth2 != false && defined("FORCE_SESS_ACCOUNT")) {
    $smarty->assign("SESS_LOGGED", FORCE_SESS_LOGGED);
    $smarty->assign("SESS_ACCOUNT", FORCE_SESS_ACCOUNT);
} else {
    $smarty->assign("SESS_LOGGED", SESS_LOGGED);
    $smarty->assign("SESS_ACCOUNT", SESS_ACCOUNT);
}
$smarty->assign_by_ref("method", $C_method);
$smarty->assign_by_ref("list", $C_list);
$smarty->assign_by_ref("block", $C_block);
$smarty->assign_by_ref("alert", $C_debug->alert);
$smarty->assign("VAR", $VAR);
$smarty->assign("SESS", SESS);
$smarty->assign("SSL_URL", SSL_URL);
$smarty->assign("URL", URL);
$C_theme = new CORE_theme();
ob_end_flush();
Example #7
0
// Load other config file (temporary)
include "config.php";
// Connect to database
require 'includes/EasyDB.php';
$db = new EasyDB($dbhost, $dbuname, $dbpass, $dbname);
unset($dbhost, $dbuname, $dbpass, $dbname);
$misc = $db->FetchAll("SELECT * FROM `miscinfo`");
// Set up some variables
$page = array();
$data = array();
$input = array();
// Temporarily put team names here until a better place/way is found
$data['teamnames'] = array('R' => 'Red', 'G' => 'Green', 'B' => 'Blue', 'P' => 'Purple', 'O' => 'Observer', 'H' => 'Rabbit', 'X' => 'Rogue');
$page['theme'] = 'bluetangerine';
if (array_key_exists($_COOKIE['theme'], $config['themes'])) {
    $page['theme'] = $_COOKIE['theme'];
}
$page['refresh'] = $_COOKIE['refresh'] == true;
$page['servername'] = $_SERVER['SERVER_NAME'];
$page['baseURL'] = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$page['refreshed_date'] = date('D, M d H:i:s T Y', $misc[0]['lastrefreshed']);
$page['refreshed_epoch'] = $misc[0]['lastrefreshed'];
$page['refreshed_rfc2822'] = date('r', $misc[0]['lastrefreshed']);
$page['separator'] = '<div class="center">&middot; &middot; &middot; &middot; &middot; &middot; &middot;</div>';
// Set up Smarty Template Engine
include 'includes/smarty/Smarty.class.php';
$tpl = new Smarty();
$tpl->assign_by_ref('page', $page);
$tpl->assign_by_ref('data', $data);
$tpl->assign_by_ref('input', $input);
$tpl->assign('themes', $config['themes']);
Example #8
0
if ($cfg['data_provider'] == 'redis') {
    include HAMMOCK_ROOT . "/lib/data_redis.php";
} else {
    include HAMMOCK_ROOT . "/lib/data_files.php";
}
include HAMMOCK_ROOT . "/lib/http.php";
include HAMMOCK_ROOT . "/lib/service.php";
include HAMMOCK_ROOT . "/lib/auth.php";
include HAMMOCK_ROOT . "/lib/smarty/Smarty.class.php";
if (!file_exists(HAMMOCK_ROOT . "/data/templates_c")) {
    mkdir(HAMMOCK_ROOT . "/data/templates_c", 0777, true);
}
$smarty = new Smarty();
$smarty->template_dir = HAMMOCK_ROOT . "/templates";
$smarty->compile_dir = HAMMOCK_ROOT . "/data/templates_c";
$smarty->assign_by_ref('cfg', $cfg);
function load_plugins()
{
    $GLOBALS['plugins'] = array();
    $dir = HAMMOCK_ROOT . "/plugins";
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (is_dir("{$dir}/{$file}") && is_file("{$dir}/{$file}/plugin.php")) {
                if (include "{$dir}/{$file}/plugin.php") {
                    $GLOBALS['plugins'][$file] = 1;
                }
            }
        }
        closedir($dh);
    }
    $GLOBALS['plugins_services'] = array();
Example #9
0
//exit(1);
echo "Generating tests truncate file\n";
$truncate = '<?xml version="1.0" encoding="UTF-8" ?>
<!--  Truncate all tables that will be used in the tests  -->
<dataset>';
$tbls = array_keys($tables);
foreach ($tbls as $d => $t) {
    $truncate = $truncate . "\n  <{$t} />\n";
}
$truncate = $truncate . "</dataset>\n";
$ft = fopen($sqlCodePath . "../tests/phpunit/CiviTest/truncate.xml", "w");
fputs($ft, $truncate);
fclose($ft);
unset($ft);
unset($truncate);
$smarty->assign_by_ref('database', $database);
$smarty->assign_by_ref('tables', $tables);
$tmpArray = array_keys($tables);
$tmpArray = array_reverse($tmpArray);
$smarty->assign_by_ref('dropOrder', $tmpArray);
$smarty->assign('mysql', 'modern');
echo "Generating sql file\n";
$sql = $smarty->fetch('schema.tpl');
createDir($sqlCodePath);
$fd = fopen($sqlCodePath . "civicrm.mysql", "w");
fputs($fd, $sql);
fclose($fd);
echo "Generating sql drop tables file\n";
$sql = $smarty->fetch('drop.tpl');
createDir($sqlCodePath);
$fd = fopen($sqlCodePath . "civicrm_drop.mysql", "w");
 /**
  * Constructor
  *
  * @param Request $request
  * @return ApplicationController
  */
 function __construct($request)
 {
     parent::__construct($request);
     // Set detault layout for application pages
     $this->setLayout(array('module' => SYSTEM_MODULE, 'layout' => 'wireframe'));
     // Get Smarty instance... We need it
     $this->smarty =& Smarty::instance();
     // Load and init owner company
     $this->owner_company = get_owner_company();
     if (instance_of($this->owner_company, 'Company')) {
         cache_set('owner_company', $this->owner_company);
     } else {
         $this->httpError(HTTP_ERR_NOT_FOUND, 'Owner company is not defined');
     }
     // if
     $this->application =& application();
     $this->authentication =& Authentication::instance();
     $this->logged_user =& $this->authentication->provider->getUser();
     $this->wireframe =& Wireframe::instance();
     $this->wireframe->page_company = $this->owner_company;
     $this->theme_name = instance_of($this->logged_user, 'User') ? UserConfigOptions::getValue('theme', $this->logged_user) : ConfigOptions::getValue('theme');
     $this->smarty->assign(array('root_url' => ROOT_URL, 'assets_url' => ASSETS_URL));
     // Maintenance mode
     if (ConfigOptions::getValue('maintenance_enabled')) {
         if (instance_of($this->logged_user, 'User') && $this->logged_user->isAdministrator()) {
             $this->wireframe->addPageMessage(lang('System is in maintenance mode and can be used by administrators only. <a href=":url">Click here</a> to turn off maintenance mode', array('url' => assemble_url('admin_settings_maintenance'))), 'warning');
         } else {
             $additional_error_info = ConfigOptions::getValue('maintenance_message');
             if ($additional_error_info) {
                 $additional_error_info .= "\n\n";
             }
             // if
             $additional_error_info .= lang('When system is in maintenance mode, administrators can log in and access the system') . ": " . assemble_url('login');
             $this->smarty->assign('additional_error_info', $additional_error_info);
             if ($this->restrict_access_in_maintenance_mode) {
                 $this->httpError(503);
             }
             // if
         }
         // if
     }
     // if
     // Check permissions
     if ($this->login_required && !instance_of($this->logged_user, 'User')) {
         // If async don't redirect to loging, just server proper HTTP code
         if ($this->request->isAsyncCall()) {
             $this->httpError(HTTP_ERR_UNAUTHORIZED, null, true, true);
             // Not async? Redirect to login with extracted route data...
         } else {
             $params = array();
             if ($request->matched_route != 'login') {
                 $params['re_route'] = $request->matched_route;
                 foreach ($this->request->url_params as $k => $v) {
                     if ($k == 'module' || $k == 'controller' || $k == 'action') {
                         continue;
                     }
                     // if
                     $params["re_{$k}"] = $v;
                 }
                 // foreach
             }
             // if
             $this->redirectTo($this->login_route, $params);
         }
         // if
     }
     // if
     if (instance_of($this->logged_user, 'User') && !$this->logged_user->getSystemPermission('system_access')) {
         $this->authentication->provider->logUserOut();
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $loaded_modules = $this->application->getModules();
     $assets_query_string = 'v=' . $this->application->version . '&modules=';
     foreach ($loaded_modules as $loaded_module) {
         $assets_query_string .= $loaded_module->getName() . ',';
     }
     // foreach
     $this->smarty->assign(array('api_status' => API_STATUS, 'application' => $this->application, 'owner_company' => $this->owner_company, 'authentication' => $this->authentication, 'logged_user' => $this->logged_user, 'request' => $this->request, 'theme_name' => $this->theme_name, 'request_time' => $this->request_time, 'loaded_modules' => $this->application->getModules(), 'captcha_url' => ROOT_URL . '/captcha.php?id=' . md5(time()), 'assets_query_string' => $assets_query_string, 'js_disabled_url' => assemble_url('js_disabled')));
     $this->smarty->assign_by_ref('wireframe', $this->wireframe);
     js_assign(array('homepage_url' => ROOT_URL, 'assets_url' => ASSETS_URL, 'indicator_url' => get_image_url('indicator.gif'), 'big_indicator_url' => get_image_url('indicator_big.gif'), 'ok_indicator_url' => get_image_url('ok_indicator.gif'), 'warning_indicator_url' => get_image_url('warning_indicator.gif'), 'error_indicator_url' => get_image_url('error_indicator.gif'), 'pending_indicator_url' => get_image_url('pending_indicator.gif'), 'url_base' => URL_BASE, 'keep_alive_interval' => KEEP_ALIVE_INTERVAL, 'refresh_session_url' => assemble_url('refresh_session'), 'jump_to_project_url' => assemble_url('jump_to_project_widget'), 'quick_add_url' => assemble_url('quick_add'), 'path_info_through_query_string' => PATH_INFO_THROUGH_QUERY_STRING, 'image_picker_url' => assemble_url('image_picker'), 'copyright_removed' => LICENSE_COPYRIGHT_REMOVED, 'custom_tabs_manager' => assemble_url('custom_tabs_manager'), 'add_milestone_url' => assemble_url('project_milestones_add', array('project_id' => '--PROJECT_ID--')), 'add_checklist_url' => assemble_url('project_checklists_add', array('project_id' => '--PROJECT_ID--')), 'add_discussion_url' => assemble_url('project_discussions_add', array('project_id' => '--PROJECT_ID--')), 'add_file_url' => assemble_url('project_files_upload', array('project_id' => '--PROJECT_ID--')), 'add_page_url' => assemble_url('project_pages_add', array('project_id' => '--PROJECT_ID--')), 'add_ticket_url' => assemble_url('project_tickets_add', array('project_id' => '--PROJECT_ID--')), 'add_timerecord_url' => assemble_url('project_time_add', array('project_id' => '--PROJECT_ID--')), 'attachment_rename_url' => assemble_url('attachment_rename', array('project_id' => '--PROJECT_ID--', 'attachment_id' => '--ATTACHMENT_ID--')), 'attachment_copy_to_url' => assemble_url('attachment_copy_to', array('project_id' => '--PROJECT_ID--', 'attachment_id' => '--ATTACHMENT_ID--')), 'attachment_move_to_url' => assemble_url('attachment_move_to', array('project_id' => '--PROJECT_ID--', 'attachment_id' => '--ATTACHMENT_ID--')), 'image_uploader_url' => assemble_url('image_uploader'), 'render_comments_url' => assemble_url('render_comments'), 'move_task_url' => assemble_url('project_task_move', array('project_id' => '--PROJECT_ID--', 'task_id' => '--TASK_ID--')), 'get_collection_url' => assemble_url('collection'), 'quick_task_reminder_url' => assemble_url('project_task_quickreminder', array('project_id' => '--PROJECT_ID--', 'task_id' => '--TASK_ID--')), 'convert_to_ticket_url' => assemble_url('project_object_convert_to_ticket', array('project_id' => '--PROJECT_ID--', 'object_id' => '--OBJECT_ID--')), 'convert_to_milestone_url' => assemble_url('project_object_convert_to_milestone', array('project_id' => '--PROJECT_ID--', 'object_id' => '--OBJECT_ID--')), 'convert_to_page_url' => assemble_url('project_object_convert_to_page', array('project_id' => '--PROJECT_ID--', 'object_id' => '--OBJECT_ID--')), 'snooze_task_url' => assemble_url('project_task_snooze', array('project_id' => '--PROJECT_ID--', 'task_id' => '--TASK_ID--'))));
     if ($this->logged_user) {
         $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
         mysql_select_db(DB_NAME);
         if (!empty($_SESSION['pg_ttl'])) {
             mysql_query("update healingcrystals_user_visited_pages set title='" . mysql_real_escape_string($_SESSION['pg_ttl']) . "' where user_id='" . $this->logged_user->getId() . "' and access_time='" . date('Y-m-d H:i:s', $_SESSION['temp_time']) . "'");
         }
         $current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $pos = strpos($_SERVER['QUERY_STRING'], '%2F');
         if ($pos !== false) {
             $max_pages_count_per_user = 50;
             //require_once SMARTY_PATH . '/plugins/function.page_title.php';
             //$current_page_title = smarty_function_page_title(array('default' => 'Projects'));
             //$current_page_title = PageConstruction::getPageTitle();
             $_SESSION['temp_time'] = time();
             mysql_query("insert into healingcrystals_user_visited_pages (user_id, page_url, title, access_time) values ('" . $this->logged_user->getId() . "', '" . $current_url . "', '', '" . date('Y-m-d H:i:s', $_SESSION['temp_time']) . "')");
             //mysql_query("insert into healingcrystals_user_visited_pages (user_id, page_url, title, access_time) values ('" . $this->logged_user->getId() . "', '" . $current_url . "', '', now())");
             $query = "select count(*) as count from healingcrystals_user_visited_pages where user_id='" . $this->logged_user->getId() . "'";
             $result = mysql_query($query);
             $info = mysql_fetch_assoc($result);
             $current_count = $info['count'];
             if ($current_count > $max_pages_count_per_user) {
                 $querries = array();
                 $query = "select * from healingcrystals_user_visited_pages where user_id='" . $this->logged_user->getId() . "' order by access_time limit 0, " . ($current_count - $max_pages_count_per_user);
                 $result = mysql_query($query);
                 while ($info = mysql_fetch_assoc($result)) {
                     $querries[] = "delete from healingcrystals_user_visited_pages where user_id='" . $this->logged_user->getId() . "' and page_url='" . $info['page_url'] . "' and access_time='" . $info['access_time'] . "'";
                 }
             }
             foreach ($querries as $query) {
                 mysql_query($query);
             }
         }
         $_SESSION['pg_ttl'] = '';
         mysql_close($link);
     }
 }
Example #11
0
<?php

//инициализируем класс БД
require PATH_CORE . 'database/database.php';
$oDb = new CDatabase('mysql', 'mysql:host=' . DB_HOST_SYSGEN . ';dbname=' . DB_NAME_SYSGEN, DB_USER_SYSGEN, DB_PASS_SYSGEN);
//$oDb = new CDatabase('pgsql', 'pgsql:port=5432 dbname='.DB_NAME_SYSGEN, DB_USER_SYSGEN, DB_PASS_SYSGEN);
$oDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$oDb->connect();
//инициализируем Config
config::load();
$oConfig =& config::$data;
if (BFF_DEBUG || FORDEV) {
    include PATH_CORE . 'vardump.php';
    $oDb->bShowStatistic = true;
    $oDb->bMakeStatistic = true;
}
//инициализируем Smarty
require PATH_CORE . 'external/smarty/smarty.class.php';
$oSm = new Smarty();
$oSm->force_compile = false;
$oSm->compile_check = true;
$oSm->debugging = false;
$oSm->compile_dir = PATH_BASE . 'tpl_c';
$oSm->config_dir = PATH_BASE . 'config';
$oSm->plugins_dir = array('plugins', 'plugins/bff');
Module::adminCustomCenterArea(false);
$oSm->assign('fordev', FORDEV);
$oSm->assign('site_url', SITEURL);
$oSm->assign_by_ref('config', $oConfig);
Example #12
0
     * The form is ready to be processed, just output it again as read only to
     * display the submitted values.  A real form processing script usually may
     * do something else like storing the form values in a database.
     */
    $form->ReadOnly = 1;
}
/*
 * Create the Smarty engine object to process the form template first
 *
 * NOTE: the form template needs to be processed separately from any other
 * page templates to prevent that the form prefilter interferes with the
 * normal processing of the other templates
 */
$smarty = new Smarty();
if ($smarty->template_exists("form.tpl")) {
    $smarty->assign_by_ref("form", $form);
    $smarty->assign("title", "Form class test");
    $smarty->assign("error_message", $error_message);
    $smarty->assign_by_ref("verify", $verify);
    $smarty->assign("doit", $doit);
    $smarty->assign("mark", "[Verify]");
    $smarty->assign("credit_card_field", "credit_card_number");
    $smarty->register_prefilter("smarty_prefilter_form");
    $smarty->fetch("form.tpl");
    $smarty->unregister_prefilter("smarty_prefilter_form");
} else {
    $form->AddDataPart("<h2><center>Please copy the template file <tt>templates/form.tpl</tt> to your Smarty <tt>templates</tt> directory.</center></h2>\n");
    $doit = 1;
}
/*
 * If the form was not submitted or was not valid, make the page ONLOAD
Example #13
0
    $fullinput_value .= ":" . max_min($maxminbrws_fld_C, "min", 0);
    $fullinput_value2 .= ":" . max_min($maxminbrws_fld_C, "max", 1);
    //		$fullinput_value .= ":3";
    //		$fullinput_value2 .= ":6";
    $fullinput_alph .= ":" . $browse_field_C;
}
// end if
if ($aliasname != "") {
    $or_input = " " . $strings['or'] . " [" . $fullinput_alph . "]";
} else {
    $or_input = "";
}
// end else
// $versecounteralph = chr($printversecounter);
// $printversecounter++;
$smarty->assign_by_ref('printversecounter', $printversecounter);
$smarty->assign('fullinput_value', $fullinput_value);
$smarty->assign('fullinput_value2', $fullinput_value2);
$smarty->assign('or_input', $or_input);
// } // end if
/////////////////Call the function to display the input boxes for which range of verses one wishes to browse////////////////////
$levels = array('blevela', 'blevelb', 'blevelc', 'elevela', 'elevelb', 'elevelc');
$max_arr_all = array(verse_selection(array($browse_field_A, $browse_field_B, $browse_field_C), array($textdirecA, $textdirecB, $textdirecC), array($maxminbrws_fld_A, $maxminbrws_fld_B, $maxminbrws_fld_C), $levels, 1));
/// Fix: This was designed to add an indefinite number of "or" options if one were to give the option to browse by more than 2 fields (perhaps the Collins database could use this?). browse9.php also should be fixed when testing to see if these blevela2+ items exist already or not. Do this also for browse_levels 2 and 3 or if any more levels are ever needed (dynamically added?!?--I hope they are not necessary since it is rather complicated to delineate all the possibilities!!!)
// Look for a field shortcut; if none, use the default.
$maxminbrws_fld_A = $browse_field_A;
$maxminbrws_fld_B = $browse_field_B;
$maxminbrws_fld_C = $browse_field_C;
localize_fields($browse_field_A, $fieldface);
$browse_field_A = $fieldshortcut;
$textdirecA = $textdirec;
Example #14
0
$input = array();
// Used to contain messages
$messages = array();
// Used to trigger invalid color highlights
$invalid = array();
// Per-page information
$page = array();
// Smarty Template System
if (defined('USING_SMARTY') && USING_SMARTY) {
    // Load Smarty
    require $config['paths']['includes'] . 'smarty/Smarty.class.php';
    // Create a new Smarty object
    $tpl = new Smarty();
    // This is where uncompiled template files are located
    $tpl->template_dir = $config['paths']['templates'];
    // This is where compiled templates are stored
    $tpl->compile_dir = $config['paths']['templates_c'];
    // Assign the configuration to Smarty
    // TODO: Once we have DB support, remove those from the config array
    // before assigning this to Smarty.
    $tpl->assign('config', $config);
    // Assign several variables by reference, since they may/will change during
    // script execution
    $tpl->assign_by_ref('user', $user);
    $tpl->assign_by_ref('input', $input);
    $tpl->assign_by_ref('messages', $messages);
    $tpl->assign_by_ref('invalid', $invalid);
    $tpl->assign_by_ref('page', $page);
    $tpl->assign_by_ref('data', $data);
    $tpl->assign('lang', $lang);
}
 public function assign_by_ref($tpl_var, &$value, $nocache = false)
 {
     if (method_exists($this, "assignByRef")) {
         return $this->assignByRef($tpl_var, $value, $nocache);
     } else {
         return parent::assign_by_ref($tpl_var, $value);
     }
 }
Example #16
0
 /**
  * Assign variable to template by reference.
  *
  * @param string $key Variable name.
  * @param mixed  &$value Value.
  *
  * @return Zikula_View
  */
 public function assign_by_ref($key, &$value)
 {
     $this->_assign_check($key);
     parent::assign_by_ref($key, $value);
     return $this;
 }
Example #17
0
 */
Plugins::RunHook('core_loaded');
$fb_helper = new FacebookHelper();
FPBAuth::GetInstance()->CheckFBStatus();
/**
 * The 'auth_completed' hook is executed after the authentication module has run
 * @see Hooks
 */
Plugins::RunHook('auth_completed');
$site_theme = strlen($config["Theme"]) > 0 ? $config["Theme"] : 'coolblue';
$smarty = new Smarty();
$smarty->template_dir = BASEDIR . '/themes/' . $site_theme;
$smarty->compile_dir = BASEDIR . '/cache/';
$smarty->assign('theme_path', '/themes/' . $site_theme);
if (FPBAuth::GetInstance()->IsLoggedIn()) {
    $smarty->assign_by_ref('user', FPBAuth::GetInstance()->GetUser());
}
require BASEDIR . '/fpb-includes/toolbar.php';
ob_start();
/**
 * The 'head_load' hook is executed when we build up the content in <head>
 * @see Hooks
 */
Plugins::RunHook('head_load');
fpb_toolbar_head();
$head_contents = ob_get_contents();
ob_clean();
$smarty->assign('head', $head_contents);
$smarty->assign('title', $page_title);
$smarty->assign('site_slogan', $config["GlobalSlogan"]);
$smarty->assign('site_name', $config["GlobalName"]);
Example #18
0
 function smarty_parse($template_file, &$data)
 {
     define(SMARTY_DIR, ROOT . 'smarty/');
     require SMARTY_DIR . 'Smarty.class.php';
     $smarty = new Smarty();
     $smarty->compile_dir = SMARTY_DIR . 'templates_c/';
     if (isset($this->owner)) {
         $smarty->template_dir = DIR_TEMPLATES . $this->owner->name . "/";
     }
     $data["ROOTHTML"] = ROOTHTML;
     foreach ($data as $k => $v) {
         $smarty->assign_by_ref($k, $data[$k]);
     }
     if (Is_Object($this->owner)) {
         $smarty->owner =& $this->owner;
     }
     $result = $smarty->fetch($template_file);
     return $result;
 }
Example #19
0
include BBLOGROOT . 'libs/ez_sql.php';
include BBLOGROOT . 'libs/authimage.class.php';
include BBLOGROOT . 'libs/czech.class.php';
include BBLOGROOT . 'libs/php5_emulator.php';
include BBLOGROOT . 'inc/bBlog.class.php';
include BBLOGROOT . 'inc/functions.php';
include BBLOGROOT . 'inc/templates.php';
include BBLOGROOT . 'inc/stringHandling.class.php';
// start your engines
$smartyObj = new Smarty();
$bBlog = new bBlog($smartyObj);
// include after database connection established
include BBLOGROOT . 'libs/search.class.php';
$bBlog->search = new article_search();
// Store the bBlog object in the Smarty one. So we can easily get it in Smarty functions.
$smartyObj->assign_by_ref("bBlog_object", $bBlog);
$mtime = explode(" ", microtime());
$bBlog->begintime = $mtime[1] + $mtime[0];
// this is only here until I work out the best way to do theming.
//$smartyObj->clear_compiled_tpl();
$smartyObj->template_dir = BBLOGROOT . 'templates/' . C_TEMPLATE;
$smartyObj->compile_dir = BBLOGROOT . 'compiled_templates/';
// A couple of changes to make sure we don't overwrite a smarty object initialized somewhere else
// Just to make integration a bit easier - Tiran Kenja
if (!is_array($smartyObj->plugins_dir)) {
    $smartyObj->plugins_dir = array();
}
array_push($smartyObj->plugins_dir, BBLOGROOT . 'bBlog_plugins', BBLOGROOT . 'smarty_plugins');
if (defined('IN_BBLOG_ADMIN')) {
    $smartyObj->compile_id = 'admin';
} else {
 function render($aDict = null)
 {
     $smarty = new Smarty();
     $oConfig =& KTConfig::getSingleton();
     $sVarDirectory = $oConfig->get('urls/varDirectory');
     $smarty->compile_dir = $oConfig->get('urls/tmpDirectory');
     //        foreach (array($sVarDirectory . '/tmp', '/tmp') as $sPath) {
     //            if (is_writeable($sPath)) {
     //                $smarty->compile_dir = $sPath;
     //                break;
     //            }
     //        }
     if (is_array($aDict)) {
         $iLen = count($aDict);
         $aKeys = array_keys($aDict);
         for ($i = 0; $i < $iLen; $i++) {
             $sKey = $aKeys[$i];
             $smarty->assign_by_ref($sKey, $aDict[$sKey]);
         }
     }
     if (is_array($this->aDict)) {
         $iLen = count($this->aDict);
         $aKeys = array_keys($this->aDict);
         for ($i = 0; $i < $iLen; $i++) {
             $sKey = $aKeys[$i];
             $smarty->assign_by_ref($sKey, $this->aDict[$sKey]);
         }
     }
     $KTConfig =& KTConfig::getSingleton();
     // needed for a very, very few places.
     $isSSL = $KTConfig->get("KnowledgeTree/sslEnabled");
     $hostname = $KTConfig->get("KnowledgeTree/serverName");
     $absroot = 'http';
     $absroot .= $isSSL ? 's://' : '://';
     $absroot .= $hostname;
     $absroot .= $KTConfig->get("KnowledgeTree/rootUrl");
     if (isset($_SESSION['search2_quick'])) {
         $search2_quick = $_SESSION['search2_quick'];
         $search2_general = $_SESSION['search2_general'];
         $search2_quickQuery = trim($_SESSION['search2_quickQuery']);
         if ($search2_quickQuery == '') {
             $search2_quickQuery = '';
         }
     } else {
         $search2_quick = 0;
         $search2_general = 1;
         $search2_quickQuery = '';
         $_SESSION['search2_quick'] = $search2_quick;
         $_SESSION['search2_general'] = $search2_general;
         $_SESSION['search2_quickQuery'] = '';
     }
     $smarty->assign('search2_anonymous', !array_key_exists('userID', $_SESSION) || $_SESSION['userID'] == -2);
     $smarty->assign('search2_user', $_SESSION['userId']);
     $smarty->assign('search2_quick', $search2_quick);
     $smarty->assign('search2_general', $search2_general);
     $smarty->assign('search2_quickQuery', $search2_quickQuery);
     $smarty->assign("config", $KTConfig);
     $smarty->assign("appname", $KTConfig->get("ui/appName", "KnowledgeTree"));
     $smarty->assign("rootUrl", $KTConfig->get("KnowledgeTree/rootUrl"));
     $smarty->assign("absoluteRootUrl", $absroot);
     $smarty->caching = false;
     $smarty->register_function('entity_select', array('KTSmartyTemplate', 'entity_select'));
     $smarty->register_function('boolean_checkbox', array('KTSmartyTemplate', 'boolean_checkbox'));
     $smarty->register_function('entity_checkboxes', array('KTSmartyTemplate', 'entity_checkboxes'));
     $smarty->register_function('entity_radios', array('KTSmartyTemplate', 'entity_radios'));
     $smarty->register_block('i18n', array('KTSmartyTemplate', 'i18n_block'), false);
     $smarty->register_modifier('addQueryString', array('KTSmartyTemplate', 'addQueryString'));
     $smarty->register_function('ktLink', array('KTSmartyTemplate', 'ktLink'));
     $smarty->register_modifier('addQS', array('KTSmartyTemplate', 'addQueryString'));
     $smarty->register_modifier('addQueryStringSelf', array('KTSmartyTemplate', 'addQueryStringSelf'));
     $smarty->register_modifier('addQSSelf', array('KTSmartyTemplate', 'addQueryStringSelf'));
     $smarty->register_block('addQS', array('KTSmartyTemplate', 'addQueryStringBlock'), false);
     $smarty->register_function('getUrlForFolder', array('KTSmartyTemplate', 'getUrlForFolder'));
     $smarty->register_function('getCrumbStringForDocument', array('KTSmartyTemplate', 'getCrumbStringForDocument'));
     return $smarty->fetch($this->sPath);
 }
Example #21
0
$smarty->assign('APPLICATION_VERSION', APPLICATION_VERSION);
$smarty->assign('DEPLOYMENT_ON_DEMAND', DEPLOYMENT_ON_DEMAND);
if (isset($cron_out_of_date)) {
    $smarty->assign('CRON_OUT_OF_DATE', $cron_out_of_date);
}
if (isset($db_time_zone_error)) {
    $smarty->assign('DB_TIME_ZONE_ERROR', $db_time_zone_error);
}
if (isset($config_vars['other']['installer_enabled'])) {
    $smarty->assign('INSTALLER_ENABLED', $config_vars['other']['installer_enabled']);
}
if (isset($system_settings['system_version']) and DEPLOYMENT_ON_DEMAND == FALSE and APPLICATION_VERSION != $system_settings['system_version']) {
    $smarty->assign('VERSION_MISMATCH', TRUE);
}
if (isset($system_settings)) {
    $smarty->assign_by_ref('system_settings', $system_settings);
}
if (isset($current_company)) {
    $smarty->assign_by_ref('current_company', $current_company);
}
if (isset($config_vars)) {
    $smarty->assign_by_ref('config_vars', $config_vars);
}
if (TTi18n::getLanguage() != '') {
    $smarty->assign('CALENDAR_LANG', TTi18n::getLanguage());
} else {
    $smarty->assign('CALENDAR_LANG', 'en');
}
if (isset($current_user)) {
    $smarty->assign_by_ref('current_user', $current_user);
    $smarty->assign_by_ref('current_user_prefs', $current_user_prefs);
Example #22
0
 public function setObject($name, $object)
 {
     $this->tpl->assign_by_ref($name, $object);
 }