/** * instantiate a User object * * @param int $id the user id * @param array $r a pre-defined array to fill in the values * @param boolean $enabled whether to only instantiate users that are enabled * * @return null */ function __construct($id, $r = false, $enabled = true) { $id = (int) $id; if (!$id) { return; } $filter = $enabled ? ' and active' : ''; if (!$r) { $r = Core_cacheLoad('user_accounts', $id . '|' . $filter, -1); if ($r === -1) { $r = dbRow("select * from user_accounts where id={$id} {$filter} limit 1"); Core_cacheSave('user_accounts', $id . '|' . $filter, $r); } } if (!count($r) || !is_array($r)) { return false; } foreach ($r as $k => $val) { $this->{$k} = $val; } if (!isset($this->id)) { return false; } $this->dbVals = $r; self::$instances[$this->id] =& $this; }
function show_banner($vars) { $banner = false; if (!is_array($vars) && @$vars->id) { $b = Core_cacheLoad('banner-images', 'id' . $vars->id); if ($b === false) { $b = dbRow('select * from banners_images where id=' . $vars->id); if ($b && count($b) && !$b['html']) { $b['html'] = BannerImage_getImgHtml($vars->id); dbQuery('update banners_pages set html="' . addslashes($b['html']) . '" where id=' . $vars->id); } Core_cacheSave('banner-images', 'id' . $vars->id, $b); } } elseif ($GLOBALS['PAGEDATA']->id) { $b = Core_cacheLoad('banner-images', 'bypage' . $GLOBALS['PAGEDATA']->id); if ($b === false) { $b = dbAll('select * from banners_pages,banners_images where pageid=' . $GLOBALS['PAGEDATA']->id . ' and bannerid=id'); Core_cacheSave('banner-images', 'bypage' . $GLOBALS['PAGEDATA']->id, $b); } $i = rand(0, count($b) - 1); $b = isset($b[$i]) ? $b[$i] : false; if ($b && count($b) && !$b['html']) { $b['html'] = BannerImage_getImgHtml($b['id']); dbQuery('update banners_pages set html="' . addslashes($b['html']) . '" where id=' . $b['id']); } } if (!isset($b) || $b === false || !count($b)) { $b = Core_cacheLoad('banner-image', 'all'); if ($b === false) { $b = dbAll('select * from banners_images'); Core_cacheSave('banner-image', 'all', $b); } $i = rand(0, count($b) - 1); $b = isset($b[$i]) ? $b[$i] : false; } if ($b && count($b)) { $banner = $b['html']; if (!$banner) { $banner = BannerImage_getImgHtml($vars->id); } } if (!$banner) { if (is_array($vars) && @$vars['default']) { $banner = $vars['default']; } else { $banner = ''; } } if (!$banner) { return ''; } return '<style type="text/css">#banner{background:none}</style>' . $banner; }
function Menu_getHtml() { global $DBVARS; require_once SCRIPTBASE . 'ww.incs/menus.php'; require_once SCRIPTBASE . 'ww.incs/common.php'; $vars = null; if (isset($_REQUEST['vars'])) { $vars = json_decode($_REQUEST['vars']); } if ($vars && isset($vars->id) && $vars->id) { $id = $vars->id; $vars = Core_cacheLoad('menus', $id, -1); if ($vars === -1) { $vars = dbRow('select * from menus where id=' . $id); Core_cacheSave('menus', $id, $vars); } if ($vars['cache']) { header('Cache-Control: max-age=' . $vars['cache'] . ', public'); header('Expires: Fri, 1 Jan 2500 01:01:01 GMT'); header('Expires-Active: On'); header('Pragma:'); header('Last-modified: ' . gmdate('D, d M Y H:i:s', time())); } if ($vars['parent'] == '-1') { global $PAGEDATA; $pid = $PAGEDATA->id; if ($pid) { $n = dbOne('select id from pages where parent=' . $pid . ' limit 1', id); if (!$n) { $pid = (int) $PAGEDATA->parent; if (!$pid) { return ''; } } } $vars['parent'] = $pid; } } header('Content-type: text/javascript'); echo 'document.write("' . addslashes(Core_menuShowFg($vars)) . '");'; echo join(';', $GLOBALS['scripts_inline']); $cdn = isset($DBVARS['cdn']) ? '//' . $DBVARS['cdn'] : ''; foreach ($GLOBALS['scripts'] as $r) { echo 'document.write("<script src=\\"' . $cdn . $r . '\\"></script>");'; } foreach ($GLOBALS['css_urls'] as $r) { echo 'document.write("<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"' . $cdn . $r . '\\"/>");'; } exit; }
/** * show the news in Headline mode * * @param array $PAGEDATA the page object * * @return string HTML of the news */ function News_displayHeadlines($PAGEDATA) { $items_per_page = isset($PAGEDATA->vars['news_items']) ? $PAGEDATA->vars['news_items'] : 5; $p = isset($_REQUEST['news_page']) ? (int) $_REQUEST['news_page'] : 0; if ($p < 0) { $p = 0; } $arr = Core_cacheLoad('pages', 'news-' . $GLOBALS['id'] . '-' . $p . '-' . $items_per_page); if ($arr === false) { $order_by = isset($PAGEDATA->vars['news_order']) ? addslashes($PAGEDATA->vars['news_order']) : 'associated_date desc'; $rs = dbAll('select * from pages where parent=' . $GLOBALS['id'] . ' order by ' . $order_by . ',cdate desc limit ' . $p . ',' . $items_per_page); $num_stories = dbOne('select count(id) as num from pages where parent=' . $GLOBALS['id'], 'num'); Core_cacheSave('pages', 'news-' . $GLOBALS['id'] . '-' . $p . '-' . $items_per_page, array($num_stories, $rs)); } else { $num_stories = $arr[0]; $rs = $arr[1]; unset($arr); } $nextprev = array(); $nextprev[] = '<span class="page_n_of_n">' . __('page %1 of %2', array(1 + floor($p / $items_per_page), ceil($num_stories / $items_per_page)), 'core') . '</span>'; if ($p) { $nextprev[] = '<a class="prev" href="?news_page=' . ($p - $items_per_page) . '">' . __('Previous Page') . '</a>'; } if ($p + $items_per_page < $num_stories) { $nextprev[] = '<a class="next" href="?news_page=' . ($p + $items_per_page) . '">' . __('Next Page') . '</a>'; } $nextprev = '<div class="nextprev">' . join(' | ', $nextprev) . '</div>'; $html = $nextprev; $links = array(); foreach ($rs as $r) { $page = Page::getInstance($r['id'], $r); $content = isset($PAGEDATA->vars['news_display']) && $PAGEDATA->vars['news_display'] == 'full' ? $page->render() : substr(preg_replace('/<[^>]*>/', '', preg_replace('#<h1>[^<]*</h1>#', '', $page->render())), 0, 600); $date = isset($PAGEDATA->vars['news_title']) && $PAGEDATA->vars['news_title'] == 'yes' ? '<h2 class="news-header"><a href="' . $page->getRelativeURL() . '">' . htmlspecialchars($page->name) . '</a></h2>' . '<a class="news-date" href="' . $page->getRelativeURL() . '">' . __('posted on %1', array(Core_dateM2H($page->associated_date)), 'core') . '</a>' : ''; if (!isset($page->associated_date) || !$page->associated_date) { $page->associated_date = $page->cdate; } $links[] = $date . '<p class="news-paragraph">' . $content . '...</p>'; } $html .= join('<div class="news-break"></div>', $links); $html .= $nextprev; return $html; }
/** * widget for mailing lists * * @param array $vars parameters * * @return html */ function MailingLists_widget($vars) { $html = '<div id="mailinglists-subscribe">' . '<input type="email" placeholder="' . __('enter email address') . '"/>'; $sql = 'select * from mailinglists_lists'; $md5 = md5($sql); $lists = Core_cacheLoad('mailinglists', $md5, -1); if ($lists === -1) { $lists = dbAll($sql); Core_cacheSave('mailinglists', $md5, $lists); } if (count($lists) > 1) { $html .= '<select><option value="">' . __('Mailing List') . '</option>'; foreach ($lists as $list) { $html .= '<option value="' . $list['id'] . '">' . htmlspecialchars($list['name']) . '</option>'; } $html .= '</select>'; } $html .= '<button>' . __('Subscribe') . '</button></div>'; WW_addScript('mailinglists/js.js'); return $html; }
} if (isset($_REQUEST['os_voucher']) && $_REQUEST['os_voucher']) { require_once dirname(__FILE__) . '/voucher-libs.php'; $email = $_REQUEST['Email']; $code = $_REQUEST['os_voucher']; $voucher_amount = OnlineStore_voucherAmount($code, $email, $grandTotal); if ($voucher_amount) { $c .= '<tr class="os_basket_totals vouchers">' . '<td class="voucher" style="text-align: right;" colspan="3">' . '<span>' . __('Voucher', 'core') . '</span> (' . htmlspecialchars($code) . '<span style="display:inline-block;"' . ' class="ui-icon ui-icon-circle-close online-store-voucher-remove">' . '</span>' . ')</td><td class="totals">-' . OnlineStore_numToPrice($voucher_amount) . '</td></tr>'; $grandTotal -= $voucher_amount; } else { $c .= '<tr class="os_basket_totals vouchers">' . '<td class="voucher" style="text-align: right;" colspan="4">' . '<span>' . __('Voucher has no effect on cart. Removed from cart.', 'core') . '</span></td></tr>'; unset($_REQUEST['os_voucher']); } } if (!isset($_REQUEST['os_voucher']) || !$_REQUEST['os_voucher']) { $siteHasVouchers = Core_cacheLoad('online-store', 'site-has-vouchers', -1); if ($siteHasVouchers === -1) { $siteHasVouchers = dbOne('select count(id) ids from online_store_vouchers', 'ids'); Core_cacheSave('online-store', 'site-has-vouchers', $siteHasVouchers); } if ($siteHasVouchers) { $c .= '<tr class="os_basket_totals online-store-vouchers">' . '<td class="voucher" style="text-align: right;" colspan="4">' . OnlineStore_showVoucherInput() . '</td></tr>'; } } if ($group_discount && $discountableTotal) { // group discount $discount_amount = $discountableTotal * ($group_discount / 100); $c .= '<tr class="os_basket_totals">' . '<td class="group-discount" style="text-align:right;" colspan="3">' . '<span>' . __('Group Discount', 'core') . '</span> (' . $group_discount . '%)</td><td class="totals">-' . OnlineStore_numToPrice($discount_amount) . '</td></tr>'; $grandTotal -= $discount_amount; } // { postage
/** * initialise the online store * * @return null */ function OnlineStore_startup() { $osvals = Core_cacheLoad('online-store', 'globals'); if ($osvals != false) { $_SESSION['onlinestore_checkout_page'] = $osvals['onlinestore_checkout_page']; $_SESSION['currency'] = $osvals['currency']; $_SESSION['onlinestore_vat_percent'] = $osvals['onlinestore_vat_percent']; $_SESSION['onlinestore_prices_shown_post_vat'] = (int) @$osvals['prices_shown_post_vat']; return; } OnlineStore_setCheckoutPage(); $currencies = dbOne('select value from site_vars where name="currencies" limit 1', 'value'); if ($currencies == false) { if (!isset($GLOBALS['DBVARS']['online_store_currency'])) { $GLOBALS['DBVARS']['online_store_currency'] = 'EUR'; } $currency = $GLOBALS['DBVARS']['online_store_currency']; $currency_symbols = array('EUR' => '€', 'GBP' => '£', 'USD' => '$', 'DKK' => 'DKK'); $_SESSION['currency'] = array('name' => $currency, 'symbol' => $currency_symbols[$currency], 'iso' => $currency, 'value' => 1); } else { $currencies = json_decode($currencies, true); $_SESSION['currency'] = $currencies[0]; } // { whether to display prices with VAT included by default $vat_display = (int) dbOne('select val from online_store_vars where name="vat_display"', 'val'); $_SESSION['onlinestore_prices_shown_post_vat'] = $vat_display; // } $osvals = array('onlinestore_checkout_page' => @$_SESSION['onlinestore_checkout_page'], 'currency' => $_SESSION['currency'], 'onlinestore_vat_percent' => @$_SESSION['onlinestore_vat_percent'], 'prices_shown_post_vat' => $vat_display); Core_cacheSave('online-store', 'globals', $osvals); }
/** * show a content snippet * * @param array $vars array of parameters * * @return string contentsnippet */ function ContentSnippet_show($vars = null) { if (!is_array($vars) && @$vars->id) { $data = Core_cacheLoad('content_snippets', $vars->id . '-data'); if ($data === false) { $data = dbRow('select * from content_snippets where id=' . $vars->id, 'content'); $data['content'] = json_decode($data['content'], true); Core_cacheSave('content_snippets', $vars->id . '-data', $data); } if (!is_array($data['content']) || !count($data['content'])) { return '<p>' . __('This Content Snippet is not yet defined.') . '</p>'; } // { no sub-pages if (!$data['accordion']) { return '<div class="content-snippet">' . $data['content'][0]['html'] . '</div>'; } // } // { vertical accordion $id = 'cs-' . rand(); if ($data['accordion_direction'] == '0') { $script = ' function change_slide( ){ var active = $( "#' . $id . '" ).accordion( "option", "active" ); var total = $( ".accordion-h3" ).length; active = ( active + 1 ) % total; $( "#' . $id . '" ).accordion( "activate", active ); setTimeout( change_slide, 8000 ); } $( "#' . $id . '" ).accordion( { \'heightStyle\':\'content\', \'beforeActivate\': function( ){ clearTimeout( change_slide ); } } ); setTimeout( change_slide, 8000 ); '; WW_addInlineScript($script); $html = '<div id="' . $id . '">'; foreach ($data['content'] as $content) { $html .= '<h3 class="accordion-h3"><a href="#">' . htmlspecialchars($content['title']) . '</a></h3>'; $html .= '<div>' . $content['html'] . '</div>'; } $html .= '</div>'; return $html; } // } // { horizontal accordion WW_addScript('content-snippet/frontend/jquery.hrzAccordion.js'); WW_addCss('/ww.plugins/content-snippet/frontend/jquery.hrzAccordion.defaults.css'); $html = '<ul class="hrzAccordion" id="' . $id . '">'; $imgs = array(); if ($data['images_directory'] && file_exists(USERBASE . '/f' . $data['images_directory'])) { $dir = new DirectoryIterator(USERBASE . '/f' . $data['images_directory']); foreach ($dir as $file) { if ($file->isDot()) { continue; } $imgs[] = '/f' . $data['images_directory'] . '/' . $file->getFilename(); } } sort($imgs); $i = 0; foreach ($data['content'] as $content) { $html .= '<li><div class="handle">'; if (count($imgs) && isset($imgs[$i])) { $size = getimagesize(USERBASE . '/' . $imgs[$i]); $html .= '<img src="' . htmlspecialchars($imgs[$i]) . '" style="width:' . $size[0] . 'px;height:' . $size[1] . 'px" />'; } else { $html .= htmlspecialchars($content['title']); } $html .= '</div>'; $html .= $content['html'] . '</li>'; ++$i; } $html .= '</ul><script defer="defer">$(function(){$("#' . $id . '").hrzAccordion({handlePos' . 'ition:"left",cycle:true,cycleInterval:4000});});</script>'; return $html; return $data['accordion_direction']; // } } return '<p>' . __('This Content Snippet is not yet defined.') . '</p>'; }
* @package None * @subpackage None * @author Kae Verens <*****@*****.**> * @author Conol MacAoidh <*****@*****.**> * @license GPL Version 2 * @link www.kvweb.me */ $html = ''; if (!isset($vars->id)) { $html = '<em>No news page selected.</em>'; return; } if (!$vars->stories_to_show) { $vars->stories_to_show = 10; } $rs = Core_cacheLoad('pages', 'news|' . $vars->id . '|' . $vars->stories_to_show, -1); if ($rs === -1) { $sql = 'select id from pages where parent=' . $vars->id . ' order by associated_date desc,cdate desc limit 10'; $rs = dbAll($sql); if ($rs !== false) { Core_cacheSave('pages', 'news|' . $vars->id . '|' . $vars->stories_to_show, $rs); } } if (!count($rs)) { $html = '<em>No news items to display.</em>'; return; } $links = array(); foreach ($rs as $r) { $page = Page::getInstance($r['id']); $thumb = '';
function Menu_show($b) { WW_addScript('/j/menu.js'); global $PAGEDATA, $_languages; if (!$PAGEDATA->id) { return ''; } $md5 = md5('ww_menudisplay|' . print_r($b, true) . '|' . join(',', $_languages) . '|' . @$_SESSION['language']); $cache = Core_cacheLoad('menus', $md5); if ($cache) { return $cache; } if (is_array($b)) { $align = isset($b['direction']) && $b['direction'] == 'vertical' ? 'Left' : 'Top'; $vals = $b; } else { $arr = explode('|', $b); $b = $arr[0]; $vals = array(); if (count($arr) > 1) { $d = split(',', $arr[1]); } else { $d = array(); } foreach ($d as $e) { $f = split('=', $e); if (count($f) > 1) { $vals[$f[0]] = $f[1]; } else { $vals[$f[0]] = 1; } } $c = ''; $align = $b == 'vertical' ? 'Left' : 'Top'; } $parent = 0; $classes = ''; if (isset($vals['mode'])) { if ($vals['mode'] == 'accordian' || $vals['mode'] == 'accordion') { $classes .= ' click_required accordion'; } else { if ($vals['mode'] == 'two-tier') { $classes .= ' two-tier'; } } } else { $vals['mode'] = 'default'; } if (isset($vals['preopen_menu'])) { $classes .= ' preopen_menu'; } if (isset($vals['close']) && $vals['close'] == 'no') { $classes .= ' noclose'; } if (isset($vals['parent'])) { $r = Page::getInstanceByName($vals['parent']); if ($r) { $parent = $r->id; } } if (isset($vals['spans'])) { $vals['spans'] = (int) $vals['spans']; } else { $vals['spans'] = 1; } if ($b['type'] == 'bootstrap') { $c = '<div class="navbar"><div class="navbar-inner"><a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><h1><a class="brand" href="/">' . htmlspecialchars($GLOBALS['DBVARS']['site_title']) . '</a></h1><div class="nav-collapse collapse"><ul class="nav pull-right">'; } else { $c = '<div id="ajaxmenu' . $parent . '" class="menuBar' . $align . (isset($vals['nodropdowns']) && $vals['nodropdowns'] ? '' : ' ajaxmenu ') . $classes . ' parent' . $parent . '">'; } $rs = Menu_getChildren($parent, $PAGEDATA->id, 0, $parent); $links = 0; if (count($rs)) { foreach ($rs as $r) { $page = Page::getInstance($r['id']); if ($b['type'] == 'bootstrap') { $c .= '<li class="' . $r['classes'] . '"><a href="' . $page->getRelativeURL() . '"><i class="icon"></i><br>' . htmlspecialchars(__FromJson($page->name)) . '</a>' . Menu_getSubMenuBootstrap($r, $r['id']) . '</li>'; } else { if ($vals['spans']) { $spanl = '<span class="l"></span>'; $spanr = '<span class="r"></span>'; } else { $spanl = ''; $spanr = ''; } if (!$links) { $r['classes'] .= ' first'; } $c .= '<a id="ajaxmenu_link' . $r['id'] . '" class="' . $r['classes'] . '" href="' . $page->getRelativeURL() . '">' . $spanl . htmlspecialchars(__FromJson($page->name)) . $spanr . '</a>'; } $links++; } } if (!@$GLOBALS['DBVARS']['disable-hidden-sitemap']) { $c .= '<a class="menuItemTop" style="display:none" href="' . $PAGEDATA->getRelativeURL() . '?cmsspecial=sitemap">' . __('Site Map') . '</a>'; } if ($b['type'] == 'bootstrap') { $c .= '</ul></div></div>'; } else { $c .= '</div>'; } if ($vals['mode'] == 'two-tier') { $pid = $PAGEDATA->getTopParentId(); if ($pid != 2 && $pid != 3 && $pid != 17 && $pid != 32 && $pid != 33 && $pid != 34) { $pid = 2; } $rs = Menu_getChildren($pid, $PAGEDATA->id, 0, $parent); $c .= '<div id="ajaxmenu' . $pid . '" class="menu tier-two">'; if (count($rs)) { foreach ($rs as $r) { $page = Page::getInstance($r['id']); $c .= '<a id="ajaxmenu_link' . $r['id'] . '" class="' . $r['classes'] . '" href="' . $page->getRelativeURL() . '">' . $spanl . htmlspecialchars($page->name) . $spanr . '</a>'; } } else { $c .= '<a><span class="l"></span> <span class="r"></span></a>'; } $c .= '</div>'; } Core_cacheSave('menus', $md5, $c); return $c; }
/** * get details about a specific product type * * @return array the product type details */ function Products_typeGet() { $id = (int) @$_REQUEST['id']; $r = Core_cacheLoad('products', 'productTypeDetails_' . $id, -1); if ($r === -1) { $r = dbRow("select * from products_types where id={$id}"); $r['default_category_name'] = ProductCategory::getInstance($r['default_category'])->vals['name']; $r['data_fields'] = json_decode($r['data_fields']); Core_cacheSave('products', 'productTypeDetails_' . $id, $r); } return $r; }
/** * load up a page's meta values * * @param array $pvq pre-filled values array (optional) * * @return object the Page instance */ function initValues($pvq = false) { $this->vars = array(); if (!$pvq) { $fname = 'page_vars_' . $this->id; $pvq = Core_cacheLoad('pages', $fname, -1); if ($pvq === -1) { $pvq = dbAll("select * from page_vars where page_id=" . $this->id); Core_cacheSave('pages', $fname, $pvq); } } if (!is_array($pvq)) { return $this; } foreach ($pvq as $pvr) { $this->vars[$pvr['name']] = $pvr['value']; } return $this; }
/** * panels_show * * @param array $vars parameters * * @return text */ function Panels_show($vars) { $name = isset($vars['name']) ? $vars['name'] : ''; // { load panel data $p = Core_cacheLoad('panels', md5($name)); if ($p === false) { $p = dbRow('select id,visibility,hidden,disabled,body from panels where name="' . addslashes($name) . '" limit 1'); if (!is_array($p)) { dbQuery("insert into panels (name,body) values('" . addslashes($name) . "','{\"widgets\":[]}')"); return ''; } Core_cacheSave('panels', md5($name), $p); } // } // { is the panel visible? if ($p['disabled']) { // if the panel is disabled, it's not visible anywhere return ''; } // { is the panel explicitly only to be shown on certain pages? if ($p['visibility'] && $p['visibility'] != '[]') { $visibility = json_decode($p['visibility']); if (!in_array($GLOBALS['PAGEDATA']->id, $visibility)) { return ''; } } // } // { is the panel explicitly not allowed on certain pages? if ($p['hidden'] && $p['hidden'] != '[]') { $hidden = json_decode($p['hidden']); if (in_array($GLOBALS['PAGEDATA']->id, $hidden)) { return ''; } } // } // } // { get the panel content $widgets = json_decode($p['body']); if (!isset($widgets->widgets) || !count($widgets->widgets)) { return ''; } // } // { show the panel content $h = ''; global $PLUGINS; foreach ($widgets->widgets as $widget) { if (@$widget->disabled) { continue; } if (isset($widget->visibility) && count($widget->visibility) && !in_array($GLOBALS['PAGEDATA']->id, $widget->visibility)) { continue; } if (isset($widget->hidden) && count($widget->hidden) && in_array($GLOBALS['PAGEDATA']->id, $widget->hidden)) { continue; } $h .= '<div class="panel-widget panel-widget-' . $widget->type . '">'; if (@$widget->header_visibility) { $h .= '<h2 class="panel-widget-header ' . preg_replace('/[^a-z0-9A-Z\\-]/', '', $widget->name) . '">' . htmlspecialchars($widget->name) . '</h2>'; } if (isset($PLUGINS[$widget->type])) { if (isset($PLUGINS[$widget->type]['frontend']['widget'])) { $h .= $PLUGINS[$widget->type]['frontend']['widget']($widget, $p['id']); } else { $h .= '<em>' . __('plugin "%1" does not have a widget interface.', array(htmlspecialchars($widget->type)), 'core') . '</em>'; } } else { $file = $_SERVER['DOCUMENT_ROOT'] . '/ww.plugins/panels/built-in/' . $widget->type . '.php'; if (file_exists($file)) { require $file; } else { $h .= '<em>' . __('missing plugin "%1".', array(htmlspecialchars($widget->type)), 'core') . '</em>'; } } $h .= '</div>'; } // } if ($h == '') { return ''; } $name = preg_replace('/[^a-z0-9\\-]/', '-', $name); return '<div class="panel panel-' . $name . '">' . $h . '</div>'; }
/** * get all available translations for a particular context * * @return array of tanslations */ function Core_translationsGet() { global $_languages; $context = @$_REQUEST['context']; $md5 = md5(join('|', $_languages) . '|' . $context); $strings = Core_cacheLoad('core-translation', $md5); if (1 || $strings == false) { $strings = array(); for ($i = count($_languages) - 1; $i >= 0; --$i) { $sql = 'select * from languages where lang="' . $_languages[$i] . '" and context="' . addslashes($context) . '"'; $md5 = md5($sql); $rs = Core_cacheLoad('languages', $md5, -1); if ($rs === -1) { $rs = dbAll($sql); if (!is_array($rs)) { $rs = array(); } Core_cacheSave('languages', $md5, $rs); } foreach ($rs as $r) { $strings[$r['str']] = $r['trstr']; } } Core_cacheSave('core-translation', $md5, $strings); } return array('context' => $context, 'strings' => $strings); }
/** * check that a file can be accessed * * @param array $vars array * * @return null */ function ProtectedFiles_check($vars) { global $PAGEDATA; $fname = $vars['requested_file']; $protected_files = Core_cacheLoad('protected_files', 'all'); if (!$protected_files) { $protected_files = dbAll('select * from protected_files'); Core_cacheSave('protected_files', 'all', $protected_files); } foreach ($protected_files as $pr) { if (strpos($fname, $pr['directory'] . '/') === 0) { if (!isset($pr['details'])) { $details = array('type' => 1); } else { $details = json_decode($pr['details'], true); } switch ((int) $details['type']) { case 1: // { email $email = ''; if (isset($_SESSION['protected_files_email']) && $_SESSION['protected_files_email']) { $email = $_SESSION['protected_files_email']; } elseif (isset($_SESSION['userdata']['email']) && $_SESSION['userdata']['email']) { $email = $_SESSION['userdata']['email']; } elseif (isset($_REQUEST['email']) && filter_var($_REQUEST['email'], FILTER_VALIDATE_EMAIL)) { $email = $_REQUEST['email']; } if ($email) { require_once SCRIPTBASE . 'ww.incs/common.php'; $_SESSION['protected_files_email'] = $email; if (!isset($_SESSION['protected_files_stage2'])) { $_SESSION['protected_files_stage2'] = 1; $PAGEDATA = Page::getInstance(0); $PAGEDATA->title = 'File Download'; list($smarty, $template) = ProtectedFiles_getTemplate($pr['template']); $smarty->assign('METADATA', '<title>File Download</title>'); $smarty->assign('PAGECONTENT', '<p>Your download should begin in two seconds. ' . 'If it doesn\'t, please <a href="' . $_SERVER['REQUEST_URI'] . '">click here</a></p>' . '<script defer="defer">setTimeout(function(){document.location="' . htmlspecialchars($_SERVER['REQUEST_URI']) . '";},2000);</script><p>' . '<a href="' . $_SESSION['referer'] . '">Click here</a> to return to the referring page.</p>'); $smarty->display($template . '.html'); Core_quit(); } else { cmsMail($pr['recipient_email'], '[' . $_SERVER['HTTP_HOST'] . '] protected file downloaded', 'protected file "' . addslashes($fname) . '" was downloaded by "' . addslashes($email) . '"'); ProtectedFiles_log($fname, 1, $email, $pr['id']); unset($_SESSION['referer']); } } else { unset($_SESSION['protected_files_stage2']); if (!isset($_SESSION['referer'])) { $_SESSION['referer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; } ProtectedFiles_log($fname, 0, '', $pr['id']); $PAGEDATA = Page::getInstance(0); $PAGEDATA->title = 'File Download'; list($smarty, $template) = ProtectedFiles_getTemplate($pr['template']); $smarty->assign('METADATA', '<title>File Download</title>'); $smarty->assign('PAGECONTENT', $pr['message'] . '<form method="post" action="/f' . htmlspecialchars($fname) . '">' . '<input name="email" /><input type="submit" value="Please en' . 'ter your email address" /></form>'); $smarty->display($template . '.html'); Core_quit(); } break; // } // } case 2: // { groups if (isset($_SESSION['userdata']['groups'])) { $valid = explode(',', $details['groups']); foreach ($valid as $g) { if ($g != '' && isset($_SESSION['userdata']['groups'][$g])) { return; // ok - this user is a member of a valid group } } } $PAGEDATA = Page::getInstance(0); $PAGEDATA->title = 'File Download'; list($smarty, $template) = ProtectedFiles_getTemplate($pr['template']); $smarty->assign('METADATA', '<title>File Download</title>'); $smarty->assign('PAGECONTENT', $pr['message'] . '<p>Please <a href="/_r?type=privacy">login</a> ' . 'to view this page</p>'); $smarty->display($template . '.html'); Core_quit(); // } } } } }
/** * check for new emails * * @param object $r config object * * @return array array of results */ function Aggregator_getEmail($r) { $bs = explode('|', $r->url); $username = $bs[0]; $password = $bs[1]; $hostname = $bs[2]; $link_url = isset($bs[3]) ? $bs[3] : ''; $mbox = imap_open('{' . $hostname . ':143/novalidate-cert}INBOX', $username, $password); $emails = imap_search($mbox, 'ALL'); $arr = array(); if ($emails && is_array($emails)) { foreach ($emails as $email_number) { $overview = imap_fetch_overview($mbox, $email_number, 0); $subject = $overview[0]->subject; $from = trim(preg_replace('/<[^>]*>/', '', $overview[0]->from)); $arr[] = array('type' => 'email', 'title' => $from . ' wrote an email: ' . $subject, 'link' => $link_url, 'unixtime' => strtotime($overview[0]->date)); imap_delete($mbox, $email_number); } } imap_expunge($mbox); imap_close($mbox); $md5 = md5($r->url); $c = Core_cacheLoad('messaging-notifier', $md5); if ($c === false) { $c = array(); } $arr = array_merge($arr, $c); krsort($arr); $arr = array_slice($arr, 0, 10); Core_cacheSave('messaging-notifier', $md5, $arr); return $arr; }
/** * get recursive details of pages to build a menu * * @param int $parentid the parent's ID * @param int $depth current menu depth * @param array $options any further options * * @return string HTML of the sub-menu */ function menuBuildFg($parentid, $depth, $options) { $PARENTDATA = Page::getInstance($parentid)->initValues(); // { menu order $order = 'ord,name'; if (isset($PARENTDATA->vars['order_of_sub_pages'])) { switch ($PARENTDATA->vars['order_of_sub_pages']) { case 1: // { alphabetical $order = 'name'; if ($PARENTDATA->vars['order_of_sub_pages_dir']) { $order .= ' desc'; } break; // } // } case 2: // { associated_date $order = 'associated_date'; if ($PARENTDATA->vars['order_of_sub_pages_dir']) { $order .= ' desc'; } $order .= ',name'; break; // } // } default: // { by admin order $order = 'ord'; if ($PARENTDATA->vars['order_of_sub_pages_dir']) { $order .= ' desc'; } $order .= ',name'; break; // } } } // } $sql = "select id,name,type from pages where parent='" . $parentid . "' and !(special&2) order by {$order}"; $md5 = md5($sql); $rs = Core_cacheLoad('pages', $md5, -1); if ($rs === -1) { $rs = dbAll($sql); Core_cacheSave('pages', $md5, $rs); } if ($rs === false || !count($rs)) { return ''; } $items = array(); foreach ($rs as $r) { $item = '<li>'; $page = Page::getInstance($r['id'])->initValues(); $item .= '<a class="menu-fg menu-pid-' . $r['id'] . '" href="' . $page->getRelativeUrl() . '">' . htmlspecialchars(__FromJson($page->name)) . '</a>'; // { override menu if a trigger causes the override $submenus = Core_trigger('menu-subpages-html', array($page, $depth + 1, $options)); if ($submenus) { $item .= $submenus; } else { $item .= menuBuildFg($r['id'], $depth + 1, $options); } // } $item .= '</li>'; $items[] = $item; } $options['columns'] = (int) $options['columns']; // { return top-level menu if (!$depth) { return '<ul>' . join('', $items) . '</ul>'; } // } $s = ''; if ($options['style_from'] == '1') { if ($options['background']) { $s .= 'background:' . $options['background'] . ';'; } if ($options['opacity']) { $s .= 'opacity:' . $options['opacity'] . ';'; } if ($s) { $s = ' style="' . $s . '"'; } } // { return 1-column sub-menu if ($options['columns'] < 2) { return '<ul' . $s . '>' . join('', $items) . '</ul>'; } // } // { return multi-column submenu $items_count = count($items); $items_per_column = ceil($items_count / $options['columns']); $c = '<table' . $s . '><tr><td><ul>'; for ($i = 1; $i < $items_count + 1; ++$i) { $c .= $items[$i - 1]; if ($i != $items_count && !($i % $items_per_column)) { $c .= '</ul></td><td><ul>'; } } $c .= '</ul></td></tr></table>'; return $c; // } }
/** * show the image transition * * @param array $vars array of variables * * @return HTML of the widget */ function ImageTransition_show($vars) { global $cdnprefix; if (!is_array($vars) && isset($vars->id) && $vars->id) { $r = Core_cacheLoad('image-transitions', 'id' . $vars->id); if ($r === false) { $r = dbRow('select * from image_transitions where id=' . $vars->id); Core_cacheSave('image-transitions', 'id' . $vars->id, $r); } if ($r && is_array($r)) { $width = (int) $r['width']; $height = (int) $r['height']; $imgs = array(); $dir = USERBASE . '/f' . $r['directory']; if (!file_exists($dir) || !is_dir($dir)) { return '<!-- ' . $dir . ' -->'; } $fs = new DirectoryIterator($dir); $max = array($width, $height); foreach ($fs as $f) { if ($f->isDot() || !preg_match('/\\.(jpg|.jpeg|png|gif)$/i', $f->getFilename())) { continue; } list($iw, $ih) = getimagesize(USERBASE . '/f' . $r['directory'] . '/' . $f->getFilename()); if (!$iw || !$ih) { // not an image continue; } if (!$width) { // no size predefined if ($iw > $max[0]) { $max[0] = $iw; } if ($ih > $max[1]) { $max[1] = $ih; } } $imgs[] = $f->getFilename(); } $width = $max[0]; $height = $max[1]; asort($imgs); if (!count($imgs)) { return '<em>' . __('No images in selected directory.') . '</em>'; } $html = ''; if ($r['trans_type'] == '3dCarousel') { $html .= '<div id="k3dCarousel' . $vars->id . '" style="height:' . ($height + 30) . 'px"><img style="display:none" src="' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/' . join('" /><img style="display:none" src="' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/', $imgs) . '" />'; $html .= '</div>'; WW_addScript('/ww.plugins/image-transition/frontend/k3dCarousel/' . 'jquery.k3dCarousel.js'); WW_addInlineScript('$(window).load(function(){' . '$("#k3dCarousel' . $vars->id . '").k3dCarousel();' . '});'); } else { if ($r['url']) { $url = PAGE::getInstance($r['url'])->getRelativeUrl(); $html .= '<a href="' . $url . '"'; } else { $html .= '<div'; } $html .= ' style="display:block;width:' . $width . 'px;height:' . $height . 'px;" id="image_transitions_' . $vars->id . '">' . '<div style="width:' . $width . 'px;height:' . $height . 'px;background:' . 'url(\'' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/' . join('\') no-repeat center center"> </div><div style="width:' . $width . 'px;height:' . $height . 'px;display:none;background:' . 'url(\'' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/', $imgs) . '\') no-repeat center center"> </div>'; if ($r['url']) { $html .= '</a>'; } else { $html .= '</div>'; } WW_addScript('/j/jquery.cycle.all.js'); WW_addInlineScript('$(window).load(function(){$("#image_transitions_' . $vars->id . '").cycle({fx:"' . $r['trans_type'] . '",speed:' . $r['pause'] . '})});'); } return $html; } } return '<p>' . __('This Image Transition is not yet defined.') . '</p>'; }
/** * get list of pages and and number of their kids * * @return array */ function Core_adminPageChildnodes() { $pid = (int) preg_replace('/[^0-9]/', '', $_REQUEST['id']); $c = Core_cacheLoad('pages', 'adminmenu' . $pid); if ($c) { return $c; } $rs = dbAll('select id,id as pid,special&2 as hide,type,name,' . '(select count(id) from pages where parent=pid) as children ' . 'from pages where parent=' . $pid . ' order by ord,name'); $data = array(); foreach ($rs as $r) { $item = array('data' => __FromJson($r['name'], true), 'attr' => array('id' => 'page_' . $r['id']), 'children' => $r['children'] ? array() : false); if ($r['type'] !== '0') { $item['attr']['type'] = $r['type']; } if ($r['hide'] == '2') { $item['attr']['hide'] = 'yes'; } $data[] = $item; } Core_cacheSave('pages', 'adminmenu' . $pid, $data); return $data; }
/** * render a list of products to HTML * * @param object $PAGEDATA the page object * @param int $start offset * @param int $limit how many products to show * @param string $order_by what field to order the search by * @param int $order_dir order ascending or descending * @param int $limit_start lowest $start offset allowed * @param int $enabledFilter whether to allow enabled/disabled products * * @return string the HTML of the products list */ function render($PAGEDATA, $start = 0, $limit = 0, $order_by = '', $order_dir = 0, $limit_start = 0, $enabledFilter = 0) { global $cdnprefix; $c = ''; // { sort based on $order_by $md5 = md5('ps-sorted-' . join(',', $this->product_ids) . '|' . $order_by . '|' . $order_dir . '|' . $enabledFilter); $tmpprods = -1; if ($order_dir != 2) { $tmpprods = Core_cacheLoad('products', $md5, -1); } if ($tmpprods == -1) { if ($order_by != '') { $native = substr($order_by, 0, 1) === '_'; $tmpprods1 = array(); $prods = $this->product_ids; $sql = 'select id'; if (!$native) { $sql .= ',data_fields'; } $sql .= ' from products where id in (' . join(', ', $this->product_ids) . ')'; if ($enabledFilter == 0) { $sql .= ' and enabled'; } if ($enabledFilter == 1) { } if ($enabledFilter == 2) { $sql .= ' and !enabled'; } if ($native) { $sql .= ' order by ' . substr($order_by, 1, strlen($order_by) - 1); if ($order_dir == 1) { $sql .= ' desc'; } } $values = dbAll($sql, '', 'products'); if ($native) { $tmpprods = array(); if (is_array($values)) { foreach ($values as $v) { $tmpprods[] = $v['id']; } if ($order_dir == 2) { shuffle($tmpprods); } } } else { if (is_array($values)) { foreach ($values as $v) { $vals = json_decode($v['data_fields'], true); $key2 = ''; foreach ($vals as $v2) { if ($v2['n'] == $order_by) { $key2 = __FromJSON($v2['v']); } } if (!isset($tmpprods1[$key2])) { $tmpprods1[$key2] = array(); } $tmpprods1[$key2][] = $v['id']; } } if ($order_dir == 1) { krsort($tmpprods1); } else { if ($order_dir == 0) { ksort($tmpprods1); } else { if ($order_dir == 2) { shuffle($tmpprods1); } } } $tmpprods = array(); foreach ($tmpprods1 as $pids) { foreach ($pids as $pid) { $tmpprods[] = $pid; } } foreach ($prods as $key => $pid) { $tmpprods[] = $pid; } } } else { $tmpprods = $this->product_ids; } Core_cacheSave('products', $md5, $tmpprods); } // } // { sanitise the limits $cnt = count($tmpprods); if (!$limit) { $limit = $cnt; $start = 0; } else { if ($start && $start >= count($this->product_ids)) { $start = $cnt - $limit; } } // } // { build array of items $prevnext = ''; $total_found = count($tmpprods); if ($cnt == $limit) { $prods =& $tmpprods; } else { $prods = array(); for ($i = $start; $i < $limit + $start; ++$i) { if (isset($tmpprods[$i])) { $prods[] = $tmpprods[$i]; } } $prefix = ''; if ($PAGEDATA->vars['products_what_to_show'] == 2) { $cat = ProductCategory::getInstance($PAGEDATA->vars['products_category_to_show']); if ($cat) { $prefix = $cat->getRelativeUrl(); } } if (!$prefix) { $prefix = $PAGEDATA->getRelativeUrl(); } if ($start > $limit_start) { $prevnext .= '<a class="products-prev" href="' . $prefix . '?start=' . ($start - $limit) . '">' . __('Previous') . '</a>'; } if ($limit && $start + $limit < $cnt) { if ($start) { $prevnext .= ' | '; } $prevnext .= '<a class="products-next" href="' . $prefix . '?start=' . ($start + $limit) . '">' . __('Next') . '</a>'; } } $prevnext = '<div class="products-pagination">' . $prevnext . '</div>'; // } // { see if there are search results if (isset($PAGEDATA->vars['products_add_a_search_box']) && $PAGEDATA->vars['products_add_a_search_box']) { $c .= '<div class="products-num-results">' . __('<strong>%1</strong> results found.', array($total_found), 'core') . '</div>'; } // } if (!isset($PAGEDATA->vars['products_show_multiple_with'])) { $PAGEDATA->vars['products_show_multiple_with'] = 0; } $prods = array_unique($prods); switch ($PAGEDATA->vars['products_show_multiple_with']) { case 1: // { horizontal table, headers on top $c .= Product_datatableMultiple($prods, 'horizontal'); break; // } // } case 2: // { vertical table, headers on left $c .= Product_datatableMultiple($prods, 'vertical'); break; // } // } case 3: // { map view WW_addScript('products'); WW_addCSS('/ww.plugins/products/products.css'); return '<div id="products-mapview"></div>'; // } // } case 4: // { carousel WW_addScript('products'); $c = '<div id="products-carousel"><ul id="products-carousel-slider">'; foreach ($prods as $pid) { $product = Product::getInstance($pid, false, $enabledFilter); if ($product && isset($product->id) && $product->id) { $typeID = $product->get('product_type_id'); $type = ProductType::getInstance($typeID); if (!$type) { $c .= '<li>' . __('Missing Product Type: %1', array($typeID), 'core') . '</li>'; } else { $c .= '<li id="products-' . $product->id . '" class="products-product">' . $type->render($product, 'multiview', 0) . '</li>'; } } } $c .= '</ul></div>'; WW_addScript('/j/jsor-jcarousel-7bb2e0a/jquery.jcarousel.min.js'); WW_addCSS('/ww.plugins/products/products.css'); return $c; // } // } default: // { use template if (count($prods)) { // display the first item's header $product = Product::getInstance($prods[0], false, $enabledFilter); $type = ProductType::getInstance($product->get('product_type_id')); if ($type) { $smarty = Products_setupSmarty(); $c .= $smarty->fetch(USERBASE . '/ww.cache/products/templates/types_multiview_' . $type->id . '_header'); } } foreach ($prods as $pid) { $product = Product::getInstance($pid, false, $enabledFilter); if ($product && isset($product->id) && $product->id) { $typeID = $product->get('product_type_id'); $type = ProductType::getInstance($typeID); if (!$type) { $c .= __('Missing Product Type: %1', array($typeID), 'core'); } else { if (isset($_REQUEST['product_id'])) { $c .= $type->render($product, 'singleview'); } else { $c .= $type->render($product, 'multiview'); } } } } if (isset($type) && $type && count($prods)) { // display first item's header $smarty = Products_setupSmarty(); $c .= $smarty->fetch(USERBASE . '/ww.cache/products/templates/types_multiview_' . $type->id . '_footer'); } // } } $categories = ''; if (!isset($_REQUEST['products-search']) && isset($this->subCategories) && count($this->subCategories) && !@$PAGEDATA->vars['products_dont_show_sub_categories']) { $categories = '<ul class="products-categories categories">'; foreach ($this->subCategories as $cr) { $cat = ProductCategory::getInstance($cr['id']); $categories .= '<li><a href="' . $cat->getRelativeUrl() . '">'; $icon = '/products/categories/' . $cr['id'] . '/icon.png'; if (file_exists(USERBASE . 'f' . $icon)) { $subcatW = (int) $cat->vals['thumbsize_w']; $subcatH = (int) $cat->vals['thumbsize_h']; $categories .= '<img src="' . $cdnprefix . '/a/f=getImg/w=' . $subcatW . '/h=' . $subcatH . '/fmt=' . filemtime(USERBASE . 'f' . $icon) . $icon . '"/>'; } $categories .= '<span>' . htmlspecialchars($cr['name']) . '</span>' . '</a></li>'; } $categories .= '</ul>'; } return $categories . $prevnext . '<div class="products">' . $c . '</div>' . $prevnext; }
/** * run a database query and return a single row * * @param string $query the query to run * * @return array the returned row */ function dbRow($query, $cache = false) { if (!preg_match('/ limit 1$/', $query)) { $query .= ' limit 1'; } if ($cache) { $q = Core_cacheLoad($cache, $query, -1); if ($q != -1) { return $q; } } $q = dbQuery($query); if ($q === false) { $r = false; } else { $r = $q->fetch(PDO::FETCH_ASSOC); } if ($cache) { Core_cacheSave($cache, $query, $r); } return $r; }
/** * The main display function * * @param Object $page Page Info * * @return $html The comments and an add comment form **/ function Comments_displayComments($page) { if (!$GLOBALS['access_allowed']) { return ''; } // { order of display $commentboxfirst = isset($page->vars['comments_show_box_at_top']) && $page->vars['comments_show_box_at_top']; // } // { get list of existing comments $hideComments = isset($page->vars['hide_comments']) && $page->vars['hide_comments']; if ($hideComments) { if (count(@$_SESSION['comment_ids'])) { $query = 'select * from comments where objectid=' . $page->id . ' and id in (' . join(', ', $_SESSION['comment_ids']) . ')'; } else { $query = ''; } } else { if (count(@$_SESSION['comment_ids'])) { $query = 'select * from comments where objectid=' . $page->id . ' and (isvalid=1 or id in (' . join(', ', $_SESSION['comment_ids']) . '))'; } else { $query = 'select * from comments where objectid=' . $page->id . ' and isvalid=1'; } } if ($query) { $sql = $query . ' order by cdate ' . ($commentboxfirst ? 'desc' : 'asc'); $md5 = md5($sql); $comments = Core_cacheLoad('comments', $md5); if ($comments === false) { $comments = dbAll($sql); Core_cacheSave('comments', $md5, $comments); } } // } $clist = ''; if (count($comments)) { $clist = '<div id="start-comments" class="comments-list"><a name="comments"></a>' . '<strong>Comments</strong>'; foreach ($comments as $comment) { $id = $comment['id']; $datetime = $comment['cdate']; $allowedToEdit = Core_isAdmin() || isset($_SESSION['comment_ids']) && is_array($_SESSION['comment_ids']) && in_array($id, $_SESSION['comment_ids'], false); $clist .= '<div class="comment-wrapper'; if ($allowedToEdit) { $clist .= ' comment-editable" ' . 'cdate="' . $datetime . '" comment="' . htmlspecialchars($comment['comment']) . '"'; } else { $clist .= '" '; } $clist .= 'id="comment-wrapper-' . $comment['id'] . '"' . '><a name="comments-' . $id . '"></a>' . '<div class="comment-info" id="comment-info-' . $id . '">Posted by '; if (!empty($comment['site'])) { $clist .= '<a href="' . $comment['site'] . '" target=_blank>' . htmlspecialchars($comment['name']) . '</a>'; } else { $clist .= htmlspecialchars($comment['name']); } $clist .= ' on ' . Core_dateM2H($datetime) . '</div>' . '<div id="comment-' . $id . '" class="comments-comment">' . htmlspecialchars($comment['comment']) . '</div></div>'; } $clist .= '</div>'; } else { $clist .= ''; } // { get comment box HTML $allowComments = Core_cacheLoad('comments', 'allow-' . $page->id, -1); if ($allowComments === -1) { $allowComments = dbOne('select value from page_vars where name="allow_comments" and page_id=' . $page->id, 'value'); Core_cacheSave('comments', 'allow-' . $page->id, $allowComments); } $cbhtml = $allowComments == 'on' ? Comments_showCommentForm($page->id) : ''; if ($allowComments == 'on') { WW_addScript('comments/frontend/comments-frontend.js'); $cbhtml .= '<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/' . 'jquery.validate.min.js"></script>'; } WW_addCSS('/ww.plugins/comments/frontend/comments.css'); // } return $commentboxfirst ? $cbhtml . $clist : $clist . $cbhtml; }