Ejemplo n.º 1
0
 public function index($arguments)
 {
     $news = new news(ConnectionFactory::get('mongo'));
     $articles = new articles(ConnectionFactory::get('mongo'));
     $notices = new notices(ConnectionFactory::get('redis'));
     $irc = new irc(ConnectionFactory::get('redis'));
     $quotes = new quotes(ConnectionFactory::get('mongo'));
     $forums = new forums(ConnectionFactory::get('redis'));
     // Set all site-wide notices.
     foreach ($notices->getAll() as $notice) {
         Error::set($notice, true);
     }
     // Fetch the easy data.
     $this->view['news'] = $news->getNewPosts();
     $this->view['shortNews'] = $news->getNewPosts(true);
     $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5);
     $this->view['ircOnline'] = $irc->getOnline();
     $this->view['randomQuote'] = $quotes->getRandom();
     $this->view['fPosts'] = $forums->getNew();
     // Get online users.
     $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/');
     $this->view['onlineUsers'] = array();
     while ($apc->valid()) {
         $current = $apc->current();
         array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5));
         $apc->next();
     }
     // Set title.
     Layout::set('title', 'Home');
 }
Ejemplo n.º 2
0
function search_in_article($article, $find)
{
    if (!class_exists('articles')) {
        return false;
    }
    $out = array();
    $articles = new articles();
    $articles->setWorkContainer($article);
    $categories = $articles->getCategories();
    if (!empty($categories)) {
        foreach ($categories as $catkey => $katval) {
            if (access_chk($katval['accesslevel'])) {
                to_result($katval['description'], $find, '?module=articles&c=' . $article . '&b=' . $katval['id'], $out);
                to_result($katval['title'], $find, '?module=articles&c=' . $article . '&b=' . $katval['id'], $out);
                $articls = $articles->getArticles($katval, true, true, true);
                if (!empty($articls)) {
                    foreach ($articls as $akey => $aval) {
                        $link = '?module=articles&c=' . $article . '&b=' . $aval['catid'] . '&a=' . $aval['id'];
                        to_result($aval['text'], $find, $link, $out);
                        to_result($aval['desc'], $find, $link, $out);
                        to_result($aval['keywords'], $find, $link, $out);
                        to_result($aval['sef_desc'], $find, $link, $out);
                        to_result($aval['title'], $find, $link, $out);
                        to_result($aval['author_nick'], $find, $link, $out);
                    }
                }
            }
        }
    }
    return $out;
}
Ejemplo n.º 3
0
 public function index($arguments)
 {
     Layout::set('title', 'Search');
     if (empty($_POST['query'])) {
         return Error::set('No search query found.');
     }
     $query = substr(trim(htmlentities($_POST['query'], ENT_QUOTES, 'ISO8859-1', false)), 0, 250);
     $results = Search::query($query);
     if ($results['hits']['total'] == 0) {
         return Error::set('No results found.');
     }
     $this->view['results'] = array();
     $news = new news(ConnectionFactory::get('mongo'));
     $articles = new articles(ConnectionFactory::get('mongo'));
     $lectures = new lectures(ConnectionFactory::get('mongo'));
     $i = 1;
     if (empty($results['hits']['hits'])) {
         return;
     }
     foreach ($results['hits']['hits'] as $result) {
         $entry = $result['_source'];
         switch ($entry['type']) {
             case 'news':
                 $post = $news->get($result['_id'], false, true);
                 if (empty($post)) {
                     continue;
                 }
                 $post['type'] = 'news';
                 array_push($this->view['results'], $post);
                 break;
             case 'article':
                 $article = $articles->get($result['_id'], false, true);
                 if (empty($article)) {
                     continue;
                 }
                 $article['type'] = 'article';
                 array_push($this->view['results'], $article);
                 break;
             case 'lecture':
                 $lecture = $lectures->get($result['_id'], false, true);
                 if (empty($lecture)) {
                     continue;
                 }
                 $lecture['type'] = 'lecture';
                 array_push($this->view['results'], $lecture);
                 break;
         }
         if ($i == 5) {
             break;
         }
         ++$i;
     }
 }
Ejemplo n.º 4
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 5
0
 /**
  * @see parent::initHtmlData
  */
 public function initHtmlData()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/articles.php';
     $ids = $this->parseLinks();
     if ($ids) {
         $this->html_data = articles::getArticleByIds(array_map('intval', $ids));
     }
 }
Ejemplo n.º 6
0
 function getListXML($tagName)
 {
     if ($xml = parent::getListXML($tagName)) {
         $ns = $xml->query('/*/row/article');
         foreach ($ns as $n) {
             if (($path = xml::getElementText($n)) && is_file($path)) {
                 $n->parentNode->appendChild($xml->createElement('file', array('path' => $path, 'size' => $this->file_size(filesize($path)), 'ext' => strtolower(pathinfo($path, PATHINFO_EXTENSION)))));
             }
             $n->parentNode->removeChild($n);
         }
     }
     return $xml;
 }
