function rewrite_field($field)
 {
     $field = strtolower($field);
     $field = url_encode_rewrite($field);
     $field = str_replace('-', '_', $field);
     return 'f_' . $field;
 }
Exemplo n.º 2
0
function faq_mini($position, $block)
{
    global $Cache, $Template, $FAQ_LANG, $FAQ_CATS, $RANDOM_QUESTIONS;
    load_module_lang('faq');
    $Cache->load('faq');
    include_once PATH_TO_ROOT . '/faq/faq_begin.php';
    include_once PATH_TO_ROOT . '/faq/faq_cats.class.php';
    $tpl = new Template('faq/faq_mini.tpl');
    import('core/menu_service');
    MenuService::assign_positions_conditions($tpl, $block);
    $no_random_question = array('L_FAQ_RANDOM_QUESTION' => $FAQ_LANG['random_question'], 'FAQ_QUESTION' => $FAQ_LANG['no_random_question'], 'U_FAQ_QUESTION' => TPL_PATH_TO_ROOT . '/faq/' . url('faq.php'));
    if (empty($RANDOM_QUESTIONS)) {
        $tpl->assign_vars($no_random_question);
        return $tpl->parse(TEMPLATE_STRING_MODE);
    }
    $random_question = $RANDOM_QUESTIONS[array_rand($RANDOM_QUESTIONS)];
    $faq_cats = new FaqCats();
    $i = 0;
    while (!$faq_cats->check_auth($random_question['idcat']) && $i < 5) {
        $random_question = $RANDOM_QUESTIONS[array_rand($RANDOM_QUESTIONS)];
        $i++;
    }
    if ($i < 5 && !empty($random_question['question'])) {
        $tpl->assign_vars(array('L_FAQ_RANDOM_QUESTION' => $FAQ_LANG['random_question'], 'FAQ_QUESTION' => $random_question['question'], 'U_FAQ_QUESTION' => PATH_TO_ROOT . '/faq/' . ($random_question['idcat'] > 0 ? url('faq.php?id=' . $random_question['idcat'] . '&amp;question=' . $random_question['id'], 'faq-' . $random_question['idcat'] . '+' . url_encode_rewrite($FAQ_CATS[$random_question['idcat']]['name']) . '.php?question=' . $random_question['id']) . '#q' . $random_question['id'] : url('faq.php?question=' . $random_question['id'], 'faq.php?question=' . $random_question['id']) . '#q' . $random_question['id'])));
    } else {
        $tpl->assign_vars($no_random_question);
    }
    return $tpl->parse(TEMPLATE_STRING_MODE);
}
Exemplo n.º 3
0
function wiki_display_menu($menu_list)
{
    if (count($menu_list) == 0) {
        return '';
    }
    $menu = '';
    $last_level = 0;
    foreach ($menu_list as $title) {
        $current_level = $title[0];
        $title_name = stripslashes($title[1]);
        $title_link = '<a href="#paragraph_' . url_encode_rewrite($title_name) . '">' . htmlspecialchars($title_name, ENT_COMPAT, 'ISO-8859-1') . '</a>';
        if ($current_level > $last_level) {
            $menu .= '<ol class="wiki_list_' . $current_level . '"><li>' . $title_link;
        } elseif ($current_level == $last_level) {
            $menu .= '</li><li>' . $title_link;
        } else {
            if (substr($menu, strlen($menu) - 4, 4) == '<li>') {
                $menu = substr($menu, 0, strlen($menu) - 4);
            }
            $menu .= str_repeat('</li></ol>', $last_level - $current_level) . '</li><li>' . $title_link;
        }
        $last_level = $title[0];
    }
    if (substr($menu, strlen($menu) - 4, 4) == '<li>') {
        $menu = substr($menu, 0, strlen($menu) - 4);
    }
    $menu .= str_repeat('</li></ol>', $last_level);
    return $menu;
}
Exemplo n.º 4
0
function bread_crumb($id)
{
    global $Bread_crumb, $MEDIA_CATS;
    $id_parent = $MEDIA_CATS[$id]['id_parent'];
    $Bread_crumb->add($MEDIA_CATS[$id]['name'], url('media.php?cat=' . $id, 'media-0-' . $id . '+' . url_encode_rewrite($MEDIA_CATS[$id]['name']) . '.php'));
    while ($id_parent >= 0) {
        $Bread_crumb->add($MEDIA_CATS[$id_parent]['name'], url('media.php?cat=' . $id_parent, 'media-0-' . $id_parent . '+' . url_encode_rewrite($MEDIA_CATS[$id_parent]['name']) . '.php'));
        $id_parent = $MEDIA_CATS[$id_parent]['id_parent'];
    }
    $Bread_crumb->reverse();
}
 function get_feed_data_struct($idcat = 0)
 {
     global $Cache, $Sql, $LANG, $MEDIA_LANG, $CONFIG, $MEDIA_CONFIG, $MEDIA_CATS;
     $Cache->load('media');
     load_module_lang('media');
     require_once PATH_TO_ROOT . '/media/media_constant.php';
     require_once PATH_TO_ROOT . '/media/media_cats.class.php';
     import('content/syndication/feed_data');
     import('util/date');
     import('util/url');
     $data = new FeedData();
     $data->set_title($MEDIA_LANG['xml_media_desc']);
     $data->set_date(new Date());
     $data->set_link(new Url('/syndication.php?m=media&amp;cat=' . $idcat));
     $data->set_host(HOST);
     $data->set_desc($MEDIA_LANG['xml_media_desc']);
     $data->set_lang($LANG['xml_lang']);
     $data->set_auth_bit(MEDIA_AUTH_READ);
     $cats = new MediaCats();
     $children_cats = array();
     $cats->build_children_id_list($idcat, $children_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST);
     $result = $Sql->query_while("SELECT id, idcat, name, contents, timestamp FROM " . PREFIX . "media WHERE infos = '" . MEDIA_STATUS_APROBED . "' AND idcat IN (" . implode($children_cats, ',') . " ) ORDER BY timestamp DESC" . $Sql->limit(0, $MEDIA_CONFIG['pagin']), __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         $item = new FeedItem();
         $link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php'));
         $item->set_title($row['name']);
         $item->set_link($link);
         $item->set_guid($link);
         $item->set_desc(second_parse($row['contents']));
         $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp']));
         $item->set_image_url($MEDIA_CATS[$row['idcat']]['image']);
         $item->set_auth($cats->compute_heritated_auth($row['idcat'], MEDIA_AUTH_READ, AUTH_PARENT_PRIORITY));
         $data->add_item($item);
     }
     $Sql->query_close($result);
     return $data;
 }
