function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param = array()) { global $NEWSSTYLE, $NEWSLISTSTYLE; if ($override_newsitem = e107::getSingleton('override', true)->override_check('render_newsitem')) { $result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param); if ($result == 'return') { return; } } if ($n_restrict == 'userclass') { $news['news_id'] = 0; $news['news_title'] = LAN_NEWS_1; $news['data'] = LAN_NEWS_2; $news['news_extended'] = ""; $news['news_allow_comments'] = 1; $news['news_start'] = 0; $news['news_end'] = 0; $news['news_render_type'] = 0; $news['comment_total'] = 0; } $tmp = array(); $tmp['caticon'] = defset('ICONSTYLE'); $tmp['commentoffstring'] = defset('COMMENTOFFSTRING'); $tmp['commentlink'] = defset('COMMENTLINK'); $tmp['trackbackstring'] = defset('TRACKBACKSTRING'); $tmp['trackbackbeforestring'] = defset('TRACKBACKBEFORESTRING'); $tmp['trackbackafterstring'] = defset('TRACKBACKAFTERSTRING'); $tmp['itemlink'] = defset('NEWSLIST_ITEMLINK'); $tmp['thumbnail'] = defset('NEWSLIST_THUMB', "border:0px"); $tmp['catlink'] = defset('NEWSLIST_CATLINK'); $tmp['caticon'] = defset('NEWSLIST_CATICON', defset('ICONSTYLE')); if (!$param) { $param = array(); } $param = array_merge($tmp, $param); // Next three images aren't always defined by the caller, even if most of $param is. //XXX All of this should be done via CSS from v2 on. if (!isset($param['image_nonew_small'])) { if (!defined("IMAGE_nonew_small")) { define("IMAGE_nonew_small", file_exists(THEME . "images/nonew_comments.png") ? "<img src='" . THEME_ABS . "images/nonew_comments.png' alt='' /> " : "<img src='" . e_IMAGE_ABS . "generic/nonew_comments.png' alt='' />"); } $param['image_nonew_small'] = IMAGE_nonew_small; } if (!isset($param['image_new_small'])) { if (!defined("IMAGE_new_small")) { define("IMAGE_new_small", file_exists(THEME . "images/new_comments.png") ? "<img src='" . THEME_ABS . "images/new_comments.png' alt='' /> " : "<img src='" . e_IMAGE_ABS . "generic/new_comments.png' alt='' /> "); } $param['image_new_small'] = IMAGE_new_small; } if (!isset($param['image_sticky'])) { if (!defined("IMAGE_sticky")) { define("IMAGE_sticky", file_exists(THEME . "images/sticky.png") ? "<img src='" . THEME_ABS . "images/sticky.png' alt='' /> " : "<img src='" . e_IMAGE_ABS . "generic/sticky.png' alt='' style='width: 14px; height: 14px; vertical-align: bottom' /> "); } $param['image_sticky'] = IMAGE_sticky; } cachevars('current_news_item', $news); cachevars('current_news_param', $param); if ($news['news_render_type'] == 1 && $mode != "extend") { if (function_exists("news_list")) { $NEWS_PARSE = news_list($news); } else { if ($NEWSLISTSTYLE) { $NEWS_PARSE = $NEWSLISTSTYLE; } else { $NEWS_PARSE = "{NEWSICON} <b>{NEWSTITLELINK}</b><div class='smalltext'>{NEWSAUTHOR} " . LAN_NEWS_100 . " {NEWSDATE} | {NEWSCOMMENTS}</div>"; } } } else { if ($NEWS_TEMPLATE) { $NEWS_PARSE = $NEWS_TEMPLATE; } else { if (function_exists("news_style")) { $action = varset($param['current_action'], 'default'); $NEWS_PARSE = news_style($news, $action, $param); } else { $NEWS_PARSE = $NEWSSTYLE; } } } //$loop_uid = $news['news_author']; - no references found //require_once(e_CORE.'shortcodes/batch/news_shortcodes.php'); /* DEPRECATED setScVar('news_shortcodes', 'news_item', $news); setScVar('news_shortcodes', 'param', $param); */ // Set the Values for the social shortcode usage. $tp = e107::getParser(); $socialArray = array('url' => e107::getUrl()->create('news/view/item', $news, 'full=1'), 'title' => $tp->toText($news['news_title']), 'tags' => $news['news_meta_keywords']); $socialObj = e107::getScBatch('social'); if (is_object($socialObj)) { $socialObj->setVars($socialArray); } // Retrieve batch sc object, set required vars $sc = e107::getScBatch('news')->wrapper('news/view/item')->setScVar('news_item', $news)->setScVar('param', $param); $text = e107::getParser()->parseTemplate($NEWS_PARSE, true, $sc); if ($mode == 'return') { return $text; } else { echo $text; return TRUE; } }
function get_e_comment() { if ($this->engine != 'e107') { return null; } $data = getcachedvars('e_comment'); if ($data !== FALSE) { return $data; } if ($files = e107::getPref('e_comment_list')) { foreach ($files as $file => $perms) { unset($e_comment, $key); include e_PLUGIN . $file . "/e_comment.php"; if ($e_comment && is_array($e_comment)) { $key = $e_comment['eplug_comment_ids']; if (isset($key) && $key != '') { $data[$key] = $e_comment; } } else { //convert old method variables into the same array method $key = $e_plug_table; if (isset($key) && $key != '') { $e_comment['eplug_comment_ids'] = $e_plug_table; $e_comment['plugin_name'] = $plugin_name; $e_comment['plugin_path'] = $plugin_path; $e_comment['reply_location'] = $reply_location; $e_comment['db_title'] = $link_name; $e_comment['db_id'] = $db_id; $e_comment['db_table'] = $db_table; $e_comment['qry'] = ''; $data[$key] = $e_comment; } } } cachevars('e_comment', $data); return $data; } }
/** * Preferred version of user_extended_getStruct(); */ function user_extended_getStruct($orderby = "user_extended_struct_order") { if ($ueStruct = getcachedvars('ue_struct')) { return $ueStruct; } $tp = e107::getParser(); $sql_ue = e107::getDb('ue'); // new db; // Use our own db to avoid interference with other objects $ret = array(); $parms = ""; if ($orderby != "") { $parms = "1 ORDER BY " . $tp->toDB($orderby, true); } if ($sql_ue->select('user_extended_struct', '*', $parms)) { while ($row = $sql_ue->fetch()) { $ret['user_' . $row['user_extended_struct_name']] = $row; } } cachevars('ue_struct', $ret); return $ret; }
/** * @todo - $plugin_path is undefined - needs to be obtained from somewhere */ function get_plugin_data($plugid) { if (($tmp = getcachedvars('loginbox_eplug_data_' . $plugid)) !== FALSE) { return $tmp; } $ret = array(); if (is_readable(e_PLUGIN . $plugin_path . '/plugin.xml')) { require_once e_HANDLER . 'xml_class.php'; $xml = new xmlClass(); $xml->filter = array('name' => FALSE, 'version' => FALSE); // Just want a couple of variables $readFile = $xml->loadXMLfile(e_PLUGIN . $plugin_path . '/plugin.xml', true, true); $ret['eplug_name'] = defined($readFile['name']) ? constant($readFile['name']) : $readFile['name']; $ret['eplug_version'] = $readFile['version']; } elseif (is_readable(e_PLUGIN . $plugid . '/plugin.php')) { include e_PLUGIN . $plugid . '/plugin.php'; $ret['eplug_name'] = defined($eplug_name) ? constant($eplug_name) : $eplug_name; $ret['eplug_version'] = $eplug_version; } else { return array(); } // Valid data here cachevars('loginbox_eplug_data_' . $plugid, $ret); return $ret; }
function sc_signature() { if (!USER) { return ''; } global $forum; static $forum_sig_shown; if ($forum->prefs->get('sig_once')) { $_tmp = 'forum_sig_shown_' . $this->postInfo['post_user']; if (getcachedvars($_tmp)) { return ''; } cachevars($_tmp, 1); } return $this->postInfo['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>" . $this->e107->tp->toHTML($this->postInfo['user_signature'], true) . '</span>' : ''; }
function sc_userextended_cat($parm) { global $sql, $tp, $usersettings_shortcodes, $USER_EXTENDED_CAT, $extended_showed; if (isset($extended_showed['cat'][$parm])) { return ""; } $ret = ""; $catInfo = getcachedvars("extendedcat_{$parm}"); if (!$catInfo) { $qry = "\n\t\t\tSELECT * FROM #user_extended_struct\n\t\t\tWHERE user_extended_struct_applicable IN (" . $tp->toDB($this->var['userclass_list'], true) . ")\n\t\t\tAND user_extended_struct_write IN (" . USERCLASS_LIST . ")\n\t\t\tAND user_extended_struct_id = " . intval($parm) . "\n\t\t\t"; if ($sql->db_Select_gen($qry)) { $catInfo = $sql->db_Fetch(); } } if ($catInfo) { $qry = "\n\t\t\tSELECT * FROM #user_extended_struct\n\t\t\tWHERE user_extended_struct_applicable IN (" . $tp->toDB($this->var['userclass_list'], true) . ")\n\t\t\tAND user_extended_struct_write IN (" . USERCLASS_LIST . ")\n\t\t\tAND user_extended_struct_parent = " . intval($parm) . "\n\t\t\tAND user_extended_struct_type != 0\n\t\t\tORDER BY user_extended_struct_order ASC\n\t\t\t"; if ($sql->db_Select_gen($qry)) { $fieldList = $sql->db_getList(); foreach ($fieldList as $field) { cachevars("extendedfield_{$cat['user_extended_struct_name']}", $field); //TODO use $this instead of parseTemplate(); $ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes); } } } if ($ret) { $catName = $catInfo['user_extended_struct_text'] ? $catInfo['user_extended_struct_text'] : $catInfo['user_extended_struct_name']; if (defined($catName)) { $catName = constant($catName); } $ret = str_replace("{CATNAME}", $tp->toHTML($catName, FALSE, 'emotes_off,defs'), $USER_EXTENDED_CAT) . $ret; } $extended_showed['cat'][$parm] = 1; return $ret; }
function print_store_header($p_name, $p_address_1, $p_address_2, $p_city, $p_state, $p_zip, $p_country, $p_email, $p_welcome_message, $p_print_shop_address) { global $tp, $sc_style; include e_PLUGIN . "easyshop/easyshop_shortcodes.php"; if (file_exists(THEME . "easyshop_template.php")) { include THEME . "easyshop_template.php"; } else { include e_PLUGIN . "easyshop/templates/easyshop_template.php"; } if ($p_address_1 == '' && $p_address_2 == '' && $p_city == '' && $p_state == '' && $p_zip == '' && $p_country == '' or $p_print_shop_address != '1') { $display_message = null; } else { $display_message = 1; } if ($display_message == null) { // Don't display address } else { cachevars('easyshop_store_name', $p_name); if ($p_address_1 != null) { cachevars('easyshop_store_address1', $p_address_1); } if ($p_address_2 != null) { cachevars('easyshop_store_address2', $p_address_2); } if ($p_city != null) { cachevars('easyshop_store_city', $p_city); } if ($p_address_1 == null && $p_address_2 == null && $p_city == null) { cachevars('easyshop_store_conditionalbreak', " "); } if ($p_state != null) { cachevars('easyshop_store_state', $p_state); } if ($p_zip != null) { cachevars('easyshop_store_zip', $p_zip); } if ($p_address_1 == null && $p_address_2 == null && $p_city == null && $p_state == null && $p_zip == null) { // Don't add a line break } else { cachevars('easyshop_store_conditionalbreak2', " "); } if ($p_country != null) { cachevars('easyshop_store_country', $p_country); } if (strlen(trim($p_email)) > 0) { // Security: protect shop e-mail from e-mail harvasting // Method: split the contact e-mail and present it in inline javascript $email = split("@", $p_email); //split e-mail address at the @-sign $p_email_name = $email[0]; // everything before the @-sign $tld = split(".", $email[1]); //split the part after the @-sign on dot-sign //Now use an if->else to find out if it's a subdomain or not if (count($tld) == 2) { //Normal simple address as someone@blah.com $p_email_domain = $email[0]; // domain = blah $p_email_tld = $email[1]; // tld = .com } else { // Subdomains like someone@blah.org.uk // Determine the last tld expression $last_dot = strrchr(".", $email[1]); $p_email_domain = substr($email[1], 0, $last_dot); // domain = blah.org $p_email_tld = substr($email[1], $last_dot); // tld = .uk } // Display the splitted e-mail in an inline javascript where we join them to one e-mail address (in the shortcode) $easyshop_store_email = array($p_email_name, $p_email_domain, $p_email_tld); cachevars('easyshop_store_email', $easyshop_store_email); } // End of showing e-mail when filled in } // End of else of displaying address cachevars('easyshop_store_welcome_message', $p_welcome_message); $sh_text = $tp->parseTemplate($ES_STORE_CONTAINER, FALSE, $easyshop_shortcodes); return $sh_text; }
function sc_lm_external_links($parm = '') { global $menu_pref, $login_menu_shortcodes, $LOGIN_MENU_EXTERNAL_LINK; $tp = e107::getParser(); if (!vartrue($menu_pref['login_menu']['external_links'])) { return ''; } $lbox_infos = login_menu_class::parse_external_list(true, false); $lbox_active = $menu_pref['login_menu']['external_links'] ? explode(',', $menu_pref['login_menu']['external_links']) : array(); if (!vartrue($lbox_infos['links'])) { return ''; } $ret = ''; foreach ($lbox_active as $stackid) { $lbox_items = login_menu_class::clean_links(varset($lbox_infos['links'][$stackid])); if (!$lbox_items) { continue; } foreach ($lbox_items as $num => $lbox_item) { $lbox_item['link_id'] = $stackid . '_' . $num; cachevars('login_menu_linkdata', $lbox_item); $ret .= $tp->parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes); } } return $ret; }
function sc_user_jump_link($parm) { global $full_perms; $sql = e107::getDb(); if (!$full_perms) { return; } $url = e107::getUrl(); if (!($userjump = getcachedvars('userjump'))) { // $sql->db_Select("user", "user_id, user_name", "`user_id` > ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 "); $sql->db_Select_gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` > " . intval($this->var['user_id']) . " AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 "); if ($row = $sql->db_Fetch()) { $userjump['next']['id'] = $row['user_id']; $userjump['next']['name'] = $row['user_name']; } // $sql->db_Select("user", "user_id, user_name", "`user_id` < ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 "); $sql->db_Select_gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` < " . intval($this->var['user_id']) . " AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 "); if ($row = $sql->db_Fetch()) { $userjump['prev']['id'] = $row['user_id']; $userjump['prev']['name'] = $row['user_name']; } cachevars('userjump', $userjump); } if ($parm == 'prev') { return isset($userjump['prev']['id']) ? "<< " . LAN_USER_40 . " [ <a href='" . $url->create('user/profile/view', $userjump['prev']) . "'>" . $userjump['prev']['name'] . "</a> ]" : " "; } else { return isset($userjump['next']['id']) ? "[ <a href='" . $url->create('user/profile/view', $userjump['next']) . "'>" . $userjump['next']['name'] . "</a> ] " . LAN_USER_41 . " >>" : " "; } }
if (vartrue($loginPrefs['new_members'])) { $menu_data['new_users'] = $sql->count('user', '(user_join)', 'WHERE user_join > ' . $time); $new_total += $menu_data['new_users']; } // ------------ Enable stats / other --------------- $menu_data['enable_stats'] = $menu_data || vartrue($loginPrefs['external_stats']) ? true : false; $menu_data['new_total'] = $new_total + $loginClass->get_stats_total(); $menu_data['link_bullet'] = $bullet; $menu_data['link_bullet_src'] = $bullet_src; // ------------ List New Link --------------- $menu_data['listnew_link'] = ''; if ($menu_data['new_total'] && array_key_exists('list_new', $pref['plug_installed'])) { $menu_data['listnew_link'] = e_PLUGIN . 'list_new/list.php?new'; } // ------------ Pass the data & parse ------------ cachevars('login_menu_data', $menu_data); $text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes); //menu caption if (file_exists(THEME . 'images/login_menu.png')) { $caption = '<img src="' . THEME_ABS . 'images/login_menu.png" alt="" />' . LAN_LOGINMENU_5 . ' ' . USERNAME; } else { $caption = LAN_LOGINMENU_5 . ' ' . USERNAME; } //render $ns->tablerender($caption, $text, 'login'); // END LOGGED CODE } else { //get templates if (!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE) { if (file_exists(THEME . 'templates/login_menu/login_menu_template.php')) { require THEME . 'templates/login_menu/login_menu_template.php';