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


PHP XDB类代码示例

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


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

示例1: delete_by_variable

 public function delete_by_variable($pluginid, $variable)
 {
     if (!$pluginid || !$variable) {
         return;
     }
     XDB::delete($this->_table, XDB::field('pluginid', $pluginid) . ' AND ' . XDB::field('variable', $variable));
 }
开发者ID:herosrx,项目名称:shops,代码行数:7,代码来源:table_common_pluginvar.php

示例2: IsCandidate

 public static function IsCandidate(User $user, $candidate)
 {
     $profile = $user->profile();
     if (!$profile) {
         return false;
     }
     // We only test if the user is in her promotion group for it is too
     // expensive to check if she is in the corresponding ML as well.
     $res = XDB::query('SELECT  COUNT(*)
                          FROM  group_members
                         WHERE  uid = {?} AND asso_id = (SELECT  id
                                                           FROM  groups
                                                          WHERE  diminutif = {?})', $user->id(), $user->profile()->yearPromo());
     $mlCount = $res->fetchOneCell();
     if ($mlCount) {
         Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
     }
     if ($mlCount == 0) {
         $mlist = MailingList::promo($user->profile()->yearPromo());
         try {
             $mlist->getMembersLimit(0, 0);
         } catch (Exception $e) {
             return false;
         }
     }
     return false;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:27,代码来源:promotion_ml.inc.php

示例3: run

 public function run()
 {
     global $platal, $globals;
     $nom = S::v('prenom') . ' ' . S::v('nom');
     $mail = $this->user->bestEmail();
     $sig = $nom . ' (' . S::v('promo') . ')';
     Banana::$msgedit_headers['X-Org-Mail'] = $this->user->forlifeEmail();
     // Tree color
     $req = XDB::query('SELECT  tree_unread, tree_read
                          FROM  forum_profiles
                         WHERE  uid= {?}', $this->user->id());
     if (!(list($unread, $read) = $req->fetchOneRow())) {
         $unread = 'o';
         $read = 'dg';
     }
     Banana::$tree_unread = $unread;
     Banana::$tree_read = $read;
     // Build user profile
     Banana::$profile['headers']['From'] = "{$nom} <{$mail}>";
     Banana::$profile['headers']['Organization'] = make_Organization();
     Banana::$profile['signature'] = $sig;
     // Page design
     Banana::$page->killPage('forums');
     Banana::$page->killPage('subscribe');
     // Run Banana
     return parent::run();
 }
开发者ID:Ekleog,项目名称:platal,代码行数:27,代码来源:ml.inc.php

示例4: commit

 public function commit()
 {
     if ($this->user->hasProfile()) {
         XDB::execute('UPDATE  profiles
                          SET  alias_pub = {?}
                        WHERE  pid = {?}', $this->public, $this->user->profile()->id());
     }
     if ($this->old) {
         $success = XDB::execute('UPDATE  email_source_account
                                     SET  email = {?}
                                   WHERE  uid = {?} AND type = \'alias_aux\'', $this->alias, $this->user->id());
     } else {
         $success = XDB::execute('INSERT INTO  email_source_account (email, uid, domain, type, flags)
                                       SELECT  {?}, {?}, id, \'alias_aux\', \'\'
                                         FROM  email_virtual_domains
                                        WHERE  name = {?}', $this->alias, $this->user->id(), Platal::globals()->mail->alias_dom);
     }
     if ($success) {
         // Update the local User object, to pick up the new bestalias.
         require_once 'emails.inc.php';
         fix_bestalias($this->user);
         $this->user = User::getSilentWithUID($this->user->id());
     }
     return $success;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:25,代码来源:aliases.inc.php

示例5: fetch_all_by_searchc

 public function fetch_all_by_searchc($condition, $orderby, $start = 0, $ppp = 0)
 {
     if (is_array($condition)) {
         $where = " AND " . implode($condition, ' AND ');
     }
     return XDB::fetch_all("SELECT * FROM %t WHERE 1 %i ORDER BY %i LIMIT %d, %d", array($this->_table, $where, $orderby, $start, $ppp));
 }
开发者ID:herosrx,项目名称:shops,代码行数:7,代码来源:table_sanree_brand_msg.php

示例6: commit

 public function commit()
 {
     $sql = 'INSERT INTO  surveys
                     SET  questions = {?}, title = {?}, description = {?},
                          uid = {?}, end = {?},mode = {?}, promos = {?}';
     return XDB::execute($sql, serialize($this->questions), $this->title, $this->description, $this->user->id(), $this->end, $this->mode, $this->promos);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:7,代码来源:surveys.inc.php

示例7: query

function query($sql)
{
    XDB::execute($sql);
    if (XDB::errno() != 0) {
        echo "error in \"{$sql}\":\n", XDB::error(), "\n";
    }
}
开发者ID:Ekleog,项目名称:platal,代码行数:7,代码来源:clean.php

示例8: prepareform

 function prepareform($pay, $user)
 {
     // Documentation:
     // https://www.paypal.com/developer
     // Warning: the automatic return only works if we force the
     // users to create a paypal account. We do not use it; thus
     // the user must come back on the site.
     global $globals, $platal;
     $this->urlform = 'https://' . $globals->money->paypal_site . '/cgi-bin/webscr';
     $roboturl = str_replace("https://", "http://", $globals->baseurl) . '/' . $platal->ns . "payment/paypal_return/" . $user->id() . "?comment=" . urlencode(Env::v('comment')) . '&display=' . Post::i('display');
     $this->infos = array('commercant' => array('business' => $globals->money->paypal_compte, 'rm' => 2, 'return' => $roboturl, 'cn' => 'Commentaires', 'no_shipping' => 1, 'cbt' => empty($GLOBALS['IS_XNET_SITE']) ? 'Revenir sur polytechnique.org.' : 'Revenir sur polytechnique.net.'));
     $info_client = array('first_name' => $user->firstName(), 'last_name' => $user->lastName(), 'email' => $user->bestEmail());
     if ($user->hasProfile()) {
         $res = XDB::query("SELECT  pa.text, GROUP_CONCAT(pace2.short_name) AS city,\n                                       GROUP_CONCAT(pace3.short_name) AS zip, GROUP_CONCAT(pace1.short_name) AS country,\n                                       IF(pp1.display_tel != '', pp1.display_tel, pp2.display_tel) AS night_phone_b\n                                 FROM  profile_addresses                 AS pa\n                            LEFT JOIN  profile_phones                    AS pp1   ON (pp1.pid = pa.pid AND pp1.link_type = 'address' AND pp1.link_id = pa.id)\n                            LEFT JOIN  profile_phones                    AS pp2   ON (pp2.pid = pa.pid AND pp2.link_type = 'user' AND pp2.link_id = 0)\n                            LEFT JOIN  profile_addresses_components      AS pc    ON (pa.pid = pc.pid AND pa.jobid = pc.jobid AND pa.groupid = pc.groupid\n                                                                                      AND pa.type = pc.type AND pa.id = pc.id)\n                            LEFT JOIN  profile_addresses_components_enum AS pace1 ON (FIND_IN_SET('country', pace1.types) AND pace1.id = pc.component_id)\n                            LEFT JOIN  profile_addresses_components_enum AS pace2 ON (FIND_IN_SET('locality', pace2.types) AND pace2.id = pc.component_id)\n                            LEFT JOIN  profile_addresses_components_enum AS pace3 ON (FIND_IN_SET('postal_code', pace3.types) AND pace3.id = pc.component_id)\n                                WHERE  pa.pid = {?} AND FIND_IN_SET('current', pa.flags)\n                             GROUP BY  pa.pid, pa.jobid, pa.groupid, pa.id, pa.type\n                                LIMIT  1", $user->profile()->id());
         if (is_array($res)) {
             $this->infos['client'] = array_map('replace_accent', array_merge($info_client, $res->fetchOneAssoc()));
             list($this->infos['client']['address1'], $this->infos['client']['address2']) = explode("\n", Geocoder::getFirstLines($this->infos['client']['text'], $this->infos['client']['zip'], 2));
             unset($this->infos['client']['text']);
         } else {
             $this->infos['client'] = array_map('replace_accent', $info_client);
         }
     } else {
         $this->infos['client'] = array_map('replace_accent', $info_client);
     }
     // We build the transaction's reference
     $prefix = rand_url_id();
     $fullref = substr("{$prefix}-xorg-{$pay->id}", -15);
     $this->infos['commande'] = array('item_name' => replace_accent($pay->text), 'amount' => $this->val_number, 'currency_code' => 'EUR', 'custom' => $fullref);
     $this->infos['divers'] = array('cmd' => '_xclick');
 }
开发者ID:Ekleog,项目名称:platal,代码行数:30,代码来源:paypal.inc.php

示例9: assign_json_to_map

 public static function assign_json_to_map(PlPage $page, $pids = null)
 {
     if (!is_null($pids)) {
         $where = XDB::format(' AND pa.pid IN {?}', $pids);
     } else {
         $where = '';
     }
     if (!S::logged() || !S::user()->checkPerms('directory_ax')) {
         $where .= " AND pa.pub = 'public'";
         $name_publicity = 'public';
     } else {
         if (!S::user()->checkPerms('directory_private')) {
             $where .= " AND pa.pub = 'ax'";
             $name_publicity = 'public';
         } else {
             $name_publicity = 'private';
         }
     }
     $data = XDB::rawFetchAllAssoc('SELECT  pa.latitude, pa.longitude, GROUP_CONCAT(DISTINCT p.hrpid SEPARATOR \',\') AS hrpid,
                                            GROUP_CONCAT(pd.promo SEPARATOR \',\') AS promo,
                                            GROUP_CONCAT(DISTINCT pd.' . $name_publicity . '_name, \' (\', pd.promo, \')\' SEPARATOR \', \') AS name,
                                            GROUP_CONCAT(DISTINCT pa.pid SEPARATOR \',\') AS pid
                                      FROM  profile_addresses AS pa
                                INNER JOIN  profiles          AS p  ON (pa.pid = p.pid)
                                INNER JOIN  profile_display   AS pd ON (pd.pid = pa.pid)
                                     WHERE  pa.type = \'home\' AND p.deathdate IS NULL AND pa.latitude IS NOT NULL AND pa.longitude IS NOT NULL' . $where . '
                                  GROUP BY  pa.latitude, pa.longitude');
     $page->jsonAssign('data', $data);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:29,代码来源:geoloc.php

示例10: do_update_by_block

function do_update_by_block($values)
{
    // Update display_tel by block
    // Because there is no mysql update syntax for multiple updates in one query
    // we use a multiple insert syntax which will fail because the key already exist
    // and then update the display_tel
    XDB::execute("INSERT INTO  profile_phones (pid, link_type, link_id, tel_id ,tel_type,\n                                          search_tel, display_tel, pub, comment)\n                       VALUES  " . $values . "\n      ON DUPLICATE KEY UPDATE  display_tel = VALUES(display_tel)");
}
开发者ID:Ekleog,项目名称:platal,代码行数:8,代码来源:phones.check.php

示例11: fetch_all_username_by_uid

 public function fetch_all_username_by_uid($uid)
 {
     $user = '';
     if ($uid) {
         $user = XDB::result_first('SELECT username FROM %t WHERE uid=%s', array($this->_table, $uid));
     }
     return $user;
 }
开发者ID:herosrx,项目名称:shops,代码行数:8,代码来源:table_xcommon_member.php

示例12: run

 public function run()
 {
     $today = date('d');
     $month = date('m');
     $res = XDB::query("\n                SELECT name\n                FROM days\n                WHERE day={$today} AND month={$month}\n                ");
     $fetes = $res->fetchColumn(0);
     $this->assign("fetes", $fetes);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:8,代码来源:days.php

示例13: delete_by_tid

 public function delete_by_tid($tids)
 {
     $tids = dintval($tids, true);
     if ($tids) {
         return XDB::delete($this->_table, XDB::field('tid', $tids));
     }
     return 0;
 }
开发者ID:herosrx,项目名称:shops,代码行数:8,代码来源:table_forum_threadmod.php

示例14: 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

示例15: run

 public function run()
 {
     $res = XDB::query('SELECT todo_id, sent, checked, tobedone
                        FROM todo
                       WHERE uid = {?}
                       ORDER BY sent DESC', S::user()->id());
     $array_todo = $res->fetchAllAssoc();
     $this->assign('list', $array_todo);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:9,代码来源:todo.php


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