| at www.gnu.org/licenses/agpl.html. Removal of this | copyright header is strictly prohibited without | written permission from the original author(s). +--------------------------------------------------------*/ require_once file_exists('maincore.php') ? 'maincore.php' : __DIR__ . "/../../maincore.php"; if (!db_exists(DB_FAQS)) { redirect(BASEDIR . "error.php?code=404"); } require_once THEMES . "templates/header.php"; if (file_exists(INFUSIONS . "faq/locale/" . LOCALESET . "faq.php")) { include INFUSIONS . "faq/locale/" . LOCALESET . "faq.php"; } else { include INFUSIONS . "faq/locale/English/faq.php"; } include "templates/faq.php"; add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name")); if (isset($_GET['cat_id']) && isnum($_GET['cat_id'])) { $result = dbquery("SELECT *\tFROM " . DB_FAQ_CATS . " " . (multilang_table("FQ") ? "WHERE faq_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " faq_cat_id='" . intval($_GET['cat_id']) . "'"); if (dbrows($result) > 0) { $data = dbarray($result); add_to_title($locale['global_201'] . $data['faq_cat_name']); $data['faq_link'] = INFUSIONS . "faq/faq.php?cat_id=" . $data['faq_cat_id']; $info = $data; if (dbcount("(faq_id)", DB_FAQS, "faq_cat_id='" . intval($_GET['cat_id']) . "'")) { $result = dbquery("SELECT faq_id, faq_question, faq_answer from " . DB_FAQS . " WHERE faq_cat_id='" . intval($_GET['cat_id']) . "' ORDER BY faq_question"); while ($data = dbarray($result)) { $info['items'][$data['faq_id']] = $data; } } else { $info['nofaq_items'] = $locale['411']; }
redirect(BASEDIR . "error.php?code=404"); } require_once THEMES . "templates/header.php"; require_once INCLUDES . "infusions_include.php"; if (file_exists(INFUSIONS . "downloads/locale/" . LOCALESET . "downloads.php")) { $locale += fusion_get_locale("", INFUSIONS . "downloads/locale/" . LOCALESET . "downloads.php"); } else { $locale += fusion_get_locale("", INFUSIONS . "downloads/locale/English/downloads.php"); } include INFUSIONS . "downloads/templates/downloads.php"; require_once INFUSIONS . "downloads/classes/Functions.php"; $dl_settings = get_settings("downloads"); if (!isset($_GET['download_id']) && !isset($_GET['cat_id'])) { add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name")); } add_breadcrumb(array('link' => INFUSIONS . 'downloads/downloads.php', 'title' => \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name"))); $result = NULL; if (isset($_GET['file_id']) && isnum($_GET['file_id'])) { $res = 0; $data = dbarray(dbquery("SELECT download_url, download_file, download_cat, download_visibility FROM " . DB_DOWNLOADS . " WHERE download_id='" . intval($_GET['file_id']) . "'")); if (checkgroup($data['download_visibility'])) { $result = dbquery("UPDATE " . DB_DOWNLOADS . " SET download_count=download_count+1 WHERE download_id='" . intval($_GET['file_id']) . "'"); if (!empty($data['download_file']) && file_exists(DOWNLOADS . 'files/' . $data['download_file'])) { $res = 1; require_once INCLUDES . "class.httpdownload.php"; ob_end_clean(); $object = new httpdownload(); $object->set_byfile(DOWNLOADS . 'files/' . $data['download_file']); $object->use_resume = TRUE; $object->download(); exit;
} if ($data['photo_allow_ratings']) { $data += array("sum_rating" => $data['sum_rating'] > 0 ? $data['sum_rating'] : '0', "photo_ratings" => array('link' => $data['photo_link']['link'] . '#ratings', 'name' => $data['sum_rating'], 'word' => $data['sum_rating'] > 0 ? $data['sum_rating'] / $data['count_rating'] * 10 . "/10" : "0/10")); } $info['item'][] = $data; } } } render_photo_album($info); } else { redirect(INFUSIONS . 'gallery/gallery.php'); } } else { /* Main Index */ add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name")); add_breadcrumb(array('link' => INFUSIONS . 'gallery/gallery.php', 'title' => \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name"))); $info['max_rows'] = dbcount("(album_id)", DB_PHOTO_ALBUMS, groupaccess('album_access')); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $info['max_rows'] ? $_GET['rowstart'] : 0; if ($info['max_rows'] > 0) { $info['page_nav'] = $info['max_rows'] > $gallery_settings['gallery_pagination'] ? makepagenav($_GET['rowstart'], $gallery_settings['gallery_pagination'], $info['max_rows'], 3) : ''; $result = dbquery("SELECT ta.album_id, ta.album_title, ta.album_description, ta.album_image, ta.album_thumb1, ta.album_thumb2, ta.album_datestamp,\n\t\t\ttu.user_id, tu.user_name, tu.user_status\n\t\t\tFROM " . DB_PHOTO_ALBUMS . " ta\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ta.album_user=tu.user_id\n\t\t\t" . (multilang_table("PG") ? "WHERE album_language='" . LANGUAGE . "' AND" : "WHERE") . "\n\t\t\t" . groupaccess('album_access') . " ORDER BY album_order\n\t\t\tLIMIT " . $_GET['rowstart'] . ", " . $gallery_settings['gallery_pagination']); while ($data = dbarray($result)) { $data['album_link'] = array("link" => INFUSIONS . "gallery/gallery.php?album_id=" . $data['album_id'], "name" => $data['album_title']); if (iADMIN && checkrights("PH")) { global $aidlink; $data['album_edit'] = array("link" => INFUSIONS . "gallery/gallery_admin.php" . $aidlink . "&section=album_form&action=edit&cat_id=" . $data['album_id'], "name" => $locale['edit']); $data['album_delete'] = array("link" => INFUSIONS . "gallery/gallery_admin.php" . $aidlink . "&section=album_form&action=delete&cat_id=" . $data['album_id'], "name" => $locale['delete']); } $photo_directory = !SAFEMODE ? "album_" . $data['album_id'] : ''; $data['image'] = ''; if ($data['album_image']) {
/** * Set CustomPage Links into Navigation Bar * @param $data */ protected function set_customPageLinks($data) { $page_language = explode(".", $data['page_language']); foreach ($page_language as $language) { $link_order = dbresult(dbquery("SELECT MAX(link_order) FROM " . DB_SITE_LINKS . " " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . " link_cat='" . $data['page_link_cat'] . "'"), 0) + 1; $link_data = array('link_id' => !empty($data['link_id']) ? $data['link_id'] : 0, 'link_cat' => $data['page_link_cat'], 'link_name' => $data['page_title'], 'link_url' => 'viewpage.php?page_id=' . $data['page_id'], 'link_icon' => '', 'link_language' => $language, 'link_visibility' => 0, 'link_position' => 2, 'link_window' => 0, 'link_order' => $link_order); print_p($link_data); if (\PHPFusion\SiteLinks::verify_edit($link_data['link_id'])) { dbquery_insert(DB_SITE_LINKS, $link_data, 'update'); } else { dbquery_insert(DB_SITE_LINKS, $link_data, 'save'); } } }
/** * Displays Site Links Navigation Bar * @param string $sep - Custom seperator text * @param string $class - Class * @param array $options - * * Default $options parameters: * id - unique navbar id * container - true for container mode * navbar_class - switch between navbar-default, navbar-inverse or custom class * item_class - the default li class * separator - default li separator * callback_data - replace default data callback * * @param int $id - 0 for root , Sitelink_ID to show child only * @return string */ function showsublinks($sep = "", $class = "", array $options = array(), $id = 0) { $default_options = array("id" => "", "container" => FALSE, "navbar_class" => "navbar-default", "item_class" => $class, "separator" => $sep, "callback_data" => array(), "links_per_page" => fusion_get_settings("links_per_page"), "grouping" => fusion_get_settings("links_grouping"), "show_banner" => false, "show_header" => false); $options += $default_options; if (empty($options['id'])) { $options['id'] = md5(str_shuffle(str_replace(" ", "_", fusion_get_settings("sitename")))); } $pageInfo = pathinfo($_SERVER['REQUEST_URI']); $start_page = $pageInfo['dirname'] !== "/" ? ltrim($pageInfo['dirname'], "/") . "/" : ""; $site_path = ltrim(fusion_get_settings("site_path"), "/"); $start_page = str_replace($site_path, "", $start_page); $start_page .= $pageInfo['basename']; if (fusion_get_settings("site_seo") && defined('IN_PERMALINK') && !isset($_GET['aid'])) { global $filepath; $start_page = $filepath; } $res =& $res; if (empty($data) && empty($options['callback_data'])) { $data = \PHPFusion\SiteLinks::get_SiteLinksData(array('link_position' => array(2, 3))); // Is Equivalent to: //$data = dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat", "WHERE link_position >= 2".(multilang_table("SL") ? " AND link_language='".LANGUAGE."'" : "")." AND ".groupaccess('link_visibility')." ORDER BY link_cat ASC, link_order ASC"); } else { $data = $options['callback_data']; } /** * Change hierarchy data when grouping is on */ if ($options['grouping'] == true) { if (count($data[0]) > $options['links_per_page']) { $more_index = 9 * 10000000; $base_data = $data[0]; $data[$more_index] = array_slice($base_data, $options['links_per_page'], 9, TRUE); $data[0] = array_slice($base_data, 0, $options['links_per_page'], TRUE); $more[$more_index] = array("link_id" => $more_index, "link_cat" => 0, "link_name" => fusion_get_locale("global_700"), "link_url" => "#", "link_icon" => "", "link_visibility" => 0, "link_position" => 2, "link_window" => 0, "link_order" => $options['links_per_page'], "link_language" => LANGUAGE); $data[0] += $more; } } $banner = fusion_get_settings("sitebanner") && $options['show_banner'] == true ? "<img src='" . BASEDIR . fusion_get_settings("sitebanner") . "' alt='" . fusion_get_settings("sitename") . "'/>" : fusion_get_settings("sitename"); if (empty($id)) { $res = "<div id='" . $options['id'] . "' class='navbar " . $options['navbar_class'] . "' role='navigation'>\n"; $res .= $options['container'] ? "<div class='container'>\n" : ""; $res .= "<div class='navbar-header'>\n"; $res .= "<!---Menu Header Start--->\n"; $res .= "<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#phpfusion-menu' aria-expanded='false'>\n\t\t\t\t\t<span class='sr-only'>Toggle navigation</span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n \t\t\t</button>\n"; if ($options['show_header']) { $res .= "<a class='navbar-brand' href='" . BASEDIR . fusion_get_settings('opening_page') . "'>{$banner}</a>\n"; } else { $res .= "<a class='navbar-brand visible-xs hidden-sm hidden-md hidden-lg' href='" . BASEDIR . fusion_get_settings('opening_page') . "'>" . fusion_get_settings("sitename") . "</a>\n"; } $res .= "<!---Menu Header End--->\n"; $res .= "</div>\n"; $res .= "<div class='navbar-collapse collapse' id='" . $id . "-menu'>\n"; $res .= "<ul " . (fusion_get_settings("bootstrap") ? "class='nav navbar-nav primary'" : "id='main-menu' class='primary sm sm-simple'") . ">\n"; $res .= "<!---Menu Item Start--->\n"; } if (!empty($data)) { $i = 0; $default_link_data = array("link_id" => 0, "link_name" => "", "link_cat" => 0, "link_url" => "", "link_icon" => "", "link_active" => FALSE, "link_title" => FALSE, "link_disabled" => FALSE, "link_window" => FALSE); foreach ($data[$id] as $link_id => $link_data) { $link_data += $default_link_data; $link_data['link_name'] = parsesmileys(parseubb($link_data['link_name'])); $li_class = $options['item_class']; if ($link_data['link_disabled']) { $li_class = "disabled"; } else { if ($link_data['link_title'] == TRUE) { $li_class = "dropdown-header"; } } // Attempt to calculate a relative link $secondary_active = FALSE; if ($start_page !== $link_data['link_url']) { $link_instance = \PHPFusion\BreadCrumbs::getInstance(); $link_instance->showHome(FALSE); $reference = $link_instance->toArray(); if (!empty($reference)) { foreach ($reference as $refData) { if (!empty($link_data['link_url']) && !empty($refData['link']) && $link_data['link_url'] !== "index.php") { if (stristr($refData['link'], str_replace("index.php", "", $link_data['link_url']))) { $secondary_active = TRUE; } break; // match found } } } } if ($link_data['link_name'] != "---" && $link_data['link_name'] != "===") { $link_target = $link_data['link_window'] == "1" ? " target='_blank'" : ""; if ($i == 0 && $id > 0) { $li_class .= ($li_class ? " " : "") . "first-link"; } if ($start_page == $link_data['link_url'] || fusion_get_settings('site_path') . $start_page == $link_data['link_url'] || $secondary_active == TRUE || $start_page == fusion_get_settings("opening_page") && $i == 0 && $id === 0) { $li_class .= ($li_class ? " " : "") . "current-link active"; } $itemlink = BASEDIR . $link_data['link_url']; if (preg_match("!^(ht|f)tp(s)?://!i", $link_data['link_url']) || !empty(BASEDIR) && stristr($link_data['link_url'], BASEDIR)) { $itemlink = $link_data['link_url']; } $has_child = false; $l_1 = ""; $l_2 = ""; $tab_index = ""; if (isset($data[$link_id])) { $has_child = true; $l_1 = "class='dropdown-toggle' data-toggle='dropdown' "; $l_1 .= empty($id) && $has_child ? "data-submenu " : ""; $l_2 = empty($id) ? " <i class='caret'></i>\n" : ""; $li_class .= !empty($id) ? " dropdown-submenu" : " dropdown"; $tab_index .= !empty($id) ? "tabindex='0'" : ""; } $res .= "<li" . ($li_class ? " class='" . $li_class . "'" : "") . ">" . $sep . "\n"; $res .= "<a " . $l_1 . "href='" . $itemlink . "'" . $link_target . " {$tab_index}>\n"; $res .= !empty($link_data['link_icon']) ? "<i class='" . $link_data['link_icon'] . "'></i>" : ""; $res .= $link_data['link_name'] . $l_2 . "</a>\n"; if ($has_child) { $res .= "<ul" . (fusion_get_settings("bootstrap") ? " class='dropdown-menu'" : "") . ">\n"; if (!empty($link_data['link_url']) and $link_data['link_url'] !== "#") { $res .= "<li>" . $options['separator'] . "\n"; $res .= "<a href='" . $itemlink . "'" . $link_target . ">\n"; $res .= !empty($link_data['link_icon']) ? "<i class='" . $link_data['link_icon'] . "'></i>" : ""; $res .= $link_data['link_name'] . "</a>\n"; $res .= "</li>\n"; } $res .= showsublinks($sep, $class, $options, $link_data['link_id']); $res .= "</ul>\n"; } $res .= "</li>\n"; } elseif ($link_data['link_cat'] > 0) { $res .= "<li class='divider'></li>"; } $i++; } } if (empty($id)) { $res .= "<!---Menu Item End--->\n"; $res .= "</ul>\n"; $res .= $options['container'] ? "</div>\n" : ""; $res .= "</div>\n</div>\n"; } return $res; }
/** * Executes single news item information - $_GET['readmore'] * @param $news_id */ public function set_NewsItemInfo($news_id) { global $aidlink; $locale = fusion_get_locale('', NEWS_LOCALE); $settings = fusion_get_settings(); set_title(SiteLinks::get_current_SiteLinks("", "link_name")); add_breadcrumb(array('link' => INFUSIONS . 'news/news.php', 'title' => SiteLinks::get_current_SiteLinks("", "link_name"))); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) ? $_GET['rowstart'] : 0; $result = dbquery(self::get_NewsQuery(array('condition' => 'news_id=' . intval($news_id)))); if (dbrows($result) > 0) { include INCLUDES . "comments_include.php"; include INCLUDES . "ratings_include.php"; $data = dbarray($result); if ($data['news_keywords'] !== "") { set_meta("keywords", $data['news_keywords']); } if (!isset($_POST['post_comment']) && !isset($_POST['post_rating'])) { $result2 = dbquery("UPDATE " . DB_NEWS . " SET news_reads=news_reads+1 WHERE news_id='" . $_GET['readmore'] . "'"); $data['news_reads']++; } $news_subject = $data['news_subject']; $news_news = preg_split("/<!?--\\s*pagebreak\\s*-->/i", $data['news_breaks'] == "y" ? nl2br(parse_textarea($data['news_extended'] ? $data['news_extended'] : $data['news_news'])) : parse_textarea($data['news_extended'] ? $data['news_extended'] : $data['news_news'])); $pagecount = count($news_news); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $pagecount ? $_GET['rowstart'] : 0; $admin_actions = array(); if (iADMIN && checkrights("N")) { $admin_actions = array("edit" => INFUSIONS . "news/news_admin.php" . $aidlink . "&action=edit&section=nform&news_id=" . $data['news_id'], "delete" => INFUSIONS . "news/news_admin.php" . $aidlink . "&action=delete&section=nform&news_id=" . $data['news_id']); } $news_info = $this->get_NewsData($data); /* array( "news_id" => $data['news_id'], "user_id" => $data['user_id'], "user_name" => $data['user_name'], "user_status" => $data['user_status'], "user_joined" => $data['user_joined'], "user_level" => $data['user_level'], "user_avatar" => $data['user_avatar'], "news_datestamp" => $data['news_datestamp'], "news_ialign" => $data['news_ialign'], "cat_id" => $data['news_cat'], "news_cat_name" => $data['news_cat_name'], "news_cat_image_src" => !empty($data['news_cat_image']) && file_exists(IMAGES_NC.$data['news_cat_image']) ? IMAGES_NC.$data['news_cat_image'] : "", "news_image_src" => !empty($data['news_image']) && file_exists(IMAGES_N.$data['news_image']) ? IMAGES_N.$data['news_image'] : "", "cat_image" => $data['news_cat_image'], "news_subject" => $data['news_subject'], "news_descr" => $data['news_news'], "news_cat_url" => INFUSIONS.'news/news.php?cat_id='.$data['news_cat'], 'news_url' => INFUSIONS.'news/news.php?readmore='.$data['news_id'], 'news_news' => $news_news[$_GET['rowstart']], "news_ext" => "n", "news_keywords" => $data['news_keywords'], "news_reads" => $data['news_reads'], "news_comments" => $data['count_comment'], 'news_sum_rating' => $data['sum_rating'] ? $data['sum_rating'] : 0, 'news_count_votes' => $data['count_votes'], "news_allow_comments" => $data['news_allow_comments'], 'news_allow_ratings' => $data['news_allow_ratings'], "news_sticky" => $data['news_sticky'], "print_link" => BASEDIR."print.php?type=N&item_id=".$data['news_id'], 'admin_actions' => $admin_actions, ); */ if (fusion_get_settings("create_og_tags")) { add_to_head("<meta property='og:title' content='" . $data['news_subject'] . "' />"); add_to_head("<meta property='og:description' content='" . strip_tags($data['news_news']) . "' />"); add_to_head("<meta property='og:site_name' content='" . fusion_get_settings('sitename') . "' />"); add_to_head("<meta property='og:type' content='article' />"); add_to_head("<meta property='og:url' content='" . $settings['siteurl'] . "infusions/news.php?readmore=" . $_GET['readmore'] . "' />"); if ($data['news_image']) { $og_image = IMAGES_N . $data['news_image']; } else { $og_image = IMAGES_NC . $data['news_cat_image']; } $og_image = str_replace(BASEDIR, $settings['siteurl'], $og_image); add_to_head("<meta property='og:image' content='" . $og_image . "' />"); } $_GET['cat_id'] = $data['news_cat_id']; set_title($news_subject . $locale['global_200'] . $locale['news_0004']); $news_cat_index = dbquery_tree(DB_NEWS_CATS, 'news_cat_id', 'news_cat_parent'); $this->news_cat_breadcrumbs($news_cat_index); add_breadcrumb(array('link' => INFUSIONS . "news/news.php?readmore=" . $data['news_id'], 'title' => $data['news_subject'])); $info['news_item'] = $news_info; $info['news_item']['page_count'] = $pagecount; } else { redirect(INFUSIONS . "news/news.php"); } return $info; }