Ejemplo n.º 7
0
 public function view($arguments)
 {
     // Read
     if (empty($arguments[0])) {
         return Error::set('Username is required.');
     }
     if (!empty($arguments[1])) {
         $page = (int) array_pop($arguments);
         if ($page < 1) {
             $this->view['commentPage'] = 1;
         } else {
             $this->view['commentPage'] = $page;
         }
     } else {
         $this->view['commentPage'] = 1;
     }
     $this->view['commentPageLoc'] = 'user/view/' . $arguments[0] . '/';
     $username = $arguments[0];
     $users = new users(ConnectionFactory::get('mongo'));
     $userInfo = $users->get($username);
     if (empty($userInfo)) {
         return Error::set('User not found.');
     }
     $irc = new irc(ConnectionFactory::get('redis'));
     $articles = new articles(ConnectionFactory::get('mongo'));
     $lectures = new lectures(ConnectionFactory::get('mongo'));
     $github = new github(ConnectionFactory::get('redis'));
     $this->view['valid'] = true;
     $this->view['username'] = $username;
     $this->view['user'] = $userInfo;
     $this->view['onIrc'] = $irc->isOnline($username);
     $this->view['onSite'] = apc_exists(Cache::PREFIX . 'user_' . $username);
     $this->view['articles'] = $articles->getForUser($this->view['user']['_id']);
     $this->view['lectures'] = $lectures->getForUser($username);
     $this->view['github'] = $github->get($userInfo['_id']);
     Layout::set('title', $username . '\'s profile');
 }
Ejemplo n.º 8
0
 public function printCategoryList($cat, $menu = false, $parent_str = "", $current_section = null, $current_cat = null)
 {
     if ($menu) {
         if ($parent_str) {
             $cat->title = str_ireplace($parent_str, '', $cat->title);
         }
         $cat->title = ucfirst(trim($cat->title));
         $c = '';
         if ($current_section === $cat->id) {
             $c = 'active ';
         }
         if ($current_cat === $cat->id) {
             $c = 'current active ';
         }
         if (isset($cat->children) && count($cat->children)) {
             $c .= 'parent';
         }
         echo "                                        <li class='{$c}'><a href='/articles/{$cat->slug}'>";
         echo "{$cat->title}</a>";
         if (isset($cat->children) && count($cat->children)) {
             echo "\n                                        <ul>\n";
             foreach ($cat->children as $child) {
                 $this->printCategoryList($child, $menu, $cat->title, $current_section, $current_cat);
             }
             echo "                                        </ul>\n                                        ";
         }
         echo "</li>\n";
     } else {
         echo "<li data-value='{$cat->id}'>{$cat->title}\n";
         if (isset($cat->children) && count($cat->children)) {
             echo "<ul>\n";
             foreach ($cat->children as $child) {
                 articles::printCategoryList($child);
             }
             echo "</ul>\n";
         }
         echo "</li>\n";
     }
 }
