Exemple #1
0
function forum($rowQ1)
{
    global $user, $subscribe, $theme, $NPDS_Prefix, $admin, $adminforum;
    //==> droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    $adminforum = false;
    if ($admin) {
        $adminX = base64_decode($admin);
        $adminR = explode(':', $adminX);
        $Q = sql_fetch_assoc(sql_query("SELECT * FROM " . $NPDS_Prefix . "authors WHERE aid='{$adminR['0']}' LIMIT 1"));
        if ($Q['radminsuper'] == 1) {
            $adminforum = 1;
        } else {
            $R = sql_query("SELECT fnom, fid, radminsuper FROM " . $NPDS_Prefix . "authors a LEFT JOIN " . $NPDS_Prefix . "droits d ON a.aid = d.d_aut_aid LEFT JOIN " . $NPDS_Prefix . "fonctions f ON d.d_fon_fid = f.fid WHERE a.aid='{$adminR['0']}' AND f.fid BETWEEN 13 AND 15");
            if (sql_num_rows($R) >= 1) {
                $adminforum = 1;
            }
        }
    }
    //<== droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    if ($user) {
        $userX = base64_decode($user);
        $userR = explode(':', $userX);
        $tab_groupe = valid_group($user);
    }
    if ($ibid = theme_image("forum/icons/red_folder.gif")) {
        $imgtmpR = $ibid;
    } else {
        $imgtmpR = "images/forum/icons/red_folder.gif";
    }
    if ($ibid = theme_image("forum/icons/folder.gif")) {
        $imgtmp = $ibid;
    } else {
        $imgtmp = "images/forum/icons/folder.gif";
    }
    $linked = "onmouseover=\"this.className='lignb'; this.style.cursor='default';\" " . " onmouseout=\"this.className='ligna';\"";
    // preparation de la gestion des folders
    $result = sql_query("SELECT forum_id, COUNT(topic_id) AS total FROM " . $NPDS_Prefix . "forumtopics GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][0] = $total;
        // Topic
    }
    $result = sql_query("SELECT forum_id, COUNT(DISTINCT topicid) AS total FROM " . $NPDS_Prefix . "forum_read WHERE uid='{$userR['0']}' AND topicid>'0' AND status!='0' GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][1] = $total;
        // Folder
    }
    // préparation de la gestion des abonnements
    $result = sql_query("SELECT forumid FROM " . $NPDS_Prefix . "subscribe WHERE uid='{$userR['0']}'");
    while (list($forumid) = sql_fetch_row($result)) {
        $tab_subscribe[$forumid] = true;
    }
    // preparation du compteur total_post
    $rowQ0 = Q_Select("SELECT forum_id, COUNT(post_aff) AS total FROM " . $NPDS_Prefix . "posts GROUP BY forum_id", 600);
    while (list(, $row0) = each($rowQ0)) {
        $tab_total_post[$row0['forum_id']] = $row0['total'];
    }
    if ($subscribe and $user) {
        $colspanX = 7;
    } else {
        $colspanX = 6;
    }
    $ibid = '';
    if ($rowQ1) {
        while (list(, $row) = each($rowQ1)) {
            $title_aff = true;
            $rowQ2 = Q_Select("SELECT * FROM " . $NPDS_Prefix . "forums WHERE cat_id = '" . $row['cat_id'] . "' AND SUBSTRING(forum_name,1,3)!='<!>' ORDER BY forum_index,forum_id", 21600);
            if ($rowQ2) {
                while (list(, $myrow) = each($rowQ2)) {
                    // Gestion des Forums Cachés aux non-membres
                    if ($myrow['forum_type'] != "9" or $userR) {
                        // Gestion des Forums réservés à un groupe de membre
                        if ($myrow['forum_type'] == "7" or $myrow['forum_type'] == "5") {
                            $ok_affich = groupe_forum($myrow['forum_pass'], $tab_groupe);
                            if (isset($admin) and $adminforum == 1) {
                                $ok_affich = true;
                            }
                            // to see when admin mais pas assez precis
                        } else {
                            $ok_affich = true;
                        }
                        if ($ok_affich) {
                            if ($title_aff) {
                                $title = stripslashes($row['cat_title']);
                                if (file_exists("themes/{$theme}/html/forum-cat" . $row['cat_id'] . ".html") or file_exists("themes/default/html/forum-cat" . $row['cat_id'] . ".html")) {
                                    $ibid .= '
         <tr valign="top">
            <td colspan="' . $colspanX . '" class="lignb"><a href="forum.php?catid=' . $row['cat_id'] . '">' . $title . '</a></td>
         </tr>';
                                } else {
                                    $ibid .= '
         <tr valign="top">
            <td colspan="' . $colspanX . '" class="lignb">' . $title . '</td>
         </tr>';
                                }
                                $title_aff = false;
                            }
                            $forum_moderator = explode(" ", get_moderator($myrow['forum_moderator']));
                            $Mmod = false;
                            for ($i = 0; $i < count($forum_moderator); $i++) {
                                if ($userR[1] == $forum_moderator[$i]) {
                                    $Mmod = true;
                                }
                            }
                            $last_post = get_last_post($myrow['forum_id'], "forum", "infos", $Mmod);
                            $ibid .= '
         <tr align="left" valign="top">';
                            if ($tab_folder[$myrow['forum_id']][0] - $tab_folder[$myrow['forum_id']][1] > 0) {
                                $ibid .= '
            <td class="lignb" align="center" valign="middle" width="5%"><img src="' . $imgtmpR . '" border="" alt="" /></td>';
                            } else {
                                $ibid .= '
            <td class="lignb" align="center" valign="middle" width="5%"><img src="' . $imgtmp . '" border="" alt="" /></td>';
                            }
                            $name = stripslashes($myrow['forum_name']);
                            $redirect = false;
                            if (strstr(strtoupper($name), "<a HREF")) {
                                if ($colspanX == 7) {
                                    $ibid .= '
            <td width="40%" class="ligna" ' . $linked . '>' . $name;
                                } else {
                                    $ibid .= '
            <td width="45%" class="ligna" ' . $linked . '>' . $name;
                                }
                                $redirect = true;
                            } else {
                                if ($colspanX == 7) {
                                    $ibid .= '
            <td width="40%" class="ligna" ' . $linked . ' onclick=\'window.location.href="viewforum.php?forum=' . $myrow['forum_id'] . '"\'><a href="viewforum.php?forum=' . $myrow['forum_id'] . '" >' . $name . '</a>';
                                } else {
                                    $ibid .= '
            <td width="45%" class="ligna" ' . $linked . ' onclick=\'window.location.href="viewforum.php?forum=' . $myrow['forum_id'] . '"\'><a href="viewforum.php?forum=' . $myrow['forum_id'] . '" >' . $name . '</a>';
                                }
                            }
                            $desc = stripslashes(meta_lang($myrow['forum_desc']));
                            $ibid .= '<br />' . $desc . '</td>';
                            // Subscribe
                            if ($subscribe and $user) {
                                if (!$redirect) {
                                    if ($tab_subscribe[$myrow['forum_id']]) {
                                        $ibid .= '
            <td class="lignb" width="5%" align="center" valign="middle"><input type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" checked="checked" /></td>';
                                    } else {
                                        $ibid .= '
            <td class="lignb" width="5%" align="center" valign="middle"><input type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" /></td>';
                                    }
                                } else {
                                    $ibid .= '
            <td class="lignb" width="5%" align="center" valign="middle">&nbsp;</td>';
                                }
                            }
                            if (!$redirect) {
                                $ibid .= '
            <td width="15%" align="center" valign="middle" class="ligna">';
                                if ($myrow['forum_access'] == "0" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Free for All");
                                }
                                if ($myrow['forum_type'] == "1") {
                                    $ibid .= translate("Private");
                                }
                                if ($myrow['forum_type'] == "5") {
                                    $ibid .= "PHP Script + " . translate("Group");
                                }
                                if ($myrow['forum_type'] == "6") {
                                    $ibid .= "PHP Script";
                                }
                                if ($myrow['forum_type'] == "7") {
                                    $ibid .= translate("Group");
                                }
                                if ($myrow['forum_type'] == "8") {
                                    $ibid .= translate("Extended Text");
                                }
                                if ($myrow['forum_type'] == "9") {
                                    $ibid .= translate("Hidden");
                                }
                                if ($myrow['forum_access'] == "1" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Registered User");
                                }
                                if ($myrow['forum_access'] == "2" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Moderator");
                                }
                                if ($myrow['forum_access'] == "9") {
                                    $ibid .= ' <strong>' . translate("Closed") . '</strong>';
                                }
                                $ibid .= '</td>
            <td width="10%" align="center" valign="middle" class="lignb">' . $tab_folder[$myrow['forum_id']][0] . '</td>
            <td width="10%" align="center" valign="middle" class="ligna">' . $tab_total_post[$myrow['forum_id']] . '</td>
            <td width="15%" align="center" valign="middle" class="lignb">' . $last_post . '</td>
         </tr>';
                            } else {
                                $ibid .= '
            <td width="15%" align="center" valign="middle" class="ligna">&nbsp;</td>
            <td width="10%" align="center" valign="middle" class="lignb">&nbsp;</td>
            <td width="10%" align="center" valign="middle" class="ligna">&nbsp;</td>
            <td width="15%" align="center" valign="middle" class="ligna">&nbsp;</td>
         </tr>';
                            }
                        }
                    }
                }
            }
        }
    }
    return $ibid;
}
Exemple #2
0
    $ok_affiche = false;
    $tab_groupe = valid_group($user);
    $ok_affiche = groupe_forum($myrow['forum_pass'], $tab_groupe);
    if (!$ok_affiche) {
        header("location: forum.php");
    }
}
if ($forum_type == 9 and !$user) {
    header("location: forum.php");
}
// Moderator
if (isset($user)) {
    $userX = base64_decode($user);
    $userdata = explode(':', $userX);
}
$moderator = get_moderator($mod);
$moderator = explode(' ', $moderator);
$Mmod = false;
if (isset($user)) {
    for ($i = 0; $i < count($moderator); $i++) {
        if ($userdata[1] == $moderator[$i]) {
            $Mmod = true;
            break;
        }
    }
}
$sql = "SELECT topic_title, topic_status FROM " . $NPDS_Prefix . "forumtopics WHERE topic_id = '{$topic}'";
if (!($result = sql_query($sql))) {
    forumerror(01);
}
$myrow = sql_fetch_assoc($result);
Exemple #3
0
 function index()
 {
     $data['title'] = 'ACS - Moderation Schedule BEAT';
     //--HARI INI--//
     $this->table->set_template(tbl_tmp());
     $this->table->set_heading(array('data' => 'SHIFT', 'width' => 20), 'MODERATOR');
     $shift_siang = get_moderator(siang_beat(date('Y-m-d')));
     $shift_malam = get_moderator(malam_beat(date('Y-m-d')));
     $this->table->add_row(array('data' => "<b>SIANG</b>"), array('data' => $shift_siang[1]));
     $this->table->add_row(array('data' => "<b>MALAM</b>"), array('data' => $shift_malam[1]));
     $data['table_sekarang'] = $this->table->generate();
     //--BULAN LALU--//
     unset($heading);
     $total_hari = date('d', strtotime('last day of last month'));
     $heading[] = array('data' => 'SHIFT', 'rowspan=2');
     for ($i = 1; $i <= $total_hari; $i++) {
         $heading[] = (date_format(date_create(date('Y-m-', strtotime('last day of last month')) . $i), "N") == 6 || date_format(date_create(date('Y-m-', strtotime('last day of last month')) . $i), "N") == 7 ? "<span style='color:red'>" . get_hari(date_format(date_create(date('Y-m-', strtotime('last day of last month')) . $i), "N")) . "</span>" : get_hari(date_format(date_create(date('Y-m-', strtotime('last day of last month')) . $i), "N"))) . "<br/>" . $i;
     }
     $this->table->set_heading($heading);
     unset($row);
     $row[] = array('data' => "<b>SIANG</b>");
     for ($i = 1; $i <= $total_hari; $i++) {
         $date = date_format(date_create(date('Y-m-', strtotime('last day of last month')) . $i), "Y-m-d");
         $shift = get_moderator(siang_beat($date));
         $row[] = array('data' => $shift[0], 'class' => 'mod_' . siang_beat($date));
     }
     $this->table->add_row($row);
     unset($row);
     $row[] = array('data' => "<b>MALAM</b>");
     for ($i = 1; $i <= $total_hari; $i++) {
         $date = date_format(date_create(date('Y-m-', strtotime('last day of last month')) . $i), "Y-m-d");
         $shift = get_moderator(malam_beat($date));
         $row[] = array('data' => $shift[0], 'class' => 'mod_' . malam_beat($date));
     }
     $this->table->add_row($row);
     unset($row);
     $data['table_bulan_lalu'] = $this->table->generate();
     //--BULAN INI--//
     unset($heading);
     $total_hari = date('d', strtotime('last day of this month'));
     $heading[] = array('data' => 'SHIFT', 'rowspan=2');
     for ($i = 1; $i <= $total_hari; $i++) {
         $heading[] = (date_format(date_create(date('Y-m-') . $i), "N") == 6 || date_format(date_create(date('Y-m-') . $i), "N") == 7 ? "<span style='color:red'>" . get_hari(date_format(date_create(date('Y-m-') . $i), "N")) . "</span>" : get_hari(date_format(date_create(date('Y-m-') . $i), "N"))) . "<br/>" . $i;
     }
     $this->table->set_heading($heading);
     $row[] = array('data' => "<b>SIANG</b>");
     for ($i = 1; $i <= $total_hari; $i++) {
         $date = date_format(date_create(date('Y-m-') . $i), "Y-m-d");
         $shift = get_moderator(siang_beat($date));
         $row[] = array('data' => $shift[0], 'class' => 'mod_' . siang_beat($date));
     }
     $this->table->add_row($row);
     unset($row);
     $row[] = array('data' => "<b>MALAM</b>");
     for ($i = 1; $i <= $total_hari; $i++) {
         $date = date_format(date_create(date('Y-m-') . $i), "Y-m-d");
         $shift = get_moderator(malam_beat($date));
         $row[] = array('data' => $shift[0], 'class' => 'mod_' . malam_beat($date));
     }
     $this->table->add_row($row);
     unset($row);
     $data['table_bulan_ini'] = $this->table->generate();
     //--BULAN DEPAN--//
     unset($heading);
     $total_hari = date('d', strtotime('last day of next month'));
     $heading[] = array('data' => 'SHIFT', 'rowspan=2');
     for ($i = 1; $i <= $total_hari; $i++) {
         $heading[] = (date_format(date_create(date('Y-m-', strtotime('last day of next month')) . $i), "N") == 6 || date_format(date_create(date('Y-m-', strtotime('last day of next month')) . $i), "N") == 7 ? "<span style='color:red'>" . get_hari(date_format(date_create(date('Y-m-', strtotime('last day of next month')) . $i), "N")) . "</span>" : get_hari(date_format(date_create(date('Y-m-', strtotime('last day of next month')) . $i), "N"))) . "<br/>" . $i;
     }
     $this->table->set_heading($heading);
     $row[] = array('data' => "<b>SIANG</b>");
     for ($i = 1; $i <= $total_hari; $i++) {
         $date = date_format(date_create(date('Y-m-', strtotime('last day of next month')) . $i), "Y-m-d");
         $shift = get_moderator(siang_beat($date));
         $row[] = array('data' => $shift[0], 'class' => 'mod_' . siang_beat($date));
     }
     $this->table->add_row($row);
     unset($row);
     $row[] = array('data' => "<b>MALAM</b>");
     for ($i = 1; $i <= $total_hari; $i++) {
         $date = date_format(date_create(date('Y-m-', strtotime('last day of next month')) . $i), "Y-m-d");
         $shift = get_moderator(malam_beat($date));
         $row[] = array('data' => $shift[0], 'class' => 'mod_' . malam_beat($date));
     }
     $this->table->add_row($row);
     unset($row);
     $data['table_bulan_depan'] = $this->table->generate();
     $this->template->display('mod_sche', $data);
 }
