Example #1
0
    }
    $Sql->query_close($result);
    if ($i == 0) {
        $Errorh->handler($LANG['require_cat_create'], E_USER_WARNING);
    }
    $Template->assign_block_vars('news.preview', array('THEME' => get_utheme(), 'TITLE' => $title, 'CONTENTS' => second_parse(stripslashes($contents)), 'EXTEND_CONTENTS' => second_parse(stripslashes($extend_contents)), 'PSEUDO' => $Sql->query("SELECT login FROM " . DB_TABLE_MEMBER . " WHERE user_id = '" . $user_id . "'", __LINE__, __FILE__), 'USER_ID' => url('.php?id=' . $user_id, '-' . $user_id . '.php'), 'IMG_PREVIEW' => $img_displays, 'IMG' => $img_displays, 'DATE' => gmdate_format('date_format_short')));
    $Template->assign_vars(array('TOKEN' => $Session->get_token(), 'KERNEL_EDITOR' => display_editor(), 'KERNEL_EDITOR_EXTEND' => display_editor('extend_contents'), 'L_UNTIL' => $LANG['until'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_REQUIRE_CAT' => $LANG['require_cat'], 'L_PREVIEW' => $LANG['preview'], 'L_COM' => $LANG['com'], 'L_ON' => $LANG['on'], 'L_EDIT_NEWS' => $LANG['edit_news'], 'L_REQUIRE' => $LANG['require'], 'L_NEWS_MANAGEMENT' => $LANG['news_management'], 'L_ADD_NEWS' => $LANG['add_news'], 'L_CONFIG_NEWS' => $LANG['configuration_news'], 'L_CAT_NEWS' => $LANG['category_news'], 'L_TITLE' => $LANG['title'], 'L_CATEGORY' => $LANG['category'], 'L_TEXT' => $LANG['content'], 'L_EXTENDED_NEWS' => $LANG['extended_news'], 'L_RELEASE_DATE' => $LANG['release_date'], 'L_IMMEDIATE' => $LANG['immediate'], 'L_UNAPROB' => $LANG['unaprob'], 'L_NEWS_DATE' => $LANG['news_date'], 'L_UNIT_HOUR' => $LANG['unit_hour'], 'L_AT' => $LANG['at'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_IMG_MANAGEMENT' => $LANG['img_management'], 'L_PREVIEW_IMG' => $LANG['preview_image'], 'L_PREVIEW_IMG_EXPLAIN' => $LANG['preview_image_explain'], 'L_BB_UPLOAD' => $LANG['bb_upload'], 'L_IMG_LINK' => $LANG['img_link'], 'L_IMG_DESC' => $LANG['img_desc'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset']));
    $Template->pparse('admin_news_management');
} else {
    $Template->set_filenames(array('admin_news_management' => 'news/admin_news_management.tpl'));
    $nbr_news = $Sql->count_table('news', __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('TOKEN' => $Session->get_token(), 'PAGINATION' => $Pagination->display('admin_news.php?p=%d', $nbr_news, 'p', 25, 3), 'LANG' => get_ulang(), 'THEME' => get_utheme(), 'L_CONFIRM_DEL_NEWS' => $LANG['confirm_del_news'], 'L_NEWS_MANAGEMENT' => $LANG['news_management'], 'L_ADD_NEWS' => $LANG['add_news'], 'L_CONFIG_NEWS' => $LANG['configuration_news'], 'L_CAT_NEWS' => $LANG['category_news'], 'L_CATEGORY' => $LANG['category'], 'L_TITLE' => $LANG['title'], 'L_PSEUDO' => $LANG['pseudo'], 'L_DATE' => $LANG['date'], 'L_APROB' => $LANG['aprob'], 'L_UPDATE' => $LANG['update'], 'L_DELETE' => $LANG['delete']));
    $Template->assign_block_vars('list', array());
    $result = $Sql->query_while("SELECT nc.name, n.id, n.title, n.timestamp, n.visible, n.start, n.end, m.login\n\t\t\tFROM " . PREFIX . "news n\n\t\t\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = n.user_id\n\t\t\tORDER BY n.timestamp DESC \n\t\t\t" . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        if ($row['visible'] && $row['start'] > time()) {
            $aprob = $LANG['waiting'];
        } elseif ($row['visible'] && $row['start'] < time() && ($row['end'] > time() || empty($row['end']))) {
            $aprob = $LANG['yes'];
        } else {
            $aprob = $LANG['no'];
        }
        $title = html_entity_decode($row['title'], ENT_COMPAT, 'ISO-8859-1');
        $title = strlen($title) > 45 ? substr($title, 0, 45) . '...' : $title;
        $visible = '';
        if ($row['start'] > 0) {
            $visible .= gmdate_format('date_format', $row['start']);
        }
        if ($row['end'] > 0 && $row['start'] > 0) {
Example #2
0
         $sort = 'login';
         break;
     case 'rank':
         $sort = 'level';
         break;
     case 'aprob':
         $sort = 'user_aprob';
         break;
     default:
         $sort = 'timestamp';
 }
 $get_mode = retrieve(GET, 'mode', '');
 $mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
 $unget = !empty($get_sort) && !empty($mode) ? '&amp;sort=' . $get_sort . '&amp;mode=' . $get_mode : '';
 $Template->assign_vars(array('PAGINATION' => $Pagination->display('admin_members.php?p=%d' . $unget, $nbr_membre, 'p', 25, 3), 'THEME' => get_utheme(), 'LANG' => get_ulang(), 'KERNEL_EDITOR' => display_editor(), 'L_REQUIRE_MAIL' => $LANG['require_mail'], 'L_REQUIRE_PASS' => $LANG['require_pass'], 'L_REQUIRE_RANK' => $LANG['require_rank'], 'L_REQUIRE_LOGIN' => $LANG['require_pseudo'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_CONFIRM_DEL_USER' => $LANG['confirm_del_member'], 'L_CONFIRM_DEL_ADMIN' => $LANG['confirm_del_admin'], 'L_CONTENTS' => $LANG['content'], 'L_SUBMIT' => $LANG['submit'], 'L_UPDATE' => $LANG['update'], 'L_USERS_MANAGEMENT' => $LANG['members_management'], 'L_USERS_ADD' => $LANG['members_add'], 'L_USERS_CONFIG' => $LANG['members_config'], 'L_USERS_PUNISHMENT' => $LANG['members_punishment'], 'L_PSEUDO' => $LANG['pseudo'], 'L_PASSWORD' => $LANG['password'], 'L_MAIL' => $LANG['mail'], 'L_RANK' => $LANG['rank'], 'L_APROB' => $LANG['aprob'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_SEARCH_USER' => $LANG['search_member'], 'L_JOKER' => $LANG['joker'], 'L_SEARCH' => $LANG['search'], 'L_WEBSITE' => $LANG['website'], 'L_REGISTERED' => $LANG['registered'], 'L_DELETE' => $LANG['delete']));
 $result = $Sql->query_while("SELECT login, user_id, user_mail, timestamp, user_web, level, user_aprob\n\tFROM " . DB_TABLE_MEMBER . " \n\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
 while ($row = $Sql->fetch_assoc($result)) {
     switch ($row['level']) {
         case 0:
             $rank = $LANG['member'];
             break;
         case 1:
             $rank = $LANG['modo'];
             break;
         case 2:
             $rank = $LANG['admin'];
             break;
         default:
             0;
     }
     $user_web = !empty($row['user_web']) ? '<a href="' . $row['user_web'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/user_web.png" alt="' . $row['user_web'] . '" title="' . $row['user_web'] . '" /></a>' : '';
if (!empty($table) && $action == 'data') {
    import('util/pagination');
    $Pagination = new Pagination();
    $table_structure = $backup->extract_table_structure(array($table));
    $primary_key = '';
    foreach ($table_structure['fields'] as $fields_info) {
        $check_primary_key = false;
        foreach ($table_structure['index'] as $index_info) {
            if ($index_info['type'] == 'PRIMARY KEY' && in_array($fields_info['name'], explode(',', $index_info['fields']))) {
                $primary_key = $fields_info['name'];
                break;
            }
        }
    }
    $nbr_lines = $Sql->query("SELECT COUNT(*) FROM " . $table, __LINE__, __FILE__);
    $query = "SELECT * FROM " . $table . $Sql->limit($Pagination->get_first_msg(30, 'p'), 30);
    $result = $Sql->query_while($query, __LINE__, __FILE__);
    $i = 1;
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('line', array());
        if ($i == 1) {
            $Template->assign_block_vars('line.field', array('FIELD' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'CLASS' => 'row1', 'STYLE' => ''));
            foreach ($row as $field_name => $field_value) {
                $Template->assign_block_vars('line.field', array('FIELD' => '<strong>' . $field_name . '</strong>', 'CLASS' => 'row1'));
            }
            $Template->assign_block_vars('line', array());
        }
        $j = 0;
        foreach ($row as $field_name => $field_value) {
            if ($j == 0 && !empty($primary_key)) {
                $Template->assign_block_vars('line.field', array('FIELD' => '<a href="admin_database_tools.php?table=' . $table . '&amp;field=' . $field_name . '&amp;value=' . $field_value . '&amp;action=update&amp;token=' . $Session->get_token() . '" title="' . $LANG['update'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="" class="valign_middle" /></a> <a href="admin_database_tools.php?table=' . $table . '&amp;field=' . $field_name . '&amp;value=' . $field_value . '&amp;action=delete&amp;token=' . $Session->get_token() . '" onclick="javascript:return Confirm_del_entry()" title="' . $LANG['delete'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/delete.png" alt="" class="valign_middle" /></a>', 'CLASS' => 'row1', 'STYLE' => ''));
Example #4
0
$nbr_com = !empty($module) ? !empty($array_com[$module]) ? $array_com[$module] : 0 : $Sql->count_table('com', __LINE__, __FILE__);
$Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'PAGINATION_COM' => $Pagination->display('admin_com.php?pc=%d', $nbr_com, 'pc', $CONFIG_COM['com_max'], 3), 'L_DISPLAY_RECENT' => $LANG['display_recent_com'], 'L_DISPLAY_TOPIC_COM' => $LANG['display_topic_com'], 'L_CONFIRM_DELETE' => $LANG['alert_delete_msg'], 'L_EDIT' => $LANG['edit'], 'L_DELETE' => $LANG['delete'], 'L_COM' => $LANG['com'], 'L_COM_MANAGEMENT' => $LANG['com_management'], 'L_COM_CONFIG' => $LANG['com_config']));
import('io/filesystem/folder');
$folder_path = new Folder('../');
foreach ($folder_path->get_folders('`^[a-z0-9_ -]+$`i') as $modules) {
    $modulef = $modules->get_name();
    if (@file_exists('../' . $modulef . '/lang/' . get_ulang() . '/config.ini')) {
        $info_module = load_ini_file('../' . $modulef . '/lang/', get_ulang());
        if (isset($info_module['info']) && !empty($info_module['com'])) {
            $Template->assign_block_vars('modules_com', array('MODULES' => $info_module['name'] . (isset($array_com[$info_module['com']]) ? ' (' . $array_com[$info_module['com']] . ')' : ' (0)'), 'U_MODULES' => $info_module['com']));
        }
    }
}
$Cache->load('ranks');
$cond = !empty($module) ? "WHERE script = '" . $module . "'" : '';
$result = $Sql->query_while("SELECT c.idprov, c.idcom, c.login, c.user_id, c.timestamp, c.script, c.path, m.login as mlogin, m.level, m.user_mail, m.user_show_mail, m.timestamp AS registered, m.user_avatar, m.user_msg, m.user_local, m.user_web, m.user_sex, m.user_msn, m.user_yahoo, m.user_sign, m.user_warning, m.user_ban, m.user_groups, s.user_id AS connect, c.contents\nFROM " . DB_TABLE_COM . " c\nLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\nLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = c.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\n" . $cond . "\nGROUP BY c.idcom\nORDER BY c.timestamp DESC\n" . $Sql->limit($Pagination->get_first_msg($CONFIG_COM['com_max'], 'pc'), $CONFIG_COM['com_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
    $row['user_id'] = (int) $row['user_id'];
    $is_guest = $row['user_id'] === -1;
    if (!$is_guest) {
        $com_pseudo = '<a class="msg_link_pseudo" href="../member/member' . url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php') . '" title="' . $row['mlogin'] . '"><span style="font-weight: bold;">' . wordwrap_html($row['mlogin'], 13) . '</span></a>';
    } else {
        $com_pseudo = '<span style="font-style:italic;">' . (!empty($row['login']) ? wordwrap_html($row['login'], 13) : $LANG['guest']) . '</span>';
    }
    $user_rank = $row['level'] === '0' ? $LANG['member'] : $LANG['guest'];
    $user_group = $user_rank;
    if ($row['level'] === '2') {
        $user_rank = $_array_rank[-2][0];
        $user_group = $user_rank;
        $user_rank_icon = $_array_rank[-2][1];
    } elseif ($row['level'] === '1') {
Example #5
0
         $cat_list = '';
         foreach ($array_cat_list as $key_cat => $option_value) {
             $cat_list .= $key_cat == $info_pics['idcat'] ? sprintf($option_value, 'selected="selected"') : sprintf($option_value, '');
         }
         $Template->assign_block_vars('pics.pics_max', array('ID' => $info_pics['id'], 'IMG' => '<img src="show_pics.php?id=' . $idpics . '&amp;cat=' . $idcat . '" alt="" / >', 'NAME' => '<span id="fi_' . $info_pics['id'] . '">' . $info_pics['name'] . '</span> <span id="fi' . $info_pics['id'] . '"></span>', 'POSTOR' => '<a class="com" href="../member/member' . url('.php?id=' . $info_pics['user_id'], '-' . $info_pics['user_id'] . '.php') . '">' . $info_pics['login'] . '</a>', 'DATE' => gmdate_format('date_format_short', $info_pics['timestamp']), 'VIEWS' => $info_pics['views'] + 1, 'DIMENSION' => $info_pics['width'] . ' x ' . $info_pics['height'], 'SIZE' => number_round($info_pics['weight'] / 1024, 1), 'COLSPAN' => $CONFIG_GALLERY['nbr_column'] + 2, 'CAT' => $cat_list, 'RENAME' => addslashes($info_pics['name']), 'RENAME_CUT' => addslashes($info_pics['name']), 'IMG_APROB' => $info_pics['aprob'] == 1 ? 'unvisible.png' : 'visible.png', 'U_DEL' => 'php?del=' . $info_pics['id'] . '&amp;cat=' . $idcat . '&amp;token=' . $Session->get_token(), 'U_MOVE' => '.php?id=' . $info_pics['id'] . '&amp;token=' . $Session->get_token() . '&amp;move=\' + this.options[this.selectedIndex].value', 'U_PREVIOUS' => $pos_pics > 0 ? '<a href="admin_gallery.php?cat=' . $idcat . '&amp;id=' . $id_previous . '#pics_max"><img src="../templates/' . get_utheme() . '/images/left.png" alt="" class="valign_middle" /></a> <a href="admin_gallery.php?cat=' . $idcat . '&amp;id=' . $id_previous . '#pics_max">' . $LANG['previous'] . '</a>' : '', 'U_NEXT' => $pos_pics < $i - 1 ? '<a href="admin_gallery.php?cat=' . $idcat . '&amp;id=' . $id_next . '#pics_max">' . $LANG['next'] . '</a> <a href="admin_gallery.php?cat=' . $idcat . '&amp;id=' . $id_next . '#pics_max"><img src="../templates/' . get_utheme() . '/images/right.png" alt="" class="valign_middle" /></a>' : '', 'U_LEFT_THUMBNAILS' => $pos_pics - $start_thumbnails > 0 ? '<span id="display_left"><a href="javascript:display_thumbnails(\'left\')"><img src="../templates/' . get_utheme() . '/images/left.png" class="valign_middle" alt="" /></a></span>' : '<span id="display_left"></span>', 'U_RIGHT_THUMBNAILS' => $pos_pics - $start_thumbnails <= $i - 1 - $nbr_column_pics ? '<span id="display_right"><a href="javascript:display_thumbnails(\'right\')"><img src="../templates/' . get_utheme() . '/images/right.png" class="valign_middle" alt="" /></a></span>' : '<span id="display_right"></span>'));
         $i = 0;
         foreach ($array_pics as $pics) {
             if ($i >= $pos_pics - $start_thumbnails && $i <= $pos_pics + $end_thumbnails) {
                 $Template->assign_block_vars('pics.pics_max.list_preview_pics', array('PICS' => $pics));
             }
             $i++;
         }
     }
 } else {
     $j = 0;
     $result = $Sql->query_while("SELECT g.id, g.idcat, g.name, g.path, g.timestamp, g.aprob, g.width, g.height, m.login, m.user_id\n\t\t\tFROM " . PREFIX . "gallery g\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\t\t\tWHERE g.idcat = '" . $idcat . "' \n\t\t\tORDER BY g.timestamp \n\t\t\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_GALLERY['nbr_pics_max'], 'pp'), $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']);
         }
         $name_cut = strlen(html_entity_decode($row['name'], ENT_COMPAT, 'ISO-8859-1')) > 22 ? htmlentities(substr(html_entity_decode($row['name'], ENT_COMPAT, 'ISO-8859-1'), 0, 22), ENT_COMPAT, 'ISO-8859-1') . '...' : $row['name'];
         $name = html_entity_decode($row['name'], ENT_COMPAT, 'ISO-8859-1');
         $name = strlen($name) > 20 ? substr($name, 0, 20) . '...' : $name;
         $tr_start = is_int($j / $nbr_column_pics) ? '<tr>' : '';
         $j++;
         $tr_end = is_int($j / $nbr_column_pics) ? '</tr>' : '';
         if ($CONFIG_GALLERY['display_pics'] == 3) {
             $display_link = HOST . DIR . '/gallery/show_pics' . url('.php?id=' . $row['id'] . '&amp;cat=' . $row['idcat']);
         } elseif ($CONFIG_GALLERY['display_pics'] == 2) {
             $display_link = 'javascript:display_pics_popup(\'' . HOST . DIR . '/gallery/show_pics' . url('.php?id=' . $row['id'] . '&amp;cat=' . $row['idcat']) . '\', \'' . $row['width'] . '\', \'' . $row['height'] . '\')';
         } elseif ($CONFIG_GALLERY['display_pics'] == 1) {
Example #6
0
    $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();
    $Template->assign_vars(array('PAGINATION' => $Pagination->display('web' . url('.php' . (!empty($unget) ? $unget . '&amp;' : '?') . 'cat=' . $idcat . '&amp;p=%d', '-' . $idcat . '-0-%d.php' . (!empty($unget) ? '?' . $unget : '')), $nbr_web, 'p', $CONFIG_WEB['nbr_web_max'], 3)));
    import('content/note');
    $result = $Sql->query_while("SELECT id, title, timestamp, compt, note, nbrnote, nbr_com\n\tFROM " . PREFIX . "web\n\tWHERE aprob = 1 AND idcat = '" . $idcat . "'\n\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($CONFIG_WEB['nbr_web_max'], 'p'), $CONFIG_WEB['nbr_web_max']), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $row['title'] = strlen($row['title']) > 45 ? substr(html_entity_decode($row['title'], ENT_COMPAT, 'ISO-8859-1'), 0, 45) . '...' : $row['title'];
        $Template->assign_block_vars('web', array('NAME' => $row['title'], 'CAT' => $CAT_WEB[$idcat]['name'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'COMPT' => $row['compt'], 'NOTE' => $row['nbrnote'] > 0 ? Note::display_img($row['note'], $CONFIG_WEB['note_max']) : '<em>' . $LANG['no_note'] . '</em>', 'COM' => $row['nbr_com'], 'U_WEB_LINK' => url('.php?cat=' . $idcat . '&amp;id=' . $row['id'], '-' . $idcat . '-' . $row['id'] . '.php')));
    }
    $Sql->query_close($result);
    $Template->pparse('web');
} else {
    $Template->set_filenames(array('web' => 'web/web.tpl'));
    $total_link = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "web_cat wc\n\tLEFT JOIN " . PREFIX . "web w ON w.idcat = wc.id\n\tWHERE w.aprob = 1 AND wc.aprob = 1 AND wc.secure <= '" . $User->get_attribute('level') . "'", __LINE__, __FILE__);
    $total_cat = $Sql->query("SELECT COUNT(*) as compt FROM " . PREFIX . "web_cat WHERE aprob = 1 AND secure <= '" . $User->get_attribute('level') . "'", __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $CONFIG_WEB['nbr_column'] = $total_cat > $CONFIG_WEB['nbr_column'] ? $CONFIG_WEB['nbr_column'] : $total_cat;
    $CONFIG_WEB['nbr_column'] = !empty($CONFIG_WEB['nbr_column']) ? $CONFIG_WEB['nbr_column'] : 1;
    $Template->assign_vars(array('C_WEB_CAT' => true, 'C_IS_ADMIN' => $User->check_level(ADMIN_LEVEL), 'PAGINATION' => $Pagination->display('web' . url('.php?p=%d', '-0-0-%d.php'), $total_cat, 'p', $CONFIG_WEB['nbr_cat_max'], 3), 'TOTAL_FILE' => $total_link, 'L_CATEGORIES' => $LANG['categories'], 'L_PROPOSE_LINK' => $LANG['propose_link'], 'L_HOW_LINK' => $LANG['how_link'], 'U_WEB_ADD' => url('.php?web=true')));
    $column_width = floor(100 / $CONFIG_WEB['nbr_column']);
    $result = $Sql->query_while("SELECT aw.id, aw.name, aw.contents, aw.icon, COUNT(w.id) as count\n\tFROM " . PREFIX . "web_cat aw\n\tLEFT JOIN " . PREFIX . "web w ON w.idcat = aw.id AND w.aprob = 1\n\tWHERE aw.aprob = 1 AND aw.secure <= '" . $User->get_attribute('level') . "'\n\tGROUP BY aw.id\n\tORDER BY aw.class\n\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_WEB['nbr_cat_max'], 'p'), $CONFIG_WEB['nbr_cat_max']), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('cat_list', array('WIDTH' => $column_width, 'TOTAL' => $row['count'], 'CAT' => $row['name'], 'CONTENTS' => $row['contents'], 'U_IMG_CAT' => !empty($row['icon']) ? '<a href="../web/web' . url('.php?cat=' . $row['id'], '-' . $row['id'] . '.php') . '"><img src="' . $row['icon'] . '" alt="" /></a><br />' : '', 'U_WEB_CAT' => url('.php?cat=' . $row['id'], '-' . $row['id'] . '.php')));
    }
    $Sql->query_close($result);
    $Template->pparse('web');
}
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);
 }
Example #8
0
require_once '../kernel/header.php';
$view_msg = retrieve(GET, 'id', 0);
if (!empty($view_msg)) {
    $Template->set_filenames(array('membermsg' => 'forum/forum_membermsg.tpl', 'forum_top' => 'forum/forum_top.tpl', 'forum_bottom' => 'forum/forum_bottom.tpl'));
    import('util/pagination');
    $Pagination = new Pagination();
    $auth_cats = '';
    foreach ($CAT_FORUM as $idcat => $key) {
        if (!$User->check_auth($CAT_FORUM[$idcat]['auth'], READ_CAT_FORUM)) {
            $auth_cats .= $idcat . ',';
        }
    }
    $auth_cats = !empty($auth_cats) ? " AND c.id NOT IN (" . trim($auth_cats, ',') . ")" : '';
    $nbr_msg = $Sql->query("SELECT COUNT(*)\n\tFROM " . PREFIX . "forum_msg msg\n\tLEFT JOIN " . PREFIX . "forum_topics t ON msg.idtopic = t.id\n\tJOIN " . PREFIX . "forum_cats c ON t.idcat = c.id AND c.aprob = 1" . $auth_cats . "\n\tWHERE msg.user_id = '" . $view_msg . "'", __LINE__, __FILE__);
    $Template->assign_vars(array('SID' => SID, 'THEME' => get_utheme(), 'LANG' => get_ulang(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('forum'), 'FORUM_NAME' => $CONFIG_FORUM['forum_name'] . ' : ' . $LANG['show_member_msg'], 'PAGINATION' => $Pagination->display('membermsg' . url('.php?id=' . $view_msg . '&amp;p=%d'), $nbr_msg, 'p', 10, 3), 'L_BACK' => $LANG['back'], 'L_VIEW_MSG_USER' => $LANG['show_member_msg'], 'L_FORUM_INDEX' => $LANG['forum_index'], 'U_FORUM_VIEW_MSG' => url('.php?id=' . $view_msg)));
    $result = $Sql->query_while("SELECT msg.id, msg.user_id, msg.idtopic, msg.timestamp, msg.timestamp_edit, m.user_groups, t.title, t.status, t.idcat, c.name, m.login, m.level, m.user_mail, m.user_show_mail, m.timestamp AS registered, m.user_avatar, m.user_msg, m.user_local, m.user_web, m.user_sex, m.user_msn, m.user_yahoo, m.user_sign, m.user_warning, m.user_ban, s.user_id AS connect, msg.contents\n\tFROM " . PREFIX . "forum_msg msg\n\tLEFT JOIN " . PREFIX . "forum_topics t ON msg.idtopic = t.id\n\tJOIN " . PREFIX . "forum_cats c ON t.idcat = c.id AND c.aprob = 1\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = '" . $view_msg . "'\n\tLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = msg.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\n\tWHERE msg.user_id = '" . $view_msg . "'" . $auth_cats . "\n\tORDER BY msg.id DESC\n\t" . $Sql->limit($Pagination->get_first_msg(10, 'p'), 10), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $user_online = !empty($row['connect']) ? 'online' : 'offline';
        $rewrited_cat_title = $CONFIG['rewrite'] == 1 ? '+' . url_encode_rewrite($row['name']) : '';
        $rewrited_title = $CONFIG['rewrite'] == 1 ? '+' . url_encode_rewrite($row['title']) : '';
        $edit_mark = $row['timestamp_edit'] > 0 && $CONFIG_FORUM['edit_mark'] == '0' ? '<br /><br /><br /><span style="padding: 10px;font-size:10px;font-style:italic;">' . $LANG['edit_by'] . ' <a class="edit_pseudo" href="../member/member' . url('.php?id=' . $row['user_id_edit'], '-' . $row['user_id_edit'] . '.php') . '">' . $row['login_edit'] . '</a> ' . $LANG['on'] . ' ' . gmdate_format('date_format', $row['timestamp_edit']) . '</span><br />' : '';
        $Template->assign_block_vars('list', array('CONTENTS' => second_parse($row['contents']), 'DATE' => $LANG['on'] . ' ' . gmdate_format('date_format', $row['timestamp']), 'ID' => $row['id'], 'USER_ONLINE' => '<img src="../templates/' . get_utheme() . '/images/' . (!empty($row['connect']) ? 'online' : 'offline') . '.png" alt="" class="valign_middle" />', 'USER_PSEUDO' => !empty($row['login']) ? wordwrap(html_entity_decode($row['login'], ENT_COMPAT, 'ISO-8859-1'), 13, '<br />', 1) : $LANG['guest'], 'U_USER_ID' => url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php'), 'U_USER_ID' => url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php'), 'U_VARS_ANCRE' => url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . $rewrited_title . '.php'), 'U_FORUM_CAT' => '<a class="forum_mbrmsg_links" href="../forum/forum' . url('.php?id=' . $row['idcat'], '-' . $row['idcat'] . $rewrited_cat_title . '.php') . '">' . $row['name'] . '</a>', 'U_TITLE_T' => '<a class="forum_mbrmsg_links" href="../forum/topic' . url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . $rewrited_title . '.php') . '">' . ucfirst($row['title']) . '</a>'));
    }
    $Sql->query_close($result);
    list($users_list, $total_admin, $total_modo, $total_member, $total_visit, $total_online) = forum_list_user_online("AND s.session_script LIKE '" . DIR . "/forum/%'");
    $Template->assign_vars(array('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, '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('membermsg');
} else {
    redirect(HOST . DIR . '/forum/index.php');
}
require_once '../kernel/footer.php';
 function get_home_page()
 {
     global $User, $Sql, $Cache, $Bread_crumb, $CONFIG_NEWS, $LANG, $Session;
     require_once PATH_TO_ROOT . '/news/news_begin.php';
     $show_archive = retrieve(GET, 'arch', false);
     $is_admin = $User->check_level(ADMIN_LEVEL);
     $tpl_news = new Template('news/news.tpl');
     if ($CONFIG_NEWS['activ_edito'] == 1) {
         $tpl_news->assign_vars(array('C_NEWS_EDITO' => true, 'CONTENTS' => second_parse($CONFIG_NEWS['edito']), 'TITLE' => $CONFIG_NEWS['edito_title']));
     }
     import('content/comments');
     import('content/syndication/feed');
     import('util/pagination');
     $Pagination = new Pagination();
     if ($CONFIG_NEWS['activ_pagin'] == '1') {
         $show_pagin = $Pagination->display(PATH_TO_ROOT . '/news/news' . url('.php?p=%d', '-0-0-%d.php'), $CONFIG_NEWS['nbr_news'], 'p', $CONFIG_NEWS['pagination_news'], 3);
         $first_msg = $Pagination->get_first_msg($CONFIG_NEWS['pagination_news'], 'p');
     } elseif ($show_archive) {
         $show_pagin = $Pagination->display(PATH_TO_ROOT . '/news/news' . url('.php?arch=1&amp;p=%d', '-0-0-%d.php?arch=1'), $CONFIG_NEWS['nbr_news'] - $CONFIG_NEWS['pagination_news'], 'p', $CONFIG_NEWS['pagination_arch'], 3);
         $first_msg = $CONFIG_NEWS['pagination_news'] + $Pagination->get_first_msg($CONFIG_NEWS['pagination_arch'], 'p');
         $CONFIG_NEWS['pagination_news'] = $CONFIG_NEWS['pagination_arch'];
     } else {
         $show_pagin = $CONFIG_NEWS['nbr_news'] > $CONFIG_NEWS['pagination_news'] && $CONFIG_NEWS['nbr_news'] != 0 ? '<a href="' . PATH_TO_ROOT . '/news/news.php?arch=1" title="' . $LANG['display_archive'] . '">' . $LANG['display_archive'] . '</a>' : '';
         $first_msg = 0;
     }
     $tpl_news->assign_vars(array('C_IS_ADMIN' => $is_admin, 'C_NEWS_NAVIGATION_LINKS' => false, 'L_SYNDICATION' => $LANG['syndication'], 'PAGINATION' => $show_pagin, 'L_ALERT_DELETE_NEWS' => $LANG['alert_delete_news'], 'L_LAST_NEWS' => !$show_archive ? $LANG['last_news'] : $LANG['archive'], 'PATH_TO_ROOT' => TPL_PATH_TO_ROOT, 'THEME' => get_utheme(), 'FEED_MENU' => Feed::get_feed_menu(FEED_URL)));
     if ($CONFIG_NEWS['type'] == 1 && !$show_archive) {
         $tpl_news->assign_vars(array('C_NEWS_BLOCK' => true));
         $column = $CONFIG_NEWS['nbr_column'] > 1 ? true : false;
         if ($column) {
             $i = 0;
             $CONFIG_NEWS['nbr_column'] = !empty($CONFIG_NEWS['nbr_column']) ? $CONFIG_NEWS['nbr_column'] : 1;
             $column_width = floor(100 / $CONFIG_NEWS['nbr_column']);
             $tpl_news->assign_vars(array('C_NEWS_BLOCK_COLUMN' => true, 'COLUMN_WIDTH' => $column_width));
         }
         $z = 0;
         list($admin, $del) = array('', '');
         $result = $Sql->query_while("SELECT n.contents, n.extend_contents, n.title, n.id, n.timestamp, n.user_id, n.img, n.alt, n.nbr_com, nc.id AS idcat, nc.icon, m.login\n\t\t\tFROM " . PREFIX . "news n\n\t\t\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = n.user_id\n\t\t\tWHERE '" . time() . "' >= n.start AND ('" . time() . "' <= n.end OR n.end = 0) AND n.visible = 1\n\t\t\tORDER BY n.timestamp DESC\n\t\t\t" . $Sql->limit($first_msg, $CONFIG_NEWS['pagination_news']), __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $new_row = false;
             if ($column) {
                 $new_row = $i % $CONFIG_NEWS['nbr_column'] == 0 && $i > 0;
                 $i++;
             }
             $tpl_news->assign_block_vars('news', array('C_IMG' => !empty($row['img']), 'C_ICON' => !empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1, 'C_NEWS_ROW' => $new_row, 'ID' => $row['id'], 'IDCAT' => $row['idcat'], 'ICON' => second_parse_url($row['icon']), 'TITLE' => $row['title'], 'CONTENTS' => second_parse($row['contents']), 'EXTEND_CONTENTS' => !empty($row['extend_contents']) ? '<a style="font-size:10px" href="' . PATH_TO_ROOT . '/news/news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '.php') . '">[' . $LANG['extend_contents'] . ']</a><br /><br />' : '', 'IMG' => second_parse_url($row['img']), 'IMG_DESC' => $row['alt'], 'PSEUDO' => $CONFIG_NEWS['display_author'] ? $row['login'] : '', 'DATE' => $CONFIG_NEWS['display_date'] ? $LANG['on'] . ': ' . gmdate_format('date_format_short', $row['timestamp']) : '', 'TOKEN' => $Session->get_token(), 'U_COM' => $CONFIG_NEWS['activ_com'] == 1 ? Comments::com_display_link($row['nbr_com'], PATH_TO_ROOT . '/news/news' . url('.php?cat=0&amp;id=' . $row['id'] . '&amp;com=0', '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php?com=0'), $row['id'], 'news') : '', 'NEW_ROW' => $new_row, 'U_USER_ID' => url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php'), 'U_NEWS_LINK' => url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'), 'FEED_MENU' => Feed::get_feed_menu(FEED_URL)));
             $z++;
         }
         $Sql->query_close($result);
         if ($z == 0) {
             $tpl_news->assign_vars(array('C_NEWS_NO_AVAILABLE' => true, 'L_NO_NEWS_AVAILABLE' => $LANG['no_news_available']));
         }
     } else {
         $tpl_news->assign_vars(array('C_NEWS_LINK' => true));
         $column = $CONFIG_NEWS['nbr_column'] > 1 ? true : false;
         if ($column) {
             $i = 0;
             $CONFIG_NEWS['nbr_column'] = !empty($CONFIG_NEWS['nbr_column']) ? $CONFIG_NEWS['nbr_column'] : 1;
             $column_width = floor(100 / $CONFIG_NEWS['nbr_column']);
             $tpl_news->assign_vars(array('C_NEWS_LINK_COLUMN' => true, 'COLUMN_WIDTH' => $column_width));
         }
         $result = $Sql->query_while("SELECT n.id, n.title, n.timestamp, nc.id AS idcat, nc.icon\n\t\t\tFROM " . PREFIX . "news n\n\t\t\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\t\t\tWHERE n.visible = 1\n\t\t\tORDER BY n.timestamp DESC\n\t\t\t" . $Sql->limit($first_msg, $CONFIG_NEWS['pagination_news']), __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $new_row = false;
             if ($column) {
                 $new_row = $i % $CONFIG_NEWS['nbr_column'] == 0 && $i > 0;
                 $i++;
             }
             $tpl_news->assign_block_vars('list', array('C_NEWS_ROW' => $new_row, 'ICON' => !empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1 ? '<a href="' . PATH_TO_ROOT . '/news/news' . url('.php?cat=' . $row['idcat'], '-' . $row['idcat'] . '.php') . '"><img class="valign_middle" src="' . $row['icon'] . '" alt="" /></a>' : '', 'DATE' => gmdate_format('date_format_tiny', $row['timestamp']), 'TITLE' => $row['title'], 'NEW_ROW' => $new_row, 'U_NEWS' => PATH_TO_ROOT . '/news/news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')));
         }
         $Sql->query_close($result);
     }
     return $tpl_news->parse(TRUE);
 }
Example #10
0
<?php

require_once '../kernel/begin.php';
require_once '../online/online_begin.php';
require_once '../kernel/header.php';
$Template->set_filenames(array('online' => 'online/online.tpl'));
$nbr_member = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_SESSIONS . " WHERE level <> -1 AND session_time > '" . (time() - $CONFIG['site_session_invit']) . "'", __LINE__, __FILE__);
import('util/pagination');
$Pagination = new Pagination();
$Template->assign_vars(array('PAGINATION' => $Pagination->display('online' . url('.php?p=%d'), $nbr_member, 'p', 25, 3), 'L_LOGIN' => $LANG['pseudo'], 'L_LOCATION' => $LANG['location'], 'L_LAST_UPDATE' => $LANG['last_update'], 'L_ONLINE' => $LANG['online']));
$result = $Sql->query_while("SELECT s.user_id, s.level, s.session_time, s.session_script, s.session_script_get, \ns.session_script_title, m.login\nFROM " . DB_TABLE_SESSIONS . " s\nJOIN " . DB_TABLE_MEMBER . " m ON (m.user_id = s.user_id)\nWHERE s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\nORDER BY " . $CONFIG_ONLINE['display_order_online'] . "\n" . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
    switch ($row['level']) {
        case 0:
            $status = 'member';
            break;
        case 1:
            $status = 'modo';
            break;
        case 2:
            $status = 'admin';
            break;
        default:
            $status = 'member';
    }
    $row['session_script_get'] = !empty($row['session_script_get']) ? '?' . $row['session_script_get'] : '';
    $Template->assign_block_vars('users', array('USER' => !empty($row['login']) ? '<a href="' . HOST . '/member/member.php?id=' . $row['user_id'] . '" class="' . $status . '">' . $row['login'] . '</a>' : $LANG['guest'], 'LOCATION' => '<a href="' . HOST . DIR . $row['session_script'] . $row['session_script_get'] . '">' . stripslashes($row['session_script_title']) . '</a>', 'LAST_UPDATE' => gmdate_format('date_format_long', $row['session_time'])));
}
$Sql->query_close($result);
$Template->pparse('online');
require_once '../kernel/footer.php';
Example #11
0
    $Template->assign_block_vars('article', array('L_TITLE' => $LANG['wiki_history'] . ': <a href="' . $article_infos['encoded_title'] . '">' . $article_infos['title'] . '</a>'));
    $general_auth = empty($article_infos['auth']) ? true : false;
    $article_auth = !empty($article_infos['auth']) ? unserialize($article_infos['auth']) : array();
    $restore_auth = (!$general_auth || $User->check_auth($_WIKI_CONFIG['auth'], WIKI_RESTORE_ARCHIVE)) && ($general_auth || $User->check_auth($article_auth, WIKI_RESTORE_ARCHIVE)) ? true : false;
    $delete_auth = (!$general_auth || $User->check_auth($_WIKI_CONFIG['auth'], WIKI_DELETE_ARCHIVE)) && ($general_auth || $User->check_auth($article_auth, WIKI_DELETE_ARCHIVE)) ? true : false;
    $result = $Sql->query_while("SELECT a.title, a.encoded_title, c.timestamp, c.id_contents, c.user_id, c.user_ip, m.login, c.id_article, c.activ\n\t\tFROM " . PREFIX . "wiki_contents c\n\t\tLEFT JOIN " . PREFIX . "wiki_articles a ON a.id = c.id_article\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\n\t\tWHERE c.id_article = '" . $id_article . "'\n\t\tORDER BY c.timestamp DESC", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $actions = $row['activ'] != 1 && $restore_auth ? '<a href="' . url('action.php?restore=' . $row['id_contents'] . '&amp;token=' . $Session->get_token()) . '" title="' . $LANG['wiki_restore_version'] . '"><img src="templates/images/restore.png" alt="' . $LANG['wiki_restore_version'] . '" /></a> &nbsp; ' : '';
        $actions .= $row['activ'] != 1 && $delete_auth ? '<a href="' . url('action.php?del_contents=' . $row['id_contents'] . '&amp;token=' . $Session->get_token()) . '" title="' . $LANG['delete'] . '" onclick="javascript: return confirm(\'' . str_replace('\'', '\\\'', $LANG['wiki_confirm_delete_archive']) . '\');"><img src="' . $Template->get_module_data_path('wiki') . '/images/delete.png" alt="' . $LANG['delete'] . '" /></a>' : '';
        $Template->assign_block_vars('article.list', array('TITLE' => $LANG['wiki_consult_article'], 'AUTHOR' => !empty($row['login']) ? '<a href="../member/member' . url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php') . '">' . $row['login'] . '</a>' : $row['user_ip'], 'DATE' => gmdate_format('date_format', $row['timestamp']), 'U_ARTICLE' => $row['activ'] == 1 ? url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title']) : url('wiki.php?id_contents=' . $row['id_contents']), 'CURRENT_RELEASE' => $row['activ'] == 1 ? '(' . $LANG['wiki_current_version'] . ')' : '', 'ACTIONS' => !empty($actions) ? $actions : $LANG['wiki_no_possible_action']));
    }
    $Sql->query_close($result);
    $Template->assign_vars(array('L_VERSIONS' => $LANG['wiki_version_list'], 'L_DATE' => $LANG['date'], 'L_AUTHOR' => $LANG['wiki_author'], 'L_ACTIONS' => $LANG['wiki_possible_actions']));
    $Template->pparse('wiki_history');
} else {
    $_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY = 25;
    $field = $field == 'title' ? 'title' : 'timestamp';
    $order = $order == 'asc' ? 'asc' : 'desc';
    $nbr_articles = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "wiki_articles WHERE redirect = '0'", __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $show_pagin = $Pagination->display(url('history.php?field=' . $field . '&amp;order=' . $order . '&amp;p=%d'), $nbr_articles, 'p', $_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY, 3);
    $Template->set_filenames(array('wiki_history' => 'wiki/history.tpl'));
    $Template->assign_block_vars('index', array('L_HISTORY' => $LANG['wiki_history'], 'L_TITLE' => $LANG['wiki_article_title'], 'L_AUTHOR' => $LANG['wiki_author'], 'L_DATE' => $LANG['date'], 'ARROW_TOP_TITLE' => $field == 'title' && $order == 'asc' ? '' : '<a href="' . url('history.php?p=' . $Pagination->page . '&amp;field=title&amp;order=asc') . '"><img src="../templates/' . get_utheme() . '/images/top.png" alt="asc" /></a>', 'ARROW_BOTTOM_TITLE' => $field == 'title' && $order == 'desc' ? '' : '<a href="' . url('history.php?p=' . $Pagination->page . '&amp;field=title&amp;order=desc') . '"><img src="../templates/' . get_utheme() . '/images/bottom.png" alt="desc" /></a>', 'ARROW_TOP_DATE' => $field == 'timestamp' && $order == 'asc' ? '' : '<a href="' . url('history.php?p=' . $Pagination->page . '&amp;field=timestamp&amp;order=asc') . '"><img src="../templates/' . get_utheme() . '/images/top.png" alt="asc" /></a>', 'ARROW_BOTTOM_DATE' => $field == 'timestamp' && $order == 'desc' ? '' : '<a href="' . url('history.php?p=' . $Pagination->page . '&amp;field=timestamp&amp;order=desc') . '"><img src="../templates/' . get_utheme() . '/images/bottom.png" alt="desc" /></a>', 'PAGINATION' => $nbr_articles > $_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY ? $show_pagin : ''));
    $result = $Sql->query_while("SELECT a.title, a.encoded_title, c.timestamp, c.id_contents AS id, c.user_id, c.user_ip, m.login, c.id_article, c.activ,  a.id_contents\n\t\tFROM " . PREFIX . "wiki_articles a\n\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\n\t\tWHERE a.redirect = 0\n\t\tORDER BY " . ($field == 'title' ? 'a' : 'c') . "." . $field . " " . $order . "\n\t\t" . $Sql->limit($Pagination->get_first_msg($_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY, 'p'), $_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('index.list', array('TITLE' => $row['title'], 'AUTHOR' => !empty($row['login']) ? '<a href="../member/member' . url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php') . '">' . $row['login'] . '</a>' : $row['user_ip'], 'DATE' => gmdate_format('date_format', $row['timestamp']), 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title'])));
    }
    $Template->pparse('wiki_history');
}
require_once '../kernel/footer.php';
Example #12
0
$page = retrieve(GET, 'p', 0);
if (retrieve(POST, 'submit', false)) {
    $FAQ_CONFIG['faq_name'] = stripslashes(retrieve(POST, 'faq_name', $FAQ_LANG['faq']));
    $FAQ_CONFIG['num_cols'] = retrieve(POST, 'num_cols', 3);
    $FAQ_CONFIG['display_block'] = !empty($_POST['display_mode']) && $_POST['display_mode'] == 'inline' ? false : true;
    $FAQ_CONFIG['global_auth'] = Authorizations::build_auth_array_from_form(AUTH_READ, AUTH_WRITE);
    $FAQ_CONFIG['root'] = $FAQ_CATS[0];
    $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($FAQ_CONFIG)) . "' WHERE name = 'faq'", __LINE__, __FILE__);
    $Cache->Generate_module_file('faq');
    redirect(url('admin_faq.php', '', '&'));
}
if ($page > 0) {
    $Template->set_filenames(array('admin_faq_questions' => 'faq/admin_faq_questions.tpl'));
    import('util/pagination');
    $Pagination = new Pagination();
    $result = $Sql->query_while("SELECT q.id, q.question, q.timestamp, q.idcat, c.name\n\tFROM " . PREFIX . "faq q\n\tLEFT JOIN " . PREFIX . "faq_cats c ON c.id = q.idcat\n\tORDER BY q.timestamp DESC\n\t" . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
    $nbr_questions = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "faq", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('question', array('QUESTION' => $row['question'], 'CATEGORY' => !empty($row['idcat']) ? $row['name'] : $LANG['root'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'U_QUESTION' => url('faq.php?id=' . $row['idcat'] . '&amp;question=' . $row['id'], 'faq-' . $row['idcat'] . '+' . url_encode_rewrite($row['name']) . '.php?question=' . $row['id']) . '#q' . $row['id'], 'U_CATEGORY' => !empty($row['idcat']) ? url('faq.php?id=' . $row['idcat'], 'faq-' . $row['idcat'] . '+' . url_encode_rewrite($row['name']) . '.php') : url('faq.php')));
    }
    $Template->assign_vars(array('PAGINATION' => $Pagination->display('admin_faq.php?p=%d', $nbr_questions, 'p', 25, 3), 'L_QUESTION' => $FAQ_LANG['question'], 'L_CATEGORY' => $FAQ_LANG['category'], 'L_DATE' => $LANG['date'], 'L_FAQ_MANAGEMENT' => $FAQ_LANG['faq_management'], 'L_CATS_MANAGEMENT' => $FAQ_LANG['cats_management'], 'L_CONFIG_MANAGEMENT' => $FAQ_LANG['faq_configuration'], 'L_QUESTIONS_LIST' => $FAQ_LANG['faq_questions_list'], 'L_ADD_QUESTION' => $FAQ_LANG['add_question'], 'L_ADD_CAT' => $FAQ_LANG['add_cat']));
    $Template->pparse('admin_faq_questions');
} else {
    $Template->set_filenames(array('admin_faq' => 'faq/admin_faq.tpl'));
    $FAQ_CONFIG['global_auth'] = isset($FAQ_CONFIG['global_auth']) && is_array($FAQ_CONFIG['global_auth']) ? $FAQ_CONFIG['global_auth'] : array();
    $FAQ_CONFIG['faq_name'] = !empty($FAQ_CONFIG['faq_name']) ? $FAQ_CONFIG['faq_name'] : '';
    $FAQ_CONFIG['num_cols'] = isset($FAQ_CONFIG['num_cols']) ? $FAQ_CONFIG['num_cols'] : 4;
    $FAQ_CONFIG['display_block'] = isset($FAQ_CONFIG['display_block']) ? $FAQ_CONFIG['display_block'] : true;
    $Template->assign_vars(array('L_FAQ_MANAGEMENT' => $FAQ_LANG['faq_management'], 'L_CATS_MANAGEMENT' => $FAQ_LANG['cats_management'], 'L_CONFIG_MANAGEMENT' => $FAQ_LANG['faq_configuration'], 'L_QUESTIONS_LIST' => $FAQ_LANG['faq_questions_list'], 'L_ADD_QUESTION' => $FAQ_LANG['add_question'], 'L_ADD_CAT' => $FAQ_LANG['add_cat'], 'L_FAQ_NAME' => $FAQ_LANG['faq_name'], 'L_FAQ_NAME_EXPLAIN' => $FAQ_LANG['faq_name_explain'], 'L_NBR_COLS' => $FAQ_LANG['nbr_cols'], 'L_NBR_COLS_EXPLAIN' => $FAQ_LANG['nbr_cols_explain'], 'L_DISPLAY_MODE' => $FAQ_LANG['display_mode'], 'L_DISPLAY_MODE_EXPLAIN' => $FAQ_LANG['display_mode_admin_explain'], 'L_BLOCKS' => $FAQ_LANG['display_block'], 'L_INLINE' => $FAQ_LANG['display_inline'], 'L_AUTH' => $FAQ_LANG['general_auth'], 'L_AUTH_EXPLAIN' => $FAQ_LANG['general_auth_explain'], 'L_AUTH_READ' => $FAQ_LANG['read_auth'], 'L_AUTH_WRITE' => $FAQ_LANG['write_auth'], 'L_SUBMIT' => $LANG['submit'], 'AUTH_READ' => Authorizations::generate_select(AUTH_READ, $FAQ_CONFIG['global_auth']), 'AUTH_WRITE' => Authorizations::generate_select(AUTH_WRITE, $FAQ_CONFIG['global_auth']), 'FAQ_NAME' => $FAQ_CONFIG['faq_name'], 'NUM_COLS' => $FAQ_CONFIG['num_cols'], 'SELECTED_BLOCK' => $FAQ_CONFIG['display_block'] ? ' selected="selected"' : '', 'SELECTED_INLINE' => !$FAQ_CONFIG['display_block'] ? ' selected="selected"' : ''));
    $Template->pparse('admin_faq');
}
Example #13
0
 $pm_max = $unlimited_pm ? $LANG['illimited'] : $limit_group;
 $Template->assign_block_vars('convers', array('NBR_PM' => $pagination_pm, 'PM_POURCENT' => '<strong>' . $nbr_pm . '</strong> / <strong>' . $pm_max . '</strong>', 'PAGINATION' => $Pagination->display('pm' . url('.php?p=%d', '-0-0-%d.php'), $nbr_pm, 'p', $pagination_pm, 3), 'U_MARK_AS_READ' => '<a href="pm.php?read=1" class="small_link">' . $LANG['mark_pm_as_read'] . '</a>', 'U_USER_ACTION_PM' => url('.php?del_convers=1&amp;p=' . $page . '&amp;token=' . $Session->get_token()), 'U_USER_VIEW' => '<a href="' . url('member.php?id=' . $User->get_attribute('user_id') . '&amp;view=1', 'member-' . $User->get_attribute('user_id') . '.php?view=1') . '">' . $LANG['member_area'] . '</a>', 'U_PM_BOX' => '<a href="pm.php' . SID . '">' . $LANG['pm_box'] . '</a>', 'U_POST_NEW_CONVERS' => '<a href="pm' . url('.php?post=1', '') . '" title="' . $LANG['post_new_convers'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/post.png" alt="' . $LANG['post_new_convers'] . '" title="' . $LANG['post_new_convers'] . '" class="valign_middle" /></a>'));
 if ($nbr_pm == 0) {
     $Template->assign_block_vars('convers.no_pm', array('L_NO_PM' => $LANG['no_pm']));
 }
 $nbr_waiting_pm = 0;
 if (!$unlimited_pm && $nbr_pm > $limit_group) {
     $nbr_waiting_pm = $nbr_pm - $limit_group;
     if ($nbr_waiting_pm > 0) {
         $Errorh->handler(sprintf($LANG['e_pm_full'], $nbr_waiting_pm), E_USER_WARNING);
     }
 }
 $Template->assign_vars(array('THEME' => get_utheme(), 'L_REQUIRE_MESSAGE' => $LANG['require_text'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_DELETE_MESSAGE' => $LANG['alert_delete_msg'], 'L_PRIVATE_MSG' => $LANG['private_message'], 'L_PM_BOX' => $LANG['pm_box'], 'L_TITLE' => $LANG['title'], 'L_PARTICIPANTS' => $LANG['participants'], 'L_MESSAGE' => $LANG['replies'], 'L_LAST_MESSAGE' => $LANG['last_message'], 'L_STATUS' => $LANG['status'], 'L_DELETE' => $LANG['delete'], 'L_READ' => $LANG['read'], 'L_TRACK' => $LANG['pm_track'], 'L_NOT_READ' => $LANG['not_read']));
 $i = 0;
 $j = 0;
 $result = $Sql->query_while("SELECT pm.id, pm.title, pm.user_id, pm.user_id_dest, pm.user_convers_status, pm.nbr_msg, pm.last_user_id, pm.last_msg_id, pm.last_timestamp, msg.view_status, m.login AS login, m1.login AS login_dest, m2.login AS last_login\n\tFROM " . DB_TABLE_PM_TOPIC . "  pm\n\tLEFT JOIN " . DB_TABLE_PM_MSG . " msg ON msg.id = pm.last_msg_id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = pm.user_id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m1 ON m1.user_id = pm.user_id_dest\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m2 ON m2.user_id = pm.last_user_id\n\tWHERE\n\t(\n\t\t" . $User->get_attribute('user_id') . " IN (pm.user_id, pm.user_id_dest)\n\t)\n\tAND\n\t(\n\t\tpm.user_convers_status = 0\n\t\tOR\n\t\t(\n\t\t\t(pm.user_id_dest = '" . $User->get_attribute('user_id') . "' AND pm.user_convers_status = 1)\n\t\t\tOR\n\t\t\t(pm.user_id = '" . $User->get_attribute('user_id') . "' AND pm.user_convers_status = 2)\n\t\t)\n\t)\n\tORDER BY pm.last_timestamp DESC\n\t" . $Sql->limit($Pagination->get_first_msg($pagination_pm, 'p'), $pagination_pm), __LINE__, __FILE__);
 while ($row = $Sql->fetch_assoc($result)) {
     if ($row['user_id'] != -1) {
         $j++;
         if (!$unlimited_pm && $nbr_waiting_pm - $j >= 0) {
             continue;
         }
     }
     $view = false;
     $track = false;
     if ($row['last_user_id'] == $User->get_attribute('user_id')) {
         $view = true;
         if ($row['view_status'] === '0') {
             $track = true;
         }
     } else {
Example #14
0
        }
        $Sql->query_inject("UPDATE " . PREFIX . "articles SET" . $cat_clause . "title = '" . $title . "', contents = '" . str_replace('[page][/page]', '', $contents) . "', icon = '" . $icon . "', visible = '" . $visible . "', start = '" . $start_timestamp . "', end = '" . $end_timestamp . "', timestamp = '" . $timestamp . "' WHERE id = '" . $id_post . "'", __LINE__, __FILE__);
        import('content/syndication/feed');
        Feed::clear_cache('articles');
        redirect(HOST . SCRIPT);
    } else {
        redirect(HOST . DIR . '/articles/admin_articles.php?id= ' . $id_post . '&error=incomplete#errorh');
    }
} else {
    $Template->set_filenames(array('admin_articles_management' => 'articles/admin_articles_management.tpl'));
    $nbr_articles = $Sql->count_table('articles', __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'PAGINATION' => $Pagination->display('admin_articles.php?p=%d', $nbr_articles, 'p', 25, 3), 'CHEMIN' => SCRIPT, 'L_CONFIRM_DEL_ARTICLE' => $LANG['confirm_del_article'], '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_NAME' => $LANG['name'], 'L_TITLE' => $LANG['title'], 'L_CATEGORY' => $LANG['category'], 'L_PSEUDO' => $LANG['pseudo'], 'L_DATE' => $LANG['date'], 'L_APROB' => $LANG['aprob'], 'L_UPDATE' => $LANG['update'], 'L_DELETE' => $LANG['delete'], 'L_SHOW' => $LANG['show']));
    $Template->assign_block_vars('list', array());
    $result = $Sql->query_while("SELECT a.id, a.idcat, a.title, a.timestamp, a.visible, a.start, a.end, ac.name, m.login \n\tFROM " . PREFIX . "articles a\n\tLEFT JOIN " . PREFIX . "articles_cats ac ON ac.id = a.idcat\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON a.user_id = m.user_id\n\tORDER BY a.timestamp DESC " . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        if ($row['visible'] == 2) {
            $aprob = $LANG['waiting'];
        } elseif ($row['visible'] == 1) {
            $aprob = $LANG['yes'];
        } else {
            $aprob = $LANG['no'];
        }
        $title = strlen($row['title']) > 45 ? substr_html($row['title'], 0, 45) . '...' : $row['title'];
        $visible = '';
        if ($row['start'] > 0) {
            $visible .= gmdate_format('date_format_short', $row['start']);
        }
        if ($row['end'] > 0 && $row['start'] > 0) {
            $visible .= ' ' . strtolower($LANG['until']) . ' ' . gmdate_format('date_format_short', $row['end']);
Example #15
0
        }
    } else {
        redirect(HOST . SCRIPT);
    }
    $Template->pparse('admin_groups_management2');
} elseif ($add) {
    $Template->set_filenames(array('admin_groups_management2' => 'admin/admin_groups_management2.tpl'));
    $img_groups = '<option value="" selected="selected">--</option>';
    import('io/filesystem/folder');
    $img_groups = '<option value="">--</option>';
    $image_folder_path = new Folder(PATH_TO_ROOT . '/images/group');
    foreach ($image_folder_path->get_files('`\\.(png|jpg|bmp|gif)$`i') as $image) {
        $file = $image->get_name();
        $img_groups .= '<option value="' . $file . '">' . $file . '</option>';
    }
    $Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'IMG_GROUPS' => $img_groups, 'C_ADD_GROUP' => true, 'L_REQUIRE_PSEUDO' => $LANG['require_pseudo'], 'L_REQUIRE_NAME' => $LANG['require_name'], 'L_CONFIRM_DEL_USER_GROUP' => $LANG['confirm_del_member_group'], 'L_GROUPS_MANAGEMENT' => $LANG['groups_management'], 'L_ADD_GROUPS' => $LANG['groups_add'], 'L_REQUIRE' => $LANG['require'], 'L_UPLOAD_GROUPS' => $LANG['upload_group'], 'L_UPLOAD_FORMAT' => $LANG['upload_rank_format'], 'L_UPLOAD' => $LANG['upload'], 'L_NAME' => $LANG['name'], 'L_IMG_ASSOC_GROUP' => $LANG['img_assoc_group'], 'L_IMG_ASSOC_GROUP_EXPLAIN' => $LANG['img_assoc_group_explain'], 'L_AUTH_FLOOD' => $LANG['auth_flood'], 'L_PM_GROUP_LIMIT' => $LANG['pm_group_limit'], 'L_PM_GROUP_LIMIT_EXPLAIN' => $LANG['pm_group_limit_explain'], 'L_DATA_GROUP_LIMIT' => $LANG['data_group_limit'], 'L_DATA_GROUP_LIMIT_EXPLAIN' => $LANG['data_group_limit_explain'], 'L_COLOR_GROUP' => $LANG['color_group'], 'L_COLOR_GROUP_EXPLAIN' => $LANG['color_group_explain'], 'L_MB' => $LANG['unit_megabytes'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_ADD' => $LANG['add']));
    $Template->pparse('admin_groups_management2');
} else {
    $Template->set_filenames(array('admin_groups_management' => 'admin/admin_groups_management.tpl'));
    $nbr_group = $Sql->count_table("group", __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('PAGINATION' => $Pagination->display('admin_groups.php?p=%d', $nbr_group, 'p', 25, 3), 'THEME' => get_utheme(), 'LANG' => get_ulang(), 'KERNEL_EDITOR' => display_editor(), 'L_CONFIRM_DEL_GROUP' => $LANG['confirm_del_group'], 'L_GROUPS_MANAGEMENT' => $LANG['groups_management'], 'L_ADD_GROUPS' => $LANG['groups_add'], 'L_NAME' => $LANG['name'], 'L_IMAGE' => $LANG['image'], 'L_UPDATE' => $LANG['update'], 'L_DELETE' => $LANG['delete']));
    $result = $Sql->query_while("SELECT id, name, img\n\tFROM " . DB_TABLE_GROUP . "\n\tORDER BY name\n\t" . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('group', array('LINK' => url('.php?g=' . $row['id'], '-0.php?g=' . $row['id']), 'ID' => $row['id'], 'NAME' => $row['name'], 'IMAGE' => !empty($row['img']) ? '<img src="../images/group/' . $row['img'] . '" alt="" />' : ''));
    }
    $Sql->query_close($result);
    $Template->pparse('admin_groups_management');
}
require_once '../admin/admin_footer.php';
Example #16
0
            } else {
                $Errorh->handler($LANG['newsletter_del_failure'], E_USER_WARNING);
            }
        }
    } else {
        $Errorh->handler($LANG['newsletter_email_address_is_not_valid'], E_USER_WARNING);
    }
} elseif ($id > 0) {
    $check_mail = $Sql->query_inject("DELETE FROM " . PREFIX . "newsletter WHERE id = '" . $id . "'", __LINE__, __FILE__);
    $Errorh->handler($LANG['newsletter_del_success'], E_USER_NOTICE);
} else {
    $Template->assign_block_vars('arch_title', array());
    import('util/pagination');
    $Pagination = new Pagination();
    $i = 0;
    $result = $Sql->query_while("SELECT id, title, message, timestamp, type, nbr\n\tFROM " . PREFIX . "newsletter_arch \n\tORDER BY id DESC \n\t" . $Sql->limit($Pagination->get_first_msg(5, 'p'), 5), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('arch', array('DATE' => gmdate_format('date_format_short', $row['timestamp']), 'TITLE' => stripslashes($row['title']), 'MESSAGE' => $row['type'] === 'bbcode' || $row['type'] === 'html' ? '<div style="text-align:center;"><a class="com" href="#" onclick="popup(\'' . HOST . DIR . url('/newsletter/newsletter_arch.php?id=' . $row['id'], '', '') . '\', \'' . $row['title'] . '\');">' . $LANG['newsletter_msg_html'] . '</a></div>' : nl2br($row['message']), 'NBR_SENT_NEWSLETTERS' => sprintf($LANG['newsletter_nbr'], (int) $row['nbr'])));
        $i++;
    }
    $total_msg = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "newsletter_arch", __LINE__, __FILE__);
    if ($total_msg == 0) {
        $Errorh->handler($LANG['newsletter_no_archives'], E_USER_NOTICE);
    }
    $Template->assign_vars(array('PAGINATION' => $Pagination->display('newsletter.php?p=%d', $total_msg, 'p', 5, 3), 'L_NEWSLETTER_ARCHIVES' => $LANG['newsletter_archives'], 'L_NEWSLETTER_ARCHIVES_EXPLAIN' => $LANG['newsletter_archives_explain']));
    if ($i === 0) {
        $Template->assign_block_vars('mail', array('MSG' => 'Il n\'y a pas d\'archives pour le moment.'));
    }
}
$Template->pparse('newsletter');
require_once '../kernel/footer.php';
Example #17
0
    $array_poll = array_combine($array_answer, $array_vote);
    foreach ($array_poll as $answer => $nbrvote) {
        $percent = number_round($nbrvote * 100 / $sum_vote, 1);
        $Template->assign_block_vars('answers', array('ID' => $i, 'ANSWER' => !empty($answer) ? $answer : ''));
        $Template->assign_block_vars('votes', array('ID' => $i, 'VOTES' => isset($nbrvote) ? $nbrvote : '', 'PERCENT' => isset($percent) ? $percent . '%' : ''));
        $i++;
    }
    $Template->assign_vars(array('MAX_ID' => $i));
    $Template->pparse('admin_poll_management2');
} else {
    $Template->set_filenames(array('admin_poll_management' => 'poll/admin_poll_management.tpl'));
    $nbr_poll = $Sql->count_table('poll', __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('PAGINATION' => $Pagination->display('admin_poll.php?p=%d', $nbr_poll, 'p', 20, 3), 'LANG' => get_ulang(), 'L_CONFIRM_ERASE_POOL' => $LANG['confirm_del_poll'], 'L_POLL_MANAGEMENT' => $LANG['poll_management'], 'L_POLL_ADD' => $LANG['poll_add'], 'L_POLL_CONFIG' => $LANG['poll_config'], 'L_REQUIRE' => $LANG['require'], 'L_QUESTION' => $LANG['question'], 'L_POLLS' => $LANG['polls'], 'L_DATE' => $LANG['date'], 'L_ARCHIVED' => $LANG['archived'], 'L_PSEUDO' => $LANG['pseudo'], 'L_APROB' => $LANG['aprob'], 'L_UPDATE' => $LANG['update'], 'L_DELETE' => $LANG['delete'], 'L_SHOW' => $LANG['show']));
    $result = $Sql->query_while("SELECT p.id, p.question, p.archive, p.timestamp, p.visible, p.start, p.end, m.login \n\tFROM " . PREFIX . "poll p\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON p.user_id = m.user_id\t\n\tORDER BY p.timestamp DESC \n\t" . $Sql->limit($Pagination->get_first_msg(20, 'p'), 20), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        if ($row['visible'] == 2) {
            $aprob = $LANG['waiting'];
        } elseif ($row['visible'] == 1) {
            $aprob = $LANG['yes'];
        } else {
            $aprob = $LANG['no'];
        }
        $archive = $row['archive'] == 1 ? $LANG['yes'] : $LANG['no'];
        $question = strlen($row['question']) > 45 ? substr($row['question'], 0, 45) . '...' : $row['question'];
        $visible = '';
        if ($row['start'] > 0) {
            $visible .= gmdate_format('date_format_short', $row['start']);
        }
        if ($row['end'] > 0 && $row['start'] > 0) {
Example #18
0
                $sort = 'note';
                $selected_fields['note'] = ' selected="selected"';
                break;
            default:
                $sort = 'timestamp';
                $selected_fields['date'] = ' selected="selected"';
        }
        $mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
        if ($mode == 'ASC') {
            $selected_fields['asc'] = ' selected="selected"';
        } else {
            $selected_fields['desc'] = ' selected="selected"';
        }
        $unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&amp;mode=' . $get_mode : '';
        $Template->assign_vars(array('L_FILE' => $DOWNLOAD_LANG['file'], 'L_ALPHA' => $DOWNLOAD_LANG['sort_alpha'], 'L_SIZE' => $LANG['size'], 'L_DATE' => $LANG['date'], 'L_DOWNLOAD' => $DOWNLOAD_LANG['download'], 'L_POPULARITY' => $DOWNLOAD_LANG['popularity'], 'L_DESC' => $LANG['desc'], 'L_ASC' => $LANG['asc'], 'L_NOTE' => $LANG['note'], 'L_ORDER_BY' => $DOWNLOAD_LANG['order_by'], 'L_CONFIRM_DELETE_FILE' => str_replace('\'', '\\\'', $DOWNLOAD_LANG['confirm_delete_file']), 'SELECTED_ALPHA' => $selected_fields['alpha'], 'SELECTED_SIZE' => $selected_fields['size'], 'SELECTED_DATE' => $selected_fields['date'], 'SELECTED_HITS' => $selected_fields['hits'], 'SELECTED_NOTE' => $selected_fields['note'], 'SELECTED_ASC' => $selected_fields['asc'], 'SELECTED_DESC' => $selected_fields['desc']));
        import('util/pagination');
        $Pagination = new Pagination();
        import('content/note');
        import('content/comments');
        $Template->assign_vars(array('PAGINATION' => $Pagination->display(url('download.php' . (!empty($unget) ? $unget . '&amp;' : '?') . 'cat=' . $category_id . '&amp;p=%d', 'category-' . $category_id . '-%d.php' . $unget), $nbr_files, 'p', $CONFIG_DOWNLOAD['nbr_file_max'], 3), 'C_FILES' => true, 'TARGET_ON_CHANGE_ORDER' => $CONFIG['rewrite'] ? 'category-' . $category_id . '.php?' : 'download.php?cat=' . $category_id . '&'));
        $result = $Sql->query_while("SELECT id, title, timestamp, size, count, note, nbrnote, nbr_com, image, short_contents\n\t\tFROM " . PREFIX . "download\n\t\tWHERE visible = 1 AND approved = 1 AND idcat = '" . $category_id . "'\n\t\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($CONFIG_DOWNLOAD['nbr_file_max'], 'p'), $CONFIG_DOWNLOAD['nbr_file_max']), __LINE__, __FILE__);
        while ($row = $Sql->fetch_assoc($result)) {
            $Template->assign_block_vars('file', array('NAME' => $row['title'], 'IMG_NAME' => str_replace('"', '\\"', $row['title']), 'C_DESCRIPTION' => !empty($row['short_contents']), 'DESCRIPTION' => second_parse($row['short_contents']), 'DATE' => sprintf($DOWNLOAD_LANG['add_on_date'], gmdate_format('date_format_short', $row['timestamp'])), 'COUNT_DL' => sprintf($DOWNLOAD_LANG['downloaded_n_times'], $row['count']), 'NOTE' => $row['nbrnote'] > 0 ? Note::display_img($row['note'], $CONFIG_DOWNLOAD['note_max'], 5) : '<em>' . $LANG['no_note'] . '</em>', 'SIZE' => $row['size'] >= 1 ? number_round($row['size'], 1) . ' ' . $LANG['unit_megabytes'] : number_round($row['size'], 1) * 1024 . ' ' . $LANG['unit_kilobytes'], 'C_IMG' => !empty($row['image']), 'IMG' => $row['image'], 'U_DOWNLOAD_LINK' => url('download.php?id=' . $row['id'], 'download-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'), 'U_ADMIN_EDIT_FILE' => url('management.php?edit=' . $row['id']), 'U_ADMIN_DELETE_FILE' => url('management.php?del=' . $row['id'] . '&amp;token=' . $Session->get_token()), 'U_COM_LINK' => Comments::com_display_link($row['nbr_com'], '../download/download' . url('.php?id=' . $row['id'] . '&amp;com=0', '-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php?com=0'), $row['id'], 'download')));
        }
        $Sql->query_close($result);
    } else {
        $Template->assign_vars(array('L_NO_FILE_THIS_CATEGORY' => $DOWNLOAD_LANG['none_download'], 'C_NO_FILE' => true));
    }
    $Template->pparse('download');
}
require_once '../kernel/footer.php';
Example #19
0
    if ($i == 2) {
        $forum_cats .= '<a href="' . $array[1] . '">' . $array[0] . '</a>';
    } elseif ($i > 2) {
        $forum_cats .= ' &raquo; <a href="' . $array[1] . '">' . $array[0] . '</a>';
    }
    $i++;
}
$Template->assign_vars(array('FORUM_NAME' => $CONFIG_FORUM['forum_name'], 'SID' => SID, 'MODULE_DATA_PATH' => $module_data_path, 'DESC' => !empty($topic['subtitle']) ? $topic['subtitle'] : '', 'PAGINATION' => $Pagination->display('topic' . url('.php?id=' . $id_get . '&amp;pt=%d', '-' . $id_get . '-%d' . $rewrited_title . '.php'), $topic['nbr_msg'], 'pt', $CONFIG_FORUM['pagination_msg'], 3), 'THEME' => get_utheme(), 'LANG' => get_ulang(), 'USER_ID' => $topic['user_id'], 'ID' => $topic['idcat'], 'IDTOPIC' => $id_get, 'PAGE' => $page, 'TITLE_T' => ucfirst($topic['title']), 'DISPLAY_MSG' => $CONFIG_FORUM['activ_display_msg'] && $topic['display_msg'] ? $CONFIG_FORUM['display_msg'] . ' ' : '', 'U_MSG_SET_VIEW' => '<a class="small_link" href="../forum/action' . url('.php?read=1&amp;f=' . $topic['idcat'], '') . '" title="' . $LANG['mark_as_read'] . '" onclick="javascript:return Confirm_read_topics();">' . $LANG['mark_as_read'] . '</a>', 'U_CHANGE_CAT' => 'topic' . url('.php?id=' . $id_get . '&amp;token=' . $Session->get_token(), '-' . $id_get . $rewrited_cat_title . '.php?token=' . $Session->get_token()), '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"), 'U_FORUM_CAT' => !empty($forum_cats) ? $forum_cats . ' &raquo;' : '', 'U_TITLE_T' => 'topic' . url('.php?id=' . $id_get, '-' . $id_get . $rewrited_title . '.php'), 'L_REQUIRE_MESSAGE' => $LANG['require_text'], 'L_DELETE_MESSAGE' => $LANG['alert_delete_msg'], 'L_GUEST' => $LANG['guest'], 'L_DELETE' => $LANG['delete'], 'L_EDIT' => $LANG['edit'], 'L_CUT_TOPIC' => $LANG['cut_topic'], 'L_EDIT_BY' => $LANG['edit_by'], 'L_PUNISHMENT_MANAGEMENT' => $LANG['punishment_management'], 'L_WARNING_MANAGEMENT' => $LANG['warning_management'], 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_QUOTE' => $LANG['quote'], 'L_ON' => $LANG['on'], 'L_RESPOND' => $LANG['respond'], 'L_SUBMIT' => $LANG['submit'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset']));
$array_ranks = array(-1 => $LANG['guest_s'], 0 => $LANG['member_s'], 1 => $LANG['modo_s'], 2 => $LANG['admin_s']);
list($track, $track_pm, $track_mail, $poll_done) = array(false, false, false, false);
$Cache->load('ranks');
$page = retrieve(GET, 'pt', 0);
$quote_last_msg = $page > 1 ? 1 : 0;
$i = 0;
$j = 0;
$result = $Sql->query_while("SELECT msg.id, msg.timestamp, msg.timestamp_edit, msg.user_id_edit, m.user_id, m.user_groups, p.question, p.answers, p.voter_id, p.votes, p.type, m.login, m.level, m.user_mail, m.user_show_mail, m.timestamp AS registered, m.user_avatar, m.user_msg, m.user_local, m.user_web, m.user_sex, m.user_msn, m.user_yahoo, m.user_sign, m.user_warning, m.user_readonly, m.user_ban, m2.login as login_edit, s.user_id AS connect, tr.id AS trackid, tr.pm as trackpm, tr.track AS track, tr.mail AS trackmail, msg.contents\nFROM " . PREFIX . "forum_msg msg\nLEFT JOIN " . PREFIX . "forum_poll p ON p.idtopic = '" . $id_get . "'\nLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = msg.user_id\nLEFT JOIN " . DB_TABLE_MEMBER . " m2 ON m2.user_id = msg.user_id_edit\nLEFT JOIN " . PREFIX . "forum_track tr ON tr.idtopic = '" . $id_get . "' AND tr.user_id = '" . $User->get_attribute('user_id') . "'\nLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = msg.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "' AND s.user_id != -1\nWHERE msg.idtopic = '" . $id_get . "'\t\nORDER BY msg.timestamp \n" . $Sql->limit($Pagination->get_first_msg($CONFIG_FORUM['pagination_msg'], 'pt') - $quote_last_msg, $CONFIG_FORUM['pagination_msg'] + $quote_last_msg), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
    $is_guest = empty($row['user_id']);
    $first_message = $row['id'] == $topic['first_msg_id'] ? true : false;
    list($edit, $del, $cut, $moderator) = array(false, false, false, false);
    if ($check_group_edit_auth || $User->get_attribute('user_id') == $row['user_id'] && !$is_guest && !$first_message) {
        list($edit, $del) = array(true, true);
        if ($check_group_edit_auth) {
            $cut = !$first_message ? true : false;
            $moderator = !$is_guest ? true : false;
        }
    } elseif ($User->get_attribute('user_id') == $row['user_id'] && !$is_guest && $first_message) {
        $edit = true;
    }
    if (!empty($row['question']) && $poll_done === false) {
        $Template->assign_vars(array('C_POLL_EXIST' => true, 'QUESTION' => $row['question'], 'U_POLL_RESULT' => url('.php?id=' . $id_get . '&amp;r=1&amp;pt=' . $page), 'U_POLL_ACTION' => url('.php?id=' . $id_get . '&amp;p=' . $page . '&amp;token=' . $Session->get_token()), 'L_POLL' => $LANG['poll'], 'L_VOTE' => $LANG['poll_vote'], 'L_RESULT' => $LANG['poll_result']));
Example #20
0
        $edit = '<a href="../poll/admin_poll.php" title="' . $LANG['edit'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" class="valign_middle" /></a>';
    }
    $Template->assign_vars(array('C_POLL_MAIN' => true, 'EDIT' => $edit, 'U_ARCHIVE' => $show_archives, 'L_POLL' => $LANG['poll'], 'L_POLL_MAIN' => $LANG['poll_main']));
    $result = $Sql->query_while("SELECT id, question \n\tFROM " . PREFIX . "poll \n\tWHERE archive = 0 AND visible = 1\n\tORDER BY id DESC", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $Template->assign_block_vars('list', array('U_POLL_ID' => url('.php?id=' . $row['id'], '-' . $row['id'] . '.php'), 'QUESTION' => $row['question']));
    }
    $Sql->query_close($result);
    $Template->pparse('poll');
} elseif ($archives) {
    $Template->set_filenames(array('poll' => 'poll/poll.tpl'));
    $nbrarchives = $Sql->query("SELECT COUNT(*) as id FROM " . PREFIX . "poll WHERE archive = 1 AND visible = 1", __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('C_POLL_ARCHIVES' => true, 'SID' => SID, 'THEME' => get_utheme(), 'C_IS_ADMIN' => $User->check_level(ADMIN_LEVEL), 'PAGINATION' => $Pagination->display('poll' . url('.php?p=%d', '-0-0-%d.php'), $nbrarchives, 'p', 10, 3), 'MODULE_DATA_PATH' => $Template->get_module_data_path('poll'), 'L_ALERT_DELETE_POLL' => $LANG['alert_delete_poll'], 'L_ARCHIVE' => $LANG['archives'], 'L_BACK_POLL' => $LANG['poll_back'], 'L_ON' => $LANG['on'], 'L_EDIT' => $LANG['edit'], 'L_DELETE' => $LANG['delete']));
    $result = $Sql->query_while("SELECT id, question, votes, answers, type, timestamp\n\tFROM " . PREFIX . "poll\n\tWHERE archive = 1 AND visible = 1\n\tORDER BY timestamp DESC\n\t" . $Sql->limit($Pagination->get_first_msg(10, 'archives'), 10), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $array_answer = explode('|', $row['answers']);
        $array_vote = explode('|', $row['votes']);
        $sum_vote = array_sum($array_vote);
        $sum_vote = $sum_vote == 0 ? 1 : $sum_vote;
        $Template->assign_block_vars('list', array('ID' => $row['id'], 'QUESTION' => $row['question'], 'EDIT' => '<a href="../poll/admin_poll' . url('.php?id=' . $row['id']) . '" title="' . $LANG['edit'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" class="valign_middle" /></a>', 'DEL' => '&nbsp;&nbsp;<a href="../poll/admin_poll' . url('.php?delete=1&amp;id=' . $row['id']) . '" title="' . $LANG['delete'] . '" onclick="javascript:return Confirm();"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/delete.png" class="valign_middle" /></a>', 'VOTE' => $sum_vote, 'DATE' => gmdate_format('date_format'), 'L_VOTE' => $sum_vote > 1 ? $LANG['poll_vote_s'] : $LANG['poll_vote']));
        $array_poll = array_combine($array_answer, $array_vote);
        foreach ($array_poll as $answer => $nbrvote) {
            $Template->assign_block_vars('list.result', array('ANSWERS' => $answer, 'NBRVOTE' => $nbrvote, 'WIDTH' => number_round($nbrvote * 100 / $sum_vote, 1) * 4, 'PERCENT' => number_round($nbrvote * 100 / $sum_vote, 1), 'L_VOTE' => $nbrvote > 1 ? $LANG['poll_vote_s'] : $LANG['poll_vote']));
        }
    }
    $Sql->query_close($result);
    $Template->pparse('poll');
} else {
    $Errorh->handler('e_unexist_page', E_USER_REDIRECT);
Example #21
0
 function display($integrated_in_environment = INTEGRATED_IN_ENVIRONMENT, $Template = false, $page_path_to_root = '')
 {
     global $Cache, $User, $Errorh, $Sql, $LANG, $CONFIG, $CONFIG_USER, $CONFIG_COM, $_array_rank, $_array_groups_auth, $Session;
     if ($integrated_in_environment) {
         $idcom_get = retrieve(GET, 'com', 0);
         $idcom_post = retrieve(POST, 'idcom', 0);
         $idcom = $idcom_post > 0 ? $idcom_post : $idcom_get;
         $this->set_arg($idcom);
     }
     $vars_simple = sprintf($this->vars, 0);
     $delcom = retrieve(GET, 'delcom', 0);
     $editcom = retrieve(GET, 'editcom', 0);
     $updatecom = retrieve(GET, 'updatecom', false);
     $path_redirect = $this->path . sprintf(str_replace('&amp;', '&', $this->vars), 0) . (!empty($page_path_to_root) && !$integrated_in_environment ? '&path_to_root=' . $page_path_to_root : '');
     if (!is_object($Template) || strtolower(get_class($Template)) != 'template') {
         $Template = new Template('framework/content/com.tpl');
     }
     if ($this->is_loaded()) {
         $Cache->load('com');
         import('util/captcha');
         $captcha = new Captcha();
         $captcha->set_difficulty($CONFIG_COM['com_verif_code_difficulty']);
         ###########################Insertion##############################
         if (retrieve(POST, 'valid_com', false) && !$updatecom) {
             if ($User->get_attribute('user_readonly') > time()) {
                 $Errorh->handler('e_auth', E_USER_REDIRECT);
             }
             $login = retrieve(POST, 'login', '');
             $contents = retrieve(POST, 'contents', '', TSTRING_UNCHANGE);
             if (!empty($login) && !empty($contents)) {
                 if ($this->lock_com >= 1 && !$User->check_level(MODO_LEVEL)) {
                     redirect($path_redirect);
                 }
                 if ($User->check_level($CONFIG_COM['com_auth'])) {
                     $check_time = $User->get_attribute('user_id') !== -1 && $CONFIG['anti_flood'] == 1 ? $Sql->query("SELECT MAX(timestamp) as timestamp FROM " . DB_TABLE_COM . " WHERE user_id = '" . $User->get_attribute('user_id') . "'", __LINE__, __FILE__) : '';
                     if (!empty($check_time) && !$User->check_max_value(AUTH_FLOOD)) {
                         if ($check_time >= time() - $CONFIG['delay_flood']) {
                             redirect($path_redirect . '&errorh=flood#errorh');
                         }
                     }
                     if ($CONFIG_COM['com_verif_code'] && !$captcha->is_valid()) {
                         redirect($path_redirect . '&errorh=verif#errorh');
                     }
                     $contents = strparse($contents, $CONFIG_COM['forbidden_tags']);
                     if (!check_nbr_links($login, 0)) {
                         redirect($path_redirect . '&errorh=l_pseudo#errorh');
                     }
                     if (!check_nbr_links($contents, $CONFIG_COM['max_link'])) {
                         redirect($path_redirect . '&errorh=l_flood#errorh');
                     }
                     $last_idcom = $this->add($contents, $login);
                     redirect($path_redirect . '#m' . $last_idcom);
                 } else {
                     redirect($path_redirect . '&errorh=auth#errorh');
                 }
             } else {
                 redirect($path_redirect . '&errorh=incomplete#errorh');
             }
         } elseif ($updatecom || $delcom > 0 || $editcom > 0) {
             if ($User->get_attribute('user_readonly') > time()) {
                 $Errorh->handler('e_auth', E_USER_REDIRECT);
             }
             $row = $Sql->query_array(DB_TABLE_COM, '*', "WHERE idcom = '" . $this->idcom . "' AND idprov = '" . $this->idprov . "' AND script = '" . $this->script . "'", __LINE__, __FILE__);
             $row['user_id'] = (int) $row['user_id'];
             if ($this->idcom != 0 && ($User->check_level(MODO_LEVEL) || $row['user_id'] === $User->get_attribute('user_id') && $User->get_attribute('user_id') !== -1)) {
                 if ($delcom > 0) {
                     $Session->csrf_get_protect();
                     $lastid_com = $this->del();
                     $lastid_com = !empty($lastid_com) ? '#m' . $lastid_com : '';
                     redirect($path_redirect . $lastid_com);
                 } elseif ($editcom > 0) {
                     $Template->assign_vars(array('CURRENT_PAGE_COM' => $integrated_in_environment, 'POPUP_PAGE_COM' => !$integrated_in_environment, 'AUTH_POST_COM' => true));
                     if ($row['user_id'] !== -1) {
                         $Template->assign_vars(array('C_HIDDEN_COM' => true, 'LOGIN' => $User->get_attribute('login')));
                     } else {
                         $Template->assign_vars(array('C_VISIBLE_COM' => true, 'LOGIN' => $row['login']));
                     }
                     $Template->assign_vars(array('IDPROV' => $row['idprov'], 'IDCOM' => $row['idcom'], 'SCRIPT' => $this->script, 'CONTENTS' => unparse($row['contents']), 'DATE' => gmdate_format('date_format', $row['timestamp']), 'THEME' => get_utheme(), 'KERNEL_EDITOR' => display_editor($this->script . 'contents', $CONFIG_COM['forbidden_tags']), 'L_LANGUAGE' => substr(get_ulang(), 0, 2), 'L_EDIT_COMMENT' => $LANG['edit_comment'], 'L_REQUIRE_LOGIN' => $LANG['require_pseudo'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_DELETE_MESSAGE' => $LANG['alert_delete_msg'], 'L_LOGIN' => $LANG['pseudo'], 'L_MESSAGE' => $LANG['message'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_PREVIEW' => $LANG['preview'], 'L_SUBMIT' => $LANG['update'], 'U_ACTION' => $this->path . sprintf($this->vars, $this->idcom) . '&amp;token=' . $Session->get_token() . '&amp;updatecom=1' . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '')));
                 } elseif ($updatecom) {
                     $contents = retrieve(POST, 'contents', '', TSTRING_UNCHANGE);
                     $login = retrieve(POST, 'login', '');
                     if (!empty($contents) && !empty($login)) {
                         $contents = strparse($contents, $CONFIG_COM['forbidden_tags']);
                         if (!check_nbr_links($contents, $CONFIG_COM['max_link'])) {
                             redirect($path_redirect . '&errorh=l_flood#errorh');
                         }
                         $this->update($contents, $login);
                         redirect($path_redirect . '#m' . $this->idcom);
                     } else {
                         redirect($path_redirect . '&errorh=incomplete#errorh');
                     }
                 } else {
                     redirect($path_redirect . '&errorh=incomplete#errorh');
                 }
             } else {
                 $Errorh->handler('e_auth', E_USER_REDIRECT);
             }
         } elseif (isset($_GET['lock']) && $User->check_level(MODO_LEVEL)) {
             $Session->csrf_get_protect();
             if ($User->check_level(MODO_LEVEL)) {
                 $lock = retrieve(GET, 'lock', 0);
                 $this->lock($lock);
             }
             redirect($path_redirect . '#anchor_' . $this->script);
         } else {
             ###########################Affichage##############################
             $get_quote = retrieve(GET, 'quote', 0);
             $contents = '';
             if ($get_quote > 0) {
                 $info_com = $Sql->query_array(DB_TABLE_COM, 'login', 'contents', "WHERE script = '" . $this->script . "' AND idprov = '" . $this->idprov . "' AND idcom = '" . $get_quote . "'", __LINE__, __FILE__);
                 $contents = '[quote=' . $info_com['login'] . ']' . $info_com['contents'] . '[/quote]';
             }
             import('util/pagination');
             $pagination = new Pagination();
             $Template->assign_vars(array('ERROR_HANDLER' => '', 'CURRENT_PAGE_COM' => $integrated_in_environment, 'POPUP_PAGE_COM' => !$integrated_in_environment));
             if ($User->check_level(MODO_LEVEL)) {
                 $Template->assign_vars(array('COM_LOCK' => true, 'IMG' => $this->lock_com >= 1 ? 'unlock' : 'lock', 'L_LOCK' => $this->lock_com >= 1 ? $LANG['unlock'] : $LANG['lock'], 'U_LOCK' => $this->path . ($this->lock_com >= 1 ? $vars_simple . '&amp;lock=0&amp;token=' . $Session->get_token() : $vars_simple . '&amp;lock=1&amp;token=' . $Session->get_token()) . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '')));
             }
             $get_error = !empty($_GET['errorh']) ? trim($_GET['errorh']) : '';
             $errno = E_USER_NOTICE;
             switch ($get_error) {
                 case 'auth':
                     $errstr = $LANG['e_unauthorized'];
                     $errno = E_USER_WARNING;
                     break;
                 case 'verif':
                     $errstr = $LANG['e_incorrect_verif_code'];
                     $errno = E_USER_WARNING;
                     break;
                 case 'l_flood':
                     $errstr = sprintf($LANG['e_l_flood'], $CONFIG_COM['max_link']);
                     break;
                 case 'l_pseudo':
                     $errstr = $LANG['e_link_pseudo'];
                     break;
                 case 'flood':
                     $errstr = $LANG['e_flood'];
                     break;
                 case 'incomplete':
                     $errstr = $LANG['e_incomplete'];
                     break;
                 default:
                     $errstr = '';
             }
             $Errorh->set_template($Template);
             if (!empty($errstr)) {
                 $Template->assign_vars(array('ERROR_HANDLER' => $Errorh->display($errstr, E_USER_NOTICE)));
             }
             if (!$this->lock_com || $User->check_level(MODO_LEVEL)) {
                 if ($captcha->is_available() && $CONFIG_COM['com_verif_code']) {
                     $Template->assign_vars(array('C_VERIF_CODE' => true, 'VERIF_CODE' => $captcha->display_form(), 'L_REQUIRE_VERIF_CODE' => $captcha->js_require()));
                 }
                 if ($User->check_level($CONFIG_COM['com_auth'])) {
                     $Template->assign_vars(array('AUTH_POST_COM' => true));
                 } else {
                     $Template->assign_vars(array('ERROR_HANDLER' => $Errorh->display($LANG['e_unauthorized'], E_USER_NOTICE)));
                 }
                 if ($User->get_attribute('user_id') !== -1) {
                     $Template->assign_vars(array('C_HIDDEN_COM' => true, 'LOGIN' => $User->get_attribute('login')));
                 } else {
                     $Template->assign_vars(array('C_VISIBLE_COM' => true, 'LOGIN' => $LANG['guest']));
                 }
             } else {
                 $Template->assign_vars(array('ERROR_HANDLER' => $Errorh->display($LANG['com_locked'], E_USER_NOTICE)));
             }
             $get_pos = strpos($_SERVER['QUERY_STRING'], '&pc');
             if ($get_pos) {
                 $get_page = substr($_SERVER['QUERY_STRING'], 0, $get_pos) . '&amp;pc';
             } else {
                 $get_page = $_SERVER['QUERY_STRING'] . '&amp;pc';
             }
             $is_modo = $User->check_level(MODO_LEVEL);
             $Template->assign_vars(array('C_COM_DISPLAY' => $this->get_attribute('nbr_com') > 0 ? true : false, 'C_IS_MODERATOR' => $is_modo, 'PAGINATION_COM' => $pagination->display($this->path . $vars_simple . '&amp;pc=%d#anchor_' . $this->script, $this->nbr_com, 'pc', $CONFIG_COM['com_max'], 3), 'LANG' => get_ulang(), 'IDCOM' => '', 'IDPROV' => $this->idprov, 'SCRIPT' => $this->script, 'PATH' => SCRIPT, 'UPDATE' => $integrated_in_environment == true ? SID : '', 'VAR' => $vars_simple, 'KERNEL_EDITOR' => display_editor($this->script . 'contents', $CONFIG_COM['forbidden_tags']), 'C_BBCODE_TINYMCE_MODE' => $User->get_attribute('user_editor') == 'tinymce', 'L_XML_LANGUAGE' => $LANG['xml_lang'], 'L_TITLE' => $CONFIG['com_popup'] == 0 || $integrated_in_environment === true ? $LANG['title_com'] : '', 'THEME' => get_utheme(), 'CONTENTS' => unparse($contents), 'L_REQUIRE_LOGIN' => $LANG['require_pseudo'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_VERIF_CODE' => $LANG['verif_code'], 'L_DELETE_MESSAGE' => $LANG['alert_delete_msg'], 'L_ADD_COMMENT' => $LANG['add_comment'], 'L_PUNISHMENT_MANAGEMENT' => $LANG['punishment_management'], 'L_WARNING_MANAGEMENT' => $LANG['warning_management'], 'L_LOGIN' => $LANG['pseudo'], 'L_MESSAGE' => $LANG['message'], 'L_QUOTE' => $LANG['quote'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_SUBMIT' => $LANG['submit'], 'U_ACTION' => $this->path . sprintf($this->vars, $this->idcom) . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '') . '&amp;token=' . $Session->get_token()));
             $array_ranks = array(-1 => $LANG['guest'], 0 => $LANG['member'], 1 => $LANG['modo'], 2 => $LANG['admin']);
             $Cache->load('ranks');
             $j = 0;
             $result = $Sql->query_while("SELECT c.idprov, c.idcom, c.login, c.timestamp, m.user_id, m.login as mlogin, m.level, m.user_mail, m.user_show_mail, m.timestamp AS registered, m.user_avatar, m.user_msg, m.user_local, m.user_web, m.user_sex, m.user_msn, m.user_yahoo, m.user_sign, m.user_warning, m.user_ban, m.user_groups, s.user_id AS connect, c.contents\n\t\t\t\tFROM " . DB_TABLE_COM . " c\n\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\n\t\t\t\tLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = c.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\n\t\t\t\tWHERE c.script = '" . $this->script . "' AND c.idprov = '" . $this->idprov . "'\n\t\t\t\tGROUP BY c.idcom\n\t\t\t\tORDER BY c.timestamp DESC\n\t\t\t\t" . $Sql->limit($pagination->get_first_msg($CONFIG_COM['com_max'], 'pc'), $CONFIG_COM['com_max']), __LINE__, __FILE__);
             while ($row = $Sql->fetch_assoc($result)) {
                 list($edit, $del) = array(false, false);
                 $is_guest = empty($row['user_id']);
                 if ($is_modo || $row['user_id'] == $User->get_attribute('user_id') && $User->get_attribute('user_id') !== -1) {
                     list($edit, $del) = array(true, true);
                 }
                 if (!$is_guest) {
                     $com_pseudo = '<a class="msg_link_pseudo" href="' . PATH_TO_ROOT . '/member/member' . url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php') . '" title="' . $row['mlogin'] . '"><span style="font-weight: bold;">' . wordwrap_html($row['mlogin'], 13) . '</span></a>';
                 } else {
                     $com_pseudo = '<span style="font-style:italic;">' . (!empty($row['login']) ? wordwrap_html($row['login'], 13) : $LANG['guest']) . '</span>';
                 }
                 $user_rank = $row['level'] === '0' ? $LANG['member'] : $LANG['guest'];
                 $user_group = $user_rank;
                 $user_rank_icon = '';
                 if ($row['level'] === '2') {
                     $user_rank = $_array_rank[-2][0];
                     $user_group = $user_rank;
                     $user_rank_icon = $_array_rank[-2][1];
                 } elseif ($row['level'] === '1') {
                     $user_rank = $_array_rank[-1][0];
                     $user_group = $user_rank;
                     $user_rank_icon = $_array_rank[-1][1];
                 } else {
                     foreach ($_array_rank as $msg => $ranks_info) {
                         if ($msg >= 0 && $msg <= $row['user_msg']) {
                             $user_rank = $ranks_info[0];
                             $user_rank_icon = $ranks_info[1];
                             break;
                         }
                     }
                 }
                 $user_assoc_img = !empty($user_rank_icon) ? '<img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/ranks/' . $user_rank_icon . '" alt="" />' : '';
                 if (!empty($row['user_groups']) && $_array_groups_auth) {
                     $user_groups = '';
                     $array_user_groups = explode('|', $row['user_groups']);
                     foreach ($_array_groups_auth as $idgroup => $array_group_info) {
                         if (is_numeric(array_search($idgroup, $array_user_groups))) {
                             $user_groups .= !empty($array_group_info['img']) ? '<img src="' . PATH_TO_ROOT . '/images/group/' . $array_group_info['img'] . '" alt="' . $array_group_info['name'] . '" title="' . $array_group_info['name'] . '"/><br />' : $LANG['group'] . ': ' . $array_group_info['name'];
                         }
                     }
                 } else {
                     $user_groups = $LANG['group'] . ': ' . $user_group;
                 }
                 $user_online = !empty($row['connect']) ? 'online' : 'offline';
                 if (empty($row['user_avatar'])) {
                     $user_avatar = $CONFIG_USER['activ_avatar'] == '1' && !empty($CONFIG_USER['avatar_url']) ? '<img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . $CONFIG_USER['avatar_url'] . '" alt="" />' : '';
                 } else {
                     $user_avatar = '<img src="' . $row['user_avatar'] . '" alt=""	/>';
                 }
                 $user_sex = '';
                 if ($row['user_sex'] == 1) {
                     $user_sex = $LANG['sex'] . ': <img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/man.png" alt="" /><br />';
                 } elseif ($row['user_sex'] == 2) {
                     $user_sex = $LANG['sex'] . ': <img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/woman.png" alt="" /><br />';
                 }
                 $user_msg = $row['user_msg'] > 1 ? $LANG['message_s'] . ': ' . $row['user_msg'] : $LANG['message'] . ': ' . $row['user_msg'];
                 if (!empty($row['user_local'])) {
                     $user_local = $LANG['place'] . ': ' . $row['user_local'];
                     $user_local = $user_local > 15 ? substr_html($user_local, 0, 15) . '...<br />' : $user_local . '<br />';
                 } else {
                     $user_local = '';
                 }
                 $contents = ucfirst(second_parse($row['contents']));
                 if (!$integrated_in_environment && !empty($page_path_to_root)) {
                     $contents = str_replace('"' . $page_path_to_root . '/', '"' . PATH_TO_ROOT . '/', $contents);
                 }
                 $Template->assign_block_vars('com_list', array('ID' => $row['idcom'], 'CONTENTS' => $contents, 'DATE' => $LANG['on'] . ': ' . gmdate_format('date_format', $row['timestamp']), 'CLASS_COLOR' => $j % 2 == 0 ? '' : 2, 'USER_ONLINE' => '<img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . $user_online . '.png" alt="" class="valign_middle" />', 'USER_PSEUDO' => $com_pseudo, 'USER_RANK' => $row['user_warning'] < '100' || time() - $row['user_ban'] < 0 ? $user_rank : $LANG['banned'], 'USER_IMG_ASSOC' => $user_assoc_img, 'USER_AVATAR' => $user_avatar, 'USER_GROUP' => $user_groups, 'USER_DATE' => !$is_guest ? $LANG['registered_on'] . ': ' . gmdate_format('date_format_short', $row['registered']) : '', 'USER_SEX' => $user_sex, 'USER_MSG' => !$is_guest ? $user_msg : '', 'USER_LOCAL' => $user_local, 'USER_MAIL' => !empty($row['user_mail']) && $row['user_show_mail'] == '1' ? '<a href="mailto:' . $row['user_mail'] . '"><img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . get_ulang() . '/email.png" alt="' . $row['user_mail'] . '" title="' . $row['user_mail'] . '" /></a>' : '', 'USER_MSN' => !empty($row['user_msn']) ? '<a href="mailto:' . $row['user_msn'] . '"><img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . get_ulang() . '/msn.png" alt="' . $row['user_msn'] . '" title="' . $row['user_msn'] . '" /></a>' : '', 'USER_YAHOO' => !empty($row['user_yahoo']) ? '<a href="mailto:' . $row['user_yahoo'] . '"><img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . get_ulang() . '/yahoo.png" alt="' . $row['user_yahoo'] . '" title="' . $row['user_yahoo'] . '" /></a>' : '', 'USER_SIGN' => !empty($row['user_sign']) ? '____________________<br />' . second_parse($row['user_sign']) : '', 'USER_WEB' => !empty($row['user_web']) ? '<a href="' . $row['user_web'] . '"><img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . get_ulang() . '/user_web.png" alt="' . $row['user_web'] . '" title="' . $row['user_yahoo'] . '" /></a>' : '', 'USER_WARNING' => !empty($row['user_warning']) ? $row['user_warning'] : '0', 'C_COM_MSG_EDIT' => $del, 'C_COM_MSG_DEL' => $edit, 'U_COM_EDIT' => $this->path . sprintf($this->vars, $row['idcom']) . '&amp;editcom=1' . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '') . '#anchor_' . $this->script, 'U_COM_DEL' => $this->path . sprintf($this->vars, $row['idcom']) . '&amp;token=' . $Session->get_token() . '&amp;delcom=1' . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '') . '#anchor_' . $this->script, 'U_COM_WARNING' => $is_modo && !$is_guest ? PATH_TO_ROOT . '/member/moderation_panel' . url('.php?action=warning&amp;id=' . $row['user_id'] . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '')) . '" title="' . $LANG['warning_management'] : '', 'U_COM_PUNISHEMENT' => $is_modo && !$is_guest ? PATH_TO_ROOT . '/member/moderation_panel' . url('.php?action=punish&amp;id=' . $row['user_id'] . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '')) . '" title="' . $LANG['punishment_management'] : '', 'U_USER_PM' => !$is_guest ? '<a href="' . PATH_TO_ROOT . '/member/pm' . url('.php?pm=' . $row['user_id'], '-' . $row['user_id'] . '.php') . '"><img src="' . PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/' . get_ulang() . '/pm.png" alt="" /></a>' : '', 'U_ANCHOR' => $this->path . $vars_simple . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '') . '#m' . $row['idcom'], 'U_QUOTE' => $this->path . sprintf($this->vars, $row['idcom']) . '&amp;quote=' . $row['idcom'] . (!empty($page_path_to_root) && !$integrated_in_environment ? '&amp;path_to_root=' . $page_path_to_root : '') . '#anchor_' . $this->script));
                 $j++;
             }
             $Sql->query_close($result);
         }
         return $Template->parse(TEMPLATE_STRING_MODE);
     } else {
         return 'error : class Comments loaded uncorrectly';
     }
 }
Example #22
0
$Bread_crumb->add($LANG['member_msg'], 'membermsg.php' . SID);
define('TITLE', $LANG['member_msg']);
require_once '../kernel/header.php';
$memberId = retrieve(GET, 'id', 0, TUNSIGNED_INT);
$script = retrieve(GET, 'script', '');
if (!empty($memberId)) {
    $Template->set_filenames(array('membermsg' => 'member/membermsg.tpl'));
    import('modules/modules_discovery_service');
    $modulesLoader = new ModulesDiscoveryService();
    $modules = $modulesLoader->get_available_modules('get_member_msg_link');
    foreach ($modules as $module) {
        $img = $module->functionality('get_member_msg_img');
        $Template->assign_block_vars('available_modules_msg', array('NAME_USER_MSG' => $module->functionality('get_member_msg_name'), 'IMG_USER_MSG' => $img, 'C_IMG_USER_MSG' => !empty($img) ? true : false, 'U_LINK_USER_MSG' => $module->functionality('get_member_msg_link', array($memberId))));
    }
    $Template->assign_vars(array('L_USER_MSG' => $LANG['member_msg'], 'L_USER_MSG_DISPLAY' => $LANG['member_msg_display'], 'L_COMMENTS' => $LANG['com_s'], 'L_BACK' => $LANG['back'], 'U_BACK' => url('.php?id=' . $memberId, '-' . $memberId . '.php'), 'U_USER_MSG' => url('.php?id=' . $memberId), 'U_COMMENTS' => url('.php?id=' . $memberId . '&amp;script=com')));
    if (!empty($script)) {
        import('util/pagination');
        $Pagination = new Pagination();
        $nbr_msg = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_COM . " WHERE user_id = '" . $memberId . "'", __LINE__, __FILE__);
        $Template->assign_vars(array('C_START_MSG' => true, 'PAGINATION' => $Pagination->display('membermsg.php?pmsg=%d', $nbr_msg, 'pmsg', 25, 3), 'L_GO_MSG' => $LANG['go_msg'], 'L_ON' => $LANG['on']));
        $result = $Sql->query_while("SELECT c.timestamp, c.script, c.path, m.login, s.user_id AS connect, c.contents\n\t\tFROM " . DB_TABLE_COM . " c\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\n\t\tLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = c.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\n\t\tWHERE m.user_id = '" . $memberId . "'\n\t\tORDER BY c.timestamp DESC \n\t\t" . $Sql->limit($Pagination->get_first_msg(25, 'pmsg'), 25), __LINE__, __FILE__);
        $row = $Sql->fetch_assoc($result);
        while ($row = $Sql->fetch_assoc($result)) {
            $Template->assign_block_vars('msg_list', array('USER_PSEUDO' => '<a class="msg_link_pseudo" href="../member/member' . url('.php?id=' . $memberId, '-' . $memberId . '.php') . '"><span class="text_strong">' . wordwrap_html($row['login'], 13) . '</span></a>', 'USER_ONLINE' => '<img src="../templates/' . get_utheme() . '/images/' . (!empty($row['connect']) ? 'online' : 'offline') . '.png" alt="" class="valign_middle" />', 'DATE' => gmdate_format('date_format', $row['timestamp']), 'CONTENTS' => ucfirst(second_parse($row['contents'])), 'U_TITLE' => url($row['path'] . '#' . $row['script'])));
        }
    }
    $Template->pparse('membermsg');
} else {
    redirect(HOST . DIR . '/member/member.php');
}
require_once '../kernel/footer.php';
Example #23
0
    $idcat = retrieve(POST, 'idcat', 0);
    $compt = retrieve(POST, 'compt', 0);
    $aprob = retrieve(POST, 'aprob', 0);
    if (!empty($title) && !empty($url) && !empty($idcat)) {
        $Sql->query_inject("UPDATE " . PREFIX . "web SET title = '" . $title . "', contents = '" . $contents . "', url = '" . $url . "', idcat = '" . $idcat . "', compt = '" . $compt . "', aprob = '" . $aprob . "' WHERE id = '" . $id_post . "'", __LINE__, __FILE__);
        redirect(HOST . SCRIPT);
    } else {
        redirect(HOST . DIR . '/web/admin_web.php?id= ' . $id_post . '&error=incomplete#errorh');
    }
} elseif ($del && !empty($id)) {
    $Session->csrf_get_protect();
    $Sql->query_inject("DELETE FROM " . PREFIX . "web WHERE id = '" . $id . "'", __LINE__, __FILE__);
    $Sql->query_inject("DELETE FROM " . DB_TABLE_COM . " WHERE idprov = '" . $id . "' AND script = 'web'", __LINE__, __FILE__);
    redirect(HOST . SCRIPT);
} else {
    $Template->set_filenames(array('admin_web_management' => 'web/admin_web_management.tpl'));
    $nbr_web = $Sql->count_table('web', __LINE__, __FILE__);
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('PAGINATION' => $Pagination->display('admin_web.php?p=%d', $nbr_web, 'p', 25, 3), 'THEME' => get_utheme(), 'LANG' => get_ulang(), 'KERNEL_EDITOR' => display_editor(), 'L_WEB_ADD' => $LANG['web_add'], 'L_WEB_MANAGEMENT' => $LANG['web_management'], 'L_WEB_CAT' => $LANG['cat_management'], 'L_WEB_CONFIG' => $LANG['web_config'], 'L_DEL_ENTRY' => $LANG['delete_link'], 'L_LISTE' => $LANG['list'], 'L_NAME' => $LANG['name'], 'L_CATEGORY' => $LANG['category'], 'L_URL' => $LANG['url'], 'L_VIEW' => $LANG['view'], 'L_DATE' => $LANG['date'], 'L_APROB' => $LANG['aprob'], 'L_UPDATE' => $LANG['update'], 'L_DELETE' => $LANG['delete']));
    $result = $Sql->query_while("SELECT d.*, ad.name \n\tFROM " . PREFIX . "web d \n\tLEFT JOIN " . PREFIX . "web_cat ad ON ad.id = d.idcat\n\tORDER BY timestamp DESC \n\t" . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $aprob = $row['aprob'] == 1 ? $LANG['yes'] : $LANG['no'];
        $title = $row['title'];
        $title = strlen($title) > 45 ? substr_html($title, 0, 45) . '...' : $title;
        $Template->assign_block_vars('web', array('IDWEB' => $row['id'], 'NAME' => $title, 'IDCAT' => $row['idcat'], 'CAT' => $row['name'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'APROBATION' => $aprob, 'COMPT' => $row['compt']));
    }
    $Sql->query_close($result);
    $Template->pparse('admin_web_management');
}
require_once '../admin/admin_footer.php';
Example #24
0
            break;
        case 'last':
            $sort = 'last_connect';
            break;
        case 'msg':
            $sort = 'user_msg';
            break;
        case 'alph':
            $sort = 'login';
            break;
        default:
            $sort = 'timestamp';
    }
    $get_mode = retrieve(GET, 'mode', '', TSTRING_UNCHANGE);
    $mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
    $unget = !empty($sort) && !empty($mode) ? '?sort=' . $get_sort . '&amp;mode=' . $get_mode : '';
    import('util/pagination');
    $Pagination = new Pagination();
    $Template->assign_vars(array('PAGINATION' => '&nbsp;<strong>' . $LANG['page'] . ' :</strong> ' . $Pagination->display('member' . url('.php' . (!empty($unget) ? $unget . '&amp;' : '?') . 'p=%d', '-0-%d.php' . $unget), $nbr_member, 'p', 25, 3)));
    $result = $Sql->query_while("SELECT user_id, login, user_mail, user_show_mail, timestamp, user_msg, user_local, user_web, last_connect\n\tFROM " . PREFIX . "member\n\tWHERE user_aprob = 1\n\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg(25, 'p'), 25), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $user_web = !empty($row['user_web']) ? '<a href="' . $row['user_web'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/user_web.png" alt="' . $row['user_web'] . '" title="' . $row['user_web'] . '" /></a>' : '&nbsp;';
        $user_msg = !empty($row['user_msg']) ? $row['user_msg'] : '0';
        $user_mail = $row['user_show_mail'] == 1 ? '<a href="mailto:' . $row['user_mail'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/email.png" alt="' . $row['user_mail'] . '" /></a>' : '&nbsp;';
        $row['last_connect'] = !empty($row['last_connect']) ? $row['last_connect'] : $row['timestamp'];
        $Template->assign_block_vars('member_list', array('PSEUDO' => $row['login'], 'MAIL' => $user_mail, 'MSG' => $user_msg, 'LOCAL' => !empty($row['user_local']) ? $row['user_local'] : '&nbsp;', 'LAST_CONNECT' => gmdate_format('date_format_short', $row['last_connect']), 'WEB' => $user_web, 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'U_USER_ID' => url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php'), 'U_USER_PM' => url('.php?pm=' . $row['user_id'], '-' . $row['user_id'] . '.php')));
    }
    $Sql->query_close($result);
    $Template->pparse('member');
}
require_once '../kernel/footer.php';
Example #25
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';
Example #26
0
            $sign = '-';
            $trend = number_round(100 - $row['yesterday_visit'] * 100 / $average, 1);
        } else {
            $trend_img = 'right.png';
            $sign = '+';
            $trend = 0;
        }
        $Template->assign_block_vars('referer_list', array('ID' => $row['id'], 'URL' => $row['url'], 'IMG_MORE' => '<img src="../templates/' . get_utheme() . '/images/upload/plus.png" alt="" onclick="XMLHttpRequest_referer(' . $row['id'] . ')" class="valign_middle" id="img_url' . $row['id'] . '" />', 'NBR_LINKS' => $row['count'], 'TOTAL_VISIT' => $row['total_visit'], 'AVERAGE_VISIT' => number_round($average, 1), 'LAST_UPDATE' => gmdate_format('date_format_short', $row['last_update']), 'TREND' => '<img src="../templates/' . get_utheme() . '/images/admin/' . $trend_img . '" alt="" class="valign_middle" /> (' . $sign . $trend . '%)'));
    }
    $Sql->query_close($result);
    $Template->assign_vars(array('C_STATS_REFERER' => true, 'PAGINATION' => $Pagination->display('stats' . url('.php?referer=1&amp;p=%d', '-referer.php?p=%d'), $nbr_referer, 'p', 15, 3), 'L_URL' => $LANG['url'], 'L_TOTAL_VISIT' => $LANG['total_visit'], 'L_AVERAGE_VISIT' => $LANG['average_visit'], 'L_TREND' => $LANG['trend'], 'L_LAST_UPDATE' => $LANG['last_update']));
} elseif ($keyword) {
    import('util/pagination');
    $Pagination = new Pagination();
    $nbr_keyword = $Sql->query("SELECT COUNT(DISTINCT(relative_url)) FROM " . DB_TABLE_STATS_REFERER . " WHERE type = 1", __LINE__, __FILE__);
    $result = $Sql->query_while("SELECT id, count(*) as count, relative_url, SUM(total_visit) as total_visit, SUM(today_visit) as today_visit, SUM(yesterday_visit) as yesterday_visit, nbr_day, MAX(last_update) as last_update\n\tFROM " . PREFIX . "stats_referer\n\tWHERE type = 1\n\tGROUP BY relative_url\n\tORDER BY total_visit DESC\n\t" . $Sql->limit($Pagination->get_first_msg(15, 'p'), 15), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $average = $row['total_visit'] / $row['nbr_day'];
        if ($row['yesterday_visit'] > $average) {
            $trend_img = 'up.png';
            $sign = '+';
            $trend = number_round($row['yesterday_visit'] * 100 / $average, 1) - 100;
        } elseif ($row['yesterday_visit'] < $average) {
            $trend_img = 'down.png';
            $sign = '-';
            $trend = 100 - number_round($row['yesterday_visit'] * 100 / $average, 1);
        } else {
            $trend_img = 'right.png';
            $sign = '+';
            $trend = 0;
        }
Example #27
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';
Example #28
0
         $errstr = '';
 }
 if (!empty($errstr)) {
     $Errorh->handler($errstr, E_USER_NOTICE);
 }
 if ($captcha->is_available() && $CONFIG_GUESTBOOK['guestbook_verifcode']) {
     $Template->assign_vars(array('C_VERIF_CODE' => true, 'VERIF_CODE' => $captcha->display_form(), 'L_REQUIRE_VERIF_CODE' => $captcha->js_require()));
 }
 $nbr_guestbook = $Sql->count_table('guestbook', __LINE__, __FILE__);
 import('util/pagination');
 $Pagination = new Pagination();
 $Template->assign_vars(array('UPDATE' => url('?token=' . $Session->get_token()), 'PAGINATION' => $Pagination->display('guestbook' . url('.php?p=%d'), $nbr_guestbook, 'p', 10, 3), 'KERNEL_EDITOR' => display_editor('guestbook_contents', $CONFIG_GUESTBOOK['guestbook_forbidden_tags']), 'L_ALERT_TEXT' => $LANG['require_text'], 'L_DELETE_MSG' => $LANG['alert_delete_msg'], 'L_ADD_MSG' => $LANG['add_msg'], 'L_REQUIRE' => $LANG['require'], 'L_MESSAGE' => $LANG['message'], 'L_VERIF_CODE' => $LANG['verif_code'], 'L_PSEUDO' => $LANG['pseudo'], 'L_SUBMIT' => $LANG['submit'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset'], 'L_ON' => $LANG['on']));
 $array_ranks = array(-1 => $LANG['guest'], 0 => $LANG['member'], 1 => $LANG['modo'], 2 => $LANG['admin']);
 $Cache->load('ranks');
 $j = 0;
 $result = $Sql->query_while("SELECT g.id, g.login, g.timestamp, m.user_id, m.login as mlogin, m.level, m.user_mail, m.user_show_mail, m.timestamp AS registered, m.user_avatar, m.user_msg, m.user_local, m.user_web, m.user_sex, m.user_msn, m.user_yahoo, m.user_sign, m.user_warning, m.user_ban, m.user_groups, s.user_id AS connect, g.contents\n\tFROM " . PREFIX . "guestbook g\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\tLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = g.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\n\tGROUP BY g.id\n\tORDER BY g.timestamp DESC\n\t" . $Sql->limit($Pagination->get_first_msg(10, 'p'), 10), __LINE__, __FILE__);
 while ($row = $Sql->fetch_assoc($result)) {
     $edit = '';
     $del = '';
     $is_guest = empty($row['user_id']);
     $is_modo = $User->check_level(MODO_LEVEL);
     $warning = '';
     $readonly = '';
     if ($is_modo && !$is_guest) {
         $warning = '&nbsp;<a href="../member/moderation_panel' . url('.php?action=warning&amp;id=' . $row['user_id']) . '" title="' . $LANG['warning_management'] . '"><img src="../templates/' . get_utheme() . '/images/admin/important.png" alt="' . $LANG['warning_management'] . '" class="valign_middle" /></a>';
         $readonly = '<a href="../member/moderation_panel' . url('.php?action=punish&amp;id=' . $row['user_id']) . '" title="' . $LANG['punishment_management'] . '"><img src="../templates/' . get_utheme() . '/images/readonly.png" alt="' . $LANG['punishment_management'] . '" class="valign_middle" /></a>';
     }
     if ($is_modo || $row['user_id'] === $User->get_attribute('user_id') && $User->get_attribute('user_id') !== -1) {
         $edit = '&nbsp;&nbsp;<a href="../guestbook/guestbook' . url('.php?edit=1&id=' . $row['id']) . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="' . $LANG['edit'] . '" title="' . $LANG['edit'] . '" class="valign_middle" /></a>';
         $del = '&nbsp;&nbsp;<a href="../guestbook/guestbook' . url('.php?del=1&amp;id=' . $row['id'] . '&amp;token=' . $Session->get_token()) . '" onclick="javascript:return Confirm();"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/delete.png" alt="' . $LANG['delete'] . '" title="' . $LANG['delete'] . '" class="valign_middle" /></a>';
     }
Example #29
0
define('TITLE', $LANG['title_forum'] . ' - ' . $LANG['show_last_read']);
require_once '../kernel/header.php';
$change_cat = retrieve(POST, 'change_cat', '');
if (!empty($change_cat)) {
    redirect(HOST . DIR . '/forum/forum' . url('.php?id=' . $change_cat, '-' . $change_cat . $rewrited_title . '.php', '&'));
}
if (!$User->check_level(MEMBER_LEVEL)) {
    redirect(HOST . DIR . '/member/error.php');
}
if ($User->check_level(MEMBER_LEVEL)) {
    $Template->set_filenames(array('forum_topics' => 'forum/forum_forum.tpl', 'forum_top' => 'forum/forum_top.tpl', 'forum_bottom' => 'forum/forum_bottom.tpl'));
    import('util/pagination');
    $Pagination = new Pagination();
    $max_time = time() - $CONFIG_FORUM['view_time'];
    $max_time_msg = forum_limit_time_msg();
    $result = $Sql->query_while("SELECT m1.login AS login, m2.login AS last_login, t.id, t.title, t.subtitle, t.user_id, t.nbr_msg, t.nbr_views, t.last_user_id, t.last_msg_id, t.last_timestamp, t.type, t.status, t.display_msg, v.last_view_id, p.question, tr.id AS idtrack\n\tFROM " . PREFIX . "forum_view v\n\tLEFT JOIN " . PREFIX . "forum_topics t ON t.id = v.idtopic\n\tLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat \n\tLEFT JOIN " . PREFIX . "forum_poll p ON p.idtopic = t.id\n\tLEFT JOIN " . PREFIX . "forum_track tr ON tr.idtopic = t.id AND tr.user_id = '" . $User->get_attribute('user_id') . "'\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m1 ON m1.user_id = t.user_id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m2 ON m2.user_id = t.last_user_id\n\tWHERE t.last_timestamp >= '" . $max_time . "' AND v.user_id = '" . $User->get_attribute('user_id') . "'\n\tORDER BY t.last_timestamp DESC\n\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_FORUM['pagination_topic'], 'p'), $CONFIG_FORUM['pagination_topic']), __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $last_msg = $LANG['on'] . ' ' . gmdate_format('date_format', $row['last_timestamp']) . '<br /> ' . $LANG['by'] . ' <a class="small_link" href="../member/member.php?id=' . $row['last_user_id'] . '">' . $row['last_login'] . '</a>';
        $type = array('2' => $LANG['forum_announce'] . ':', '1' => $LANG['forum_postit'] . ':', '0' => '');
        $img_announce = 'announce';
        if ($row['last_view_id'] != $row['last_msg_id'] && $row['last_timestamp'] >= $max_time_msg) {
            $img_announce = 'new_' . $img_announce;
        }
        $img_announce .= $row['type'] == '1' ? '_post' : '';
        $img_announce .= $row['type'] == '2' ? '_top' : '';
        $img_announce .= $row['status'] == '0' && $row['type'] == '0' ? '_lock' : '';
        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 {
Example #30
0
                $sort = 'nbr_com';
                $selected_fields['com'] = ' selected="selected"';
                break;
        }
        if ($mode == 'ASC') {
            $selected_fields['asc'] = ' selected="selected"';
        } else {
            $selected_fields['desc'] = ' selected="selected"';
        }
        $Template->assign_vars(array('L_ALPHA' => $MEDIA_LANG['sort_title'], 'L_DATE' => $LANG['date'], 'L_NBR' => $MEDIA_LANG['sort_popularity'], 'L_NOTE' => $LANG['note'], 'L_COM' => $LANG['com'], 'L_DESC' => $LANG['desc'], 'L_ASC' => $LANG['asc'], 'L_ORDER_BY' => $LANG['orderby'], 'L_CONFIRM_DELETE_FILE' => str_replace('\'', '\\\'', $MEDIA_LANG['confirm_delete_media']), 'SELECTED_ALPHA' => $selected_fields['alpha'], 'SELECTED_DATE' => $selected_fields['date'], 'SELECTED_NBR' => $selected_fields['nbr'], 'SELECTED_NOTE' => $selected_fields['note'], 'SELECTED_COM' => $selected_fields['com'], 'SELECTED_ASC' => $selected_fields['asc'], 'SELECTED_DESC' => $selected_fields['desc'], 'A_COM' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_COM) !== 0, 'A_NOTE' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_NOTE) !== 0, 'A_USER' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_USER) !== 0, 'A_COUNTER' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_COUNT) !== 0, 'A_DATE' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_DATE) !== 0, 'A_DESC' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_DESC) !== 0, 'A_BLOCK' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_DATE + MEDIA_DL_COUNT + MEDIA_DL_COM + MEDIA_DL_NOTE + MEDIA_DL_USER) !== 0));
        import('util/pagination');
        $Pagination = new Pagination();
        import('content/note');
        import('content/comments');
        $Template->assign_vars(array('PAGINATION' => $Pagination->display(url('media.php' . (!empty($unget) ? $unget . '&amp;' : '?') . 'cat=' . $id_cat . '&amp;p=%d', 'media-0-' . $id_cat . '-%d' . '+' . url_encode_rewrite($MEDIA_CATS[$id_cat]['name']) . '.php' . $unget), $MEDIA_CATS[$id_cat]['num_media'], 'p', $MEDIA_CONFIG['pagin'], 3), 'C_FILES' => true, 'TARGET_ON_CHANGE_ORDER' => $CONFIG['rewrite'] ? 'media-0-' . $id_cat . '.php?' : 'media.php?cat=' . $id_cat . '&'));
        $result = $Sql->query_while("SELECT v.id, v.iduser, v.name, v.timestamp, v.counter, v.note, v.nbrnote, v.nbr_com, v.infos, v.contents, mb.login, mb.level\n\t\t\tFROM " . PREFIX . "media AS v\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " AS mb ON v.iduser = mb.user_id\n\t\t\tWHERE idcat = '" . $id_cat . "' AND infos = '" . MEDIA_STATUS_APROBED . "'\n\t\t\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($MEDIA_CONFIG['pagin'], 'p'), $MEDIA_CONFIG['pagin']), __LINE__, __FILE__);
        while ($row = $Sql->fetch_assoc($result)) {
            $Template->assign_block_vars('file', array('NAME' => $row['name'], 'IMG_NAME' => str_replace('"', '\\"', $row['name']), 'C_DESCRIPTION' => !empty($row['contents']), 'DESCRIPTION' => second_parse($row['contents']), 'POSTER' => !empty($row['login']) ? sprintf($MEDIA_LANG['media_added_by'], $row['login'], '../member/member' . url('.php?id=' . $row['iduser'], '-' . $row['iduser'] . '.php'), $level[$row['level']]) : $LANG['guest'], 'DATE' => sprintf($MEDIA_LANG['add_on_date'], gmdate_format('date_format_short', $row['timestamp'])), 'COUNT' => sprintf($MEDIA_LANG['view_n_times'], $row['counter']), 'NOTE' => $row['nbrnote'] ? Note::display_img($row['note'], $MEDIA_CONFIG['note_max'], $MEDIA_CONFIG['note_max']) : '<em>' . $LANG['no_note'] . '</em>', 'U_MEDIA_LINK' => url('media.php?id=' . $row['id'], 'media-' . $row['id'] . '-' . $id_cat . '+' . url_encode_rewrite($row['name']) . '.php'), 'U_ADMIN_UNVISIBLE_MEDIA' => url('media_action.php?unvisible=' . $row['id'] . '&amp;token=' . $Session->get_token()), 'U_ADMIN_EDIT_MEDIA' => url('media_action.php?edit=' . $row['id']), 'U_ADMIN_DELETE_MEDIA' => url('media_action.php?del=' . $row['id'] . '&amp;token=' . $Session->get_token()), 'U_COM_LINK' => Comments::com_display_link($row['nbr_com'], '../media/media' . url('.php?id=' . $row['id'] . '&amp;com=0', '-' . $row['id'] . '-' . $id_cat . '+' . url_encode_rewrite($row['name']) . '.php?com=0'), $row['id'], 'media')));
        }
        $Sql->query_close($result);
    } else {
        $Template->assign_vars(array('L_NO_FILE_THIS_CATEGORY' => $MEDIA_LANG['none_media'], 'C_NO_FILE' => true));
    }
} elseif ($id_media > 0) {
    $result = $Sql->query_while("SELECT v.*, mb.login, mb.level\tFROM " . PREFIX . "media AS v LEFT JOIN " . DB_TABLE_MEMBER . " AS mb ON v.iduser = mb.user_id\tWHERE id = '" . $id_media . "'", __LINE__, __FILE__);
    $media = $Sql->fetch_assoc($result);
    $Sql->query_close($result);
    if (empty($media) || ($media['infos'] & MEDIA_STATUS_UNVISIBLE) !== 0) {
        $Errorh->handler('e_unexist_media', E_USER_REDIRECT);
        exit;
    } elseif (!$User->check_auth($MEDIA_CATS[$media['idcat']]['auth'], MEDIA_AUTH_READ)) {