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


PHP XDB::affectedRows方法代码示例

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


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

示例1: purgeOrphanedEvents

/**
 * Purges session events without a valid session.
 */
function purgeOrphanedEvents()
{
    $begin = time();
    XDB::execute("DELETE  e\n           FROM  log_events AS e\n      LEFT JOIN  log_sessions AS s ON (s.id = e.session)\n          WHERE  s.id IS NULL");
    $affectedRows = XDB::affectedRows();
    $duration = time() - $begin;
    echo "Orphaned events: removed {$affectedRows} events in {$duration} seconds.\n";
}
开发者ID:Ekleog,项目名称:platal,代码行数:11,代码来源:compliance.php

示例2: handler_ajax_todo_clear

 function handler_ajax_todo_clear($page)
 {
     S::assert_xsrf_token();
     XDB::execute('DELETE FROM  todo
                         WHERE  uid = {?} AND checked = 1', S::user()->id());
     if (XDB::affectedRows() != 1) {
         $page->jsonAssign('error', "Impossible de nettoyer la liste des tâches");
     }
     return PL_JSON;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:10,代码来源:todo.php

示例3: commit

 public function commit()
 {
     global $globals;
     $email = $this->m_user->bestEmail();
     XDB::execute('UPDATE  email_redirect_account
                      SET  flags = \'active\', broken_level = 2
                    WHERE  uid = {?} AND redirect = {?}', $this->m_user->id(), $this->m_email);
     if (XDB::affectedRows() > 0) {
         $this->m_reactive = true;
         $mailer = new PlMailer();
         $mailer->setFrom('"Association Polytechnique.org" <register@' . $globals->mail->domain . '>');
         $mailer->addTo($email);
         $mailer->setSubject("Mise à jour de ton adresse {$email}");
         $mailer->setTxtBody(wordwrap("Cher Camarade,\n\n" . "Ton adresse {$email} étant en panne et ayant été informés que ta redirection {$this->m_email}, jusqu'à présent inactive, " . "est fonctionnelle, nous venons de réactiver cette adresse.\n\n" . "N'hésite pas à aller gérer toi-même tes redirections en te rendant à la page :\n" . "https://www.polytechnique.org/emails/redirect\n" . "Si tu as perdu ton mot de passe d'accès au site, tu peux également effectuer la procédure de récupération à l'adresse :\n" . "https://www.polytechnique.org/recovery\n\n" . "-- \nTrès Cordialement,\nL'Équipe de Polytechnique.org\n"));
         $mailer->send();
         return true;
     }
     if ($this->m_user->email) {
         $subject = "Ton adresse {$email} semble ne plus fonctionner";
         $reason = "Nous avons été informés que ton adresse {$email} ne fonctionne plus correctement par un camarade";
     } else {
         $res = XDB::iterRow('SELECT  redirect
                                FROM  email_redirect_account
                               WHERE  uid = {?} AND flags = \'broken\'', $this->m_user->id());
         $redirect = array();
         while (list($red) = $res->next()) {
             list(, $redirect[]) = explode('@', $red);
         }
         $subject = "Ton adresse {$email} ne fonctionne plus";
         $reason = "Ton adresse {$email} ne fonctionne plus";
         if (!count($redirect)) {
             $reason .= '.';
         } elseif (count($redirect) == 1) {
             $reason .= ' car sa redirection vers ' . $redirect[0] . ' est hors-service depuis plusieurs mois.';
         } else {
             $reason .= ' car ses redirections vers ' . implode(', ', $redirect) . ' sont hors-services depuis plusieurs mois.';
         }
     }
     $body = ($this->m_user->isFemale() ? 'Chère ' : 'Cher ') . $this->m_user->displayName() . ",\n\n" . $reason . "\n\n" . "L'adresse {$this->m_email} nous a été communiquée, veux-tu que cette adresse devienne ta nouvelle " . "adresse de redirection ? Si oui, envoie nous des informations qui " . "nous permettront de nous assurer de ton identité (par exemple ta date de naissance et ta promotion).\n\n" . "-- \nTrès Cordialement,\nL'Équipe de Polytechnique.org\n";
     $body = wordwrap($body, 78);
     $mailer = new PlMailer();
     $mailer->setFrom('"Association Polytechnique.org" <register@' . $globals->mail->domain . '>');
     $mailer->addTo($this->m_email);
     $mailer->setSubject($subject);
     $mailer->setTxtBody($body);
     return $mailer->send();
 }
开发者ID:Ekleog,项目名称:platal,代码行数:47,代码来源:broken.inc.php

示例4: foreach

foreach ($tables as $table => $keys) {
    $res = XDB::query("SELECT * FROM geoloc_{$table}");
    if (!$res) {
        echo "{$table}\n";
        continue;
    }
    $all = $res->fetchAllAssoc();
    foreach ($all as &$array) {
        $from = array();
        $to = array();
        foreach ($array as $key => $value) {
            if (in_array($key, $keys)) {
                $from[] = $key . '=' . XDB::escape($value);
            }
            $valued = utf8_decode($value);
            if (is_utf8($value) && $valued != $value) {
                $to[] = $key . '=' . XDB::escape($valued);
            }
        }
        if (!empty($to)) {
            $to = implode(', ', $to);
            $from = implode(' AND ', $from);
            $sql = "UPDATE geoloc_{$table} SET {$to} WHERE {$from}";
            if (!XDB::execute($sql)) {
                echo "Echec : {$sql}\n";
            } elseif (XDB::affectedRows() == 0) {
                echo "{$sql}\n";
            }
        }
    }
}
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:geoloc.utf8.php

示例5: delRegistered

 public function delRegistered(PlPage $page, Profile $profile)
 {
     XDB::execute('DELETE FROM  contacts
                         WHERE  uid = {?} AND contact = {?}', S::i('uid'), $profile->id());
     if (XDB::affectedRows() > 0) {
         S::user()->invalidWatchCache();
         Platal::session()->updateNbNotifs();
         $page->trigSuccess("Contact retiré&nbsp;!");
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:10,代码来源:carnet.php

示例6: DATE_ADD

/***************************************************************************
 *  Copyright (C) 2003-2015 Polytechnique.org                              *
 *  http://opensource.polytechnique.org/                                   *
 *                                                                         *
 *  This program is free software; you can redistribute it and/or modify   *
 *  it under the terms of the GNU General Public License as published by   *
 *  the Free Software Foundation; either version 2 of the License, or      *
 *  (at your option) any later version.                                    *
 *                                                                         *
 *  This program is distributed in the hope that it will be useful,        *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *  GNU General Public License for more details.                           *
 *                                                                         *
 *  You should have received a copy of the GNU General Public License      *
 *  along with this program; if not, write to the Free Software            *
 *  Foundation, Inc.,                                                      *
 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 ***************************************************************************/
require './connect.db.inc.php';
$it = 0;
do {
    XDB::execute('UPDATE  profiles
                     SET  next_birthday = DATE_ADD(next_birthday, INTERVAL 1 YEAR)
                   WHERE  (next_birthday != 0 AND next_birthday IS NOT NULL AND next_birthday < CURDATE())
                           AND deathdate IS NULL');
    ++$it;
    $affected = XDB::affectedRows();
    //echo "Iteration $it => $affected changes\n";
} while ($affected > 0);
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
开发者ID:pombredanne,项目名称:platal,代码行数:31,代码来源:notifs.birthday.php

示例7: run

 public function run()
 {
     global $platal, $globals;
     // Update last unread time
     $time = null;
     if (!is_null($this->params) && isset($this->params['updateall'])) {
         $time = intval($this->params['updateall']);
         $this->user->banana_last = $time;
     }
     $infos = $this->fetchProfile();
     if ($infos['maj']) {
         $time = time();
     }
     // Build user profile
     $req = XDB::query("SELECT  name\n                             FROM  forum_subs AS fs\n                        LEFT JOIN  forums AS f ON (f.fid = fs.fid)\n                            WHERE  uid={?}", $this->user->id());
     Banana::$profile['headers']['From'] = $infos['name'] . ' <' . $infos['mail'] . '>';
     Banana::$profile['headers']['Organization'] = make_Organization();
     Banana::$profile['signature'] = $infos['sig'];
     Banana::$profile['display'] = $infos['threads'];
     Banana::$profile['autoup'] = $infos['maj'];
     Banana::$profile['lastnews'] = $this->user->banana_last;
     Banana::$profile['subscribe'] = $req->fetchColumn();
     Banana::$tree_unread = $infos['tree_unread'];
     Banana::$tree_read = $infos['tree_read'];
     // Update the "unread limit"
     if (!is_null($time)) {
         XDB::execute('UPDATE  forum_profiles
                          SET  last_seen = FROM_UNIXTIME({?})
                        WHERE  uid = {?}', $time, $this->user->id());
         if (XDB::affectedRows() == 0) {
             XDB::execute('INSERT IGNORE INTO  forum_profiles (uid, last_seen)
                                       VALUES  ({?}, FROM_UNIXTIME({?}))', $this->user->id(), $time);
         }
     }
     if (!empty($GLOBALS['IS_XNET_SITE'])) {
         Banana::$page->killPage('forums');
         Banana::$page->killPage('subscribe');
         Banana::$spool_boxlist = false;
     } else {
         // Register custom Banana links and tabs
         if (!Banana::$profile['autoup']) {
             Banana::$page->registerAction('<a href=\'javascript:$.dynPost("' . $platal->path . '", "updateall", ' . time() . ')\'>' . 'Marquer tous les messages comme lus' . '</a>', array('forums', 'thread', 'message'));
         }
         Banana::$page->registerPage('profile', 'Préférences', null);
     }
     // Run Bananai
     if (Banana::$action == 'profile') {
         Banana::$page->run();
         return $this->action_updateProfile();
     } else {
         return parent::run();
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:53,代码来源:forum.inc.php

示例8: delete

 public function delete()
 {
     XDB::execute('DELETE FROM  profile_addresses_components
                         WHERE  pid = {?} AND jobid = {?} AND groupid = {?} AND type = {?} AND id = {?}', $this->pid, $this->jobid, $this->groupid, $this->type, $this->id);
     XDB::execute('DELETE FROM  profile_addresses
                         WHERE  pid = {?} AND jobid = {?} AND groupid = {?} AND type = {?} AND id = {?}', $this->pid, $this->jobid, $this->groupid, $this->type, $this->id);
     return XDB::affectedRows();
 }
开发者ID:Ekleog,项目名称:platal,代码行数:8,代码来源:address.php

示例9: link_by_ids

 /** Lier les identifiants d'un ancien dans les deux annuaires
  * @param user_id identifiant dans l'annuaire X.org
  * @param matricule_ax identifiant dans l'annuaire de l'AX
  * @return 0 si la liaison a échoué, 1 sinon
  */
 private static function link_by_ids($pid, $ax_id)
 {
     $res = XDB::execute('UPDATE  fusionax_import       AS i
                      INNER JOIN  fusionax_xorg_anciens AS u
                             SET  u.ax_id = i.ax_id,
                                  i.pid = u.pid,
                                  i.date_match_id = NOW()
                           WHERE  i.ax_id = {?} AND u.pid = {?}
                                  AND (u.ax_id != {?} OR u.ax_id IS NULL
                                       OR i.pid != {?} OR i.pid IS NULL)', $ax_id, $pid, $ax_id, $pid);
     if (!$res) {
         return 0;
     }
     return XDB::affectedRows() / 2;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:20,代码来源:fusionax.php

示例10: save

 /** Save the global properties of this NL issue (title&co).
  */
 public function save()
 {
     $errors = array();
     // Fill the list of fields to update
     $fields = array('title' => $this->title, 'mail_title' => $this->title_mail, 'head' => $this->head, 'signature' => $this->signature);
     if (!empty($this->reply_to) && !isvalid_email($this->reply_to)) {
         $errors[] = self::ERROR_INVALID_REPLY_TO;
     } else {
         $fields['reply_to'] = $this->reply_to;
     }
     if ($this->isEditable()) {
         $fields['date'] = $this->date;
         if (!preg_match('/^[-a-z0-9]+$/i', $this->shortname) || is_numeric($this->shortname)) {
             $errors[] = self::ERROR_INVALID_SHORTNAME;
         } else {
             $fields['short_name'] = $this->shortname;
         }
         if ($this->sufb->isValid() || $this->sufb->isEmpty()) {
             $fields['sufb_json'] = json_encode($this->sufb->export()->dict());
             // If sufb_json is too long to be store, we do not store a truncated json and notify the user.
             // The limit is LONGTEXT's one, ie 2^32 = 4294967296.
             if (strlen($fields['sufb_json']) > 4294967295) {
                 $errors[] = self::ERROR_TOO_LONG_UFC;
             }
         } else {
             $errors[] = self::ERROR_INVALID_UFC;
         }
         if ($this->nl->automaticMailingEnabled()) {
             $fields['send_before'] = $this->send_before ? $this->send_before : null;
         }
     }
     if (count($errors)) {
         return $errors;
     }
     $field_sets = array();
     foreach ($fields as $key => $value) {
         $field_sets[] = XDB::format($key . ' = {?}', $value);
     }
     XDB::execute('UPDATE  newsletter_issues
                      SET  ' . implode(', ', $field_sets) . '
                    WHERE  id={?}', $this->id);
     if (XDB::affectedRows()) {
         $this->refresh();
     } else {
         $errors[] = self::ERROR_SQL_SAVE;
     }
     return $errors;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:50,代码来源:newsletter.inc.php

示例11: _saveData

 protected function _saveData()
 {
     if ($this->changed['nationality1'] || $this->changed['nationality2'] || $this->changed['nationality3'] || $this->changed['birthdate'] || $this->changed['freetext'] || $this->changed['freetext_pub'] || $this->changed['axfreetext'] || $this->changed['email_directory'] || $this->changed['profile_title']) {
         if ($this->values['nationality3'] == "") {
             $this->values['nationality3'] = NULL;
         }
         if ($this->values['nationality2'] == "") {
             $this->values['nationality2'] = $this->values['nationality3'];
             $this->values['nationality3'] = NULL;
         }
         if ($this->values['nationality1'] == "") {
             $this->values['nationality1'] = $this->values['nationality2'];
             $this->values['nationality2'] = $this->values['nationality3'];
             $this->values['nationality3'] = NULL;
         }
         if ($this->values['nationality1'] == $this->values['nationality2'] && $this->values['nationality2'] == $this->values['nationality3']) {
             $this->values['nationality2'] = NULL;
             $this->values['nationality3'] = NULL;
         } else {
             if ($this->values['nationality1'] == $this->values['nationality2']) {
                 $this->values['nationality2'] = $this->values['nationality3'];
                 $this->values['nationality3'] = NULL;
             } else {
                 if ($this->values['nationality2'] == $this->values['nationality3'] || $this->values['nationality1'] == $this->values['nationality3']) {
                     $this->values['nationality3'] = NULL;
                 }
             }
         }
         $new_email = $this->values['email_directory'] == "new@example.org" ? $this->values['email_directory_new'] : $this->values['email_directory'];
         if ($new_email == "") {
             $new_email = NULL;
         }
         XDB::execute("UPDATE  profiles\n                             SET  nationality1 = {?}, nationality2 = {?}, nationality3 = {?}, birthdate = {?},\n                                  freetext = {?}, freetext_pub = {?}, axfreetext = {?}, email_directory = {?}, title = {?}\n                           WHERE  pid = {?}", $this->values['nationality1'], $this->values['nationality2'], $this->values['nationality3'], ProfileSettingDate::toSQLDate($this->values['birthdate']), $this->values['freetext'], $this->values['freetext_pub'], $this->values['axfreetext'], $new_email, $this->values['profile_title'], $this->pid());
     }
     if ($this->changed['photo_pub']) {
         XDB::execute("UPDATE  profile_photos\n                             SET  pub = {?}\n                           WHERE  pid = {?}", $this->values['photo_pub'], $this->pid());
     }
     if (S::user()->isMe($this->owner) && $this->changed['yourself']) {
         if ($this->owner) {
             XDB::execute('UPDATE  accounts
                              SET  display_name = {?}
                            WHERE  uid = {?}', $this->values['yourself'], $this->owner->id());
         }
         XDB::execute('UPDATE  profile_display
                          SET  yourself = {?}
                        WHERE  pid = {?}', $this->values['yourself'], $this->pid());
     }
     if ($this->changed['promo_display']) {
         if ($this->values['promo_display'][0] == $this->profile->mainEducation()) {
             $yearpromo = intval(substr($this->values['promo_display'], 1, 4));
             if ($this->profile->mainEducation() == 'X' && $yearpromo >= $this->profile->entry_year || $this->profile->mainEducation() != 'X' && $yearpromo >= $this->profile->entry_year + $this->profile->mainEducationDuration()) {
                 XDB::execute('UPDATE  profile_display
                                  SET  promo = {?}
                                WHERE  pid = {?}', $this->values['promo_display'], $this->pid());
                 XDB::execute('UPDATE  profile_education
                                  SET  promo_year = {?}
                                WHERE  pid = {?} AND FIND_IN_SET(\'primary\', flags)', $yearpromo, $this->pid());
             }
         }
     }
     if ($this->changed['birthdate_ref'] && S::admin() && !$this->owner->perms) {
         XDB::execute('UPDATE  profiles
                          SET  birthdate_ref = {?}
                        WHERE  pid = {?}', ProfileSettingDate::toSQLDate($this->values['birthdate_ref']), $this->pid());
     }
     if (!S::user()->isMe($this->owner) && $this->changed['deathdate']) {
         XDB::execute('UPDATE  profiles
                          SET  deathdate = {?}, deathdate_rec = NOW()
                        WHERE  pid = {?} AND deathdate_rec IS NULL', ProfileSettingDate::toSQLDate($this->values['deathdate']), $this->pid());
         if (XDB::affectedRows() > 0) {
             $this->profile->clear();
             if ($this->owner) {
                 $this->owner->clear(true);
             }
         } else {
             /* deathdate_rec was not NULL, this is just an update of the death date
              */
             XDB::execute('UPDATE  profiles
                              SET  deathdate = {?}
                            WHERE  pid = {?}', ProfileSettingDate::toSQLDate($this->values['deathdate']), $this->pid());
         }
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:83,代码来源:general.inc.php

示例12: removeMinimodule

 public function removeMinimodule(FrankizMiniModule $m)
 {
     $rmName = $m->name();
     XDB::execute('DELETE FROM users_minimodules WHERE uid = {?} AND name = {?}', $this->id(), $rmName);
     if (XDB::affectedRows() > 0) {
         $cols = array_keys(FrankizMiniModule::emptyLayout());
         foreach ($cols as $col) {
             $this->minimodules[$col] = array_filter($this->minimodules[$col], function ($name) use($rmName) {
                 return $name != $rmName;
             });
         }
         return true;
     }
     return false;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:15,代码来源:user.php

示例13: handler_admin_member

 function handler_admin_member($page, $user)
 {
     global $globals;
     $user = User::getSilent($user);
     if (empty($user)) {
         return PL_NOT_FOUND;
     }
     if (!$user->inGroup($globals->asso('id'))) {
         pl_redirect('annuaire');
     }
     $page->changeTpl('xnetgrp/membres-edit.tpl');
     $page->addJsLink('xnet_members.js');
     $mmlist = new MMList(S::user(), $globals->asso('mail_domain'));
     if (Post::has('change')) {
         S::assert_xsrf_token();
         require_once 'emails.inc.php';
         require_once 'name.func.inc.php';
         // Convert user status to X
         if (!Post::blank('x')) {
             $forlife = $this->changeLogin($page, $user, Post::i('userid'), Post::b('broken'), Post::b('marketing'), Post::v('marketing_from'));
             if ($forlife) {
                 pl_redirect('member/' . $forlife);
             }
         }
         // Update user info
         if ($user->type == 'virtual' || $user->type == 'xnet' && !$user->perms) {
             $lastname = capitalize_name(Post::t('lastname'));
             if (Post::s('type') != 'virtual') {
                 $firstname = capitalize_name(Post::t('firstname'));
             } else {
                 $firstname = '';
             }
             $full_name = build_full_name($firstname, $lastname);
             $directory_name = build_directory_name($firstname, $lastname);
             $sort_name = build_sort_name($firstname, $lastname);
             XDB::query('UPDATE  accounts
                            SET  full_name = {?}, directory_name = {?}, sort_name = {?}, display_name = {?},
                                 firstname = {?}, lastname = {?}, sex = {?}, type = {?}
                          WHERE  uid = {?}', $full_name, $directory_name, $sort_name, Post::t('display_name'), $firstname, $lastname, Post::t('sex') == 'male' ? 'male' : 'female', Post::t('type') == 'xnet' ? 'xnet' : 'virtual', $user->id());
         }
         // Updates email.
         $new_email = strtolower(Post::t('email'));
         if (($user->type == 'virtual' || $user->type == 'xnet' && !$user->perms) && require_email_update($user, $new_email)) {
             XDB::query('UPDATE  accounts
                            SET  email = {?}
                          WHERE  uid = {?}', $new_email, $user->id());
             if ($user->forlifeEmail()) {
                 $listClient = new MMList(S::user());
                 $listClient->change_user_email($user->forlifeEmail(), $new_email);
                 update_alias_user($user->forlifeEmail(), $new_email);
             }
             $user = User::getWithUID($user->id());
         }
         if (XDB::affectedRows()) {
             $page->trigSuccess('Données de l\'utilisateur mises à jour.');
         }
         if ($user->type == 'xnet' && !$user->perms) {
             if (Post::b('suggest')) {
                 $request = new AccountReq(S::user(), $user->hruid, Post::t('email'), $globals->asso('nom'), $globals->asso('diminutif'));
                 $request->submit();
                 $page->trigSuccess('Le compte va bientôt être activé.');
             }
             if (Post::b('again')) {
                 $this->again($user->id());
                 $page->trigSuccess('Relance effectuée avec succès.');
             }
         }
         // Update group params for user
         $perms = Post::v('group_perms');
         $comm = Post::t('comm');
         $position = Post::t('group_position') == '' ? null : Post::v('group_position');
         if ($user->group_perms != $perms || $user->group_comm != $comm || $user->group_position != $position) {
             XDB::query('UPDATE  group_members
                            SET  perms = {?}, comm = {?}, position = {?}
                          WHERE  uid = {?} AND asso_id = {?}', $perms == 'admin' ? 'admin' : 'membre', $comm, $position, $user->id(), $globals->asso('id'));
             if (XDB::affectedRows()) {
                 if ($perms != $user->group_perms) {
                     $page->trigSuccess('Permissions modifiées&nbsp;!');
                 }
                 if ($comm != $user->group_comm) {
                     $page->trigSuccess('Commentaire mis à jour.');
                 }
                 if ($position != $user->group_position) {
                     $page->trigSuccess('Poste mis à jour.');
                 }
             }
         }
         // Gets user info again as they might have change
         $user = User::getSilent($user->id());
         // Update ML subscriptions
         foreach (Env::v('ml1', array()) as $ml => $state) {
             $ask = empty($_REQUEST['ml2'][$ml]) ? 0 : 2;
             if ($ask == $state) {
                 continue;
             }
             if ($state == '1') {
                 $page->trigWarning("{$user->fullName()} a " . "actuellement une demande d'inscription en " . "cours sur <strong>{$ml}@</strong> !!!");
             } elseif ($ask) {
                 $mmlist->mass_subscribe($ml, array($user->forlifeEmail()));
                 $page->trigSuccess("{$user->fullName()} a été abonné à {$ml}@.");
//.........这里部分代码省略.........
开发者ID:Ekleog,项目名称:platal,代码行数:101,代码来源:xnetgrp.php

示例14: commit

 public function commit()
 {
     $res = XDB::query('SELECT  id
                          FROM  profile_job_enum
                         WHERE  name = {?}', $this->name);
     if ($res->numRows() != 1) {
         XDB::execute('INSERT INTO  profile_job_enum (name, acronym, url, email, holdingid, SIREN_code, NAF_code, AX_code)
                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', $this->name, $this->acronym, $this->url, $this->email, $this->holdingid, $this->SIREN, $this->NAF_code, $this->AX_code);
         $jobid = XDB::insertId();
         $phone = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 0, 'type' => 'fixed', 'display' => $this->tel, 'pub' => 'public'));
         $fax = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 1, 'type' => 'fax', 'display' => $this->fax, 'pub' => 'public'));
         $address = new Address(array('jobid' => $jobid, 'type' => Address::LINK_COMPANY, 'text' => $this->address));
         $phone->save();
         $fax->save();
         $address->save();
     } else {
         $jobid = $res->fetchOneCell();
     }
     XDB::execute('UPDATE  profile_job
                      SET  jobid = {?}
                    WHERE  pid = {?} AND id = {?}', $jobid, $this->profile->id(), $this->id);
     if (XDB::affectedRows() == 0) {
         return XDB::execute('INSERT INTO  profile_job (jobid, pid, id)
                                   VALUES  ({?}, {?}, {?})', $jobid, $this->profile->id(), $this->id);
     }
     return true;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:27,代码来源:entreprises.inc.php

示例15: helper_flagsetRemove

 /**
  * Helper to remove a value from a FlagSet which is in the database
  *
  * @param string $field Object field
  * @param mixed $value the value to remove
  * @return true if something has been modified, false otherwise
  */
 protected function helper_flagsetRemove($field, $value)
 {
     $className = get_class($this);
     $schema = Schema::get($className);
     $id = $schema->id();
     list($table, $column) = $schema->flagsetType($field);
     XDB::execute("DELETE FROM  {$table}\n                            WHERE  {$id} = {?} AND {$column} = {?}\n                            LIMIT  1", $this->id(), $value);
     if (!(XDB::affectedRows() > 0)) {
         return false;
     }
     if (empty($this->{$field})) {
         $this->{$field} = new PlFlagSet();
     }
     $this->{$field}->rmFlag($value);
     return true;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:23,代码来源:meta.php


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