| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | |
|---|
| 3 | <extension engine="1.0"> |
|---|
| 4 | <id>portal_by_daris</id> |
|---|
| 5 | <title>Portal by Daris</title> |
|---|
| 6 | <version>2.4.3</version> |
|---|
| 7 | <description>Adds a portal to forum</description> |
|---|
| 8 | <author>Daris</author> |
|---|
| 9 | <minversion>1.3</minversion> |
|---|
| 10 | <maxtestedon>1.3.2</maxtestedon> |
|---|
| 11 | <install><![CDATA[ |
|---|
| 12 | require_once FORUM_ROOT.'extensions/portal_by_daris/install.php'; |
|---|
| 13 | install(); |
|---|
| 14 | |
|---|
| 15 | ]]></install> |
|---|
| 16 | <uninstall><![CDATA[ |
|---|
| 17 | require_once FORUM_ROOT.'extensions/portal_by_daris/install.php'; |
|---|
| 18 | uninstall(); |
|---|
| 19 | |
|---|
| 20 | ]]></uninstall> |
|---|
| 21 | |
|---|
| 22 | <hooks> |
|---|
| 23 | |
|---|
| 24 | <hook id="re_rewrite_rules"><![CDATA[ |
|---|
| 25 | require $ext_info['path'].'/include/rewrite_rules.php'; |
|---|
| 26 | ]]></hook> |
|---|
| 27 | |
|---|
| 28 | <hook id="in_start"><![CDATA[ |
|---|
| 29 | if (isset($_GET['page']) || isset($_GET['pages'])) |
|---|
| 30 | require $ext_info['path'].'/page.php'; |
|---|
| 31 | elseif ((empty($_GET) || (isset($_GET['login']) && count($_GET) == 1)) && basename($_SERVER['SCRIPT_NAME']) == 'index.php') |
|---|
| 32 | require $ext_info['path'].'/index.php'; |
|---|
| 33 | ]]></hook> |
|---|
| 34 | |
|---|
| 35 | <hook id="co_modify_url_scheme"><![CDATA[ |
|---|
| 36 | // Setup the URL rewriting scheme |
|---|
| 37 | if (file_exists($ext_info['path'].'/include/url/'.$forum_config['o_sef'].'.php')) |
|---|
| 38 | require $ext_info['path'].'/include/url/'.$forum_config['o_sef'].'.php'; |
|---|
| 39 | else |
|---|
| 40 | require $ext_info['path'].'/include/url/Default.php'; |
|---|
| 41 | ]]></hook> |
|---|
| 42 | |
|---|
| 43 | <hook id="hd_main_elements"><![CDATA[ |
|---|
| 44 | if (FORUM_PAGE == 'index') |
|---|
| 45 | { |
|---|
| 46 | // Top breadcrumbs |
|---|
| 47 | if (isset($main_elements['<!-- forum_crumbs_top -->']) && $main_elements['<!-- forum_crumbs_top -->'] == '') |
|---|
| 48 | $main_elements['<!-- forum_crumbs_top -->'] = '<div id="brd-crumbs-top" class="crumbs gen-content">'."\n\t".'<p>'.generate_crumbs(false).'</p>'."\n".'</div>'; |
|---|
| 49 | |
|---|
| 50 | // Bottom breadcrumbs |
|---|
| 51 | if (isset($main_elements['<!-- forum_crumbs_end -->']) && $main_elements['<!-- forum_crumbs_end -->'] == '') |
|---|
| 52 | $main_elements['<!-- forum_crumbs_end -->'] = '<div id="brd-crumbs-end" class="crumbs gen-content">'."\n\t".'<p>'.generate_crumbs(false).'</p>'."\n".'</div>'; |
|---|
| 53 | } |
|---|
| 54 | elseif (FORUM_PAGE == 'news') |
|---|
| 55 | { |
|---|
| 56 | $main_elements['<!-- forum_crumbs_top -->'] = '<div id="brd-crumbs-top">'."\n\t".'<p>'./*generate_crumbs(false).*/'</p>'."\n".'</div>'; |
|---|
| 57 | $main_elements['<!-- forum_crumbs_end -->'] = ''; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | ]]></hook> |
|---|
| 61 | |
|---|
| 62 | <hook id="vt_qpost_output_start"><![CDATA[ |
|---|
| 63 | |
|---|
| 64 | if ($forum_config['o_portal_panels_all_pages'] == 1) |
|---|
| 65 | echo '<div>'."\n\t".'<p></p>'."\n".'</div>'; |
|---|
| 66 | |
|---|
| 67 | ]]></hook> |
|---|
| 68 | |
|---|
| 69 | <hook id="hd_head"><![CDATA[ |
|---|
| 70 | // hd_head hook could be executed from a function (like message), so we need to globalize language variable |
|---|
| 71 | global $lang_portal; |
|---|
| 72 | |
|---|
| 73 | if (FORUM_PAGE != 'index') |
|---|
| 74 | { |
|---|
| 75 | $first_crumb = is_array($forum_page['crumbs'][0]) ? $forum_page['crumbs'][0][0] : $forum_page['crumbs'][0]; |
|---|
| 76 | $crumb = array($first_crumb, forum_link($forum_url['forums'])); |
|---|
| 77 | |
|---|
| 78 | array_insert($forum_page['crumbs'], 1, $crumb); |
|---|
| 79 | |
|---|
| 80 | if (FORUM_PAGE != 'news') |
|---|
| 81 | $forum_page['crumbs'][0][0] = $lang_common['Index']; |
|---|
| 82 | } |
|---|
| 83 | else |
|---|
| 84 | { |
|---|
| 85 | // Setup breadcrumbs |
|---|
| 86 | $forum_page['crumbs'] = array( |
|---|
| 87 | array($lang_common['Index'], forum_link($forum_url['index'])), |
|---|
| 88 | array($forum_config['o_board_title'], forum_link($forum_url['forums'])), |
|---|
| 89 | ); |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | if (!defined('FORUM_PORTAL') && $forum_config['o_portal_panels_all_pages'] == 1 && strpos(FORUM_PAGE, 'profile-') === false && strpos(FORUM_PAGE, 'admin-') === false && FORUM_PAGE != 'message') |
|---|
| 94 | define('FORUM_PORTAL', $ext_info['path'].'/'); |
|---|
| 95 | |
|---|
| 96 | if (defined('FORUM_PORTAL')) |
|---|
| 97 | { |
|---|
| 98 | $forum_head['style_portal'] = '<link rel="stylesheet" type="text/css" media="screen" href="'. $ext_info['url'].'/style/style.css" />'; |
|---|
| 99 | |
|---|
| 100 | $tpl_main = str_replace('<!-- forum_crumbs_top -->', '', $tpl_main); |
|---|
| 101 | $tpl_main = str_replace('<!-- forum_crumbs_end -->', '', $tpl_main); |
|---|
| 102 | |
|---|
| 103 | // add portal_top before forum_main |
|---|
| 104 | $tpl_main = str_replace('<div id="brd-main">', '<!-- forum_crumbs_top -->'."\n".'<!-- portal_top -->'."\n".'<div id="brd-main">', $tpl_main); |
|---|
| 105 | |
|---|
| 106 | /* if (FORUM_PAGE == 'news' || FORUM_PAGE == 'pages') |
|---|
| 107 | $tpl_main = str_replace('<!-- forum_main_head -->', '', $tpl_main); |
|---|
| 108 | */ |
|---|
| 109 | // add portal_bottom before forum_stats |
|---|
| 110 | $tpl_main = str_replace('<!-- forum_info -->', "\n".'<!-- portal_bottom -->'."\n".'<!-- forum_crumbs_end -->'."\n".'<!-- forum_info -->', $tpl_main); |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | if (file_exists(FORUM_CACHE_DIR.'cache_panels.php')) |
|---|
| 114 | require FORUM_CACHE_DIR.'cache_panels.php'; |
|---|
| 115 | |
|---|
| 116 | if (!defined('FORUM_PANELS_LOADED')) |
|---|
| 117 | { |
|---|
| 118 | require FORUM_PORTAL.'include/cache.php'; |
|---|
| 119 | generate_panels_cache(); |
|---|
| 120 | require FORUM_CACHE_DIR.'cache_panels.php'; |
|---|
| 121 | } |
|---|
| 122 | } |
|---|
| 123 | ]]></hook> |
|---|
| 124 | |
|---|
| 125 | <hook id="ft_end"><![CDATA[ |
|---|
| 126 | |
|---|
| 127 | require $ext_info['path'].'/panels.php'; |
|---|
| 128 | |
|---|
| 129 | ]]></hook> |
|---|
| 130 | |
|---|
| 131 | <hook id="ca_fn_generate_admin_menu_new_sublink"><![CDATA[ |
|---|
| 132 | |
|---|
| 133 | if (FORUM_PAGE_SECTION == 'start' || FORUM_PAGE_SECTION == 'settings') |
|---|
| 134 | { |
|---|
| 135 | global $lang_portal; |
|---|
| 136 | |
|---|
| 137 | if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/portal.php')) |
|---|
| 138 | require_once $ext_info['path'].'/lang/'.$forum_user['language'].'/portal.php'; |
|---|
| 139 | else |
|---|
| 140 | require_once $ext_info['path'].'/lang/English/portal.php'; |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | if (FORUM_PAGE_SECTION == 'start') |
|---|
| 144 | { |
|---|
| 145 | $forum_page['admin_submenu']['pages'] = '<li'.((FORUM_PAGE == 'admin-pages') ? ' class="active"' : '').'><a href="'.forum_link($forum_url['admin_pages']).'">'.$lang_portal['Pages'].'</a></li>'; |
|---|
| 146 | $forum_page['admin_submenu']['panels'] = '<li'.((FORUM_PAGE == 'admin-panels') ? ' class="active"' : '').'><a href="'.forum_link($forum_url['admin_panels']).'">'.$lang_portal['Panels'].'</a></li>'; |
|---|
| 147 | } |
|---|
| 148 | elseif (FORUM_PAGE_SECTION == 'settings') |
|---|
| 149 | $forum_page['admin_submenu']['settings-portal'] = '<li'.((FORUM_PAGE == 'admin-settings-portal') ? ' class="active"' : '').'><a href="'.forum_link($forum_url['admin_settings_portal']).'">'.$lang_portal['Portal'].'</a></li>'; |
|---|
| 150 | ]]></hook> |
|---|
| 151 | |
|---|
| 152 | <hook id="fn_generate_navlinks_end"><![CDATA[ |
|---|
| 153 | global $lang_portal; |
|---|
| 154 | |
|---|
| 155 | // Load portal.php language file |
|---|
| 156 | if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/portal.php')) |
|---|
| 157 | require_once $ext_info['path'].'/lang/'.$forum_user['language'].'/portal.php'; |
|---|
| 158 | else |
|---|
| 159 | require_once $ext_info['path'].'/lang/English/portal.php'; |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | $links['index'] = '<li id="navportal"'.((FORUM_PAGE == 'news' || FORUM_PAGE == 'pages') ? ' class="active"' : '').'><a href="'.forum_link($forum_url['index']).'"><span>'.$lang_common['Index'].'</span></a></li>'; |
|---|
| 163 | |
|---|
| 164 | array_insert($links, 1, '<li id="navindex"'.((FORUM_PAGE == 'index') ? ' class="active"' : '').'><a href="'.forum_link($forum_url['forums']).'"><span>'.$lang_common['Forum'].'</span></a></li>', 'forum'); |
|---|
| 165 | |
|---|
| 166 | ]]></hook> |
|---|
| 167 | |
|---|
| 168 | <hook id="aop_new_section"><![CDATA[ |
|---|
| 169 | if ($section == 'portal') |
|---|
| 170 | require $ext_info['path'].'/admin/portal.php'; |
|---|
| 171 | ]]></hook> |
|---|
| 172 | |
|---|
| 173 | <hook id="aop_new_section_validation"><![CDATA[ |
|---|
| 174 | if ($section == 'portal') |
|---|
| 175 | { |
|---|
| 176 | $form['portal_news_count'] = intval($form['portal_news_count']); |
|---|
| 177 | $form['portal_left_width'] = intval($form['portal_left_width']); |
|---|
| 178 | $form['portal_right_width'] = intval($form['portal_right_width']); |
|---|
| 179 | if (!isset($form['portal_panels_all_pages']) || $form['portal_panels_all_pages'] != '1') $form['portal_panels_all_pages'] = '0'; |
|---|
| 180 | } |
|---|
| 181 | ]]></hook> |
|---|
| 182 | |
|---|
| 183 | <hook id="aop_start"><![CDATA[ |
|---|
| 184 | if (isset($_POST['form']['portal_news_forums'])) |
|---|
| 185 | $_POST['form']['portal_news_forums'] = implode(',', $_POST['form']['portal_news_forums']); |
|---|
| 186 | ]]></hook> |
|---|
| 187 | |
|---|
| 188 | <!-- RSS --> |
|---|
| 189 | |
|---|
| 190 | <hook id="ex_qr_get_topics"><![CDATA[ |
|---|
| 191 | if (isset($_GET['news_feed'])) |
|---|
| 192 | $query['WHERE'] .= ' AND t.forum_id IN('.$forum_config['o_portal_news_forums'].')'; |
|---|
| 193 | |
|---|
| 194 | ]]></hook> |
|---|
| 195 | |
|---|
| 196 | <hook id="ex_modify_cur_topic_item"><![CDATA[ |
|---|
| 197 | |
|---|
| 198 | if (isset($_GET['news_feed'])) |
|---|
| 199 | { |
|---|
| 200 | require_once FORUM_ROOT.'include/parser.php'; |
|---|
| 201 | |
|---|
| 202 | $link = forum_link($forum_url['topic'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))); |
|---|
| 203 | |
|---|
| 204 | $description = parse_message(strlen($cur_topic['message']) > 1000 ? substr($cur_topic['message'], 0, 1000).'...' : $cur_topic['message'], 1); |
|---|
| 205 | |
|---|
| 206 | $item_id = count($feed['items']) - 1; |
|---|
| 207 | $feed['items'][$item_id]['description'] = $description; |
|---|
| 208 | $feed['items'][$item_id]['link'] = $link; |
|---|
| 209 | } |
|---|
| 210 | ]]></hook> |
|---|
| 211 | |
|---|
| 212 | <!-- / RSS --> |
|---|
| 213 | </hooks> |
|---|
| 214 | </extension> |
|---|