changeset 618 | 587b393f1e5e |
parent 603 | 33b274c8d357 |
child 629 | 8733c22969e7 |
617:9e4ccf67b6ea | 618:587b393f1e5e |
---|---|
1228 . ' ON ( u.user_id=x.user_id OR x.user_id IS NULL )' . "\n" |
1228 . ' ON ( u.user_id=x.user_id OR x.user_id IS NULL )' . "\n" |
1229 . ' LEFT JOIN '.table_prefix.'privmsgs AS p' . "\n" |
1229 . ' LEFT JOIN '.table_prefix.'privmsgs AS p' . "\n" |
1230 . ' ON ( p.message_to=u.username AND p.message_read=0 )' . "\n" |
1230 . ' ON ( p.message_to=u.username AND p.message_read=0 )' . "\n" |
1231 . ' WHERE k.session_key=\''.$keyhash.'\'' . "\n" |
1231 . ' WHERE k.session_key=\''.$keyhash.'\'' . "\n" |
1232 . ' AND k.salt=\''.$salt.'\'' . "\n" |
1232 . ' AND k.salt=\''.$salt.'\'' . "\n" |
1233 . ' GROUP BY u.user_id,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,u.user_lang,u.user_timezone,k.source_ip,k.time,k.auth_level,x.user_id, x.user_aim, x.user_yahoo, x.user_msn, x.user_xmpp, x.user_homepage, x.user_location, x.user_job, x.user_hobbies, x.email_public, x.disable_js_fx;'); |
1233 . ' GROUP BY u.user_id,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,u.user_lang,u.user_timezone,u.user_title,k.source_ip,k.time,k.auth_level,x.user_id, x.user_aim, x.user_yahoo, x.user_msn, x.user_xmpp, x.user_homepage, x.user_location, x.user_job, x.user_hobbies, x.email_public, x.disable_js_fx;'); |
1234 |
1234 |
1235 if ( !$query && ( defined('IN_ENANO_INSTALL') or defined('IN_ENANO_UPGRADE') ) ) |
1235 if ( !$query && ( defined('IN_ENANO_INSTALL') or defined('IN_ENANO_UPGRADE') ) ) |
1236 { |
1236 { |
1237 $query = $this->sql('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms, 1440 AS user_timezone FROM '.table_prefix.'session_keys AS k |
1237 $query = $this->sql('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms, 1440 AS user_timezone FROM '.table_prefix.'session_keys AS k |
1238 LEFT JOIN '.table_prefix.'users AS u |
1238 LEFT JOIN '.table_prefix.'users AS u |
2481 $assoc[] = " ( u.user_level = $level AND rl.rank_id = $rank )"; |
2481 $assoc[] = " ( u.user_level = $level AND rl.rank_id = $rank )"; |
2482 } |
2482 } |
2483 $assoc = implode(" OR\n", $assoc) . "\n"; |
2483 $assoc = implode(" OR\n", $assoc) . "\n"; |
2484 |
2484 |
2485 $gid_col = ( ENANO_DBLAYER == 'PGSQL' ) ? |
2485 $gid_col = ( ENANO_DBLAYER == 'PGSQL' ) ? |
2486 'array_to_string(array_accum(m.group_id), \',\') AS group_list' : |
2486 'array_to_string(' . table_prefix . 'array_accum(m.group_id), \',\') AS group_list' : |
2487 'GROUP_CONCAT(m.group_id) AS group_list'; |
2487 'GROUP_CONCAT(m.group_id) AS group_list'; |
2488 |
2488 |
2489 // The actual query |
2489 // The actual query |
2490 $sql = "SELECT u.user_id, u.username, u.user_level, u.user_group, u.user_rank, u.user_title, g.group_rank,\n" |
2490 $sql = "SELECT u.user_id, u.username, u.user_level, u.user_group, u.user_rank, u.user_title, g.group_rank,\n" |
2491 . " COALESCE(ru.rank_id, rg.rank_id, rl.rank_id, rd.rank_id ) AS rank_id,\n" |
2491 . " COALESCE(ru.rank_id, rg.rank_id, rl.rank_id, rd.rank_id ) AS rank_id,\n" |
2492 . " COALESCE(ru.rank_title, rg.rank_title, rl.rank_title, rd.rank_title) AS rank_title,\n" |
2492 . " COALESCE(ru.rank_title, rg.rank_title, rl.rank_title, rd.rank_title) AS rank_title,\n" |
2493 . " COALESCE(ru.rank_style, rg.rank_style, rl.rank_style, rd.rank_style) AS rank_style,\n" |
2493 . " COALESCE(ru.rank_style, rg.rank_style, rl.rank_style, rd.rank_style) AS rank_style,\n" |
2494 . " rg.rank_id AS group_rank_id," |
|
2494 . " ( ru.rank_id IS NULL AND rg.rank_id IS NULL ) AS using_default," |
2495 . " ( ru.rank_id IS NULL AND rg.rank_id IS NULL ) AS using_default," |
2495 . " ( ru.rank_id IS NULL AND rg.rank_id IS NOT NULL ) AS using_group," |
2496 . " ( ru.rank_id IS NULL AND rg.rank_id IS NOT NULL ) AS using_group," |
2496 . " $gid_col\n" |
2497 . " $gid_col\n" |
2497 . " FROM " . table_prefix . "users AS u\n" |
2498 . " FROM " . table_prefix . "users AS u\n" |
2498 . " LEFT JOIN " . table_prefix . "groups AS g\n" |
2499 . " LEFT JOIN " . table_prefix . "groups AS g\n" |
3992 } |
3993 } |
3993 |
3994 |
3994 // Build a query to grab ACL info |
3995 // Build a query to grab ACL info |
3995 $bs = 'SELECT rules,target_type,target_id,page_id,namespace,rule_id,pg.pg_name,g.group_name FROM '.table_prefix."acl AS a\n" |
3996 $bs = 'SELECT rules,target_type,target_id,page_id,namespace,rule_id,pg.pg_name,g.group_name FROM '.table_prefix."acl AS a\n" |
3996 . " LEFT JOIN " . table_prefix . "page_groups AS pg\n" |
3997 . " LEFT JOIN " . table_prefix . "page_groups AS pg\n" |
3997 . " ON ( ( a.page_id = pg.pg_id AND a.namespace = '__PageGroup' ) OR ( a.namespace != '__PageGroup' ) )\n" |
3998 . " ON ( ( a.page_id = CAST(pg.pg_id AS char) AND a.namespace = '__PageGroup' ) OR ( a.namespace != '__PageGroup' ) )\n" |
3998 . " LEFT JOIN " . table_prefix . "groups AS g\n" |
3999 . " LEFT JOIN " . table_prefix . "groups AS g\n" |
3999 . " ON ( ( a.target_type = " . ACL_TYPE_GROUP . " AND a.target_id = g.group_id ) OR ( a.target_type != " . ACL_TYPE_GROUP . " ) )\n"; |
4000 . " ON ( ( a.target_type = " . ACL_TYPE_GROUP . " AND a.target_id = g.group_id ) OR ( a.target_type != " . ACL_TYPE_GROUP . " ) )\n"; |
4000 |
4001 |
4001 $bs .= ' WHERE ' . "\n" |
4002 $bs .= ' WHERE ' . "\n" |
4002 . ' ( '; |
4003 . ' ( '; |