function _nav_modifier_article_m($input) { global $articles; if (!is_a($articles, 'articles')) { $arts = new articles(); } else { $arts =& $articles; } $data = explode('/', $input, 3); $mode = sizeof($data); $containers = $arts->getContainers(0); switch ($mode) { case 1: if (!empty($containers[$data[0]])) { return array('?module=articles&c=' . urlencode($data[0]), $containers[$data[0]]); } break; case 2: if ($arts->setWorkContainer($data[0])) { $categories = $arts->getCategories(true, false, false); if ($data[0] == '#hidden' || $data[0] == '#root' && ($article = $arts->getArticle(0, (int) $data[1], false, false, false, false))) { return array('?module=articles&c=' . urlencode($data[0]) . '&a=' . (int) $data[1], $article['title']); } elseif ($categories && !empty($categories[(int) $data[1]])) { return array('?module=articles&c=' . urlencode($data[0]) . '&b=' . (int) $data[1], $categories[$data[1]]); } } break; case 3: if ($arts->setWorkContainer($data[0])) { if ($article = $arts->getArticle((int) $data[1], (int) $data[2], false, false, false, false)) { return array('?module=articles&c=' . urlencode($data[0]) . '&b=' . (int) $data[1] . '&a=' . (int) $data[2], $article['title']); } } break; } return false; }
function rcms_parse_dynamik_menu($format) { global $system; function convertArray($ar) { $var = '{ '; foreach ($ar as $key => $val) { $var .= '"' . $key . '" : '; if (is_array($val)) { $var .= convertArray($val) . ', '; } else { $var .= '"' . $val . '", '; } } if ($var[strlen($var) - 2] == ',') { $var[strlen($var) - 2] = ' '; } return $var . '} '; } $pic_right = ' <b>�</b> '; //Commented becouse f*****g IE, Microsoft, Gates and his mother... //$pic_right = ' <img src = \''.SKIN_PATH.'arrow_right.gif\'>'; //$pic_down = '<img src = \''.SKIN_PATH.'arrow_down.gif\'>'; $pic_down = ''; $navigation = parse_ini_file(CONFIG_PATH . 'navigation.ini', true); $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true); $result = array(); foreach ($navigation as $link) { if (substr($link['url'], 0, 9) == 'external:') { $target = '_blank'; $link['url'] = substr($link['url'], 9); } else { $target = ''; } $tdata = explode(':', $link['url'], 2); if (count($tdata) == 2) { list($modifier, $value) = $tdata; } else { $modifier = $tdata[0]; } if (!empty($value) && !empty($system->navmodifiers[$modifier])) { if ($clink = call_user_func($system->navmodifiers[$modifier]['m'], $value)) { $result[] = array($clink[0], empty($link['name']) ? $clink[1] : __($link['name']), $target); } } else { $result[] = array($link['url'], __($link['name'])); } } $menu = ' <script type="text/javascript" src="modules/jsc/navigation.js"></script> <div class="dhtml_menu"> <div class="horz_menu"> '; foreach ($result as $item) { if (empty($item[2])) { $item[2] = '_top'; } if (empty($item[4])) { $item[4] = ''; } // Begin of Icons support by Migel //$arr = array(); if ($item[0] == '?module=articles') { if (!isset($dyna['use_art'])) { $articles = new articles(); $containers = $articles->getContainers(); $count = 0; if (is_array($containers)) { $item[1] .= ' ' . $pic_down; $containers = array_reverse($containers); foreach ($containers as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_article'][' ' . cut_text($conval) . ' '] = '?module=articles&c=' . $conkey; if (!isset($dyna['min'])) { $articles->setWorkContainer($conkey); $art = $articles->getCategories(); $count2 = 0; if (is_array($art)) { unset($arr['ddm_article'][' ' . cut_text($conval) . ' ']); $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '] = array('-' => '?module=articles&c=' . $conkey); $art = array_reverse($art); foreach ($art as $artkey => $artval) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][' ' . cut_text($artval['title']) . ' '] = '?module=articles&c=' . $conkey . '&b=' . $artval['id']; $art2 = $articles->getArticles($artval['id']); $count3 = 0; if (count($art2) > 0) { unset($arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][' ' . cut_text($artval['title']) . ' ']); $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][$pic_right . ' ' . cut_text($artval['title']) . ' '] = array('-' => '?module=articles&c=' . $conkey . '&b=' . $artval['id']); $art2 = array_reverse($art2); foreach ($art2 as $art2key => $art2val) { $count3++; if ($count3 != $dyna['max']) { $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][$pic_right . ' ' . cut_text($artval['title']) . ' '][' ' . cut_text($art2val['title']) . ' '] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'] . '&a=' . $art2val['id']; } } } } } } } } } } $item[4] = 'ddm_article'; } $item[3] = 'articles.png'; } elseif ($item[0] == '?module=gallery') { if (!isset($dyna['use_gal'])) { $gallery = new gallery(); $kw = $gallery->getAvaiableValues('keywords'); $count = 0; if (is_array($kw)) { $kw = array_reverse($kw); $count++; if (!isset($dyna['min'])) { foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By keywords') . ' '][$pic_right . ' ' . cut_text($val) . ' '] = array('-' => '?module=gallery&keyword=' . $val); $kw2 = $gallery->getLimitedImagesList('keywords', $val); $kw2 = array_reverse($kw2); $count2 = 0; foreach ($kw2 as $key2 => $val2) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By keywords') . ' '][$pic_right . ' ' . cut_text($val) . ' '][' ' . cut_text($val2) . ' '] = '?module=gallery&id=' . $val2; } } } } } } $kw = $gallery->getAvaiableValues('size'); $count = 0; if (is_array($kw)) { $kw = array_reverse($kw); $count++; $item[1] .= ' ' . $pic_down; if (!isset($dyna['min'])) { foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By size') . ' '][$pic_right . ' ' . cut_text($val) . ' '] = array('-' => '?module=gallery&size=' . $val); $kw2 = $gallery->getLimitedImagesList('size', $val); $kw2 = array_reverse($kw2); $count2 = 0; foreach ($kw2 as $key2 => $val2) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By size') . ' '][$pic_right . ' ' . cut_text($val) . ' '][' ' . cut_text($val2) . ' '] = '?module=gallery&id=' . $val2; } } } } } } $kw = $gallery->getAvaiableValues('type'); $count = 0; if (is_array($kw)) { $kw = array_reverse($kw); $count++; if (!isset($dyna['min'])) { foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By type') . ' '][$pic_right . ' ' . cut_text($val) . ' '] = array('-' => '?module=gallery&type=' . $val); $kw2 = $gallery->getLimitedImagesList('type', $val); $kw2 = array_reverse($kw2); $count2 = 0; foreach ($kw2 as $key2 => $val2) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By type') . ' '][$pic_right . ' ' . cut_text($val) . ' '][' ' . cut_text($val2) . ' '] = '?module=gallery&id=' . $val2; } } } } } } $kw = $gallery->getFullImagesList(); $count = 0; if (count($kw) > 0) { $kw = array_reverse($kw); $count++; foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][' ' . cut_text($val) . ' '] = '?module=gallery&id=' . $val; } } } $item[4] = 'ddm_gallery'; } $item[3] = 'gallery.png'; } elseif ($item[0] == '?module=user.list') { if (!isset($dyna['use_mem'])) { $userlist = $system->getUserList('*', 'nickname'); $count = 0; if (count($userlist) > 0) { $item[1] .= ' ' . $pic_down; $userlist = array_reverse($userlist); foreach ($userlist as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_users'][' ' . cut_text($conval['nickname']) . ' '] = '?module=user.list&user='******'username']; } } } $item[4] = 'ddm_users'; } $item[3] = 'userlist.png'; } elseif ($item[0] == '?module=filesdb') { if (!isset($dyna['use_fdb'])) { $filesdb = new linksdb(DOWNLOADS_DATAFILE); $count = 0; if (!empty($filesdb->data)) { $item[1] .= ' ' . $pic_down; $fdb = array_reverse($filesdb->data); foreach ($fdb as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_filesdb'][' ' . cut_text($conval['name']) . ' '] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)); if (count($conval['files']) > 0) { if (!isset($dyna['min'])) { unset($arr['ddm_filesdb'][' ' . cut_text($conval['name']) . ' ']); $arr['ddm_filesdb'][$pic_right . ' ' . cut_text($conval['name']) . ' '] = array('-' => '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1))); $count2 = 0; $conval['files'] = array_reverse($conval['files']); foreach ($conval['files'] as $artkey => $artval) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_filesdb'][$pic_right . ' ' . cut_text($conval['name']) . ' '][' ' . cut_text($artval['name']) . ' '] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)) . '&fid=' . (sizeof($conval['files']) - ($count2 - 1)); } } } } } } } $item[4] = 'ddm_filesdb'; } $item[3] = 'files.png'; } elseif ($item[0] == '?module=forum') { if (!isset($dyna['use_for'])) { $topics = @unserialize(@file_get_contents(FORUM_PATH . 'topic_index.dat')); $count = 0; if (count($topics) > 0) { $item[1] .= ' ' . $pic_down; if (is_array($topics)) { $topics = array_reverse($topics); foreach ($topics as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_forum'][' ' . cut_text($conval['title']) . ' '] = '?module=forum&id=' . (sizeof($topics) - $count) . '&action=topic'; } } } } $item[4] = 'ddm_forum'; } $item[3] = 'forum.png'; } elseif ($item[1] == 'CUSTOM1') { $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_1.txt')) . ' ' . $pic_down; $arr['ddm_custom1'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_1.dat'))); $item[4] = 'ddm_custom1'; $item[3] = 'custom1.png'; } elseif ($item[1] == 'CUSTOM2') { $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_2.txt')) . ' ' . $pic_down; $arr['ddm_custom2'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_2.dat'))); $item[4] = 'ddm_custom2'; $item[3] = 'custom2.png'; } elseif ($item[1] == 'CUSTOM3') { $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_3.txt')) . ' ' . $pic_down; $arr['ddm_custom3'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_3.dat'))); $item[4] = 'ddm_custom3'; $item[3] = 'custom3.png'; } else { $item[3] = 'default.png'; } if (isset($dyna['ico'])) { $item[3] = '<img src="skins/icons/' . $item[3] . '">'; } else { $item[3] = ''; } $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))))); // End of Icons support by Migel } $menu .= ' <br clear="both" /> </div>'; $result = $menu . ' <script type="text/javascript"> dhtmlmenu_build(' . convertArray($arr, 'arr') . ');</script></div>'; return $result; }
if (!$articles->moveArticle($b, $a, $nb)) { rcms_showAdminMessage($articles->last_error); } else { rcms_showAdminMessage(__('Article moved')); } } else { rcms_redirect(RCMS_ROOT_PATH . '?module=articles&c=' . $c . '&b=' . $b . '&a=' . $a); } } } /****************************************************************************** * Interface * ******************************************************************************/ // Show container selector $frm = new InputForm('', 'post', __('Submit')); $frm->addrow(__('Select section'), $frm->select_tag('c', $articles->getContainers(2), $c), 'top'); // Show category selector if (!empty($c) && $c != '#hidden' && $c != '#root') { if ($articles->setWorkContainer($c)) { $frm->addrow(__('Select category'), $frm->select_tag('b', $articles->getCategories(true, false), $b), 'top'); } else { rcms_showAdminMessage($articles->last_error); } } $frm->show(); if (!empty($_POST['tc']) && !empty($_POST['tb']) && !empty($_POST['ms']) && $_POST['ms'] == '2') { if (!$articles->moveArticleToContainer($_POST['mc'], $_POST['mb'], $_POST['ma'], $_POST['tc'], $_POST['tb'])) { rcms_showAdminMessage($articles->last_error); } else { rcms_showAdminMessage(__('Article moved')); }
} return $out; } //Main logic $find = ''; if (isset($_GET['search'])) { $find = trim(rcms_parse_text($_GET['search'])); } else { $find = ''; } if (strlen($find) >= $config['min'] and strlen($find) <= $config['max']) { $content = '<table width=100%>'; //articles if (class_exists('articles') && isset($_GET['articles'])) { $articles = new articles(); $containers = $articles->getContainers(); foreach ($containers as $conkey => $conval) { $result = search_in_article($conkey, $find); $content .= '<tr class = "row2"><td><b>' . $conval . ' (' . count($result) . '):</b></td></tr>'; if (count($result) == 0) { $content .= '<tr class = "row3"><td> <i>' . __('Nothing founded') . '</i></td></tr>'; } else { foreach ($result as $link => $text) { $content .= '<tr class = "row3"><td> <a href="' . $link . '">' . format_finded($text, $find) . '</a></td></tr>'; } } $content .= '<tr class = "row3"><td> </td></tr>'; } } //files if (isset($_GET['files']) && defined('DOWNLOADS_DATAFILE')) {
<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) ReloadCMS Development Team // // http://reloadcms.com // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// $articles = new articles(); $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%">'; $i = 2; $arr_res = array(); foreach (array_keys($articles->getContainers()) as $c) { if (substr($c, 0, 1) != '#') { $articles->setWorkContainer($c); if ($list = $articles->getLimitedStat('time', $system->config['num_of_latest'], true)) { foreach ($list as $id => $time) { $id = explode('.', $id); if (($article = $articles->getArticle($id[0], $id[1], false, false, false, false)) !== false) { $arr_res[$article['time']] = '<tr><td class="row' . $i . '"><a href="index.php?module=articles&c=' . $c . '&b=' . $id[0] . '&a=' . $id[1] . '"><abbr title="' . $article['author_nick'] . ', ' . rcms_format_time('d.m.Y H:i:s', $article['time']) . '">' . $article['title'] . ' </abbr><small><sup title="' . __('Comments') . ': ' . $article['comcnt'] . '">' . $article['comcnt'] . '</sup></small></a></td></tr>'; $i++; if ($i > 3) { $i = 2; } } } } } } krsort($arr_res); $arr_res = array_values($arr_res); for ($k = 0; $k < $system->config['num_of_latest']; $k++) {
global $lang; $articles = new articles(); $current_year = rcms_format_time('Y', rcms_get_time()); $current_month = rcms_format_time('n', rcms_get_time()); if (!empty($_POST['cal-year']) && $_POST['cal-year'] >= $current_year - 6 && $_POST['cal-year'] <= $current_year) { $selected_year = $_POST['cal-year']; } else { $selected_year = $current_year; } if (!empty($_POST['cal-month']) && $_POST['cal-month'] >= 1 && $_POST['cal-month'] <= 12) { $selected_month = $_POST['cal-month']; } else { $selected_month = $current_month; } $calendar = new calendar($selected_month, $selected_year); foreach ($articles->getContainers(0) as $container => $null) { $articles->setWorkContainer($container); if ($list = $articles->getStat('time')) { foreach ($list as $id => $time) { $id = explode('.', $id); if (rcms_format_time('n', $time) == $selected_month && rcms_format_time('Y', $time) == $selected_year) { $calendar->assignEvent(rcms_format_time('d', $time), '?module=articles&from=' . mktime(0, 0, 0, $selected_month, rcms_format_time('d', $time), $selected_year) . '&until=' . mktime(23, 59, 59, $selected_month, rcms_format_time('d', $time), $selected_year)); } } } } $calendar->highlightDay(rcms_format_time('d', time())); $date_pick = '<form action="" method="post" style="text-align: center"> <select name="cal-month">'; foreach (array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') as $num => $month) { $date_pick .= '<option value="' . ($num + 1) . '"' . ($num == $selected_month - 1 ? ' selected="selected"' : '') . '>' . $lang['datetime'][$month] . '</option>';
theme_advanced_statusbar_location : \'bottom\', theme_advanced_resizing : true, paste_auto_cleanup_on_paste : true, content_css: \'/css/tinymce.css\', extended_valid_elements : \'script[type|language|src]\', forced_root_block : \'\', force_br_newlines : true, force_p_newlines : false }); $(\'table.bb_editor\').hide(); $(\'a.clr_txt\').hide(); } else { tinyMCE.get(\'description\').hide(); tinyMCE.get(\'text\').hide(); $(\'table.bb_editor\').show(); $(\'a.clr_txt\').show(); }"'), 'top'); $frm->addrow(__('Allow comments'), $frm->radio_button('comments', array('yes' => __('Allow'), 'no' => __('Disallow')), 'yes'), 'top'); $result = $frm->show(true); } } else { show_error($articles->last_error); } } else { $frm = new InputForm('', 'post', __('Submit')); $frm->addrow(__('Select section'), $frm->select_tag('c', $articles->getContainers(2)), 'top'); $result = $frm->show(true); } show_window(__('Post article'), $result, 'center'); $system->config['pagename'] = __('Post article'); }
$articles = new articles(); $c = empty($_GET['c']) || $_GET['c'] == '#hidden' ? null : $_GET['c']; $b = empty($_GET['b']) ? null : (int) $_GET['b']; $a = empty($_GET['a']) ? null : (int) $_GET['a']; if (!empty($a) && (!empty($b) && !empty($c) || $c == '#root')) { if (!$articles->setWorkContainer($c)) { show_error($articles->last_error); } elseif (!($article = $articles->getArticle($b, $a, true, true, true, true))) { show_error($articles->last_error); } elseif ($c !== '#root' && !($category = $articles->getCategory($b, false))) { show_error($articles->last_error); } else { if (!empty($category)) { $article['cat_data'] = $category; } $containers = $articles->getContainers(); $com_text = ''; /* If user posting a comment */ if (!empty($_POST['comtext']) && $article['comments'] == 'yes') { if (isset($system->config['article-guest']) and !LOGGED_IN) { show_error(__('You are not logined!')); } else { if (isset($_POST['antispam']) and isset($_POST['captcheckout'])) { $defcatp = substr(md5($_POST['antispam']), 0, 5); $intcapt = $_POST['captcheckout']; if ($defcatp == $intcapt) { if (!$articles->addComment($b, $a, $_POST['comtext'])) { show_error($articles->last_error); $com_text = $_POST['comtext']; } if (!empty($articles->config['email']) && rcms_is_valid_email($articles->config['email'])) {