当前位置: 首页>>代码示例>>PHP>>正文


PHP XDB::fetchOneCell方法代码示例

本文整理汇总了PHP中XDB::fetchOneCell方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::fetchOneCell方法的具体用法?PHP XDB::fetchOneCell怎么用?PHP XDB::fetchOneCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XDB的用法示例。


在下文中一共展示了XDB::fetchOneCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(User $_user, Profile $_profile, array $_public_names, array $_old_public_names)
 {
     parent::__construct($_user, $_profile, true, 'usage');
     $this->public_names = $_public_names;
     $this->old_public_names = $_old_public_names;
     if (!is_null($this->profileOwner)) {
         require_once 'name.func.inc.php';
         $this->new_alias = build_email_alias($this->public_names);
         $this->old_alias = XDB::fetchOneCell('SELECT  email
                                                 FROM  email_source_account
                                                WHERE  uid = {?} AND type = \'alias\' AND FIND_IN_SET(\'usage\', flags)', $this->profileOwner->id());
         if ($this->old_alias == $this->new_alias) {
             $this->old_alias = $this->new_alias = null;
         } else {
             $used = XDB::fetchOneCell('SELECT  COUNT(uid)
                                          FROM  email_source_account
                                         WHERE  email = {?} AND type != \'alias_aux\'', $this->new_alias);
             if (!$used) {
                 // Check against homonyms
                 $used = XDB::fetchOneCell('SELECT  COUNT(email)
                                              FROM  email_source_other
                                             WHERE  email = {?}', $this->new_alias);
             }
             if ($used) {
                 $this->new_alias = null;
             }
         }
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:29,代码来源:names.inc.php

示例2: strongCheckId

function strongCheckId($subState)
{
    $subState->set('xorgid', Profile::getXorgId($subState->i('schoolid')));
    if (!$subState->v('xorgid')) {
        return 'Le matricule est incorrect.';
    }
    $uf = new UserFilter(new PFC_And(new UFC_SchoolId('xorg', $subState->i('xorgid')), new PFC_Not(new UFC_Dead()), new PFC_Not(new UFC_Registered(true))));
    $profile = $uf->getProfile();
    if (is_null($profile)) {
        $max_promo_year = XDB::fetchOneCell("SELECT  MAX(promo_year)\n                                               FROM  profile_education\n                                              WHERE  FIND_IN_SET(flags, 'primary')\n                                                     AND eduid = (\n                                                         SELECT  id\n                                                         FROM    profile_education_enum\n                                                         WHERE   abbreviation='X'\n                                                     )\n                                                     AND degreeid = (\n                                                         SELECT  id\n                                                         FROM    profile_education_degree_enum\n                                                         WHERE   abbreviation = 'Ing.'\n                                                     )");
        if ($subState->i('yearpromo') > $max_promo_year) {
            return "Ta promo n'est pas encore dans l'annuaire, réessaie dans quelques semaines.";
        }
        return "Cherche ton nom dans l'annuaire public. Si tu te trouves, tu es déjà inscrit ou ton matricule est incorrect ! Sinon envoie-nous un email à support@polytechnique.org";
    }
    if ($profile->promo() != $subState->s('promo')) {
        return 'Le matricule est incorrect.';
    }
    if (!$profile->compareNames($subState->s('firstname'), $subState->s('lastname'))) {
        return "Erreur dans l'identification. Réessaie, il y a une erreur quelque part !";
    }
    $subState->set('lastname', $profile->lastName());
    $subState->set('firstname', $profile->firstName());
    $subState->set('uid', $profile->owner()->id());
    $subState->set('watch', $profile->owner()->watch);
    $subState->set('comment', $profile->owner()->comment);
    $subState->set('birthdateRef', $profile->__get('birthdate_ref'));
    return true;
}
开发者ID:Ekleog,项目名称:platal,代码行数:29,代码来源:register.inc.php

示例3: countNonGeocoded

 public static function countNonGeocoded($pid)
 {
     $count = XDB::fetchOneCell('SELECT  COUNT(*)
                                   FROM  profile_addresses AS pa
                                  WHERE  pid = {?} AND type = \'home\'
                                         AND NOT EXISTS (SELECT  *
                                                           FROM  profile_addresses_components AS pc
                                                          WHERE  pa.pid = pc.pid AND pa.jobid = pc.jobid AND pa.groupid = pc.groupid
                                                                 AND pa.type = pc.type AND pa.id = pc.id)', $pid);
     return $count;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:11,代码来源:geocoder.php

示例4: check_email

function check_email($email, $message)
{
    $res = XDB::fetchOneCell('SELECT  COUNT(*)
                                FROM  email_watch
                               WHERE  state != \'safe\' AND email = {?}', $email);
    if ($res) {
        send_warning_mail($message);
        return true;
    }
    return false;
}
开发者ID:Ekleog,项目名称:platal,代码行数:11,代码来源:security.inc.php

示例5: ListMergeIssues

 private static function ListMergeIssues(Profile $profile)
 {
     if (Platal::globals()->merge->state != 'done') {
         return null;
     }
     $flags = XDB::fetchOneCell('SELECT  issues
                                   FROM  profile_merge_issues
                                  WHERE  pid = {?}', $profile->id());
     if (!$flags) {
         return null;
     }
     return new PlFlagSet($flags);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:13,代码来源:profile_update.inc.php

示例6: medal_name

 public function medal_name()
 {
     $name = XDB::fetchOneCell('SELECT  text
                                  FROM  profile_medal_enum
                                 WHERE  id = {?}', $this->mid);
     $grade = XDB::fetchOneCell('SELECT  text
                                   FROM  profile_medal_grade_enum
                                  WHERE  mid = {?} AND gid = {?}', $this->mid, $this->gid);
     if (is_null($grade)) {
         return $name;
     }
     return $name . ' (' . $grade . ')';
 }
开发者ID:Ekleog,项目名称:platal,代码行数:13,代码来源:medals.inc.php

示例7: __construct

 public function __construct(User $user, $hruid, $email, $group, $dim)
 {
     parent::__construct($user, false, 'account');
     $this->hruid = $hruid;
     $this->email = $email;
     $this->group = $group;
     $this->dim = $dim;
     $this->uid = XDB::fetchOneCell('SELECT  uid
                                       FROM  accounts
                                      WHERE  hruid = {?}', $hruid);
     $this->groups = XDB::fetchAllAssoc('SELECT  g.nom, g.diminutif
                                           FROM  groups AS g
                                     INNER JOIN  group_members AS m ON (g.id = m.asso_id)
                                          WHERE  m.uid = {?}
                                       ORDER BY  g.nom', $this->uid);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:16,代码来源:account.inc.php

示例8: handler_picture_token

 function handler_picture_token(PlPage $page, $size, $token)
 {
     XDB::rawExecute('DELETE FROM  profile_photo_tokens
                            WHERE  expires <= NOW()');
     $pid = XDB::fetchOneCell('SELECT  pid
                                 FROM  profile_photo_tokens
                                WHERE  token = {?}', $token);
     if ($pid != null) {
         $res = XDB::fetchOneAssoc('SELECT  attach, attachmime, x, y, last_update
                                      FROM  profile_photos
                                     WHERE  pid = {?}', $pid);
         $photo = PlImage::fromData($res['attach'], 'image/' . $res['attachmime'], $res['x'], $res['y'], $res['last_update']);
         $photo->send();
     } else {
         return PL_NOT_FOUND;
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:17,代码来源:sharingapi.php

示例9: handler_admin_url

 function handler_admin_url($page)
 {
     $page->changeTpl('urlshortener/admin.tpl');
     if (!Post::has('url')) {
         return;
     }
     $url = Post::t('url');
     $alias = Post::t('alias');
     $url_regex = '{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i';
     if (strlen($url) > 255 || !preg_match($url_regex, $url)) {
         $page->trigError("L'url donnée n'est pas valide.");
         return;
     }
     $page->assign('url', $url);
     if ($alias != '') {
         if (!preg_match('/^[a-zA-Z0-9\\-\\/]+$/i', $alias)) {
             $page->trigError("L'alias proposé n'est pas valide.");
             return;
         }
         if (preg_match('/^a\\//i', $alias)) {
             $page->trigError("L'alias commence par le préfixe 'a/' qui est réservé et donc non autorisé.");
             return;
         }
         $page->assign('alias', $alias);
         $used = XDB::fetchOneCell('SELECT  COUNT(*)
                                      FROM  url_shortener
                                     WHERE  alias = {?}', $alias);
         if ($used != 0) {
             $page->trigError("L'alias proposé est déjà utilisé.");
             return;
         }
     } else {
         do {
             $alias = 'a/' . rand_token(6);
             $used = XDB::fetchOneCell('SELECT  COUNT(*)
                                          FROM  url_shortener
                                         WHERE  alias = {?}', $alias);
         } while ($used != 0);
         $page->assign('alias', $alias);
     }
     XDB::execute('INSERT INTO  url_shortener (url, alias)
                        VALUES  ({?}, {?})', $url, $alias);
     $page->trigSuccess("L'url « " . $url . ' » est maintenant accessible depuis « http://u.w4x.org/' . $alias . ' ».');
 }
开发者ID:Ekleog,项目名称:platal,代码行数:44,代码来源:urlshortener.php

示例10: while

while ($nickname = $res->next()) {
    // Checks that the requested nickname doesn't look like a regular forlife;
    // we might run in troubler later if we don't keep the two repos. If we need
    // to add a forlife-looking nickname at some point, we'll do it manually.
    if (!preg_match('/^[-a-z]+\\.[-a-z]+\\.\\d{4}$/', $nickname['nickname'])) {
        $pending_tasks = XDB::fetchOneCell("SELECT  COUNT(*)\n               FROM  gapps_queue\n              WHERE  q_recipient_id = {?} AND p_status = 'idle' AND j_type = 'n_create' AND j_parameters = {?}", $nickname['id'], json_encode($nickname));
        if ($pending_tasks == 0) {
            XDB::execute("INSERT  INTO gapps_queue\n                    SET  q_recipient_id = {?}, p_entry_date = NOW(), p_notbefore_date = NOW(),\n                         p_priority = 'offline', j_type = 'n_create', j_parameters = {?}", $nickname['id'], json_encode($nickname));
        }
    }
}
/* Checks that all nicknames in GoogleApps are also aliases on plat/al side.
   Deletes the invalid ones. */
$res = XDB::iterator("SELECT  g.l_userid AS id, g.g_nickname AS nickname\n       FROM  gapps_nicknames AS g\n  LEFT JOIN  email_source_account AS s ON (s.uid = g.l_userid AND s.type = 'alias' AND s.email = g.g_nickname)\n      WHERE  g.l_userid IS NOT NULL AND s.email IS NULL");
while ($nickname = $res->next()) {
    $pending_tasks = XDB::fetchOneCell("SELECT  COUNT(*)\n           FROM  gapps_queue\n          WHERE  q_recipient_id = {?} AND p_status = 'idle' AND j_type = 'n_delete' AND j_parameters = {?}", $nickname['id'], json_encode($nickname));
    if ($pending_tasks == 0) {
        XDB::execute("INSERT  INTO gapps_queue\n                SET  q_recipient_id = {?}, p_entry_date = NOW(), p_notbefore_date = NOW(),\n                     p_priority = 'offline', j_type = 'n_delete', j_parameters = {?}", $nickname['id'], json_encode($nickname));
    }
}
/* Retrieves successful job queues for post-queue processing. */
$res = XDB::iterator("SELECT  q_id, q_recipient_id, j_type, j_parameters\n       FROM  gapps_queue\n      WHERE  p_status = 'success' AND q_recipient_id IS NOT NULL");
while ($job = $res->next()) {
    if ($job['j_type'] == 'u_create') {
        post_queue_u_create($job);
    } else {
        if ($job['j_type'] == 'u_update') {
            post_queue_u_update($job);
        }
    }
}
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:google_apps.php

示例11: mergeIn

 public function mergeIn(User $newuser)
 {
     if ($this->profile()) {
         // Don't disable user with profile in this way.
         global $globals;
         Platal::page()->trigError('Impossible de fusionner les comptes ' . $this->hruid . ' et ' . $newuser->hruid . '. Contacte support@' . $globals->mail->domain . '.');
         return false;
     }
     if ($this->forlifeEmail()) {
         // If the new user is not registered and does not have already an email address,
         // we need to give him the old user's email address if he has any.
         if (!$newuser->perms) {
             XDB::execute('UPDATE  accounts
                              SET  email = {?}
                            WHERE  uid = {?} AND email IS NULL', $this->forlifeEmail(), $newuser->id());
             // Reftech new user so its forlifeEmail will be correct.
             $newuser = self::getSilentWithUID($newuser->id());
         }
         // Change email used in mailing lists.
         if ($this->forlifeEmail() != $newuser->forlifeEmail()) {
             // The super user is the user who has the right to do the modification.
             $super_user = S::user();
             // group mailing lists
             $group_domains = XDB::fetchColumn('SELECT  g.mail_domain
                                                  FROM  groups        AS g
                                            INNER JOIN  group_members AS gm ON(g.id = gm.asso_id)
                                                 WHERE  g.mail_domain != \'\' AND gm.uid = {?}', $this->id());
             foreach ($group_domains as $mail_domain) {
                 $mmlist = new MMList($super_user, $mail_domain);
                 $mmlist->replace_email_in_all($this->forlifeEmail(), $newuser->forlifeEmail());
             }
             // main domain lists
             $mmlist = new MMList($super_user);
             $mmlist->replace_email_in_all($this->forlifeEmail(), $newuser->forlifeEmail());
         }
     }
     // Updates user in following tables.
     foreach (array('group_announces', 'payment_transactions', 'log_sessions', 'group_events') as $table) {
         XDB::execute('UPDATE  ' . $table . '
                          SET  uid = {?}
                        WHERE  uid = {?}', $newuser->id(), $this->id());
     }
     // Merges user in following tables, ie updates when possible, then deletes remaining occurences of the old user.
     foreach (array('group_announces_read', 'group_event_participants', 'group_member_sub_requests', 'group_members', 'email_redirect_account') as $table) {
         XDB::execute('UPDATE IGNORE  ' . $table . '
                                 SET  uid = {?}
                               WHERE  uid = {?}', $newuser->id(), $this->id());
         XDB::execute('DELETE FROM  ' . $table . '
                             WHERE  uid = {?}', $this->id());
     }
     // Eventually updates last session id and deletes old user's accounts entry.
     $lastSession = XDB::fetchOneCell('SELECT  id
                                         FROM  log_sessions
                                        WHERE  uid = {?}
                                     ORDER BY  start DESC
                                        LIMIT  1', $newuser->id());
     XDB::execute('UPDATE  log_last_sessions
                      SET  id = {?}
                    WHERE  uid = {?}', $lastSession, $newuser->id());
     XDB::execute('DELETE FROM  accounts
                         WHERE  uid = {?}', $this->id());
     return true;
 }
开发者ID:pombredanne,项目名称:platal,代码行数:63,代码来源:user.php

示例12: select_if_homonym

function select_if_homonym(PlUser $user)
{
    return XDB::fetchOneCell('SELECT  email
                                FROM  email_source_account
                               WHERE  uid = {?} AND expire IS NOT NULL', $user->id());
}
开发者ID:Ekleog,项目名称:platal,代码行数:6,代码来源:homonyms.inc.php

示例13: handler_broken

 function handler_broken($page, $uid = null)
 {
     $page->changeTpl('marketing/broken.tpl');
     if (is_null($uid)) {
         return PL_NOT_FOUND;
     }
     $user = User::get($uid);
     if (!$user) {
         return PL_NOT_FOUND;
     } elseif ($user->login() == S::user()->login()) {
         pl_redirect('emails/redirect');
     }
     $res = XDB::query('SELECT  p.deathdate IS NULL AS alive, r.last, IF(r.type = \'googleapps\', \'googleapps\', r.redirect) AS active_email
                          FROM  accounts               AS a
                     LEFT JOIN  email_redirect_account AS r  ON (a.uid = r.uid AND r.type IN (\'smtp\', \'googleapps\') AND r.flags = \'active\')
                     LEFT JOIN  account_profiles       AS ap ON (ap.uid = r.uid AND FIND_IN_SET(\'owner\', ap.perms))
                     LEFT JOIN  profiles               AS p  ON (p.pid = ap.pid)
                         WHERE  a.uid = {?}
                      ORDER BY  r.broken_level, r.last', $user->id());
     if (!$res->numRows()) {
         return PL_NOT_FOUND;
     }
     $user->addProperties($res->fetchOneAssoc());
     $page->assign('user', $user);
     $email = null;
     require_once 'emails.inc.php';
     if (Post::has('mail')) {
         $email = valide_email(Post::v('mail'));
     }
     if (Post::has('valide') && isvalid_email_redirection($email, $user)) {
         S::assert_xsrf_token();
         // security stuff
         check_email($email, "Proposition d'une adresse surveillee pour " . $user->login() . " par " . S::user()->login());
         $state = XDB::fetchOneCell('SELECT  flags
                                       FROM  email_redirect_account
                                      WHERE  redirect = {?} AND uid = {?}', $email, $user->id());
         if ($state == 'broken') {
             $page->trigWarning("L'adresse que tu as fournie est l'adresse actuelle de {$user->fullName()} et est en panne.");
         } elseif ($state == 'active') {
             $page->trigWarning("L'adresse que tu as fournie est l'adresse actuelle de {$user->fullName()}");
         } elseif ($user->email && !Post::t('comment')) {
             $page->trigError("Il faut que tu ajoutes un commentaire à ta proposition pour justifier le " . "besoin de changer la redirection de {$user->fullName()}.");
         } else {
             $valid = new BrokenReq(S::user(), $user, $email, trim(Post::v('comment')));
             $valid->submit();
             $page->assign('sent', true);
         }
     } elseif ($email) {
         $page->trigError("L'adresse proposée n'est pas une adresse acceptable pour une redirection.");
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:51,代码来源:marketing.php

示例14: getCond

 /** Compute the conditions to use for the current request.
  * @return A PlFilterCondition instance (actually a PFC_And)
  */
 protected function getCond()
 {
     $cond = new PFC_And();
     foreach ($this->criteria as $criterion => $value) {
         switch ($criterion) {
             // ENUM fields
             case WSRequestCriteria::SCHOOL:
                 // Useless criterion: we don't need to check on origin school
                 if (WSRequestCriteria::$choices_enum[$criterion][$value]) {
                     $cond->addChild(new PFC_True());
                 } else {
                     $cond->addChild(new PFC_False());
                 }
                 break;
             case WSRequestCriteria::DIPLOMA:
                 $diploma = WSRequestCriteria::$choices_enum[$criterion][$value];
                 $id_X = XDB::fetchOneCell('SELECT  id
                                          FROM  profile_education_enum
                                         WHERE  abbreviation = {?}', 'X');
                 $cond->addChildren(array(new UFC_EducationSchool($id_X), new UFC_EducationDegree($diploma)));
                 break;
                 // TEXT fields
             // TEXT fields
             case WSRequestCriteria::FIRSTNAME:
             case WSRequestCriteria::LASTNAME:
                 $cond->addChild(new UFC_NameTokens($value, UFC_NameTokens::FLAG_PUBLIC, false, false, $criterion));
                 break;
             case WSRequestCriteria::PROMOTION:
                 $cond->addChild(new PFC_Or(new UFC_Promo(UserFilter::OP_EQUALS, UserFilter::GRADE_ING, $value), new UFC_Promo(UserFilter::OP_EQUALS, UserFilter::GRADE_MST, $value), new UFC_Promo(UserFilter::OP_EQUALS, UserFilter::GRADE_PHD, $value)));
                 break;
             case WSRequestCriteria::ALT_DIPLOMA:
                 $cond->addChild(new UFC_EducationDegree(DirEnum::getIds(DirEnum::EDUDEGREES, $value)));
                 break;
             case WSRequestCriteria::DIPLOMA_FIELD:
                 $cond->addChild(new UFC_EducationField(DirEnum::getIds(DirEnum::EDUFIELDS, $value)));
                 break;
             case WSRequestCriteria::CITY:
                 $cond->addChild(new UFC_AddressField($value, UFC_AddressField::FIELD_LOCALITY, UFC_Address::TYPE_HOME, UFC_Address::FLAG_CURRENT));
                 break;
             case WSRequestCriteria::COUNTRY:
                 $cond->addChild(new UFC_AddressField($value, UFC_AddressField::FIELD_COUNTRY, UFC_Address::TYPE_HOME, UFC_Address::FLAG_CURRENT));
                 break;
             case WSRequestCriteria::ZIPCODE:
                 $cond->addChild(new UFC_AddressField($value, UFC_AddressField::FIELD_ZIPCODE, UFC_Address::TYPE_HOME, UFC_Address::FLAG_CURRENT));
                 break;
             case WSRequestCriteria::JOB_ANY_COUNTRY:
                 $cond->addChild(new UFC_AddressField($value, UFC_AddressField::FIELD_COUNTRY, UFC_Address::TYPE_PRO, UFC_Address::FLAG_ANY));
                 break;
             case WSRequestCriteria::JOB_CURRENT_CITY:
                 $cond->addChild(new UFC_AddressField($value, UFC_AddressField::FIELD_LOCALITY, UFC_Address::TYPE_PRO, UFC_Address::FLAG_ANY));
                 break;
             case WSRequestCriteria::JOB_ANY_COMPANY:
             case WSRequestCriteria::JOB_CURRENT_COMPANY:
                 $cond->addChild(new UFC_Job_Company(UFC_Job_Company::JOBNAME, $value));
                 break;
             case WSRequestCriteria::JOB_ANY_SECTOR:
             case WSRequestCriteria::JOB_CURRENT_SECTOR:
             case WSRequestCriteria::JOB_CURRENT_TITLE:
                 $cond->addChild(new UFC_Job_Terms(DirEnum::getIds(DirEnum::JOBTERMS, $value)));
                 break;
                 // LIST fields
             // LIST fields
             case WSRequestCriteria::HOBBIES:
                 $subcond = new PFC_Or();
                 foreach ($value as $val) {
                     $subcond->addChild(new UFC_Comment($value));
                 }
                 $cond->addChild($subcond);
                 break;
             case WSRequestCriteria::JOB_COMPETENCIES:
             case WSRequestCriteria::JOB_RESUME:
             case WSRequestCriteria::PROFESSIONAL_PROJECT:
                 $subcond = new PFC_Or();
                 foreach ($value as $val) {
                     $subcond->addChild(new UFC_Job_Description($value, UserFilter::JOB_USERDEFINED));
                 }
                 $cond->addChild($subcond);
                 break;
             case WSRequestCriteria::NOT_UID:
                 $cond->addChild(new PFC_Not(new UFC_PartnerSharingID($this->partner->id, $value)));
                 break;
             default:
                 break;
         }
     }
     return $cond;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:90,代码来源:request.inc.php

示例15: fill_email_combobox

function fill_email_combobox(PlPage $page, array $retrieve, $user = null)
{
    require_once 'emails.inc.php';
    if (is_null($user)) {
        $user = S::user();
    }
    /* Always refetch the profile. */
    $profile = $user->profile(true);
    $emails = array();
    if (in_array('source', $retrieve)) {
        $emails['Emails polytechniciens'] = XDB::fetchColumn('SELECT  CONCAT(s.email, \'@\', d.name)
                                                                FROM  email_source_account  AS s
                                                          INNER JOIN  email_virtual_domains AS m ON (s.domain = m.id)
                                                          INNER JOIN  email_virtual_domains AS d ON (d.aliasing = m.id)
                                                               WHERE  s.uid = {?}
                                                            ORDER BY  s.email, d.name', $user->id());
    }
    if (in_array('redirect', $retrieve)) {
        $redirect = new Redirect($user);
        $emails['Redirections'] = array();
        foreach ($redirect->emails as $redirect_it) {
            if ($redirect_it->is_redirection()) {
                $emails['Redirections'][] = $redirect_it->email;
            }
        }
    }
    if ($profile) {
        if (in_array('job', $retrieve)) {
            $emails['Emails professionels'] = XDB::fetchColumn('SELECT  email
                                                                  FROM  profile_job
                                                                 WHERE  pid = {?} AND email IS NOT NULL AND email != \'\'', $profile->id());
        }
        if ($profile->email_directory) {
            if (in_array('directory', $retrieve)) {
                foreach ($emails as &$email_list) {
                    foreach ($email_list as $key => $email) {
                        if ($profile->email_directory == $email) {
                            unset($email_list[$key]);
                        }
                    }
                }
                $emails['Email annuaire AX'] = array($profile->email_directory);
            } elseif (in_array('stripped_directory', $retrieve)) {
                if (User::isForeignEmailAddress($profile->email_directory)) {
                    $is_redirect = XDB::fetchOneCell('SELECT  COUNT(*)
                                                        FROM  email_redirect_account
                                                       WHERE  uid = {?} AND redirect = {?}', $user->id(), $profile->email_directory);
                    if ($is_redirect == 0) {
                        $emails['Email annuaire AX'] = array($profile->email_directory);
                    }
                }
            }
        }
        if (isset($emails['Emails professionels']) && isset($emails['Redirections'])) {
            $intersect = array_intersect($emails['Emails professionels'], $emails['Redirections']);
            foreach ($intersect as $key => $email) {
                unset($emails['Emails professionels'][$key]);
            }
        }
    }
    $emails_count = 0;
    foreach ($emails as $email_list) {
        $emails_count += count($email_list);
    }
    $page->assign('emails_count', $emails_count);
    $page->assign('email_lists', $emails);
}
开发者ID:Ekleog,项目名称:platal,代码行数:67,代码来源:emails.combobox.inc.php


注:本文中的XDB::fetchOneCell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。