Exemplo n.º 6
0
            }
            $last_topic_title = ($CONFIG_FORUM['activ_display_msg'] && $row['display_msg'] ? $CONFIG_FORUM['display_msg'] : '') . ' ' . ucfirst($row['title']);
            $last_topic_title = strlen(html_entity_decode($last_topic_title, ENT_COMPAT, 'ISO-8859-1')) > 20 ? substr_html($last_topic_title, 0, 20) . '...' : $last_topic_title;
            $row['login'] = !empty($row['login']) ? $row['login'] : $LANG['guest'];
            $last = '<a href="topic' . url('.php?id=' . $row['tid'], '-' . $row['tid'] . '+' . url_encode_rewrite($row['title']) . '.php') . '" class="small_link">' . $last_topic_title . '</a><br />
			<a href="topic' . url('.php?' . $last_page . 'id=' . $row['tid'], '-' . $row['tid'] . $last_page_rewrite . '+' . url_encode_rewrite($row['title']) . '.php') . '#m' . $last_msg_id . '"><img src="../templates/' . get_utheme() . '/images/ancre.png" alt="" /></a> ' . $LANG['on'] . ' ' . gmdate_format('date_format', $row['last_timestamp']) . '<br />' . $LANG['by'] . ' ' . ($row['last_user_id'] != '-1' ? '<a href="../member/member' . url('.php?id=' . $row['last_user_id'], '-' . $row['last_user_id'] . '.php') . '" class="small_link">' . $row['login'] . '</a>' : '<em>' . $LANG['guest'] . '</em>');
        } else {
            $row['last_timestamp'] = '';
            $last = '<br />' . $LANG['no_message'] . '<br /><br />';
        }
        $img_announce = 'announce';
        if (!$is_guest) {
            if ($row['last_view_id'] != $row['last_msg_id'] && $row['last_timestamp'] >= $max_time_msg) {
                $img_announce = 'new_' . $img_announce;
            }
        }
        $img_announce .= $row['status'] == '0' ? '_lock' : '';
        $total_topic += $row['nbr_topic'];
        $total_msg += $row['nbr_msg'];
        $Template->assign_block_vars('forums_list.subcats', array('IMG_ANNOUNCE' => $img_announce, 'NAME' => $row['name'], 'DESC' => second_parse($row['subname']), 'SUBFORUMS' => !empty($subforums) && !empty($row['subname']) ? '<br />' . $subforums : $subforums, 'NBR_TOPIC' => $row['nbr_topic'], 'NBR_MSG' => $row['nbr_msg'], 'U_FORUM_URL' => $row['url'], 'U_FORUM_VARS' => url('.php?id=' . $row['cid'], '-' . $row['cid'] . '+' . url_encode_rewrite($row['name']) . '.php'), 'U_LAST_TOPIC' => $last));
    }
}
$Sql->query_close($result);
if ($i > 0) {
    $Template->assign_block_vars('forums_list', array());
    $Template->assign_block_vars('forums_list.endcats', array());
}
list($users_list, $total_admin, $total_modo, $total_member, $total_visit, $total_online) = forum_list_user_online("AND s.session_script LIKE '/forum/%'");
$Template->assign_vars(array('FORUM_NAME' => $CONFIG_FORUM['forum_name'], 'NBR_MSG' => $total_msg, 'NBR_TOPIC' => $total_topic, 'TOTAL_ONLINE' => $total_online, 'USERS_ONLINE' => $total_online - $total_visit == 0 ? '<em>' . $LANG['no_member_online'] . '</em>' : $users_list, 'ADMIN' => $total_admin, 'MODO' => $total_modo, 'MEMBER' => $total_member, 'GUEST' => $total_visit, 'SID' => SID, 'MODULE_DATA_PATH' => $Template->get_module_data_path('forum'), 'SELECT_CAT' => !empty($id_get) ? forum_list_cat($id_get, 0) : '', 'C_TOTAL_POST' => true, 'U_ONCHANGE' => url(".php?id=' + this.options[this.selectedIndex].value + '", "-' + this.options[this.selectedIndex].value + '.php"), 'U_ONCHANGE_CAT' => url("index.php?id=' + this.options[this.selectedIndex].value + '", "cat-' + this.options[this.selectedIndex].value + '.php"), 'L_SEARCH' => $LANG['search'], 'L_ADVANCED_SEARCH' => $LANG['advanced_search'], 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_FORUM' => $LANG['forum'], 'L_TOPIC' => $total_topic > 1 ? $LANG['topic_s'] : $LANG['topic'], 'L_MESSAGE' => $total_msg > 1 ? $LANG['message_s'] : $LANG['message'], 'L_LAST_MESSAGE' => $LANG['last_message'], 'L_STATS' => $LANG['stats'], 'L_DISPLAY_UNREAD_MSG' => $LANG['show_not_reads'], 'L_MARK_AS_READ' => $LANG['mark_as_read'], 'L_TOTAL_POST' => $LANG['nbr_message'], 'L_DISTRIBUTED' => strtolower($LANG['distributed']), 'L_AND' => $LANG['and'], 'L_USER' => $total_online > 1 ? $LANG['user_s'] : $LANG['user'], 'L_ADMIN' => $total_admin > 1 ? $LANG['admin_s'] : $LANG['admin'], 'L_MODO' => $total_modo > 1 ? $LANG['modo_s'] : $LANG['modo'], 'L_MEMBER' => $total_member > 1 ? $LANG['member_s'] : $LANG['member'], 'L_GUEST' => $total_visit > 1 ? $LANG['guest_s'] : $LANG['guest'], 'L_AND' => $LANG['and'], 'L_ONLINE' => strtolower($LANG['online'])));
$Template->pparse('forum_index');
include '../kernel/footer.php';
Exemplo n.º 7
0
if (!$User->check_level(MEMBER_LEVEL)) {
    $Errorh->handler('e_auth', E_USER_REDIRECT);
}
$Template->set_filenames(array('forum_alert' => 'forum/forum_alert.tpl', 'forum_top' => 'forum/forum_top.tpl', 'forum_bottom' => 'forum/forum_bottom.tpl'));
if (!empty($alert) && empty($alert_post)) {
    $nbr_alert = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "forum_alerts WHERE idtopic = '" . $alert . "' AND status = 0", __LINE__, __FILE__);
    if (empty($nbr_alert)) {
        $Template->assign_vars(array('KERNEL_EDITOR' => display_editor(), 'L_ALERT' => $LANG['alert_topic'], 'L_ALERT_EXPLAIN' => $LANG['alert_modo_explain'], 'L_ALERT_TITLE' => $LANG['alert_title'], 'L_ALERT_CONTENTS' => $LANG['alert_contents'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_REQUIRE_TITLE' => $LANG['require_title']));
        $Template->assign_block_vars('alert_form', array('TITLE' => $topic_name, 'U_TOPIC' => 'topic' . url('.php?id=' . $alert, '-' . $alert . '-' . url_encode_rewrite($topic_name) . '.php'), 'ID_ALERT' => $alert));
    } else {
        $Template->assign_vars(array('L_ALERT' => $LANG['alert_topic'], 'L_BACK_TOPIC' => $LANG['alert_back'], 'URL_TOPIC' => 'topic' . url('.php?id=' . $alert, '-' . $alert . '-' . url_encode_rewrite($topic_name) . '.php')));
        $Template->assign_block_vars('alert_confirm', array('MSG' => $LANG['alert_topic_already_done']));
    }
}
if (!empty($alert_post)) {
    $Template->assign_vars(array('L_ALERT' => $LANG['alert_topic'], 'L_BACK_TOPIC' => $LANG['alert_back'], 'URL_TOPIC' => 'topic' . url('.php?id=' . $alert_post, '-' . $alert_post . '-' . url_encode_rewrite($topic_name) . '.php')));
    $nbr_alert = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "forum_alerts WHERE idtopic = '" . $alert_post . "' AND status = 0", __LINE__, __FILE__);
    if (empty($nbr_alert)) {
        $alert_title = retrieve(POST, 'title', '');
        $alert_contents = retrieve(POST, 'contents', '', TSTRING_PARSE);
        include_once '../forum/forum.class.php';
        $Forumfct = new Forum();
        $Forumfct->Alert_topic($alert_post, $alert_title, $alert_contents);
        $Template->assign_block_vars('alert_confirm', array('MSG' => str_replace('%title', $topic_name, $LANG['alert_success'])));
    } else {
        $Template->assign_block_vars('alert_confirm', array('MSG' => $LANG['alert_topic_already_done']));
    }
}
list($users_list, $total_admin, $total_modo, $total_member, $total_visit, $total_online) = forum_list_user_online("AND s.session_script = '/forum/%'");
$Template->assign_vars(array('FORUM_NAME' => $CONFIG_FORUM['forum_name'] . ' : ' . $LANG['alert_topic'], 'SID' => SID, 'MODULE_DATA_PATH' => $Template->get_module_data_path('forum'), 'DESC' => $topic['subtitle'], 'TOTAL_ONLINE' => $total_online, 'USERS_ONLINE' => $total_online - $total_visit == 0 ? '<em>' . $LANG['no_member_online'] . '</em>' : $users_list, 'ADMIN' => $total_admin, 'MODO' => $total_modo, 'MEMBER' => $total_member, 'GUEST' => $total_visit, 'U_FORUM_CAT' => '<a href="forum' . url('.php?id=' . $topic['idcat'], '-' . $topic['idcat'] . '.php') . '">' . $CAT_FORUM[$topic['idcat']]['name'] . '</a>', 'U_TITLE_T' => '<a href="topic' . url('.php?id=' . $topic_id, '-' . $topic_id . '.php') . '">' . $topic['title'] . '</a>', 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_SUBMIT' => $LANG['submit'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset'], 'L_USER' => $total_online > 1 ? $LANG['user_s'] : $LANG['user'], 'L_ADMIN' => $total_admin > 1 ? $LANG['admin_s'] : $LANG['admin'], 'L_MODO' => $total_modo > 1 ? $LANG['modo_s'] : $LANG['modo'], 'L_MEMBER' => $total_member > 1 ? $LANG['member_s'] : $LANG['member'], 'L_GUEST' => $total_visit > 1 ? $LANG['guest_s'] : $LANG['guest'], 'L_AND' => $LANG['and'], 'L_ONLINE' => strtolower($LANG['online'])));
$Template->pparse('forum_alert');
Exemplo n.º 8
0
        $auth_cats = !empty($auth_cats) ? " AND c.id NOT IN (" . trim($auth_cats, ',') . ")" : '';
        $result = $Sql->query_while("\n\t\tSELECT ta.id, ta.title, ta.timestamp, ta.status, ta.user_id, ta.idtopic, ta.idmodo, m2.login AS login_modo, m.login, t.title AS topic_title, t.idcat, c.id AS cid, ta.contents\n\t\tFROM " . PREFIX . "forum_alerts ta\n\t\tLEFT JOIN " . PREFIX . "forum_topics t ON t.id = ta.idtopic\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = ta.user_id\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m2 ON m2.user_id = ta.idmodo\n\t\tLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat\n\t\tWHERE ta.id = '" . $id_get . "'" . $auth_cats, __LINE__, __FILE__);
        $row = $Sql->fetch_assoc($result);
        if (!empty($row)) {
            if (empty($row['idcat'])) {
                include_once '../forum/forum.class.php';
                $Forumfct = new Forum();
                $Forumfct->Del_alert_topic($id_get);
                redirect(HOST . DIR . '/forum/moderation_forum' . url('.php?action=alert', '', '&'));
            }
            if ($row['status'] == 0) {
                $status = $LANG['alert_not_solved'];
            } else {
                $status = $LANG['alert_solved'] . '<a href="../member/member' . url('.php?id=' . $row['idmodo'], '-' . $row['idmodo'] . '.php') . '">' . $row['login_modo'] . '</a>';
            }
            $Template->assign_vars(array('ID' => $id_get, 'TITLE' => $row['title'], 'TOPIC' => '<a href="topic' . url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . '+' . url_encode_rewrite($row['topic_title']) . '.php') . '">' . $row['topic_title'] . '</a>', 'CONTENTS' => second_parse($row['contents']), 'STATUS' => $status, 'LOGIN' => '<a href="../member/member' . url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php') . '">' . $row['login'] . '</a>', 'TIME' => gmdate_format('date_format', $row['timestamp']), 'CAT' => '<a href="forum' . url('.php?id=' . $row['idcat'], '-' . $row['idcat'] . '+' . url_encode_rewrite($CAT_FORUM[$row['idcat']]['name']) . '.php') . '">' . $CAT_FORUM[$row['idcat']]['name'] . '</a>', 'C_FORUM_ALERT_LIST' => true, 'U_CHANGE_STATUS' => $row['status'] == '0' ? 'moderation_forum.php' . url('?action=alert&amp;id=' . $id_get . '&amp;new_status=1&amp;token=' . $Session->get_token()) : 'moderation_forum.php' . url('?action=alert&amp;id=' . $id_get . '&amp;new_status=0&amp;token=' . $Session->get_token()), 'L_CHANGE_STATUS' => $row['status'] == '0' ? $LANG['change_status_to_1'] : $LANG['change_status_to_0'], 'L_TITLE' => $LANG['alert_title'], 'L_TOPIC' => $LANG['alert_concerned_topic'], 'L_CONTENTS' => $LANG['alert_msg'], 'L_LOGIN' => $LANG['alert_login'], 'L_TIME' => $LANG['date'], 'L_STATUS' => $LANG['status'], 'L_STATUS_1' => $LANG['change_status_to_1'], 'L_CAT' => $LANG['alert_concerned_cat']));
        } else {
            $Template->assign_vars(array('C_FORUM_ALERT_NOT_AUTH' => true, 'L_NO_ALERT' => $LANG['alert_not_auth']));
        }
    }
} elseif ($action == 'punish') {
    $readonly = retrieve(POST, 'new_info', 0);
    $readonly = $readonly > 0 ? time() + $readonly : 0;
    $readonly_contents = retrieve(POST, 'action_contents', '', TSTRING_UNCHANGE);
    if (!empty($id_get) && retrieve(POST, 'valid_user', false)) {
        $info_mbr = $Sql->query_array(DB_TABLE_MEMBER, 'user_id', 'level', "WHERE user_id = '" . $id_get . "'", __LINE__, __FILE__);
        if (!empty($info_mbr['user_id']) && ($info_mbr['level'] < 2 || $User->check_level(ADMIN_LEVEL))) {
            $Sql->query_inject("UPDATE " . DB_TABLE_MEMBER . " SET user_readonly = '" . $readonly . "' WHERE user_id = '" . $info_mbr['user_id'] . "'", __LINE__, __FILE__);
            if ($info_mbr['user_id'] != $User->get_attribute('user_id')) {
                if (!empty($readonly_contents) && !empty($readonly)) {
                    import('members/pm');
Exemplo n.º 9
0
        redirect(HOST . DIR . '/pages/pages.php?error=e_auth');
    }
    if ($id_redirection > 0) {
        $Bread_crumb->add($LANG['pages_redirection_management'], url('action.php?id=' . $id_redirection));
    } elseif ($id_new > 0) {
        $Bread_crumb->add($LANG['pages_creation_redirection'], url('action.php?new=' . $id_redirection));
    } elseif ($del_cat > 0) {
        $Bread_crumb->add($LANG['pages_delete_cat'], url('action.php?del_cat=' . $id_redirection));
    } else {
        $Bread_crumb->add($LANG['pages_rename'], url('action.php?rename=' . $id_rename));
    }
    $Bread_crumb->add($page_infos['title'], url('pages.php?title=' . $page_infos['encoded_title'], $page_infos['encoded_title']));
    $id = $page_infos['id_cat'];
    while ($id > 0) {
        if (empty($_PAGES_CATS[$id]['auth']) || $User->check_auth($_PAGES_CATS[$id]['auth'], READ_PAGE)) {
            $Bread_crumb->add($_PAGES_CATS[$id]['name'], url('pages.php?title=' . url_encode_rewrite($_PAGES_CATS[$id]['name']), url_encode_rewrite($_PAGES_CATS[$id]['name'])));
        }
        $id = (int) $_PAGES_CATS[$id]['id_parent'];
    }
    if ($User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) {
        $Bread_crumb->add($LANG['pages'], url('pages.php'));
    }
    $Bread_crumb->reverse();
} else {
    $Bread_crumb->add($LANG['pages'], url('pages.php'), $LANG['pages_redirections'], url('action.php'));
}
require_once '../kernel/header.php';
$Template->set_filenames(array('pages_action' => 'pages/action.tpl'));
if ($del_cat > 0) {
    $page_infos = $Sql->query_array(PREFIX . 'pages', 'id', 'title', 'encoded_title', 'auth', 'id_cat', 'redirect', "WHERE id = '" . $del_cat . "'", __LINE__, __FILE__);
    $special_auth = !empty($page_infos['auth']);
Exemplo n.º 10
0
 function get_home_page()
 {
     global $Sql, $User, $Template, $Cache, $Bread_crumb, $_WIKI_CONFIG, $_WIKI_CATS, $LANG;
     load_module_lang('wiki');
     include_once '../wiki/wiki_functions.php';
     $bread_crumb_key = 'wiki';
     require_once '../wiki/wiki_bread_crumb.php';
     unset($Template);
     $Template = new Template();
     $Template->set_filenames(array('wiki' => 'wiki/wiki.tpl', 'index' => 'wiki/index.tpl'));
     $Template->assign_vars(array('WIKI_PATH' => $Template->get_module_data_path('wiki')));
     if ($_WIKI_CONFIG['last_articles'] > 1) {
         $result = $Sql->query_while("SELECT a.title, a.encoded_title, a.id\n\t\t\tFROM " . PREFIX . "wiki_articles a\n\t\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\t\t\tWHERE a.redirect = 0\n\t\t\tORDER BY c.timestamp DESC\n\t\t\tLIMIT 0, " . $_WIKI_CONFIG['last_articles'], __LINE__, __FILE__);
         $articles_number = $Sql->num_rows($result, "SELECT COUNT(*) FROM " . PREFIX . "wiki_articles WHERE encoded_title = '" . $encoded_title . "'", __LINE__, __FILE__);
         $Template->assign_block_vars('last_articles', array('L_ARTICLES' => $LANG['wiki_last_articles_list'], 'RSS' => $articles_number > 0 ? '<a href="{PATH_TO_ROOT}/syndication.php?m=wiki"><img src="../templates/' . get_utheme() . '/images/rss.png" alt="RSS" /></a>' : ''));
         $i = 0;
         while ($row = $Sql->fetch_assoc($result)) {
             $Template->assign_block_vars('last_articles.list', array('ARTICLE' => $row['title'], 'TR' => $i > 0 && $i % 2 == 0 ? '</tr><tr>' : '', 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title'])));
             $i++;
         }
         if ($articles_number == 0) {
             $Template->assign_vars(array('L_NO_ARTICLE' => '<td style="text-align:center;" class="row2">' . $LANG['wiki_no_article'] . '</td>'));
         }
     }
     if ($_WIKI_CONFIG['display_cats'] != 0) {
         $Template->assign_block_vars('cat_list', array('L_CATS' => $LANG['wiki_cats_list']));
         $i = 0;
         foreach ($_WIKI_CATS as $id => $infos) {
             if ($infos['id_parent'] == 0) {
                 $Template->assign_block_vars('cat_list.list', array('CAT' => $infos['name'], 'U_CAT' => url('wiki.php?title=' . url_encode_rewrite($infos['name']), url_encode_rewrite($infos['name']))));
                 $i++;
             }
         }
         if ($i == 0) {
             $Template->assign_vars(array('L_NO_CAT' => $LANG['wiki_no_cat']));
         }
     }
     $Template->assign_vars(array('TITLE' => !empty($_WIKI_CONFIG['wiki_name']) ? $_WIKI_CONFIG['wiki_name'] : $LANG['wiki'], 'INDEX_TEXT' => !empty($_WIKI_CONFIG['index_text']) ? second_parse(wiki_no_rewrite($_WIKI_CONFIG['index_text'])) : $LANG['wiki_empty_index'], 'L_EXPLORER' => $LANG['wiki_explorer'], 'U_EXPLORER' => url('explorer.php'), 'WIKI_PATH' => $Template->get_module_data_path('wiki')));
     $page_type = 'index';
     include '../wiki/wiki_tools.php';
     $tmp = $Template->pparse('wiki', TRUE);
     return $tmp;
 }
Exemplo n.º 11
0
<?php

require_once '../kernel/begin.php';
require_once 'download_auth.php';
$idurl = retrieve(GET, 'id', 0);
if (!empty($idurl)) {
    $Sql->query_inject("UPDATE " . PREFIX . "download SET count = count + 1 WHERE id = '" . $idurl . "'", __LINE__, __FILE__);
    $info_file = $Sql->query_array(PREFIX . "download", "url", "force_download", "idcat", "size", "WHERE id = '" . $idurl . "'", __LINE__, __FILE__);
    $Cache->load('download');
    $auth_read = $User->check_auth($CONFIG_DOWNLOAD['global_auth'], DOWNLOAD_READ_CAT_AUTH_BIT);
    $id_cat_for_download = (int) $info_file['idcat'];
    while ($id_cat_for_download > 0) {
        $Bread_crumb->add($DOWNLOAD_CATS[$id_cat_for_download]['name'], url('download.php?cat=' . $id_cat_for_download, 'category-' . $id_cat_for_download . '+' . url_encode_rewrite($DOWNLOAD_CATS[$id_cat_for_download]['name']) . '.php'));
        if (!empty($DOWNLOAD_CATS[$id_cat_for_download]['auth'])) {
            $auth_read = $auth_read && $User->check_auth($DOWNLOAD_CATS[$id_cat_for_download]['auth'], DOWNLOAD_READ_CAT_AUTH_BIT);
        }
        $id_cat_for_download = (int) $DOWNLOAD_CATS[$id_cat_for_download]['id_parent'];
    }
    if (!$auth_read) {
        $Errorh->handler('e_auth', E_USER_REDIRECT);
    }
    if (empty($info_file['url'])) {
        $Errorh->handler('e_unexist_file_download', E_USER_REDIRECT);
    }
    if ($info_file['force_download'] == DOWNLOAD_FORCE_DL && strpos($info_file['url'], '://') === false) {
        $info_file['url'] = second_parse_url($info_file['url']);
        $filesize = @filesize($info_file['url']);
        $filesize = $filesize !== false ? $filesize : (!empty($info_file) ? number_round($info_file['size'] * 1048576, 0) : false);
        if ($filesize !== false) {
            header('Content-Length: ' . $filesize);
        }
Exemplo n.º 12
0
    $type = 2;
    if (!empty($forum_info['url'])) {
        $type = 3;
    } elseif ($forum_info['level'] == 0) {
        $type = 1;
    }
    $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('forum'), 'ID' => $id, 'TYPE' => $type, 'CATEGORIES' => $forums, 'NAME' => $forum_info['name'], 'URL' => $forum_info['url'], 'DESC' => unparse($forum_info['subname']), 'CHECKED_APROB' => $forum_info['aprob'] == 1 ? 'checked="checked"' : '', 'UNCHECKED_APROB' => $forum_info['aprob'] == 0 ? 'checked="checked"' : '', 'CHECKED_STATUS' => $forum_info['status'] == 1 ? 'checked="checked"' : '', 'UNCHECKED_STATUS' => $forum_info['status'] == 0 ? 'checked="checked"' : '', 'AUTH_READ' => Authorizations::generate_select(READ_CAT_FORUM, $array_auth), 'AUTH_WRITE' => $is_root ? Authorizations::generate_select(WRITE_CAT_FORUM, $array_auth) : Authorizations::generate_select(WRITE_CAT_FORUM, $array_auth, array(), GROUP_DEFAULT_IDSELECT, GROUP_DISABLE_SELECT), 'AUTH_EDIT' => $is_root ? Authorizations::generate_select(EDIT_CAT_FORUM, $array_auth) : Authorizations::generate_select(EDIT_CAT_FORUM, $array_auth, array(), GROUP_DEFAULT_IDSELECT, GROUP_DISABLE_SELECT), 'DISABLED' => $is_root ? '0' : '1', 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_FORUM_MANAGEMENT' => $LANG['forum_management'], 'L_CAT_MANAGEMENT' => $LANG['cat_management'], 'L_ADD_CAT' => $LANG['cat_add'], 'L_FORUM_CONFIG' => $LANG['forum_config'], 'L_FORUM_GROUPS' => $LANG['forum_groups_config'], 'L_EDIT_CAT' => $LANG['cat_edit'], 'L_REQUIRE' => $LANG['require'], 'L_APROB' => $LANG['visible'], 'L_STATUS' => $LANG['status'], 'L_RANK' => $LANG['rank'], 'L_DELETE' => $LANG['delete'], 'L_PARENT_CATEGORY' => $LANG['parent_category'], 'L_NAME' => $LANG['name'], 'L_URL' => $LANG['url'], 'L_URL_EXPLAIN' => $LANG['url_explain'], 'L_DESC' => $LANG['description'], 'L_RESET' => $LANG['reset'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_LOCK' => $LANG['lock'], 'L_UNLOCK' => $LANG['unlock'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_UPDATE' => $LANG['update'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_write'], 'L_AUTH_EDIT' => $LANG['auth_edit']));
    $Template->pparse('admin_forum_cat_edit');
} else {
    $Template->set_filenames(array('admin_forum_cat' => 'forum/admin_forum_cat.tpl'));
    $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('forum'), 'L_CONFIRM_DEL' => $LANG['del_entry'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_FORUM_MANAGEMENT' => $LANG['forum_management'], 'L_CAT_MANAGEMENT' => $LANG['cat_management'], 'L_ADD_CAT' => $LANG['cat_add'], 'L_FORUM_CONFIG' => $LANG['forum_config'], 'L_FORUM_GROUPS' => $LANG['forum_groups_config'], 'L_DELETE' => $LANG['delete'], 'L_NAME' => $LANG['name'], 'L_DESC' => $LANG['description'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_LOCK' => $LANG['lock'], 'L_UNLOCK' => $LANG['unlock'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_ADD' => $LANG['add'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_write'], 'L_AUTH_EDIT' => $LANG['auth_edit'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none']));
    $max_cat = $Sql->query("SELECT MAX(id_left) FROM " . PREFIX . "forum_cats", __LINE__, __FILE__);
    $list_cats_js = '';
    $array_js = '';
    $i = 0;
    $result = $Sql->query_while("SELECT id, id_left, id_right, level, name, subname, url, status\n\tFROM " . PREFIX . "forum_cats\n\tORDER BY id_left", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('list', array('I' => $i, 'ID' => $row['id'], 'NAME' => strlen($row['name']) > 60 ? substr($row['name'], 0, 60) . '...' : $row['name'], 'INDENT' => $row['level'] * 75, 'LOCK' => $row['status'] == 0 ? '<img class="valign_middle" src="../templates/' . get_utheme() . '/images/readonly.png" alt="" title="' . $LANG['lock'] . '" />' : '', 'URL' => !empty($row['url']) ? '<a href="' . $row['url'] . '"><img src="./forum_mini.png" alt="" class="valign_middle" /></a> ' : '', 'U_FORUM_VARS' => !empty($row['url']) ? $row['url'] : ($row['level'] > 0 ? 'forum' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php') : url('index.php?id=' . $row['id'], 'cat-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php'))));
        $list_cats_js .= $row['id'] . ', ';
        $array_js .= 'array_cats[' . $row['id'] . '] = new Array();' . "\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id\'] = ' . $row['id'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id_left\'] = ' . $row['id_left'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id_right\'] = ' . $row['id_right'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'i\'] = ' . $i . ";\n";
        $i++;
    }
    $Sql->query_close($result);
    $Template->assign_vars(array('LIST_CATS' => trim($list_cats_js, ', '), 'ARRAY_JS' => $array_js, 'ID_END' => $i - 1));
    $Template->pparse('admin_forum_cat');
}
require_once '../admin/admin_footer.php';
Exemplo n.º 13
0
    }
    $array_auth = isset($CONFIG_ARTICLES['auth_root']) ? $CONFIG_ARTICLES['auth_root'] : array();
    $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('articles'), 'AUTH_READ' => Authorizations::generate_select(READ_CAT_ARTICLES, $array_auth), 'L_ROOT' => $LANG['root'], 'L_ARTICLES_MANAGEMENT' => $LANG['articles_management'], 'L_ARTICLES_ADD' => $LANG['articles_add'], 'L_ARTICLES_CAT' => $LANG['cat_management'], 'L_ARTICLES_CONFIG' => $LANG['articles_config'], 'L_ARTICLES_CAT_ADD' => $LANG['articles_cats_add'], 'L_EDIT_CAT' => $LANG['cat_edit'], 'L_REQUIRE' => $LANG['require'], 'L_RESET' => $LANG['reset'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_UPDATE' => $LANG['update'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none']));
    $Template->pparse('admin_articles_cat_edit2');
} else {
    $Template->set_filenames(array('admin_articles_cat' => 'articles/admin_articles_cat.tpl'));
    $get_error = retrieve(GET, 'error', '');
    if ($get_error == 'unexist_cat') {
        $Errorh->handler($LANG['e_unexist_cat'], E_USER_NOTICE);
    }
    $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('articles'), 'L_CONFIRM_DEL' => $LANG['del_entry'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_ARTICLES_MANAGEMENT' => $LANG['articles_management'], 'L_ARTICLES_ADD' => $LANG['articles_add'], 'L_ARTICLES_CAT' => $LANG['cat_management'], 'L_ARTICLES_CONFIG' => $LANG['articles_config'], 'L_ARTICLES_CAT_ADD' => $LANG['articles_cats_add'], 'L_DELETE' => $LANG['delete'], 'L_ROOT' => $LANG['root'], 'L_NAME' => $LANG['name'], 'L_DESC' => $LANG['description'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_LOCK' => $LANG['lock'], 'L_UNLOCK' => $LANG['unlock'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_ADD' => $LANG['add'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_write'], 'L_AUTH_EDIT' => $LANG['auth_edit'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none']));
    $max_cat = $Sql->query("SELECT MAX(id_left) FROM " . PREFIX . "articles_cats", __LINE__, __FILE__);
    $list_cats_js = '';
    $array_js = '';
    $i = 0;
    $result = $Sql->query_while("SELECT id, id_left, id_right, level, name, contents\n\tFROM " . PREFIX . "articles_cats\n\tORDER BY id_left", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('list', array('I' => $i, 'ID' => $row['id'], 'NAME' => strlen($row['name']) > 60 ? substr($row['name'], 0, 60) . '...' : $row['name'], 'INDENT' => ($row['level'] + 1) * 75, 'U_ARTICLES_VARS' => url('.php?cat=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php')));
        $list_cats_js .= $row['id'] . ', ';
        $array_js .= 'array_cats[' . $row['id'] . '] = new Array();' . "\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id\'] = ' . $row['id'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id_left\'] = ' . $row['id_left'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id_right\'] = ' . $row['id_right'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'i\'] = ' . $i . ";\n";
        $i++;
    }
    $Sql->query_close($result);
    $Template->assign_vars(array('LIST_CATS' => trim($list_cats_js, ', '), 'ARRAY_JS' => $array_js, 'ID_END' => $i - 1));
    $Template->pparse('admin_articles_cat');
}
require_once '../admin/admin_footer.php';
 function get_feed_data_struct($idcat = 0, $name = '')
 {
     require_once PATH_TO_ROOT . '/download/download_auth.php';
     require_once PATH_TO_ROOT . '/download/download_cats.class.php';
     import('content/syndication/feed_data');
     import('util/date');
     import('util/url');
     global $Cache, $Sql, $LANG, $DOWNLOAD_LANG, $CONFIG, $CONFIG_DOWNLOAD, $DOWNLOAD_CATS;
     load_module_lang('download');
     $Cache->load('download');
     $data = new FeedData();
     $data->set_title($DOWNLOAD_LANG['xml_download_desc']);
     $data->set_date(new Date());
     $data->set_link(new Url('/syndication.php?m=download&amp;cat=' . $idcat));
     $data->set_host(HOST);
     $data->set_desc($DOWNLOAD_LANG['xml_download_desc']);
     $data->set_lang($LANG['xml_lang']);
     $data->set_auth_bit(DOWNLOAD_READ_CAT_AUTH_BIT);
     $cats = new DownloadCats();
     $children_cats = array();
     $cats->build_children_id_list($idcat, $children_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST);
     $req = "SELECT id, idcat, title, contents, timestamp, image\n        FROM " . PREFIX . "download\n        WHERE visible = 1 AND idcat IN (" . implode($children_cats, ',') . " )\n        ORDER BY timestamp DESC" . $Sql->limit(0, $CONFIG_DOWNLOAD['nbr_file_max']);
     $result = $Sql->query_while($req, __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         $item = new FeedItem();
         $link = new Url('/download/download' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'));
         $item->set_title($row['title']);
         $item->set_link($link);
         $item->set_guid($link);
         $item->set_desc(second_parse($row['contents']));
         $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp']));
         $item->set_image_url($row['image']);
         $item->set_auth($cats->compute_heritated_auth($row['idcat'], DOWNLOAD_READ_CAT_AUTH_BIT, AUTH_PARENT_PRIORITY));
         $data->add_item($item);
     }
     $Sql->query_close($result);
     return $data;
 }
Exemplo n.º 15
0
    }
    $array_auth = !empty($CONFIG_GALLERY['auth_root']) ? $CONFIG_GALLERY['auth_root'] : array();
    $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('gallery'), 'AUTH_READ' => Authorizations::generate_select(READ_CAT_GALLERY, $array_auth), 'AUTH_WRITE' => Authorizations::generate_select(WRITE_CAT_GALLERY, $array_auth), 'AUTH_EDIT' => Authorizations::generate_select(EDIT_CAT_GALLERY, $array_auth), 'L_ROOT' => $LANG['root'], 'L_GALLERY_MANAGEMENT' => $LANG['gallery_management'], 'L_GALLERY_PICS_ADD' => $LANG['gallery_pics_add'], 'L_GALLERY_CAT_MANAGEMENT' => $LANG['gallery_cats_management'], 'L_GALLERY_CAT_ADD' => $LANG['gallery_cats_add'], 'L_GALLERY_CONFIG' => $LANG['gallery_config'], 'L_EDIT_CAT' => $LANG['cat_edit'], 'L_REQUIRE' => $LANG['require'], 'L_RESET' => $LANG['reset'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_UPDATE' => $LANG['update'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_upload'], 'L_AUTH_EDIT' => $LANG['auth_edit'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none']));
    $Template->pparse('admin_gallery_cat_edit2');
} else {
    $Template->set_filenames(array('admin_gallery_cat' => 'gallery/admin_gallery_cat.tpl'));
    $get_error = !empty($_GET['error']) ? trim($_GET['error']) : '';
    if ($get_error == 'unexist_cat') {
        $Errorh->handler($LANG['e_unexist_cat'], E_USER_NOTICE);
    }
    $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('gallery'), 'L_CONFIRM_DEL' => $LANG['del_entry'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_GALLERY_MANAGEMENT' => $LANG['gallery_management'], 'L_GALLERY_PICS_ADD' => $LANG['gallery_pics_add'], 'L_GALLERY_CAT_MANAGEMENT' => $LANG['gallery_cats_management'], 'L_GALLERY_CAT_ADD' => $LANG['gallery_cats_add'], 'L_GALLERY_CONFIG' => $LANG['gallery_config'], 'L_DELETE' => $LANG['delete'], 'L_ROOT' => $LANG['root'], 'L_NAME' => $LANG['name'], 'L_DESC' => $LANG['description'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_LOCK' => $LANG['gallery_lock'], 'L_UNLOCK' => $LANG['gallery_unlock'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_ADD' => $LANG['add'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_write'], 'L_AUTH_EDIT' => $LANG['auth_edit'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none']));
    $max_cat = $Sql->query("SELECT MAX(id_left) FROM " . PREFIX . "gallery_cats", __LINE__, __FILE__);
    $list_cats_js = '';
    $array_js = '';
    $i = 0;
    $result = $Sql->query_while("SELECT id, id_left, id_right, level, name, contents, status\n\tFROM " . PREFIX . "gallery_cats \n\tORDER BY id_left", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('list', array('I' => $i, 'ID' => $row['id'], 'NAME' => $row['name'], 'DESC' => $row['contents'], 'INDENT' => ($row['level'] + 1) * 75, 'LOCK' => $row['status'] == 0 ? '<img class="valign_middle" src="../templates/' . get_utheme() . '/images/readonly.png" alt="" title="' . $LANG['gallery_lock'] . '" />' : '', 'U_GALLERY_VARS' => url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php')));
        $list_cats_js .= $row['id'] . ', ';
        $array_js .= 'array_cats[' . $row['id'] . '] = new Array();' . "\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id\'] = ' . $row['id'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id_left\'] = ' . $row['id_left'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'id_right\'] = ' . $row['id_right'] . ";\n";
        $array_js .= 'array_cats[' . $row['id'] . '][\'i\'] = ' . $i . ";\n";
        $i++;
    }
    $Sql->query_close($result);
    $Template->assign_vars(array('LIST_CATS' => trim($list_cats_js, ', '), 'ARRAY_JS' => $array_js, 'ID_END' => $i - 1));
    $Template->pparse('admin_gallery_cat');
}
require_once '../admin/admin_footer.php';
Exemplo n.º 16
0
            $result = $Sql->query_while("SELECT id FROM " . PREFIX . "wiki_articles WHERE id_cat = '" . $id . "'", __LINE__, __FILE__);
            while ($row = $Sql->fetch_assoc($result)) {
                $Sql->query_inject("DELETE FROM " . PREFIX . "wiki_contents WHERE id_article = '" . $row['id'] . "'", __LINE__, __FILE__);
                $Sql->query_inject("DELETE FROM " . DB_TABLE_COM . " WHERE script = 'wiki' AND idprov = '" . $row['id'] . "'", __LINE__);
            }
            $Sql->query_close($result);
            $Sql->query_inject("DELETE FROM " . PREFIX . "wiki_articles WHERE id_cat = '" . $id . "'", __LINE__, __FILE__);
            $Sql->query_inject("DELETE FROM " . PREFIX . "wiki_cats WHERE id = '" . $id . "'", __LINE__, __FILE__);
        }
        $Cache->Generate_module_file('wiki');
        import('content/syndication/feed');
        Feed::clear_cache('wiki');
        if (array_key_exists($article_infos['id_cat'], $_WIKI_CATS) && $_WIKI_CATS[$article_infos['id_cat']]['id_parent'] > 0) {
            $title = $_WIKI_CATS[$_WIKI_CATS[$article_infos['id_cat']]['id_parent']]['name'];
            redirect(HOST . DIR . '/wiki/' . url('wiki.php?title=' . url_encode_rewrite($title), url_encode_rewrite($title), '&'));
        } else {
            redirect(HOST . DIR . '/wiki/' . url('wiki.php', '', '&'));
        }
    } elseif ($remove_action == 'move_all') {
        $Sql->query_inject("UPDATE " . PREFIX . "wiki_articles SET id_cat = '" . $report_cat . "' WHERE id_cat = '" . $article_infos['id_cat'] . "'", __LINE__, __FILE__);
        $Sql->query_inject("UPDATE " . PREFIX . "wiki_cats SET id_parent = '" . $report_cat . "' WHERE id_parent = '" . $article_infos['id_cat'] . "'", __LINE__, __FILE__);
        $Cache->Generate_module_file('wiki');
        if (array_key_exists($report_cat, $_WIKI_CATS)) {
            $title = $_WIKI_CATS[$report_cat]['name'];
            redirect(HOST . DIR . '/wiki/' . url('wiki.php?title=' . url_encode_rewrite($title), url_encode_rewrite($title), '&'));
        } else {
            redirect(HOST . DIR . '/wiki/' . url('wiki.php', '', '&'));
        }
    }
}
redirect(HOST . DIR . '/wiki/' . url('wiki.php', '', '&'));
Exemplo n.º 17
0
        $Bread_crumb->add($media['name'], url('media.php?id=' . $media['id'], 'media-' . $media['id'] . '-' . $media['idcat'] . '+' . url_encode_rewrite($media['name']) . '.php'));
        $Bread_crumb->add($MEDIA_LANG['edit_media'], url('media_action.php?edit=' . $media['id']));
        define('TITLE', $MEDIA_LANG['edit_media']);
    } else {
        $Bread_crumb->add($MEDIA_LANG['add_media'], url('media_action.php'));
        define('TITLE', $MEDIA_LANG['add_media']);
    }
    require_once '../kernel/header.php';
} elseif (!empty($_POST['submit'])) {
    $Session->csrf_get_protect();
    $media = array('idedit' => retrieve(POST, 'idedit', 0, TINTEGER), 'name' => retrieve(POST, 'name', '', TSTRING), 'idcat' => retrieve(POST, 'idcat', 0, TINTEGER), 'width' => min(retrieve(POST, 'width', $MEDIA_CONFIG['width'], TINTEGER), $MEDIA_CONFIG['width']), 'height' => min(retrieve(POST, 'height', $MEDIA_CONFIG['height'], TINTEGER), $MEDIA_CONFIG['height']), 'url' => retrieve(POST, 'u_media', '', TSTRING), 'contents' => retrieve(POST, 'contents', '', TSTRING_UNCHANGE), 'approved' => retrieve(POST, 'approved', 0, TBOOL), 'contrib' => retrieve(POST, 'contrib', 0, TBOOL), 'counterpart' => retrieve(POST, 'counterpart', '', TSTRING_PARSE));
    $auth_cat = !empty($MEDIA_CATS[$media['idcat']]['auth']) ? $MEDIA_CATS[$media['idcat']]['auth'] : $MEDIA_CATS[0]['auth'];
    $media['idcat'] = !empty($MEDIA_CATS[$media['idcat']]) ? $media['idcat'] : 0;
    bread_crumb($media['idcat']);
    if ($media['idedit']) {
        $Bread_crumb->add($media['name'], url('media.php?id=' . $media['idedit'], 'media-' . $media['idedit'] . '-' . $media['idcat'] . '+' . url_encode_rewrite($media['name']) . '.php'));
        $Bread_crumb->add($MEDIA_LANG['edit_media'], url('media_action.php?edit=' . $media['idedit']));
        define('TITLE', $MEDIA_LANG['edit_media']);
    } else {
        $Bread_crumb->add($MEDIA_LANG['add_media'], url('media_action.php?add=' . $media['idcat']));
        define('TITLE', $MEDIA_LANG['add_media']);
    }
    require_once '../kernel/header.php';
    if (!empty($media['url'])) {
        if ($MEDIA_CATS[$media['idcat']]['mime_type'] == MEDIA_TYPE_MUSIC) {
            $mime_type = $mime_type['audio'];
            $host_ok = $host_ok['audio'];
        } elseif ($MEDIA_CATS[$media['idcat']]['mime_type'] == MEDIA_TYPE_VIDEO) {
            $mime_type = $mime_type['video'];
            $host_ok = $host_ok['video'];
        } else {
Exemplo n.º 18
0
<?php

require_once '../admin/admin_begin.php';
load_module_lang('download');
define('TITLE', $LANG['administration']);
require_once '../admin/admin_header.php';
$Cache->load('download');
$Template->set_filenames(array('admin_download_management' => 'download/admin_download_management.tpl'));
$nbr_dl = $Sql->count_table('download', __LINE__, __FILE__);
import('util/pagination');
$Pagination = new Pagination();
$Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'PAGINATION' => $Pagination->display('admin_download.php?p=%d', $nbr_dl, 'p', 25, 3), 'L_DEL_ENTRY' => $LANG['del_entry'], 'L_DOWNLOAD_ADD' => $DOWNLOAD_LANG['download_add'], 'L_DOWNLOAD_MANAGEMENT' => $DOWNLOAD_LANG['download_management'], 'L_DOWNLOAD_CAT' => $LANG['cat_management'], 'L_DOWNLOAD_CONFIG' => $DOWNLOAD_LANG['download_config'], 'L_CATEGORY' => $LANG['category'], 'L_SIZE' => $LANG['size'], 'L_TITLE' => $LANG['title'], 'L_APROB' => $LANG['aprob'], 'L_UPDATE' => $LANG['update'], 'L_DELETE' => $LANG['delete'], 'L_DATE' => $LANG['date'], 'L_CONFIRM_DELETE' => str_replace('\'', '\\\'', $DOWNLOAD_LANG['confirm_delete_file'])));
$result = $Sql->query_while("SELECT id, idcat, title, timestamp, approved, start, end, size\nFROM " . PREFIX . "download\nORDER BY timestamp DESC \n" . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
    if ($row['approved'] == 1) {
        $aprob = $LANG['yes'];
    } else {
        $aprob = $LANG['no'];
    }
    $title =& $row['title'];
    $title = strlen($title) > 45 ? substr($title, 0, 45) . '...' : $title;
    $Template->assign_block_vars('list', array('TITLE' => $title, 'IDCAT' => $row['idcat'], 'CAT' => $row['idcat'] > 0 ? $DOWNLOAD_CATS[$row['idcat']]['name'] : $LANG['root'], 'PSEUDO' => !empty($row['login']) ? $row['login'] : $LANG['guest'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'SIZE' => $row['size'] >= 1 ? number_round($row['size'], 1) . ' ' . $LANG['unit_megabytes'] : number_round($row['size'] * 2524, 1) . ' ' . $LANG['unit_kilobytes'], 'APROBATION' => $aprob, 'U_FILE' => url('download.php?id=' . $row['id'], 'download-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'), 'U_EDIT_FILE' => url('management.php?edit=' . $row['id']), 'U_DEL_FILE' => url('management.php?del=' . $row['id'] . '&amp;token=' . $Session->get_token())));
}
$Sql->query_close($result);
include_once 'admin_download_menu.php';
$Template->pparse('admin_download_management');
require_once '../admin/admin_footer.php';
Exemplo n.º 19
0
     $Template->set_filenames(array('news' => 'news/news.tpl'));
     if ($news_size > 1) {
         $size_tpl = $news_size . ' ' . $LANG['unit_megabytes'];
     } elseif ($news_size > 0) {
         $size_tpl = $news_size * 1024 . ' ' . $LANG['unit_kilobytes'];
     } else {
         $size_tpl = $NEWS_LANG['unknown_size'];
     }
     $creation_calendar = new MiniCalendar('creation');
     $creation_calendar->set_date($news_creation_date);
     $release_calendar = new MiniCalendar('release_date');
     $release_calendar->set_date($news_release_date);
     if ($news_visibility < 0 || $news_visibility > 2) {
         $news_visibility = 0;
     }
     $Template->assign_vars(array('C_DISPLAY_NEWS' => true, 'C_IMG' => !empty($news_image), 'C_EDIT_AUTH' => false, 'MODULE_DATA_PATH' => $Template->get_module_data_path('news'), 'NAME' => stripslashes($news_title), 'CONTENTS' => second_parse(stripslashes(strparse($news_contents))), 'CREATION_DATE' => $news_creation_date->format(DATE_FORMAT_SHORT), 'RELEASE_DATE' => $news_release_date->get_timestamp() > 0 ? $news_release_date->format(DATE_FORMAT_SHORT) : $NEWS_LANG['unknown_date'], 'SIZE' => $size_tpl, 'COUNT' => $news_hits, 'THEME' => get_utheme(), 'HITS' => sprintf($NEWS_LANG['n_times'], (int) $news_hits), 'NUM_NOTES' => sprintf($NEWS_LANG['num_notes'], 0), 'U_IMG' => $news_image, 'IMAGE_ALT' => str_replace('"', '\\"', $news_title), 'LANG' => get_ulang(), 'L_DATE' => $LANG['date'], 'L_SIZE' => $LANG['size'], 'L_NEWS' => $NEWS_LANG['news'], 'L_NEWS_FILE' => $NEWS_LANG['news_news'], 'L_FILE_INFOS' => $NEWS_LANG['news_infos'], 'L_INSERTION_DATE' => $NEWS_LANG['insertion_date'], 'L_RELEASE_DATE' => $NEWS_LANG['release_date'], 'L_NEWSED' => $NEWS_LANG['newsed'], 'L_NOTE' => $LANG['note'], 'U_NEWS_FILE' => url('count.php?id=' . $edit_news_id, 'news-' . $edit_news_id . '+' . url_encode_rewrite($news_title) . '.php')));
     $Template->assign_vars(array('TITLE' => stripslashes($news_title), 'COUNT' => $news_hits, 'DESCRIPTION' => $news_contents, 'SHORT_DESCRIPTION' => $news_short_contents, 'FILE_IMAGE' => $news_image, 'URL' => $news_url, 'SIZE_FORM' => $news_size, 'DATE' => $news_creation_date->format(DATE_FORMAT_SHORT, TIMEZONE_AUTO), 'CATEGORIES_TREE' => $news_categories->build_select_form($news_cat_id, 'idcat', 'idcat', 0, WRITE_CAT_NEWS, $CONFIG_NEWS['global_auth'], IGNORE_AND_CONTINUE_BROWSING_IF_A_CATEGORY_DOES_NOT_MATCH), 'SHORT_DESCRIPTION_PREVIEW' => second_parse(stripslashes(strparse($news_short_contents))), 'VISIBLE_WAITING' => $news_visibility == 2 ? ' checked="checked"' : '', 'VISIBLE_ENABLED' => $news_visibility == 1 ? ' checked="checked"' : '', 'VISIBLE_UNAPROVED' => $news_visibility == 0 ? ' checked="checked"' : '', 'DATE_CALENDAR_CREATION' => $creation_calendar->display(), 'DATE_CALENDAR_RELEASE' => $release_calendar->display(), 'BOOL_IGNORE_RELEASE_DATE' => $ignore_release_date ? 'true' : 'false', 'STYLE_FIELD_RELEASE_DATE' => $ignore_release_date ? 'none' : 'block', 'IGNORE_RELEASE_DATE_CHECKED' => $ignore_release_date ? ' checked="checked"' : '', 'BEGINING_CALENDAR' => $begining_calendar->display(), 'END_CALENDAR' => $end_calendar->display()));
 } else {
     $news_creation_date = new Date(DATE_NOW, TIMEZONE_AUTO);
     $news_release_date = new Date(DATE_NOW, TIMEZONE_AUTO);
     $creation_calendar = new MiniCalendar('creation');
     $creation_calendar->set_date($news_creation_date);
     $release_calendar = new MiniCalendar('release_date');
     $ignore_release_date = false;
     if (!$ignore_release_date) {
         $release_calendar->set_date($news_release_date);
     }
     $begining_calendar = new MiniCalendar('begining_date');
     $end_calendar = new MiniCalendar('end_date');
     $end_calendar->set_style('margin-left:150px;');
     $begining_calendar->set_date(new Date(DATE_NOW, TIMEZONE_AUTO));
Exemplo n.º 20
0
if (defined('PHPBOOST') !== true) {
    exit;
}
require_once 'articles_constants.php';
if (isset($CAT_ARTICLES[$idartcat]) && isset($_GET['cat'])) {
    $Bread_crumb->add($LANG['title_articles'], url('articles.php'));
    foreach ($CAT_ARTICLES as $id => $array_info_cat) {
        if (!empty($idartcat) && $CAT_ARTICLES[$idartcat]['id_left'] >= $array_info_cat['id_left'] && $CAT_ARTICLES[$idartcat]['id_right'] <= $array_info_cat['id_right'] && $array_info_cat['level'] <= $CAT_ARTICLES[$idartcat]['level']) {
            $Bread_crumb->add($array_info_cat['name'], 'articles' . url('.php?cat=' . $id, '-' . $id . '.php'));
        }
    }
    if (!empty($idart)) {
        $articles = $Sql->query_array(PREFIX . 'articles', '*', "WHERE visible = 1 AND id = '" . $idart . "' AND idcat = " . $idartcat, __LINE__, __FILE__);
        $idartcat = $articles['idcat'];
        define('TITLE', $LANG['title_articles'] . ' - ' . addslashes($articles['title']));
        $Bread_crumb->add($articles['title'], 'articles' . url('.php?cat=' . $idartcat . '&amp;id=' . $idart, '-' . $idartcat . '-' . $idart . '+' . url_encode_rewrite($articles['title']) . '.php'));
        if (!empty($get_note)) {
            $Bread_crumb->add($LANG['note'], '');
        } elseif (!empty($_GET['i'])) {
            $Bread_crumb->add($LANG['com'], '');
        }
    } else {
        define('TITLE', $LANG['title_articles'] . ' - ' . addslashes($CAT_ARTICLES[$idartcat]['name']));
    }
} else {
    $Bread_crumb->add($LANG['title_articles'], '');
    if (!defined('TITLE')) {
        define('TITLE', $LANG['title_articles']);
    }
}
Exemplo n.º 21
0
        if ($state == "visible") {
            $db_where = MEDIA_STATUS_APROBED;
        } elseif ($state == 'unvisible') {
            $db_where = MEDIA_STATUS_UNVISIBLE;
        } elseif ($state == 'unaprobed') {
            $db_where = MEDIA_STATUS_UNAPROBED;
        } else {
            $db_where = null;
        }
        if ($sub_cats) {
            $media_categories->build_children_id_list($cat, $array_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST, MEDIA_AUTH_READ);
        }
    } else {
        $cat = 0;
        $db_where = $sub_cats = null;
        $media_categories->build_children_id_list(0, $array_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST, MEDIA_AUTH_READ);
    }
    import('util/pagination');
    $Pagination = new Pagination();
    $nbr_media = 0;
    $result = $Sql->query_while("SELECT * FROM " . PREFIX . "media WHERE " . (!empty($array_cats) ? 'idcat IN (' . "'" . implode("', '", $array_cats) . "'" . ')' : 'idcat=' . (!empty($cat) ? $cat : 0)) . (is_null($db_where) ? '' : ' AND infos=' . $db_where) . " ORDER BY infos ASC, timestamp DESC" . $Sql->limit($Pagination->get_first_msg(NUM_MODO_MEDIA, 'p'), NUM_MODO_MEDIA), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $nbr_media++;
        $js_array[] = $row['id'];
        $Template->assign_block_vars('files', array('ID' => $row['id'], 'NAME' => $row['name'], 'U_FILE' => url('media.php?id=' . $row['id'], 'media-' . $row['id'] . '-' . $row['idcat'] . '+' . url_encode_rewrite($row['name']) . '.php'), 'U_EDIT' => url('media_action.php?edit=' . $row['id']), 'CAT' => !empty($MEDIA_CATS[$row['idcat']]) ? $MEDIA_CATS[$row['idcat']]['name'] : $LANG['unknow'], 'U_CAT' => url('media.php?cat=' . $row['idcat']), 'COLOR' => $row['infos'] == MEDIA_STATUS_UNVISIBLE ? '#FFEE99' : ($row['infos'] == MEDIA_STATUS_APROBED ? '#CCFFCC' : '#FFCCCC'), 'SHOW' => $row['infos'] == MEDIA_STATUS_APROBED ? ' checked="checked"' : '', 'HIDE' => $row['infos'] == MEDIA_STATUS_UNVISIBLE ? ' checked="checked"' : '', 'UNAPROBED' => $row['infos'] == MEDIA_STATUS_UNAPROBED ? ' checked="checked"' : ''));
    }
    $Sql->query_close($result);
    $Template->assign_vars(array('C_DISPLAY' => 1, 'L_FILTER' => $MEDIA_LANG['filter'], 'L_DISPLAY_FILE' => $MEDIA_LANG['display_file'], 'L_ALL' => $MEDIA_LANG['all_file'], 'SELECTED_ALL' => is_null($db_where) ? ' selected="selected"' : '', 'L_FVISIBLE' => $MEDIA_LANG['visible'], 'SELECTED_VISIBLE' => $db_where === MEDIA_STATUS_APROBED ? ' selected="selected"' : '', 'L_FUNVISIBLE' => $MEDIA_LANG['unvisible'], 'SELECTED_UNVISIBLE' => $db_where === MEDIA_STATUS_UNVISIBLE ? ' selected="selected"' : '', 'L_FUNAPROBED' => $MEDIA_LANG['unaprobed'], 'SELECTED_UNAPROBED' => $db_where === MEDIA_STATUS_UNAPROBED ? ' selected="selected"' : '', 'L_CATEGORIES' => $MEDIA_LANG['from_cats'], 'CATEGORIES_TREE' => $media_categories->build_select_form($cat, 'idcat', 'idcat', 0, MEDIA_AUTH_READ, $MEDIA_CATS[$cat]['auth']), 'L_INCLUDE_SUB_CATS' => $MEDIA_LANG['include_sub_cats'], 'SUB_CATS' => is_null($sub_cats) ? ' checked="checked"' : ($sub_cats ? ' checked="checked"' : ''), 'L_MODO_PANEL' => $LANG['modo_panel'], 'L_NAME' => $LANG['name'], 'L_CATEGORY' => $LANG['category'], 'L_VISIBLE' => $MEDIA_LANG['show_media_short'], 'L_UNVISIBLE' => $MEDIA_LANG['hide_media_short'], 'L_UNAPROBED' => $MEDIA_LANG['unaprobed_media_short'], 'L_DELETE' => $LANG['delete'], 'C_NO_MODERATION' => $nbr_media > 0 ? 0 : 1, 'L_NO_MODERATION' => $MEDIA_LANG['no_media_moderate'], 'L_CONFIRM_DELETE' => str_replace('\'', '\\\'', $MEDIA_LANG['confirm_delete_media']), 'L_CONFIRM_DELETE_ALL' => str_replace('\'', '\\\'', $MEDIA_LANG['confirm_delete_media_all']), 'L_LEGEND' => $MEDIA_LANG['legend'], 'L_FILE_UNAPROBED' => $MEDIA_LANG['file_unaprobed'], 'L_FILE_UNVISIBLE' => $MEDIA_LANG['file_unvisible'], 'L_FILE_VISIBLE' => $MEDIA_LANG['file_visible'], 'PAGINATION' => $Pagination->display('moderation_media.php?p=%d', $nbr_media, 'p', NUM_MODO_MEDIA, 3), 'L_SUBMIT' => $LANG['submit'], 'L_RESET' => $LANG['reset'], 'C_ADMIN' => $User->check_level(ADMIN_LEVEL), 'L_RECOUNT_MEDIA' => $MEDIA_LANG['recount_per_cat'], 'JS_ARRAY' => '"' . implode('", "', $js_array) . '"'));
}
$Template->pparse('media_moderation');
require_once '../kernel/footer.php';
 function get_home_page()
 {
     global $Sql, $idartcat, $User, $Cache, $Bread_crumb, $Errorh, $CAT_ARTICLES, $CONFIG_ARTICLES, $LANG;
     require_once '../articles/articles_begin.php';
     $tpl = new Template('articles/articles_cat.tpl');
     if ($idartcat > 0) {
         if (!isset($CAT_ARTICLES[$idartcat]) || $CAT_ARTICLES[$idartcat]['aprob'] == 0) {
             $Errorh->handler('e_auth', E_USER_REDIRECT);
         }
         $cat_links = '';
         foreach ($CAT_ARTICLES as $id => $array_info_cat) {
             if ($CAT_ARTICLES[$idartcat]['id_left'] >= $array_info_cat['id_left'] && $CAT_ARTICLES[$idartcat]['id_right'] <= $array_info_cat['id_right'] && $array_info_cat['level'] <= $CAT_ARTICLES[$idartcat]['level']) {
                 $cat_links .= ' <a href="articles' . url('.php?cat=' . $id, '-' . $id . '.php') . '">' . $array_info_cat['name'] . '</a> &raquo;';
             }
         }
         $clause_cat = " WHERE ac.id_left > '" . $CAT_ARTICLES[$idartcat]['id_left'] . "' AND ac.id_right < '" . $CAT_ARTICLES[$idartcat]['id_right'] . "' AND ac.level = '" . ($CAT_ARTICLES[$idartcat]['level'] + 1) . "' AND ac.aprob = 1";
     } else {
         $cat_links = '';
         $clause_cat = " WHERE ac.level = '0' AND ac.aprob = 1";
     }
     if (!isset($CAT_ARTICLES[$idartcat]) || !$User->check_auth($CAT_ARTICLES[$idartcat]['auth'], READ_CAT_ARTICLES)) {
         $Errorh->handler('e_auth', E_USER_REDIRECT);
     }
     $nbr_articles = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "articles WHERE visible = 1 AND idcat = '" . $idartcat . "'", __LINE__, __FILE__);
     $total_cat = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "articles_cats ac " . $clause_cat, __LINE__, __FILE__);
     $rewrite_title = url_encode_rewrite($CAT_ARTICLES[$idartcat]['name']);
     $nbr_column_cats = $total_cat > $CONFIG_ARTICLES['nbr_column'] ? $CONFIG_ARTICLES['nbr_column'] : $total_cat;
     $nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1;
     $column_width_cats = floor(100 / $nbr_column_cats);
     $is_admin = $User->check_level(ADMIN_LEVEL) ? true : false;
     $tpl->assign_vars(array('IDCAT' => $idartcat, 'C_IS_ADMIN' => $is_admin, 'COLUMN_WIDTH_CAT' => $column_width_cats, 'ADD_ARTICLES' => $is_admin ? (!empty($idartcat) ? '&raquo; ' : '') . '<a href="../articles/admin_articles_add.php"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/add.png" alt="" class="valign_middle" /></a>' : '', 'L_ARTICLES' => $LANG['articles'], 'L_DATE' => $LANG['date'], 'L_VIEW' => $LANG['views'], 'L_NOTE' => $LANG['note'], 'L_COM' => $LANG['com'], 'L_TOTAL_ARTICLE' => $nbr_articles > 0 ? sprintf($LANG['nbr_articles_info'], $nbr_articles) : '', 'L_NO_ARTICLES' => $nbr_articles == 0 ? $LANG['none_article'] : '', 'L_ARTICLES_INDEX' => $LANG['title_articles'], 'L_CATEGORIES' => $CAT_ARTICLES[$idartcat]['level'] >= 0 ? $LANG['sub_categories'] : $LANG['categories'], 'U_ARTICLES_CAT_LINKS' => trim($cat_links, ' &raquo;'), 'U_ARTICLES_ALPHA_TOP' => url('.php?sort=alpha&amp;mode=desc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=alpha&amp;mode=desc'), 'U_ARTICLES_ALPHA_BOTTOM' => url('.php?sort=alpha&amp;mode=asc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=alpha&amp;mode=asc'), 'U_ARTICLES_DATE_TOP' => url('.php?sort=date&amp;mode=desc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=date&amp;mode=desc'), 'U_ARTICLES_DATE_BOTTOM' => url('.php?sort=date&amp;mode=asc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=date&amp;mode=asc'), 'U_ARTICLES_VIEW_TOP' => url('.php?sort=view&amp;mode=desc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=view&amp;mode=desc'), 'U_ARTICLES_VIEW_BOTTOM' => url('.php?sort=view&amp;mode=asc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=view&amp;mode=asc'), 'U_ARTICLES_NOTE_TOP' => url('.php?sort=note&amp;mode=desc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=note&amp;mode=desc'), 'U_ARTICLES_NOTE_BOTTOM' => url('.php?sort=note&amp;mode=asc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=note&amp;mode=asc'), 'U_ARTICLES_COM_TOP' => url('.php?sort=com&amp;mode=desc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=com&amp;mode=desc'), 'U_ARTICLES_COM_BOTTOM' => url('.php?sort=com&amp;mode=asc&amp;cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=com&amp;mode=asc')));
     $get_sort = retrieve(GET, 'sort', '');
     switch ($get_sort) {
         case 'alpha':
             $sort = 'title';
             break;
         case 'date':
             $sort = 'timestamp';
             break;
         case 'view':
             $sort = 'views';
             break;
         case 'note':
             $sort = 'note/' . $CONFIG_ARTICLES['note_max'];
             break;
         case 'com':
             $sort = 'nbr_com';
             break;
         default:
             $sort = 'timestamp';
     }
     $get_mode = retrieve(GET, 'mode', '');
     $mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
     $unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&amp;mode=' . $get_mode : '';
     import('util/pagination');
     $Pagination = new Pagination();
     $unauth_cats_sql = array();
     foreach ($CAT_ARTICLES as $id => $key) {
         if (!$User->check_auth($CAT_ARTICLES[$id]['auth'], READ_CAT_ARTICLES)) {
             $unauth_cats_sql[] = $id;
         }
     }
     $nbr_unauth_cats = count($unauth_cats_sql);
     $clause_unauth_cats = $nbr_unauth_cats > 0 ? " AND ac.id NOT IN (" . implode(', ', $unauth_cats_sql) . ")" : '';
     ##### Catégories disponibles #####
     if ($total_cat > 0) {
         $tpl->assign_vars(array('C_ARTICLES_CAT' => true, 'PAGINATION_CAT' => $Pagination->display('articles' . url('.php' . (!empty($unget) ? $unget . '&amp;' : '?') . 'cat=' . $idartcat . '&amp;pcat=%d', '-' . $idartcat . '-0+' . $rewrite_title . '.php?pcat=%d' . $unget), $total_cat, 'pcat', $CONFIG_ARTICLES['nbr_cat_max'], 3)));
         $i = 0;
         $result = $Sql->query_while("SELECT ac.id, ac.name, ac.contents, ac.icon, ac.nbr_articles_visible AS nbr_articles\n\t\t\tFROM " . PREFIX . "articles_cats ac\n\t\t\t" . $clause_cat . $clause_unauth_cats . "\n\t\t\tORDER BY ac.id_left\n\t\t\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_ARTICLES['nbr_cat_max'], 'pcat'), $CONFIG_ARTICLES['nbr_cat_max']), __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $tpl->assign_block_vars('cat_list', array('IDCAT' => $row['id'], 'CAT' => $row['name'], 'DESC' => $row['contents'], 'ICON_CAT' => !empty($row['icon']) ? '<a href="articles' . url('.php?cat=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php') . '"><img src="' . $row['icon'] . '" alt="" class="valign_middle" /></a><br />' : '', 'EDIT' => $is_admin ? '<a href="admin_articles_cat.php?id=' . $row['id'] . '"><img class="valign_middle" src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="" /></a>' : '', 'L_NBR_ARTICLES' => sprintf($LANG['nbr_articles_info'], $row['nbr_articles']), 'U_CAT' => url('.php?cat=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php')));
         }
         $Sql->query_close($result);
     }
     ##### Affichage des articles #####
     if ($nbr_articles > 0) {
         $tpl->assign_vars(array('C_ARTICLES_LINK' => true, 'PAGINATION' => $Pagination->display('articles' . url('.php' . (!empty($unget) ? $unget . '&amp;' : '?') . 'cat=' . $idartcat . '&amp;p=%d', '-' . $idartcat . '-0-%d+' . $rewrite_title . '.php' . $unget), $nbr_articles, 'p', $CONFIG_ARTICLES['nbr_articles_max'], 3), 'CAT' => $CAT_ARTICLES[$idartcat]['name']));
         import('content/note');
         $result = $Sql->query_while("SELECT id, title, icon, timestamp, views, note, nbrnote, nbr_com\n\t\t\tFROM " . PREFIX . "articles\n\t\t\tWHERE visible = 1 AND idcat = '" . $idartcat . "'\n\t\t\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($CONFIG_ARTICLES['nbr_articles_max'], 'p'), $CONFIG_ARTICLES['nbr_articles_max']), __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $fichier = strlen($row['title']) > 45 ? substr(html_entity_decode($row['title'], ENT_COMPAT, 'ISO-8859-1'), 0, 45) . '...' : $row['title'];
             $tpl->assign_block_vars('articles', array('NAME' => $row['title'], 'ICON' => !empty($row['icon']) ? '<a href="articles' . url('.php?id=' . $row['id'] . '&amp;cat=' . $idartcat, '-' . $idartcat . '-' . $row['id'] . '+' . url_encode_rewrite($fichier) . '.php') . '"><img src="' . $row['icon'] . '" alt="" class="valign_middle" /></a>' : '', 'CAT' => $CAT_ARTICLES[$idartcat]['name'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'COMPT' => $row['views'], 'NOTE' => $row['nbrnote'] > 0 ? Note::display_img($row['note'], $CONFIG_ARTICLES['note_max'], 5) : '<em>' . $LANG['no_note'] . '</em>', 'COM' => $row['nbr_com'], 'U_ARTICLES_LINK' => url('.php?id=' . $row['id'] . '&amp;cat=' . $idartcat, '-' . $idartcat . '-' . $row['id'] . '+' . url_encode_rewrite($fichier) . '.php')));
         }
         $Sql->query_close($result);
     }
     return $tpl->parse(TRUE);
 }
 function _create_row_interface($id_cat, $level, $ajax_mode, &$reference_template)
 {
     global $CONFIG, $LANG, $Session;
     $id_categories = array_keys($this->cache_var);
     $num_cats = count($id_categories);
     $template = $reference_template->copy();
     $template->assign_vars(array('C_AJAX_MODE' => $ajax_mode, 'L_MANAGEMENT_HIDE_CAT' => $LANG['cats_management_hide_cat'], 'L_MANAGEMENT_SHOW_CAT' => $LANG['cats_management_show_cat'], 'L_CONFIRM_DELETE' => $LANG['cats_management_confirm_delete']));
     for ($i = 0; $i < $num_cats; $i++) {
         $id = $id_categories[$i];
         $values =& $this->cache_var[$id];
         if ($id != 0 && $values['id_parent'] == $id_cat) {
             $template->assign_block_vars('categories', array('ID' => $id, 'MARGIN_LEFT' => $level * 50, 'C_DISPLAY_URL' => !empty($this->display_config['url']), 'URL' => empty($this->display_config['url']['rewrited']) ? url(sprintf($this->display_config['url']['unrewrited'], $id)) : (!empty($this->display_config['url']['rewrited']) ? strpos($this->display_config['url']['rewrited'], '%s') !== false ? url(sprintf($this->display_config['url']['unrewrited'], $id), sprintf($this->display_config['url']['rewrited'], $id, url_encode_rewrite($values['name']))) : url(sprintf($this->display_config['url']['unrewrited'], $id), sprintf($this->display_config['url']['rewrited'], $id)) : ''), 'NAME' => $values['name'], 'C_NOT_FIRST_CAT' => $values['order'] > 1, 'ACTION_GO_UP' => $ajax_mode ? url($this->display_config['administration_file_name'] . '?id_up=' . $id . '&amp;token=' . $Session->get_token()) : 'javascript:ajax_move_cat(' . $id . ', \'up\');', 'C_NOT_LAST_CAT' => $i != $num_cats - 1 && $this->cache_var[$id_categories[$i + 1]]['id_parent'] == $id_cat, 'ACTION_GO_DOWN' => $ajax_mode ? url($this->display_config['administration_file_name'] . '?id_down=' . $id . '&amp;token=' . $Session->get_token()) : 'javascript:ajax_move_cat(' . $id . ', \'down\');', 'C_VISIBLE' => $values['visible'], 'ACTION_HIDE' => $ajax_mode ? url($this->display_config['administration_file_name'] . '?hide=' . $id . '&amp;token=' . $Session->get_token()) : 'javascript:ajax_change_cat_visibility(' . $id . ', \'hide\');', 'ACTION_SHOW' => $ajax_mode ? url($this->display_config['administration_file_name'] . '?show=' . $id . '&amp;token=' . $Session->get_token()) : 'javascript:ajax_change_cat_visibility(' . $id . ', \'show\');', 'ACTION_EDIT' => url($this->display_config['administration_file_name'] . '?edit=' . $id), 'ACTION_DELETE' => url($this->display_config['administration_file_name'] . '?del=' . $id . '&amp;token=' . $Session->get_token()), 'CONFIRM_DELETE' => $LANG['cats_management_confirm_delete'], 'NEXT_CATEGORY' => $this->_create_row_interface($id, $level + 1, $ajax_mode, $reference_template)));
             if ($i + 1 < $num_cats && $this->cache_var[$id_categories[$i + 1]]['id_parent'] != $id_cat) {
                 break;
             }
         }
     }
     return $template->parse(TEMPLATE_STRING_MODE);
 }
Exemplo n.º 24
0
        $Errorh->handler('Le module <strong>' . $module_name . '</strong> n\'a pas de fonction get_home_page!', E_USER_ERROR, __LINE__, __FILE__);
        exit;
    }
} elseif (!empty($idnews)) {
    if (empty($news['id'])) {
        $Errorh->handler('e_unexist_news', E_USER_REDIRECT);
    }
    import('content/comments');
    import('content/syndication/feed');
    $tpl_news = new Template('news/news.tpl');
    $next_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id > '" . $idnews . "' " . $Sql->limit(0, 1), __LINE__, __FILE__);
    $previous_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id < '" . $idnews . "' ORDER BY id DESC " . $Sql->limit(0, 1), __LINE__, __FILE__);
    $tpl_news->assign_vars(array('C_IS_ADMIN' => $is_admin, 'C_NEWS_BLOCK' => true, 'C_NEWS_NAVIGATION_LINKS' => true, 'C_PREVIOUS_NEWS' => !empty($previous_news['id']), 'C_NEXT_NEWS' => !empty($next_news['id']), 'TOKEN' => $Session->get_token(), 'PREVIOUS_NEWS' => $previous_news['title'], 'NEXT_NEWS' => $next_news['title'], 'U_PREVIOUS_NEWS' => url('.php?id=' . $previous_news['id'], '-0-' . $previous_news['id'] . '+' . url_encode_rewrite($previous_news['title']) . '.php'), 'U_NEXT_NEWS' => url('.php?id=' . $next_news['id'], '-0-' . $next_news['id'] . '+' . url_encode_rewrite($next_news['title']) . '.php'), 'L_SYNDICATION' => $LANG['syndication'], 'L_ALERT_DELETE_NEWS' => $LANG['alert_delete_news'], 'L_ON' => $LANG['on'], 'L_DELETE' => $LANG['delete'], 'L_EDIT' => $LANG['edit']));
    $tpl_news->assign_block_vars('news', array('C_IMG' => !empty($news['img']), 'C_ICON' => !empty($news['icon']) && $CONFIG_NEWS['activ_icon'] == 1, 'ID' => $news['id'], 'IDCAT' => $news['idcat'], 'ICON' => second_parse_url($news['icon']), 'TITLE' => $news['title'], 'CONTENTS' => second_parse($news['contents']), 'EXTEND_CONTENTS' => second_parse($news['extend_contents']) . '<br /><br />', 'IMG' => second_parse_url($news['img']), 'IMG_DESC' => $news['alt'], 'PSEUDO' => $CONFIG_NEWS['display_author'] ? $news['login'] : '', 'DATE' => $CONFIG_NEWS['display_date'] ? $LANG['on'] . ': ' . gmdate_format('date_format_short', $news['timestamp']) : '', 'U_COM' => $CONFIG_NEWS['activ_com'] == 1 ? Comments::com_display_link($news['nbr_com'], '../news/news' . url('.php?cat=0&amp;id=' . $idnews . '&amp;com=0', '-0-' . $idnews . '+' . url_encode_rewrite($news['title']) . '.php?com=0'), $idnews, 'news') : '', 'U_USER_ID' => url('.php?id=' . $news['user_id'], '-' . $news['user_id'] . '.php'), 'U_NEWS_LINK' => url('.php?id=' . $news['id'], '-0-' . $news['id'] . '+' . url_encode_rewrite($news['title']) . '.php'), 'FEED_MENU' => Feed::get_feed_menu(FEED_URL)));
} elseif (!empty($idcat)) {
    $tpl_news = new Template('news/news_cat.tpl');
    $cat = $Sql->query_array(PREFIX . 'news_cat', 'id', 'name', 'icon', "WHERE id = '" . $idcat . "'", __LINE__, __FILE__);
    if (empty($cat['id'])) {
        $Errorh->handler('error_unexist_cat', E_USER_REDIRECT);
    }
    $tpl_news->assign_vars(array('C_IS_ADMIN' => $is_admin, 'C_NEWS_LINK' => true, 'CAT_NAME' => $cat['name'], 'IDCAT' => $cat['id'], 'L_EDIT' => $LANG['edit'], 'L_CATEGORY' => $LANG['category']));
    $result = $Sql->query_while("SELECT n.id, n.title, n.nbr_com, nc.id AS idcat, nc.icon\n\tFROM " . PREFIX . "news n\n\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\tWHERE n.visible = 1 AND n.idcat = '" . $idcat . "'\n\tORDER BY n.timestamp DESC", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $tpl_news->assign_block_vars('list', array('ICON' => !empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1 ? '<a href="news' . url('.php?cat=' . $row['idcat'], '-' . $row['idcat'] . '.php') . '"><img class="valign_middle" src="' . $row['icon'] . '" alt="" /></a>' : '', 'TITLE' => $row['title'], 'COM' => $row['nbr_com'], 'U_NEWS' => 'news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')));
    }
}
if (isset($_GET['com']) && $idnews > 0) {
    $tpl_news->assign_vars(array('COMMENTS' => display_comments('news', $idnews, url('news.php?id=' . $idnews . '&amp;com=%s', 'news-0-' . $idnews . '.php?com=%s'))));
}
$tpl_news->parse();
require_once '../kernel/footer.php';
Exemplo n.º 25
0
     if ($page_infos['is_cat'] == 0) {
         $Sql->query_inject("UPDATE " . PREFIX . "pages SET contents = '" . pages_parse($contents) . "', count_hits = '" . $count_hits . "', activ_com = '" . $enable_com . "', auth = '" . $page_auth . "', id_cat = '" . $id_cat . "' WHERE id = '" . $id_edit . "'", __LINE__, __FILE__);
         redirect(HOST . DIR . '/pages/' . url('pages.php?title=' . $page_infos['encoded_title'], $page_infos['encoded_title'], '&'));
     } elseif ($page_infos['is_cat'] == 1 && empty($error)) {
         if ($id_cat != $page_infos['id_cat']) {
             $Sql->query_inject("UPDATE " . PREFIX . "pages_cats SET id_parent = '" . $id_cat . "' WHERE id = '" . $page_infos['id_cat'] . "'", __LINE__, __FILE__);
         }
         $Sql->query_inject("UPDATE " . PREFIX . "pages SET contents = '" . pages_parse($contents) . "', count_hits = '" . $count_hits . "', activ_com = '" . $enable_com . "', auth = '" . $page_auth . "' WHERE id = '" . $id_edit . "'", __LINE__, __FILE__);
         $Cache->Generate_module_file('pages');
         redirect(HOST . DIR . '/pages/' . url('pages.php?title=' . $page_infos['encoded_title'], $page_infos['encoded_title'], '&'));
     }
 } elseif (!empty($title)) {
     if (!$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) {
         redirect(HOST . DIR . url('/pages/pages.php?error=e_auth', '', '&'));
     }
     $encoded_title = url_encode_rewrite($title);
     $is_already_page = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "pages WHERE encoded_title = '" . $encoded_title . "'", __LINE__, __FILE__);
     if ($is_already_page == 0) {
         $Sql->query_inject("INSERT INTO " . PREFIX . "pages (title, encoded_title, contents, user_id, count_hits, activ_com, timestamp, auth, is_cat, id_cat) VALUES ('" . $title . "', '" . $encoded_title . "', '" . pages_parse($contents) . "', '" . $User->get_attribute('user_id') . "', '" . $count_hits . "', '" . $enable_com . "', '" . time() . "', '" . $page_auth . "', '" . $is_cat . "', '" . $id_cat . "')", __LINE__, __FILE__);
         if ($is_cat > 0) {
             $last_id_page = $Sql->insert_id("SELECT MAX(id) FROM " . PREFIX . "pages");
             $Sql->query_inject("INSERT INTO " . PREFIX . "pages_cats (id_parent, id_page) VALUES ('" . $id_cat . "', '" . $last_id_page . "')", __LINE__, __FILE__);
             $last_id_pages_cat = $Sql->insert_id("SELECT MAX(id) FROM " . PREFIX . "pages_cats");
             $Sql->query_inject("UPDATE " . PREFIX . "pages SET id_cat = '" . $last_id_pages_cat . "' WHERE id = '" . $last_id_page . "'", __LINE__, __FILE__);
             $Cache->Generate_module_file('pages');
         }
         redirect(HOST . DIR . '/pages/' . url('pages.php?title=' . $encoded_title, $encoded_title, '&'));
     } else {
         $error = 'page_already_exists';
     }
 }
Exemplo n.º 26
0
     $Sql->query_inject("UPDATE " . PREFIX . "wiki_articles SET id_contents = '" . $id_contents . "' WHERE id = '" . $id_edit . "'", __LINE__, __FILE__);
     import('content/syndication/feed');
     Feed::clear_cache('wiki');
     $redirect = $article_infos['encoded_title'];
     redirect(url('wiki.php?title=' . $redirect, $redirect, '', '&'));
 } elseif (!empty($title)) {
     if ($is_cat && !$User->check_auth($_WIKI_CONFIG['auth'], WIKI_CREATE_CAT)) {
         $Errorh->handler('e_auth', E_USER_REDIRECT);
     } elseif (!$is_cat && !$User->check_auth($_WIKI_CONFIG['auth'], WIKI_CREATE_ARTICLE)) {
         $Errorh->handler('e_auth', E_USER_REDIRECT);
     }
     $article_exists = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "wiki_articles WHERE encoded_title = '" . url_encode_rewrite($title) . "'", __LINE__, __FILE__);
     if ($article_exists > 0) {
         $errstr = $LANG['wiki_title_already_exists'];
     } else {
         $Sql->query_inject("INSERT INTO " . PREFIX . "wiki_articles (title, encoded_title, id_cat, is_cat, undefined_status, auth) VALUES ('" . $title . "', '" . url_encode_rewrite($title) . "', '" . $new_id_cat . "', '" . $is_cat . "', '', '')", __LINE__, __FILE__);
         $id_article = $Sql->insert_id("SELECT MAX(id) FROM " . PREFIX . "wiki_articles");
         $Sql->query_inject("INSERT INTO " . PREFIX . "wiki_contents (id_article, menu, content, activ, user_id, user_ip, timestamp) VALUES ('" . $id_article . "', '" . addslashes($menu) . "', '" . $contents . "', 1, " . $User->get_attribute('user_id') . ", '" . USER_IP . "', " . time() . ")", __LINE__, __FILE__);
         $id_contents = $Sql->insert_id("SELECT MAX(id_contents) FROM " . PREFIX . "wiki_contents");
         $cat_update = '';
         if ($is_cat == 1) {
             $Sql->query_inject("INSERT INTO " . PREFIX . "wiki_cats (id_parent, article_id) VALUES (" . $new_id_cat . ", '" . $id_article . "')", __LINE__, __FILE__);
             $id_created_cat = $Sql->insert_id("SELECT MAX(id) FROM " . PREFIX . "wiki_articles");
             $cat_update = ", id_cat = '" . $id_created_cat . "'";
             $Cache->Generate_module_file('wiki');
         }
         $Sql->query_inject("UPDATE " . PREFIX . "wiki_articles SET id_contents = '" . $id_contents . "'" . $cat_update . " WHERE id = " . $id_article, __LINE__, __FILE__);
         import('content/syndication/feed');
         Feed::clear_cache('wiki');
         $redirect = $Sql->query("SELECT encoded_title FROM " . PREFIX . "wiki_articles WHERE id = '" . $id_article . "'", __LINE__, __FILE__);
         redirect(url('wiki.php?title=' . $redirect, $redirect, '', '&'));
Exemplo n.º 27
0
 function get_feed_data_struct($idcat = 0, $name = '')
 {
     global $Cache, $Sql, $LANG, $CONFIG, $CONFIG_FORUM, $CAT_FORUM, $User;
     $_idcat = $idcat;
     require_once PATH_TO_ROOT . '/forum/forum_init_auth_cats.php';
     $idcat = $_idcat;
     $data = new FeedData();
     import('content/syndication/feed_data');
     import('util/date');
     import('util/url');
     $data->set_title($LANG['xml_forum_desc']);
     $data->set_date(new Date());
     $data->set_link(new Url('/syndication.php?m=forum&amp;cat=' . $_idcat));
     $data->set_host(HOST);
     $data->set_desc($LANG['xml_forum_desc']);
     $data->set_lang($LANG['xml_lang']);
     $data->set_auth_bit(READ_CAT_FORUM);
     $req_cats = $idcat > 0 && isset($CAT_FORUM[$idcat]) ? " AND c.id_left >= '" . $CAT_FORUM[$idcat]['id_left'] . "' AND id_right <= '" . $CAT_FORUM[$idcat]['id_right'] . "' " : "";
     $req = "SELECT t.id, t.title, t.last_timestamp, t.last_msg_id, t.display_msg, t.nbr_msg AS t_nbr_msg, msg.id mid, msg.contents, c.auth\n\t\tFROM " . PREFIX . "forum_topics t\n\t\tLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat\n\t\tLEFT JOIN " . PREFIX . "forum_msg msg ON msg.id = t.last_msg_id\n\t\tWHERE c.level != 0 AND c.aprob = 1 " . $req_cats . "\n\t\tORDER BY t.last_timestamp DESC\n\t\t" . $Sql->limit(0, 2 * $CONFIG_FORUM['pagination_msg']);
     $result = $Sql->query_while($req, __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         $item = new FeedItem();
         $last_page = ceil($row['t_nbr_msg'] / $CONFIG_FORUM['pagination_msg']);
         $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
         $last_page = $last_page > 1 ? 'pt=' . $last_page . '&amp;' : '';
         $link = new Url('/forum/topic' . url('.php?' . $last_page . 'id=' . $row['id'], '-' . $row['id'] . $last_page_rewrite . '+' . url_encode_rewrite($row['title']) . '.php') . '#m' . $row['last_msg_id']);
         $item->set_title(($CONFIG_FORUM['activ_display_msg'] && !empty($row['display_msg']) ? html_entity_decode($CONFIG_FORUM['display_msg'], ENT_NOQUOTES, 'ISO-8859-1') . ' ' : '') . ucfirst($row['title']));
         $item->set_link($link);
         $item->set_guid($link);
         $item->set_desc(second_parse($row['contents']));
         $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['last_timestamp']));
         $item->set_auth(unserialize($row['auth']));
         $data->add_item($item);
     }
     $Sql->query_close($result);
     return $data;
 }
