function getArticle($cat_id, $art_id, $parse = true, $desc = false, $text = false, $cnt = false) { $cat_id = (int) $cat_id; $art_id = (int) $art_id; if (empty($this->container)) { $this->last_error = __('No section selected!'); return false; } global $system; if ($this->container !== '#root' && $this->container !== '#hidden') { if (!($category = $this->getCategory($cat_id))) { $this->last_error = __('There are no category with this ID'); return false; } if ($category['accesslevel'] > (int) @$system->user['accesslevel'] && !$system->checkForRight('-any-')) { $this->last_error = __('Access denied'); return false; } $art_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/' . $art_id . '/'; $art_data =& $this->articles[$this->container][$cat_id][$art_id]; } else { $art_prefix = ARTICLES_PATH . $this->container . '/' . $art_id . '/'; $art_data =& $this->articles[$this->container][$art_id]; } if (is_file($art_prefix . 'define')) { $art_data = rcms_parse_ini_file($art_prefix . 'define'); if ($cnt) { $art_data['views']++; if (!write_ini_file($art_data, $art_prefix . 'define')) { $this->last_error = __('Cannot write to file'); } else { $this->index[$cat_id][$art_id]['view'] = $art_data['views']; $this->saveIndex(); } } $art_data['text_nonempty'] = filesize($art_prefix . 'full') < 1 ? false : true; if ($desc) { $art_data['desc'] = file_get_contents($art_prefix . 'short'); if ($parse) { $art_data['desc'] = rcms_parse_text_by_mode($art_data['desc'], $art_data['mode']); } } if ($text) { $art_data['text'] = file_get_contents($art_prefix . 'full'); if ($parse) { $art_data['text'] = rcms_parse_text_by_mode($art_data['text'], $art_data['mode']); } } $art_data['id'] = $art_id; $art_data['catid'] = $cat_id; $art_data['comcnt'] = $art_data['comcount']; $art_data['title'] = str_replace('"', '"', $art_data['title']); return $art_data; } else { $this->last_error = __('There are no article with this ID'); return false; } }
<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) ReloadCMS Development Team // // http://reloadcms.com // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// if (isset($_GET['id'])) { if (is_file(DATA_PATH . 'pages/' . $_GET['id'])) { $page = unserialize(file_get_contents(DATA_PATH . 'pages/' . $_GET['id'])); $text = rcms_parse_text_by_mode($page['text'], $page['mode']); if (!empty($page['description'])) { $system->addInfoToHead('<meta name="Description" content="' . $page['description'] . '">' . "\n"); } if (!empty($page['keywords'])) { $system->addInfoToHead('<meta name="Keywords" content="' . $page['keywords'] . '">' . "\n"); } $title = !empty($page['title']) ? $system->checkForRight('GENERAL') ? $page['title'] . ' <a href="' . ADMIN_FILE . '?show=module&id=articles.pages&tab=2&page=' . $_GET['id'] . '" title="' . __('Edit') . '"> <img src="' . IMAGES_PATH . 'skins/edit_small.gif" title="' . __('Edit') . '"> </a> ' : $page['title'] : ''; if (!empty($page['text'])) { show_window($title, rcms_parse_module_template('pages.tpl', array('text' => $text, 'author_name' => $page['author_name'], 'author_nick' => $page['author_nick'], 'date' => $page['date']))); } } else { show_window(__('Error'), __('There are no article with this ID')); } }
<tr> <th align="center" colspan="2"><?php echo __($tpldata['name']); ?> </th> </tr> <?php if (!empty($tpldata['desc'])) { ?> <tr> <td align="left" valign="top" class="row3" nowrap="nowrap"><?php echo __('Description'); ?> : </td> <td align="left" valign="top" class="row3" width="100%"><?php echo rcms_parse_text_by_mode($tpldata['desc'], 'text'); ?> </td> </tr> <?php } ?> <tr> <td align="left" valign="top" class="row3" nowrap="nowrap"><?php echo __('Downloads count'); ?> </td> <td align="left" valign="top" class="row3" width="100%"><?php echo (int) @$tpldata['count']; ?> </td>
function pm_get_msg_by_id($num = 10, $parse = false, $limited, $mid = '0', $file = RCMS_PM_DEFAULT_FILE) { global $_CACHE, $system; $t = ''; $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) { $t = rcms_parse_text_by_mode($rdata[$mid]['text'], 'text'); } else { $t = $rdata[$mid]['text']; } } return $t; }