/** * Generates the HTML for a gift certificate using this theme. * * @param array gift certificate placeholder data * * @return string the generated gift certificate html */ public function generateGiftCertificateHTML($certificate) { $template = TEMPLATE::getInstance(); if(!isset($GLOBALS['ShopPathNormal'])) { $GLOBALS['ShopPathNormal'] = $GLOBALS['ShopPath']; } // Fetch the store logo or store title if(GetConfig('UseAlternateTitle')) { $text = GetConfig('AlternateTitle'); } else { $text = GetConfig('StoreName'); } $text = explode(" ", $text, 2); $text[0] = "<span class=\"Logo1stWord\">".$text[0]."</span>"; $GLOBALS['LogoText'] = implode(" ", $text); $GLOBALS['HeaderLogo'] = $template->GetSnippet("LogoText"); // Set gift certificate details $GLOBALS['CharacterSet']=GetConfig('CharacterSet'); $GLOBALS['GiftCertificateTo'] = isc_html_escape($certificate['giftcertto']); $GLOBALS['GiftCertificateToEmail'] = isc_html_escape($certificate['giftcerttoemail']); $GLOBALS['GiftCertificateFrom'] = isc_html_escape($certificate['giftcertfrom']); $GLOBALS['GiftCertificateFromEmail'] = isc_html_escape($certificate['giftcertfromemail']); $GLOBALS['GiftCertificateAmount'] = CurrencyConvertFormatPrice($certificate['giftcertamount']); $GLOBALS['GiftCertificateMessage'] = isc_html_escape($certificate['giftcertmessage']); $GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']); if(isset($certificate['giftcertexpirydate']) && $certificate['giftcertexpirydate'] != 0) { $GLOBALS['GiftCertificateExpiryInfo'] = sprintf(GetLang('GiftCertificateExpiresOn'), CDate($certificate['giftcertexpirydate'])); } else { $GLOBALS['GiftCertificateExpiryInfo'] = ''; } // Build the html $html = $template->ParseTemplate(true, $this->getTemplateContents()); return $html; }
function sendActivationLink($type, $extra = '') { global $CONF; if (!isset($CONF['ActivationDays'])) { $CONF['ActivationDays'] = 2; } // generate key and URL $key = $this->generateActivationEntry($type, $extra); $url = $CONF['AdminURL'] . 'index.php?action=activate&key=' . $key; // choose text to use in mail switch ($type) { case 'register': $message = _ACTIVATE_REGISTER_MAIL; $title = _ACTIVATE_REGISTER_MAILTITLE; break; case 'forgot': $message = _ACTIVATE_FORGOT_MAIL; $title = _ACTIVATE_FORGOT_MAILTITLE; break; case 'addresschange': $message = _ACTIVATE_CHANGE_MAIL; $title = _ACTIVATE_CHANGE_MAILTITLE; break; default: } // fill out variables in text $aVars = array('siteName' => $CONF['SiteName'], 'siteUrl' => $CONF['IndexURL'], 'memberName' => $this->getDisplayName(), 'activationUrl' => $url, 'activationDays' => $CONF['ActivationDays']); $message = TEMPLATE::fill($message, $aVars); $title = TEMPLATE::fill($title, $aVars); // send mail mb_language('ja'); mb_internal_encoding(_CHARSET); @mb_send_mail($this->getEmail(), $title, $message, 'From: ' . $CONF['AdminEmail']); ACTIONLOG::add(INFO, _ACTIONLOG_ACTIVATIONLINK . ' (' . $this->getDisplayName() . ' / type: ' . $type . ')'); }
/** * Shows a list of all blogs in the system using a given template * ordered by number, name, shortname or description * in ascending or descending order */ function showBlogList($template, $bnametype, $orderby, $direction) { global $CONF, $manager; switch ($orderby) { case 'number': $orderby = 'bnumber'; break; case 'name': $orderby = 'bname'; break; case 'shortname': $orderby = 'bshortname'; break; case 'description': $orderby = 'bdesc'; break; default: $orderby = 'bnumber'; break; } $direction = strtolower($direction); switch ($direction) { case 'asc': $direction = 'ASC'; break; case 'desc': $direction = 'DESC'; break; default: $direction = 'ASC'; break; } $template =& $manager->getTemplate($template); echo TEMPLATE::fill(isset($template['BLOGLIST_HEADER']) ? $template['BLOGLIST_HEADER'] : null, array('sitename' => $CONF['SiteName'], 'siteurl' => $CONF['IndexURL'])); $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM ' . sql_table('blog') . ' ORDER BY ' . $orderby . ' ' . $direction; $res = sql_query($query); while ($data = sql_fetch_assoc($res)) { $list = array(); // $list['bloglink'] = createLink('blog', array('blogid' => $data['bnumber'])); $list['bloglink'] = createBlogidLink($data['bnumber']); $list['blogdesc'] = $data['bdesc']; $list['blogurl'] = $data['burl']; if ($bnametype == 'shortname') { $list['blogname'] = $data['bshortname']; } else { // all other cases $list['blogname'] = $data['bname']; } $manager->notify('PreBlogListItem', array('listitem' => &$list)); echo TEMPLATE::fill(isset($template['BLOGLIST_LISTITEM']) ? $template['BLOGLIST_LISTITEM'] : null, $list); } sql_free_result($res); echo TEMPLATE::fill(isset($template['BLOGLIST_FOOTER']) ? $template['BLOGLIST_FOOTER'] : null, array('sitename' => $CONF['SiteName'], 'siteurl' => $CONF['IndexURL'])); }
</span> </div> </div> <!-- Google +1 --> <div class="control-group <?php echo form_error('share_plusone') ? 'error' : ''; ?> "> <label class="control-label"></label> <div class="controls"> <?php $use_selection = isset($settings['news.share_plusone']) && $settings['news.share_plusone'] == 1 || !isset($settings['news.share_plusone']) ? true : false; echo form_checkbox('share_plusone', 1, $use_selection, 'id="share_plusone"'); ?> <span class="help-inline"><img src="<?php echo TEMPLATE::theme_url('images/icons/google_plus.png '); ?> " align="absmiddle" /> <?php echo lang('nw_share_plusone'); ?> </span> </div> </div> </fieldset> <div class="form-actions"> <input type="submit" name="submit" class="btn btn-primary" value="<?php echo lang('bf_action_save') . ' ' . lang('bf_context_settings'); ?> " /> <?php echo lang('bf_or');
/** * @todo document this */ function action_templateclone() { global $member; $templateid = intRequestVar('templateid'); $member->isAdmin() or $this->disallow(); // 1. read old template $name = TEMPLATE::getNameFromId($templateid); $desc = TEMPLATE::getDesc($templateid); // 2. create desc thing $name = "cloned" . $name; // if a template with that name already exists: if (TEMPLATE::exists($name)) { $i = 1; while (TEMPLATE::exists($name . $i)) { $i++; } $name .= $i; } $newid = TEMPLATE::createNew($name, $desc); // 3. create clone // go through parts of old template and add them to the new one $res = sql_query('SELECT tpartname, tcontent FROM ' . sql_table('template') . ' WHERE tdesc=' . $templateid); while ($o = sql_fetch_object($res)) { $this->addToTemplate($newid, $o->tpartname, $o->tcontent); } $this->action_templateoverview(); }
/** * Outputs the XML contents of the export file * * @param $setHeaders * set to 0 if you don't want to send out headers * (optional, default 1) */ function export($setHeaders = 1) { if ($setHeaders) { // make sure the mimetype is correct, and that the data does not show up // in the browser, but gets saved into and XML file (popup download window) header('Content-Type: text/xml'); header('Content-Disposition: attachment; filename="skinbackup.xml"'); header('Expires: 0'); header('Pragma: no-cache'); } echo "<nucleusskin>\n"; // meta echo "\t<meta>\n"; // skins foreach ($this->skins as $skinId => $skinName) { $skinName = htmlspecialchars($skinName, ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET); } echo "\t\t" . '<skin name="' . htmlspecialchars($skinName, ENT_QUOTES) . '" />' . "\n"; } // templates foreach ($this->templates as $templateId => $templateName) { $templateName = htmlspecialchars($templateName, ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET); } echo "\t\t" . '<template name="' . htmlspecialchars($templateName, ENT_QUOTES) . '" />' . "\n"; } // extra info if ($this->info) { if (strtoupper(_CHARSET) != 'UTF-8') { $skin_info = mb_convert_encoding($this->info, 'UTF-8', _CHARSET); } else { $skin_info = $this->info; } echo "\t\t<info><![CDATA[" . $skin_info . "]]></info>\n"; } echo "\t</meta>\n\n\n"; // contents skins foreach ($this->skins as $skinId => $skinName) { $skinId = intval($skinId); $skinObj = new SKIN($skinId); $skinName = htmlspecialchars($skinName, ENT_QUOTES); $contentT = htmlspecialchars($skinObj->getContentType(), ENT_QUOTES); $incMode = htmlspecialchars($skinObj->getIncludeMode(), ENT_QUOTES); $incPrefx = htmlspecialchars($skinObj->getIncludePrefix(), ENT_QUOTES); $skinDesc = htmlspecialchars($skinObj->getDescription(), ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET); $contentT = mb_convert_encoding($contentT, 'UTF-8', _CHARSET); $incMode = mb_convert_encoding($incMode, 'UTF-8', _CHARSET); $incPrefx = mb_convert_encoding($incPrefx, 'UTF-8', _CHARSET); $skinDesc = mb_convert_encoding($skinDesc, 'UTF-8', _CHARSET); } echo "\t" . '<skin name="' . $skinName . '" type="' . $contentT . '" includeMode="' . $incMode . '" includePrefix="' . $incPrefx . '">' . "\n"; echo "\t\t" . '<description>' . $skinDesc . '</description>' . "\n"; $que = 'SELECT' . ' stype,' . ' scontent ' . 'FROM ' . sql_table('skin') . ' WHERE' . ' sdesc = ' . $skinId; $res = sql_query($que); while ($partObj = sql_fetch_object($res)) { $type = htmlspecialchars($partObj->stype, ENT_QUOTES); $cdata = $this->escapeCDATA($partObj->scontent); if (strtoupper(_CHARSET) != 'UTF-8') { $type = mb_convert_encoding($type, 'UTF-8', _CHARSET); $cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET); } echo "\t\t" . '<part name="' . $type . '">'; echo '<![CDATA[' . $cdata . ']]>'; echo "</part>\n\n"; } echo "\t</skin>\n\n\n"; } // contents templates foreach ($this->templates as $templateId => $templateName) { $templateId = intval($templateId); $templateName = htmlspecialchars($templateName, ENT_QUOTES); $templateDesc = htmlspecialchars(TEMPLATE::getDesc($templateId), ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET); $templateDesc = mb_convert_encoding($templateDesc, 'UTF-8', _CHARSET); } echo "\t" . '<template name="' . $templateName . '">' . "\n"; echo "\t\t" . '<description>' . $templateDesc . "</description>\n"; $que = 'SELECT' . ' tpartname,' . ' tcontent' . ' FROM ' . sql_table('template') . ' WHERE' . ' tdesc = ' . $templateId; $res = sql_query($que); while ($partObj = sql_fetch_object($res)) { $type = htmlspecialchars($partObj->tpartname, ENT_QUOTES); $cdata = $this->escapeCDATA($partObj->tcontent); if (strtoupper(_CHARSET) != 'UTF-8') { $type = mb_convert_encoding($type, 'UTF-8', _CHARSET); $cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET); } echo "\t\t" . '<part name="' . $type . '">'; echo '<![CDATA[' . $cdata . ']]>'; echo '</part>' . "\n\n"; } echo "\t</template>\n\n\n"; } echo '</nucleusskin>'; }
} else { // No inviter (open registration) $DB->query("SELECT MAX(TreeID) FROM invite_tree"); list($TreeID) = $DB->next_record(); $TreeID++; $InviterID = 0; $TreePosition=1; $TreeLevel=1; } // Create invite tree record $DB->query("INSERT INTO invite_tree (UserID, InviterID, TreePosition, TreeID, TreeLevel) VALUES ('$UserID', '$InviterID', '$TreePosition', '$TreeID', '$TreeLevel')"); include(SERVER_ROOT.'/classes/class_templates.php'); $TPL=NEW TEMPLATE; $TPL->open(SERVER_ROOT.'/templates/new_registration.tpl'); $TPL->set('Username',$_REQUEST['username']); $TPL->set('TorrentKey',$torrent_pass); $TPL->set('SITE_NAME',SITE_NAME); $TPL->set('SITE_URL',SITE_URL); send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply'); $Sent=1; } } elseif($_GET['invite']) { // If they haven't submitted the form, check to see if their invite is good $DB->query("SELECT InviteKey FROM invites WHERE InviteKey='".db_string($_GET['invite'])."'"); if($DB->record_count() == 0){
/** * Initiate a password reset * * @param int $UserID The user ID * @param string $Username The username * @param string $Email The email address */ public static function resetPassword($UserID, $Username, $Email) { $ResetKey = Users::make_secret(); G::$DB->query("\n\t\t\tUPDATE users_info\n\t\t\tSET\n\t\t\t\tResetKey = '" . db_string($ResetKey) . "',\n\t\t\t\tResetExpires = '" . time_plus(60 * 60) . "'\n\t\t\tWHERE UserID = '{$UserID}'"); require SERVER_ROOT . '/classes/templates.class.php'; $TPL = new TEMPLATE(); $TPL->open(SERVER_ROOT . '/templates/password_reset.tpl'); // Password reset template $TPL->set('Username', $Username); $TPL->set('ResetKey', $ResetKey); $TPL->set('IP', $_SERVER['REMOTE_ADDR']); $TPL->set('SITE_NAME', SITE_NAME); $TPL->set('SITE_URL', NONSSL_SITE_URL); Misc::send_email($Email, 'Password reset information for ' . SITE_NAME, $TPL->get(), 'noreply'); }
function createPopupCode($filename, $width, $height, $text = '') { global $CONF; // select private collection when no collection given if (!strstr($filename, '/')) { $filename = $this->currentItem->authorid . '/' . $filename; } $windowwidth = $width; $windowheight = $height; $vars['rawpopuplink'] = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename, ENT_QUOTES) . "&width={$width}&height={$height}&imagetext=" . urlencode(htmlspecialchars($text)); $vars['popupcode'] = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width={$windowwidth},height={$windowheight}');return false;"; $vars['popuptext'] = htmlspecialchars($text, ENT_QUOTES); $vars['popuplink'] = '<a href="' . $vars['rawpopuplink'] . '" onclick="' . $vars['popupcode'] . '" >' . $vars['popuptext'] . '</a>'; $vars['width'] = $width; $vars['height'] = $height; $vars['text'] = $text; $vars['link'] = htmlspecialchars($CONF['MediaURL'] . $filename, ENT_QUOTES); $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>'; echo TEMPLATE::fill($this->template['POPUP_CODE'], $vars); }
function doSkinVar($skinType, $type = 'list20/1/0/1/4') { // global $ecatid; // echo 'ecat='.$ecatid.'<br />'; // type[0]: type ( + amount (int)) // type[1]: $narrowMode (0/1/2) // type[2]: sortMode (1/2/3/4) // type[3]: Minimum font-sizem(em) 0.5/1/1.5/2... // type[4]: Maximum font-sizem(em) $maxtaglevel = $this->getOption('maxTagLevel'); $mintaglevel = $this->getOption('minTagLevel'); $taglevel = 1; // default if (empty($type)) { $type = 'list20/2/1/1/4'; } $type = explode('/', $type); if (preg_match('@list@i', $type[0])) { $amount = str_ireplace("list", "", $type[0]); $type[0] = 'list'; // keywords="TAG" } elseif (preg_match('@meta@i', $type[0])) { $amount = str_ireplace("meta", "", $type[0]); $type[0] = 'meta'; } // default amount $amount = !empty($amount) ? intval($amount) : 99999999; $defaultType = array('list', '1', '0', '1', '4'); $type = $type + $defaultType; $requestT = $this->getNoDecodeQuery('tag'); if (!empty($requestT)) { $requestT = rawurldecode($requestT); $requestTarray = $this->splitRequestTags($requestT); $reqAND = $requestTarray['and']; if ($requestTarray['or']) { $reqOR = $requestTarray['or']; } } switch ($type[0]) { case 'tag': if ($requestTarray) { $reqAndLink = array(); foreach ($reqAND as $val) { $reqAndLink[] = '<a href="' . $this->creatTagLink($val) . '" title="' . $val . '">' . $val . '</a>'; } $reqANDp = implode('" + "', $reqAndLink); if ($reqOR) { $reqOrLink = array(); foreach ($reqOR as $val) { $reqOrLink[] = '<a href="' . $this->creatTagLink($val) . '" title="' . $val . '">' . $val . '</a>'; } $reqORp = '"</u> or <u>"' . implode('"</u> or <u>"', $reqOrLink); } echo '<h1> Tag for <u>"' . $reqANDp . $reqORp . '"</u></h1>'; } break; // meta keywords="TAG" // and AWS keywords // meta keywords="TAG" // and AWS keywords case 'meta': global $manager, $itemid; $itemid = intval($itemid); if ($type[3] != 'ad') { echo '<meta name="keywords" content="'; $sep = ' '; } elseif ($type[3] == 'ad') { $sep = ' '; } if ($skinType == 'item') { $q = 'SELECT * FROM %s WHERE inum = %d'; $res = sql_query(sprintf($q, _TAGEX_TABLE, $itemid)); while ($o = sql_fetch_object($res)) { $temp_tags_array = preg_split("/[\n,]+/", trim($o->itags)); $temp_tags_count = count($temp_tags_array); for ($i = 0; $i < $temp_tags_count; $i++) { $tag = trim($temp_tags_array[$i]); $taglist[$i] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET); } } if ($taglist) { echo implode(' ', $taglist); } } else { if ($tags = $this->scanExistTags(intval($type[1]), $amount, intval($type[2]))) { $eachTag = array(); $t = 0; foreach ($tags as $tag => $inums) { $eachTag[$t] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET); $t++; } if ($type[3] != 'ad') { echo implode($sep, $eachTag); } elseif ($type[3] == 'ad') { $tag_str = implode($sep, $eachTag); } } } if ($type[3] != 'ad') { echo '" />'; } elseif ($type[3] == 'ad') { // $tag_str = mb_convert_encoding($tag_str, 'UTF-8', 'UTF-8'); $tag_str = urlencode($tag_str); echo $tag_str; } break; // TAG list(tag cloud) // TAG list(tag cloud) case 'list': $template['and'] = $this->getOption('and'); $template['or'] = $this->getOption('or'); $template['tagIndex'] = $this->getOption('tagIndex'); $template['tagItemHeader'] = $this->getOption('tagItemHeader'); $template['tagItem'] = $this->getOption('tagItem'); $template['tagItemSeparator'] = $this->getOption('tagItemSeparator'); $template['tagItemFooter'] = $this->getOption('tagItemFooter'); $template['tagIndexSeparator'] = $this->getOption('tagIndexSeparator'); if ($tags = $this->scanExistTags($type[1])) { if ($type[3] != $type[4]) { $minFontSize = min((double) $type[3], (double) $type[4]) - 0.5; $maxFontSize = max((double) $type[3], (double) $type[4]); $levelsum = ($maxFontSize - $minFontSize) / 0.5; $taglevelsum = $maxtaglevel - $mintaglevel; list($maxCount, $minCount) = $this->scanCount($tags); $eachCount = ceil(($maxCount - $minCount) / $levelsum); } $select = array(); if ($reqAND) { $req = $reqOR ? array_merge($reqAND, $reqOR) : $reqAND; foreach ($req as $tag) { if (array_key_exists($tag, $tags)) { $select = array_merge($select, $tags[$tag]); $selected = array_unique($select); } } } foreach ($tags as $tag => $inums) { if ($selected) { if (!in_array($tag, $req)) { // shiborikomi // if (!in_array($tag, $req) && !array_diff($tags[$tag], $selected)) { $tagCount[$tag] = count($inums); } } else { $tagCount[$tag] = count($inums); } } if ($tagCount) { arsort($tagCount); foreach ($tagCount as $k => $v) { $r[$k] = $tags[$k]; } unset($tags); if (count($r) > $amount) { $r = array_slice($r, 0, $amount); } $tags = array(); if (count($r) == 1) { $tags = $r; } else { $tags = $this->sortTags($r, intval($type[2])); } } else { echo 'No Tags'; return; } $eachTag = array(); $t = 0; foreach ($tags as $tag => $inums) { $tagitems = array(); $tagAmount = count($inums); if ($eachCount) { $fontlevel = ceil($tagAmount / $eachCount) * 0.5 + $minFontSize; } else { $fontlevel = 1; } if ($maxCount == $minCount) { //2008-05-22 Cacher $taglevel = 1; } else { $taglevel = round(($tagAmount - $minCount) / ($maxCount - $minCount) * $taglevelsum + $mintaglevel); } /// Item's name had TAGs $iids = array_slice($inums, 0, 4); sort($iids); $qQuery = ' SELECT ' . ' SUBSTRING(ititle, 1, 12) as short_title' . ' FROM ' . sql_table('item') . ' WHERE ' . ' inumber in (' . implode(',', $iids) . ') ' . 'ORDER BY ' . ' inumber'; $sTitles = sql_query($qQuery); $i = 0; while ($sTitle = sql_fetch_assoc($sTitles)) { $shortTitle = mb_convert_encoding($sTitle['short_title'], _CHARSET, _CHARSET); $shortTitle = htmlspecialchars($shortTitle, ENT_QUOTES, _CHARSET); $printData['tagItem'] = array('itemid' => intval($iids[$i]), 'itemtitle' => $shortTitle . '..'); $i++; $tagitems[] = TEMPLATE::fill($template['tagItem'], $printData['tagItem']); } $tagitem = implode($template['tagItemSeparator'], $tagitems) . '...etc.'; // Generate URL link to TAGs $and = $or = ''; /********************* * comment out this line when nodisplay selected TAGs */ // $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND; /*********************/ if ($req && !in_array($tag, $req)) { $printData['and'] = array('andurl' => $this->creatTagLink($tag, $type[1], $requestT, '+')); $printData['or'] = array('orurl' => $this->creatTagLink($tag, $type[1], $requestT, ':')); $and = TEMPLATE::fill($template['and'], $printData['and']); // insert URL to template $or = TEMPLATE::fill($template['or'], $printData['or']); } // insert data to template $printData['tagIndex'] = array('and' => $and, 'or' => $or, 'tag' => htmlspecialchars($tag, ENT_QUOTES, _CHARSET), 'tagamount' => $tagAmount, 'fontlevel' => $fontlevel, 'taglevel' => $taglevel, 'taglinkurl' => $this->creatTagLink($tag, intval($type[1])), 'tagitems' => $tagitem); $eachTag[$t] = TEMPLATE::fill($template['tagIndex'], $printData['tagIndex']); // format outputdata and data output $eachTag[$t] .= $template['tagItemHeader']; $eachTag[$t] .= $template['tagItemFooter']; $t++; } echo implode($template['tagIndexSeparator'] . "\n", $eachTag); } break; // show selected TAGs for <title></title> // show selected TAGs for <title></title> case 'title': if ($reqAND) { $req = $reqOR ? array_merge($reqAND, $reqOR) : $reqAND; $data = htmlspecialchars(implode('|', $req), ENT_QUOTES, _CHARSET); echo ' : Selected Tag(s) » "' . $data . '"'; } break; default: break; } // end of switch(type) }
/** * GetInstance * @return mixed Returns a handle to the front end template instance. */ public function GetInstance() { if(!self::$instance) { $frontEndTemplate = new TEMPLATE('ISC_LANG'); $frontEndTemplate->frontEnd(); $frontEndTemplate->setTemplateBase(ISC_BASE_PATH . '/templates'); $frontEndTemplate->panelPHPDir = ISC_BASE_PATH . '/includes/display/'; $frontEndTemplate->templateExt = 'html'; $frontEndTemplate->setTemplate(getConfig('template')); self::$instance = $frontEndTemplate; } return self::$instance; }
exit; } } } } } // not cookie, no sso if (!isset($w->sess_id)) { require INC_DIR . '/func.php'; require LIB_DIR . '/class_file.php'; // cache + template require LIB_DIR . '/class_template.php'; $o->lang = $w->lang; $o->mid_content = VOID; load_translations($w->lang, $l); $t = new TEMPLATE(); $t->debug = $w->debug; $t->translations = $l; // keelemuutujad templeidile nähtavaks. keelekontroll on config.php's //echo "<!--"; //echo $auth_method; //print_r($w); //echo "-->"; if (!$authok) { switch ($auth_method) { case 'sso': if ($w->allow_sso) { require INC_DIR . '/sso.php'; } break; case 'mid':
/** * Called from e.g. the commentform-notloggedin.template file, at the time * a comment form is included. We'll add HTML code to insert the captcha image */ function event_FormExtra(&$data) { switch ($data['type']) { case 'commentform-notloggedin': // anonymous comments // anonymous comments case 'membermailform-notloggedin': // anonymous message to site member // anonymous message to site member case 'activation': // activation or re-activation of member account break; default: return; } // initialize on first call if (!$this->inited) { $this->init_captcha(); } // don't do anything when no GD libraries are available if (!$this->isAvailable()) { return; } // create captcha key. This key is required to // // 1. create the captcha image // 2. check the validity of the entered solution $key = $this->generateKey(); $aVars = array('imgHtml' => $this->generateImgHtml($key), 'key' => htmlspecialchars($key, ENT_QUOTES, _CHARSET)); switch ($data['type']) { case 'activation': echo TEMPLATE::fill($this->getOption('ActivationHtml'), $aVars); break; case 'commentform-notloggedin': echo TEMPLATE::fill($this->getOption('CommentFormHtml'), $aVars); break; case 'membermailform-notloggedin': echo TEMPLATE::fill($this->getOption('MemberMailHtml'), $aVars); break; } }
/** * Parse skinvar preview */ function parse_preview($template) { global $blog, $CONF, $manager; $template =& $manager->getTemplate($template); $row['body'] = '<span id="prevbody"></span>'; $row['title'] = '<span id="prevtitle"></span>'; $row['more'] = '<span id="prevmore"></span>'; $row['itemlink'] = ''; $row['itemid'] = 0; $row['blogid'] = $blog->getID(); echo TEMPLATE::fill($template['ITEM_HEADER'], $row); echo TEMPLATE::fill($template['ITEM'], $row); echo TEMPLATE::fill($template['ITEM_FOOTER'], $row); }
} else { $Validate->SetFields('email', '1', 'email', 'You entered an invalid email address.'); if (!empty($_REQUEST['email'])) { // User has entered email and submitted form $Err = $Validate->ValidateForm($_REQUEST); if (!$Err) { // Form validates correctly $DB->query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tID,\n\t\t\t\t\t\tUsername,\n\t\t\t\t\t\tEmail\n\t\t\t\t\tFROM users_main\n\t\t\t\t\tWHERE Email = '" . db_string($_REQUEST['email']) . "'\n\t\t\t\t\t\tAND Enabled = '1'"); list($UserID, $Username, $Email) = $DB->next_record(); if ($UserID) { // Email exists in the database // Set ResetKey, send out email, and set $Sent to 1 to show success page $ResetKey = Users::make_secret(); $DB->query("\n\t\t\t\t\t\tUPDATE users_info\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tResetKey = '" . db_string($ResetKey) . "',\n\t\t\t\t\t\t\tResetExpires = '" . time_plus(60 * 60) . "'\n\t\t\t\t\t\tWHERE UserID = '{$UserID}'"); require SERVER_ROOT . '/classes/templates.class.php'; $TPL = new TEMPLATE(); $TPL->open(SERVER_ROOT . '/templates/password_reset.tpl'); // Password reset template $TPL->set('Username', $Username); $TPL->set('ResetKey', $ResetKey); $TPL->set('IP', $_SERVER['REMOTE_ADDR']); $TPL->set('SITE_NAME', SITE_NAME); $TPL->set('SITE_URL', NONSSL_SITE_URL); Misc::send_email($Email, 'Password reset information for ' . SITE_NAME, $TPL->get(), 'noreply'); $Sent = 1; // If $Sent is 1, recover_step1.php displays a success message //Log out all of the users current sessions $Cache->delete_value("user_info_{$UserID}"); $Cache->delete_value("user_info_heavy_{$UserID}"); $Cache->delete_value("user_stats_{$UserID}"); $Cache->delete_value("enabled_{$UserID}");
public function ManageLayouts($MsgDesc = "", $MsgStatus = "", $template = "") { $output = ''; if(isset($_REQUEST['forceTab'])) { $GLOBALS['ForceTab'] = (int)$_REQUEST['forceTab']; } $opener = new connect_remote(); if ($opener->CanOpen()) { $GLOBALS['FopenSupport'] = true; } else { $GLOBALS['FopenSupport'] = false; } $GLOBALS['CurrentTemplateName'] = GetConfig('template'); $GLOBALS['CurrentTemplateNameProper'] = ucfirst(GetConfig('template')); $GLOBALS['CurrentTemplateColor'] = GetConfig('SiteColor'); $GLOBALS['StoreLogo'] = GetConfig('StoreLogo'); $GLOBALS['siteName'] = GetConfig('StoreName'); $this->LoadChooseTemplateTab(); $this->LoadDownloadTemplates(); $this->LoadLogoTab(); if(file_exists(ISC_BASE_PATH . '/templates/'. GetConfig('template') . '/config.php')) { include(ISC_BASE_PATH . '/templates/'. GetConfig('template') . '/config.php'); if(isset($GLOBALS['TPL_CFG']['GenerateLogo']) && $GLOBALS['TPL_CFG']['GenerateLogo'] === true) { $GLOBALS['CurrentTemplateHasLogoOption'] = 'true'; } else { $GLOBALS['CurrentTemplateHasLogoOption'] = 'false'; } } if(GetConfig('DisableTemplateDownloading')) { $GLOBALS['HideDownloadTab'] = 'none'; } $GLOBALS['TemplateVersion'] = '1.0'; if(isset($GLOBALS['TPL_CFG']['Version'])) { $GLOBALS['TemplateVersion'] = $GLOBALS['TPL_CFG']['Version']; } $GLOBALS['LayoutIntro'] = GetLang('TemplateIntro'); $GLOBALS['DesignModeToken'] = isc_html_escape($_COOKIE['STORESUITE_CP_TOKEN']); $GLOBALS['Message'] = ''; if ($MsgDesc != "") { $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus); } $flashMessages = GetFlashMessages(); if(is_array($flashMessages)) { foreach($flashMessages as $flashMessage) { $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']); } } // Get the getting started box if we need to $GLOBALS['GettingStartedStep'] = ''; if(empty($GLOBALS['Message']) && (isset($_GET['wizard']) && $_GET['wizard']==1) && !in_array('design', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) { $GLOBALS['GettingStartedTitle'] = GetLang('DesignYourStore'); $GLOBALS['GettingStartedContent'] = GetLang('DesignYourStoreDesc'); $GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html'); } // Mark the design step as complete GetClass('ISC_ADMIN_ENGINE')->MarkGettingStartedComplete('design'); if(!function_exists("gzdeflate")) { // No zlib - they can't download templates automatically $GLOBALS['HideDownloadMessage'] = "none"; $GLOBALS['NoZLibMessage'] = MessageBox(GetLang('NoZLibInstalled'), MSG_ERROR); } else { // They have zlib - hide the zlib error message $GLOBALS['HideNoZLib'] = "none"; } if(!$this->safeMode) { $GLOBALS['HideSafeModeMessage'] = 'display: none'; } // Mobile template settings tab $validSettings = array( 'enableMobileTemplate', 'enableMobileTemplateDevices', 'mobileTemplateLogo', ); $mobileSettings = array(); foreach($validSettings as $setting) { $mobileSettings[$setting] = getConfig($setting); } $this->template->assign('mobileSettings', $mobileSettings); require_once ISC_BASE_PATH.'/lib/templates/template.php'; $phoneTemplateConfig = TEMPLATE::getTemplateConfiguration('__mobile'); $this->template->assign('phoneLogoDimensions', array( 'width' => $phoneTemplateConfig['LogoWidth'], 'height' => $phoneTemplateConfig['LogoHeight'] )); // Gift certificates tab if(GetConfig('EnableGiftCertificates')) { $GLOBALS['GiftCertificateThemes'] = ISC_GIFTCERTIFICATE_THEME::findAll(); } // Load the email templates $GLOBALS['EmailTemplatesGrid'] = $this->GetEmailTemplateRows(); $GLOBALS['TemplatesOrderCustomURL'] = GetConfig('TemplatesOrderCustomURL'); // Load a temporary editor to use for editing email templates $wysiwygOptions = array( 'id' => 'temp_email_editor', 'delayLoad' => true ); $GLOBALS['TemporaryEditor'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['Favicon'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . GetConfig('Favicon'); $this->template->display('layout.manage.tpl'); }
function createFromName($name) { return new TEMPLATE(TEMPLATE::getIdFromName($name)); }
function RegistPath($objID, $path, $bid, $oParam, $name, $new = FALSE) { global $CONF; switch ($oParam) { case 'item': case 'member': if (preg_match('/.html$/', $path)) { $path = substr($path, 0, -5); } break; case 'blog': case 'category': case 'subcategory': break; default: return; break; } $bid = intval($bid); $objID = intval($objID); $name = rawurlencode($name); if ($new && $oParam == 'item') { $tque = 'SELECT itime as result FROM %s WHERE inumber = %d'; $itime = quickQuery(sprintf($tque, sql_table('item'), $objID)); list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s'); $param['year'] = sprintf('%04d', $y); $param['month'] = sprintf('%02d', $m); $param['day'] = sprintf('%02d', $d); $dfItem = $this->getOption('customurl_dfitem'); $ikey = TEMPLATE::fill($dfItem, $param); if ($path == $ikey) { $path = $ikey . '_' . $objID; } } elseif (!$new && strlen($path) == 0) { $del_que = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"'; sql_query(sprintf($del_que, _CUSTOMURL_TABLE, $objID, $oParam)); $msg = array(0, _DELETE_PATH, $name, _DELETE_MSG); return $msg; exit; } $dotslash = array('.', '/'); $path = str_replace($dotslash, '_', $path); if (!preg_match('/^[-_a-zA-Z0-9]+$/', $path)) { $msg = array(1, _INVALID_ERROR, $name, _INVALID_MSG); return $msg; exit; } $tempPath = $path; if ($oParam == 'item' || $oParam == 'member') { $tempPath .= '.html'; } $conf_que = 'SELECT obj_id FROM %s' . ' WHERE obj_name = "%s"' . ' AND obj_bid = %d' . ' AND obj_param = "%s"' . ' AND obj_id != %d'; $res = sql_query(sprintf($conf_que, _CUSTOMURL_TABLE, $tempPath, $bid, $oParam, $objID)); if ($res && sql_num_rows($res)) { $msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG); $path .= '_' . $objID; } if ($oParam == 'category' && !$msg) { $conf_cat = 'SELECT obj_id FROM %s WHERE obj_name = "%s"' . ' AND obj_param = "blog"'; $res = sql_query(sprintf($conf_cat, _CUSTOMURL_TABLE, $tempPath)); if ($res && sql_num_rows($res)) { $msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG); $path .= '_' . $objID; } } if ($oParam == 'blog' && !$msg) { $conf_blg = 'SELECT obj_id FROM %s WHERE obj_name = "%s"' . ' AND obj_param = "category"'; $res = sql_query(sprintf($conf_blg, _CUSTOMURL_TABLE, $tempPath)); if ($res && sql_num_rows($res)) { $msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG); $path .= '_' . $objID; } } $newPath = $path; if ($oParam == 'item' || $oParam == 'member') { $newPath .= '.html'; } $query = 'SELECT * FROM %s WHERE obj_id = %d AND obj_param = "%s"'; $res = sql_query(sprintf($query, _CUSTOMURL_TABLE, $objID, $oParam)); $row = sql_fetch_object($res); $pathID = $row->id; if ($pathID) { $query = 'UPDATE %s SET obj_name = "%s" WHERE id = %d'; sql_query(sprintf($query, _CUSTOMURL_TABLE, $newPath, $pathID)); } else { $query = 'INSERT INTO %s (obj_param, obj_name, obj_id, obj_bid)' . ' VALUES ("%s", "%s", %d, %d)'; sql_query(sprintf($query, _CUSTOMURL_TABLE, $oParam, $newPath, $objID, $bid)); } switch ($oParam) { case 'blog': $this->setBlogOption($objID, 'customurl_bname', $path); break; case 'category': $this->setCategoryOption($objID, 'customurl_cname', $path); break; case 'member': $this->setMemberOption($objID, 'customurl_mname', $path); break; default: break; } return $msg; }
function doSkinVar($skinType, $numberOfWritebacks = 5, $filter = '', $TBorCm = 'all', $numberOfCharacters = 60, $numberOfTitleCharacters = 40, $toadd = "...") { global $manager, $CONF, $blog; if (!is_numeric($numberOfWritebacks)) { $filter = $numberOfWritebacks; $numberOfWritebacks = 5; // defaults to 5 } $b =& $manager->getBlog($CONF['DefaultBlog']); $this->defaultblogurl = $b->getURL(); if (!$this->defaultblogurl) { $this->defaultblogurl = $CONF['IndexURL']; } if ($blog) { $b =& $blog; } $blogid = $b->getID(); //for select $filter = trim($filter); if ($filter == 'current') { $filter = 'cblog = ' . $blogid; } elseif (strstr($filter, '=')) { $filter = str_replace('=', '', $filter); $filter = ' cblog IN(' . str_replace('/', ',', $filter) . ')'; } elseif (strstr($filter, '<>')) { $filter = str_replace('<>', '', $filter); $filter = ' cblog <> ' . str_replace('/', ' AND cblog <> ', $filter); } setlocale(LC_TIME, $this->getOption('timelocale')); $arr_res = array(); if ($TBorCm != 't') { $join = ''; $query = 'SELECT' . ' c.cnumber as commentid,' . ' c.cuser as commentator,' . ' c.cbody as commentbody,' . ' c.citem as itemid,' . ' c.cmember as memberid,' . ' SUBSTRING(c.ctime, 6, 5) as commentday,' . ' UNIX_TIMESTAMP(c.ctime) as ctimest'; if ($EzComment2 = $this->pluginCheck('EzComment2')) { if (method_exists($EzComment2, 'getTemplateParts')) { $query .= ', s.comid as cid, ' . 's.secflg as secret, ' . 's.module as modname, ' . 's.userID as identity '; $join = ' LEFT OUTER JOIN ' . sql_table('plug_ezcomment2') . ' as s ' . ' ON c.cnumber = s.comid '; } } // select $query .= ' FROM ' . sql_table('comment') . ' as c ' . $join; if ($filter) { $query .= ' WHERE ' . $filter; } $query .= ' ORDER by c.ctime DESC LIMIT 0, ' . $numberOfWritebacks; $comments = sql_query($query); if (sql_num_rows($comments)) { while ($row = sql_fetch_object($comments)) { $content = (array) $row; $tempBody = strip_tags($content['commentbody']); $tempBody = htmlspecialchars($tempBody, ENT_QUOTES, _CHARSET); $tempBody = shorten($tempBody, $numberOfCharacters, $toadd); $tempBody = htmlspecialchars($tempBody, ENT_QUOTES, _CHARSET); $tempBody = str_replace("\r\n", ' ', $tempBody); $tempBody = str_replace("&", '&', $tempBody); $tempBody = str_replace(">", '>', $tempBody); $tempBody = str_replace("<", '<', $tempBody); $content['commentdate'] = strftime($this->getOption('cmdateformat'), $content['ctimest']); $content['commentbody'] = str_replace("&amp;", '&', $tempBody); if (!empty($row->memberid)) { $mem = new MEMBER(); $mem->readFromID(intval($row->memberid)); $content['commentator'] = $mem->getRealName(); } if ($EzComment2) { $bid = intval(getBlogIDFromItemID(intval($comment['itemid']))); if ($EzComment2->getBlogOption($bid, 'secret') == 'yes') { $b = $manager->getBlog($bid); global $member; $judge = $EzComment2->setSecretJudge($bid, $member, $b); } } if ($judge && $content['secret']) { $content = $EzComment2->JudgementCommentSecrets($content, $judge); } /* $cid = $row->cnumber; $ct = $row->ctimest; $ctst = date("y-m-d H:i",$ct); $text = strip_tags($row->cbody); $text = htmlspecialchars($text, ENT_QUOTES,_CHARSET); $ctext = shorten($text,$numberOfCharacters,$toadd); if (!$row->cmember) $myname = $row->cuser; else { $mem = new MEMBER; $mem->readFromID(intval($row->cmember)); $myname = $mem->getRealName(); }*/ // $itemlink = $this->_createItemLink($row->citem, ''); // $arr_res[$ct] = "<li>♣<a href=\"".$itemlink."#c".$cid."\">$ctst|".$myname.">".$ctext."</a></li>" ; $itemlink = $this->_createItemLink($content['itemid']); $content['itemlink'] = $itemlink; $arr_res[$content['ctimest']] = TEMPLATE::fill($this->getOption('cmttemplate'), $content); } } } //========================= if ($manager->pluginInstalled('NP_TrackBack') && $TBorCm != 'c') { $query = 'SELECT' . ' t.id as tbid,' . ' t.title as entrytitle,' . ' t.excerpt as expect,' . ' t.url as tburl,' . ' t.tb_id as trackbackid,' . ' t.blog_name as blogname,' . ' t.timestamp as tbdate,' . ' SUBSTRING(t.timestamp, 6, 5) as tbday,' . ' UNIX_TIMESTAMP(t.timestamp) as ttimest' . ' FROM ' . sql_table('plugin_tb') . ' t,' . sql_table('item') . ' i' . ' WHERE t.tb_id = i.inumber'; if ($this->checkTBVersion()) { $query .= ' and t.block = 0'; } if ($filter) { $tfilter = str_replace('c.cblog', 'i.iblog', $filter); $query .= ' and ' . $tfilter; } $query .= ' ORDER by t.timestamp DESC LIMIT 0, ' . $numberOfWritebacks; $comments = sql_query($query); if (sql_num_rows($comments)) { while ($row = sql_fetch_object($comments)) { $content = (array) $row; $entrytitle = strip_tags($content['entrytitle']); $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES, _CHARSET); $entrytitle = shorten($entrytitle, $numberOfCharacters, $toadd); $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES, _CHARSET); $content['entrytitle'] = $entrytitle; $content['expect'] = str_replace("\r\n", ' ', $content['expect']); $blogname = htmlspecialchars($content['blogname'], ENT_QUOTES, _CHARSET); $content['blogname'] = $blogname; $content['tbdate'] = strftime($this->getOption('tbdateformat'), $content['ttimest']); /* $title = strip_tags($row->title); $title = htmlspecialchars($title, ENT_QUOTES,_CHARSET); $ctitle = shorten($title,$numberOfCharacters,$toadd); $blogname = htmlspecialchars($row->blog_name, ENT_QUOTES,_CHARSET); $tbtime = $row->ttimest; $ttst = date("y-m-d H:i",$tbtime);*/ // $itemlink = $this->_createItemLink($row->tb_id, ''); // $arr_res[$tbtime] = '<li>…<a href="'.$itemlink.'#trackback">'.$ttst.'|'.$blogname.' ping: "'.$ctitle.'"</a></li>'; $itemlink = $this->_createItemLink($content['trackbackid']); $content['itemlink'] = $itemlink; $arr_res[$content['ttimest']] = TEMPLATE::fill($this->getOption('tbktemplate'), $content); } } } //========================= krsort($arr_res); $ress = array_values($arr_res); $show_rescnt = min(intval($numberOfWritebacks), count($arr_res)); switch ($TBorCm) { case 'c': $head = $this->getOption('cmlisthead'); $foot = $this->getOption('cmlistfoot'); break; case 't': $head = $this->getOption('tblisthead'); $foot = $this->getOption('tblistfoot'); break; default: $head = ' <ul class="nobullets"> '; $foot = ' </ul> '; break; } // echo ' <ul class="nobullets"> '; echo $head; for ($j = 0; $j < $show_rescnt; $j++) { echo $ress[$j] . "\n"; } echo $foot; // echo " </ul> "; }
/** * Given some details, generate a printable packing slip. * * @param string $title Title of the packing slip. * @param array $details Array of details about the packing slip. * @param array $products Array of products for the packing slip. * @return string Generated HTML packing slip. */ function generatePrintablePackingSlip($title, $details, $products) { $db = $GLOBALS['ISC_CLASS_DB']; $template = new TEMPLATE('ISC_LANG'); $template->frontEnd(); $template->setTemplateBase(ISC_BASE_PATH . "/templates"); $template->panelPHPDir = ISC_BASE_PATH . "/includes/display/"; $template->templateExt = "html"; $template->setTemplate(getConfig("template")); $template->assign('PackingSlipTitle', $title); $template->assign('OrderId', $details['shiporderid']); $template->assign('OrderDate', cdate($details['shiporderdate'])); if(!empty($details['shipmethod'])) { $template->assign('ShippingMethod', isc_html_escape($details['shipmethod'])); } else { $template->assign('HideShippingMethod', 'display: none'); } if(!empty($details['shiptrackno'])) { $template->assign('TrackingNo', isc_html_escape($details['shiptrackno'])); } else { $template->assign('HideTrackingNo', 'display: none'); } if(!empty($details['shipcomments'])) { $template->assign('Comments', nl2br(isc_html_escape($details['shipcomments']))); $template->assign('HideComments', ''); } else { $template->assign('Comments', ''); $template->assign('HideComments', 'display: none'); } if(!empty($details['shipdate'])) { $template->assign('DateShipped', cDate($details['shipdate'])); } else { $template->assign('HideShippingDate', 'display: none'); } if(empty($products)) { return false; } $query = " SELECT customerid, CONCAT(custconfirstname, ' ', custconlastname) AS ordcustname, custconemail AS ordcustemail, custconphone AS ordcustphone FROM [|PREFIX|]customers WHERE customerid = '".$db->Quote($details['shipcustid'])."' "; $query .= $db->AddLimit(0, 1); $result = $db->Query($query); $template->assign('CustomerName', ''); $template->assign('CustomerEmail', ''); $template->assign('CustomerPhone', ''); if($customer = $db->Fetch($result)) { // Format the customer details $template->assign('CustomerName', isc_html_escape($customer['ordcustname'])); $template->assign('CustomerEmail', isc_html_escape($customer['ordcustemail'])); $template->assign('CuastomerPhone', isc_html_escape($customer['ordcustphone'])); $template->assign('CustomerId', $customer['customerid']); } else { $template->assign('HideCustomerDetails', 'display: none'); } $template->assign('StoreAddressFormatted', nl2br(GetConfig('StoreAddress'))); $addressDetails = array( 'shipfirstname' => $details['shipbillfirstname'], 'shiplastname' => $details['shipbilllastname'], 'shipcompany' => $details['shipbillcompany'], 'shipaddress1' => $details['shipbillstreet1'], 'shipaddress2' => $details['shipbillstreet2'], 'shipcity' => $details['shipbillsuburb'], 'shipstate' => $details['shipbillstate'], 'shipzip' => $details['shipbillzip'], 'shipcountry' => $details['shipbillcountry'], 'countrycode' => $details['shipbillcountrycode'], ); $template->assign('BillingAddress', ISC_ADMIN_ORDERS::buildOrderAddressDetails($addressDetails, false)); $template->assign('BillingPhone', isc_html_escape($details['shipbillphone'])); if(!$details['shipbillphone']) { $template->assign('HideBillingPhone', 'display: none'); } $template->assign('BillingEmail', isc_html_escape($details['shipbillemail'])); if(!$details['shipbillemail']) { $template->assign('HideBillingEmail', 'display: none'); } $addressDetails = array( 'shipfirstname' => $details['shipshipfirstname'], 'shiplastname' => $details['shipshiplastname'], 'shipcompany' => $details['shipshipcompany'], 'shipaddress1' => $details['shipshipstreet1'], 'shipaddress2' => $details['shipshipstreet2'], 'shipcity' => $details['shipshipsuburb'], 'shipstate' => $details['shipshipstate'], 'shipzip' => $details['shipshipzip'], 'shipcountry' => $details['shipshipcountry'], 'countrycode' => $details['shipshipcountrycode'], ); $template->assign('ShippingAddress', ISC_ADMIN_ORDERS::buildOrderAddressDetails($addressDetails, false)); $template->assign('ShippingPhone', isc_html_escape($details['shipshipphone'])); if(!$details['shipshipphone']) { $template->assign('HideShippingPhone', 'display: none'); } $template->assign('ShippingEmail', isc_html_escape($details['shipshipemail'])); if(!$details['shipshipemail']) { $template->assign('HideShippingEmail', 'display: none'); } $fieldsArray = array(); $query = " SELECT o.* FROM [|PREFIX|]order_configurable_fields o JOIN [|PREFIX|]product_configurable_fields p ON o.fieldid = p.productfieldid WHERE o.orderid=".(int)$details['shiporderid']." ORDER BY p.fieldsortorder ASC "; $result = $db->Query($query); $fields = array(); while ($row = $db->Fetch($result)) { $fieldsArray[$row['ordprodid']][] = $row; } // Build the list of products that are being shipped $productsTable = ''; foreach($products as $product) { $template->assign('ProductName', isc_html_escape($product['prodname'])); if($product['prodcode']) { $template->assign('ProductSku', isc_html_escape($product['prodcode'])); } else { $template->assign('ProductSku', getLang('NA')); } $template->assign('ProductQuantity', $product['prodqty']); $pOptions = ''; if($product['prodoptions'] != '') { $options = @unserialize($product['prodoptions']); if(!empty($options)) { foreach($options as $name => $value) { $template->assign('FieldName', isc_html_escape($name)); $template->assign('FieldValue', isc_html_escape($value)); $pOptions .= $template->GetSnippet('PrintableInvoiceItemConfigurableField'); } } } if($pOptions) { $template->assign('ProductOptions', $pOptions); $template->assign('HideVariationOptions', ''); } else { $template->assign('HideVariationOptions', 'display: none'); } $productFields = ''; if(!empty($fieldsArray[$product['prodordprodid']])) { $fields = $fieldsArray[$product['prodordprodid']]; foreach($fields as $field) { if(empty($field['textcontents']) && empty($field['filename'])) { continue; } $fieldValue = '-'; $template->assign('FieldName', isc_html_escape($field['fieldname'])); if($field['fieldtype'] == 'file') { $fieldValue = '<a href="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/configured_products/'.urlencode($field['originalfilename']).'">'.isc_html_escape($field['originalfilename']).'</a>'; } else { $fieldValue = isc_html_escape($field['textcontents']); } $template->assign('FieldValue', $fieldValue); $productFields .= $template->getSnippet('PrintableInvoiceItemConfigurableField'); } } $template->assign('ProductConfigurableFields', $productFields); if(!$productFields) { $template->assign('HideConfigurableFields', 'display: none'); } else { $template->assign('HideConfigurableFields', ''); } if($product['prodeventdatename']) { $template->assign('FieldName', isc_html_escape($product['prodeventdatename'])); $template->assign('FieldValue', isc_date('dS M Y', $product['prodeventdate'])); $template->assign('ProductEventDate', $template->getSnippet('PrintableInvoiceItemConfigurableField')); $template->assign('HideEventDate', ''); } else { $template->assign('ProductEventDate', ''); $template->assign('HideEventDate', 'display: none'); } $productsTable .= $template->GetSnippet('PrintablePackingSlipItem'); } $template->assign('ProductsTable', $productsTable); $template->setTemplate('packing_slip_print'); return $template->parseTemplate(true); }
/** * Fetch the email template parser and return it. * * @return The TEMPLATE class configured for sending emails. */ function FetchEmailTemplateParser() { static $emailTemplate; if (!$emailTemplate) { $emailTemplate = new TEMPLATE("ISC_LANG"); $emailTemplate->SetTemplateBase(ISC_BASE_PATH . "/templates/__emails/"); $emailTemplate->panelPHPDir = ISC_BASE_PATH . '/includes/Panels/'; $emailTemplate->templateExt = 'html'; } return $emailTemplate; }
/** * Returns a previously read template */ function &getTemplate($templateName) { $template =& $this->templates[$templateName]; if (!$template) { $template = TEMPLATE::read($templateName); $this->templates[$templateName] =& $template; } return $template; }