function guestbook_get_last_msgs($file, $config = 'minichat.ini', $parse = true) { if ($config) { $config = parse_ini_file(CONFIG_PATH . $config); } if ($data = @file_get_contents($file)) { $data = unserialize($data); $c = count($data); if ($parse) { foreach ($data as $i => $msg) { if (!empty($msg)) { $data[$i]['text'] = rcms_parse_text($msg['text'], false, false, true, $config['max_word_len']); } } } $ndata = $rdata = array(); foreach ($data as $key => $value) { $ndata[$key . ''] = $value; } $ndata = array_reverse($ndata, true); $i = 0; while ($i < $config['messages_to_show'] && ($el = each($ndata))) { $rdata[$el['key']] = $el['value']; $i++; } return $rdata; } else { return array(); } }
function gallery_get_comments($id) { $images = rcms_scandir(GALLERY_PATH); if ($data = @file_get_contents(GALLERY_PATH . $images[$id] . '.cm')) { $data = unserialize($data); foreach ($data as $i => $msg) { if (!empty($data[$i])) { $data[$i]['text'] = rcms_parse_text($data[$i]['text'], true, false, true, 50); } } return $data; } else { return array(); } }
function get_messages($page = 0, $parse = true, $limited = true, $file = RCMS_GB_DEFAULT_FILE, $config = 'comments.ini') { global $_CACHE, $system, $comment_config; $comment_config = parse_ini_file(CONFIG_PATH . $config); $bbcodes = empty($comment_config['bbcodes']) ? false : true; $img = empty($comment_config['links']) ? false : true; $data =& $_CACHE['gbook'][$file]; if (!isset($data)) { if (!is_readable($file) || !($data = unserialize(file_get_contents($file)))) { $data = array(); } } if (!empty($data)) { $c = sizeof($data); $ndata = $rdata = array(); foreach ($data as $key => $value) { $ndata[$key . ''] = $value; } $ndata = array_reverse($ndata, true); if ($page !== null) { $i = 0; while ($i < ($page + 1) * $system->config['perpage'] && ($el = each($ndata))) { if ($i >= $page * $system->config['perpage']) { $rdata[$el['key']] = $el['value']; } $i++; } } else { $rdata = $ndata; } if ($parse) { foreach ($rdata as $id => $msg) { if (!$bbcodes && !$img) { $rdata[$id]['text'] = htmlspecialchars($msg['text']); } else { if (!empty($msg)) { $rdata[$id]['text'] = rcms_parse_text($msg['text'], !$limited, false, !$limited, $bbcodes, $img); } } } } return $rdata; } else { return array(); } }
function guestbook_get_last_msgs($num = 10, $parse = true, $limited, $file = RCMS_GB_DEFAULT_FILE, $config = 'guestbook.ini') { global $_CACHE, $system; $config = parse_ini_file(CONFIG_PATH . $config); $data =& $_CACHE['gbook'][$file]; if (!isset($data)) { if (!is_readable($file) || !($data = unserialize(file_get_contents($file)))) { $data = array(); } } if (!empty($data)) { $ndata = $rdata = array(); foreach ($data as $key => $value) { $ndata[$key . ''] = $value; } $ndata = array_reverse($ndata, true); if ($num !== null) { $i = 0; while ($i < $num && ($el = each($ndata))) { $rdata[$el['key']] = $el['value']; $i++; } } else { $rdata = $ndata; } if ($parse) { foreach ($rdata as $id => $msg) { if (!empty($msg)) { $rdata[$id]['text'] = rcms_parse_text($msg['text'], !$limited, false, !$limited); } } } return $rdata; } else { return array(); } }
echo @$user['nickname']; ?> </td> </tr> <tr> <th><?php echo $lang['users']['email']; ?> </td> <td class="row3"><?php echo !@$user['hideemail'] ? @$user['email'] : $lang['users']['emailhidden']; ?> </td> </tr> <?php foreach ($tpldata['fields'] as $field_id => $field_name) { ?> <tr> <th><?php echo $field_name; ?> </td> <td class="row3"><?php echo rcms_parse_text(@$user[$field_id], false, false, false, false); ?> </td> </tr> <?php } ?> </table>
function pm_get_all_msgs($num = 10, $parse = true, $limited, $file = RCMS_PM_DEFAULT_FILE) { global $_CACHE, $system; $data =& $_CACHE['gbook'][$file]; if (!isset($data)) { if (!is_readable($file) || !($data = unserialize(file_get_contents($file)))) { $data = array(); } } if (!empty($data)) { $ndata = $rdata = array(); foreach ($data as $key => $value) { $ndata[$key . ''] = $value; } $ndata = array_reverse($ndata, true); if ($num !== null) { $i = 0; while ($i < $num && ($el = each($ndata))) { $rdata[$el['key']] = $el['value']; $i++; } } else { $rdata = $ndata; } if ($parse) { foreach ($rdata as $id => $msg) { if (!empty($msg)) { $rdata[$id]['text'] = rcms_parse_text($msg['text'], !$limited, false, !$limited); $rdata[$id]['new'] = $msg['new']; $rdata[$id]['username'] = $msg['username']; $rdata[$id]['nickname'] = $msg['nickname']; $rdata[$id]['time'] = rcms_format_time('H:i:s d.m.Y', $msg['time']); } } } return $rdata; } else { return array(); } }
function getComments($cat_id, $art_id) { $cat_id = (int) $cat_id; $art_id = (int) $art_id; if (empty($this->container)) { $this->last_error = __('No section selected!'); return false; } if ($this->container !== '#root' && $this->container !== '#hidden') { if (!($category = $this->getCategory($cat_id))) { return false; } $art_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/' . $art_id . '/'; } else { $art_prefix = ARTICLES_PATH . $this->container . '/' . $art_id . '/'; } if ($data = @file_get_contents($art_prefix . 'comments')) { $data = unserialize($data); foreach ($data as $i => $msg) { if (!empty($data[$i])) { $data[$i]['text'] = rcms_parse_text($data[$i]['text'], true, false, true, 50); } } return $data; } else { return array(); } }
function rcms_parse_text_by_mode($str, $mode) { switch ($mode) { default: case 'check': return rcms_parse_text($str, false, false, false, false, false, false); break; case 'text': return rcms_parse_text($str, true, false, true, false, true, true); break; case 'text-safe': return rcms_parse_text($str, true, false, true, false, false, false); break; case 'html': return rcms_parse_text($str, false, true, false, false, true, true); break; case 'htmlbb': return rcms_parse_text($str, true, true, false, false, true, true); break; } }
to_result($aval['author_nick'], $find, '?module=forum&action=topic&id=' . $akey, $out); $posts = @unserialize(@file_get_contents(FORUM_PATH . 'topic.' . $akey . '.dat')); if (!is_array($posts)) { $posts = array(); } foreach ($posts as $bkey => $bval) { to_result($bval['text'], $find, '?module=forum&action=topic&id=' . $akey . '#' . $bkey, $out); to_result($bval['author_nick'], $find, '?module=forum&action=topic&id=' . $akey . '#' . $bkey, $out); } } 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 {
echo rcms_format_time('d F Y H:i:s', $tpldata['time']); ?> </td> <td align="center" class="row2" style="width: 100%;"> <?php echo __('Posted by'); ?> <?php echo user_create_link($tpldata['author_name'], str_replace(' ', ' ', $tpldata['author_nick'])); ?> , <?php echo __('Author/source'); ?> : <?php echo rcms_parse_text($tpldata['src'], false, false, false, false, false); ?> </td> <?php if (!empty($tpldata['linktext']) && !empty($tpldata['linkurl'])) { ?> <td class="row3" align="left" style="white-space: nowrap;"> <a href="<?php echo $tpldata['linkurl']; ?> "><?php echo $tpldata['linktext']; ?> </a> </td> <?php
function rcms_parse_text_by_mode($str, $mode) { switch ($mode) { default: case 'check': return rcms_parse_text($str, false, false, false, false, false, false); break; case 'text': return rcms_parse_text($str, true, false, true, false, true, true); break; case 'text-safe': return rcms_parse_text($str, true, false, true, false, false, false); break; case 'html': return rcms_parse_text($str, false, true, false, false, true, true); break; case 'php': ob_start(); eval($str); $text = ob_get_contents(); ob_end_clean(); return $text; break; case 'htmlbb': return rcms_parse_text($str, true, true, true, false, true, true); break; } }
if (@is_readable($system->logging . $_POST['archive'])) { $output = ''; $archive = new tar(); $archive->openTAR($system->logging . $_POST['archive']); foreach ($_POST['viewlog'] as $logfile) { $logfile = basename($logfile); if ($gz_contents = $archive->getFile($logfile)) { $gz_contents = $gz_contents['file']; if (substr($logfile, -3) == '.gz') { file_write_contents($system->logging . $logfile, $gz_contents); $contents = gzfile_get_contents($system->logging . $logfile); rcms_delete_files($system->logging . $logfile); } else { $contents =& $gz_contents; } $output .= rcms_parse_text('[quote=' . $logfile . ']' . $contents . '[/quote]', true, false, true); } } unset($archive); } rcms_showAdminMessage($output); } elseif (!empty($_POST['browse_archive']) && !empty($_POST['browse'])) { $frm = new InputForm('', 'post', '<<< ' . __('Back')); $frm->show(); $_POST['browse'] = basename($_POST['browse']); if (is_readable($system->logging . $_POST['browse'])) { $archive = new tar(); $archive->openTAR($system->logging . $_POST['browse']); $frm = new InputForm('', 'post', __('Show selected')); $frm->addbreak(__('Avaible logs in archive') . ' ' . $_POST['browse']); $frm->hidden('showlogs_from_archive', '1');
function get_rate($for) { $valid_post = false; $b_start = '<div class="rate"> '; $b_end = ' </div>'; if (trim(rcms_parse_text($for)) != '') { $valid_post = true; $for = md5(trim(rcms_parse_text($for))); } $post_for = 0; if (isset($_POST['for'])) { $post_for = $_POST['for']; } $valid_val = 0; if (isset($_POST['val'])) { if ($_POST['val'] == '5' or $_POST['val'] == '4' or $_POST['val'] == '3' or $_POST['val'] == '2' or $_POST['val'] == '1') { $valid_val = $_POST['val']; } } if (!$valid_post) { return $b_start . __('Rate') . ': ' . __('Only for registered users') . $b_end; } if (!LOGGED_IN) { return $b_start . show_rate($for) . $b_end; } if ($post_for == $for and $valid_val == 0 and $valid_post and !check_ip($for, $_SERVER['REMOTE_ADDR'])) { return $b_start . show_rate_rbox($for) . $b_end; } if ($post_for == $for and $valid_val == 0 and check_ip($for, $_SERVER['REMOTE_ADDR'])) { return $b_start . show_rate($for) . $b_end; } if ($post_for == $for and $valid_val !== 0 and $valid_post and !check_ip($for, $_SERVER['REMOTE_ADDR'])) { write_rate($for, $valid_val, $_SERVER['REMOTE_ADDR']); return $b_start . show_rate($for) . $b_end; } if ($post_for !== $for and $valid_post and !check_ip($for, $_SERVER['REMOTE_ADDR'])) { return $b_start . show_rate_rbox($for) . $b_end; } if ($post_for !== $for and $valid_post and check_ip($for, $_SERVER['REMOTE_ADDR'])) { return $b_start . show_rate($for) . $b_end; } return $b_start . __('Rate') . ': ' . __('Data not valid') . $b_end; }
function articles_get_category($catid, $parse = true, $dir = ARTICLES_PATH) { global $system; $cat_prefix = $dir . $catid . '/'; if (!is_file($cat_prefix . '/access')) { $minlevel = 0; } else { $minlevel = (int) file_get_contents($cat_prefix . '/access'); } if ($minlevel > @$system->user['accesslevel'] && !$system->checkForRight('-any-')) { return false; } // If category exists if (@is_dir($cat_prefix)) { $return['id'] = $catid; $return['title'] = file_get_contents($cat_prefix . 'title'); $return['description'] = file_get_contents($cat_prefix . 'description'); if (!is_file($cat_prefix . '/access')) { $return['accesslevel'] = 0; } else { $return['accesslevel'] = (int) file_get_contents($cat_prefix . '/access'); } if ($parse) { $return['description'] = rcms_parse_text($return['description'], true, false, true, false, true); } $return['articles_clv'] = count(rcms_scandir($dir . '/' . $catid, '', 'dir')); $return['last_article'] = articles_get($catid, file_get_contents($cat_prefix . 'last'), $parse, 0, $dir); // Search for icon if (is_file($cat_prefix . 'icon.gif')) { $return['icon'] = 'icon.gif'; $return['iconfull'] = $cat_prefix . 'icon.gif'; } elseif (is_file($cat_prefix . 'icon.png')) { $return['icon'] = 'icon.png'; $return['iconfull'] = $cat_prefix . 'icon.png'; } elseif (is_file($cat_prefix . 'icon.jpg')) { $return['icon'] = 'icon.jpg'; $return['iconfull'] = $cat_prefix . 'icon.jpg'; } elseif (is_file($cat_prefix . 'icon.jpeg')) { $return['icon'] = 'icon.jpeg'; $return['iconfull'] = $cat_prefix . 'icon.jpeg'; } else { $return['icon'] = false; } // Finish! return $return; } return false; }
function getCategory($cat_id = 0, $parse = true, $ret_last_article = false) { $cat_id = (int) $cat_id; if (empty($this->container)) { $this->last_error = __('No section selected!'); return false; } if ($this->container == '#root' || $this->container == '#hidden') { $this->last_error = __('This system section doesn\'t have categories'); return false; } global $system; $cat_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/'; if (empty($cat_id)) { $this->last_error = __('Invalid category ID'); return false; } $cat_data =& $this->categories[$this->container][$cat_id]; // Checking access level $cat_data['accesslevel'] = !is_file($cat_prefix . 'access') ? 0 : (int) file_get_contents($cat_prefix . 'access'); if ($cat_data['accesslevel'] > $system->user['accesslevel'] && !$system->checkForRight('-any-')) { $this->last_error = __('Access denied'); return false; } // If category exists if (is_dir($cat_prefix)) { $cat_data['id'] = $cat_id; $cat_data['title'] = file_get_contents($cat_prefix . 'title'); $cat_data['description'] = @file_get_contents($cat_prefix . 'description'); if ($parse) { $cat_data['description'] = rcms_parse_text($cat_data['description'], true, false, true, false, true); } $cat_data['articles_clv'] = sizeof(rcms_scandir($cat_prefix, '', 'dir')); if ($ret_last_article && $cat_data['articles_clv'] > 0) { $stat = $this->getStat('time', $cat_id, true); if (!empty($stat)) { $id = explode('.', $stat['key']); $cat_data['last_article'] = $this->getArticle($cat_id, $id[1], $parse, false, false, false); } } // Search for icon if (is_file($cat_prefix . 'icon.gif')) { $cat_data['icon'] = 'icon.gif'; $cat_data['iconfull'] = $cat_prefix . 'icon.gif'; } elseif (is_file($cat_prefix . 'icon.png')) { $cat_data['icon'] = 'icon.png'; $cat_data['iconfull'] = $cat_prefix . 'icon.png'; } elseif (is_file($cat_prefix . 'icon.jpg')) { $cat_data['icon'] = 'icon.jpg'; $cat_data['iconfull'] = $cat_prefix . 'icon.jpg'; } elseif (is_file($cat_prefix . 'icon.jpeg')) { $cat_data['icon'] = 'icon.jpeg'; $cat_data['iconfull'] = $cat_prefix . 'icon.jpeg'; } else { $cat_data['icon'] = false; } // Finish! return $cat_data; } else { $this->last_error = __('There are no category with this ID'); return false; } }
echo $post_id + 2; ?> "><?php echo __('Delete'); ?> </a> ] <?php } ?> </small> </td> </tr> <tr> <td class="row2" style="height: 60px;" valign="top" colspan="2"> <?php echo rcms_parse_text($post['text'], true, false, true, true, true); ?> </td> </tr> <?php $total--; } $c++; } ?> </table> <div align="left"> <?php echo rcms_pagination(sizeof($tpldata['posts']), $system->config['perpage'], $page + 1, '?module=forum.archive&action=topic&id=' . $tpldata['topic']['id']); ?> </div>
<?php $config = parse_ini_file(CONFIG_PATH . 'search.ini'); $init = ''; $chose = ''; if (isset($_GET['search'])) { $init = trim(rcms_parse_text($_GET['search'])); } if (isset($config['chose'])) { $articles = ' checked '; $files = ' checked '; $forum = ' checked '; if (isset($_GET['module'])) { if ($_GET['module'] == 'search.result') { if (!isset($_GET['articles'])) { $articles = ''; } if (!isset($_GET['forum'])) { $forum = ''; } if (!isset($_GET['files'])) { $files = ''; } } } $chose = '<tr valign = "middle"><td align="left" valign = "middle"><input type="checkbox" name="articles" ' . $articles . '>' . __('News') . ', ' . __('Articles') . '</td></tr>' . '<tr><td align="left"><input type="checkbox" name="forum" ' . $forum . ' />' . __('Forum') . '</td></tr>' . '<tr><td align="left"><input type="checkbox" name="files" ' . $files . ' />' . __('FilesDB') . '</td></tr>'; } show_window(__('Search'), '<center><table><tr><td align="left"><form method="get" action=""> <input type="hidden" name="module" value="search.result" /> <input type="text" name="search" size=' . $config['width'] . ' value="' . $init . '" /> <input type="submit" value="' . __('Find') . '" /></td></tr>' . $chose . '</form></table></center>');