function display_home($info) { foreach ($info as $db_id => $content) { $colwidth = $content['colwidth']; opentable($content['blockTitle']); if ($colwidth) { $classes = "col-xs-" . $colwidth . " col-sm-" . $colwidth . " col-md-" . $colwidth . " col-lg-" . $colwidth . " content"; echo "<div class='row'>"; foreach ($content['data'] as $data) { echo "<div class='" . $classes . " clearfix'>"; echo "<h3><a href='" . $data['url'] . "'>" . $data['title'] . "</a></h3>"; echo "<div class='small m-b-10'>" . $data['meta'] . "</div>"; echo "<div class='overflow-hide'>" . fusion_first_words($data['content'], 100) . "</div>"; echo "</div>"; } echo "</div>"; } else { echo $content['norecord']; } closetable(); } }
function render_thread_item($data) { global $locale, $info, $userdata; echo "<div class='thread-item' id='thread_" . $data['thread_id'] . "'>\n"; echo "<div class='row m-0'>\n"; echo "<div class='col-xs-12 col-sm-9 col-md-6 p-l-0'>\n"; echo "<div class='pull-left m-r-10 m-t-5'>\n" . $data['thread_last']['avatar'] . "</div>\n"; $thead_icons = ''; foreach ($data['thread_icons'] as $icon) { $thead_icons .= $icon; } echo "<div class='overflow-hide'>\n"; echo "<a class='forum-link' href='" . $data['thread_link']['link'] . "'>" . $data['thread_link']['title'] . "</a>\n<span class='m-l-10 m-r-10 text-lighter'>" . $thead_icons . "</span>\n"; echo "<div class='text-smaller'>" . $data['thread_starter'] . "</div>\n"; echo $data['thread_pages']; echo isset($data['track_button']) ? "<div class='forum_track'><a onclick=\"return confirm('" . $locale['global_060'] . "');\" href='" . $data['track_button']['link'] . "'>" . $data['track_button']['name'] . "</a>\n</div>\n" : ''; echo "</div>\n"; echo "</div>\n"; // end grid echo "<div class='hidden-xs col-sm-3 col-md-3 p-l-0 p-r-0 text-center'>\n"; echo "<div class='display-inline-block forum-stats p-5 m-r-5 m-b-0'>\n"; echo "<h4 class='text-bigger strong text-dark m-0'>" . number_format($data['thread_views']) . "</h4>\n"; echo "<span>" . format_word($data['thread_views'], $locale['fmt_views'], 0) . "</span>"; echo "</div>\n"; echo "<div class='display-inline-block forum-stats p-5 m-r-5 m-b-0'>\n"; echo "<h4 class='text-bigger strong text-dark m-0'>" . number_format($data['thread_postcount']) . "</h4>\n"; echo "<span>" . format_word($data['thread_postcount'], $locale['fmt_post'], 0) . "</span>"; echo "</div>\n"; if ($data['forum_type'] == '4') { echo "<div class='display-inline-block forum-stats p-5 m-r-5 m-b-0'>\n"; echo "<h4 class='text-bigger strong text-dark m-0'>" . number_format($data['vote_count']) . "</h4>\n"; echo "<span>" . format_word($data['vote_count'], $locale['fmt_vote'], 0) . "</span>"; echo "</div>\n"; } echo "</div>\n"; // end grid echo "<div class='forum-lastuser hidden-xs hidden-sm col-md-3'>\n\t\t\t" . $data['thread_last']['profile_link'] . " " . timer($data['thread_last']['time']) . "<br/>\n\t\t\t" . fusion_first_words(strip_tags($data['thread_last']['post_message']), 10) . "\n\t\t</div>\n"; echo "</div>\n"; echo "</div>\n"; }
/** * Blog Listing HTML */ function blog_listing() { global $aidlink, $locale; // Remodel display results into straight view instead category container sorting. // consistently monitor sql results rendertime. -- Do not Surpass 0.15 // all blog are uncategorized by default unless specified. $limit = 15; $total_rows = dbcount("(blog_id)", DB_BLOG, multilang_table("BL") ? "blog_language='" . LANGUAGE . "'" : ""); $rowstart = isset($_GET['rowstart']) && $_GET['rowstart'] <= $total_rows ? $_GET['rowstart'] : 0; // add a filter browser $catOpts = array("all" => $locale['blog_0460'], "0" => $locale['blog_0424']); $categories = dbquery("select blog_cat_id, blog_cat_name\n\t\t\t\tfrom " . DB_BLOG_CATS . " " . (multilang_table("BL") ? "where blog_cat_language='" . LANGUAGE . "'" : "") . ""); if (dbrows($categories) > 0) { while ($cat_data = dbarray($categories)) { $catOpts[$cat_data['blog_cat_id']] = $cat_data['blog_cat_name']; } } // prevent xss $catFilter = ""; if (isset($_GET['filter_cid']) && isnum($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { if ($_GET['filter_cid'] > 0) { $catFilter = "and " . in_group("blog_cat", intval($_GET['filter_cid'])); } } $langFilter = multilang_table("BL") ? "blog_language='" . LANGUAGE . "'" : ""; if ($catFilter && $langFilter) { $filter = $catFilter . " AND " . $langFilter; } else { $filter = $catFilter . $langFilter; } $result = dbquery("\n\tSELECT blog_id, blog_cat, blog_subject, blog_image, blog_image_t1, blog_image_t2, blog_blog, blog_draft\n\tFROM " . DB_BLOG . "\n\t" . ($filter ? "WHERE " . $filter : "") . "\n\tORDER BY blog_draft DESC, blog_sticky DESC, blog_datestamp DESC LIMIT {$rowstart}, {$limit}\n\t"); $rows = dbrows($result); echo "<div class='clearfix'>\n"; echo "<span class='pull-right m-t-10'>" . sprintf($locale['blog_0408'], $rows, $total_rows) . "</span>\n"; if (!empty($catOpts) > 0 && $total_rows > 0) { echo "<div class='pull-left m-t-5 m-r-10'>" . $locale['blog_0458'] . "</div>\n"; echo "<div class='dropdown pull-left m-r-10' style='position:relative'>\n"; echo "<a class='dropdown-toggle btn btn-default btn-sm' style='width: 200px;' data-toggle='dropdown'>\n<strong>\n"; if (isset($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { echo $catOpts[$_GET['filter_cid']]; } else { echo $locale['blog_0459']; } echo " <span class='caret'></span></strong>\n</a>\n"; echo "<ul class='dropdown-menu' style='max-height:180px; width:200px; overflow-y: scroll'>\n"; foreach ($catOpts as $catID => $catName) { $active = isset($_GET['filter_cid']) && $_GET['filter_cid'] == $catID ? true : false; echo "<li" . ($active ? " class='active'" : "") . ">\n<a class='text-smaller' href='" . clean_request("filter_cid=" . $catID, array("section", "rowstart", "aid"), true) . "'>\n"; echo $catName; echo "</a>\n</li>\n"; } echo "</ul>\n"; echo "</div>\n"; } if ($total_rows > $rows) { echo makepagenav($rowstart, $limit, $total_rows, $limit, clean_request("", array("aid", "section"), true) . "&"); } echo "</div>\n"; echo "<ul class='list-group m-10'>\n"; if ($rows > 0) { while ($data2 = dbarray($result)) { echo "<li class='list-group-item'>\n"; echo "<div class='pull-left m-r-10'>\n"; $image_thumb = get_blog_image_path($data2['blog_image'], $data2['blog_image_t1'], $data2['blog_image_t2']); if (!$image_thumb) { $image_thumb = IMAGES . "imagenotfound70.jpg"; } echo thumbnail($image_thumb, '70px'); echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo "<div><span class='strong text-dark'>" . $data2['blog_subject'] . "</span><br/>\n"; if (!empty($data2['blog_cat'])) { $blog_cat = str_replace(".", ",", $data2['blog_cat']); $result2 = dbquery("SELECT blog_cat_id, blog_cat_name\n from " . DB_BLOG_CATS . " WHERE blog_cat_id in ({$blog_cat})\n "); $rows2 = dbrows($result2); if ($rows2 > 0) { echo "<div class='m-b-10'><strong>" . $locale['blog_0407'] . ": </strong>\n"; $i = 1; while ($cdata = dbarray($result2)) { echo "<a href='" . FUSION_SELF . $aidlink . "&action=edit&cat_id=" . $cdata['blog_cat_id'] . "&section=blog_category'>"; echo $cdata['blog_cat_name']; echo "</a>"; echo $i == $rows2 ? "" : ", "; $i++; } echo "</div>\n"; } echo "</div>\n"; } $blogText = strip_tags(parse_textarea($data2['blog_blog'])); echo fusion_first_words($blogText, '50'); echo "<div class='block m-t-10'><a href='" . FUSION_SELF . $aidlink . "&action=edit&section=blog_form&blog_id=" . $data2['blog_id'] . "'>" . $locale['blog_0420'] . "</a> -\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=delete&section=blog_form&blog_id=" . $data2['blog_id'] . "' onclick=\"return confirm('" . $locale['blog_0451'] . "');\">" . $locale['blog_0421'] . "</a>\n"; echo "</div>\n</div>\n"; echo "</li>\n"; } } else { echo "<div class='panel-body text-center'>\n"; echo $locale['blog_0456']; echo "</div>\n"; } echo "</ul>\n"; if ($total_rows > $rows) { echo makepagenav($rowstart, $limit, $total_rows, $limit, clean_request("", array("aid", "section"), true) . "&"); } }
public function set_ForumInfo() { global $forum_settings, $userdata, $locale; if (stristr($_SERVER['PHP_SELF'], 'forum_id')) { if ($_GET['section'] == 'latest') { redirect(INFUSIONS . 'forum/index.php?section=latest'); } if ($_GET['section'] == 'mypost') { redirect(INFUSIONS . 'forum/index.php?section=mypost'); } if ($_GET['section'] == 'tracked') { redirect(INFUSIONS . 'forum/index.php?section=tracked'); } } // security boot due to insufficient access level if (isset($_GET['viewforum']) && !verify_forum($_GET['forum_id'])) { redirect(INFUSIONS . 'forum/index.php'); } // Xss sanitization $this->forum_info = array('forum_id' => isset($_GET['forum_id']) ? $_GET['forum_id'] : 0, 'parent_id' => isset($_GET['parent_id']) && verify_forum($_GET['parent_id']) ? $_GET['parent_id'] : 0, 'forum_branch' => isset($_GET['forum_branch']) && verify_forum($_GET['forum_branch']) ? $_GET['forum_branch'] : 0, 'new_thread_link' => '', 'lastvisited' => isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(), 'posts_per_page' => $forum_settings['posts_per_page'], 'threads_per_page' => $forum_settings['threads_per_page'], 'forum_index' => dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'), 'threads' => array(), 'section' => isset($_GET['section']) ? $_GET['section'] : 'thread'); // Set Max Rows -- XSS $this->forum_info['forum_max_rows'] = dbcount("('forum_id')", DB_FORUMS, (multilang_table("FO") ? "forum_language='" . LANGUAGE . "' AND" : '') . "\n\t\tforum_cat='" . $this->forum_info['parent_id'] . "' AND " . groupaccess('forum_access') . ""); // Sanitize Globals $_GET['forum_id'] = $this->forum_info['forum_id']; $_GET['rowstart'] = isset($_GET['rowstart']) && $_GET['rowstart'] <= $this->forum_info['forum_max_rows'] ? $_GET['rowstart'] : 0; $this->ext = isset($this->forum_info['parent_id']) && isnum($this->forum_info['parent_id']) ? "&parent_id=" . $this->forum_info['parent_id'] : ''; add_to_title($locale['global_200'] . $locale['forum_0000']); add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php', 'title' => $locale['forum_0000'])); forum_breadcrumbs($this->forum_info['forum_index']); // Set Meta data if ($this->forum_info['forum_id'] > 0) { $meta_result = dbquery("SELECT forum_meta, forum_description FROM " . DB_FORUMS . " WHERE forum_id='" . intval($this->forum_info['forum_id']) . "'"); if (dbrows($meta_result) > 0) { $meta_data = dbarray($meta_result); if ($meta_data['forum_description'] !== '') { set_meta('description', $meta_data['forum_description']); } if ($meta_data['forum_meta'] !== '') { set_meta('keywords', $meta_data['forum_meta']); } } } // Additional Sections in Index View if (isset($_GET['section'])) { switch ($_GET['section']) { case 'participated': include INFUSIONS . "forum/sections/participated.php"; add_to_title($locale['global_201'] . $locale['global_024']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=participated", 'title' => $locale['global_024'])); set_meta("description", $locale['global_024']); break; case 'latest': include INFUSIONS . "forum/sections/latest.php"; add_to_title($locale['global_201'] . $locale['global_021']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=latest", 'title' => $locale['global_021'])); set_meta("description", $locale['global_021']); break; case 'tracked': include INFUSIONS . "forum/sections/tracked.php"; add_to_title($locale['global_201'] . $locale['global_056']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=tracked", 'title' => $locale['global_056'])); set_meta("description", $locale['global_056']); break; case "unanswered": include INFUSIONS . "forum/sections/unanswered.php"; add_to_title($locale['global_201'] . $locale['global_027']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=unanswered", 'title' => $locale['global_027'])); set_meta("description", $locale['global_027']); break; case "unsolved": include INFUSIONS . "forum/sections/unsolved.php"; add_to_title($locale['global_201'] . $locale['global_028']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=unsolved", 'title' => $locale['global_028'])); set_meta("description", $locale['global_028']); break; default: redirect(FUSION_SELF); } } else { // Switch between view forum or forum index -- required: $_GET['viewforum'] if ($this->forum_info['forum_id'] && isset($this->forum_info['parent_id']) && isset($_GET['viewforum'])) { /** * View Forum Additional Views - add Filter Initialization */ $time = isset($_GET['time']) ? $_GET['time'] : ''; $type = isset($_GET['type']) ? $_GET['type'] : ''; $sort = isset($_GET['sort']) ? $_GET['sort'] : ''; $order = isset($_GET['order']) ? $_GET['order'] : ''; $timeCol = ''; $typeCol = ''; if ($time) { $time_array = array('today' => strtotime('today'), '2days' => strtotime('-2 day'), '1week' => strtotime('-1 week'), '2week' => strtotime('-2 week'), '1month' => strtotime('-2 month'), '2month' => strtotime('-2 month'), '3month' => strtotime('-2 month'), '6month' => strtotime('-6 month'), '1year' => strtotime('-1 year')); $time_stop = ''; foreach ($time_array as $key => $value) { if ($time == $key) { $time_stop = prev($time_array); break; } } if ($time !== 'today') { $timeCol = "AND ((post_datestamp >= '" . $time_array[$time] . "' OR t.thread_lastpost >= '" . $time_array[$time] . "') AND (post_datestamp <= '" . $time_stop . "' OR t.thread_lastpost <= '" . $time_stop . "')) "; } else { $timeCol = "AND (post_datestamp >= '" . $time_array[$time] . "' OR t.thread_lastpost >= '" . $time_array[$time] . "') "; } } if ($type) { $type_array = array('all' => '', 'discussions' => "AND (a1.attach_name IS NULL or a1.attach_name='') AND (a2.attach_name IS NULL or a2.attach_name='') AND (forum_poll_title IS NULL or forum_poll_title='')", 'attachments' => "AND a1.attach_name !='' OR a2.attach_name !='' AND (forum_poll_title IS NULL or forum_poll_title='')", 'poll' => "AND (a1.attach_name IS NULL or a1.attach_name='') AND (a2.attach_name IS NULL or a2.attach_name='') AND forum_poll_title !=''", 'solved' => "AND t.thread_answered = '1'", 'unsolved' => "AND t.thread_answered = '0'"); $typeCol = $type_array[$type]; } $sortCol = "ORDER BY t.thread_lastpost "; $orderCol = 'ASC'; if ($sort) { $sort_array = array('author' => 't.thread_author', 'time' => 't.thread_lastpost', 'subject' => 't.thread_subject', 'reply' => 't.thread_postcount', 'view' => 't.thread_views'); $sortCol = "ORDER BY " . $sort_array[$sort] . " "; } if ($order) { $order_array = array('ascending' => 'ASC', 'descending' => 'DESC'); $orderCol = $order_array[$order]; } $sql_condition = $timeCol . $typeCol; $sql_order = $sortCol . $orderCol; // Filter Links $timeExt = isset($_GET['time']) ? "&time=" . $_GET['time'] : ''; $typeExt = isset($_GET['type']) ? "&type=" . $_GET['type'] : ''; $sortExt = isset($_GET['sort']) ? "&sort=" . $_GET['sort'] : ''; $orderExt = isset($_GET['order']) ? "&order=" . $_GET['order'] : ''; $baseLink = INFUSIONS . 'forum/index.php?viewforum&forum_id=' . $_GET['forum_id'] . '' . (isset($_GET['parent_id']) ? '&parent_id=' . $_GET['parent_id'] . '' : ''); $timeLink = $baseLink . $typeExt . $sortExt . $orderExt; $this->forum_info['filter']['time'] = array($locale['forum_3006'] => INFUSIONS . 'forum/index.php?viewforum&forum_id=' . $_GET['forum_id'] . '' . (isset($_GET['parent_id']) ? '&parent_id=' . $_GET['parent_id'] . '' : ''), $locale['forum_3007'] => $timeLink . '&time=today', $locale['forum_3008'] => $timeLink . '&time=2days', $locale['forum_3009'] => $timeLink . '&time=1week', $locale['forum_3010'] => $timeLink . '&time=2week', $locale['forum_3011'] => $timeLink . '&time=1month', $locale['forum_3012'] => $timeLink . '&time=2month', $locale['forum_3013'] => $timeLink . '&time=3month', $locale['forum_3014'] => $timeLink . '&time=6month', $locale['forum_3015'] => $timeLink . '&time=1year'); $typeLink = $baseLink . $timeExt . $sortExt . $orderExt; $this->forum_info['filter']['type'] = array($locale['forum_3000'] => $typeLink . '&type=all', $locale['forum_3001'] => $typeLink . '&type=discussions', $locale['forum_3002'] => $typeLink . '&type=attachments', $locale['forum_3003'] => $typeLink . '&type=poll', $locale['forum_3004'] => $typeLink . '&type=solved', $locale['forum_3005'] => $typeLink . '&type=unsolved'); $sortLink = $baseLink . $timeExt . $typeExt . $orderExt; $this->forum_info['filter']['sort'] = array($locale['forum_3016'] => $sortLink . '&sort=author', $locale['forum_3017'] => $sortLink . '&sort=time', $locale['forum_3018'] => $sortLink . '&sort=subject', $locale['forum_3019'] => $sortLink . '&sort=reply', $locale['forum_3020'] => $sortLink . '&sort=view'); $orderLink = $baseLink . $timeExt . $typeExt . $sortExt; $this->forum_info['filter']['order'] = array($locale['forum_3021'] => $orderLink . '&order=descending', $locale['forum_3022'] => $orderLink . '&order=ascending'); // Forum SQL $result = dbquery("SELECT f.*, f2.forum_name AS forum_cat_name,\n\t\t\t\tt.thread_id, t.thread_lastpost, t.thread_lastpostid, t.thread_subject,\n\t\t\t\tcount(t.thread_id) as forum_threadcount, p.post_message,\n\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar\n\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat = f2.forum_id\n\t\t\t\tLEFT JOIN " . DB_FORUM_THREADS . " t ON t.forum_id = f.forum_id\n\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p on p.thread_id = t.thread_id and p.post_id = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON f.forum_lastuser=u.user_id ## -- redo this part -- ##\n\t\t\t\t" . (multilang_table("FO") ? "WHERE f.forum_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('f.forum_access') . "\n\t\t\t\tAND f.forum_id='" . intval($this->forum_info['forum_id']) . "' OR f.forum_cat='" . intval($this->forum_info['forum_id']) . "' OR f.forum_branch='" . intval($this->forum_info['forum_branch']) . "'\n\t\t\t\tgroup by f.forum_id ORDER BY forum_cat ASC\n\t\t\t\t"); $refs = array(); if (dbrows($result) > 0) { while ($row = dbarray($result) and checkgroup($row['forum_access'])) { // Calculate Forum New Status $newStatus = ""; $forum_match = "\\|" . $row['forum_lastpost'] . "\\|" . $row['forum_id']; $last_visited = isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(); if ($row['forum_lastpost'] > $last_visited) { if (iMEMBER && ($row['forum_lastuser'] !== $userdata['user_id'] || !preg_match("({$forum_match}\\.|{$forum_match}\$)", $userdata['user_threads']))) { $newStatus = "<span class='forum-new-icon'><i title='" . $locale['forum_0260'] . "' class='" . Functions::get_forumIcons('new') . "'></i></span>"; } } // Calculate lastpost information $lastPostInfo = array(); if ($row['forum_lastpostid']) { $last_post = array('avatar' => '', 'avatar_src' => $row['user_avatar'] && file_exists(IMAGES . 'avatars/' . $row['user_avatar']) && !is_dir(IMAGES . 'avatars/' . $row['user_avatar']) ? IMAGES . 'avatars/' . $row['user_avatar'] : '', 'message' => fusion_first_words(parseubb(parsesmileys($row['post_message'])), 10), 'profile_link' => profile_link($row['forum_lastuser'], $row['user_name'], $row['user_status']), 'time' => timer($row['forum_lastpost']), 'date' => showdate("forumdate", $row['forum_lastpost']), 'thread_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $row['forum_id'] . "&thread_id=" . $row['thread_id'], 'post_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $row['forum_id'] . "&thread_id=" . $row['thread_id'] . "&pid=" . $row['thread_lastpostid'] . "#post_" . $row['thread_lastpostid']); if ($forum_settings['forum_last_post_avatar']) { $last_post['avatar'] = display_avatar($row, '30px', '', '', 'img-rounded'); } $lastPostInfo = $last_post; } /** * Default system icons - why do i need this? Why not let themers decide? */ switch ($row['forum_type']) { case '1': $forum_icon = "<i class='" . Functions::get_forumIcons('forum') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('forum') . " fa-3x fa-fw m-r-10'></i>"; break; case '2': $forum_icon = "<i class='" . Functions::get_forumIcons('thread') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('thread') . " fa-3x fa-fw m-r-10'></i>"; break; case '3': $forum_icon = "<i class='" . Functions::get_forumIcons('link') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('link') . " fa-3x fa-fw m-r-10'></i>"; break; case '4': $forum_icon = "<i class='" . Functions::get_forumIcons('question') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('question') . " fa-3x fa-fw m-r-10'></i>"; break; default: $forum_icon = ""; $forum_icon_lg = ""; } $row += array("forum_moderators" => Functions::parse_forumMods($row['forum_mods']), "forum_new_status" => $newStatus, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&forum_id=" . $row['forum_id'] . "&parent_id=" . $row['forum_cat'], "title" => $row['forum_name']), "forum_description" => nl2br(parseubb($row['forum_description'])), "forum_postcount_word" => format_word($row['forum_postcount'], $locale['fmt_post']), "forum_threadcount_word" => format_word($row['forum_threadcount'], $locale['fmt_thread']), "last_post" => $lastPostInfo, "forum_icon" => $forum_icon, "forum_icon_lg" => $forum_icon_lg, "forum_image" => $row['forum_image'] && file_exists(FORUM . "images/" . $row['forum_image']) ? $row['forum_image'] : ""); $this->forum_info['forum_moderators'] = $row['forum_moderators']; // child hierarchy data. $thisref =& $refs[$row['forum_id']]; $thisref = $row; if ($row['forum_cat'] == $this->forum_info['parent_id']) { $this->forum_info['item'][$row['forum_id']] =& $thisref; // will push main item out. } else { $refs[$row['forum_cat']]['child'][$row['forum_id']] =& $thisref; } /** * The current forum */ if ($row['forum_id'] == $this->forum_info['forum_id']) { require_once INCLUDES . "mimetypes_include.php"; define_forum_mods($row); // do the full string of checks for forums access $this->setForumPermission($row); // Generate Links if ($this->getForumPermission("can_post")) { $this->forum_info['new_thread_link'] = INFUSIONS . "forum/newthread.php?forum_id=" . $row['forum_id']; } /** * Get threads with filter conditions */ //xss $count = dbarray(dbquery("SELECT\n\t\t\t\t\t\t\t\tcount(t.thread_id) 'thread_max_rows',\n\t\t\t\t\t\t\t\tcount(a1.attach_id) 'attach_image',\n\t\t\t\t\t\t\t\tcount(a2.attach_id) 'attach_files'\n\n\t\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . " t\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = t.forum_id\n\t\t\t\t\t\t\t\tINNER JOIN " . DB_USERS . " tu1 ON t.thread_author = tu1.user_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_USERS . " tu2 ON t.thread_lastuser = tu2.user_id #issue 323\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p1 ON p1.thread_id = t.thread_id and p1.post_id = t.thread_lastpostid\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POLLS . " p ON p.thread_id = t.thread_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.thread_id = t.thread_id AND p1.post_id = v.post_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.thread_id = t.thread_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.thread_id = t.thread_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tWHERE t.forum_id='" . $this->forum_info['forum_id'] . "' AND t.thread_hidden='0' AND " . groupaccess('tf.forum_access') . " {$sql_condition}\n\t\t\t\t\t\t\t\t##GROUP BY t.thread_id {$sql_order}\n\t\t\t\t\t\t")); $this->forum_info['thread_max_rows'] = $count['thread_max_rows']; if ($this->forum_info['thread_max_rows'] > 0) { $this->forum_info['threads']['pagenav'] = ""; $this->forum_info['threads']['pagenav2'] = ""; // anti-XSS filtered rowstart $_GET['thread_rowstart'] = isset($_GET['thread_rowstart']) && isnum($_GET['thread_rowstart']) && $_GET['thread_rowstart'] <= $this->forum_info['thread_max_rows'] ? $_GET['thread_rowstart'] : 0; $t_result = dbquery("\n SELECT t.*, tu1.user_name AS author_name, tu1.user_status AS author_status, tu1.user_avatar as author_avatar,\n\t\t\t\t\t\t\t\ttu2.user_name AS last_user_name, tu2.user_status AS last_user_status, tu2.user_avatar AS last_user_avatar,\n\t\t\t\t\t\t\t\tp1.post_datestamp, p1.post_message,\n\t\t\t\t\t\t\t\tp.forum_poll_title,\n\t\t\t\t\t\t\t\tcount(v.post_id) AS vote_count,\n\t\t\t\t\t\t\t\ta1.attach_name, a1.attach_id,\n\t\t\t\t\t\t\t\ta2.attach_name, a2.attach_id,\n\t\t\t\t\t\t\t\tcount(a1.attach_mime) 'attach_image',\n\t\t\t\t\t\t\t\tcount(a2.attach_mime) 'attach_files'\n\t\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . " t\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = t.forum_id\n\t\t\t\t\t\t\t\tINNER JOIN " . DB_USERS . " tu1 ON t.thread_author = tu1.user_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_USERS . " tu2 ON t.thread_lastuser = tu2.user_id #issue 323\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p1 ON p1.thread_id = t.thread_id and p1.post_id = t.thread_lastpostid\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POLLS . " p ON p.thread_id = t.thread_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.thread_id = t.thread_id AND p1.post_id = v.post_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.thread_id = t.thread_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.thread_id = t.thread_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tWHERE t.forum_id='" . $this->forum_info['forum_id'] . "' AND t.thread_hidden='0' AND " . groupaccess('tf.forum_access') . " {$sql_condition}\n\t\t\t\t\t\t\t\tGROUP BY t.thread_id {$sql_order} LIMIT " . intval($_GET['thread_rowstart']) . ", " . $this->forum_info['threads_per_page']); $thread_rows = dbrows($t_result); if ($thread_rows > 0) { while ($threads = dbarray($t_result)) { $icon = ""; $match_regex = $threads['thread_id'] . "\\|" . $threads['thread_lastpost'] . "\\|" . $threads['forum_id']; if ($threads['thread_lastpost'] > $this->forum_info['lastvisited']) { if (iMEMBER && ($threads['thread_lastuser'] == $userdata['user_id'] || preg_match("(^\\.{$match_regex}\$|\\.{$match_regex}\\.|\\.{$match_regex}\$)", $userdata['user_threads']))) { $icon = "<i class='" . get_forumIcons('thread') . "' title='" . $locale['forum_0261'] . "'></i>"; } else { $icon = "<i class='" . get_forumIcons('new') . "' title='" . $locale['forum_0260'] . "'></i>"; } } $author = array('user_id' => $threads['thread_author'], 'user_name' => $threads['author_name'], 'user_status' => $threads['author_status'], 'user_avatar' => $threads['author_avatar']); $lastuser = array('user_id' => $threads['thread_lastuser'], 'user_name' => $threads['last_user_name'], 'user_status' => $threads['last_user_status'], 'user_avatar' => $threads['last_user_avatar']); $threads += array("thread_link" => array("link" => INFUSIONS . "forum/viewthread.php?thread_id=" . $threads['thread_id'], "title" => $threads['thread_subject']), "forum_type" => $row['forum_type'], "thread_pages" => makepagenav(0, $forum_settings['posts_per_page'], $threads['thread_postcount'], 3, FORUM . "viewthread.php?thread_id=" . $threads['thread_id'] . "&"), "thread_icons" => array('lock' => $threads['thread_locked'] ? "<i class='" . get_forumIcons('lock') . "' title='" . $locale['forum_0263'] . "'></i>" : '', 'sticky' => $threads['thread_sticky'] ? "<i class='" . get_forumIcons('sticky') . "' title='" . $locale['forum_0103'] . "'></i>" : '', 'poll' => $threads['thread_poll'] ? "<i class='" . get_forumIcons('poll') . "' title='" . $locale['forum_0314'] . "'></i>" : '', 'hot' => $threads['thread_postcount'] >= 20 ? "<i class='" . get_forumIcons('hot') . "' title='" . $locale['forum_0311'] . "'></i>" : '', 'reads' => $threads['thread_views'] >= 20 ? "<i class='" . get_forumIcons('reads') . "' title='" . $locale['forum_0311'] . "'></i>" : '', 'image' => $threads['attach_image'] > 0 ? "<i class='" . get_forumIcons('image') . "' title='" . $locale['forum_0313'] . "'></i>" : '', 'file' => $threads['attach_files'] > 0 ? "<i class='" . get_forumIcons('file') . "' title='" . $locale['forum_0312'] . "'></i>" : '', 'icon' => $icon), "thread_starter" => $locale['forum_0006'] . timer($threads['post_datestamp']) . " " . $locale['by'] . " " . profile_link($author['user_id'], $author['user_name'], $author['user_status']) . "</span>", "thread_author" => $author, "thread_last" => array('avatar' => display_avatar($lastuser, '30px', '', '', ''), 'profile_link' => profile_link($lastuser['user_id'], $lastuser['user_name'], $lastuser['user_status']), 'time' => $threads['post_datestamp'], 'post_message' => parseubb(parsesmileys($threads['post_message'])), "formatted" => "<div class='pull-left'>" . display_avatar($lastuser, '30px', '', '', '') . "</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='overflow-hide'>" . $locale['forum_0373'] . " <span class='forum_profile_link'>" . profile_link($lastuser['user_id'], $lastuser['user_name'], $lastuser['user_status']) . "</span><br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . timer($threads['post_datestamp']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>")); //if ($threads['thread_status']['reads']) $threads['thread_status']['icon'] = $threads['thread_status']['reads']; //if ($threads['thread_status']['hot']) $threads['thread_status']['icon'] = $threads['thread_status']['hot']; //if ($threads['thread_status']['sticky']) $threads['thread_status']['icon'] = $threads['thread_status']['sticky']; //if ($threads['thread_status']['lock']) $threads['thread_status']['icon'] = $threads['thread_status']['lock']; // Threads Customized Output /* $attach_image = 0; $attach_file = 0; $a_result = dbquery("SELECT attach_id, attach_mime FROM ".DB_FORUM_ATTACHMENTS." WHERE thread_id ='".$threads['thread_id']."'"); if (dbrows($a_result) > 0) { require_once INCLUDES."mimetypes_include.php"; while ($adata = dbarray($a_result)) { if (in_array($adata['attach_mime'], img_mimeTypes())) { $attach_image = $attach_image+1; } else { $attach_file = $attach_file+1; } } }*/ if ($threads['thread_sticky']) { $this->forum_info['threads']['sticky'][$threads['thread_id']] = $threads; } else { $this->forum_info['threads']['item'][$threads['thread_id']] = $threads; } } } if ($this->forum_info['thread_max_rows'] > $this->forum_info['threads_per_page']) { $this->forum_info['threads']['pagenav'] = makepagenav($_GET['thread_rowstart'], $this->forum_info['threads_per_page'], $this->forum_info['thread_max_rows'], 3, clean_request("", array("thread_rowstart"), FALSE) . "&", "thread_rowstart"); $this->forum_info['threads']['pagenav2'] = makepagenav($_GET['thread_rowstart'], $this->forum_info['threads_per_page'], $this->forum_info['thread_max_rows'], 3, clean_request("", array("thread_rowstart"), FALSE) . "&", "thread_rowstart", TRUE); } } } } } else { redirect(INFUSIONS . 'forum/index.php'); } } else { $this->forum_info['forums'] = Functions::get_forum(); } } }
/** * Get the forum structure * * @param bool $forum_id * @param bool $branch_id * * @return array */ public static function get_forum($forum_id = FALSE, $branch_id = FALSE) { // only need to fetch child. $forum_settings = self::get_forum_settings(); $userdata = fusion_get_userdata(); $locale = fusion_get_locale("", FORUM_LOCALE); $index = array(); // define what a row is $row = array('forum_new_status' => '', 'last_post' => '', 'forum_icon' => '', 'forum_icon_lg' => '', 'forum_moderators' => '', 'forum_link' => array('link' => '', 'title' => ''), 'forum_description' => '', 'forum_postcount_word' => '', 'forum_threadcount_word' => ''); $query = dbquery("\n\t\t\t\tSELECT tf.forum_id, tf.forum_cat, tf.forum_branch, tf.forum_name, tf.forum_description, tf.forum_image,\n\t\t\t\ttf.forum_type, tf.forum_mods, tf.forum_threadcount, tf.forum_postcount, tf.forum_order, tf.forum_lastuser, tf.forum_access, tf.forum_lastpost, tf.forum_lastpostid,\n\t\t\t\tt.thread_id, t.thread_lastpost, t.thread_lastpostid, t.thread_subject, p.post_message,\n\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar\n\t\t\t\tFROM " . DB_FORUMS . " tf\n\t\t\t\tLEFT JOIN " . DB_FORUM_THREADS . " t ON tf.forum_lastpostid = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p ON p.thread_id = t.thread_id AND p.post_id = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON tf.forum_lastuser = u.user_id\n\t\t\t\t" . (multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('tf.forum_access') . "\n\t\t\t\t" . ($forum_id && $branch_id ? "AND tf.forum_id = '" . intval($forum_id) . "' or tf.forum_cat = '" . intval($forum_id) . "' OR tf.forum_branch = '" . intval($branch_id) . "'" : '') . "\n\t\t\t\tGROUP BY tf.forum_id ORDER BY tf.forum_cat ASC, tf.forum_order ASC, t.thread_lastpost DESC\n\t\t"); while ($data = dbarray($query) and checkgroup($data['forum_access'])) { // Calculate Forum New Status $newStatus = ""; $forum_match = "\\|" . $data['forum_lastpost'] . "\\|" . $data['forum_id']; $last_visited = isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(); if ($data['forum_lastpost'] > $last_visited) { if (iMEMBER && ($data['forum_lastuser'] !== $userdata['user_id'] || !preg_match("({$forum_match}\\.|{$forum_match}\$)", $userdata['user_threads']))) { $newStatus = "<span class='forum-new-icon'><i title='" . $locale['forum_0260'] . "' class='" . self::get_forumIcons('new') . "'></i></span>"; } } // Calculate lastpost information $lastPostInfo = array(); if ($data['forum_lastpostid']) { $last_post = array('avatar' => '', 'avatar_src' => $data['user_avatar'] && file_exists(IMAGES . 'avatars/' . $data['user_avatar']) && !is_dir(IMAGES . 'avatars/' . $data['user_avatar']) ? IMAGES . 'avatars/' . $data['user_avatar'] : '', 'message' => fusion_first_words(parseubb(parsesmileys($data['post_message'])), 10), 'profile_link' => profile_link($data['forum_lastuser'], $data['user_name'], $data['user_status']), 'time' => timer($data['forum_lastpost']), 'date' => showdate("forumdate", $data['forum_lastpost']), 'thread_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $data['forum_id'] . "&thread_id=" . $data['thread_id'], 'post_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $data['forum_id'] . "&thread_id=" . $data['thread_id'] . "&pid=" . $data['thread_lastpostid'] . "#post_" . $data['thread_lastpostid']); if ($forum_settings['forum_last_post_avatar']) { $last_post['avatar'] = display_avatar($data, '30px', '', '', 'img-rounded'); } $lastPostInfo = $last_post; } /** * Default system icons - why do i need this? Why not let themers decide? */ switch ($data['forum_type']) { case '1': $forum_icon = "<i class='" . self::get_forumIcons('forum') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('forum') . " fa-3x fa-fw m-r-10'></i>"; break; case '2': $forum_icon = "<i class='" . self::get_forumIcons('thread') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('thread') . " fa-3x fa-fw m-r-10'></i>"; break; case '3': $forum_icon = "<i class='" . self::get_forumIcons('link') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('link') . " fa-3x fa-fw m-r-10'></i>"; break; case '4': $forum_icon = "<i class='" . self::get_forumIcons('question') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('question') . " fa-3x fa-fw m-r-10'></i>"; break; default: $forum_icon = ""; $forum_icon_lg = ""; } $mod = new Moderator(); $row = array_merge($row, $data, array("forum_moderators" => $mod::parse_forum_mods($data['forum_mods']), "forum_new_status" => $newStatus, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&forum_id=" . $data['forum_id'] . "&parent_id=" . $data['forum_cat'], "title" => $data['forum_name']), "forum_description" => nl2br(parseubb($data['forum_description'])), "forum_postcount_word" => format_word($data['forum_postcount'], $locale['fmt_post']), "forum_threadcount_word" => format_word($data['forum_threadcount'], $locale['fmt_thread']), "last_post" => $lastPostInfo, "forum_icon" => $forum_icon, "forum_icon_lg" => $forum_icon_lg)); $data["forum_image"] = $data['forum_image'] && file_exists(FORUM . "images/" . $data['forum_image']) ? $data['forum_image'] : ""; $thisref =& $refs[$data['forum_id']]; $thisref = $row; if ($data['forum_cat'] == 0) { $index[0][$data['forum_id']] =& $thisref; } else { $refs[$data['forum_cat']]['child'][$data['forum_id']] =& $thisref; } } return (array) $index; }
function article_listing() { global $aidlink, $locale; // Remodel display results into straight view instead category container sorting. // consistently monitor sql results rendertime. -- Do not Surpass 0.15 // all blog are uncategorized by default unless specified. $limit = 15; if (isset($_GET['filter_cid']) && isnum($_GET['filter_cid'])) { $total_rows = dbcount("(article_id)", DB_ARTICLES, "article_cat='" . intval($_GET['filter_cid']) . "' AND " . (multilang_table("AR") ? "article_language='" . LANGUAGE . "'" : "")); } else { $total_rows = dbcount("(article_id)", DB_ARTICLES, multilang_table("AR") ? "article_language='" . LANGUAGE . "'" : ""); } $rowstart = isset($_GET['rowstart']) && $_GET['rowstart'] <= $total_rows ? $_GET['rowstart'] : 0; // add a filter browser $catOpts = array("all" => $locale['articles_0023']); $categories = dbquery("select article_cat_id, article_cat_name\n\t\t\t\tfrom " . DB_ARTICLE_CATS . " " . (multilang_table("AR") ? "where article_cat_language='" . LANGUAGE . "'" : "") . ""); if (dbrows($categories) > 0) { while ($cat_data = dbarray($categories)) { $catOpts[$cat_data['article_cat_id']] = $cat_data['article_cat_name']; } } // prevent xss $catFilter = ""; if (isset($_GET['filter_cid']) && isnum($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { if ($_GET['filter_cid'] > 0) { $catFilter = "article_cat = '" . intval($_GET['filter_cid']) . "'"; } } $langFilter = multilang_table("AR") ? "article_language='" . LANGUAGE . "'" : ""; if ($catFilter && $langFilter) { $filter = $catFilter . " AND " . $langFilter; } else { $filter = $catFilter . $langFilter; } $result = dbquery("\n\tSELECT a.article_id, a.article_cat, a.article_subject, a.article_snippet, a.article_draft,\n\tcat.article_cat_id, cat.article_cat_name\n\tFROM " . DB_ARTICLES . " a\n\tLEFT JOIN " . DB_ARTICLE_CATS . " cat on cat.article_cat_id=a.article_cat\n\t" . ($filter ? "WHERE " . $filter : "") . "\n\tORDER BY article_draft DESC, article_datestamp DESC LIMIT {$rowstart}, {$limit}\n\t"); $rows = dbrows($result); echo "<div class='clearfix m-t-20'>\n"; echo "<span class='pull-right m-t-10'>" . sprintf($locale['articles_0024'], $rows, $total_rows) . "</span>\n"; if (!empty($catOpts) > 0) { echo "<div class='pull-left m-t-5 m-r-10'>" . $locale['articles_0025'] . "</div>\n"; echo "<div class='dropdown pull-left m-r-10' style='position:relative'>\n"; echo "<a class='dropdown-toggle btn btn-default btn-sm' data-toggle='dropdown'>\n<strong>\n"; if (isset($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { echo $catOpts[$_GET['filter_cid']]; } else { echo $locale['articles_0026']; } echo " <span class='caret'></span></strong>\n</a>\n"; echo "<ul class='dropdown-menu' style='max-height:280px; width:300px; overflow-y: scroll'>\n"; function admin_article_list(array $data = array(), $id = 0, $level = 0) { $opt_pattern = str_repeat("—", $level); if (!empty($data[$id])) { foreach ($data[$id] as $cat_id => $value) { $active = isset($_GET['filter_cid']) && $_GET['filter_cid'] == $value['article_cat_id'] ? TRUE : FALSE; echo "<li" . ($active ? " class='active'" : "") . ">\n<a href='" . clean_request("filter_cid=" . $value['article_cat_id'], array("section", "rowstart", "aid"), TRUE) . "'>\n"; echo $opt_pattern . " " . $value['article_cat_name']; echo "</a>\n</li>\n"; if (isset($data[$value['article_cat_id']])) { admin_article_list($data, $value['article_cat_id'], $level + 1); } } } } $category_dat = dbquery_tree_full(DB_ARTICLE_CATS, "article_cat_id", "article_cat_parent"); admin_article_list($category_dat); echo "</ul>\n"; echo "</div>\n"; } if ($total_rows > $rows) { echo "<div class='pull-right m-r-10 '>\n"; echo makepagenav($rowstart, $limit, $total_rows, 3, clean_request("", array("aid", "section"), TRUE) . "&"); echo "</div>\n"; } echo "</div>\n"; echo "<ul class='list-group m-10'>\n"; if ($rows > 0) { while ($data2 = dbarray($result)) { echo "<li class='list-group-item'>\n"; echo "<div class='clearfix'>\n"; echo "<div class='m-b-10 pull-right'><strong>" . $locale['articles_0340'] . ":</strong>\n"; echo "<a class='display-inline-block badge' style='width:auto;' href='" . FUSION_SELF . $aidlink . "&action=edit&cat_id=" . $data2['article_cat_id'] . "&section=article_category'>"; echo $data2['article_cat_name']; echo "</a>"; echo "</div>\n"; echo "<span class='strong text-dark'>" . $data2['article_subject'] . "</span>\n"; echo "</div>\n"; $articleText = strip_tags(parse_textarea($data2['article_snippet'])); echo fusion_first_words($articleText, '50'); echo "<div class='block m-t-10'>\n\t\t\t<a href='" . FUSION_SELF . $aidlink . "&action=edit&section=article_form&article_id=" . $data2['article_id'] . "'>" . $locale['edit'] . "</a> -\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=delete&section=article&article_id=" . $data2['article_id'] . "'\n\t\t\tonclick=\"return confirm('" . $locale['articles_0251'] . "');\">" . $locale['delete'] . "</a>\n"; echo "</div>\n"; echo "</li>\n"; } } else { echo "<div class='panel-body text-center'>\n"; echo $locale['articles_0343']; echo "</div>\n"; } echo "</ul>\n"; if ($total_rows > $rows) { echo makepagenav($rowstart, $limit, $total_rows, 3, clean_request("", array("aid", "section"), TRUE) . "&"); } }
function render_page($license = FALSE) { global $locale, $data, $aidlink; include THEME . "/locale/" . LOCALESET . "locale.php"; add_to_head(' <!--[if lt IE 7]> <script type="text/javascript" src="' . THEME . 'js/ie-png.js"></script> <script type="text/javascript" src="' . THEME . 'js/supersleight.js"></script> <link rel="stylesheet" type="text/css" href="' . THEME . 'css/lt7.css" /> <![endif]--> <!--[if IE]> <link rel="stylesheet" type="text/css" href="' . THEME . 'css/ie.css" /> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="' . THEME . 'css/ie7.css" /> <![endif]--> <script type="text/javascript" src="' . THEME . 'js/jquery.cycle.all.min.js"></script> <script type="text/javascript" src="' . THEME . 'js/cufon-yui.js"></script> <script type="text/javascript" src="' . THEME . 'js/Debonair-Calibri.js"></script> <script type="text/javascript" src="' . THEME . 'js/Cufon-Settings.js"></script> <script type="text/javascript" src="' . THEME . 'js/slider-settings.js"></script> <script type="text/javascript" src="' . THEME . 'js/subnavie6.js"></script> '); add_to_head("<link rel='stylesheet' href='" . THEME . "css/bootstrap_rewrite.css' type='text/css'/>"); include THEME . "theme_db.php"; $theme_settings = get_theme_settings("debonair"); echo "<div id='wrapper'>\n"; echo "<div class='container'>\n"; echo "<div class='body-wrap'>\n"; echo "<div class='body-inner-wrap'>\n"; // start header ---- $banner_path = fusion_get_settings("sitebanner"); echo "<header class='clearfix m-t-10'>\n\t\t<a class='logo' href='" . BASEDIR . "index.php'><img src='" . ($banner_path !== "" ? BASEDIR . $banner_path : IMAGES . "php-fusion-logo.png") . "' alt='" . fusion_get_settings("sitename") . "'/></a>\n\t\t<div class='tagline'>Super Clean Web 2.0 Business Template</div>\n"; echo "<div class='call-tag'>\n"; if (iADMIN) { echo "<span class='display-inline-block m-r-10'><a href='" . ADMIN . $aidlink . "'>" . $locale['global_123'] . "</a></span>\n"; } echo $locale['global_ML102'] . "\n"; foreach (fusion_get_enabled_languages() as $lang => $lang_name) { echo "<a href='" . clean_request("lang=" . $lang, array(), FALSE) . "'>{$lang_name}</a>\n"; } echo "<i id='theme_search' class='fa fa-search fa-fw'></i>"; echo "</div>\n</header>\n"; // end header ---- // start nav --- echo showsublinks(); // end nav -- // Header Banner $banner_inclusion_url = explode(",", $theme_settings['main_banner_url']); if (in_array(START_PAGE, $banner_inclusion_url)) { // get the results of the banner $result = dbquery("SELECT * FROM " . DB_DEBONAIR . " where banner_language='" . LANGUAGE . "' order by banner_order ASC"); // show banner echo "<aside class='banner'>\n"; echo "<div id='slider-container'>\n"; echo "<ul id='slider-box'>\n"; if (dbrows($result)) { while ($data = dbarray($result)) { echo "<!--Slide " . $data['banner_id'] . "-->\n"; echo "<li>\n"; echo "<div class='inner-banner'>\n"; echo "<div class='slider-corner'></div>\n"; if ($data['banner_image']) { echo "<div class='screen'><img src='" . THEME . "upload/" . $data['banner_image'] . "' alt='" . $data['banner_subject'] . "'/></div>\n"; } if ($data['banner_description'] !== "") { echo "<h2>" . $data['banner_subject'] . "</h2>\n"; echo "<p>" . parseubb(parsesmileys($data['banner_description'])) . "</p>\n"; } else { echo "<h1>" . $data['banner_subject'] . "</h1>\n"; } if ($data['banner_link'] !== "") { echo "<div class='button-position'>\n"; echo "<div class='btn-group'><a class='btn btn-success btn-sm' href='" . BASEDIR . $data['banner_link'] . "'>Learn more</a></div>\n"; echo "</div>\n"; } echo "</div>\n</li>\n"; echo "<!--End slide " . $data['banner_id'] . "-->\n"; } } else { echo "<!--Slide Welcome-->\n\t\t\t <li>\n\t\t\t <div class='welcome-banner'><div class='slider-corner'></div>\n\t\t\t <h1>" . $locale['debonair_0500'] . "</h1>\n\t\t\t <h2>" . $locale['debonair_0501'] . "</h2>\n\t\t\t </div>\n\t\t\t </li>\n\t\t\t <!-- End Slide Welcome-->\n\t\t \t"; echo "<!--Slide Customize-->\n\t\t\t <li>\n\t\t\t <div class='welcome-banner-2'><div class='slider-corner'></div>\n\t\t\t <h1>" . $locale['debonair_0502'] . "</h1>\n\t\t\t <h2>" . $locale['debonair_0502a'] . "</h2>\n\t\t\t <div class='button-position'>\n\t\t\t <p>" . $locale['debonair_0502c'] . "</p>\n\t\t\t </div></div>\n\t\t\t </li>\n\t\t\t <!-- End Slide Customize-->\n\t\t \t"; } echo "</ul>\n"; echo "<!-- Start Slider Nav-->\n<div class='slide-pager-container'>\n<div id='slide-pager'></div>\n</div>\n<!-- End Slider Nav-->\n</div>\n"; echo "</aside>\n"; // upperbanner echo "<div class='lower-banner'>\n<div class='row holder'>\n"; // 3 columns for ($i = 1; $i <= 3; $i++) { echo "<div class='col-xs-12 col-sm-4 col'>\n"; if ($theme_settings['ubanner_col_' . $i] !== "") { $data = uncomposeSelection($theme_settings['ubanner_col_' . $i]); if (!empty($data['selected']) && multilang_table("NS") ? !empty($data['options'][LANGUAGE]) : "") { switch ($data['selected']) { case "news": if (db_exists(DB_NEWS) && isset($data['options'][LANGUAGE])) { $result = dbquery("select * from " . DB_NEWS . "\n\t\t\t\t\t\t\t\t\t\t\t" . (multilang_table("NS") ? "WHERE news_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('news_visibility') . "\n\t\t\t\t\t\t\t\t\t\t\tAND (news_start='0'||news_start<=" . time() . ")\n\t\t\t\t\t\t\t\t\t\t\tAND (news_end='0'||news_end>=" . time() . ") AND news_draft='0'\n\t\t\t\t\t\t\t\t\t\t\tAND news_id='" . $data['options'][LANGUAGE] . "'\n\t\t\t\t\t\t\t\t\t\t\t"); if (dbrows($result) > 0) { $data = dbarray($result); echo "<h2 class='icon1'>" . $data['news_subject'] . "</h2>\n"; echo "<p>" . fusion_first_words(parse_textarea($data['news_news']), 50) . "</p>\n"; echo "<div class='link-holder'><a href='" . INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n"; } else { echo "<p>" . $locale['debonair_0600'] . "</p>\n"; } } else { echo "<p>" . $locale['debonair_0408'] . "</p>\n"; } break; case "blog": if (db_exists(DB_BLOG) && isset($data['options'][LANGUAGE])) { $result = dbquery("select * from " . DB_BLOG . "\n\t\t\t\t\t\t\t\t\t\t\t" . (multilang_table("BL") ? "WHERE blog_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('blog_visibility') . "\n\t\t\t\t\t\t\t\t\t\t\tAND (blog_start='0'||blog_start<=" . time() . ")\n\t\t\t\t\t\t\t\t\t\t\tAND (blog_end='0'||blog_end>=" . time() . ") AND blog_draft='0'\n\t\t\t\t\t\t\t\t\t\t\tAND blog_id='" . $data['options'][LANGUAGE] . "'\n\t\t\t\t\t\t\t\t\t\t\t"); if (dbrows($result) > 0) { $data = dbarray($result); echo "<h2 class='icon2'>" . $data['blog_subject'] . "</h2>\n"; echo "<p>" . fusion_first_words(parse_textarea($data['blog_blog']), 50) . "</p>\n"; echo "<div class='link-holder'><a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n"; } else { echo "<p>" . $locale['debonair_0600'] . "</p>\n"; } } else { echo "<p>" . $locale['debonair_0405'] . "</p>\n"; } break; case "articles": if (db_exists(DB_ARTICLES) && isset($data['options'][LANGUAGE])) { $result = dbquery("SELECT ta.article_id, ta.article_subject, ta.article_snippet, ta.article_article, ta.article_keywords, ta.article_breaks,\n\t\t\t\t\t\t\t\tta.article_datestamp, ta.article_reads, ta.article_allow_comments, ta.article_allow_ratings,\n\t\t\t\t\t\t\t\ttac.article_cat_id, tac.article_cat_name\n\t\t\t\t\t\t\t\tFROM " . DB_ARTICLES . " ta\n\t\t\t\t\t\t\t\tINNER JOIN " . DB_ARTICLE_CATS . " tac ON ta.article_cat=tac.article_cat_id\n\t\t\t\t\t\t\t\t" . (multilang_table("AR") ? "WHERE tac.article_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('article_visibility') . " AND article_id='" . $data['options'][LANGUAGE] . "' AND article_draft='0'"); if (dbrows($result) > 0) { $data = dbarray($result); echo "<h2 class='icon2'>" . $data['article_subject'] . "</h2>\n"; echo "<p>" . fusion_first_words(parse_textarea($data['article_subject']), 50) . "</p>\n"; echo "<div class='link-holder'><a href='" . INFUSIONS . "articles/articles.php?article_id=" . $data['article_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n"; } else { echo "<p>" . $locale['debonair_0600'] . "</p>\n"; } } else { echo "<p>" . $locale['debonair_0415'] . "</p>\n"; } break; case "cp": $result = dbquery("SELECT page_id, page_title, page_content\n\t\t\t\t\t\t\t\t\t\tfrom " . DB_CUSTOM_PAGES . "\n\t\t\t\t\t\t\t\t\t\tWHERE " . groupaccess('page_access') . "\n\t\t\t\t\t\t\t\t\t\tAND page_id='" . $data['options'][LANGUAGE] . "'"); if (dbrows($result) > 0) { $data = dbarray($result); echo "<h2 class='icon3'>" . $data['page_title'] . "</h2>\n"; echo "<p>" . fusion_first_words(parse_textarea($data['page_content']), 50) . "</p>\n"; echo "<div class='link-holder'><a href='" . BASEDIR . "viewpage.php?page_id=" . $data['page_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n"; } else { echo "<p>" . $locale['debonair_0600'] . "</p>\n"; } break; } } } else { echo "<h2 class='icon3'>" . $locale['debonair_0601'] . "</h2>\n"; echo "<p>" . $locale['debonair_0602'] . "</p>\n"; } echo "</div>\n"; } echo "</div>\n</div>\n"; } else { // show simple header echo "<aside class='banner m-b-15'>\n"; echo "<div class='page-header'>\n"; if (!iMEMBER) { echo "<a href='" . BASEDIR . "login.php' class='btn btn-sm btn-success pull-right'><span>" . $locale['register'] . "/" . $locale['login'] . "</span></a>"; } else { echo "<a href='" . fusion_get_settings("opening_page") . "?logout=yes' class='btn btn-sm btn-success pull-right'><span>" . $locale['logout'] . "</span></a>"; } echo "<div class='holder p-b-20 p-r-10'>\n"; echo "<div class='clearfix'>\n"; echo "<div class='pull-left m-r-5'><span class='fa fa-map-marker fa-fw'></i>\n</span></div>"; echo "<div class='overflow-hide'>\n"; echo render_breadcrumbs(); echo "</div>\n</div>\n"; $title_instance = \PHPFusion\BreadCrumbs::getInstance(); $reference = $title_instance->toArray(); // this will give you the whole breadcrumb array $debonAirTitle = !empty($reference) ? end($reference) : array('title' => $locale['home']); echo "<h1>" . $debonAirTitle['title'] . "</h1>\n"; echo "</div>\n</div>\n"; echo "</aside>\n"; } // end of banner // Start of Inner page structure for Bootstrap $side_grid_settings = array('desktop_size' => 2, 'laptop_size' => 3, 'tablet_size' => 3, 'phone_size' => 4); $notices = getNotices(); if ($notices) { echo renderNotices($notices); } echo "<section class='main-content'>\n<div class='main-content-inner'>\n"; // now have to do bootstrap calculation // row 1 - go for max width if (defined('AU_CENTER') && AU_CENTER) { echo "<div class='row'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>" . AU_CENTER . "</div>\n</div>"; } // row 2 - fluid setitngs depending on panel appearances echo "<div class='row'>\n"; if (defined('LEFT') && LEFT) { echo "<div class='" . html_prefix($side_grid_settings) . "'>\n" . LEFT . "</div>\n"; } // column left echo "<div class='" . html_prefix(center_grid_settings($side_grid_settings)) . "'>\n"; echo U_CENTER . CONTENT . L_CENTER . "</div>\n"; // column center if (defined('RIGHT') && RIGHT) { echo "<div class='" . html_prefix($side_grid_settings) . "'>\n" . RIGHT . "</div>\n"; } // column right echo "</div>\n"; // row 3 if (defined('BL_CENTER') && BL_CENTER) { echo "<div class='row'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>" . BL_CENTER . "</div>\n</div>"; } echo "</div>\n</section>\n"; echo "</div>\n"; // end body-inner-wrap // Begin Footer echo "<section class='lower-section'>\n"; echo "<div class='row col-holder'>\n"; // column 1 echo "<div class='col-xs-12 col-sm-3'>\n"; if ($theme_settings['lbanner_col_1'] !== "") { include "include/" . $theme_settings['lbanner_col_1']; } // column 2 echo "</div>\n<div class='col-xs-12 col-sm-3'>\n"; if ($theme_settings['lbanner_col_2'] !== "") { include "include/" . $theme_settings['lbanner_col_2']; } // column 3 echo "</div>\n<div class='col-xs-12 col-sm-3'>\n"; if ($theme_settings['lbanner_col_3'] !== "") { include "include/" . $theme_settings['lbanner_col_3']; } // column 4 echo "</div>\n<div class='col-xs-12 col-sm-3'>\n"; if ($theme_settings['lbanner_col_4'] !== "") { include "include/" . $theme_settings['lbanner_col_4']; } echo "</div>\n"; echo "</div>\n"; // start bottom echo "<div class='bottom'>\n"; if ($theme_settings['facebook_url'] || $theme_settings['twitter_url']) { echo "<!-- Start Follow Us Links -->\n<div class='follow-box'> <strong>" . $locale['debonair_0510'] . "</strong><ul>\n"; if ($theme_settings['facebook_url']) { echo "<li><a href='" . $theme_settings['facebook_url'] . "' class='facebook'>" . $locale['debonair_0511'] . "</a></li>\n"; } if ($theme_settings['twitter_url']) { echo "<li><a href='" . $theme_settings['twitter_url'] . "' class='twitter'>" . $locale['debonair_0512'] . "</a></li>\n"; } echo "</ul></div><!-- End Follow Us Links -->\n"; } echo "<div class='txt-holder'><p><small>" . str_replace("<br />", "", showcopyright()) . "</small></p></div>\n\t</div>\n</div>"; echo "</section>\n"; echo "</div>\n <!--End Wrapper Sub Elements -->"; echo "\n\t<div id='footer'>\n <!--Start Footer Nav -->\n <div class='footer-nav'>\n <div class='w1'>\n <div class='w2'>\n <ul>\n <li><a href='" . BASEDIR . fusion_get_settings("opening_page") . "'>" . $locale['debonair_0505'] . "</a></li>\n\t\t\t\t <li><a href='" . BASEDIR . "contact.php'>" . $locale['debonair_0506'] . "</a></li>\n"; if (db_exists(DB_ARTICLES)) { echo "<li><a href='" . INFUSIONS . "articles/articles.php'>" . $locale['debonair_0507'] . "</a></li>\n"; } if (db_exists(DB_NEWS)) { echo "<li><a href='" . INFUSIONS . "news/news.php'>" . $locale['debonair_0508'] . "</a></li>\n"; } if (db_exists(DB_BLOG)) { echo "<li><a href='" . INFUSIONS . "blog/blog.php'>" . $locale['debonair_0509'] . "</a></li>\n"; } echo "</ul>\n </div>\n </div>\n </div>\n <!--End Footer Nav -->\n </div>\n\t"; echo '<script type="text/javascript">Cufon.now();</script>'; }
/** * display download category container * @param int $parent * @param int $level */ function showcatlist($parent = 0, $level = 0) { global $locale, $aidlink, $row_num; $result = dbquery("\n\tSELECT d.download_cat_id, d.download_cat_name, d.download_cat_description,\n\tcount(dl.download_id) 'download_count',\n\tdc.download_cat_id 'child_categories'\n\tfrom " . DB_DOWNLOAD_CATS . " d\n\tleft join " . DB_DOWNLOAD_CATS . " dc on dc.download_cat_parent=d.download_cat_id\n\tleft join " . DB_DOWNLOADS . " dl on dl.download_cat=d.download_cat_id\n\tWHERE d.download_cat_parent='{$parent}' " . (multilang_table("DL") ? "and d.download_cat_language='" . LANGUAGE . "'" : "") . "\n\tgroup by d.download_cat_id\n\tORDER BY d.download_cat_name\n\t"); if (dbrows($result) != 0) { while ($data = dbarray($result)) { echo "<div class='list-group-item clearfix'>\n"; echo "<div class='btn-group pull-right m-t-5'>\n"; echo "<a class='btn btn-sm btn-default' href='" . clean_request("action=edit&cat_id=" . $data['download_cat_id'], array("section", "aid"), TRUE) . "'>" . $locale['edit'] . "</a>"; echo "<a class='btn btn-sm btn-danger " . ($data['download_count'] || $data['child_categories'] ? "disabled" : "") . "' href='" . clean_request("action=delete&cat_id=" . $data['download_cat_id'], array("section", "aid"), TRUE) . "' onclick=\"return confirm('" . $locale['download_0350'] . "');\"><i class='fa fa-trash fa-fw'></i> " . $locale['delete'] . "</a>\n"; echo "</div>\n"; echo "<div class='overflow-hide p-r-10'>\n"; echo "<span class='display-inline-block m-r-10 strong text-bigger'>" . str_repeat("—", $level) . $data['download_cat_name'] . "</span>"; if ($data['download_cat_description']) { echo "<br />" . str_repeat("—", $level) . "<span class='small'>" . fusion_first_words($data['download_cat_description'], 50) . "</span>"; } echo "</div>\n"; echo "</div>\n"; $row_num++; showcatlist($data['download_cat_id'], $level + 1); } } }
function news_listing() { global $aidlink, $locale; $result2 = dbquery("\n\tSELECT news_id, news_subject, news_image_t1, news_image, news_image_t2, news_news, news_draft FROM " . DB_NEWS . "\n\tWHERE " . (multilang_table("NS") ? "news_language='" . LANGUAGE . "' AND " : "") . " news_cat='0'\n\tORDER BY news_draft DESC, news_sticky DESC, news_datestamp DESC\n\t"); echo "<div class='m-t-20'>\n"; echo opencollapse('news-list'); echo "<div class='panel panel-default'>\n"; echo "<div class='panel-heading clearfix'>\n"; echo "<div class='overflow-hide'>\n"; echo "<span class='display-inline-block strong'><a " . collapse_header_link('news-list', '0', TRUE, 'm-r-10') . ">" . $locale['news_0202'] . "</a></span>\n"; echo "<span class='badge m-r-10'>" . dbrows($result2) . "</span>"; echo "<span class='text-smaller mid-opacity'>" . LANGUAGE . "</span>"; echo "</div>\n"; echo "</div>\n"; // end panel heading echo "<div " . collapse_footer_link('news-list', '0', TRUE) . ">\n"; echo "<ul class='list-group p-15'>\n"; if (dbrows($result2) > 0) { while ($data2 = dbarray($result2)) { echo "<li class='list-group-item'>\n"; echo "<div class='pull-left m-r-10'>\n"; $image_thumb = get_news_image_path($data2['news_image'], $data2['news_image_t1'], $data2['news_image_t2']); if (!$image_thumb) { $image_thumb = IMAGES . "imagenotfound70.jpg"; } echo thumbnail($image_thumb, '50px'); echo "</div>\n"; echo "<div class='overflow-hide'>\n"; $newsText = strip_tags(parse_textarea($data2['news_news'])); echo "<div><span class='strong text-dark'>" . $data2['news_subject'] . "</span><br/>" . fusion_first_words($newsText, '50') . "</div>\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=edit&section=news_form&news_id=" . $data2['news_id'] . "'>" . $locale['edit'] . "</a> -\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=delete&news_id=" . $data2['news_id'] . "' onclick=\"return confirm('" . $locale['news_0251'] . "');\">" . $locale['delete'] . "</a>\n"; echo "</li>\n"; } } else { echo "<div class='panel-body text-center'>\n"; echo $locale['news_0254']; echo "</div>\n"; } // news listing. echo "</ul>\n"; echo "</div>\n"; // panel container echo "</div>\n"; // panel default $result = dbquery("\n\tSELECT cat.news_cat_id, cat.news_cat_name, cat.news_cat_image, cat.news_cat_language,\n\tcount(news.news_id) as news_count,\n\tcount(child.news_cat_id) as news_parent_count\n\tFROM " . DB_NEWS_CATS . " cat\n\tLEFT JOIN " . DB_NEWS_CATS . " child on child.news_cat_parent = cat.news_cat_id\n\tLEFT JOIN " . DB_NEWS . " news on news.news_cat = cat.news_cat_id\n\t" . (multilang_table("NS") ? "WHERE cat.news_cat_language='" . LANGUAGE . "'" : "") . " GROUP BY cat.news_cat_id ORDER BY cat.news_cat_name\n\t"); if (dbrows($result) > 0) { while ($data = dbarray($result)) { echo "<div class='panel panel-default'>\n"; echo "<div class='panel-heading clearfix'>\n"; echo "<div class='btn-group pull-right m-t-5'>\n"; echo "<a class='btn btn btn-default' href='" . clean_request("section=news_category&action=edit&cat_id=" . $data['news_cat_id'], array("aid")) . "'>" . $locale['edit'] . "</a>"; echo "<a class='" . ($data['news_count'] || $data['news_parent_count'] ? "disabled" : "") . " btn btn-danger' href='" . clean_request("section=news_category&action=delete&cat_id=" . $data['news_cat_id'], array("aid")) . "' onclick=\"return confirm('" . $locale['news_0252'] . "');\"><i class='fa fa-trash'></i> " . $locale['delete'] . "</a>\n"; echo "</div>\n"; echo "<div class='overflow-hide p-r-10'>\n"; echo "<span class='display-inline-block strong'><a " . collapse_header_link('news-list', $data['news_cat_id'], '0', 'm-r-10') . ">" . $data['news_cat_name'] . "</a></span>\n"; echo "<span class='badge m-r-10'>" . $data['news_count'] . "</span>"; echo "<span class='text-smaller mid-opacity'>" . LANGUAGE . "</span>"; echo "</div>\n"; /// end overflow-hide echo "</div>\n"; // end panel heading echo "<div " . collapse_footer_link('news-list', $data['news_cat_id'], '0') . ">\n"; echo "<ul class='list-group p-15'>\n"; $result2 = dbquery("SELECT news_id, news_subject, news_image_t1, news_image, news_image_t2, news_news, news_draft FROM " . DB_NEWS . " " . (multilang_table("NS") ? "WHERE news_language='" . LANGUAGE . "' AND" : "WHERE") . " news_cat='" . $data['news_cat_id'] . "' ORDER BY news_draft DESC, news_sticky DESC, news_datestamp DESC"); if (dbrows($result2) > 0) { while ($data2 = dbarray($result2)) { echo "<li class='list-group-item'>\n"; echo "<div class='pull-left m-r-10'>\n"; $image_thumb = get_news_image_path($data2['news_image'], $data2['news_image_t1'], $data2['news_image_t2']); if (!$image_thumb) { $image_thumb = IMAGES . "imagenotfound70.jpg"; } echo thumbnail($image_thumb, '50px'); echo "</div>\n"; echo "<div class='overflow-hide'>\n"; $newsText = strip_tags(parse_textarea($data2['news_news'])); echo "<div><span class='strong text-dark'>" . $data2['news_subject'] . "</span><br/>" . fusion_first_words($newsText, 50) . "</div>\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=edit&section=news_form&news_id=" . $data2['news_id'] . "'>" . $locale['edit'] . "</a> -\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=delete&news_id=" . $data2['news_id'] . "' onclick=\"return confirm('" . $locale['news_0251'] . "');\">" . $locale['delete'] . "</a>\n"; echo "</li>\n"; } } else { echo "<div class='panel-body text-center'>\n"; echo $locale['news_0254']; echo "</div>\n"; } echo "</ul>\n"; echo "</div>\n</div>\n"; // panel container, default } } echo closecollapse(); echo "</div>\n"; }
function download_listing() { global $aidlink, $locale; $limit = 15; $total_rows = dbcount("(download_id)", DB_DOWNLOADS, ""); $rowstart = isset($_GET['rowstart']) && $_GET['rowstart'] <= $total_rows ? $_GET['rowstart'] : 0; // add a filter browser $catOpts['all'] = $locale['download_0004']; $categories = dbquery("select download_cat_id, download_cat_name from " . DB_DOWNLOAD_CATS . " " . (multilang_table("DL") ? "WHERE download_cat_language='" . LANGUAGE . "'" : "") . ""); if (dbrows($categories) > 0) { while ($cat_data = dbarray($categories)) { $catOpts[$cat_data['download_cat_id']] = $cat_data['download_cat_name']; } } // prevent xss $catFilter = ""; if (isset($_GET['filter_cid']) && isnum($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { if ($_GET['filter_cid'] > 0) { $catFilter = "download_cat='" . intval($_GET['filter_cid']) . "'"; } } $langFilter = multilang_table("DL") ? "download_cat_language='" . LANGUAGE . "'" : ""; if ($catFilter && $langFilter) { $filter = $catFilter . " AND " . $langFilter; } else { $filter = $catFilter . $langFilter; } $list_query = "SELECT d.*, dc.download_cat_id, dc.download_cat_name\n\tFROM " . DB_DOWNLOADS . " d\n\tINNER JOIN " . DB_DOWNLOAD_CATS . " dc on d.download_cat = dc.download_cat_id\n\t" . ($filter ? "WHERE {$filter} " : "") . "\n\tORDER BY dc.download_cat_sorting LIMIT {$rowstart}, {$limit}"; $result = dbquery($list_query); $rows = dbrows($result); echo "<div class='clearfix'>\n"; echo "<span class='pull-right m-t-10'>" . sprintf($locale['download_0005'], $rows, $total_rows) . "</span>\n"; if (!empty($catOpts) > 0 && $total_rows > 0) { echo "<div class='pull-left m-t-5 m-r-10'>" . $locale['download_0010'] . "</div>\n"; echo "<div class='dropdown pull-left m-r-10' style='position:relative'>\n"; echo "<a class='dropdown-toggle btn btn-default btn-sm' style='width: 200px;' data-toggle='dropdown'>\n<strong>\n"; if (isset($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { echo $catOpts[$_GET['filter_cid']]; } else { echo $locale['download_0011']; } echo " <span class='caret'></span></strong>\n</a>\n"; echo "<ul class='dropdown-menu' style='max-height:180px; width:200px; overflow-y: auto'>\n"; foreach ($catOpts as $catID => $catName) { $active = isset($_GET['filter_cid']) && $_GET['filter_cid'] == $catID ? true : false; echo "<li" . ($active ? " class='active'" : "") . ">\n<a class='text-smaller' href='" . clean_request("filter_cid=" . $catID, array("section", "rowstart", "aid"), true) . "'>\n"; echo $catName; echo "</a>\n</li>\n"; } echo "</ul>\n"; echo "</div>\n"; } if ($total_rows > $rows) { echo makepagenav($rowstart, $limit, $total_rows, $limit, clean_request("", array("aid", "section"), true) . "&"); } echo "</div>\n"; echo "<ul class='list-group m-10'>\n"; if ($rows > 0) { while ($data2 = dbarray($result)) { $download_url = ''; if (!empty($data2['download_file']) && file_exists(DOWNLOADS . "files/" . $data2['download_file'])) { $download_url = INFUSIONS . "downloads/downloads.php?file_id=" . $data2['download_id']; } elseif (!strstr($data2['download_url'], "http://") && !strstr($data2['download_url'], "../")) { $download_url = $data2['download_url']; } echo "<li class='list-group-item'>\n"; echo "<div class='pull-right'>\n" . $locale['download_0207'] . "\n\t\t\t<a style='width:auto;' href='" . FUSION_SELF . $aidlink . "&section=download_category&action=edit&cat_id=" . $data2['download_cat_id'] . "' class='badge'>\n\t\t\t" . $data2['download_cat_name'] . "</a>\n\t\t\t</div>\n"; echo "<div class='pull-left m-r-10'>\n"; echo thumbnail(DOWNLOADS . "images/" . $data2['download_image_thumb'], '50px'); echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo "<span class='strong text-dark'>" . $data2['download_title'] . "</span><br/>\n"; $dlText = strip_tags(parse_textarea($data2['download_description_short'])); echo fusion_first_words($dlText, '50'); echo "<div class='m-t-5'>\n"; echo "<a class='m-r-10' target='_blank' href='{$download_url}'>" . $locale['download_0226'] . "</a>\n"; echo "<a class='m-r-10' href='" . FUSION_SELF . $aidlink . "&action=edit&section=download_form&download_id=" . $data2['download_id'] . "'>" . $locale['edit'] . "</a>\n"; echo "<a class='m-r-10' href='" . FUSION_SELF . $aidlink . "&action=delete&section=download_form&download_id=" . $data2['download_id'] . "' onclick=\"return confirm('" . $locale['download_0255'] . "');\">" . $locale['delete'] . "</a>\n"; echo "</div>\n"; echo "</div>\n"; echo "</li>\n"; } } else { echo "<li class='panel-body text-center'>\n"; echo $locale['download_0250']; echo "</li>\n"; } echo "</ul>\n"; }