예제 #1
0
파일: profile.php 프로젝트: Ekleog/platal
 public static function getPIDsFromUIDs($uids, $respect_order = true)
 {
     if ($respect_order) {
         $order = 'ORDER BY ' . XDB::formatCustomOrder('uid', $uids);
     } else {
         $order = '';
     }
     return XDB::fetchAllAssoc('uid', 'SELECT  ap.uid, ap.pid
                                         FROM  account_profiles AS ap
                                        WHERE  FIND_IN_SET(\'owner\', ap.perms)
                                               AND ap.uid IN ' . XDB::formatArray($uids) . '
                                            ' . $order);
 }
예제 #2
0
파일: user.php 프로젝트: pombredanne/platal
 protected static function loadMainFieldsFromUIDs(array $uids, $respect_order = true)
 {
     if (empty($uids)) {
         return PlIteratorUtils::emptyIterator();
     }
     global $globals;
     $joins = '';
     $fields = array();
     if ($globals->asso('id')) {
         $joins .= XDB::format("LEFT JOIN group_members AS gpm ON (gpm.uid = a.uid AND gpm.asso_id = {?})\n", $globals->asso('id'));
         $fields[] = 'gpm.perms AS group_perms';
         $fields[] = 'gpm.comm AS group_comm';
         $fields[] = 'gpm.position AS group_position';
     }
     if (count($fields) > 0) {
         $fields = ', ' . implode(', ', $fields);
     } else {
         $fields = '';
     }
     if ($respect_order) {
         $order = 'ORDER BY ' . XDB::formatCustomOrder('a.uid', $uids);
     } else {
         $order = '';
     }
     $uids = array_map(array('XDB', 'escape'), $uids);
     return XDB::iterator('SELECT  a.uid, a.hruid, a.registration_date, h.uid IS NOT NULL AS homonym, a.firstname, a.lastname,
                                   IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', mf.name)) AS forlife,
                                   IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', df.name)) AS forlife_alternate,
                                   IF(eb.email IS NULL, NULL, CONCAT(eb.email, \'@\', mb.name)) AS bestalias,
                                   (er.redirect IS NULL AND a.state = \'active\' AND FIND_IN_SET(\'mail\', at.perms)) AS lost,
                                   a.email, a.full_name, a.directory_name, a.display_name, a.sort_name, a.sex = \'female\' AS gender,
                                   IF(a.state = \'active\', CONCAT(at.perms, \',\', IF(a.user_perms IS NULL, \'\', a.user_perms)), \'\') AS perms,
                                   a.user_perms, a.email_format, a.is_admin, a.state, a.type, at.description AS type_description, a.skin,
                                   FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment,
                                   a.weak_password IS NOT NULL AS weak_access, g.g_account_name IS NOT NULL AS googleapps,
                                   a.token IS NOT NULL AS token_access, a.token, a.last_version,
                                   s.start AS lastlogin, s.host, fp.last_seen AS banana_last
                                   ' . $fields . '
                             FROM  accounts               AS a
                       INNER JOIN  account_types          AS at ON (at.type = a.type)
                        LEFT JOIN  email_source_account   AS ef ON (ef.uid = a.uid AND ef.type = \'forlife\')
                        LEFT JOIN  email_virtual_domains  AS mf ON (ef.domain = mf.id)
                        LEFT JOIN  email_virtual_domains  AS df ON (df.aliasing = mf.id AND
                                                                    df.name LIKE CONCAT(\'%\', {?}) AND df.name NOT LIKE \'alumni.%\')
                        LEFT JOIN  email_source_account   AS eb ON (eb.uid = a.uid AND FIND_IN_SET(\'bestalias\',eb.flags))
                        LEFT JOIN  email_virtual_domains  AS mb ON (a.best_domain = mb.id)
                        LEFT JOIN  email_redirect_account AS er ON (er.uid = a.uid AND er.flags = \'active\' AND er.broken_level < 3
                                                                    AND er.type != \'imap\' AND er.type != \'homonym\')
                        LEFT JOIN  homonyms_list          AS h  ON (h.uid = a.uid)
                        LEFT JOIN  gapps_accounts         AS g  ON (a.uid = g.l_userid AND g.g_status = \'active\')
                        LEFT JOIN  log_last_sessions      AS ls ON (ls.uid = a.uid)
                        LEFT JOIN  log_sessions           AS s  ON (s.id = ls.id)
                        LEFT JOIN  forum_profiles         AS fp ON (fp.uid = a.uid)
                                ' . $joins . '
                            WHERE  a.uid IN (' . implode(', ', $uids) . ')
                         GROUP BY  a.uid
                                ' . $order, $globals->mail->domain2, $globals->mail->domain2);
 }
예제 #3
0
 public static function fetchData(array $pids, Visibility $visibility)
 {
     $data = XDB::iterator('SELECT  ppss.pid, ppss.exposed_uid, ppss.sharing_level,
                                    ppss.allow_email, ppss.partner_id,
                                    ppse.shortname AS partner_shortname,
                                    ppse.name AS partner_name,
                                    ppse.url AS partner_url
                              FROM  profile_partnersharing_settings AS ppss
                         LEFT JOIN  profile_partnersharing_enum AS ppse ON (ppss.partner_id = ppse.id)
                             WHERE  ppss.pid IN {?}
                          ORDER BY  ' . XDB::formatCustomOrder('ppss.pid', $pids), $pids);
     return PlIteratorUtils::subIterator($data, PlIteratorUtils::arrayValueCallback('pid'));
 }