Ejemplo n.º 1
0
/**
 * SUMO MODULE: Relationship
 * 
 * @version    0.5.0
 * @link       http://sumoam.sourceforge.net SUMO Access Manager
 * @author     Alberto Basso <*****@*****.**>
 * @copyright  Copyright &copy; 2003-2009, Alberto Basso
 * @package    SUMO
 * @category   Console
 */
sumo_set_table_settings();
$num_groups = count($SUMO['user']['group']);
// Create sql query	to select only groups of user
// and optionally search only users of a group
$group_query = sumo_get_group_query(false, true);
// Create search query
$search = '';
if ($_SESSION['search_relationship_group2accesspoints']) {
    $field['usergroup'] = sumo_search_composer($_SESSION['search_relationship_group2accesspoints'], 'usergroup');
    $search = $group_query ? " AND " : " WHERE ";
    $search = $search . " (" . $field['usergroup'][0] . ")";
}
$query1 = "SELECT id,usergroup FROM " . SUMO_TABLE_GROUPS . " " . $group_query . " " . $search . "";
$query2 = $query1 . " ORDER BY " . $_SESSION['relationship']['group2accesspoints']['col_sql'] . " " . $_SESSION['relationship']['group2accesspoints']['mode_sql'];
$rs = $SUMO['DB']->Execute($query1);
$tot = $rs->PO_RecordCount();
$rs = $SUMO['DB']->SelectLimit($query2, $_SESSION['rows_relationship_group2accesspoints'], $_SESSION['start_relationship_group2accesspoints']);
$vis = $rs->PO_RecordCount();
/**
 * Create list
Ejemplo n.º 2
0
 * @copyright  Copyright &copy; 2003-2009, Alberto Basso
 * @package    SUMO
 * @category   Console
 */
// set table settings
sumo_set_table_settings();
// Create search query
$search = '';
if ($_SESSION['search_accesspoints_list']) {
    $field['b.name'] = sumo_search_composer($_SESSION['search_accesspoints_list'], 'b.name');
    $field['a.path'] = sumo_search_composer($_SESSION['search_accesspoints_list'], 'a.path');
    $field['a.name'] = sumo_search_composer($_SESSION['search_accesspoints_list'], 'a.name');
    $search = $field['a.path'][0] && $field['a.name'][0] && $field['b.name'][0] ? " AND (" . $field['a.path'][0] . " OR " . $field['a.name'][0] . " OR " . $field['b.name'][0] . ") " : '';
}
// Create sql query	to select only groups of user
$group_query = sumo_get_group_query($search);
$query = "SELECT a.id AS id, b.\"name\" AS node_name, a.path AS path, a.\"name\" AS \"name\", \na.usergroup AS usergroup, a.http_auth AS http_auth, a.filtering AS filtering,\na.pwd_encrypt AS pwd_encrypt, a.registration AS registration, a.reg_group AS reg_group, \na.change_pwd AS change_pwd, a.theme AS theme, a.created AS created, a.updated AS updated,\nb.id AS node_id\nFROM " . SUMO_TABLE_ACCESSPOINTS . " a, " . SUMO_TABLE_NODES . " b \nWHERE a.node = b.id " . $search . " " . $group_query . " \nORDER BY " . $_SESSION['accesspoints']['list']['col_sql'] . " " . $_SESSION['accesspoints']['list']['mode_sql'];
// MySQL Fix
$query = str_replace('"', '', $query);
$rs = $SUMO['DB']->Execute($query);
switch ($_POST['type']) {
    case '':
    case 'csv':
        $ext = 'csv';
        break;
    case 'xls':
        $ext = 'xls';
        break;
    case 'csvdump':
        $ext = 'dump.csv';
        break;