Esempio n. 1
0
    if ($sortby == 'oldest') {
        $order_by = "group_date ASC";
    }
    if ($sortby == 'members') {
        $order_by = "group_members DESC";
    }
    if ($sortby == 'name') {
        $order_by = "group_name Asc";
    }
    $main_smarty->assign('sortby', $sortby);
}
// pagename
define('pagename', 'groups');
$main_smarty->assign('pagename', pagename);
$main_smarty = do_sidebar($main_smarty);
group_read($from_where, $order_by);
function group_read($from_where, $order_by)
{
    global $db, $main_smarty, $view, $user, $rows, $page_size, $offset;
    // figure out what "page" of the results we're on
    $offset = (get_current_page() - 1) * $page_size;
    // pagesize set in the admin panel
    $search->pagesize = $page_size;
    if ($order_by == "") {
        $order_by = "group_date DESC";
    }
    include_once mnminclude . 'smartyvariables.php';
    global $db, $main_smarty;
    $rows = $db->get_var("SELECT count(*) FROM " . table_groups . " WHERE " . $from_where . " ");
    $group = $db->get_results("SELECT distinct(group_id) as group_id FROM " . table_groups . " WHERE " . $from_where . " ORDER BY group_status DESC, " . $order_by . " LIMIT {$offset},{$page_size} ");
    if ($group) {
Esempio n. 2
0
            $allowthread = param('allowthread', 0);
            $allowpost = param('allowpost', 0);
            $allowattach = param('allowattach', 0);
            $allowdown = param('allowdown', 0);
            $allowagree = param('allowagree', 0);
            $allowtop = param('allowtop', 0);
            $allowupdate = param('allowupdate', 0);
            $allowdelete = param('allowdelete', 0);
            $allowmove = param('allowmove', 0);
            $allowbanuser = param('allowbanuser', 0);
            $allowdeleteuser = param('allowdeleteuser', 0);
            $allowviewip = param('allowviewip', 0);
            $allowcustomurl = param('allowcustomurl', 0);
            $arr2 = array('allowread' => $allowread, 'allowthread' => $allowthread, 'allowpost' => $allowpost, 'allowattach' => $allowattach, 'allowdown' => $allowdown, 'allowagree' => $allowagree, 'allowtop' => $allowtop, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete, 'allowmove' => $allowmove, 'allowbanuser' => $allowbanuser, 'allowdeleteuser' => $allowdeleteuser, 'allowviewip' => $allowviewip, 'allowcustomurl' => $allowcustomurl);
            $arr += $arr2;
        }
        // 更新
        $r = group_update($gid, $arr);
        $r !== FALSE ? message(0, '更新成功') : message(-1, '更新失败');
    }
} elseif ($action == 'delete') {
    if ($method != 'POST') {
        message(-1, 'Method Error.');
    }
    $gid = param(2, 0);
    $group = group_read($gid);
    empty($group) and message(1, '用户组不存在');
    $gid <= 101 and message(-1, '该用户组不允许删除!');
    $r = group_delete($gid);
    $r !== FALSE ? message(0, '删除成功') : message(1, '删除失败');
}