function get_current_table($table_name, $prefix = "") { global $sql; if (!isset($sql)) { $sql = new db(); } if (!$prefix) { $prefix = MPREFIX; } // echo "Get table structure for: {$table_name}, prefix: {$prefix}<br />"; $sql->db_Select_gen('SET SQL_QUOTE_SHOW_CREATE = 1'); $qry = 'SHOW CREATE TABLE `' . $prefix . $table_name . "`"; if (!($z = $sql->db_Select_gen($qry))) { return FALSE; } $row = $sql->db_Fetch(MYSQL_NUM); $tmp = str_replace("`", "", stripslashes($row[1])) . ';'; // Add semicolon to work with our parser $count = preg_match_all("#CREATE\\s+?TABLE\\s+?`{0,1}({$prefix}{$table_name})`{0,1}\\s+?\\((.*?)\\)\\s+?(?:TYPE|ENGINE)\\s*\\=\\s*(.*?);#is", $tmp, $matches, PREG_SET_ORDER); if ($count === FALSE) { return "Error occurred"; } if (!$count) { return "No matches"; } return $matches; }
function DKPraidCount($character_name) { $sql99 = new db(); $count30_total = $sql99->db_Count(DKPDB_TABLE_RAIDS, "(*)", "WHERE (raid_date BETWEEN '" . mktime(0, 0, 0, date('m'), date('d') - 30, date('Y')) . "' AND '" . time() . "')"); $count60_total = $sql99->db_Count(DKPDB_TABLE_RAIDS, "(*)", "WHERE (raid_date BETWEEN '" . mktime(0, 0, 0, date('m'), date('d') - 60, date('Y')) . "' AND '" . time() . "')"); $count90_total = $sql99->db_Count(DKPDB_TABLE_RAIDS, "(*)", "WHERE (raid_date BETWEEN '" . mktime(0, 0, 0, date('m'), date('d') - 90, date('Y')) . "' AND '" . time() . "')"); $sql99->db_Select_gen("SELECT count(*) FROM " . MPREFIX . DKPDB_TABLE_RAIDS . " r, " . MPREFIX . DKPDB_TABLE_RAID_A . " ra WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='" . $character_name . "') AND (r.raid_date BETWEEN " . mktime(0, 0, 0, date('m'), date('d') - 30, date('Y')) . " AND " . time() . ")"); while ($row99 = $sql99->db_Fetch()) { $count30_member = $row99['count(*)']; } $sql99->db_Select_gen("SELECT count(*) FROM " . MPREFIX . DKPDB_TABLE_RAIDS . " r, " . MPREFIX . DKPDB_TABLE_RAID_A . " ra WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='" . $character_name . "') AND (r.raid_date BETWEEN " . mktime(0, 0, 0, date('m'), date('d') - 60, date('Y')) . " AND " . time() . ")"); while ($row99 = $sql99->db_Fetch()) { $count60_member = $row99['count(*)']; } $sql99->db_Select_gen("SELECT count(*) FROM " . MPREFIX . DKPDB_TABLE_RAIDS . " r, " . MPREFIX . DKPDB_TABLE_RAID_A . " ra WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='" . $character_name . "') AND (r.raid_date BETWEEN " . mktime(0, 0, 0, date('m'), date('d') - 90, date('Y')) . " AND " . time() . ")"); while ($row99 = $sql99->db_Fetch()) { $count90_member = $row99['count(*)']; } $percent30 = $count30_total > 0 ? round($count30_member / $count30_total * 100) : 0; $percent60 = $count60_total > 0 ? round($count60_member / $count60_total * 100) : 0; $percent90 = $count90_total > 0 ? round($count90_member / $count90_total * 100) : 0; $return_array = array(); array_push($return_array, $percent30, $percent60, $percent90); return $return_array; }
function search_content($row) { global $con; $sqlCon = new db(); // Use a separate DB to avoid interfering with main query $res['link'] = e_PLUGIN . "content/content.php?content." . $row['content_id']; $res['pre_title'] = ""; $res['title'] = $row['content_heading']; $res['summary'] = $row['content_summary'] . ' ' . $row['content_text']; //get category heading if ($row['content_parent'] == '0') { $qry = "\n\t\tSELECT c.content_heading\n\t\tFROM #pcontent as c\n\t\tWHERE c.content_id = '" . $row['content_id'] . "' "; } elseif (strpos($row['content_parent'], "0.") !== FALSE) { $tmp = explode(".", $row['content_parent']); $qry = "\n\t\tSELECT c.content_heading\n\t\tFROM #pcontent as c\n\t\tWHERE c.content_id = '" . intval($tmp[1]) . "' "; } else { $qry = "\n\t\tSELECT c.*, p.*\n\t\tFROM #pcontent as c\n\t\tLEFT JOIN #pcontent as p ON p.content_id = c.content_parent\n\t\tWHERE c.content_id = '" . $row['content_id'] . "' "; } $sqlCon->db_Select_gen($qry); $cat = $sqlCon->db_Fetch(); $res['detail'] = LAN_SEARCH_3 . $con->convert_date($row['content_datestamp'], "long") . " " . CONT_SCH_LAN_4 . " " . $cat['content_heading']; return $res; }
<tr class="rowhead"> <th align="center" colspan="4"><u>Purchase History for ' . $item_name . '</u></th> </tr> <tr> <th align="left" width="90" nowrap="nowrap">Date</th> <th align="left" width="35%">Buyer</th> <th align="left" width="65%" class="header">Raid</th> <th align="left" width="60" nowrap="nowrap">Value</th> </tr>'; $query = 'SELECT i.item_id, i.item_name, i.item_value, i.item_date, i.raid_id, i.item_buyer, r.raid_name FROM ' . MPREFIX . DKPDB_TABLE_ITEMS . ' i, ' . MPREFIX . DKPDB_TABLE_RAIDS . " r\r\n\t\t\t\t\t WHERE (r.raid_id = i.raid_id) AND (i.item_name='" . addslashes($item_name) . "')"; $query2 = 'SELECT count(*) FROM ' . MPREFIX . DKPDB_TABLE_ITEMS . ' i, ' . MPREFIX . DKPDB_TABLE_RAIDS . " r\r\n \t\t\t\t\t WHERE (r.raid_id = i.raid_id) AND (i.item_name='" . addslashes($item_name) . "')"; $sql99->db_Select_gen($query2); while ($row99 = $sql99->db_Fetch()) { $item_count = $row99['count(*)']; } $sql99->db_Select_gen($query); while ($row99 = $sql99->db_Fetch()) { $item_buyer = $row99["item_buyer"]; $raid_id = $row99["raid_id"]; $raid_name = $row99["raid_name"]; $item_date = $row99["item_date"]; $item_value = $row99["item_value"]; $text .= ' <tr class="row1"> <td width="90" nowrap="nowrap">' . strftime($pref['shortdate'], $item_date) . '</td> <td width="35%"><a href="view_member.php?n=' . utf8_encode($item_buyer) . '">' . utf8_encode($item_buyer) . '</a></td>'; if (WCMCheckCharAdmin()) {
/** * Render a single comment and any nested comments it may have. * * @param array $row * @param string $table * @param string $action * @param integer $id * @param interger $width * @param string $subject * @param integer $addrating * @return html */ function render_comment($row, $table, $action, $id, $width, $subject, $addrating = FALSE) { //addrating : boolean, to show rating system in rendered comment global $sc_style, $gen; $tp = e107::getParser(); $sql = e107::getDb(); $pref = e107::getPref(); if (vartrue($pref['comments_disabled'])) { return; } global $NEWIMAGE, $USERNAME, $RATING, $datestamp; global $thisaction, $thistable, $thisid, $e107; $comrow = $row; $thistable = $table; $thisid = $id; $thisaction = $action; //FIXME - new level handler, currently commented to avoid parse errors //require_once (e_HANDLER."level_handler.php"); if (!$width) { $width = 0; } if (!defined("IMAGE_nonew_comments")) { define("IMAGE_nonew_comments", 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='' />"); } if (!defined("IMAGE_new_comments")) { define("IMAGE_new_comments", 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='' /> "); } // $ns = new e107table; if (!$gen || !is_object($gen)) { $gen = new convert(); } $row['rating_enabled'] = true; // Toggles rating shortcode. //TODO add pref e107::getScBatch('comment')->setVars($row); $COMMENT_TEMPLATE = $this->template; $COMMENT_TEMPLATE['ITEM_START'] = "\n\n<div id='{COMMENT_ITEMID}' class='comment-box clearfix'>\n"; $COMMENT_TEMPLATE['ITEM_END'] = "\n</div><div class='clear_b'><!-- --></div>\n"; if (vartrue($pref['nested_comments'])) { $width2 = 100 - $width; $total_width = "95%"; if ($width) { $renderstyle = $COMMENT_TEMPLATE['ITEM_START']; $renderstyle .= "<div style='margin-left:{$width}%'>" . $COMMENT_TEMPLATE['ITEM'] . "</div>"; $renderstyle .= $COMMENT_TEMPLATE['ITEM_END']; } else { $renderstyle = $COMMENT_TEMPLATE['ITEM_START'] . $COMMENT_TEMPLATE['ITEM'] . $COMMENT_TEMPLATE['ITEM_END']; } if ($pref['comments_icon']) { if ($comrow['comment_datestamp'] > USERLV) { $NEWIMAGE = IMAGE_new_comments; } else { $NEWIMAGE = IMAGE_nonew_comments; } } else { $NEWIMAGE = ""; } } else { $renderstyle = $COMMENT_TEMPLATE['ITEM']; } $highlight_search = FALSE; if (isset($_POST['highlight_search'])) { $highlight_search = TRUE; } if (!defined("IMAGE_rank_main_admin_image")) { define("IMAGE_rank_main_admin_image", isset($pref['rank_main_admin_image']) && $pref['rank_main_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_main_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_main_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/main_admin.png' alt='' />"); } if (!defined("IMAGE_rank_moderator_image")) { define("IMAGE_rank_moderator_image", isset($pref['rank_moderator_image']) && $pref['rank_moderator_image'] && file_exists(THEME . "forum/" . $pref['rank_moderator_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_moderator_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/admin.png' alt='' />"); } if (!defined("IMAGE_rank_admin_image")) { define("IMAGE_rank_admin_image", isset($pref['rank_admin_image']) && $pref['rank_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/admin.png' alt='' />"); } // $RATING = ($addrating == TRUE && $comrow['user_id'] ? $rater->composerating($thistable, $thisid, FALSE, $comrow['user_id']) : ""); $comment_shortcodes = e107::getScBatch('comment'); $text = $tp->parseTemplate($renderstyle, TRUE, $comment_shortcodes); //FIXME - dramatically increases the number of queries performed. if ($action == "comment" && vartrue($pref['nested_comments'])) { $type = $this->getCommentType($thistable); $sub_query = "\n\t\t\tSELECT c.*, u.*, ue.*, r.*\n\t\t\tFROM #comments AS c\n\t\t\tLEFT JOIN #user AS u ON c.comment_author_id = u.user_id\n\t\t\tLEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id\n\t\t\tLEFT JOIN #rate AS r ON c.comment_id = r.rate_itemid AND r.rate_table = 'comments' \n\t\t\t\n\t\t\tWHERE comment_item_id='" . intval($thisid) . "' AND comment_type='" . $tp->toDB($type, true) . "' AND comment_pid='" . intval($comrow['comment_id']) . "'\n\t\t\t\n\t\t\t\n\t\t\tORDER BY comment_datestamp\n\t\t\t"; $sql_nc = new db(); /* a new db must be created here, for nested comment */ if ($sub_total = $sql_nc->db_Select_gen($sub_query)) { while ($row1 = $sql_nc->db_Fetch()) { if ($this->isPending($row1)) { $sub_total = $sub_total - 1; continue; } if ($pref['nested_comments']) { $width = min($width + 3, 80); } $text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating); unset($width); } } $this->totalComments = $this->totalComments + $sub_total; } // End (nested comment handling) return $text; }
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'); } }
$feed['topic_id'] = '*'; $feed['path'] = 'forum|name'; $feed['text'] = 'this is the rss feed for the forum_name entries'; $feed['class'] = '0'; $feed['limit'] = '9'; $rss[] = $feed; return $rss; } //##### ------------------------------------------------------------------------------------ //##### create rss data, return as array $eplug_rss_data ----------------------------------- $sqlrss = new db(); switch ($this->parm) { case threads: case 6: $this->rssQuery = "SELECT t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, u.user_name, u.user_email FROM #forum_t AS t\n\t\tLEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id\n\t\tLEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id\n\t\tWHERE f.forum_class IN (" . USERCLASS_LIST . ") AND t.thread_parent=0\n\t\tORDER BY t.thread_datestamp DESC LIMIT 0," . $this->limit; $sqlrss->db_Select_gen($this->rssQuery); $tmp = $sqlrss->db_getList(); $rss = array(); $i = 0; foreach ($tmp as $value) { if ($value['user_name']) { $rss[$i]['author'] = $value['user_name']; $rss[$i]['author_email'] = $value['user_email']; // must include an email address to be valid. } else { $tmp = explode(".", $value['thread_user'], 2); list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]); } $rss[$i]['title'] = $value['thread_name']; $rss[$i]['link'] = $e107->base_path . $PLUGINS_DIRECTORY . "forum/forum_viewtopic.php?" . $value['thread_id']; $rss[$i]['description'] = $value['thread_thread'];
/** * Do PM DB maintenance * @param array $opts of tasks key = sent|rec|blocked|expired (one or more present). ATM value not used * @return array where key is message type (E_MESSAGE_SUCCESS|E_MESSAGE_ERROR|E_MESSAGE_INFO etc), data is array of messages of that type (key = timestamp) */ function doMaint($opts, $pmPrefs) { if (!count($opts)) { return array(E_MESSAGE_ERROR => array(ADLAN_PM_66)); } $results = array(E_MESSAGE_INFO => array(ADLAN_PM_67)); // 'Maintenance started' - primarily for a log entry to mark start time $logResults = array(); $e107 = e107::getInstance(); $e107->admin_log->log_event('PM_ADM_04', implode(', ', array_keys($opts))); $pmHandler = new private_message($pmPrefs); $db2 = new db(); // Will usually need a second DB object to avoid over load $start = 0; // Use to ensure we get different log times if (isset($opts['sent'])) { $cnt = 0; if ($res = $db2->db_Select_gen("SELECT pm.pm_id FROM `#private_msg` AS pm LEFT JOIN `#user` AS u ON pm.`pm_from` = `#user`.`user_id`\n\t\t\t\t\tWHERE (pm.`pm_read_del = 1) AND `#user`.`user_id` IS NULL")) { while ($row = $db2->db_Fetch(MYSQL_ASSOC)) { if ($pmHandler->del($row['pm_id']) !== FALSE) { $cnt++; } } } $start = time(); $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $cnt, ADLAN_PM_74); } if (isset($opts['rec'])) { $cnt = 0; if ($res = $db2->db_Select_gen("SELECT pm.pm_id FROM `#private_msg` AS pm LEFT JOIN `#user` AS u ON pm.`pm_to` = `#user`.`user_id`\n\t\t\t\t\tWHERE (pm.`pm_sent_del = 1) AND `#user`.`user_id` IS NULL")) { while ($row = $db2->db_Fetch(MYSQL_ASSOC)) { if ($pmHandler->del($row['pm_id']) !== FALSE) { $cnt++; } } } $start = max($start + 1, time()); $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $cnt, ADLAN_PM_75); } if (isset($opts['blocked'])) { if ($res = $e107->sql->db_Select_gen("DELETE `#private_msg_block` FROM `#private_msg_block` LEFT JOIN `#user` ON `#private_msg_block`.`pm_block_from` = `#user`.`user_id`\n\t\t\t\t\tWHERE `#user`.`user_id` IS NULL")) { $start = max($start + 1, time()); $results[E_MESSAGE_ERROR][$start] = str_replace(array('--NUM--', '--TEXT--'), array($this->sql->getLastErrorNum, $this->sql->getLastErrorText), ADLAN_PM_70); } else { $start = max($start + 1, time()); $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $res, ADLAN_PM_69); } if ($res = $e107->sql->db_Select_gen("DELETE `#private_msg_block` FROM `#private_msg_block` LEFT JOIN `#user` ON `#private_msg_block`.`pm_block_to` = `#user`.`user_id`\n\t\t\t\t\tWHERE `#user`.`user_id` IS NULL")) { $start = max($start + 1, time()); $results[E_MESSAGE_ERROR][$start] = str_replace(array('--NUM--', '--TEXT--'), array($this->sql->getLastErrorNum, $this->sql->getLastErrorText), ADLAN_PM_70); } else { $start = max($start + 1, time()); $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $res, ADLAN_PM_68); } } if (isset($opts['expired'])) { $del_qry = array(); $read_timeout = intval($pmPrefs['read_timeout']); $unread_timeout = intval($pmPrefs['unread_timeout']); if ($read_timeout > 0) { $timeout = time() - $read_timeout * 86400; $del_qry[] = "(pm_sent < {$timeout} AND pm_read > 0)"; } if ($unread_timeout > 0) { $timeout = time() - $unread_timeout * 86400; $del_qry[] = "(pm_sent < {$timeout} AND pm_read = 0)"; } if (count($del_qry) > 0) { $qry = implode(' OR ', $del_qry); $cnt = 0; if ($db2->db_Select('private_msg', 'pm_id', $qry)) { while ($row = $db2->db_Fetch(MYSQL_ASSOC)) { if ($pmHandler->del($row['pm_id']) !== FALSE) { $cnt++; } } } $start = max($start + 1, time()); $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $cnt, ADLAN_PM_73); } else { $start = max($start + 1, time()); $results[E_MESSAGE_ERROR][$start] = ADLAN_PM_72; } } if (isset($opts['attach'])) { // Check for orphaned and missing attachments require_once e_HANDLER . 'file_class.php'; $fl = new e_file(); $missing = array(); $orphans = array(); $fileArray = $fl->get_files(e_PLUGIN . 'pm/attachments'); if ($db2->db_Select('private_msg', 'pm_id, pm_attachments', "pm_attachments != ''")) { while ($row = $db2->db_Fetch(MYSQL_ASSOC)) { $attachList = explode(chr(0), $row['pm_attachments']); foreach ($attachList as $a) { $found = FALSE; foreach ($fileArray as $k => $fd) { if ($fd['fname'] == $a) { $found = TRUE; unset($fileArray[$k]); break; } } if (!$found) { $missing[] = $row['pm_id'] . ':' . $a; } } } } // Any files left in $fileArray now are unused if (count($fileArray)) { foreach ($fileArray as $k => $fd) { unlink($fd['path'] . $fd['fname']); $orphans[] = $fd['fname']; } } $attachMessage = str_replace(array('--ORPHANS--', '--MISSING--'), array(count($orphans), count($missing)), ADLAN_PM_79); if (TRUE) { // Mostly for testing - probably disable this if (count($orphans)) { $attachMessage .= '[!br!]Orphans:[!br!]' . implode('[!br!]', $orphans); } if (count($missing)) { $attachMessage .= '[!br!]Missing:[!br!]' . implode('[!br!]', $missing); } } $start = max($start + 1, time()); $results[E_MESSAGE_SUCCESS][$start] = $attachMessage; } $e107->admin_log->logArrayAll('PM_ADM_03', makeLogEntry($results)); foreach ($results as $k => $r) { foreach ($r as $sk => $s) { $results[$k][$sk] = str_replace('[!br!]', '<br />', $s); } } return $results; }
} // print $cal_row . $cal_subs[$cal_row] . "<br />"; } $caltext = "<table class='fborder' width='97%'>\n\t<tr><td class='fcaption' >" . EC_LAN_130 . "</td></tr>\n\t<tr><td class='forumheader3' ><a href='calendar.php'>" . EC_LAN_131 . "</a></tr>\n\t<tr><td class='fcaption' > </td></tr></table>"; } else { $caltext = "<form id='calsubs' action='" . e_SELF . "' method='post' >\n\t<table class='fborder' width='97%'>\n\t<tr><td class='fcaption' colspan='3'>" . EC_LAN_125 . "</td></tr>\n\t<tr><td class='forumheader2' >" . EC_LAN_126 . "</td><td class='forumheader2' >" . EC_LAN_127 . "</td><td class='forumheader2' >" . EC_LAN_136 . "</td></tr>"; // Get list of currently subscribed $cal_db->db_Select('event_subs', 'event_cat', "where event_userid='" . USERID . "'", "nowhere"); while ($cal_s = $cal_db->db_Fetch()) { extract($cal_s); $cal_array[] = $event_cat; } // while // Get list of categories that have subscriptions and are visible to this member $cal_args = "select * from #event_cat \n\t\twhere event_cat_subs>0 and (find_in_set(event_cat_class,'" . USERCLASS_LIST . "') OR find_in_set(event_cat_force_class,'" . USERCLASS_LIST . "'))"; if ($cal_db->db_Select_gen($cal_args)) { // echo $cal_args."<br />"; while ($cal_row = $cal_db->db_Fetch()) { extract($cal_row); $caltext .= "<tr><td class='forumheader3' style='width:10%;'>"; if (check_class($event_cat_force_class)) { $caltext .= EC_LAN_126; } else { $caltext .= "<input type='hidden' name='event_list[]' value='" . $event_cat_id . "' />\n\t\t\t<input type='checkbox' class='tbox' value='1' name='event_subd[{$event_cat_id}]' " . (in_array($event_cat_id, $cal_array) ? "checked='checked' " : "") . " /> </td>"; } $caltext .= "<td class='forumheader3'>{$event_cat_name}</td><td class='forumheader3'>{$event_cat_description}</td></tr>"; } } else { $caltext .= "<tr><td class='forumheader3' colspan='3'>" . EC_LAN_128 . "</td></tr>"; } $caltext .= "<tr><td class='forumheader3' colspan='3'><input class='tbox' type='submit' value='" . EC_LAN_129 . "' name='upsubs' /></td></tr>";
// End of while of fetching all main categories in use cachevars('easyshop_all_mcat_container', $easyshop_all_mcat_container); // Count active Product Categories without Main Category and show them additionally on last page $sql7 = new db(); $cat_without_main = $sql7->db_Count(DB_TABLE_SHOP_ITEM_CATEGORIES, "(*)", "WHERE category_active_status=2 AND category_main_id='' AND (category_class IN (" . USERCLASS_LIST . ")) "); if ($cat_without_main > 0) { cachevars('easyshop_mcat_loose_title', $cat_without_main); $count_rows++; $easyshop_all_mcat_loose_container = $tp->parseTemplate($ES_ALL_MCAT_LOOSE_CONTAINER, FALSE, $easyshop_shortcodes); cachevars('easyshop_all_mcat_loose_container', $easyshop_all_mcat_loose_container); } // End of if $cat_without_main $sql6 = new db(); // Only display main category records in use $arg6 = "SELECT DISTINCT category_main_id, main_category_id, main_category_name, main_category_image, main_category_description\n\t\tFROM #easyshop_item_categories, #easyshop_main_categories\n\t\tWHERE category_main_id=main_category_id AND main_category_active_status=2"; $sql6->db_Select_gen($arg6, false); while ($row6 = $sql6->db_Fetch()) { $count_total_categories++; } $total_categories = $count_total_categories; $easyshop_paging = General::multiple_paging($total_categories, $main_categories_per_page, $action, $action_id, $page_id, $page_devide_char); cachevars('easyshop_paging', $easyshop_paging); } // End of else $easyshop_show_checkout = Shop::show_checkout($session_id); // Code optimisation: make use of function show_checkout cachevars('easyshop_show_checkout', $easyshop_show_checkout); // Print the shop at the 'bottom' if the setting is set to 'bottom' (value 1) if ($print_shop_top_bottom == '1') { $easyshop_store_footer = print_store_header($store_name, $store_address_1, $store_address_2, $store_city, $store_state, $store_zip, $store_country, $support_email, $store_welcome_message, $print_shop_address); cachevars('easyshop_store_footer', $easyshop_store_footer);
$saltConvert = 0; // Don't do conversions if restoring database $emailGen = 0; } $error = ''; if ($emailGen == 1) { // Scan DB for salted passwords } //----------------------------------------- // Backup user DB (selected fields) //----------------------------------------- if (!$error && $doBackup == 1) { echo LAN_PCONV_13; if ($pc_db->db_Table_exists('user_backup')) { // Completely delete table - avoids problems with incorrect structure $pc_db->db_Select_gen('DROP TABLE `#user_backup` '); } $qry = "CREATE TABLE `#user_backup` (\r\n user_id int(10) unsigned NOT NULL,\r\n user_name varchar(100) NOT NULL default '',\r\n user_loginname varchar(100) NOT NULL default '',\r\n user_password varchar(50) NOT NULL default '',\r\n user_email varchar(100) NOT NULL default '',\r\n user_prefs text NOT NULL,\r\n PRIMARY KEY (user_id),\r\n UNIQUE KEY user_name (user_name)\r\n) ENGINE=MyISAM;"; // If not exists, of course if (!$pc_db->db_Select_gen($qry)) { $error = LAN_PCONV_20; } if (!$error) { $qry = "INSERT INTO `#user_backup` SELECT user_id, user_name, user_loginname, user_password, user_email, user_prefs FROM `#user` "; if ($pc_db->db_Select_gen($qry) === FALSE) { $error = LAN_PCONV_21; } } if (!$error) { echo '...' . LAN_PCONV_14 . '<br /><br />'; }
//------ create feed for admin, return array $eplug_rss_feed ------------------ $feed['name'] = 'Links Page'; $feed['url'] = 'links'; //the identifier for the rss feed url $feed['topic_id'] = ''; //the topic_id, empty on default (to select a certain category) $feed['path'] = 'links_page'; //this is the plugin path location $feed['text'] = 'this is the rss feed for the links_page entries'; $feed['class'] = '0'; $feed['limit'] = '9'; //------ create rss data, return as array $eplug_rss_data ----------------------- $qry = "\nSELECT l.*, c.link_category_id, c.link_category_name\nFROM #links_page AS l\nLEFT JOIN #links_page_cat AS c ON c.link_category_id = l.link_category\nWHERE l.link_class REGEXP '" . e_CLASS_REGEXP . "' AND c.link_category_class REGEXP '" . e_CLASS_REGEXP . "'\nORDER BY l.link_datestamp DESC LIMIT 0," . $this->limit; $rss = array(); $sqlrss = new db(); if ($items = $sqlrss->db_Select_gen($qry)) { $i = 0; while ($rowrss = $sqlrss->db_Fetch()) { $tmp = ''; $rss[$i]['author'] = $tmp[1]; $rss[$i]['author_email'] = $tmp[2]; $rss[$i]['link'] = $rowrss['link_url']; $rss[$i]['linkid'] = $rowrss['link_id']; $rss[$i]['title'] = $rowrss['link_name']; $rss[$i]['description'] = ''; $rss[$i]['category_name'] = $rowrss['link_category_name']; $rss[$i]['category_link'] = $e107->base_path . $PLUGINS_DIRECTORY . "links_page/links.php?cat." . $rowrss['link_category_id']; $rss[$i]['datestamp'] = $rowrss['link_datestamp']; $rss[$i]['enc_url'] = ""; $rss[$i]['enc_leng'] = ""; $rss[$i]['enc_type'] = "";
function displayCategoryLinks($mode = '') { global $sql2, $ns, $lc, $tp, $cobj, $rowl, $qs, $linkspage_pref, $from, $link_shortcodes, $link_category_total; global $LINK_TABLE_START, $linkbutton_count, $LINK_TABLE, $link_category_total, $LINK_TABLE_CAPTION, $LINK_TABLE_END, $LINK_APPEND; $order = $lc->getOrder(); $number = $linkspage_pref["link_nextprev_number"] ? $linkspage_pref["link_nextprev_number"] : "20"; $nextprevquery = $mode && $linkspage_pref["link_nextprev"] ? "LIMIT " . intval($from) . "," . intval($number) : ""; $cat = $mode ? " AND l.link_category='" . intval($mode) . "' " : ""; $qry = "\n\tSELECT l.*, lc.*, COUNT(c.comment_id) AS link_comment\n\tFROM #links_page AS l\n\tLEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category\n\tLEFT JOIN #comments as c ON c.comment_item_id=l.link_id AND comment_type='links_page'\n\tWHERE l.link_class REGEXP '" . e_CLASS_REGEXP . "' AND lc.link_category_class REGEXP '" . e_CLASS_REGEXP . "' " . $cat . "\n\tGROUP BY l.link_id\n\t" . $order . "\n\t" . $nextprevquery . "\n\t"; $link_table_string = ""; if (!is_object($sql2)) { $sql2 = new db(); } $link_total = $sql2->db_Count("links_page as l", "(*)", "WHERE l.link_class REGEXP '" . e_CLASS_REGEXP . "' " . $cat . " "); if (!$sql2->db_Select_gen($qry)) { $lc->show_message(LAN_LINKS_34, LAN_LINKS_39); } else { $linkbutton_count = 0; $list = $sql2->db_getList(); foreach ($list as $rowl) { $linkbutton_count = $rowl['link_button'] ? $linkbutton_count + 1 : $linkbutton_count; if ($mode) { $cat_name = $rowl['link_category_name']; $cat_desc = $rowl['link_category_description']; $LINK_APPEND = $lc->parse_link_append($rowl); $link_table_string .= $tp->parseTemplate($LINK_TABLE, FALSE, $link_shortcodes); } else { $arr[$rowl['link_category_id']][] = $rowl; } } if ($mode) { $link_category_total = $link_total; $link_table_start = $tp->parseTemplate($LINK_TABLE_START, FALSE, $link_shortcodes); $link_table_end = $tp->parseTemplate($LINK_TABLE_END, FALSE, $link_shortcodes); $text = $link_table_start . $link_table_string . $link_table_end; $caption = LAN_LINKS_32 . " " . $cat_name . " " . ($cat_desc ? " <i>[" . $cat_desc . "]</i>" : ""); //number of links $caption .= " (<b title='" . (ADMIN ? LAN_LINKS_2 : LAN_LINKS_1) . "' >" . $link_total . "</b>" . (ADMIN ? "/<b title='" . (ADMIN ? LAN_LINKS_1 : "") . "' >" . $link_total . "</b>" : "") . ") "; $ns->tablerender($caption, $text); if (is_numeric($mode)) { $lc->ShowNextPrev($from, $number, $link_total); } } else { $text = ''; foreach ($arr as $key => $value) { $link_table_string = ""; $linkbutton_count = 0; $i = 0; for ($i = 0; $i < count($value); $i++) { $rowl = $value[$i]; $linkbutton_count = $rowl['link_button'] ? $linkbutton_count + 1 : $linkbutton_count; $cat_name = $rowl['link_category_name']; $cat_desc = $rowl['link_category_description']; $LINK_APPEND = $lc->parse_link_append($rowl); $link_table_string .= $tp->parseTemplate($LINK_TABLE, FALSE, $link_shortcodes); } $link_category_total = count($value); $link_table_caption = $tp->parseTemplate($LINK_TABLE_CAPTION, FALSE, $link_shortcodes); $link_table_start = $tp->parseTemplate($LINK_TABLE_START, FALSE, $link_shortcodes); $link_table_end = $tp->parseTemplate($LINK_TABLE_END, FALSE, $link_shortcodes); $text .= $link_table_start . $link_table_string . $link_table_end; } // $nav = $tp->parseTemplate("{NAVIGATOR}", FALSE, $link_shortcodes); Navigator now positioned in template // $ns->tablerender($link_table_caption, $nav.$text); $ns->tablerender($link_table_caption, $text); } } return; }
function getRecords($tag_type = '', $tag_itemid = '', $returnwordsonly = false, $link = true) { $sqlgr = new db(); $qry = "\n\t\tSELECT tag_word FROM #" . $this->table . "\n\t\tWHERE tag_type='" . $this->e107->tp->toDB($tag_type) . "'\n\t\tAND tag_itemid='" . intval($tag_itemid) . "'\n\t\tORDER BY tag_word "; if ($sqlgr->db_Select_gen($qry)) { $ret = array(); while ($row = $sqlgr->db_Fetch()) { $ret[] = $row['tag_word']; } if ($returnwordsonly) { $arr = array(); foreach ($ret as $word) { $word = $this->e107->tp->toHTML($word, true, 'no_hook, emotes_off'); $arr[] = $link ? trim($this->createTagWordLink($word)) : $word; } return implode($this->pref['tagwords_word_seperator'], $arr); } //return a \n seperated list of tagwords for the specific item return implode("\n", $ret); } return; }
$cur_year = date("Y"); $cur_month = date("n"); $cur_day = date("j"); if (strstr(e_QUERY, "year")) { $tmp = explode(".", e_QUERY); if (is_numeric($tmp[1])) { $req_year = intval($tmp[1]); } } if (!isset($req_year)) { $req_year = $cur_year; } // -------------------------------- // look for the first and last year // -------------------------------- $bcSql->db_Select_gen("SELECT news_id, news_datestamp from #news ORDER BY news_datestamp LIMIT 0,1"); $first_post = $bcSql->db_Fetch(); $start_year = date("Y", $first_post['news_datestamp']); $end_year = $cur_year; // ---------------------- // build the yearselector // ---------------------- $year_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>"; $year_selector .= "" . BLOGCAL_ARCHIV1 . ": <select name='activate' onchange='urljump(this.options[selectedIndex].value)' class='tbox'>\n"; for ($i = $start_year; $i <= $end_year; $i++) { $start = mktime(0, 0, 0, 1, 1, intval($req_year)); $end = mktime(23, 59, 59, 12, 31, intval($req_year)); // create the option entry $year_link = $prefix . "/archive.php?year." . $i; $year_selector .= "<option value='" . $year_link . "'"; if ($i == $req_year) {
* */ global $sql, $tp, $pref; $amount = $tp->toFORM( $pref['es_slider_number'] ); $es_text = " <div class='rslides_container'> <ul class='rslides rslides2'> "; $sql = new db; $qry = "SELECT * FROM #news WHERE news_render_type='0' ORDER BY news_datestamp DESC LIMIT 0,".$pref['es_slider_news_amount'].""; if($sql->db_Select_gen($qry)){ while ($row = $sql->db_Fetch()){ $news_id = intval($row['news_id']); $image = $tp->toHTML($row['news_thumbnail']); $title = $tp->toHTML($row['news_title']); $es_text .= " <li> <a href='".e_HTTP."news.php?extend.".$news_id."'><img src='".e_IMAGE."newspost_images/".$image."' alt=''/></a> <p class='caption'> ".$title." </p> </li> "; }
exit; } global $tp; // Get language file (assume that the English language file is always present) include_lan(e_PLUGIN . 'easyshop/languages/' . e_LANGUAGE . '.php'); // include define tables info require_once e_PLUGIN . "easyshop/includes/config.php"; // It's important to point to the correct plugin folder! require_once 'easyshop_class.php'; // $session_id = Security::get_session_id(); // Get the session id by using Singleton pattern // Randomly pick an active product from an active product category (only pick categories that user is entitled to see) // with an active discount that the user is entitled to see $today = time(); $sql = new db(); $arg = "SELECT *\n FROM #easyshop_items\n LEFT JOIN #easyshop_item_categories\n ON #easyshop_items.category_id = #easyshop_item_categories.category_id\n LEFT JOIN #easyshop_discount\n ON #easyshop_items.prod_discount_id = #easyshop_discount.discount_id\n WHERE category_active_status = '2' AND item_active_status = '2' AND (category_class IN (" . USERCLASS_LIST . ")) AND prod_discount_id > 0\n AND discount_valid_from < '" . $today . "'\n AND (discount_valid_till > '" . $today . "' OR discount_valid_till = '0')\n AND (discount_class IN (" . USERCLASS_LIST . "))\n ORDER BY RAND()"; $sql->db_Select_gen($arg, false); if ($row = $sql->db_Fetch() and $row["item_id"] > 0) { $category_id = $row["category_id"]; $item_id = $row["item_id"]; $item_name = $row["item_name"]; $item_description = strip_tags($tp->toHTML($row["item_description"], true)); $item_image = $row["item_image"]; $item_active_status = $row["item_active_status"]; $item_price = $row["item_price"]; $discount_id = $row["discount_id"]; $discount_class = $row["discount_class"]; $discount_valid_from = $row["discount_valid_from"]; $discount_valid_till = $row["discount_valid_till"]; $discount_code = $row["discount_code"]; $discount_flag = $row["discount_flag"]; $discount_percentage = $row["discount_percentage"];
function show_content_top() { global $qs, $plugindir, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $cobj, $content_icon_path; global $from, $datequery, $content_pref, $mainparent; global $CONTENT_TOP_TABLE_AUTHOR, $authordetails, $row; $newcontent_shortcodes = e107::getScBatch('content', TRUE); $mainparent = $aa->getMainParent(intval($qs[1])); $content_pref = $aa->getContentPref($mainparent); show_content_search_menu("top", $mainparent); //show navigator/search/order menu if (!isset($CONTENT_TOP_TABLE)) { if (!$content_pref["content_theme"]) { require_once $plugindir . "templates/default/content_top_template.php"; } else { if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . "content_top_template.php")) { require_once $tp->replaceConstants($content_pref["content_theme"]) . "content_top_template.php"; } else { require_once $plugindir . "templates/default/content_top_template.php"; } } } $cachestr = "{$plugintable}.top.{$qs['1']}"; $cachecheck = CachePre($cachestr); if ($cachecheck) { echo $cachecheck; return; } $content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]); $array = $aa->getCategoryTree("", intval($qs[1]), TRUE); $validparent = implode(",", array_keys($array)); $datequery1 = " AND p.content_datestamp < " . time() . " AND (p.content_enddate=0 || p.content_enddate>" . time() . ") "; $qry = " p.content_parent REGEXP '" . $aa->CONTENTREGEXP($validparent) . "' "; $number = isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : ""; $np = $number ? " LIMIT " . intval($from) . ", " . intval($number) : ""; $qry1 = "\n\t\tSELECT p.*, r.*, (r.rate_rating / r.rate_votes) as rate_avg\n\t\tFROM #rate AS r\n\t\tLEFT JOIN #pcontent AS p ON p.content_id = r.rate_itemid \n\t\tWHERE p.content_refer !='sa' AND " . $qry . " " . $datequery1 . " AND p.content_class REGEXP '" . e_CLASS_REGEXP . "' AND r.rate_table='pcontent'\n\t\tORDER BY rate_avg DESC "; $qry2 = $qry1 . " " . $np; if (!is_object($sql)) { $sql = new db(); } $total = $sql->db_Select_gen($qry1); if ($sql->db_Select_gen($qry2)) { while ($row = $sql->db_Fetch()) { $CONTENT_TOP_TABLE_AUTHOR = $aa->prepareAuthor("top", $row['content_author'], $row['content_id']); $content_top_table_string .= $tp->parseTemplate($CONTENT_TOP_TABLE, FALSE, $newcontent_shortcodes); } $content_top_table_string = $aa->getCrumbPage("top", $array, $mainparent) . $content_top_table_string; $text = $CONTENT_TOP_TABLE_START . $content_top_table_string . $CONTENT_TOP_TABLE_END; $caption = $content_pref['content_top_caption']; if (isset($content_pref['content_top_caption_append_name']) && $content_pref['content_top_caption_append_name']) { $caption .= " " . $array[intval($qs[1])][1]; } $pagination = $aa->ShowNextPrev("", $from, $number, $total); $ns->tablerender($caption, $text . $pagination); } $cachecheck = CachePost($cachestr); unset($qry, $qry1, $qry2, $array, $validparent, $datequery); }