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


PHP XDB::format方法代码示例

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


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

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

示例2: save

 public function save(ProfilePage $page, $field, $value)
 {
     XDB::execute("DELETE FROM  profile_binets\n                            WHERE  pid = {?}", $page->pid());
     if (!count($value)) {
         return;
     }
     $insert = array();
     foreach ($value as $id => $text) {
         $insert[] = XDB::format('({?}, {?})', $page->pid(), $id);
     }
     XDB::execute("INSERT INTO  profile_binets (pid, binet_id)\n                           VALUES  " . implode(',', $insert));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:12,代码来源:groups.inc.php

示例3: getComponentId

 public static function getComponentId(array $component)
 {
     $where = '';
     foreach ($component['types'] as $type) {
         $where .= XDB::format(' AND FIND_IN_SET({?}, types)', $type);
     }
     $id = XDB::fetchOneCell('SELECT  id
                                FROM  profile_addresses_components_enum
                               WHERE  short_name = {?} AND long_name = {?}' . $where, $component['short_name'], $component['long_name']);
     if (is_null($id)) {
         XDB::execute('INSERT INTO  profile_addresses_components_enum (short_name, long_name, types)
                            VALUES  ({?}, {?}, {?})', $component['short_name'], $component['long_name'], implode(',', $component['types']));
         $id = XDB::insertId();
     }
     return $id;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:16,代码来源:geocoder.php

示例4: commit

 public function commit()
 {
     $values = array();
     $i = 0;
     foreach ($this->users as $user) {
         $values[] = XDB::format('({?}, {?}, {?}, NOW(), {?}, {?}, {?})', $user['uid'], $user['hruid'], $user['email'], rand_url_id(12), $this->user->fullName(), $this->group);
         if ($i == $this->limit) {
             XDB::rawExecute('INSERT INTO  register_pending_xnet (uid, hruid, email, date, hash, sender_name, group_name)
                                   VALUES  ' . implode(', ', $values));
             $i = 0;
             $values = array();
         } else {
             ++$i;
         }
     }
     XDB::rawExecute('INSERT INTO  register_pending_xnet (uid, hruid, email, date, hash, sender_name, group_name)
                           VALUES  ' . implode(', ', $values));
     return true;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:19,代码来源:bulkaccounts.inc.php

示例5: get

 public static function get($id, $can_be_shortname = true)
 {
     if (!$id) {
         return null;
     }
     if (!$can_be_shortname) {
         $where = XDB::format('a.id = {?}', $id);
     } else {
         $where = XDB::format('a.diminutif = {?}', $id);
     }
     $res = XDB::query('SELECT  a.*, d.nom AS domnom,
                                FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc,
                                FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub,
                                FIND_IN_SET(\'notify_all\', a.flags) AS notify_all,
                                (nls.id IS NOT NULL) AS has_nl, ad.text AS address,
                                p.display_tel AS phone, f.display_tel AS fax
                          FROM  groups AS a
                     LEFT JOIN  group_dom  AS d ON d.id = a.dom
                     LEFT JOIN  newsletters AS nls ON (nls.group_id = a.id)
                     LEFT JOIN  profile_phones AS p ON (p.link_type = \'group\' AND p.link_id = a.id AND p.tel_id = 0)
                     LEFT JOIN  profile_phones AS f ON (f.link_type = \'group\' AND f.link_id = a.id AND f.tel_id = 1)
                     LEFT JOIN  profile_addresses AS ad ON (ad.type = \'group\' AND ad.groupid = a.id)
                         WHERE  ' . $where);
     if ($res->numRows() != 1) {
         if ($can_be_shortname && (is_int($id) || ctype_digit($id))) {
             return Group::get($id, false);
         }
         return null;
     }
     $data = $res->fetchOneAssoc();
     $positions = XDB::fetchAllAssoc('SELECT  position, uid
                                        FROM  group_members
                                       WHERE  asso_id = {?} AND position IS NOT NULL
                                    ORDER BY  position', $data['id']);
     return new Group(array_merge($data, array('positions' => $positions)));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:36,代码来源:group.php

示例6: handler_trusted

 function handler_trusted($page, $action = 'list', $id = null)
 {
     $page->setTitle('Sites tiers de confiance');
     $page->assign('title', 'Mes sites tiers de confiance pour OpenId');
     $table_editor = new PLTableEditor('openid/trusted', 'account_auth_openid', 'id');
     $table_editor->set_where_clause(XDB::format('uid = {?}', S::user()->id()));
     $table_editor->vars['uid']['display_list'] = false;
     $table_editor->vars['uid']['display_item'] = false;
     $table_editor->describe('url', 'site tiers', true);
     $page->assign('deleteonly', true);
     $table_editor->apply($page, $action, $id);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:12,代码来源:openid.php

示例7: getAutoComplete

 public function getAutoComplete($text, $subid = null)
 {
     $text = str_replace(array('%', '_'), '', $text);
     if (is_null($this->ac_where) || $this->ac_where == '') {
         $where = '';
     } else {
         $where = $this->ac_where . ' AND ';
     }
     if ($subid != null && array_key_exists($subid, $this->suboptions)) {
         $where .= XDB::format($this->optfield . ' = {?} AND ', $subid);
     }
     $tests = $this->mkTests($this->valfield, $text);
     if (!is_null($this->valfield2)) {
         $tests = array_merge($tests, $this->mkTests($this->valfield2, $text));
     }
     $where .= '(' . implode(' OR ', $tests) . ')';
     return XDB::fetchAllAssoc('SELECT ' . $this->valfield . ' AS field' . ($this->ac_distinct ? ', COUNT(DISTINCT ' . $this->ac_unique . ') AS nb' : '') . ($this->ac_withid ? ', ' . $this->idfield . ' AS id' : '') . '
                                  FROM ' . $this->from . '
                                       ' . $this->ac_join . '
                                 WHERE ' . $where . '
                              GROUP BY ' . $this->valfield . '
                              ORDER BY ' . ($this->ac_distinct ? 'nb DESC' : $this->valfield) . '
                                 LIMIT ' . self::AUTOCOMPLETE_LIMIT);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:24,代码来源:direnum.php

示例8: getSortTokens

 protected function getSortTokens(PlFilter $uf)
 {
     $toks = $uf->getNameTokens();
     $scores = array();
     // If there weren't any sort tokens, we shouldn't sort by score, sort by NULL instead
     if (count($toks) == 0) {
         return 'NULL';
     }
     foreach ($toks as $sub => $token) {
         $scores[] = XDB::format('SUM(' . $sub . '.score + IF (' . $sub . '.token = {?}, 5, 0) )', $token);
     }
     return implode(' + ', $scores);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:13,代码来源:orders.inc.php

示例9: buildCondition

 public function buildCondition(PlFilter $f)
 {
     $sub = $f->addGroupFilter();
     return XDB::format($sub . '.gid IN {?}', $this->gids);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:5,代码来源:roomfilter.php

示例10: save

 public function save(ProfilePage $page, $field, $value)
 {
     require_once 'name.func.inc.php';
     $old = XDB::fetchOneAssoc('SELECT  lastname_main, lastname_marital, lastname_ordinary,
                                        firstname_main, firstname_ordinary, pseudonym
                                  FROM  profile_public_names
                                 WHERE  pid = {?}', $page->pid());
     if ($has_diff = $this->diff($page->pid(), $old, $value['public_names'])) {
         $new_names = new NamesReq(S::user(), $page->profile, $value['public_names'], $old);
         $new_names->submit();
         Platal::page()->assign('validation', true);
         Platal::page()->trigWarning('La demande de modification des noms a bien été prise en compte.' . ' Un email sera envoyé dès que ces changements auront été effectués.');
     }
     XDB::execute('DELETE FROM  profile_private_names
                         WHERE  pid = {?}', $page->pid());
     $values = array();
     $nickname = $lastname = $firstname = 0;
     if (isset($value['private_names'])) {
         foreach ($value['private_names'] as $name) {
             $values[] = XDB::format('({?}, {?}, {?}, {?})', $page->pid(), $name['type'], ${$name}['type']++, $name['name']);
         }
     }
     if (count($values)) {
         XDB::rawExecute('INSERT INTO  profile_private_names (pid, type, id, name)
                               VALUES  ' . implode(',', $values));
     }
     if ($has_diff) {
         update_display_names($page->profile, $old, $value['private_names']);
     } else {
         update_display_names($page->profile, $value['public_names'], isset($value['private_names']) ? $value['private_names'] : null);
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:32,代码来源:general.inc.php

示例11: loadMainFieldsFromUIDs

 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);
 }
开发者ID:pombredanne,项目名称:platal,代码行数:58,代码来源:user.php

示例12: rebuildSearchTokens

 public static function rebuildSearchTokens($pids, $transaction = true)
 {
     require_once 'name.func.inc.php';
     if (!is_array($pids)) {
         $pids = array($pids);
     }
     $keys = XDB::iterator("(SELECT  pid, name, type, IF(type = 'nickname', 2, 1) AS score, '' AS public\n                                  FROM  profile_private_names\n                                 WHERE  pid IN {?})\n                                UNION\n                               (SELECT  pid, lastname_main, 'lastname' AS type, 10 AS score, 'public' AS public\n                                  FROM  profile_public_names\n                                 WHERE  lastname_main != '' AND pid IN {?})\n                                UNION\n                               (SELECT  pid, lastname_marital, 'lastname' AS type, 10 AS score, 'public' AS public\n                                  FROM  profile_public_names\n                                 WHERE  lastname_marital != '' AND pid IN {?})\n                                UNION\n                               (SELECT  pid, lastname_ordinary, 'lastname' AS type, 10 AS score, 'public' AS public\n                                  FROM  profile_public_names\n                                 WHERE  lastname_ordinary != '' AND pid IN {?})\n                                UNION\n                               (SELECT  pid, firstname_main, 'firstname' AS type, 10 AS score, 'public' AS public\n                                  FROM  profile_public_names\n                                 WHERE  firstname_main != '' AND pid IN {?})\n                                UNION\n                               (SELECT  pid, firstname_ordinary, 'firstname' AS type, 10 AS score, 'public' AS public\n                                  FROM  profile_public_names\n                                 WHERE  firstname_ordinary != '' AND pid IN {?})\n                                UNION\n                               (SELECT  pid, pseudonym, 'nickname' AS type, 10 AS score, 'public' AS public\n                                  FROM  profile_public_names\n                                 WHERE  pseudonym != '' AND pid IN {?})", $pids, $pids, $pids, $pids, $pids, $pids, $pids);
     $names = array();
     while ($key = $keys->next()) {
         if ($key['name'] == '') {
             continue;
         }
         $pid = $key['pid'];
         $toks = split_name_for_search($key['name']);
         $toks = array_reverse($toks);
         /* Split the score between the tokens to avoid the user to be over-rated.
          * Let says my user name is "Machin-Truc Bidule" and I also have a user named
          * 'Machin Truc'. Distributing the score force "Machin Truc" to be displayed
          * before "Machin-Truc" for both "Machin Truc" and "Machin" searches.
          */
         $eltScore = ceil((double) $key['score'] / (double) count($toks));
         $token = '';
         foreach ($toks as $tok) {
             $token = $tok . $token;
             $names["{$pid}-{$token}"] = XDB::format('({?}, {?}, {?}, {?}, {?}, {?})', $token, $pid, soundex_fr($token), $eltScore, $key['public'], $key['type']);
         }
     }
     if ($transaction) {
         XDB::startTransaction();
     }
     XDB::execute('DELETE FROM  search_name
                         WHERE  pid IN {?}', $pids);
     if (count($names) > 0) {
         XDB::rawExecute('INSERT INTO  search_name (token, pid, soundex, score, flags, general_type)
                               VALUES  ' . implode(', ', $names));
     }
     if ($transaction) {
         XDB::commit();
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:40,代码来源:profile.php

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

示例14: layoutMinimodules

 public function layoutMinimodules(array $layout)
 {
     $cols = array_keys(FrankizMiniModule::emptyLayout());
     $sql = array();
     foreach ($cols as $col) {
         if (isset($layout[$col])) {
             foreach ($layout[$col] as $row => $name) {
                 $sql[] = XDB::format('({?}, {?}, {?}, {?})', S::user()->id(), $name, $col, $row);
             }
         }
     }
     XDB::execute('INSERT INTO  users_minimodules (uid, name, col, row)
                        VALUES  ' . implode(', ', $sql) . '
       ON DUPLICATE KEY UPDATE  col = VALUES(col), row = VALUES(row)');
     if (!(XDB::affectedRows() > 0)) {
         return false;
     }
     $this->select(UserSelect::minimodules());
     return true;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:20,代码来源:user.php

示例15: __construct

 public function __construct(array $pids, array $link_types, array $link_ids, $visibility)
 {
     $where = array();
     if (count($pids) != 0) {
         $where[] = XDB::format('(pid IN {?})', $pids);
     }
     if (count($link_types) != 0) {
         $where[] = XDB::format('(link_type IN {?})', $link_types);
     }
     if (count($link_ids) != 0) {
         $where[] = XDB::format('(link_id IN {?})', $link_ids);
     }
     if ($visibility == null || !$visibility instanceof Visibility) {
         $visibility = Visibility::defaultForRead();
     }
     $where[] = 'pve.best_display_level+0 <= pub+0';
     $sql = 'SELECT  search_tel AS search, display_tel AS display, comment, link_id,
                     tel_type AS type, link_type, tel_id AS id, pid, pub
               FROM  profile_phones
          LEFT JOIN  profile_visibility_enum AS pve ON (pve.access_level = {?})
              WHERE  ' . implode(' AND ', $where) . '
           ORDER BY  pid, link_id, tel_id';
     $this->dbiter = XDB::iterator($sql, $visibility->level());
 }
开发者ID:Ekleog,项目名称:platal,代码行数:24,代码来源:phone.php


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