Ejemplo n.º 9
0
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&amp;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&amp;c=' . urlencode($data[0]) . '&amp;a=' . (int) $data[1], $article['title']);
                } elseif ($categories && !empty($categories[(int) $data[1]])) {
                    return array('?module=articles&amp;c=' . urlencode($data[0]) . '&amp;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&amp;c=' . urlencode($data[0]) . '&amp;b=' . (int) $data[1] . '&amp;a=' . (int) $data[2], $article['title']);
                }
            }
            break;
    }
    return false;
}
Ejemplo n.º 10
0
                    echo ajax::sdgJSONencode(array('success' => MESSAGE_COMMENTS_COMPLAINT_SEND));
                } else {
                    echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
                }
            } else {
                echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
            }
        } else {
            echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
        }
    } else {
        echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
    }
} elseif (isset($_POST['deleteCommentA']) && !empty($_POST['articleId'])) {
    if (!empty($_POST['deleteCommentA'])) {
        $articles = new articles();
        $aComments = new articlesComments();
        if ($arrData = $articles->getPublishedArticle("id=" . secure::escQuoteData($_POST['articleId']))) {
            if (!empty($_SESSION['sd_user']['data']['id']) && $_SESSION['sd_user']['data']['id'] == $arrData['id_user']) {
                if ($aComments->deleteRecords("id=" . secure::escQuoteData($_POST['deleteCommentA']))) {
                    echo ajax::sdgJSONencode(array('success' => true));
                } else {
                    echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
                }
            } else {
                echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
            }
        } else {
            echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
        }
    } else {
Ejemplo n.º 11
0
 // объединяем данные пользователя
 // проверяем права
 if (!empty($_SESSION['sd_' . DB_PREFIX . 'codex']['rights']['add_articles'])) {
     /**
      * иницализация массива подключаемых шаблонов: по умолчанию все значения - false
      * для подключения шаблона, необходимо установить значение - true
      * шаблоны подключаются в порядке установленном в файле головного шаблона
      */
     $arrActions = array('add' => false, 'edit' => false, 'moderate' => false, 'correction' => false, 'archived' => false, 'active' => false);
     // определяем шаблон для отображения
     isset($_GET['action']) && isset($arrActions[$_GET['action']]) ? $arrActions[$_GET['action']] = true : null;
     // инициируем "Наименование страницы" отображаемое в заголовке формы
     $arrNamePage = array(array('name' => constant('MENU_MY_ARTICLES'), 'link' => false));
     $retFields = false;
     // создаем объект
     $articles = new articles();
     $artsections = new artsections();
     // создаем массив секций, с которым мы будем работать
     $arrArtSections = !($arrArtSections['full'] = $artsections->getSections()) ? false : $arrArtSections + $artsections->splitSections($arrArtSections['full']);
     $smarty->assignByRef('arrArtSections', $arrArtSections);
     /******** ДЕЙСТВИЯ ********/
     /** Добавление **/
     if ($arrActions['add']) {
         // инициируем "Наименование страницы" отображаемое в заголовке формы
         $arrNamePage[] = array('name' => constant('FORM_ARTICLES_ADD'), 'link' => false);
         /** Проверяем псевдоним пользователя **/
         if (!empty($arrUser['alias'])) {
             /** Добавляем статью **/
             if (isset($_POST['save'])) {
                 /** Проверяем на непустые поля **/
                 if (!empty($_POST['arrBindFields']) && !empty($_POST['date']) && !empty($_POST['time'])) {
Ejemplo n.º 12
0
 * Интервью.
 */
$grey_articles = 1;
$g_page_id = '0|34';
$stretch_page = true;
$showMainDiv = true;
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/interview.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/articles.php';
$mpath = dirname(__FILE__);
$rpath = realpath(dirname(__FILE__) . '/../');
session_start();
$uid = get_uid();
if ($uid) {
    // определяем, показывать ли вкладку НА МОДЕРАЦИИ ($articles_unpub)
    $_uid = hasPermissions('articles') ? null : $uid;
    $articles_unpub = hasPermissions('articles') ? articles::ArticlesCount(false, $_uid) : null;
}
if ($_GET['id'] && !$_GET['newurl'] && !$_POST && !$_GET['task']) {
    $interview_info = interview::getInterview($uid, $_GET['id']);
    if ($interview_info['id']) {
        $query_string = preg_replace("/id={$interview_info['id']}/", '', $_SERVER['QUERY_STRING']);
        $query_string = preg_replace('/^&/', '', $query_string);
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: ' . getFriendlyURL('interview', $interview_info['id']) . ($query_string ? "?{$query_string}" : ''));
        exit;
    }
}
$url_parts = parse_url($_SERVER['REQUEST_URI']);
if ($_GET['id'] && !$_GET['task']) {
    $friendly_url = getFriendlyURL('interview', $_GET['id']);
    if (strtolower($url_parts['path']) != $friendly_url) {
Ejemplo n.º 13
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
$articles = new articles();
$container = empty($articles->config['cpop']) ? 'articles' : $articles->config['cpop'];
if (!$articles->setWorkContainer($container)) {
    return show_window(__('Most commented articles'), __('Error occurred') . ':<br />' . $articles->last_error);
}
if ($list = $articles->getLimitedStat('ccnt', $system->config['num_of_latest'], true)) {
    $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%">';
    $i = 2;
    foreach ($list as $id => $time) {
        $id = explode('.', $id);
        if (($article = $articles->getArticle($id[0], $id[1], false, false, false, false)) !== false) {
            $result .= '<tr><td class="row' . $i . '"><a href="index.php?module=articles&amp;c=' . $container . '&amp;b=' . $id[0] . '&amp;a=' . $id[1] . '"><abbr title="' . $article['author_nick'] . ', ' . rcms_format_time('d.m.Y H:i:s', $article['time']) . '">' . $article['title'] . ' (' . $article['comcnt'] . ')</abbr></a></td></tr>';
            $i++;
            if ($i > 3) {
                $i = 2;
            }
        }
    }
    $result .= '</table>';
    show_window(__('Most commented articles'), $result);
}
Ejemplo n.º 14
0
/**
 * Генерирует ЧПУ ссылки
 *
 * @param    string    $type    Тип ссылки(project, blog и т.д.)
 * @param    integer|array   $data      Параметры для ссылки. Если целое, то id объекта в БД, иначе готовый массив $data (см. внутрь).
 * @return   string             ЧПУ ссылка
 */
function getFriendlyURL($type, $data = NULL)
{
    static $url_cache = array();
    $url = '';
    if (!is_array($data)) {
        $id = intval($data);
        $data = NULL;
    } else {
        $id = intval($data['id']);
    }
    if (!$id) {
        return NULL;
    }
    if ($url_cache[$type][$id]) {
        return $url_cache[$type][$id];
    }
    switch ($type) {
        case 'project':
            if (!$data) {
                require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
                $data = projects::getInfoForFriendlyURL($id);
            }
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $url = "/projects/{$id}/" . ($name ? "{$name}.html" : "");
            }
            break;
        case 'blog':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
            $data = blogs::getMsgInfoForFriendlyURL($id);
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $category = translit(strtolower(htmlspecialchars_decode($data['category'], ENT_QUOTES)));
                $url = "/blogs/{$category}/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'blog_group':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
            $data = blogs::GetGroupName($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data, ENT_QUOTES)));
                $url = "/blogs/" . ($category ? "{$category}/" : "");
            }
            break;
        case 'article':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/articles.php";
            $data = articles::getInfoForFriendlyURL($id);
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['title'], ENT_QUOTES)));
                $url = "/articles/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'interview':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/interview.php";
            $data = interview::getInfoForFriendlyURL($id);
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['uname'] . ' ' . $data['usurname'] . ' ' . $data['login'], ENT_QUOTES)));
                $url = "/interview/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'commune':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
            $data = commune::getMsgInfoForFriendlyURL($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data['group_link'], ENT_QUOTES)));
                $commune = translit(strtolower(htmlspecialchars_decode($data['commune_name'], ENT_QUOTES)));
                $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $commune_id = $data['commune_id'];
                $url = "/commune/{$category}/{$commune_id}/{$commune}/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'commune_group':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
            $data = commune::getGroupInfoForFriendlyURL($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data['link'], ENT_QUOTES)));
                $url = "/commune/{$category}/";
            }
            break;
        case 'commune_commune':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
            $data = commune::getCommuneInfoForFriendlyURL($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data['category_link'], ENT_QUOTES)));
                $commune = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $commune = $commune ? $commune : 'commune';
                $url = "/commune/{$category}/{$id}/{$commune}/";
            }
            break;
    }
    if ($url) {
        $url_cache[$type][$id] = $url;
    }
    return $url;
}
Ejemplo n.º 15
0
        $order = intval($_COOKIE['bmOrderType']);
        switch ($order) {
            case 0:
                $order = 'time';
                break;
            case 1:
                $order = 'priority';
                break;
            case 2:
                $order = 'title';
                break;
            default:
                $order = 'time';
                break;
        }
        $bookmarks = articles::getBookmarks($uid, $order);
        $authors = articles::getTopAuthors();
        $pages = ceil($articles_count / $msgs_on_page);
        if (($articles_count == 0 || $articles_count - 1 < ($page - 1) * $msgs_on_page) && !$bPageDefault || $pages == 1 && !$bPageDefault && $page != 1) {
            include ABS_PATH . '/404.php';
            exit;
        }
}
if (hasPermissions('articles')) {
    $js_file[] = 'uploader.js';
}
$js_file[] = 'mootools-forms.js';
$js_file[] = 'articles.js';
$js_file[] = 'kwords.js';
$js_file[] = '/kword_js.php';
include $rpath . '/template2.php';
Ejemplo n.º 16
0
 /**
  * protected функция считывает данные из таблицы БД
  *
  * @return bool
  */
 protected function pGetCategorys()
 {
     if (CONF_ENABLE_CACHING) {
         if ($this->getCachingEntrys()) {
             return true;
         } else {
             // записываем в робота дату обновления кеша
             $articles = new articles();
             $strWhere = "token IN ('active') AND datetime>NOW()";
             $arrFields = array('datetime');
             $arrArticle = $articles->getArticle($strWhere, $arrFields);
             $arrRobotData[$this->retTableName()] = !empty($arrArticle['datetime']) ? strtotime($arrArticle['datetime']) : false;
             robot::putClearCacheData($arrRobotData);
             return !$this->getSubSelectEntrys(false, true, $this->pRetCategoryConf()) ? false : $this->setCachingEntrys();
         }
     } else {
         return !$this->getSubSelectEntrys(false, true, $this->pRetCategoryConf()) ? false : true;
     }
 }
