<?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"' : '');
* @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); $savant->assignRef($ref3, $ref3); echo "<h1>Fetch non-existent template</h1>"; $result = $savant->fetch('no_such_template.tpl.php'); echo "result: <pre>"; print_r($result); echo "</pre>";
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'); } }
<?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');
$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) : ''); $tpl_friend->assign('FEMAIL_VALUE', isset($femail) ? cleanData($femail) : '');
<?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 /*---------------------------------- 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());