* $Revision$ * $Date$ * $Author$ */ if (!defined('e107_INIT')) { die("Unauthorised Access"); } if (!getperms("2")) { header("location:" . e_BASE . "index.php"); exit; } $sql = e107::getDb(); $tp = e107::getParser(); if (isset($_POST['reset'])) { for ($mc = 1; $mc <= 5; $mc++) { $sql->db_Select("menus", "*", "menu_location='" . $mc . "' ORDER BY menu_order"); $count = 1; $sql2 = new db(); while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch()) { $sql2->db_Update("menus", "menu_order='{$count}' WHERE menu_id='{$menu_id}' "); $count++; } $text = "<b>Menus reset in database</b><br /><br />"; } } else { unset($text); } $frm = e107::getForm(); $text = "The Menu-Manager allows you to place and arrange your menus within your theme template. \n[u]Hover[/u] over the sub-areas to modify existing menu items. \n\nIf you find the menus are not updating correctly, clicking the refresh button below may help. \n[html]\n<form method='post' id='menurefresh' action='" . $_SERVER['PHP_SELF'] . "'>\n<div>\n" . $frm->admin_button('reset', 'Refresh', 'cancel') . "</div>\n</form>\n<div class='indent'><span class='required'><i class='icon-search icon-white'></i></span> indicates that the menu's visibility has been modified.</div>\n[/html]\n"; $text = $tp->toHtml($text, true); $ns->tablerender("Menus Help", $text);
$sql = new db(); if (isset($_POST['create_new'])) { // Create a new record in Properties table $sql->db_Insert(easyshop_properties, "0,\r\n '" . $tp->toDB($_POST['prop_display_name']) . "',\r\n\t\t'" . $tp->toDB($_POST['prop_list']) . "',\r\n\t\t''\r\n ") or die(mysql_error()); } if (isset($_POST['update_prop'])) { // Update the existing record in Properties table $prop_list = $_POST['prop_list']; $prop_prices = $_POST['prop_prices']; // Clean the property array from empty elements General::Array_Clean("", $prop_list); // Transfer the prop_list array back to a string separated by comma's $prop_list = implode(",", $prop_list); $prop_prices = implode(",", $prop_prices); // Actual update $sql->db_Update(easyshop_properties, "prop_display_name='" . $tp->toDB($_POST['prop_display_name']) . "',\r\n\t\tprop_list='" . $tp->toDB($prop_list) . "',\r\n\t\tprop_prices='" . $tp->toDB($prop_prices) . "'\r\n\t\tWHERE property_id='" . $tp->toDB($_POST['property_id']) . "'"); } $upd_message = EASYSHOP_ADMIN_PROP_08; // Property information saved message } // Displays the update message to confirm data is stored in database if (isset($upd_message)) { $ns->tablerender("", "<div style='text-align:center'><b>" . $upd_message . "</b></div>"); header("Location: admin_properties.php"); } // ----------------------------------------------------------------------------+ // ---------------------------- Delete records --------------------------------+ // ----------------------------------------------------------------------------+ if ($action == 'delete') { // Verify deletion before actual delete $delete_text = "\r\n <br /><br />\r\n <center>\r\n " . EASYSHOP_ADMIN_PROP_15 . "\r\n <br /><br />\r\n <table width='100'>\r\n <tr>\r\n <td>\r\n <a href='admin_properties.php?delete_final." . $action_id . "'>" . EASYSHOP_ADMIN_PROP_16 . "</a>\r\n </td>\r\n <td>\r\n <a href='admin_properties.php'>" . EASYSHOP_ADMIN_PROP_17 . "</a>\r\n </td>\r\n </tr>\r\n </table>\r\n </center>";
function convert_rating() { global $plugintable; $plugintable = "pcontent"; if (!is_object($sqlcr)) { $sqlcr = new db(); } $numr = $sqlcr->db_Count("rate", "(*)", "WHERE (rate_table = 'article' || rate_table = 'review' || rate_table = 'content') "); if ($numr > 0) { $sqlcr->db_Update("rate", "rate_table = '" . $plugintable . "' WHERE (rate_table = 'article' || rate_table = 'review' || rate_table = 'content') "); } }
/** * Removes all users in list from a specified user class * (Moved in from e_userclass class) * @param integer $cid - user class ID * @param $uinfoArray is array(uid=>user_class) - list of affected users * @return none */ public function class_remove($cid, $uinfoArray) { $e107 = e107::getInstance(); $uc_sql = new db(); foreach ($uinfoArray as $uid => $curclass) { $newarray = array_diff(explode(',', $curclass), array('', $cid)); $new_userclass = implode(',', $newarray); $uc_sql->db_Update('user', "user_class='" . $e107->tp->toDB($new_userclass, true) . "' WHERE user_id=" . intval($uid)); } }
// e.g. 06 $day_till = $tmp[2]; // e.g. 30 unset($tmp); // unset the arrays, so next time tmp will be determined as new $_POST['discount_valid_till'] = mktime(23, 59, 59, $month_till, $day_till, $year_till); // Till end of day } if (isset($_POST['create_new'])) { // Create a new record in Discounts table $sql->db_Insert(easyshop_discount, "0,\n '" . $tp->toDB($_POST['discount_name']) . "',\n\t\t'" . $tp->toDB($_POST['discount_class']) . "',\n\t\t'" . $tp->toDB($_POST['discount_flag']) . "',\n\t\t'" . $tp->toDB($discount_price) . "',\n\t\t'" . $tp->toDB($discount_percentage) . "',\n\t\t'" . $tp->toDB($_POST['discount_valid_from']) . "',\n\t\t'" . $tp->toDB($_POST['discount_valid_till']) . "',\n\t\t'" . $tp->toDB(trim($_POST['discount_code'])) . "'\n ") or die(mysql_error()); } if (isset($_POST['update_disc'])) { // Update the existing record in Discounts table // Actual update $sql->db_Update(easyshop_discount, "discount_name='" . $tp->toDB($_POST['discount_name']) . "',\n\t\tdiscount_class='" . intval($tp->toDB($_POST['discount_class'])) . "',\n\t\tdiscount_flag='" . $tp->toDB($_POST['discount_flag']) . "',\n\t\tdiscount_price='" . $tp->toDB($discount_price) . "',\n\t\tdiscount_percentage='" . $tp->toDB($discount_percentage) . "',\n\t\tdiscount_valid_from='" . $tp->toDB($_POST['discount_valid_from']) . "',\n\t\tdiscount_valid_till='" . $tp->toDB($_POST['discount_valid_till']) . "',\n\t\tdiscount_code='" . $tp->toDB(trim($_POST['discount_code'])) . "'\n\t\tWHERE discount_id='" . $tp->toDB($_POST['discount_id']) . "'"); } $upd_message = EASYSHOP_ADMIN_DISC_13; // Discount information saved message } // Displays the update message to confirm data is stored in database if (isset($upd_message)) { $ns->tablerender("", "<div style='text-align:center'><b>" . $upd_message . "</b></div>"); header("Location: admin_discounts.php"); } // ----------------------------------------------------------------------------+ // ---------------------------- Delete records --------------------------------+ // ----------------------------------------------------------------------------+ if ($action == 'delete') { // Verify deletion before actual delete $delete_text = "\n <br /><br />\n <center>\n " . EASYSHOP_ADMIN_DISC_20 . "\n <br /><br />\n <table width='100'>\n <tr>\n <td>\n <a href='admin_discounts.php?delete_final." . $action_id . "'>" . EASYSHOP_ADMIN_DISC_21 . "</a>\n </td>\n <td>\n <a href='admin_discounts.php'>" . EASYSHOP_ADMIN_DISC_22 . "</a>\n </td>\n </tr>\n </table>\n </center>";
function editPost($xmlrpcmsg) { $postid = $xmlrpcmsg->getParam(0)->scalarval(); $username = $xmlrpcmsg->getParam(1)->scalarval(); $password = $xmlrpcmsg->getParam(2)->scalarval(); if (userLogin($username, $password, 'H') == true) { $content = $xmlrpcmsg->getParam(3); $title = $content->structMem('title')->scalarval(); $description = '[html]' . $content->structMem('description')->scalarval() . '[/html]'; //22/10/2009 14.48.04 added mt_text_more ie news_extended //check if we have something... $tempTextMore = checkXmlElementS($content->serialize(), 'mt_text_more'); if ($tempTextMore == 1) { $mt_text_more = '[html]' . $content->structMem('mt_text_more')->scalarval() . '[/html]'; } //if date is null will be replaced with current datetime (wordpress like) //check with simplexml for the parameter dateCreated? XMLRPC-PHP seems to not have such functions?? $tempDate = checkXmlElementS($content->serialize(), 'dateCreated'); if ($tempDate == 1) { $dateCreated = $content->structMem('dateCreated')->serialize(); // Not all clients send dateCreated info. So add if statement here if you want to use it. $timestamp = iso8601_decode($dateCreated); // To convert to unix timestamp } else { $timestamp = time(); } //22/10/2009 11.51.54 added $mt_excerpt //add the news summary //check if we have something... $tempExcerpt = checkXmlElementS($content->serialize(), 'mt_excerpt'); if ($tempExcerpt == 1) { $mt_excerpt = $content->structMem('mt_excerpt')->scalarval(); } //22/10/2009 11.51.54 added $mt_allow_comments //add the news_allow_comments flag //check if we have something... $tempAllowComments = checkXmlElementS($content->serialize(), 'mt_allow_comments'); if ($tempAllowComments == 1) { $mt_allow_comments = $content->structMem('mt_allow_comments')->scalarval(); } //26/10/2009 14.30.41 added mt_keywords ie tags //check if we have something... $tempKeywords = checkXmlElementS($content->serialize(), 'mt_keywords'); if ($tempKeywords == 1) { $mt_keywords = $content->structMem('mt_keywords')->scalarval(); } //author from e107 $query = 'SELECT u.user_id FROM `#user` AS u WHERE u.user_loginname = \'' . $username . '\' AND u.user_password = \'' . md5($password) . '\''; $sql = new db(); $sql->db_Select_gen($query); $row = $sql->db_Fetch(); $author = $row['user_id']; if ($content->structMem('categories')->arraySize() > 0) { $categories = $content->structMem('categories')->arrayMem(0)->scalarval(); //try to read out the id of the category if ($categories != '') { $query = 'SELECT c.category_id FROM `#news_category` AS c WHERE c.category_name = \'' . $categories . '\''; $sql->db_Select_gen($query); $row = $sql->db_Fetch(); $categories = $row['category_id']; } } $published = $xmlrpcmsg->getParam(4)->scalarval(); // TODO use: // $ix = new news; // $ret = $ix->submit_item($arrayvalues); //edit data with new fuctions $data = array(); //to update we need to set news id... $data['data']['news_id'] = $postid; $data['_FIELD_TYPES']['news_id'] = 'int'; $data['data']['news_title'] = $title; $data['_FIELD_TYPES']['news_title'] = 'todb'; $data['data']['news_body'] = $description; $data['_FIELD_TYPES']['news_body'] = 'todb'; $data['data']['news_extended'] = $mt_text_more; $data['_FIELD_TYPES']['news_extended'] = 'todb'; $data['data']['news_datestamp'] = $timestamp; $data['_FIELD_TYPES']['news_datestamp'] = 'int'; $data['data']['news_author'] = $author; $data['_FIELD_TYPES']['news_author'] = 'int'; $data['data']['news_category'] = $categories; //category id is taken by a query against news categories $data['_FIELD_TYPES']['news_category'] = 'int'; $data['data']['news_allow_comments'] = $mt_allow_comments; $data['_FIELD_TYPES']['news_allow_comments'] = 'int'; $data['data']['news_start'] = ''; //NOT AVAIBLE MAKE A CUSTOM FIELD? $data['_FIELD_TYPES']['news_start'] = 'int'; $data['data']['news_end'] = ''; //NOT AVAIBLE MAKE A CUSTOM FIELD? $data['_FIELD_TYPES']['news_end'] = 'int'; //$data['data']['news_class'] = $news['news_class']; //$data['_FIELD_TYPES']['news_class'] = 'todb'; $data['data']['news_render_type'] = eXMLRPC_NEWS_RENDER_TYPE_LOC; //from preferences $data['_FIELD_TYPES']['news_render_type'] = 'int'; //news_comment_total $data['data']['news_summary'] = $mt_excerpt; //NOT AVAIBLE MAKE A CUSTOM FIELD? $data['_FIELD_TYPES']['news_summary'] = 'todb'; $data['data']['news_thumbnail'] = ''; //NOT APPLICABLE? $data['_FIELD_TYPES']['news_thumbnail'] = 'todb'; $data['data']['news_sticky'] = ''; //NOT AVAIBLE MAKE A CUSTOM FIELD? $data['_FIELD_TYPES']['news_sticky'] = 'int'; $data['data']['news_meta_keywords'] = $mt_keywords; $data['_FIELD_TYPES']['news_meta_keywords'] = 'todb'; $data['data']['news_meta_description'] = ''; //NOT AVAIBLE MAKE A CUSTOM FIELD? $data['_FIELD_TYPES']['news_meta_description'] = 'todb'; $postid = $sql->db_Update('news', $data); return new xmlrpcresp(new xmlrpcval(true, 'boolean')); } else { return new xmlrpcresp(0, $xmlrpcerruser + 1, 'Login Failed'); } }
/** * Adds all users in list to a specified user class * (Moved in from e_userclass class) * @param integer $cid - user class ID * @param $uinfoArray is array(uid=>user_class) - list of affected users * @return none */ public function class_add($cid, $uinfoArray) { $e107 = e107::getInstance(); $uc_sql = new db(); foreach ($uinfoArray as $uid => $curclass) { if ($curclass) { $newarray = array_unique(array_merge(explode(',', $curclass), array($cid))); $new_userclass = implode(',', $newarray); } else { $new_userclass = $cid; } $uc_sql->db_Update('user', "user_class='" . e107::getParser()->toDB($new_userclass, true) . "' WHERE user_id=" . intval($uid)); } }
function view_subscribers($p_id) { $ns = e107::getRender(); $mes = e107::getMessage(); $frm = e107::getForm(); $nl_sql = new db(); $_nl_sanatized = ''; if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) { $mes->addError(NLLAN_56); $vs_text .= "<div class='buttons-bar center'>\n\t\t\t\t\t\t\t<input class='btn btn-default button' type=button value='" . LAN_BACK . "' onClick=\"window.location='" . e_SELF . "'\">\n\t\t\t\t\t\t</div>"; $ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text); return; } else { $vs_text .= "\n\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table class='table adminlist'>\n\t\t\t<colgroup>\n\t\t\t\t<col style='width: 5%; text-align: center;' />\n\t\t\t\t<col style='width: 35%;' />\n\t\t\t\t<col style='width: 45%;' />\n\t\t\t\t<col style='width: 15%; text-align: center;' />\n\t\t\t</colgroup>\n\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . LAN_ID . "</td>\n\t\t\t\t\t<td>" . LAN_NAME . "</td>\n\t\t\t\t\t<td>" . LAN_EMAIL . "</td>\n\t\t\t\t\t<td>" . LAN_OPTIONS . "</td>\n\t\t\t\t</tr>"; if ($nl_row = $nl_sql->db_Fetch()) { $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers'])); sort($subscriber_list); $subscribers_total_count = count($subscribers_list) - 1; // Get a null entry as well } if ($subscribers_total_count < 1) { header("location:" . e_SELF); exit; } // Loop through each user in the array subscribers_list & sanatize $_last_subscriber = ''; foreach ($subscribers_list as $val) { $val = trim($val); if ($val) { if ($val != $_last_subscriber) { $nl_sql->db_Select("user", "*", "user_id=" . $val); if ($nl_row = $nl_sql->db_Fetch()) { $vs_text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . $val . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a></td>\n\t\t\t\t\t\t\t\t<td>" . $nl_row['user_email'] . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "</td>\n\t\t\t\t\t\t\t</tr>"; $_last_subscriber = $val; } } else { // Duplicate user id found in the subscribers_list array! newsletter::remove_subscribers($p_id, $val); // removes all entries for this user id $newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val; // keep this single value in the list $nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'"); $subscribers_total_count--; $_nl_sanatized = 1; } } } } $vs_text .= "\n\t\t<tr>\n\t\t\t<td colspan='4'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t</tr>\n\t\t </table>\n\t\t\t <div class='buttons-bar center'>\n\t\t\t \t" . $frm->admin_button('submit', LAN_BACK, 'submit') . "\n\t\t\t </div>\t\t\t\n\t\t </form>\n\t\t "; if ($_nl_sanatized == 1) { $mes->addInfo(NLLAN_66); } $ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text); }
function UpdateContentPref($id) { global $qs, $plugintable, $sql, $tp; if (!is_object($sql)) { $sql = new db(); } //insert default preferences into core if ($id == "0") { $num_rows = $sql->db_Select("core", "*", "e107_name='{$plugintable}' "); if ($num_rows == 0) { $sql->db_Insert("core", "'{$plugintable}', '' "); } else { $row = $sql->db_Fetch(); } //prepare custom tags: use the posted value $cp = $_POST['content_custom_preset_key']; //insert category preferences into plugintable } else { //first get the existing prefs and parent $sql->db_Select($plugintable, "content_pref, content_parent", "content_id='" . intval($id) . "' "); $row = $sql->db_Fetch(); $current = e107::unserialize($row['content_pref']); //$current = $eArrayStorage->ReadxxxArray($row['content_pref']); $currentparent = $row['content_parent']; //if we are updating options if (isset($qs[0]) && $qs[0] == 'options') { //only use the manager prefs from the existing set foreach ($current as $k => $v) { if (strpos($k, "content_manager_") === 0 || strpos($k, "content_restrict_") === 0) { $content_pref[$k] = $tp->toDB($v); } } //prepare custom tags: use the posted values $cp = $_POST['content_custom_preset_key']; //if we are updating manager } elseif (isset($qs[0]) && ($qs[0] == 'manager' || $qs[0] == 'restrict')) { //if this is a top level category we need to keep all existing options if ($currentparent == '0') { $content_pref = $current; } //prepare custom tags: use the existing content_pref values $cp = $content_pref['content_custom_preset_key']; } } //parse custom tags and covert them in $_POST values ($cp is derived above) $string = array(); foreach ($cp as $ck => $cv) { if (!empty($cv)) { $string[] = $cv; } } if (is_array($string) && !empty($string[0])) { $_POST['content_custom_preset_key'] = $string; } //convert all $_POST to $content_pref for storage, and renew the existing stored prefs foreach ($_POST as $k => $v) { if (strpos($k, "content_") === 0) { $content_pref[$k] = $tp->toDB($v); } } //create new array of preferences $tmp = e107::serialize($content_pref, true); //$tmp = $eArrayStorage->WritexxxArray($content_pref); //update core table if ($id == "0") { $sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '{$plugintable}' "); //update plugin table } else { $sql->db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='" . intval($id) . "' "); } return $content_pref; }
function menuScanMenus() { global $sql, $sql2; $efile = new e_file(); $efile->dirFilter = array('/', 'CVS', '.svn', 'languages'); $fileList = $efile->get_files(e_PLUGIN, "_menu\\.php\$", 'standard', 2); foreach ($fileList as $file) { list($parent_dir) = explode('/', str_replace(e_PLUGIN, "", $file['path'])); $file['path'] = str_replace(e_PLUGIN, "", $file['path']); $file['fname'] = str_replace(".php", "", $file['fname']); $valid_menu = FALSE; $existing_menu = $sql->db_Count("menus", "(*)", "WHERE menu_name='{$file['fname']}'"); if (file_exists(e_PLUGIN . $parent_dir . '/plugin.xml') || file_exists(e_PLUGIN . $parent_dir . '/plugin.php')) { if (e107::isInstalled($parent_dir)) { // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed $valid_menu = TRUE; // Whether new or existing, include in list // echo "Include {$parent_dir}:{$file['fname']}<br />"; } } else { $valid_menu = TRUE; // echo "Default Include {$parent_dir}:{$file['fname']}<br />"; } if ($valid_menu) { $menustr .= "&" . str_replace(".php", "", $file['fname']); if (!$existing_menu) { $insert = array('menu_id' => 0, 'menu_name' => $file['fname'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $file['path'], 'menu_layout' => '', 'menu_parms' => ''); if ($sql->db_Insert("menus", $insert)) { // Could do admin logging here - but probably not needed $message .= MENLAN_10 . " - " . $file['fname'] . "<br />"; } } } } //Reorder all menus into 1...x order if (!is_object($sql2)) { $sql2 = new db(); } // Shouldn't be needed foreach ($this->menu_areas as $menu_act) { if ($sql->db_Select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC")) { $c = 1; while ($row = $sql->db_Fetch()) { $sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']); $c++; } } } $sql->db_Select("menus", "*", "menu_path NOT REGEXP('[0-9]+') "); while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch(MYSQL_NUM)) { if (stristr($menustr, $menu_name) === FALSE) { $sql2->db_Delete("menus", "menu_name='{$menu_name}'"); $message .= MENLAN_11 . " - " . $menu_name . "<br />"; } } $this->menuAddMessage($message, E_MESSAGE_INFO); }
// Change item active status $sql2 = new db(); $sql2->db_Update(DB_TABLE_SHOP_ITEMS, "item_active_status='1'\n\t\t\tWHERE category_id='" . intval($tp->toDB($_POST['category_id'])) . "'"); foreach ($_POST['item_active_status'] as $value) { $sql2->db_Update(DB_TABLE_SHOP_ITEMS, "item_active_status='2'\n\t\t\t\tWHERE item_id='" . intval($tp->toDB($value)) . "'"); } // Change item 'Out Of Stock' status $sql3 = new db(); $sql3->db_Update(DB_TABLE_SHOP_ITEMS, "item_out_of_stock='1'\n\t \t WHERE category_id='" . intval($tp->toDB($_POST['category_id'])) . "'"); foreach ($_POST['item_out_of_stock'] as $value) { $sql3->db_Update(DB_TABLE_SHOP_ITEMS, "item_out_of_stock='2'\n WHERE item_id='" . intval($tp->toDB($value)) . "'"); } // Change item 'Out Of Stock' explanation $sql4 = new db(); foreach ($_POST['item_out_of_stock_explanation'] as $key => $value) { $sql4->db_Update(DB_TABLE_SHOP_ITEMS, "item_out_of_stock_explanation='" . $tp->toDB($value) . "'\n WHERE item_id='" . intval($tp->toDB($key)) . "'"); } header("Location: " . e_SELF); exit; } else { if ($_POST['edit_item'] == '2') { //-----------------------------------------------------------------------------+ //----------------------- Edit existing product -------------------------------+ //-----------------------------------------------------------------------------+ // Pushed 'Apply Changes' button on Edit Product // Check: name is mandatory if ($tp->toDB($_POST['item_name']) == "") { $text .= EASYSHOP_CONFEDIT_ITM_10 . "<br />"; } // First check on valid pricing if (General::validateDecimal($tp->toDB($_POST['item_price']))) {
function menuScanMenus() { global $sql2; $sql = e107::getDb(); $efile = new e_file(); $efile->dirFilter = array('/', 'CVS', '.svn', 'languages'); $fileList = $efile->get_files(e_PLUGIN, "_menu\\.php\$", 'standard', 2); $this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG); $menuList = array(); // existing menus in table. if ($result = $sql->retrieve('menus', 'menu_name', null, true)) { foreach ($result as $mn) { if ($mn['menu_name']) { $menuList[] = $mn['menu_name']; } } } //v2.x Scan Custom Page Menus. $pageMenus = $sql->retrieve('page', 'page_id, menu_name, menu_title', "menu_name !='' ", true); foreach ($pageMenus as $row) { if (!in_array($row['menu_name'], $menuList)) { $insert = array('menu_id' => 0, 'menu_name' => $row['menu_name'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $row['page_id'], 'menu_layout' => '', 'menu_parms' => ''); if ($sql->insert("menus", $insert)) { $this->menuAddMessage(MENLAN_10 . " - " . $row['menu_name'], E_MESSAGE_DEBUG); } } } foreach ($fileList as $file) { list($parent_dir) = explode('/', str_replace(e_PLUGIN, "", $file['path'])); $file['path'] = str_replace(e_PLUGIN, "", $file['path']); $file['fname'] = str_replace(".php", "", $file['fname']); $valid_menu = FALSE; $existing_menu = in_array($file['fname'], $menuList); // $sql->count("menus", "(*)", "WHERE menu_name='{$file['fname']}'"); if (file_exists(e_PLUGIN . $parent_dir . '/plugin.xml') || file_exists(e_PLUGIN . $parent_dir . '/plugin.php')) { if (e107::isInstalled($parent_dir)) { // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed $valid_menu = TRUE; // Whether new or existing, include in list // echo "Include {$parent_dir}:{$file['fname']}<br />"; } } else { $valid_menu = TRUE; // echo "Default Include {$parent_dir}:{$file['fname']}<br />"; } if ($valid_menu) { $menustr .= "&" . str_replace(".php", "", $file['fname']); if (!$existing_menu) { $insert = array('menu_id' => 0, 'menu_name' => $file['fname'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $file['path'], 'menu_layout' => '', 'menu_parms' => ''); if ($sql->insert("menus", $insert)) { // Could do admin logging here - but probably not needed $message .= MENLAN_10 . " - " . $file['fname'] . "<br />"; //FIXME } else { $this->menuAddMessage("Couldn't add menu: " . $file['fname'] . " to table ", E_MESSAGE_DEBUG); } } } } //Reorder all menus into 1...x order if (!is_object($sql2)) { $sql2 = new db(); } // Shouldn't be needed if (!is_object($sql3)) { $sql3 = new db(); } $location_count = $sql3->select("menus", "menu_location", "menu_location>0 GROUP BY menu_location"); while ($location_count) { if ($sql->select("menus", "menu_id", "menu_location={$location_count} ORDER BY menu_order ASC")) { $c = 1; while ($row = $sql->fetch()) { $sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']); $c++; } } $location_count--; } $sql->select("menus", "*", "menu_path NOT REGEXP('[0-9]+') "); while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->fetch(MYSQL_NUM)) { if (stristr($menustr, $menu_name) === FALSE) { $sql2->db_Delete("menus", "menu_name='{$menu_name}'"); $message .= MENLAN_11 . " - " . $menu_name . "<br />"; } } $this->menuAddMessage(vartrue($message), E_MESSAGE_DEBUG); }
function update_stock($txn_id = NULL, $phpsessionid = NULL) { global $pref; $sqlcheck = new db(); $trans_array = transaction($phpsessionid, 0, 0, "Completed"); $items_array = unserialize($trans_array['all_items']); $count = 1; $temp_array = ""; while ($items_array["db_id_" . $count]) { if ($sqlcheck->db_Select("easyshop_items", "*", "item_id = '" . $items_array["db_id_" . $count] . "'")) { while ($row = $sqlcheck->db_Fetch()) { if ($row['item_track_stock'] == 2) { // Is this a tracked stock item? if ($row['item_instock'] >= $items_array["quantity" . $count]) { $newstock = $row['item_instock'] - $items_array["quantity_" . $count]; if ($row['item_minimum'] == 0 || $row['item_minimum'] == NULL) { // Minimum level is flexible, but with bottom-level 1. $minimum_level = 1; } else { $minimum_level = $row['item_minimum']; } if ($newstock <= $minimum_level && $newstock != 0) { // Minimum level is reached; send e-mail alert ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 1); // Alert-type = 1 } if ($newstock == 0) { $sqlcheck->db_Update("easyshop_items", "item_instock = '" . $newstock . "', item_out_of_stock = '2'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'"); ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 3); // Alert-type = 3 } else { $sqlcheck->db_Update("easyshop_items", "item_instock = '" . $newstock . "'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'"); } } else { // There is a problem; client has paid for more items than are in stock // Raise out of stock flag and send email $sqlcheck->db_Update("easyshop_items", "item_instock = '0', item_out_of_stock = '2'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'"); ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 2); // Alert-type = 2 } } if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0 && $trans_array['ipn_user_id'] > 0) { // Auto promotion of user $sqlcheck2 = new db(); $sqlcheck3 = new db(); require_once e_HANDLER . 'userclass_class.php'; $promo_class_name = r_userclass_name($row['prod_promo_class']); $sqlcheck2->db_Select("user", "*", "user_id='" . $trans_array['ipn_user_id'] . "'"); if ($row2 = $sqlcheck2->db_Fetch()) { $user_name = $row2['user_name']; $class_extant = explode(',', $row2['user_class']); foreach ($class_extant as $key => $value) { if (intval($value) == 0) { unset($class_extant[$key]); } } if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0 && !in_array($row['prod_promo_class'], $class_extant)) { $class_extant[] = $row['prod_promo_class']; } $new_array = array_unique($class_extant); sort($new_array); $class_list = implode(',', $new_array); $sqlcheck3->db_Update("user", "user_class='" . $class_list . "' where user_id='" . $trans_array['ipn_user_id'] . "'"); $mailto = !(isset($pref['siteadminemail']) && strlen($pref['siteadminemail']) == 0) ? $pref['replyto_email'] : $pref['siteadminemail']; // Keep 0.7.8 compatible $subject = $pref['sitename'] . ": " . EASYSHOP_IPN_30; // [USERNAME] upgraded to class [PROMOCLASS] $subject = str_replace("[USERNAME]", $user_name, $subject); $subject = str_replace("[PROMOCLASS]", $promo_class_name, $subject); $message = EASYSHOP_IPN_31 . "<br /><br />"; $message .= EASYSHOP_IPN_32 . "<br /><br />"; $message .= EASYSHOP_IPN_33 . "<br />"; $message .= "<br />" . EASYSHOP_IPN_34 . " " . $pref['siteurl']; $message .= "<br /><br />© " . date("Y") . " EasyShop"; $message = str_replace("[USERNAME]", $row2['user_name'], $message); $message = str_replace("[USERLINK]", SITEURL . "user.php?id." . $trans_array['ipn_user_id'], $message); $message = str_replace("[PROMOCLASS]", r_userclass_name($row['prod_promo_class']), $message); $message = str_replace("[TRANSACTIONID]", $trans_array['txn_id'], $message); $message = str_replace("[PRODUCTPRICE]", $items_array["amount_" . $count], $message); $message = str_replace("[PRODUCTQTY]", $items_array["quantity_" . $count], $message); $message = str_replace("[CURRENCY]", $trans_array['mc_currency'], $message); $message = str_replace("[GROSSAMOUNT]", $trans_array['mc_gross'], $message); $message = str_replace("[PAYMENTDATE]", $trans_array['payment_date'], $message); $message = str_replace("[PRODLINK]", SITEURL . e_PLUGIN . "easyshop/easyshop.php?prod." . $items_array["db_id_" . $count], $message); $message = str_replace("[PRODUCTNAME]", $items_array["item_name_" . $count], $message); $user_message = EASYSHOP_IPN_35; $user_message .= "<br />" . EASYSHOP_IPN_36; $user_message .= "<br />" . EASYSHOP_IPN_34 . " " . $pref['siteurl']; $user_message .= "<br /><br />© " . date("Y") . " EasyShop"; $user_message = str_replace("[PRODUCTNAME]", $items_array["item_name_" . $count], $user_message); $user_message = str_replace("[PROMOCLASS]", r_userclass_name($row['prod_promo_class']), $user_message); //ShopMail::easyshop_sendemail($mailto, $subject, $message, $headers2, $attachment_name); if ($row2['user_class'] != $class_list) { // Only send an e-mail if the user_class array actually changed ShopMail::easyshop_sendemail($mailto, $subject, $message, $headers2, $attachment_name); // Mail to admin ShopMail::easyshop_sendemail($row2['user_email'], $subject, $user_message, $headers2, $attachment_name); // Mail to user } } } $temp_array = array($row['item_id'] => array("item_name" => $items_array["item_name_" . $count], "db_id" => $row['item_id'])); } } else { // This item does not exist!!! //$sqlcheck -> db_Close(); return FALSE; } $count++; } // Send downloads $to_email = $trans_array['payer_email']; ShopMail::easyshop_senddownloads($temp_array, $to_email); //$sqlcheck -> db_Close(); return TRUE; }
function displayPersonalManager() { global $qs, $sql, $sql2, $lc, $link_shortcodes, $cobj, $row, $from, $tp, $ns, $linkspage_pref; global $LINK_TABLE_MANAGE_START, $LINK_TABLE_MANAGE, $LINK_TABLE_MANAGE_END; if (!(isset($linkspage_pref['link_manager']) && $linkspage_pref['link_manager'])) { js_location(e_SELF); } //delete link if (isset($linkspage_pref['link_directdelete']) && $linkspage_pref['link_directdelete']) { if (isset($_POST['delete'])) { $tmp = array_pop(array_flip($_POST['delete'])); list($delete, $del_id) = explode("_", $tmp); } if (isset($delete) && $delete == 'main') { $sql->db_Select("links_page", "link_category, link_order, link_author", "link_id='" . intval($del_id) . "'"); // Get the position of target in the order $row = $sql->db_Fetch(); if ($row['link_author'] != USERID) { header('Location: ' . SITEURL); exit; } if (!is_object($sql2)) { $sql2 = new db(); } $sql->db_Select("links_page", "link_id", "link_order>'" . $row['link_order'] . "' && link_category='" . intval($row['link_category']) . "'"); while ($row = $sql->db_Fetch()) { $sql2->db_Update("links_page", "link_order=link_order-1 WHERE link_id='" . $row['link_id'] . "'"); } if ($sql->db_Delete("links_page", "link_id='" . intval($del_id) . "'")) { $lc->show_message(LCLAN_ADMIN_10 . " #" . $del_id . " " . LCLAN_ADMIN_11); } } } //upload link icon if (isset($_POST['uploadlinkicon'])) { $lc->uploadLinkIcon(); } //show existing links if (!check_class($linkspage_pref['link_manager_class'])) { js_location(e_SELF); } else { $qry = "\n\t\tSELECT l.*, lc.*\n\t\tFROM #links_page AS l\n\t\tLEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category\n\t\tWHERE l.link_author = '" . USERID . "'\n\t\tORDER BY l.link_name\n\t\t"; $link_table_manage = ""; if (!($manager_total = $sql->db_Select_gen($qry))) { $text = LAN_LINKS_MANAGER_4; } else { $link_table_manage_start = $tp->parseTemplate($LINK_TABLE_MANAGE_START, FALSE, $link_shortcodes); while ($row = $sql->db_Fetch()) { $link_table_manage .= $tp->parseTemplate($LINK_TABLE_MANAGE, FALSE, $link_shortcodes); } $link_table_manage_end = $tp->parseTemplate($LINK_TABLE_MANAGE_END, FALSE, $link_shortcodes); $text = $link_table_manage_start . $link_table_manage . $link_table_manage_end; } $ns->tablerender(LAN_LINKS_35, $text); //show link create $lc->show_link_create(); } return; }
function view_subscribers($p_id) { $nl_sql = new db(); $_nl_sanatized = ''; if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) { // Check if newsletter id is available $vs_text .= "<br /><br /><span style='text-align:center'>" . NLLAN_56 . "<br /><br/>\n\t\t\t\t\t <input class='button' type=button value='" . NLLAN_57 . "' onClick=\"window.location='" . e_SELF . "'\"></span>"; $ns->tablerender(NLLAN_58, $vs_text); return; } else { $vs_text .= "\n\t\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table style='" . ADMIN_WIDTH . "' class='fborder'>\n\t\t\t\t<tr>\n\t\t\t\t<td style='width:5%; text-align: center;' class='forumheader'>" . NLLAN_55 . "</td>\n\t\t\t\t<td style='width:35%' class='forumheader'>" . NLLAN_59 . "</td>\n\t\t\t\t<td style='width:45%;' class='forumheader'>" . NLLAN_60 . "</td>\n\t\t\t\t<td style='width:15%; text-align: center;' class='forumheader'>" . NLLAN_61 . "</td>\n\t\t\t\t</tr>"; if ($nl_row = $nl_sql->db_Fetch()) { $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers'])); sort($subscriber_list); $subscribers_total_count = count($subscribers_list) - 1; // Get a null entry as well } if ($subscribers_total_count < 1) { header("location:" . e_SELF); exit; } // Loop through each user in the array subscribers_list & sanatize $_last_subscriber = ''; foreach ($subscribers_list as $val) { $val = trim($val); if ($val) { if ($val != $_last_subscriber) { $nl_sql->db_Select("user", "*", "user_id=" . $val); if ($nl_row = $nl_sql->db_Fetch()) { $vs_text .= "<tr>\n\t\t\t\t\t\t\t\t<td style='text-align: center;' class='forumheader3'>{$val}\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='forumheader3'><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $nl_row['user_email'] . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td style='text-align: center;' class='forumheader3'><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>\n\t\t\t\t\t\t\t" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; $_last_subscriber = $val; } } else { // Duplicate user id found in the subscribers_list array! newsletter::remove_subscribers($p_id, $val); // removes all entries for this user id $newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val; // keep this single value in the list $nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'"); $subscribers_total_count--; $_nl_sanatized = 1; } } } } $vs_text .= "\n\t\t <tr>\n\t\t <td colspan='4' class='forumheader'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t </tr>\n\t\t <tr><td colspan='4' style='text-align:center;'><br /><input class='button' type='submit' value='" . NLLAN_64 . "' /></td></tr>\n\t\t </table></form>\n\t\t "; if ($_nl_sanatized == 1) { $vs_text .= "<br /><div style='text-align:center;'>" . NLLAN_66 . "</div>"; } $this->e107->ns->tablerender(NLLAN_65 . ' ' . $p_id, $vs_text); }
function show_content_item() { global $pref, $content_pref, $content_icon_path, $content_image_path, $content_file_path, $custom, $plugindir, $plugintable, $array, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $ns, $rater, $ep, $row, $authordetails, $mainparent; global $CONTENT_CONTENT_TABLE_TEXT, $CONTENT_CONTENT_TABLE_PAGENAMES, $CONTENT_CONTENT_TABLE_SUMMARY, $CONTENT_CONTENT_TABLE_CUSTOM_TAGS, $CONTENT_CONTENT_TABLE_PARENT, $CONTENT_CONTENT_TABLE_INFO_PRE, $CONTENT_CONTENT_TABLE_INFO_POST, $CONTENT_CONTENT_TABLE_AUTHORDETAILS, $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA, $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA; global $CONTENT_CONTENT_TABLE_PREV_PAGE, $CONTENT_CONTENT_TABLE_NEXT_PAGE; $newcontent_shortcodes = e107::getScBatch('content', TRUE); //if we get here through the rated auto-redirect //we need to delete cache and redirect to the normal item url if (isset($qs[2]) && ($qs[2] == 'rated' || is_numeric($qs[2]) && $qs[3] == 'rated')) { $e107cache->clear("{$plugintable}.content.{$qs['1']}"); $e107cache->clear("comment.{$plugintable}.{$qs['1']}"); //and reset qs[2] if ($qs[2] == 'rated') { $qs[2] = ''; $qry = e_SELF . "?content." . $qs[1]; } else { $qs[3] = ''; $qry = e_SELF . "?content." . $qs[1] . "." . $qs[2]; } header("location:" . $qry); exit; } $mainparent = $aa->getMainParent(intval($qs[1])); $content_pref = $aa->getContentPref($mainparent); show_content_search_menu("item", $mainparent); //show navigator/search/order menu $array = $aa->getCategoryTree("", $mainparent, TRUE); $validparent = implode(",", array_keys($array)); $qry = "content_id='" . intval($qs[1]) . "' AND content_refer !='sa' AND content_parent REGEXP '" . $aa->CONTENTREGEXP($validparent) . "' " . $datequery . " AND content_class REGEXP '" . e_CLASS_REGEXP . "' "; if (!($resultitem = $sql->db_Select($plugintable, "*", $qry))) { header("location:" . e_SELF . "?recent." . $mainparent); exit; } else { $row = $sql->db_Fetch(); //update refer count outside of cache (count visits ^ count unique ips) if (isset($content_pref["content_log"]) && $content_pref["content_log"]) { $ip = $e107->getip(); $self = e_SELF; $refertmp = explode("^", $row['content_refer']); if (strpos($self, "admin") === FALSE) { if (strpos($refertmp[1], $ip) === FALSE) { $referiplist = $refertmp[1] ? $refertmp[1] . "-" . $ip : $ip; $contentrefernew = $refertmp[0] + 1 . "^" . $referiplist; } else { $contentrefernew = $refertmp[0] + 1 . "^" . $refertmp[1]; } $sql = new db(); $sql->db_Update($plugintable, "content_refer='" . $contentrefernew . "' WHERE content_id='" . intval($qs[1]) . "' "); $e107cache->clear("{$plugintable}.content.{$qs['1']}"); $e107cache->clear("{$plugintable}.recent.{$mainparent}"); $e107cache->clear("{$plugintable}.cat.list.{$mainparent}"); $e107cache->clear("{$plugintable}.cat.{$mainparent}"); $e107cache->clear("{$plugintable}.author.{$mainparent}"); $e107cache->clear("{$plugintable}.top.{$mainparent}"); } } if (!isset($qs[2]) || ($qs[2] = intval($qs[2])) <= 0) { $cacheid = 1; $qs[2] = 1; // Force first page } else { $cacheid = $qs[2]; } $cachestr = "{$plugintable}.content.{$qs['1']}.{$cacheid}"; $cachecheck = CachePre($cachestr); if ($cachecheck) { echo $cachecheck; // return; } else { $content_pref["content_cat_icon_path_large"] = $content_pref["content_cat_icon_path_large"] ? $content_pref["content_cat_icon_path_large"] : "{e_PLUGIN}content/images/cat/48/"; $content_pref["content_cat_icon_path_small"] = $content_pref["content_cat_icon_path_small"] ? $content_pref["content_cat_icon_path_small"] : "{e_PLUGIN}content/images/cat/16/"; $content_pref["content_icon_path"] = $content_pref["content_icon_path"] ? $content_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/"; $content_pref["content_image_path"] = $content_pref["content_image_path"] ? $content_pref["content_image_path"] : "{e_PLUGIN}content/images/image/"; $content_pref["content_file_path"] = $content_pref["content_file_path"] ? $content_pref["content_file_path"] : "{e_PLUGIN}content/images/file/"; $content_cat_icon_path_large = $tp->replaceConstants($content_pref["content_cat_icon_path_large"]); $content_cat_icon_path_small = $tp->replaceConstants($content_pref["content_cat_icon_path_small"]); $content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]); $content_image_path = $tp->replaceConstants($content_pref["content_image_path"]); $content_file_path = $tp->replaceConstants($content_pref["content_file_path"]); $number = isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5"; $nextprevquery = isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT " . intval($from) . "," . intval($number) : ""; $CONTENT_CONTENT_TABLE_AUTHORDETAILS = $aa->prepareAuthor("content", $row['content_author'], $row['content_id']); $CONTENT_CONTENT_TABLE_TEXT = $row['content_text']; $CONTENT_CONTENT_TABLE_PREV_PAGE = FALSE; $CONTENT_CONTENT_TABLE_NEXT_PAGE = FALSE; $lastpage = FALSE; //boolean whether or not the current page is the last page if (preg_match_all("/\\[newpage.*?]/si", $row['content_text'], $matches)) { //remove html bbcode (since we're splitting the text, the html bbcode would not be parsed) $row['content_text'] = preg_replace("/\\[html\\](.*?)\\[\\/html\\]/si", '\\1', $row['content_text']); //split newpage $pages = preg_split("/\\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY); $pages = array_values($pages); //remove empty values if (trim($pages[0]) == "") { unset($pages[0]); } $pages = array_values($pages); if (count($pages) == count($matches[0])) { } elseif (count($pages) > count($matches[0])) { $matches[0] = array_pad($matches[0], -count($pages), "[newpage]"); } elseif (count($pages) < count($matches[0])) { } $CONTENT_CONTENT_TABLE_TEXT = $pages[!$qs[2] ? 0 : $qs[2] - 1]; $options = ""; for ($i = 0; $i < count($pages); $i++) { if (!isset($qs[2])) { $idp = 1; } else { $idp = $qs[2]; } if ($idp == $i + 1) { $pre = CONTENT_LAN_92; } else { $pre = ""; } if ($matches[0][$i] == "[newpage]") { $pagename[$i] = CONTENT_LAN_78; } else { $arrpagename = explode("[newpage=", $matches[0][$i]); $pagename[$i] = substr($arrpagename[1], 0, -1); } if (isset($content_pref["content_content_pagenames_nextprev"]) && $content_pref["content_content_pagenames_nextprev"]) { if ($idp > 1) { if (isset($content_pref["content_content_pagenames_nextprev_prevhead"]) && $content_pref["content_content_pagenames_nextprev_prevhead"]) { $cap = $content_pref["content_content_pagenames_nextprev_prevhead"]; $cap = str_replace("{PAGETITLE}", $pagename[$idp - 2], $cap); } else { $cap = CONTENT_LAN_90; } $CONTENT_CONTENT_TABLE_PREV_PAGE = "<a href='" . e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($idp - 1) . "'>" . $cap . "</a>"; } else { $CONTENT_CONTENT_TABLE_PREV_PAGE = ' '; } if ($idp < count($pages)) { if (isset($content_pref["content_content_pagenames_nextprev_nexthead"]) && $content_pref["content_content_pagenames_nextprev_nexthead"]) { $cap = $content_pref["content_content_pagenames_nextprev_nexthead"]; $cap = str_replace("{PAGETITLE}", $pagename[$idp], $cap); } else { $cap = CONTENT_LAN_91; } $CONTENT_CONTENT_TABLE_NEXT_PAGE = "<a href='" . e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($idp + 1) . "'>" . $cap . "</a>"; } else { $CONTENT_CONTENT_TABLE_NEXT_PAGE = ' '; } } //0:normal links, 1:selectbox //$content_pref["content_content_pagenames_rendertype"] = "1"; if (isset($content_pref["content_content_pagenames_rendertype"]) && $content_pref["content_content_pagenames_rendertype"] == "1") { $page = CONTENT_LAN_79 . " " . ($i + 1) . " " . $pre . " " . $pagename[$i]; $url = e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($i + 1); $options .= $rs->form_option($page, $idp == $i + 1 ? "1" : "0", $url, ""); } else { $options .= CONTENT_LAN_79 . " " . ($i + 1) . " " . $pre . " : <a href='" . e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($i + 1) . "'>" . $pagename[$i] . "</a><br />"; } if ($idp == 1) { $CONTENT_CONTENT_TABLE_SUMMARY = isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp->toHTML($row['content_summary'], TRUE, "SUMMARY") : ""; $CONTENT_CONTENT_TABLE_SUMMARY = $tp->replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY); } else { $CONTENT_CONTENT_TABLE_SUMMARY = ""; } //render custom/preset on first page if (isset($content_pref['content_content_multipage_preset']) && $content_pref['content_content_multipage_preset']) { if ($idp == '1') { $lastpage = TRUE; } //render custom/preset on last page } else { if ($idp == count($pages)) { $lastpage = TRUE; } } } if ($content_pref["content_content_pagenames_rendertype"] == "1") { $selectjs = "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\""; $CONTENT_CONTENT_TABLE_PAGENAMES = $rs->form_select_open("pagenames", $selectjs) . $rs->form_option(CONTENT_LAN_89, "1", "none", "") . $options . $rs->form_select_close(); } else { $CONTENT_CONTENT_TABLE_PAGENAMES = $options; } } else { $CONTENT_CONTENT_TABLE_SUMMARY = isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp->toHTML($row['content_summary'], TRUE, "SUMMARY") : ""; $CONTENT_CONTENT_TABLE_SUMMARY = $tp->replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY); $lastpage = TRUE; } $CONTENT_CONTENT_TABLE_TEXT = $tp->replaceConstants($CONTENT_CONTENT_TABLE_TEXT); $CONTENT_CONTENT_TABLE_TEXT = $tp->toHTML($CONTENT_CONTENT_TABLE_TEXT, TRUE, "BODY"); $custom = e107::unserialize($row['content_pref']); $date = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_DATE}', FALSE, $newcontent_shortcodes); $auth = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_AUTHORDETAILS}', FALSE, $newcontent_shortcodes); $ep = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_EPICONS}', FALSE, $newcontent_shortcodes); $edit = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_EDITICON}', FALSE, $newcontent_shortcodes); $par = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_PARENT}', FALSE, $newcontent_shortcodes); $com = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_COMMENT}', FALSE, $newcontent_shortcodes); $score = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_SCORE}', FALSE, $newcontent_shortcodes); $ref = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_REFER}', FALSE, $newcontent_shortcodes); $ico = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_ICON}', FALSE, $newcontent_shortcodes); $sub = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_SUBHEADING}', FALSE, $newcontent_shortcodes); $rat = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_RATING}', FALSE, $newcontent_shortcodes); $fil = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_FILE}', FALSE, $newcontent_shortcodes); $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = FALSE; $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = FALSE; $CONTENT_CONTENT_TABLE_INFO_PRE = FALSE; $CONTENT_CONTENT_TABLE_INFO_POST = FALSE; //if any of these exist, pre/post activate the container table if ($ico != "" || $date != "" || $auth != "" || $ep != "" || $edit != "" || $par != "" || $com != "" || $score != "" || $ref != "" || $sub != "" || $rat != "" || $fil != "") { $CONTENT_CONTENT_TABLE_INFO_PRE = TRUE; $CONTENT_CONTENT_TABLE_INFO_POST = TRUE; $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = TRUE; $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = TRUE; } if (!isset($CONTENT_CONTENT_TABLE)) { //if no theme has been set, use default theme if (!$content_pref["content_theme"]) { //if custom layout is set if ($row['content_layout']) { //if custom layout file exists if (is_readable($plugindir . "templates/default/" . $row['content_layout'])) { require_once $plugindir . "templates/default/" . $row['content_layout']; } else { require_once $plugindir . "templates/default/content_content_template.php"; } } else { require_once $plugindir . "templates/default/content_content_template.php"; } } else { //if custom layout is set if ($row['content_layout']) { //if custom layout file exists if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . $row['content_layout'])) { require_once $tp->replaceConstants($content_pref["content_theme"]) . $row['content_layout']; } else { //if default layout from the set theme exists if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php")) { require_once $tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php"; //else use default theme, default layout } else { require_once $plugindir . "templates/default/content_content_template.php"; } } //if no custom layout is set } else { //if default layout from the set theme exists if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php")) { require_once $tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php"; //else use default theme, default layout } else { require_once $plugindir . "templates/default/content_content_template.php"; } } } } $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = ""; $CUSTOM_TAGS = FALSE; if ($lastpage === TRUE && !empty($custom)) { $CONTENT_CONTENT_TABLE_CUSTOM_PRE = ""; $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = ""; //ksort($custom); foreach ($custom as $k => $v) { if ($k == "content_custom_presettags") { if (isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]) { foreach ($v as $ck => $cv) { if (is_array($cv)) { //date if (!($cv['day'] == "" && $cv['month'] == "" && $cv['year'] == "")) { $vv = $cv['day'] . " " . $months[$cv['month'] - 1] . " " . $cv['year']; } } else { $vv = $cv; } if (isset($ck) && $ck != "" && isset($vv) && $vv != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $CONTENT_CONTENT_TABLE_CUSTOM); } } } } else { if (isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]) { $key = substr($k, 15); if (isset($key) && $key != "" && isset($v) && $v != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $CONTENT_CONTENT_TABLE_CUSTOM); } } } } if ($CUSTOM_TAGS === TRUE) { $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = $CONTENT_CONTENT_TABLE_CUSTOM_START . $CONTENT_CONTENT_TABLE_CUSTOM_TAGS . $CONTENT_CONTENT_TABLE_CUSTOM_END; } } $text = $tp->parseTemplate($CONTENT_CONTENT_TABLE, TRUE, $newcontent_shortcodes); $text = $aa->getCrumbPage("item", $array, $row['content_parent']) . $text; $caption = $row['content_heading']; $ns->tablerender($caption, $text); $cachecheck = CachePost($cachestr); } //recheck some thing when caching is enabled $pages = preg_split("/\\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY); $pages = array_values($pages); $cachestr = "comment.{$plugintable}.{$qs['1']}.{$cacheid}"; if (count($pages) == 0) { $lastpage = TRUE; } else { if ($cacheid == count($pages)) { $lastpage = TRUE; } } if ($lastpage && ($row['content_comment'] || isset($content_pref["content_content_comment_all"]) && $content_pref["content_content_comment_all"])) { $cachecheck = CachePre($cachestr); if ($cachecheck) { echo $cachecheck; return; } if (isset($content_pref["content_content_rating"]) && $content_pref["content_content_rating"] && $row['content_rate'] || isset($content_pref["content_content_rating_all"]) && $content_pref["content_content_rating_all"]) { $showrate = TRUE; } else { $showrate = FALSE; } $width = 0; $cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate); $cachecheck = CachePost($cachestr); } } //close sql }