templates.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // Copyright (C) ReloadCMS Development Team //
  4. // http://reloadcms.sf.net //
  5. // //
  6. // This program is distributed in the hope that it will be useful, //
  7. // but WITHOUT ANY WARRANTY, without even the implied warranty of //
  8. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
  9. // //
  10. // This product released under GNU General Public License v2 //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. function user_tz_select($default = 0, $select_name = 'timezone') {
  13. global $lang;
  14. $tz_select = '<select name="' . $select_name . '">';
  15. if (@$lang['tz']) {
  16. foreach ($lang['tz'] as $offset => $zone) {
  17. $selected = ( $offset == $default ) ? ' selected="selected"' : '';
  18. $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
  19. }
  20. }
  21. $tz_select .= '</select>';
  22. return $tz_select;
  23. }
  24. function user_skin_select($dir, $select_name, $default = '', $style = '', $script = '') {
  25. $skins = rcms_scandir($dir);
  26. $frm = '<select name="' . $select_name . '" style="' . $style . '" ' . $script . '>';
  27. foreach ($skins as $skin) {
  28. if (is_dir($dir . $skin) && is_file($dir . $skin . '/skin_name.txt')) {
  29. $name = file_get_contents($dir . $skin . '/skin_name.txt');
  30. $frm .= '<option value="' . $skin . '"' . (($default == $skin) ? ' selected="selected">' : '>') . $name . '</option>';
  31. }
  32. }
  33. $frm .= '</select>';
  34. return $frm;
  35. }
  36. function user_lang_select($select_name, $default = '', $style = '', $script = '') {
  37. global $system;
  38. $frm = '<select name="' . $select_name . '" style="' . $style . '" ' . $script . '>';
  39. foreach ($system->data['languages'] as $lang_id => $lang_name) {
  40. $frm .= '<option value="' . $lang_id . '"' . (($default == $lang_id) ? ' selected="selected">' : '>') . $lang_name . '</option>';
  41. }
  42. $frm .= '</select>';
  43. return $frm;
  44. }
  45. function rcms_pagination($total, $perpage, $current, $link) {
  46. $return = '';
  47. $link = preg_replace("/((&amp;|&)page=(\d*))/", '', $link);
  48. if (!empty($perpage)) {
  49. $pages = ceil($total / $perpage);
  50. if ($pages != 1) {
  51. $c = 1;
  52. while ($c <= $pages) {
  53. if ($c != $current)
  54. $return .= ' [' . '<a href="' . $link . '&amp;page=' . $c . '">' . $c . '</a>] ';
  55. else
  56. $return .= ' [' . $c . '] ';
  57. $c++;
  58. }
  59. }
  60. }
  61. return $return;
  62. }
  63. function rcms_parse_menu($format) {
  64. global $system;
  65. $navigation = parse_ini_file(CONFIG_PATH . 'navigation.ini', true);
  66. $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true);
  67. $result = array();
  68. foreach ($navigation as $link) {
  69. if (substr($link['url'], 0, 9) == 'external:') {
  70. $target = '_blank';
  71. $link['url'] = substr($link['url'], 9);
  72. } else {
  73. $target = '';
  74. }
  75. $tdata = explode(':', $link['url'], 2);
  76. if (count($tdata) == 2) {
  77. list($modifier, $value) = $tdata;
  78. } else {
  79. $modifier = $tdata[0];
  80. }
  81. if (!empty($value) && !empty($system->navmodifiers[$modifier])) {
  82. if ($clink = call_user_func($system->navmodifiers[$modifier]['m'], $value)) {
  83. $result[] = array($clink[0], (empty($link['name'])) ? $clink[1] : __($link['name']), $target);
  84. }
  85. } else {
  86. $result[] = array($link['url'], __($link['name']));
  87. }
  88. }
  89. $menu = '';
  90. foreach ($result as $item) {
  91. if (empty($item[2])) {
  92. $item[2] = '_top';
  93. }
  94. // Begin of Icons support by Migel
  95. if ($item[0] == '?module=index') {
  96. $item[3] = 'home.png';
  97. } elseif ($item[0] == '?module=articles') {
  98. $item[3] = 'articles.png';
  99. } elseif ($item[0] == '?module=guestbook') {
  100. $item[3] = 'guestbook.png';
  101. } elseif ($item[0] == '?module=gallery') {
  102. $item[3] = 'gallery.png';
  103. } elseif ($item[0] == '?module=user.list') {
  104. $item[3] = 'userlist.png';
  105. } elseif ($item[0] == '?module=filesdb') {
  106. $item[3] = 'files.png';
  107. } elseif ($item[0] == '?module=feedback') {
  108. $item[3] = 'email.png';
  109. } elseif ($item[0] == '?module=forum') {
  110. $item[3] = 'forum.png';
  111. } else {
  112. $item[3] = 'default.png';
  113. }
  114. if (isset($dyna['ico']))
  115. $item[3] = '<img src="skins/icons/' . $item[3] . '">';
  116. else
  117. $item[3] = '';
  118. $menu .= str_replace('{link}', $item[0], str_replace('{title}', $item[1], str_replace('{target}', @$item[2], str_replace('{icon}', $item[3], $format))));
  119. // End of Icons support by Migel
  120. }
  121. $result = $menu;
  122. return $result;
  123. }
  124. function arr2ddm($array) {
  125. $ra = array();
  126. foreach ($array as $key => $val) {
  127. $ta = explode(":", $val['title'], 2);
  128. if (!isset($ta[1]))
  129. $ta[1] = '';
  130. if (isset($val['sub'])) {
  131. $ra['&nbsp;&nbsp;⇨ &nbsp;&nbsp; ' . __($ta[0]) . '&nbsp;&nbsp; '] = array_merge(array("-" => $ta[1]), arr2ddm($val['sub']));
  132. } else {
  133. $ra['&nbsp;&nbsp; ' . __($ta[0]) . '&nbsp;&nbsp; '] = $ta[1];
  134. }
  135. }
  136. return $ra;
  137. }
  138. function rcms_parse_dynamik_menu($format) {
  139. global $system;
  140. function convertArray($ar) {
  141. $var = '{ ';
  142. foreach ($ar as $key => $val) {
  143. $var .= '"' . $key . '" : ';
  144. if (is_array($val)) {
  145. $var .= convertArray($val) . ', ';
  146. } else {
  147. $var .= '"' . $val . '", ';
  148. }
  149. }
  150. if ($var[strlen($var) - 2] == ',')
  151. $var[strlen($var) - 2] = ' ';
  152. return $var . '} ';
  153. }
  154. $pic_right = '&nbsp;&nbsp;<b>�</b> ';
  155. //Commented becouse fucking IE, Microsoft, Gates and his mother...
  156. //$pic_right = '&nbsp;<img src = \''.SKIN_PATH.'arrow_right.gif\'>';
  157. //$pic_down = '<img src = \''.SKIN_PATH.'arrow_down.gif\'>';
  158. $pic_down = '';
  159. $navigation = parse_ini_file(CONFIG_PATH . 'navigation.ini', true);
  160. $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true);
  161. $result = array();
  162. foreach ($navigation as $link) {
  163. if (substr($link['url'], 0, 9) == 'external:') {
  164. $target = '_blank';
  165. $link['url'] = substr($link['url'], 9);
  166. } else {
  167. $target = '';
  168. }
  169. $tdata = explode(':', $link['url'], 2);
  170. if (count($tdata) == 2) {
  171. list($modifier, $value) = $tdata;
  172. } else {
  173. $modifier = $tdata[0];
  174. }
  175. if (!empty($value) && !empty($system->navmodifiers[$modifier])) {
  176. if ($clink = call_user_func($system->navmodifiers[$modifier]['m'], $value)) {
  177. $result[] = array($clink[0], (empty($link['name'])) ? $clink[1] : __($link['name']), $target);
  178. }
  179. } else {
  180. $result[] = array($link['url'], __($link['name']));
  181. }
  182. }
  183. $menu = ' <script type="text/javascript" src="modules/jsc/navigation.js"></script> <div class="dhtml_menu"> <div class="horz_menu"> ';
  184. foreach ($result as $item) {
  185. if (empty($item[2])) {
  186. $item[2] = '_top';
  187. }
  188. if (empty($item[4])) {
  189. $item[4] = '';
  190. }
  191. // Begin of Icons support by Migel
  192. //$arr = array();
  193. if ($item[0] == '?module=articles') {
  194. if (!isset($dyna['use_art'])) {
  195. $articles = new articles();
  196. $containers = $articles->getContainers();
  197. $count = 0;
  198. if (is_array($containers)) {
  199. $item[1] .= '&nbsp;' . $pic_down;
  200. $containers = array_reverse($containers);
  201. foreach ($containers as $conkey => $conval) {
  202. $count++;
  203. if ($count != $dyna['max']) {
  204. $arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = '?module=articles&c=' . $conkey;
  205. if (!isset($dyna['min'])) {
  206. $articles->setWorkContainer($conkey);
  207. $art = $articles->getCategories();
  208. $count2 = 0;
  209. if (is_array($art)) {
  210. unset($arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']);
  211. $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = array('-' => '?module=articles&c=' . $conkey);
  212. $art = array_reverse($art);
  213. foreach ($art as $artkey => $artval) {
  214. $count2++;
  215. if ($count2 != $dyna['max']) {
  216. $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;'] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'];
  217. $art2 = $articles->getArticles($artval['id']);
  218. $count3 = 0;
  219. if (count($art2) > 0) {
  220. unset($arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']);
  221. $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '][$pic_right . '&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;'] = array('-' => '?module=articles&c=' . $conkey . '&b=' . $artval['id']);
  222. $art2 = array_reverse($art2);
  223. foreach ($art2 as $art2key => $art2val) {
  224. $count3++;
  225. if ($count3 != $dyna['max'])
  226. $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '][$pic_right . '&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($art2val['title']) . '&nbsp;&nbsp;'] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'] . '&a=' . $art2val['id'];
  227. }
  228. }
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. }
  236. $item[4] = 'ddm_article';
  237. }
  238. $item[3] = 'articles.png';
  239. } elseif ($item[0] == '?module=gallery') {
  240. if (!isset($dyna['use_gal'])) {
  241. $gallery = new gallery();
  242. $kw = $gallery->getAvaiableValues('keywords');
  243. $count = 0;
  244. if (is_array($kw)) {
  245. $kw = array_reverse($kw);
  246. $count++;
  247. ;
  248. if (!isset($dyna['min']))
  249. foreach ($kw as $key => $val) {
  250. if ($count != $dyna['max']) {
  251. $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&keyword=' . $val);
  252. $kw2 = $gallery->getLimitedImagesList('keywords', $val);
  253. $kw2 = array_reverse($kw2);
  254. $count2 = 0;
  255. foreach ($kw2 as $key2 => $val2) {
  256. $count2++;
  257. if ($count2 != $dyna['max']) {
  258. $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. $kw = $gallery->getAvaiableValues('size');
  265. $count = 0;
  266. if (is_array($kw)) {
  267. $kw = array_reverse($kw);
  268. $count++;
  269. $item[1] .= '&nbsp;' . $pic_down;
  270. if (!isset($dyna['min']))
  271. foreach ($kw as $key => $val) {
  272. if ($count != $dyna['max']) {
  273. $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By size') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&size=' . $val);
  274. $kw2 = $gallery->getLimitedImagesList('size', $val);
  275. $kw2 = array_reverse($kw2);
  276. $count2 = 0;
  277. foreach ($kw2 as $key2 => $val2) {
  278. $count2++;
  279. if ($count2 != $dyna['max']) {
  280. $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By size') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
  281. }
  282. }
  283. }
  284. }
  285. }
  286. $kw = $gallery->getAvaiableValues('type');
  287. $count = 0;
  288. if (is_array($kw)) {
  289. $kw = array_reverse($kw);
  290. $count++;
  291. if (!isset($dyna['min']))
  292. foreach ($kw as $key => $val) {
  293. if ($count != $dyna['max']) {
  294. $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&type=' . $val);
  295. $kw2 = $gallery->getLimitedImagesList('type', $val);
  296. $kw2 = array_reverse($kw2);
  297. $count2 = 0;
  298. foreach ($kw2 as $key2 => $val2) {
  299. $count2++;
  300. if ($count2 != $dyna['max']) {
  301. $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. $kw = $gallery->getFullImagesList();
  308. $count = 0;
  309. if (count($kw) > 0) {
  310. $kw = array_reverse($kw);
  311. $count++;
  312. foreach ($kw as $key => $val) {
  313. if ($count != $dyna['max']) {
  314. $arr['ddm_gallery']['&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val;
  315. }
  316. }
  317. }
  318. $item[4] = 'ddm_gallery';
  319. }
  320. $item[3] = 'gallery.png';
  321. } elseif ($item[0] == '?module=user.list') {
  322. if (!isset($dyna['use_mem'])) {
  323. $userlist = $system->getUserList('*', 'nickname');
  324. $count = 0;
  325. if (count($userlist) > 0) {
  326. $item[1] .= '&nbsp;' . $pic_down;
  327. $userlist = array_reverse($userlist);
  328. foreach ($userlist as $conkey => $conval) {
  329. $count++;
  330. if ($count != $dyna['max'])
  331. $arr['ddm_users']['&nbsp;&nbsp;' . cut_text($conval['nickname']) . '&nbsp;&nbsp;'] = '?module=user.list&user=' . $conval['username'];
  332. }
  333. }
  334. $item[4] = 'ddm_users';
  335. }
  336. $item[3] = 'userlist.png';
  337. } elseif ($item[0] == '?module=filesdb') {
  338. if (!isset($dyna['use_fdb'])) {
  339. $filesdb = new linksdb(DOWNLOADS_DATAFILE);
  340. $count = 0;
  341. if (!empty($filesdb->data)) {
  342. $item[1] .= '&nbsp;' . $pic_down;
  343. $fdb = array_reverse($filesdb->data);
  344. foreach ($fdb as $conkey => $conval) {
  345. $count++;
  346. if ($count != $dyna['max']) {
  347. $arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1));
  348. if (count($conval['files']) > 0)
  349. if (!isset($dyna['min'])) {
  350. unset($arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']);
  351. $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = array('-' => '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)));
  352. $count2 = 0;
  353. $conval['files'] = array_reverse($conval['files']);
  354. foreach ($conval['files'] as $artkey => $artval) {
  355. $count2++;
  356. if ($count2 != $dyna['max'])
  357. $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($artval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)) . '&fid=' . (sizeof($conval['files']) - ($count2 - 1));
  358. }
  359. }
  360. }
  361. }
  362. }
  363. $item[4] = 'ddm_filesdb';
  364. }
  365. $item[3] = 'files.png';
  366. } elseif ($item[0] == '?module=forum') {
  367. if (!isset($dyna['use_for'])) {
  368. $topics = @unserialize(@file_get_contents(FORUM_PATH . 'topic_index.dat'));
  369. $count = 0;
  370. if (count($topics) > 0) {
  371. $item[1] .= '&nbsp;' . $pic_down;
  372. if (is_array($topics)) {
  373. $topics = array_reverse($topics);
  374. foreach ($topics as $conkey => $conval) {
  375. $count++;
  376. if ($count != $dyna['max'])
  377. $arr['ddm_forum']['&nbsp;&nbsp;' . cut_text($conval['title']) . '&nbsp;&nbsp;'] = '?module=forum&id=' . (sizeof($topics) - ($count)) . '&action=topic';
  378. }
  379. }
  380. }
  381. $item[4] = 'ddm_forum';
  382. }
  383. $item[3] = 'forum.png';
  384. } elseif ($item[1] == 'CUSTOM1') {
  385. $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_1.txt')) . '&nbsp;' . $pic_down;
  386. $arr['ddm_custom1'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_1.dat')));
  387. $item[4] = 'ddm_custom1';
  388. $item[3] = 'custom1.png';
  389. } elseif ($item[1] == 'CUSTOM2') {
  390. $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_2.txt')) . '&nbsp;' . $pic_down;
  391. $arr['ddm_custom2'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_2.dat')));
  392. $item[4] = 'ddm_custom2';
  393. $item[3] = 'custom2.png';
  394. } elseif ($item[1] == 'CUSTOM3') {
  395. $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_3.txt')) . '&nbsp;' . $pic_down;
  396. $arr['ddm_custom3'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_3.dat')));
  397. $item[4] = 'ddm_custom3';
  398. $item[3] = 'custom3.png';
  399. } else {
  400. $item[3] = 'default.png';
  401. }
  402. if (isset($dyna['ico']))
  403. $item[3] = '<img src="skins/icons/' . $item[3] . '">';
  404. else
  405. $item[3] = '';
  406. $menu .= str_replace('{link}', $item[0], str_replace('{title}', $item[1], str_replace('{target}', @$item[2], str_replace('{icon}', $item[3], str_replace('{id}', $item[4], $format)))));
  407. // End of Icons support by Migel
  408. }
  409. $menu .= ' <br clear="both" /> </div>';
  410. $result = $menu . ' <script type="text/javascript"> dhtmlmenu_build(' . convertArray($arr, 'arr') . ');</script></div>';
  411. return $result;
  412. }
  413. function rcms_parse_module_template($module, $tpldata = array()) {
  414. global $system;
  415. ob_start();
  416. if (is_file(CUR_SKIN_PATH . $module . '.php')) {
  417. include(CUR_SKIN_PATH . $module . '.php');
  418. } elseif (is_file(MODULES_TPL_PATH . $module . '.php')) {
  419. include(MODULES_TPL_PATH . $module . '.php');
  420. }
  421. $return = ob_get_contents();
  422. ob_end_clean();
  423. return $return;
  424. }
  425. function rcms_open_browser_window($id, $link, $attributes = '', $return = false) {
  426. global $system;
  427. $code = '<script language="javascript">window.open(\'' . addslashes($link) . '\', \'' . $id . '\',\'' . $attributes . '\');</script>';
  428. if ($return) {
  429. return $code;
  430. } else {
  431. @$system->config['meta'] .= $code;
  432. }
  433. }
  434. function rcms_parse_module_template_path($module) {
  435. if (is_file(CUR_SKIN_PATH . $module . '.php')) {
  436. return (CUR_SKIN_PATH . $module . '.php');
  437. } elseif (is_file(MODULES_TPL_PATH . $module . '.php')) {
  438. return (MODULES_TPL_PATH . $module . '.php');
  439. } else {
  440. return false;
  441. }
  442. }
  443. function rcms_show_element($element, $parameters = '') {
  444. global $system;
  445. switch ($element) {
  446. case 'title':
  447. if (!@$system->config['hide_title']) {
  448. echo $system->config['title'];
  449. if (!empty($system->config['pagename']))
  450. echo ' - ';
  451. }
  452. echo (!empty($system->config['pagename'])) ? $system->config['pagename'] : '';
  453. break;
  454. case 'menu_point':
  455. list($point, $template) = explode('@', $parameters);
  456. if (is_file(CUR_SKIN_PATH . 'skin.' . $template . '.php')) {
  457. $tpl_path = CUR_SKIN_PATH . 'skin.' . $template . '.php';
  458. } elseif (is_file(MODULES_TPL_PATH . $template . '.php')) {
  459. $tpl_path = MODULES_TPL_PATH . $template . '.php';
  460. }
  461. if (!empty($tpl_path) && !empty($system->output['menus'][$point])) {
  462. foreach ($system->output['menus'][$point] as $module) {
  463. $system->showWindow($module[0], $module[1], $module[2], $tpl_path);
  464. }
  465. }
  466. break;
  467. case 'main_point':
  468. foreach ($system->output['modules'] as $module) {
  469. $system->showWindow($module[0], $module[1], $module[2], CUR_SKIN_PATH . 'skin.' . substr(strstr($parameters, '@'), 1) . '.php');
  470. }
  471. break;
  472. case 'navigation':
  473. $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true);
  474. if (isset($dyna['use'])) {
  475. echo rcms_parse_dynamik_menu($parameters);
  476. break;
  477. }
  478. echo rcms_parse_menu($parameters);
  479. break;
  480. case 'meta':
  481. readfile(DATA_PATH . 'meta_tags.html');
  482. echo '<meta http-equiv="Content-Type" content="text/html; charset=' . $system->config['encoding'] . '" />' . "\r\n";
  483. if (!empty($system->config['enable_rss'])) {
  484. foreach ($system->feeds as $module => $d) {
  485. echo '<link rel="alternate" type="application/xml" title="RSS ' . $d[0] . '" href="./rss.php?m=' . $module . '" />' . "\r\n";
  486. }
  487. }
  488. if (!empty($system->config['meta']))
  489. echo $system->config['meta'];
  490. break;
  491. case 'copyright':
  492. if (!defined('RCMS_COPYRIGHT_SHOWED') || !RCMS_COPYRIGHT_SHOWED) {
  493. echo RCMS_POWERED . ' ' . RCMS_VERSION_A . '.' . RCMS_VERSION_B . '.' . RCMS_VERSION_C . RCMS_VERSION_SUFFIX . ' ' . RCMS_COPYRIGHT . '<br /> ';
  494. }
  495. break;
  496. }
  497. }
  498. ?>