Exemple #4
0
include "functions.php";
if ($SuperCache) {
    $cache_obj = new cacheManager();
} else {
    $cache_obj = new SuperCacheEmpty();
}
include "auth.php";
global $NPDS_Prefix;
$rowQ1 = Q_Select("SELECT forum_name, forum_moderator, forum_type, forum_pass, forum_access, arbre FROM " . $NPDS_Prefix . "forums WHERE forum_id = '{$forum}'", 3600);
if (!$rowQ1) {
    forumerror('0001');
}
list(, $myrow) = each($rowQ1);
$forum_type = $myrow['forum_type'];
$forum_access = $myrow['forum_access'];
$moderator = get_moderator($myrow['forum_moderator']);
if (isset($user)) {
    $userX = base64_decode($user);
    $userdata = explode(":", $userX);
    $moderator = explode(" ", $moderator);
    $Mmod = false;
    for ($i = 0; $i < count($moderator); $i++) {
        if ($userdata[1] == $moderator[$i]) {
            $Mmod = true;
            break;
        }
    }
}
settype($submitS, 'string');
if ($submitS) {
    include "header.php";
Exemple #5
0
//<== droits des admin sur les forums (superadmin et admin avec droit gestion forum)
if (isset($arbre) and $arbre == "1") {
    $url_ret = "viewtopicH.php";
} else {
    $url_ret = "viewtopic.php";
}
$Mmod = false;
$userX = base64_decode($user);
$userdata = explode(':', $userX);
settype($forum, "integer");
$rowQ1 = Q_Select("SELECT forum_name, forum_moderator, forum_type, forum_pass, forum_access, arbre FROM " . $NPDS_Prefix . "forums WHERE forum_id = '{$forum}'", 3600);
if (!$rowQ1) {
    forumerror('0001');
}
list(, $myrow) = each($rowQ1);
$moderator = explode(" ", get_moderator($myrow['forum_moderator']));
for ($i = 0; $i < count($moderator); $i++) {
    if ($userdata[1] == $moderator[$i]) {
        if (user_is_moderator($userdata[0], $userdata[2], $myrow['forum_access'])) {
            $Mmod = true;
        }
        break;
    }
}
if (!$Mmod and $adminforum == 0) {
    forumerror('0007');
}
if (isset($submit) and $mode == "move") {
    $sql = "UPDATE " . $NPDS_Prefix . "forumtopics SET forum_id='{$newforum}' WHERE topic_id='{$topic}'";
    if (!($r = sql_query($sql))) {
        forumerro('0010');
Exemple #6
0
function ForumGoEdit($forum_id, $ctg)
{
    global $hlpfile, $NPDS_Prefix, $f_meta_nom, $f_titre, $adminimg;
    include "header.php";
    GraphicAdmin($hlpfile);
    $result = sql_query("SELECT forum_id, forum_name, forum_desc, forum_access, forum_moderator, cat_id, forum_type, forum_pass, arbre, attachement, forum_index FROM " . $NPDS_Prefix . "forums WHERE forum_id='{$forum_id}'");
    list($forum_id, $forum_name, $forum_desc, $forum_access, $forum_mod, $cat_id_1, $forum_type, $forum_pass, $arbre, $attachement, $forum_index) = sql_fetch_row($result);
    adminhead($f_meta_nom, $f_titre, $adminimg);
    echo '
   <h3>' . adm_translate("Editer") . ' : <span class="text-muted">' . $forum_name . '</span></h3>
   <form id="fad_editforu" action="admin.php" method="post">
   <input type="hidden" name="forum_id" value="' . $forum_id . '" />
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_index">' . adm_translate("Index") . '</label>
            <div class="col-sm-8">
               <input class="form-control" type="number" name="forum_index" max="9999" value="' . $forum_index . '" />
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_name">' . adm_translate("Nom du forum") . '</label>
            <div class="col-sm-8">
               <input class="form-control" type="text" name="forum_name" value="' . $forum_name . '" />
               <span class="help-block">' . adm_translate("(Redirection sur un forum externe : <.a href...)") . '</span>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_desc">' . adm_translate("Description") . '</label>
            <div class="col-sm-8">
               <textarea class="form-control" name="forum_desc" rows="5">' . $forum_desc . '</textarea>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_mod">' . adm_translate("Modérateur(s)") . '</label>';
    $moderator = str_replace(" ", ",", get_moderator($forum_mod));
    echo '
            <div class="col-sm-8">
               <input id="forum_mod" class="form-control" type="text" name="forum_mod" value="' . $moderator . '," />
            </div>
         </div>
      </div>';
    echo '
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_access">' . adm_translate("Niveau d'accès") . '</label>
            <div class="col-sm-8">
               <select class="c-select form-control" name="forum_access">';
    if ($forum_access == 0) {
        $sel0 = ' selected="selected"';
    }
    if ($forum_access == 1) {
        $sel1 = ' selected="selected"';
    }
    if ($forum_access == 2) {
        $sel2 = ' selected="selected"';
    }
    if ($forum_access == 9) {
        $sel9 = ' selected="selected"';
    }
    echo '
                  <option value="0"' . $sel0 . '>' . adm_translate("Publication Anonyme autorisée") . '</option>
                  <option value="1"' . $sel1 . '>' . adm_translate("Utilisateur enregistré uniquement") . '</option>
                  <option value="2"' . $sel2 . '>' . adm_translate("Modérateurs uniquement") . '</option>
                  <option value="9"' . $sel9 . '>' . adm_translate("Fermé") . '</option>
               </select>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4" for="cat_id">' . adm_translate("Catégories") . ' </label>
            <div class="col-sm-8">
               <select class="c-select form-control" name="cat_id">';
    $result = sql_query("SELECT cat_id, cat_title FROM " . $NPDS_Prefix . "catagories");
    while (list($cat_id, $cat_title) = sql_fetch_row($result)) {
        if ($cat_id == $cat_id_1) {
            echo '
                  <option value="' . $cat_id . '" selected="selected">' . StripSlashes($cat_title) . '</option>';
        } else {
            echo '
                  <option value="' . $cat_id . '">' . StripSlashes($cat_title) . '</option>';
        }
    }
    echo '
               </select>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_type">' . adm_translate("Type") . '</label>
            <div class="col-sm-8">
               <select class="c-select form-control" name="forum_type">';
    if ($forum_type == 0) {
        $sel0 = ' selected="selected"';
    } else {
        $sel0 = '';
    }
    if ($forum_type == 1) {
        $sel1 = ' selected="selected"';
    } else {
        $sel1 = '';
    }
    if ($forum_type == 5) {
        $sel5 = ' selected="selected"';
    } else {
        $sel5 = '';
    }
    if ($forum_type == 6) {
        $sel6 = ' selected="selected"';
    } else {
        $sel6 = '';
    }
    if ($forum_type == 7) {
        $sel7 = ' selected="selected"';
    } else {
        $sel7 = '';
    }
    if ($forum_type == 8) {
        $sel8 = ' selected="selected"';
    } else {
        $sel8 = '';
    }
    if ($forum_type == 9) {
        $sel9 = ' selected="selected"';
    } else {
        $sel9 = '';
    }
    echo '
                  <option value="0"' . $sel0 . '>' . adm_translate("Public") . '</option>
                  <option value="1"' . $sel1 . '>' . adm_translate("Privé") . '</option>
                  <option value="5"' . $sel5 . '>PHP Script + ' . adm_translate("Groupe") . '</option>
                  <option value="6"' . $sel6 . '>PHP Script</option>
                  <option value="7"' . $sel7 . '>' . adm_translate("Groupe") . '</option>
                  <option value="8"' . $sel8 . '>' . adm_translate("Texte étendu") . '</option>
                  <option value="9"' . $sel9 . '>' . adm_translate("Caché") . '</option>
               </select>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="arbre">' . adm_translate("Mode") . '</label>
            <div class="col-sm-8">
               <select class="c-select form-control" name="arbre">';
    if ($arbre) {
        echo '
                  <option value="0">' . adm_translate("Standard") . '</option>
                  <option value="1" selected="selected">' . adm_translate("Arbre") . '</option>';
    } else {
        echo '
                  <option value="0" selected="selected">' . adm_translate("Standard") . '</option>
                  <option value="1">' . adm_translate("Arbre") . '</option>';
    }
    echo '
               </select>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="attachement">' . adm_translate("Attachement") . '</label>
            <div class="col-sm-8">
               <select class="c-select form-control" name="attachement">';
    if ($attachement) {
        echo '
                  <option value="0">' . adm_translate("Non") . '</option>
                  <option value="1" selected="selected">' . adm_translate("Oui") . '</option>';
    } else {
        echo '
                  <option value="0" selected="selected">' . adm_translate("Non") . '</option>
                  <option value="1">' . adm_translate("Oui") . '</option>';
    }
    echo '
               </select>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="forum_pass">' . adm_translate("- Mot de Passe (si Privé) - Le nom du fichier de formulaire (si Texte étendu) => modules/sform/forum - Les Groupes ID (si Groupe)") . '</label>
            <div class="col-sm-8">
               <input class="form-control" type="text" name="forum_pass" value="' . $forum_pass . '" />
            </div>
         </div>
      </div>
      <input type="hidden" name="ctg" value="' . StripSlashes($ctg) . '" />
      <input type="hidden" name="op" value="ForumGoSave" />
      <div class="form-group">
         <div class="row">
            <div class="col-sm-offset-4 col-sm-8">
                <button class="btn btn-primary" type="submit">' . adm_translate("Sauver les modifications") . '</button>
            </div>
         </div>
      </div>
   </form>';
    echo auto_complete_multi('modera', 'uname', 'users', 'forum_mod', 'WHERE uid<>1');
    adminfoot('fv', '', '', '');
}
Exemple #7
0
 function update_auto()
 {
     $date_from = $this->input->get("date_from");
     $date_to = $this->input->get("date_to");
     if ($date_from != '' && $date_to != '') {
         $from = date_create(format_tanggal_barat($date_from));
         $to = date_create(format_tanggal_barat($date_to));
         while ($from <= $to) {
             $user_code = get_moderator(siang(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'SIANG');
             }
             $user_code = get_moderator(siang2(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'SIANG');
             }
             $user_code = get_moderator(siang_beat(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'SIANG');
             }
             $user_code = get_moderator(siang_move(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'SIANG');
             }
             $user_code = get_moderator(malam(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'MALAM');
             }
             $user_code = get_moderator(malam2(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'MALAM');
             }
             $user_code = get_moderator(malam_beat(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'MALAM');
             }
             $user_code = get_moderator(malam_move(date_format($from, 'Y-m-d')));
             if ($user_code != '') {
                 $data[] = array('user_code' => $user_code[0], 'absen_date' => date_format($from, 'Y-m-d'), 'absen_type' => 'MALAM');
             }
             date_add($from, date_interval_create_from_date_string('1 days'));
         }
         $this->mdl_mod_absent->set($data);
         $this->session->set_flashdata('alert', '<div class="alert alert-success">Complete!!!</div>');
     } else {
         $this->session->set_flashdata('alert', '<div class="alert alert-danger">Date Empty!!!</div>');
     }
     redirect('mod_absent' . $this->_filter());
 }
Exemple #8
0
function ForumGoEdit($forum_id, $ctg)
{
    global $hlpfile, $NPDS_Prefix, $f_meta_nom, $f_titre, $adminimg;
    include "header.php";
    GraphicAdmin($hlpfile);
    $result = sql_query("SELECT forum_id, forum_name, forum_desc, forum_access, forum_moderator, cat_id, forum_type, forum_pass, arbre, attachement, forum_index FROM " . $NPDS_Prefix . "forums WHERE forum_id='{$forum_id}'");
    list($forum_id, $forum_name, $forum_desc, $forum_access, $forum_mod, $cat_id_1, $forum_type, $forum_pass, $arbre, $attachement, $forum_index) = sql_fetch_row($result);
    adminhead($f_meta_nom, $f_titre, $adminimg);
    echo '
   <hr />
   <h3>' . adm_translate("Editer") . ' : <span class="text-muted">' . $forum_name . '</span></h3>
   <form id="fad_editforu" action="admin.php" method="post">
   <input type="hidden" name="forum_id" value="' . $forum_id . '" />
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="forum_index">' . adm_translate("Index") . '</label>
         <div class="col-sm-8">
            <input class="form-control" type="number" name="forum_index" max="9999" value="' . $forum_index . '" />
         </div>
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="forum_name">' . adm_translate("Nom du forum") . '</label>
         <div class="col-sm-8">
            <input class="form-control" type="text" id="forum_name" name="forum_name" value="' . $forum_name . '" />
            <span class="help-block">' . adm_translate("(Redirection sur un forum externe : <.a href...)") . '<span id="countcar_forum_name"></span></span>
         </div>
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="forum_desc">' . adm_translate("Description") . '</label>
         <div class="col-sm-8">
            <textarea class="form-control" name="forum_desc" rows="5">' . $forum_desc . '</textarea>
         </div>
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="forum_mod">' . adm_translate("Modérateur(s)") . '</label>';
    $moderator = str_replace(' ', ',', get_moderator($forum_mod));
    echo '
         <div class="col-sm-8">
            <input id="forum_mod" class="form-control" type="text" name="forum_mod" value="' . $moderator . '," />
         </div>
      </div>';
    echo '
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="forum_access">' . adm_translate("Niveau d'accès") . '</label>
         <div class="col-sm-8">
            <select class="custom-select form-control" name="forum_access">';
    if ($forum_access == 0) {
        $sel0 = ' selected="selected"';
    }
    if ($forum_access == 1) {
        $sel1 = ' selected="selected"';
    }
    if ($forum_access == 2) {
        $sel2 = ' selected="selected"';
    }
    if ($forum_access == 9) {
        $sel9 = ' selected="selected"';
    }
    echo '
               <option value="0"' . $sel0 . '>' . adm_translate("Publication Anonyme autorisée") . '</option>
               <option value="1"' . $sel1 . '>' . adm_translate("Utilisateur enregistré uniquement") . '</option>
               <option value="2"' . $sel2 . '>' . adm_translate("Modérateurs uniquement") . '</option>
               <option value="9"' . $sel9 . '>' . adm_translate("Fermé") . '</option>
            </select>
         </div>
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="cat_id">' . adm_translate("Catégories") . ' </label>
         <div class="col-sm-8">
            <select class="custom-select form-control" name="cat_id">';
    $result = sql_query("SELECT cat_id, cat_title FROM " . $NPDS_Prefix . "catagories");
    while (list($cat_id, $cat_title) = sql_fetch_row($result)) {
        if ($cat_id == $cat_id_1) {
            echo '
               <option value="' . $cat_id . '" selected="selected">' . StripSlashes($cat_title) . '</option>';
        } else {
            echo '
               <option value="' . $cat_id . '">' . StripSlashes($cat_title) . '</option>';
        }
    }
    echo '
            </select>
         </div>
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="forum_type">' . adm_translate("Type") . '</label>
         <div class="col-sm-8">
            <select class="custom-select form-control" id="forum_type" name="forum_type">';
    if ($forum_type == 0) {
        $sel0 = ' selected="selected"';
    } else {
        $sel0 = '';
    }
    if ($forum_type == 1) {
        $sel1 = ' selected="selected"';
    } else {
        $sel1 = '';
    }
    if ($forum_type == 5) {
        $sel5 = ' selected="selected"';
    } else {
        $sel5 = '';
    }
    if ($forum_type == 6) {
        $sel6 = ' selected="selected"';
    } else {
        $sel6 = '';
    }
    if ($forum_type == 7) {
        $sel7 = ' selected="selected"';
    } else {
        $sel7 = '';
    }
    if ($forum_type == 8) {
        $sel8 = ' selected="selected"';
    } else {
        $sel8 = '';
    }
    if ($forum_type == 9) {
        $sel9 = ' selected="selected"';
    } else {
        $sel9 = '';
    }
    echo '
               <option value="0"' . $sel0 . '>' . adm_translate("Public") . '</option>
               <option value="1"' . $sel1 . '>' . adm_translate("Privé") . '</option>
               <option value="5"' . $sel5 . '>PHP Script + ' . adm_translate("Groupe") . '</option>
               <option value="6"' . $sel6 . '>PHP Script</option>
               <option value="7"' . $sel7 . '>' . adm_translate("Groupe") . '</option>
               <option value="8"' . $sel8 . '>' . adm_translate("Texte étendu") . '</option>
               <option value="9"' . $sel9 . '>' . adm_translate("Caché") . '</option>
            </select>
         </div>
      </div>
      <div class="form-group row" id="the_multi_input_lol">
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="arbre">' . adm_translate("Mode") . '</label>
         <div class="col-sm-8">
            <select class="custom-select form-control" name="arbre">';
    if ($arbre) {
        echo '
               <option value="0">' . adm_translate("Standard") . '</option>
               <option value="1" selected="selected">' . adm_translate("Arbre") . '</option>';
    } else {
        echo '
               <option value="0" selected="selected">' . adm_translate("Standard") . '</option>
               <option value="1">' . adm_translate("Arbre") . '</option>';
    }
    echo '
            </select>
         </div>
      </div>
      <div class="form-group row">
         <label class="form-control-label col-sm-4" for="attachement">' . adm_translate("Attachement") . '</label>
         <div class="col-sm-8">
            <select class="custom-select form-control" name="attachement">';
    if ($attachement) {
        echo '
               <option value="0">' . adm_translate("Non") . '</option>
               <option value="1" selected="selected">' . adm_translate("Oui") . '</option>';
    } else {
        echo '
               <option value="0" selected="selected">' . adm_translate("Non") . '</option>
               <option value="1">' . adm_translate("Oui") . '</option>';
    }
    echo '
            </select>
         </div>
      </div>
      <input type="hidden" name="ctg" value="' . StripSlashes($ctg) . '" />
      <input type="hidden" name="op" value="ForumGoSave" />
      <div class="form-group row">
         <div class="col-sm-8 offset-sm-4">
             <button class="btn btn-primary" type="submit">' . adm_translate("Sauver les modifications") . '</button>
         </div>
      </div>
   </form>';
    echo auto_complete_multi('modera', 'uname', 'users', 'forum_mod', 'WHERE uid<>1');
    echo '
   <script type="text/javascript">
   //<![CDATA[
      var inp = $("#the_multi_input_lol");
      var htmh="",htmhe="",htmf="",lab="",inp_para="";
      htmh +=\'            <label class="form-control-label col-sm-4" for="forum_pass">\'
      htmhe +=\'</label>\\n\';
      htmhe +=\'            <div class="col-sm-8">\\n\';
      htmf +=\'            </div>\\n\';
      var select = $("#forum_type");
      select.change(function(){
         var type = $(this).val();
         switch (type) {
            case "1":
            lab="' . adm_translate("Mot de Passe") . '";
            inp_para=\'<input class="form-control" type="password" name="forum_pass" id="forum_pass" maxlength="60" required="required" />\\n\';
            inp.html(htmh+lab+htmhe+inp_para+htmf);
            break;
            case "7": case"5":
            lab="' . adm_translate("Groupe ID") . '";
            inp_para=\'<input class="form-control" type="number" name="forum_pass" id="forum_pass" required="required" />\\n\';
            inp.html(htmh+lab+htmhe+inp_para+htmf);
            break;
            case "8":
            lab="' . adm_translate("Fichier de formulaire") . '";
            inp_para=\'<input class="form-control" type="text" name="forum_pass" id="forum_pass" />\\n<span class="help-block">=> modules/sform/forum</span>\\n\';
            inp.html(htmh+lab+htmhe+inp_para+htmf);
            break;
            default:
            inp.html("");
            break;
         }
      }).change();
      $(document).ready(function() {
         inpandfieldlen("forum_name",150);
//         inpandfieldlen("add_name",50);
      });
   //]]>
   </script>';
    adminfoot('fv', '', '', '');
}
Exemple #9
0
function forum($rowQ1)
{
    global $user, $subscribe, $theme, $NPDS_Prefix, $admin, $adminforum;
    //==> droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    $adminforum = false;
    if ($admin) {
        $adminX = base64_decode($admin);
        $adminR = explode(':', $adminX);
        $Q = sql_fetch_assoc(sql_query("SELECT * FROM " . $NPDS_Prefix . "authors WHERE aid='{$adminR['0']}' LIMIT 1"));
        if ($Q['radminsuper'] == 1) {
            $adminforum = 1;
        } else {
            $R = sql_query("SELECT fnom, fid, radminsuper FROM " . $NPDS_Prefix . "authors a LEFT JOIN " . $NPDS_Prefix . "droits d ON a.aid = d.d_aut_aid LEFT JOIN " . $NPDS_Prefix . "fonctions f ON d.d_fon_fid = f.fid WHERE a.aid='{$adminR['0']}' AND f.fid BETWEEN 13 AND 15");
            if (sql_num_rows($R) >= 1) {
                $adminforum = 1;
            }
        }
    }
    //<== droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    if ($user) {
        $userX = base64_decode($user);
        $userR = explode(':', $userX);
        $tab_groupe = valid_group($user);
    }
    if ($ibid = theme_image("forum/icons/red_folder.gif")) {
        $imgtmpR = $ibid;
    } else {
        $imgtmpR = "images/forum/icons/red_folder.gif";
    }
    if ($ibid = theme_image("forum/icons/folder.gif")) {
        $imgtmp = $ibid;
    } else {
        $imgtmp = "images/forum/icons/folder.gif";
    }
    // preparation de la gestion des folders
    $result = sql_query("SELECT forum_id, COUNT(topic_id) AS total FROM " . $NPDS_Prefix . "forumtopics GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][0] = $total;
        // Topic
    }
    $result = sql_query("SELECT forum_id, COUNT(DISTINCT topicid) AS total FROM " . $NPDS_Prefix . "forum_read WHERE uid='{$userR['0']}' AND topicid>'0' AND status!='0' GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][1] = $total;
        // Folder
    }
    // préparation de la gestion des abonnements
    $result = sql_query("SELECT forumid FROM " . $NPDS_Prefix . "subscribe WHERE uid='{$userR['0']}'");
    while (list($forumid) = sql_fetch_row($result)) {
        $tab_subscribe[$forumid] = true;
    }
    // preparation du compteur total_post
    $rowQ0 = Q_Select("SELECT forum_id, COUNT(post_aff) AS total FROM " . $NPDS_Prefix . "posts GROUP BY forum_id", 600);
    while (list(, $row0) = each($rowQ0)) {
        $tab_total_post[$row0['forum_id']] = $row0['total'];
    }
    $ibid = '';
    if ($rowQ1) {
        while (list(, $row) = each($rowQ1)) {
            $title_aff = true;
            $rowQ2 = Q_Select("SELECT * FROM " . $NPDS_Prefix . "forums WHERE cat_id = '" . $row['cat_id'] . "' AND SUBSTRING(forum_name,1,3)!='<!>' ORDER BY forum_index,forum_id", 21600);
            if ($rowQ2) {
                while (list(, $myrow) = each($rowQ2)) {
                    // Gestion des Forums Cachés aux non-membres
                    if ($myrow['forum_type'] != "9" or $userR) {
                        // Gestion des Forums réservés à un groupe de membre
                        if ($myrow['forum_type'] == "7" or $myrow['forum_type'] == "5") {
                            $ok_affich = groupe_forum($myrow['forum_pass'], $tab_groupe);
                            if (isset($admin) and $adminforum == 1) {
                                $ok_affich = true;
                            }
                            // to see when admin mais pas assez precis
                        } else {
                            $ok_affich = true;
                        }
                        if ($ok_affich) {
                            if ($title_aff) {
                                $title = stripslashes($row['cat_title']);
                                if (file_exists("themes/{$theme}/html/forum-cat" . $row['cat_id'] . ".html") or file_exists("themes/default/html/forum-cat" . $row['cat_id'] . ".html")) {
                                    $ibid .= '
                           <div class="list-group mt-1" id="catfo_' . $row['cat_id'] . '" >
                              <a class="list-group-item list-group-item-action active" href="forum.php?catid=' . $row['cat_id'] . '"><h5 class="list-group-item-heading" >' . $title . '</h5></a>';
                                } else {
                                    $ibid .= '
                           <div class="list-group mt-1" id="catfo_' . $row['cat_id'] . '">
                              <div class="list-group-item list-group-item-action active"><h5 class="list-group-item-heading" >' . $title . '</h5></div>';
                                }
                                $title_aff = false;
                            }
                            $forum_moderator = explode(' ', get_moderator($myrow['forum_moderator']));
                            $Mmod = false;
                            for ($i = 0; $i < count($forum_moderator); $i++) {
                                if ($userR[1] == $forum_moderator[$i]) {
                                    $Mmod = true;
                                }
                            }
                            $last_post = get_last_post($myrow['forum_id'], "forum", "infos", $Mmod);
                            $ibid .= '<p class="list-group-item list-group-item-action">';
                            if ($tab_folder[$myrow['forum_id']][0] - $tab_folder[$myrow['forum_id']][1] > 0) {
                                $ibid .= '<i class="fa fa-folder text-primary fa-lg" title="' . translate("New Posts since your last visit.") . '" data-toggle="tooltip" data-placement="right"></i>';
                            } else {
                                $ibid .= '<i class="fa fa-folder-o text-primary fa-lg" title="' . translate("No New Posts since your last visit.") . '" data-toggle="tooltip" data-placement="right"></i>';
                            }
                            $name = stripslashes($myrow['forum_name']);
                            $redirect = false;
                            if (strstr(strtoupper($name), "<a HREF")) {
                                $redirect = true;
                            } else {
                                $ibid .= '
                        <a href="viewforum.php?forum=' . $myrow['forum_id'] . '" >' . $name . '</a>';
                            }
                            if (!$redirect) {
                                $ibid .= ' 
            <span class="tag tag-default ml-1" style=" position: relative; float: right;" title="' . translate("Posts") . '" data-toggle="tooltip">' . $tab_total_post[$myrow['forum_id']] . '</span>
            <span class="tag tag-default " style=" position: relative; float: right;" title="' . translate("Topics") . '" data-toggle="tooltip">' . $tab_folder[$myrow['forum_id']][0] . '</span>';
                            }
                            $desc = stripslashes(meta_lang($myrow['forum_desc']));
                            if ($desc != '') {
                                $ibid .= '<br />' . $desc;
                            }
                            if (!$redirect) {
                                $ibid .= '<br />[ ';
                                if ($myrow['forum_access'] == "0" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Free for All");
                                }
                                if ($myrow['forum_type'] == "1") {
                                    $ibid .= translate("Private");
                                }
                                if ($myrow['forum_type'] == "5") {
                                    $ibid .= "PHP Script + " . translate("Group");
                                }
                                if ($myrow['forum_type'] == "6") {
                                    $ibid .= "PHP Script";
                                }
                                if ($myrow['forum_type'] == "7") {
                                    $ibid .= translate("Group");
                                }
                                if ($myrow['forum_type'] == "8") {
                                    $ibid .= translate("Extended Text");
                                }
                                if ($myrow['forum_type'] == "9") {
                                    $ibid .= translate("Hidden");
                                }
                                if ($myrow['forum_access'] == "1" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Registered User");
                                }
                                if ($myrow['forum_access'] == "2" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Moderator");
                                }
                                if ($myrow['forum_access'] == "9") {
                                    $ibid .= ' <strong class="text-danger">' . translate("Closed") . '</strong>';
                                }
                                $ibid .= ' ]';
                                $ibid .= '<br />';
                                // Subscribe
                                if ($subscribe and $user) {
                                    if (!$redirect) {
                                        if ($tab_subscribe[$myrow['forum_id']]) {
                                            $ibid .= '<input class="n-ckbf" type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" checked="checked" title="" data-toggle="tooltip" />';
                                        } else {
                                            $ibid .= '<input class="n-ckbf" type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" title="' . translate("Check me and click on OK button to receive an Email when is a new submission in this forum.") . '" data-toggle="tooltip" data-placement="right" />';
                                        }
                                    }
                                }
                                $ibid .= '<span class="float-xs-right">' . $last_post . '</span><br />';
                            } else {
                                $ibid .= '';
                            }
                        }
                    }
                }
                if ($ok_affich) {
                    $ibid .= '
            </p>
         </div>';
                }
            }
        }
    }
    if ($subscribe and $user and $ok_affich) {
        $ibid .= '<input type="checkbox" id="ckball_f" />&nbsp;<span class=" text-muted" id="ckb_status_f">Tout cocher</span>';
    }
    return $ibid;
}