function execute($options = array()) { $form_name = $this->udm->name; $form_method = isset($options['frmMethod']) ? $options['frmMethod'] : 'post'; $form_action = isset($options['frmAction']) ? $options['frmAction'] : null; $this->form = new HTML_QuickForm($form_name, $form_method, $form_action); $this->form->addElement('hidden', 'modin', 'Module Instance'); $this->form->addElement('submit', 'btnUdmSubmit', 'Submit'); $this->form->registerElementType('multiselect', 'HTML/QuickForm/select.php', 'HTML_QuickForm_select'); $this->form->registerElementType('radiogroup', 'HTML/QuickForm/group.php', 'HTML_QuickForm_group'); $this->form->registerElementType('checkgroup', 'HTML/QuickForm/group.php', 'HTML_QuickForm_group'); $this->form->registerElementType('wysiwyg', 'HTML/QuickForm/textarea.php', 'HTML_QuickForm_textarea'); $this->form->registerElementType('captcha', 'HTML/QuickForm/text.php', 'HTML_QuickForm_text'); $this->form->registerElementType('imagepicker', 'HTML/QuickForm/select.php', 'HTML_QuickForm_select'); $this->_build_core_fields(); $this->_build_fields(); $this->_build_plugins(); $this->_build_preview(); $opener =& $this->form->addElement('button', 'open_up', 'Expand All Fields'); $opener->updateAttributes(array('onclick' => 'change_all_udm_blocks( );')); $this->form->setDefaults($this->udm->_module_def); $this->form->setConstants(array('modin' => $this->udm->instance)); $tpl = new Savant2(); $tpl->addPath('template', $_SERVER['DOCUMENT_ROOT'] . '/include/templates/UserData'); $renderer = new HTML_QuickForm_Renderer_Savant(false, false, $tpl); $renderer->setTemplate('admin.php.tpl'); $this->form->accept($renderer); $this->udm->form = $this->form; }
function __construct() { // Choose DB from config parent::__construct(); $this->addPath('template', BASE . 'templates/'); // Hardwire SQLite $plugin = new PapyrinePlugin(BASE . 'plugins/database-sqlite/'); $this->database = $plugin->getInstance(); }
function DOCMAN_theme() { global $_DOCMAN, $savant_path; $this->name = $_DOCMAN->getCfg('icon_theme'); $this->path = $_DOCMAN->getPath('themes', $this->name); $conf = array(); $conf['template_path'] = $this->path . "templates/"; $conf['resource_path'] = $savant_path . "Savant2/"; parent::Savant2($conf); //set the theme variables $this->_setConfig(); //set the language $this->_setLanguage(); }
function DOCMAN_theme() { global $_DOCMAN, $savant_path; $this->name = $_DOCMAN->getCfg('icon_theme'); if (!$this->name) { throw new Exception('Theme name not found'); } $this->path = $_DOCMAN->getPath('themes', $this->name); $conf = array(); $conf['template_path'] = $this->path . "templates" . DS; $conf['resource_path'] = $savant_path . "Savant2" . DS; parent::Savant2($conf); //set the theme variables $this->_setConfig(); //set the language $this->_setLanguage(); }
<?php /** * * Tests fetch() issues * * @version $Id: 3_fetch.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources'); $savant = new Savant2($conf); $array = array('key0' => 'val0', 'key1' => 'val1', 'key2' => 'val2'); $var1 = 'variable1'; $var2 = 'variable2'; $var3 = 'variable3'; $ref1 = 'reference1'; $ref2 = 'reference2'; $ref3 = 'reference3'; // assign vars $savant->assign($var1, $var1); $savant->assign($var2, $var2); $savant->assign($var3, $var3); // assigns $array to a variable $set $savant->assign('set', $array); // assigns the keys and values of array $savant->assign($array); // assign references $savant->assignRef($ref1, $ref1); $savant->assignRef($ref2, $ref2);
<?php /** * * Tests default plugins * * @version $Id: 4_plugins.php,v 1.3 2004/12/08 15:51:49 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources'); $savant = new Savant2($conf); $array = array('key0' => 'val0', 'key1' => 'val1', 'key2' => 'val2'); $var1 = 'variable1'; $var2 = 'variable2'; $var3 = 'variable3'; $ref1 = 'reference1'; $ref2 = 'reference2'; $ref3 = 'reference3'; // assign vars $savant->assign($var1, $var1); $savant->assign($var2, $var2); $savant->assign($var3, $var3); // assigns $array to a variable $set $savant->assign('set', $array); // assigns the keys and values of array $savant->assign($array); // assign references $savant->assignRef($ref1, $ref1); $savant->assignRef($ref2, $ref2);
<?php /*---------------------------------- MAIAN WEBLOG v4.0 Written by David Ian Bennett E-Mail: support@maianscriptworld.co.uk Website: www.maianscriptworld.co.uk This File: Header -----------------------------------*/ if (!defined('PARENT')) { exit; } $tpl_header = new Savant2(); $tpl_header->assign('CHARSET', $msg_charset); $tpl_header->assign('TITLE', $pageTitle); $tpl_header->assign('BLOGNAME', cleanData($SETTINGS->blogname)); $tpl_header->assign('META_DESCRIPTION', cleanData($SETTINGS->meta_d)); $tpl_header->assign('META_KEYWORDS', cleanData($SETTINGS->meta_k)); $tpl_header->assign('PATH', $SETTINGS->w_path . '/themes/' . THEME); $tpl_header->assign('SUBTEXT', $msg_public_header); $tpl_header->assign('FEED_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/rss-feed.html' : $SETTINGS->w_path . '/index.php?cmd=rss-feed'); $tpl_header->assign('H_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/index.html' : $SETTINGS->w_path . '/index.php'); $tpl_header->assign('P_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/profile.html' : $SETTINGS->w_path . '/index.php?cmd=profile'); $tpl_header->assign('C_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/contact.html' : $SETTINGS->w_path . '/index.php?cmd=contact'); $tpl_header->assign('A_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/all-archive.html' : $SETTINGS->w_path . '/index.php?cmd=all-archive'); $tpl_header->assign('SEARCH_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/index.html' : $SETTINGS->w_path . '/index.php?cmd=search'); $tpl_header->assign('H_CURRENT', $cmd == 'home' ? ' id="current"' : ''); $tpl_header->assign('P_CURRENT', $cmd == 'profile' ? ' id="current"' : ''); $tpl_header->assign('C_CURRENT', $cmd == 'contact' ? ' id="current"' : ''); $tpl_header->assign('A_CURRENT', $cmd == 'archive' || $cmd == 'all-archive' ? ' id="current"' : ''); $tpl_header->assign('H_CURRENT_CLASS', $cmd == 'home' ? ' class="selected"' : '');
function advsearch2($option) { global $savantConf, $Itemid, $mtconf; $database =& JFactory::getDBO(); $document =& JFactory::getDocument(); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'mfields.class.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'mAdvancedSearch.class.php'; $document->setTitle(JText::_('Advanced search results')); # Load up search ID if available $search_id = JRequest::getInt('search_id', 0); if ($search_id > 0) { $database->setQuery('SELECT search_text FROM #__mt_searchlog WHERE search_id = ' . $database->quote($search_id)); $post = unserialize($database->loadResult()); } else { $post = JRequest::get('post'); } # Load all published CORE & custom fields $database->setQuery("SELECT cf.*, '0' AS link_id, '' AS value, '0' AS attachment, ft.ft_class FROM #__mt_customfields AS cf " . "\nLEFT JOIN #__mt_fieldtypes AS ft ON ft.field_type=cf.field_type" . "\nWHERE cf.published='1' ORDER BY ordering ASC"); $fields = new mFields($database->loadObjectList()); $searchParams = $fields->loadSearchParams($post); $advsearch = new mAdvancedSearch($database); if (intval($post['searchcondition']) == 2) { $advsearch->useAndOperator(); } else { $advsearch->useOrOperator(); } # Search Category $search_cat = intval($post['cat_id']); $only_subcats_sql = ''; if ($search_cat > 0 && is_int($search_cat)) { $mtCats = new mtCats($database); $subcats = $mtCats->getSubCats_Recursive($search_cat, true); $subcats[] = $search_cat; if (!empty($subcats)) { $advsearch->limitToCategory($subcats); } } $fields->resetPointer(); while ($fields->hasNext()) { $field = $fields->getField(); $searchFields = $field->getSearchFields(); if (isset($searchFields[0]) && isset($searchParams[$searchFields[0]]) && $searchParams[$searchFields[0]] != '') { foreach ($searchFields as $searchField) { $searchFieldValues[] = $searchParams[$searchField]; } if (!empty($searchFieldValues) && $searchFieldValues[0] != '') { if (is_array($searchFieldValues[0]) && empty($searchFieldValues[0][0])) { // Do nothing } else { $tmp_where_cond = call_user_func_array(array($field, 'getWhereCondition'), $searchFieldValues); if (!is_null($tmp_where_cond)) { $advsearch->addCondition($field, $searchFieldValues); } } } unset($searchFieldValues); } $fields->next(); } $limit = JRequest::getInt('limit', $mtconf->get('fe_num_of_searchresults'), 'get'); $limitstart = JRequest::getInt('limitstart', 0, 'get'); if ($limitstart < 0) { $limitstart = 0; } $advsearch->search(1, 1); // Total Results $total = $advsearch->getTotal(); if ($search_id <= 0 && $total > 0) { # Store search for later retrieval. if ($search_id < 1) { $database->setQuery("INSERT INTO #__mt_searchlog (search_text) VALUES ('" . serialize($post) . "')"); if (!$database->query()) { echo $database->getErrorMsg(); } } # Get the above search ID $database->setQuery("SELECT search_id FROM #__mt_searchlog WHERE search_text ='" . serialize($post) . "'"); $database->query(); $search_id = $database->loadResult(); $document->addCustomTag('<meta http-equiv="Refresh" content="1; URL=' . JRoute::_("index.php?option=com_mtree&task=advsearch2&search_id={$search_id}&Itemid={$Itemid}") . '">'); # Savant template $savant = new Savant2($savantConf); $savant->assign('redirect_url', JRoute::_("index.php?option=com_mtree&task=advsearch2&search_id={$search_id}&Itemid={$Itemid}")); $savant->display('page_advSearchRedirect.tpl.php'); } else { $links = $advsearch->loadResultList($limitstart, $limit); # Page Navigation jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); # Pathway $pathWay = new mtPathWay(); # Savant template $savant = new Savant2($savantConf); assignCommonListlinksVar($savant, $links, $pathWay, $pageNav); $savant->assign('search_id', $search_id); $savant->display('page_advSearchResults.tpl.php'); } }
* Tests the basic compiler * * @version $Id: compile.php,v 1.6 2005/01/07 22:05:38 pmjones Exp $ * */ function preprint($val) { echo "<pre>\n"; print_r($val); echo "</pre>\n"; } error_reporting(E_ALL); // instantiate Savant require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources', 'restrict' => true); $savant = new Savant2($conf); // instantiate a compiler... require_once 'Savant2/Savant2_Compiler_basic.php'; $compiler = new Savant2_Compiler_basic(); $compiler->compileDir = '/tmp/'; $compiler->forceCompile = true; // and tell Savant to use it. $savant->setCompiler($compiler); // set up vars $array = array('key0' => 'val0', 'key1' => 'val1', 'key2' => 'val2'); $var1 = 'variable1'; $var2 = 'variable2'; $var3 = 'variable3'; $ref1 = 'reference1'; $ref2 = 'reference2'; $ref3 = 'reference3';
$MW_MAIL->addTag('{BLOGURL}', $SETTINGS->modR ? $SETTINGS->w_path . '/blog/' . $BLOG->id . '/' . addTitleToUrl(cleanData($BLOG->title)) . '.html' : $SETTINGS->w_path . '/index.php?cmd=blog&post=' . $BLOG->id); $MW_MAIL->addTag('{COMMENTS}', $comments); $MW_MAIL->addTag('{VISITOR}', $yname); $MW_MAIL->addTag('{FRIEND}', $fname); $MW_MAIL->addTag('{DATE}', date($SETTINGS->dateformat, strtotime("" . $SETTINGS->timeOffset . " hours"))); $MW_MAIL->addTag('{WEBSITE}', $SETTINGS->website); $MW_MAIL->addTag('{WEBSITE_URL}', $SETTINGS->w_path . '/'); $MW_MAIL->sendMail($fname, $femail, $yname, $yemail, '[' . $SETTINGS->website . '] ' . str_replace("{name}", $fname, $msg_friend11), $MW_MAIL->template('themes/email/tell_a_friend.txt')); // Clear vars.. $yname = ''; $yemail = ''; $comments = ''; $SENT = true; } } $tpl_friend = new Savant2(); $tpl_friend->assign('CHARSET', $msg_charset); $tpl_friend->assign('TITLE', $msg_friend); $tpl_friend->assign('FORM_URL', $SETTINGS->modR ? 'friend_' . $BLOG->id . '.html' : 'index.php?cmd=tell-a-friend&blog=' . $BLOG->id); $tpl_friend->assign('PATH', $SETTINGS->w_path . '/themes/' . THEME); $tpl_friend->assign('CSS_DISPLAY', isset($SENT) ? '<style type="text/css">#friend_wrapper{display:none}</style>' : ''); $tpl_friend->assign('HEADER', isset($SENT) ? $msg_friend10 : $msg_friend); $tpl_friend->assign('MESSAGE', isset($SENT) ? str_replace(array('{friend}', '{email}'), array(cleanData($fname), $femail), $msg_friend8) : $msg_friend9); $tpl_friend->assign('YOUR_NAME', $msg_friend2); $tpl_friend->assign('YOUR_EMAIL', $msg_friend3); $tpl_friend->assign('FRIEND_NAME', $msg_friend4); $tpl_friend->assign('FRIEND_EMAIL', $msg_friend5); $tpl_friend->assign('COMMENTS', $msg_contact5); $tpl_friend->assign('YNAME_VALUE', isset($yname) ? cleanData($yname) : ''); $tpl_friend->assign('YEMAIL_VALUE', isset($yemail) ? cleanData($yemail) : ''); $tpl_friend->assign('FNAME_VALUE', isset($fname) ? cleanData($fname) : '');
<?php /** * * Tests default plugins * * @version $Id: 7_include.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources'); $savant = new Savant2($conf); $array = array('key0' => 'val0', 'key1' => 'val1', 'key2' => 'val2'); $var1 = 'variable1'; $var2 = 'variable2'; $var3 = 'variable3'; $ref1 = 'reference1'; $ref2 = 'reference2'; $ref3 = 'reference3'; // assign vars $savant->assign($var1, $var1); $savant->assign($var2, $var2); $savant->assign($var3, $var3); // assigns $array to a variable $set $savant->assign('set', $array); // assigns the keys and values of array $savant->assign($array); // assign references $savant->assignRef($ref1, $ref1); $savant->assignRef($ref2, $ref2);
<?php /** * * Tests assign() issues * * @version $Id: 1_assign.php,v 1.2 2004/12/08 01:24:59 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $savant = new Savant2(array('template_path' => 'templates')); echo "<h1>assign 0 (string, null)</h1>"; $val = null; $result = $savant->assign('nullvar', $val); echo "result: <pre>"; print_r($result); echo "</pre>"; echo "properties: <pre>"; print_r(get_object_vars($savant)); echo "</pre>"; echo "<h1>assign 1 (string, mixed)</h1>"; $result = $savant->assign('variable', 'variable_value'); echo "result: <pre>"; print_r($result); echo "</pre>"; echo "properties: <pre>"; print_r(get_object_vars($savant)); echo "</pre>"; echo "<h1>assign 2 (array)</h1>"; $result = $savant->assign(array('array1' => 'value1', 'array2' => 'value2'));
<?php /** * * Tests filters and plugins * * @version $Id: 5_filters.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources'); $savant = new Savant2($conf); // set up filters $savant->loadFilter('colorizeCode'); $savant->loadFilter('trimwhitespace'); $savant->loadFilter('fester', null, true); // run through the template $savant->display('filters.tpl.php'); // do it again to test object persistence $savant->display('filters.tpl.php'); // do it again to test object persistence $savant->display('filters.tpl.php'); echo "<hr />\n"; echo "<pre>"; print_r($savant); echo "</pre>";
<?php /** * * Tests default plugins * * @version $Id: 9_errors.php,v 1.2 2004/11/05 16:00:38 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $savant = new Savant2(); require_once 'PEAR.php'; PEAR::setErrorHandling(PEAR_ERROR_PRINT); echo "<h1>PEAR_Error</h1>\n"; $savant->setError('pear'); $result = $savant->loadPlugin('nosuchthing'); echo "<pre>\n"; print_r($result); echo "</pre>\n\n"; echo "<h1>PEAR_ErrorStack</h1>\n"; $savant->setError('stack'); $result = $savant->loadPlugin('nosuchthing'); echo "<pre>\n"; print_r($result); echo "</pre>\n\n"; echo "<pre>\n"; print_r(print_r($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'])); echo "</pre>\n\n"; echo "<h1>Exception</h1>\n"; $savant->setError('exception');
<?php /*---------------------------------- MAIAN WEBLOG v4.0 Written by David Ian Bennett E-Mail: support@maianscriptworld.co.uk Website: www.maianscriptworld.co.uk This File: Footer -----------------------------------*/ if (!defined('PARENT')) { exit; } $tpl_footer = new Savant2(); $tpl_footer->assign('FOOTER', $msg_script3 . ': <a href="http://www.maianweblog.com/" title="' . $msg_script . ' ' . $msg_script2 . '"><b>' . $msg_script . ' ' . $msg_script2 . '</b></a> © 2003-' . date("Y") . ' Maian Script World. <a href="http://validator.w3.org/check?uri=referer" title="' . $msg_public_footer . '"><b>' . $msg_public_footer . '</b></a>/<a href="http://jigsaw.w3.org/css-validator/check/referer" title="' . $msg_public_footer2 . '"><b>' . $msg_public_footer2 . '</b></a>'); $tpl_footer->assign('SNAP_CODE', cleanData($SETTINGS->snap)); $tpl_footer->assign('P_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/profile.html' : $SETTINGS->w_path . '/index.php?cmd=profile'); $tpl_footer->assign('FEED_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/rss-feed.html' : $SETTINGS->w_path . '/index.php?cmd=rss-feed'); $tpl_footer->assign('H_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/index.html' : $SETTINGS->w_path . '/index.php'); $tpl_footer->assign('C_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/contact.html' : $SETTINGS->w_path . '/index.php?cmd=contact'); $tpl_footer->assign('A_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/all-archive.html' : $SETTINGS->w_path . '/index.php?cmd=all-archive'); $tpl_footer->assign('HOME', $msg_public_header2); $tpl_footer->assign('PROFILE', $msg_public_header3); $tpl_footer->assign('CONTACT', $msg_public_header4); $tpl_footer->assign('ARCHIVE', $msg_public_header5); $tpl_footer->assign('RSS_FEED', $msg_public_header12); $tpl_footer->assign('MENU', $msg_public_header14); $tpl_footer->assign('SEARCH_URL', $SETTINGS->modR ? $SETTINGS->w_path . '/index.html' : $SETTINGS->w_path . '/index.php?cmd=search'); $tpl_footer->assign('IMAGE', $SETTINGS->profileImage ? '<img class="profile_image" src="' . $SETTINGS->w_path . '/uploads/' . $SETTINGS->profileImage . '"' . ($SETTINGS->imageWidth > 0 ? ' width="' . $SETTINGS->imageWidth . '"' : ' ') . ' ' . ($SETTINGS->imageHeight > 0 ? ' height="' . $SETTINGS->imageHeight . '" ' : ' ') . 'title="' . $msg_public_header3 . '" alt="' . $msg_public_header3 . '" /><br />' : ''); $tpl_footer->assign('VIEW_PROFILE', $msg_public_header8); $tpl_footer->assign('TOP', $msg_script11); $tpl_footer->assign('FAVOURITE_SITES', loadFavouriteSites());
/* basically the prefix to a rtl variant directory/filename. eg. rtl_tree */ } /***** end language block ****/ /* 7. load common libraries */ require AT_INCLUDE_PATH . 'classes/ContentManager.class.php'; /* content management class */ require_once AT_INCLUDE_PATH . 'lib/output.inc.php'; /* output functions */ if (!defined('AT_REDIRECT_LOADED')) { require_once AT_INCLUDE_PATH . 'classes/UrlRewrite/UrlParser.class.php'; /* pretty url tool */ } require AT_INCLUDE_PATH . 'classes/Savant2/Savant2.php'; /* for the theme and template management */ // set default template paths: $savant = new Savant2(); $savant->addPath('template', AT_INCLUDE_PATH . '../themes/default/'); /**************************************************/ /* load in message handler */ /**************************************************/ require AT_INCLUDE_PATH . 'classes/Message/Message.class.php'; $msg = new Message($savant); //if user has requested theme change, make the change here if ((isset($_POST['theme']) || isset($_POST['mobile_theme'])) && isset($_POST['submit'])) { //http://atutor.ca/atutor/mantis/view.php?id=4781 //Themes should be in the same folder, disallow '../' $newTheme = str_replace("../", "", $_POST['theme']); $newMobileTheme = str_replace("../", "", $_POST['mobile_theme']); if ($newTheme != $_POST['theme'] || $newMobileTheme != $_POST['mobile_theme']) { header('Location:' . AT_BASE_HREF . 'users/preferences.php'); exit;
* * Tests multiple-path directory searches * * @version $Id: 6_paths.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $ * */ function preprint($val) { echo "<pre>\n"; print_r($val); echo "</pre>\n"; } error_reporting(E_ALL); require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources'); $savant = new Savant2($conf); echo "<h1>Paths to begin with</h1>\n"; preprint($savant->getPath('resource')); preprint($savant->getPath('template')); echo "<h1>Add a path</h1>\n"; $savant->addPath('resource', 'no/such/path'); preprint($savant->getPath('resource')); echo "<h1>Find an existing resource (non-default)</h1>\n"; $file = $savant->findFile('resource', 'Savant2_Plugin_cycle.php'); preprint($file); echo "<h1>Find an existing resource (default)</h1>\n"; $file = $savant->findFile('resource', 'Savant2_Plugin_input.php'); preprint($file); echo "<h1>Find a non-existent template</h1>\n"; $file = $savant->findFile('template', 'no_such_template.tpl.php'); if ($file) {
<?php /** * * Tests default plugins * * @version $Id: 8_extend.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $ * */ error_reporting(E_ALL); require_once 'Savant2.php'; $conf = array('template_path' => 'templates', 'resource_path' => 'resources'); $savant = new Savant2($conf); $savant->display('extend.tpl.php');
<?php error_reporting(E_ALL); require_once 'Savant2.php'; $Savant2 = new Savant2(); $Savant2->addPath('template', 'templates/'); $Savant2->addPath('resource', 'resources/'); $defaults = array('hideme' => null, 'mytext' => null, 'xbox' => null, 'picker' => null, 'picker2' => null, 'chooser' => null, 'myarea' => null); $values = array_merge($defaults, $_POST); $tmp = array(); if ($values['mytext'] == '') { // required $tmp[] = 'required'; } if (strlen($values['mytext']) > 5) { // max 5 chars $tmp[] = 'maxlen'; } if (preg_match('/[0-9]+/', $values['mytext'])) { // no digits $tmp[] = 'no_digits'; } if (count($tmp) == 0) { $valid = array('mytext' => true); } else { $valid = array('mytext' => $tmp); } $Savant2->assign('opts', array('one', 'two', 'three', 'four', 'five')); $Savant2->assign($values); $Savant2->assign('valid', $valid); $Savant2->display('form.tpl.php');
$myLang->saveToSession(); /* set right-to-left language */ $rtl = ''; if ($myLang->isRTL()) { $rtl = 'rtl_'; /* basically the prefix to a rtl variant directory/filename. eg. rtl_atee */ } /***** end language block ****/ /***** 6. load common libraries *****/ require TR_INCLUDE_PATH . 'lib/output.inc.php'; /* output functions */ /***** end load common libraries ****/ /***** 7. initialize theme and template management *****/ require TR_INCLUDE_PATH . 'classes/Savant2/Savant2.php'; // set default template paths: $savant = new Savant2(); if (isset($_SESSION['prefs']['PREF_THEME']) && file_exists(TR_INCLUDE_PATH . '../themes/' . $_SESSION['prefs']['PREF_THEME']) && $_SESSION['user_id'] > 0) { if (!is_dir(TR_INCLUDE_PATH . '../themes/' . $_SESSION['prefs']['PREF_THEME'])) { $_SESSION['prefs']['PREF_THEME'] = 'default'; } else { //check if enabled $themesDAO = new ThemesDAO(); $row = $themesDAO->getByID($_SESSION['prefs']['PREF_THEME']); if ($row['status'] == 0) { // get default $_SESSION['prefs']['PREF_THEME'] = get_default_theme(); } } } else { $_SESSION['prefs']['PREF_THEME'] = get_default_theme(); }