Exemplo n.º 28
0
             $unauth_cats[] = $idcat;
         }
     }
 }
 $nbr_unauth_cats = count($unauth_cats_sql);
 $clause_unauth_cats = $nbr_unauth_cats > 0 ? " AND gc.id NOT IN (" . implode(', ', $unauth_cats_sql) . ")" : '';
 ##### Catégorie disponibles #####
 if ($total_cat > 0 && $nbr_unauth_cats < $total_cat && empty($g_idpics)) {
     $Template->assign_vars(array('C_GALLERY_CATS' => true, 'EDIT_CAT' => $is_admin ? '<a href="admin_gallery_cat.php"><img class="valign_middle" src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="" /></a>' : ''));
     $j = 0;
     $result = $Sql->query_while("SELECT gc.id, gc.name, gc.contents, gc.status, (gc.nbr_pics_aprob + gc.nbr_pics_unaprob) AS nbr_pics, gc.nbr_pics_unaprob, g.path\n\t\tFROM " . PREFIX . "gallery_cats gc\n\t\tLEFT JOIN " . PREFIX . "gallery g ON g.idcat = gc.id AND g.aprob = 1\n\t\t" . $clause_cat . $clause_unauth_cats . "\n\t\tGROUP BY gc.id\n\t\tORDER BY gc.id_left\n\t\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_GALLERY['nbr_pics_max'], 'p'), $CONFIG_GALLERY['nbr_pics_max']), __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         if (!file_exists('pics/thumbnails/' . $row['path'])) {
             $Gallery->Resize_pics('pics/' . $row['path']);
         }
         $Template->assign_block_vars('cat_list', array('IDCAT' => $row['id'], 'CAT' => $row['name'], 'DESC' => $row['contents'], 'IMG' => !empty($row['path']) ? '<img src="pics/thumbnails/' . $row['path'] . '" alt="" />' : '', 'EDIT' => $is_admin ? '<a href="admin_gallery_cat.php?id=' . $row['id'] . '"><img class="valign_middle" src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="" /></a>' : '', 'LOCK' => $row['status'] == 0 ? '<img class="valign_middle" src="../templates/' . get_utheme() . '/images/readonly.png" alt="" title="' . $LANG['gallery_lock'] . '" />' : '', 'OPEN_TR' => is_int($j++ / $nbr_column_cats) ? '<tr>' : '', 'CLOSE_TR' => is_int($j / $nbr_column_cats) ? '</tr>' : '', 'L_NBR_PICS' => sprintf($LANG['nbr_pics_info'], $row['nbr_pics']), 'U_CAT' => url('.php?cat=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php')));
     }
     $Sql->query_close($result);
     while (!is_int($j / $nbr_column_cats)) {
         $Template->assign_block_vars('end_table_cats', array('TD_END' => '<td style="margin:15px 0px;width:' . $nbr_column_cats . '%">&nbsp;</td>', 'TR_END' => is_int(++$j / $nbr_column_cats) ? '</tr>' : ''));
     }
 }
 ##### Affichage des photos #####
 if ($nbr_pics > 0) {
     switch ($g_type) {
         case 'name':
             $sort_type = 'g.name';
             break;
         case 'date':
             $sort_type = 'g.timestamp';
             break;
Exemplo n.º 29
0
        }
        $last_page = ceil($nbr_msg / $CONFIG_FORUM['pagination_msg']);
        $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
        $last_page = $last_page > 1 ? '&pt=' . $last_page : '';
        redirect(HOST . DIR . '/forum/topic' . url('.php?id=' . $msg['idtopic'] . $last_page, '-' . $msg['idtopic'] . $last_page_rewrite . '.php', '&') . '#m' . $previous_msg_id);
    } else {
        $Errorh->handler('e_auth', E_USER_REDIRECT);
    }
} elseif (!empty($idt_get)) {
    $Session->csrf_get_protect();
    $topic = $Sql->query_array(PREFIX . 'forum_topics', 'user_id', 'idcat', 'title', 'subtitle', 'nbr_msg', 'last_msg_id', 'first_msg_id', 'last_timestamp', 'status', "WHERE id = '" . $idt_get . "'", __LINE__, __FILE__);
    if (!$User->check_auth($CAT_FORUM[$topic['idcat']]['auth'], READ_CAT_FORUM)) {
        $Errorh->handler('e_auth', E_USER_REDIRECT);
    }
    $rewrited_cat_title = $CONFIG['rewrite'] == 1 ? '+' . url_encode_rewrite($CAT_FORUM[$topic['idcat']]['name']) : '';
    $rewrited_title = $CONFIG['rewrite'] == 1 ? '+' . url_encode_rewrite($topic['title']) : '';
    if ($msg_d) {
        $check_mbr = $Sql->query("SELECT user_id FROM " . PREFIX . "forum_topics WHERE id = '" . $idt_get . "'", __LINE__, __FILE__);
        if (!empty($check_mbr) && $User->get_attribute('user_id') == $check_mbr || $User->check_auth($CAT_FORUM[$topic['idcat']]['auth'], EDIT_CAT_FORUM)) {
            $Sql->query_inject("UPDATE " . PREFIX . "forum_topics SET display_msg = 1 - display_msg WHERE id = '" . $idt_get . "'", __LINE__, __FILE__);
            redirect(HOST . DIR . '/forum/topic' . url('.php?id=' . $idt_get, '-' . $idt_get . $rewrited_title . '.php', '&'));
        } else {
            $Errorh->handler('e_auth', E_USER_REDIRECT);
        }
    } elseif ($poll && $User->get_attribute('user_id') !== -1) {
        $info_poll = $Sql->query_array(PREFIX . 'forum_poll', 'voter_id', 'votes', 'type', "WHERE idtopic = '" . $idt_get . "'", __LINE__, __FILE__);
        if (!in_array($User->get_attribute('user_id'), explode('|', $info_poll['voter_id']))) {
            $add_voter_id = "voter_id = CONCAT(voter_id, '|" . $User->get_attribute('user_id') . "'),";
            $array_votes = explode('|', $info_poll['votes']);
            if ($info_poll['type'] == 0) {
                $id_answer = retrieve(POST, 'forumpoll', 0);
Exemplo n.º 30
0
        while ($row = $Sql->fetch_assoc($result)) {
            if (!empty($row['last_view_id'])) {
                $last_msg_id = $row['last_view_id'];
                $last_page = 'idm=' . $row['last_view_id'] . '&amp;';
                $last_page_rewrite = '-0-' . $row['last_view_id'];
            } else {
                $last_msg_id = $row['last_msg_id'];
                $last_page = ceil($row['t_nbr_msg'] / $CONFIG_FORUM['pagination_msg']);
                $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
                $last_page = $last_page > 1 ? 'pt=' . $last_page . '&amp;' : '';
            }
            $last_topic_title = ($CONFIG_FORUM['activ_display_msg'] && $row['display_msg'] ? $CONFIG_FORUM['display_msg'] : '') . ' ' . ucfirst($row['title']);
            $last_topic_title = strlen(html_entity_decode($last_topic_title, ENT_COMPAT, 'ISO-8859-1')) > 25 ? substr_html($last_topic_title, 0, 25) . '...' : $last_topic_title;
            $last_topic_title = addslashes($last_topic_title);
            $row['login'] = !empty($row['login']) ? $row['login'] : $LANG['guest'];
            $contents .= '<tr><td class="forum_notread" style="width:100%"><a href="topic' . url('.php?' . $last_page . 'id=' . $row['tid'], '-' . $row['tid'] . $last_page_rewrite . '+' . addslashes(url_encode_rewrite($row['title'])) . '.php') . '#m' . $last_msg_id . '"><img src="../templates/' . get_utheme() . '/images/ancre.png" alt="" /></a> <a href="topic' . url('.php?id=' . $row['tid'], '-' . $row['tid'] . '+' . addslashes(url_encode_rewrite($row['title'])) . '.php') . '" class="small_link">' . $last_topic_title . '</a></td><td class="forum_notread" style="white-space:nowrap">' . ($row['last_user_id'] != '-1' ? '<a href="../member/member' . url('.php?id=' . $row['last_user_id'], '-' . $row['last_user_id'] . '.php') . '" class="small_link">' . addslashes($row['login']) . '</a>' : '<em>' . addslashes($LANG['guest']) . '</em>') . '</td><td class="forum_notread" style="white-space:nowrap">' . gmdate_format('date_format', $row['last_timestamp']) . '</td></tr>';
            $nbr_msg_not_read++;
        }
        $Sql->query_close($result);
        $max_visible_topics = 10;
        $height_visible_topics = $nbr_msg_not_read < $max_visible_topics ? 23 * $nbr_msg_not_read : 23 * $max_visible_topics;
        echo "array_unread_topics[0] = '" . $nbr_msg_not_read . "';\n";
        echo "array_unread_topics[1] = '" . '<a class="small_link" href="../forum/unread.php' . SID . '" title="' . addslashes($LANG['show_not_reads']) . '">' . addslashes($LANG['show_not_reads']) . ($User->get_attribute('user_id') !== -1 ? ' (' . $nbr_msg_not_read . ')' : '') . '</a>' . "';\n";
        echo "array_unread_topics[2] = '" . '<div class="row2" style="width:438px;height:' . max($height_visible_topics, 65) . 'px;overflow:auto;padding:0px;" onmouseover="forum_hide_block(\\\'forum_unread\\\', 1);" onmouseout="forum_hide_block(\\\'forum_unread\\\', 0);"><table class="module_table" style="margin:2px;width:99%">' . $contents . "</table></div>';";
    } else {
        echo '';
    }
} elseif (retrieve(GET, 'del', false)) {
    $Session->csrf_get_protect();
    include_once '../forum/forum.class.php';
    $Forumfct = new Forum();