Ejemplo n.º 17
0
$frm->addbreak(__('Additional information'));
$frm->addrow(__('News') . ', ' . __('Articles'), format_size(get_dir_size(DATA_PATH . 'a/')));
$frm->addrow(__('Various datafiles'), format_size(get_dir_size(DF_PATH)));
$frm->addrow(__('Users profiles') . ' (' . get_user_count() . ')', format_size(get_dir_size(USERS_PATH) + get_dir_size(DATA_PATH . 'avatars/') + get_dir_size(DATA_PATH . 'pm/')));
$frm->addrow(__('Uploads'), format_size(get_dir_size(FILES_PATH)));
if (defined('GALLERY_PATH')) {
    $frm->addrow(__('Gallery'), format_size(get_dir_size(GALLERY_PATH)));
}
if (defined('FORUM_PATH')) {
    $frm->addrow(__('Forum'), format_size(get_dir_size(FORUM_PATH)));
}
$frm->addrow(__('Logs'), format_size(get_dir_size(LOGS_PATH)));
$frm->addrow(__('Config'), format_size(get_dir_size(CONFIG_PATH)));
$frm->addrow(__('Backups'), format_size(get_dir_size(BACKUP_PATH)));
$frm->addrow(__('Skins'), format_size(get_dir_size(SKIN_PATH)));
$frm->addrow(__('Images'), format_size(get_dir_size(IMAGES_PATH)));
$frm->addrow(__('All'), format_size(get_dir_size(RCMS_ROOT_PATH)));
if (class_exists('articles') && $system->checkForRight('ARTICLES-EDITOR')) {
    $frm->addbreak(__('Information from users'));
    $articles = new articles();
    $articles->setWorkContainer('#hidden');
    $count = sizeof($articles->getArticles(0, false, false, false));
    $frm->addrow($count . ' ' . __('article(s) awaits moderation'));
}
if ($system->checkForRight('SUPPORT')) {
    $count = sizeof(get_messages(null, true, false, DF_PATH . 'support.dat'));
    $frm->addrow($count . ' ' . __('feedback requests in database'));
}
$frm->addbreak(__('Here you can leave message for other administrators'));
$frm->addrow($frm->textarea('remarks', file_get_contents(DATA_PATH . 'admin_remarks.txt'), 60, 10), '', 'middle', 'center');
$frm->show();
/**
* @package
* @todo
*/
!defined('SDG') ? die('Triple protection!') : null;
// инициируем "Наименование страницы" отображаемое в форме
$arrNamePage = array(array('name' => MENU_ADMIN_MAIN, 'link' => CONF_ADMIN_FILE), array('name' => MENU_MANAGER, 'link' => false), array('name' => MENU_MANAGER_ARTICLES, 'link' => CONF_ADMIN_FILE . '?m=manager&amp;s=articles'));
/**
* иницализация массива подключаемых шаблонов: по умолчанию все значения - false
* для подключения шаблона, необходимо установить значение - true
* шаблоны подключаются в порядке установленном в файле головного шаблона
*/
$arrActions = array('config' => false, 'add' => false, 'edit' => false, 'moderate' => false, 'archived' => false, 'correction' => false, 'comments' => false);
// определяем шаблон для отображения
isset($_GET['action']) && isset($arrActions[$_GET['action']]) ? $arrActions[$_GET['action']] = true : null;
$articles = new articles();
$artsections = new artsections();
/**
* массив, который возращается в форму
* содержит значения по умолчанию для формы отбора
*/
$retFields = array('id' => false, 'id_user' => false, 'author' => false, 'title' => false, 'id_section' => false, 'sDate' => false, 'eDate' => false, 'records' => 30);
/** Строка запроса из адресной строки браузера **/
$qString = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : 'm=manager&s=articles';
/**
* Настройки статей
*/
if ($arrActions['config']) {
    // инициируем "Наименование страницы" отображаемое в форме
    $arrNamePage[] = array('name' => MENU_CONFIG, 'link' => false);
    // сохраняем данные, переданные из формы
Ejemplo n.º 19
0
} elseif (!empty($_POST['maintenance'])) {
    $maintenance = $_POST['maintenance'] == 'on' ? 'true' : 'false';
    $data = "<?php\n\n" . "(!defined('SDG')) ? die ('Triple protection!') : null;\n\n" . 'define("CONF_SERVICE_ADMINISTRATION_MAINTENANCE", ' . $maintenance . ');' . "\n";
    echo !tools::saveConfig('core/conf/const.config.service.php', $data, false) ? 'false' : 'true';
} elseif (!empty($_POST['mailFile']) && !empty($_POST['mailText']) && !empty($_POST['pathMailTemplates'])) {
    $_POST['mailFile'] = $_POST['pathMailTemplates'] . str_replace('_', '.', $_POST['mailFile']) . '.txt';
    // формируем имя файла
    echo tools::saveMailTemplateFile($_POST['mailFile'], $_POST['mailText']);
} elseif (!empty($_POST['uID']) && !empty($_POST['userType']) && !empty($_POST['userGroup'])) {
    $user = new user();
    $user->changeTable('conf_users');
    $response = !$user->updateUser(array('user_type' => $_POST['userType'], 'user_group' => $_POST['userGroup']), "id IN (" . secure::escQuoteData($_POST['uID']) . ")") ? db::$message_error : 'true';
    $user->changeTable('users', USR_PREFIX);
    echo $response;
} elseif (!empty($_POST['getArticleDetail']) && !empty($_POST['strQuery'])) {
    $articles = new articles();
    $arrArticle = $articles->getArticle("id IN (" . secure::escQuoteData($_POST['getArticleDetail']) . ")");
    $aComments = new articlesComments();
    $arrOrder = array('datetime' => 'DESC');
    $arrComments = $aComments->getRecords("id_article=" . secure::escQuoteData($_POST['getArticleDetail']) . " AND token='active'", $arrOrder, false, false);
    // адресная строка
    $smarty->assignByRef('qString', $_POST['strQuery']);
    $smarty->assignByRef('arrArticle', $arrArticle);
    $smarty->assignByRef('arrComments', $arrComments);
    $smarty->display('adm.manager.articles.detail.tpl');
} elseif (!empty($_POST['getNewsDetail']) && !empty($_POST['strQuery'])) {
    $news = new news();
    $arrNews = $news->getNews("id=" . secure::escQuoteData($_POST['getNewsDetail']));
    $newsComments = new newsComments();
    $arrOrder = array('datetime' => 'DESC');
    $arrComments = $newsComments->getRecords("id_news=" . secure::escQuoteData($_POST['getNewsDetail']) . " AND token='active'", $arrOrder, false, false);
Ejemplo n.º 20
0
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 = '&nbsp;&nbsp;<b>�</b> ';
    //Commented becouse f*****g IE, Microsoft, Gates and his mother...
    //$pic_right = '&nbsp;<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] .= '&nbsp;' . $pic_down;
                    $containers = array_reverse($containers);
                    foreach ($containers as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = '?module=articles&c=' . $conkey;
                            if (!isset($dyna['min'])) {
                                $articles->setWorkContainer($conkey);
                                $art = $articles->getCategories();
                                $count2 = 0;
                                if (is_array($art)) {
                                    unset($arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']);
                                    $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = array('-' => '?module=articles&c=' . $conkey);
                                    $art = array_reverse($art);
                                    foreach ($art as $artkey => $artval) {
                                        $count2++;
                                        if ($count2 != $dyna['max']) {
                                            $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'];
                                            $art2 = $articles->getArticles($artval['id']);
                                            $count3 = 0;
                                            if (count($art2) > 0) {
                                                unset($arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']);
                                                $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']);
                                                $art2 = array_reverse($art2);
                                                foreach ($art2 as $art2key => $art2val) {
                                                    $count3++;
                                                    if ($count3 != $dyna['max']) {
                                                        $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'];
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $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 . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = 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 . '&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;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getAvaiableValues('size');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    $item[1] .= '&nbsp;' . $pic_down;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $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);
                                $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 . '&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;
                                    }
                                }
                            }
                        }
                    }
                }
                $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 . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = 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 . '&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;
                                    }
                                }
                            }
                        }
                    }
                }
                $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']['&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = '?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] .= '&nbsp;' . $pic_down;
                    $userlist = array_reverse($userlist);
                    foreach ($userlist as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_users']['&nbsp;&nbsp;' . cut_text($conval['nickname']) . '&nbsp;&nbsp;'] = '?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] .= '&nbsp;' . $pic_down;
                    $fdb = array_reverse($filesdb->data);
                    foreach ($fdb as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1));
                            if (count($conval['files']) > 0) {
                                if (!isset($dyna['min'])) {
                                    unset($arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']);
                                    $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = 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 . '&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));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $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] .= '&nbsp;' . $pic_down;
                    if (is_array($topics)) {
                        $topics = array_reverse($topics);
                        foreach ($topics as $conkey => $conval) {
                            $count++;
                            if ($count != $dyna['max']) {
                                $arr['ddm_forum']['&nbsp;&nbsp;' . cut_text($conval['title']) . '&nbsp;&nbsp;'] = '?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')) . '&nbsp;' . $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')) . '&nbsp;' . $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')) . '&nbsp;' . $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;
}
Ejemplo n.º 21
0
    /**
     * private функция формирует RSS для статей
     * 
     * @param (int) $id - id раздела, статьи которого необходимо показать (по умолчанию false)
     * 
     * @return string
     */
    protected function rssArticles($id = false)
    {
        // создаем объекты
        $articles = new articles();
        $artsections = new artsections();
        // получаем список разделов
        $sections = $artsections->getSections("token IN ('active')");
        // формируем данные шапки
        $this->title[] = array('name' => MENU_ARTICLES);
        $this->link = chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?do=rss&amp;action=articles');
        $this->description = MENU_ARTICLES;
        // проверяем просмотр по разделу
        if (!empty($id) && !empty($sections[$id])) {
            // выбираем статьи с учетом раздела
            $arrArticles = $articles->getPuplishedArticles("id_section=" . secure::escQuoteData($id), false, array('strLimit' => '0,' . CONF_RSS_ARTICLES_COUNT, 'calcRows' => false), array('id', 'title', 'small_text', 'datetime', 'id_section'));
            // Дописываем данные по разделу в шапку
            $this->title[] = array('name' => $sections[$id]['name']);
            $this->description .= ' - ' . $sections[$id]['name'];
        } else {
            $arrArticles = $articles->getPuplishedArticles(false, false, array('strLimit' => '0,' . CONF_RSS_ARTICLES_COUNT, 'calcRows' => false), array('id', 'title', 'small_text', 'datetime', 'id_section'));
        }
        /***** Формируем XML-документ *****/
        $data = '<?xml version="1.0" encoding="' . CONF_DEFAULT_CHARSET . '" ?>
					<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
					<channel>
					<atom:link href="' . $this->link . '" rel="self" type="application/rss+xml" />
					<title>' . strings::formTitle($this->title) . '</title>
					<link>' . $this->link . '</link>
					<description>' . $this->description . '</description>
					<language>ru</language>
					<pubDate>' . $this->pubDate . '</pubDate>
					<image>
						<url>' . $this->siteLogo . '</url>
						<title>' . strings::formTitle($this->title) . '</title>
						<link>' . $this->link . '</link>
					</image>';
        // если статьи есть
        if (!empty($arrArticles) && is_array($arrArticles)) {
            foreach ($arrArticles as $value) {
                $data .= '<item>
							<title>' . $value['title'] . '</title>
							<link>' . chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?do=articles&amp;action=view&amp;id=' . $value['tId']) . '</link>
							<pubDate>' . terms::RFCDate($value['datetime']) . '</pubDate>
							<guid>' . chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?do=articles&amp;action=view&amp;id=' . $value['tId']) . '</guid>
							<category domain="' . chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?do=articles&amp;action=section&amp;id=' . $sections[$value['id_section']]['tId']) . '">' . $sections[$value['id_section']]['name'] . '</category>
							<description><![CDATA[' . $value['small_text'] . ']]></description>
						</item>';
            }
        }
        $data .= '</channel>
				</rss>';
        return $data;
    }
Ejemplo n.º 22
0
<?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++) {
Ejemplo n.º 23
0
 * Иницализация массива подключаемых шаблонов: по умолчанию все значения - false
 * Для подключения шаблона, необходимо установить значение - true
 * Шаблоны подключаются в порядке установленном в файле головного шаблона
 */
$arrAction = array('section' => false, 'view' => false, 'offset' => false);
// определяем шаблон для отображения
if (isset($_GET['action'])) {
    if (isset($arrAction[$_GET['action']])) {
        $arrAction[$_GET['action']] = true;
    } else {
        messages::error404();
    }
}
$sections = array();
// создаем объект
$articles = new articles();
$artsections = new artsections();
$artsections->getCategorys();
// формируем данные для запроса в соответствии с типом пользователя
/*
switch ($_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type']) {
	case 'competitor':
		$arrWhere = array('affiliation' => array('none', 'competitor'));
		break;

	case 'employer':
	case 'company':
		$arrWhere = array('affiliation' => array('none', 'employer'));
		break;

	default:
Ejemplo n.º 24
0
 /**
  * Устанавливает/обновляет закладку
  *
  * @param  integer $user_id ид пользователя
  * @param  integer $article_id ид сатьи
  * @param  integer $star тип звезды - число от 0 дл 4
  * @return bool
  */
 function bookmarkArticle($user_id, $article_id, $star)
 {
     global $DB;
     $article = articles::getArticle($article_id, $user_id);
     if ($article['bookmark'] === NULL) {
         $sql = "INSERT INTO articles_users (user_id, article_id, bookmark, bookmark_time)\n                                VALUES (?i, ?i, ?i, NOW())";
         if (!$DB->query($sql, $user_id, $article_id, $star)) {
             return false;
         }
     } else {
         $sql = "UPDATE articles_users SET bookmark = ?i, bookmark_time = NOW()\n                           WHERE user_id = ?i AND article_id = ?i";
         if (!$DB->query($sql, $star, $user_id, $article_id)) {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 25
0
	if (Isel.search(a) !== -1) Isel='<img src="<?php 
echo FILES_PATH;
?>
'+Isel+'"/>\n';
	else Isel='<a href="<?php 
echo FILES_PATH;
?>
'+Isel+'">'+Isel+'</a>\n';
	document.forms['arted'].elements['text'].value += Isel;
	}
	}
}
//-->
</script> 
<?php 
$articles = new articles();
if (!$system->checkForRight('ARTICLES-EDITOR')) {
    $c = '#hidden';
}
$c = empty($_POST['c']) ? null : $_POST['c'];
$b = empty($_POST['b']) ? null : $_POST['b'];
$nb = empty($_POST['nb']) ? null : $_POST['nb'];
$a = empty($_POST['a']) ? null : $_POST['a'];
/******************************************************************************
* Perform deletion of articles                                                *
******************************************************************************/
if (!empty($_POST['delete'])) {
    foreach ($_POST['delete'] as $id => $chk) {
        if ($chk && $articles->setWorkContainer($c) && $articles->deleteArticle($b, $id)) {
            rcms_showAdminMessage(__('Article removed') . ': ' . $c . '/' . $b . '/' . $id);
        } else {
Ejemplo n.º 26
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
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&amp;from=' . mktime(0, 0, 0, $selected_month, rcms_format_time('d', $time), $selected_year) . '&amp;until=' . mktime(23, 59, 59, $selected_month, rcms_format_time('d', $time), $selected_year));
            }
        }
Ejemplo n.º 27
0
<html>
<head>
<?php 
include "includes/dbInfo.php";
include "includes/articles.php";
session_start();
$conn = new mysqli("localhost", DBUSERNAME, DBPASSWORD, DB);
//Esatblish database connection
$articles = new articles($conn);
$id = $_GET["id"];
if ($id == "") {
    //Redirect if no ID specified
    header("Location:index.php");
}
$article = $articles->getArticleById($id);
//Gets article record
if ($article == null) {
    //Redirect if article does not exist
    header("Location:index.php");
}
?>
</head>

<body>
<?php 
echo "<h1>" . $article["Title"] . "</h1>";
//Title of article
echo "<h3>By: " . $article["Author"] . "</h3>";
//Author of article
echo "<p>" . $article["Content"] . "</p>";
//Main content of article
Ejemplo n.º 28
0
<?php

require_once 'model/articlesManage.php';
$articles = new articles();
$date = time();
$getArticlesCategories = $articles->getArticlesCategories($pdo);
$getArticlesOrder = $articles->getArticlesOrder($pdo);
$getArticlesId = $articles->getArticlesId($pdo);
$getViewArticles = $articles->getViewArticles($pdo);
if (isset($_POST['title']) and isset($_POST['content'])) {
    if ($_POST['idArticles'] == 0) {
        //Poster un nouvelle articles
        $_POST['title'] = trim(htmlentities($_POST['title']));
        $_POST['author'] = trim(htmlentities($_POST['author']));
        $_POST['content'] = trim(htmlentities($_POST['content']));
        $articles->addArticles($pdo, $date);
        if (isset($_SESSION['userId'])) {
            header("Location: index.php?pages=articles");
            exit;
        } else {
            header("Location: index.php?pages=listArticles");
            exit;
        }
    } else {
        //Poster une modification d'articles
        $_POST['title'] = trim(htmlentities($_POST['title']));
        $_POST['author'] = trim(htmlentities($_POST['author']));
        $_POST['content'] = trim(htmlentities($_POST['content']));
        $articles->updateArticles($pdo, $date);
        header("Location: index.php?pages=listArticles");
        exit;
Ejemplo n.º 29
0
}
//Сбор поисковых запросов - филтрация лога (запросы по юзерам)
if (date('H') == 8) {
    $parser = search_parser::factory(1);
    $log->TRACE($parser->filterRaw('users'));
}
//Сбор поисковых запросов - филтрация лога (запросы по проектам)
if (date('H') == 9) {
    $parser = search_parser::factory(1);
    $log->TRACE($parser->filterRaw('projects'));
    $log->TRACE($parser->cleanup());
}
//Очистка "мусора" создающегося при вставке в визивиг изображений и не сохранении комментария (таблицы commune_attach, file_commune и articles_comments_files, file
if (date('H') == 23) {
    //$log->TRACE( commune::removeWysiwygTrash());
    $log->TRACE(articles::removeWysiwygTrash());
}
// Каждый день первого числа формируем документ ITO за прошлый месяц
/*
if(date('j') == 1 && date('H') == 1) {
    $prevMonth = time() - 3600 * 24 * 2; // Вычитаем два дня на всякий случай
    $log->TRACE( sbr_meta::generateDocITO(array(0 => date('Y-m-01', $prevMonth), 1 => date('Y-m-t', $prevMonth)), false, 'xlsx'));
}
*/
//Очистка логов ПСКБ из базы
/*
if(date('H') == 5) {
    // $log_pskb = new log_pskb();
    // $log->TRACE( $log_pskb->clearCloneData() );
    // $log->TRACE( $log_pskb->packOldData(true) );
}
Ejemplo n.º 30
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
$name_module = __('Articles');
$articles = new articles();
$containers = $articles->getContainers();
if (!empty($containers) && is_array($containers)) {
    foreach (array_keys($containers) as $c) {
        if ($c != '#hidden') {
            if ($articles->setWorkContainer($c)) {
                if (is_array($articles->getCategories())) {
                    foreach ($articles->getCategories() as $b) {
                        foreach ($articles->getArticles($b['id'], true) as $article) {
                            $loc = $directory . '?module=articles&c=' . str_replace('#', '%23', $c) . '&b=' . $b['id'] . '&a=' . $article['id'];
                            $sitemap->addUrl($loc, rcms_format_time('Y-m-d', $article['time']), $chfr, $prio);
                        }
                    }
                }
            }
        }
    }
}