本文整理汇总了PHP中XDB类的典型用法代码示例。如果您正苦于以下问题:PHP XDB类的具体用法?PHP XDB怎么用?PHP XDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: get_address_text
function get_address_text($adr)
{
$t = '';
if (isset($adr['adr1']) && $adr['adr1']) {
$t .= $adr['adr1'];
}
if (isset($adr['adr2']) && $adr['adr2']) {
$t .= "\n" . $adr['adr2'];
}
if (isset($adr['adr3']) && $adr['adr3']) {
$t .= "\n" . $adr['adr3'];
}
$l = '';
if (isset($adr['display']) && $adr['display']) {
$keys = explode(' ', $adr['display']);
foreach ($keys as $key) {
if (isset($adr[$key])) {
$l .= ' ' . $adr[$key];
} else {
$l .= ' ' . $key;
}
}
if ($l) {
substr($l, 1);
}
} elseif ($adr['country'] == 'US' || $adr['country'] == 'CA' || $adr['country'] == 'GB') {
if ($adr['city']) {
$l .= $adr['city'] . ",\n";
}
if ($adr['region']) {
$l .= $adr['region'] . ' ';
}
if ($adr['postcode']) {
$l .= $adr['postcode'];
}
} else {
if (isset($adr['postcode']) && $adr['postcode']) {
$l .= $adr['postcode'] . ' ';
}
if (isset($adr['city']) && $adr['city']) {
$l .= $adr['city'];
}
}
if ($l) {
$t .= "\n" . trim($l);
}
if ($adr['country'] != '00' && (!$adr['countrytxt'] || $adr['countrytxt'] == strtoupper($adr['countrytxt']))) {
$res = XDB::query('SELECT countryFR
FROM geoloc_countries
WHERE iso_3166_1_a2 = {?}', $adr['country']);
$adr['countrytxt'] = $res->fetchOneCell();
}
if (isset($adr['countrytxt']) && $adr['countrytxt']) {
$t .= "\n" . $adr['countrytxt'];
}
return trim($t);
}
开发者ID:Ekleog,项目名称:platal,代码行数:57,代码来源:addresses.php
示例17: IsCandidate
public static function IsCandidate(User $user, $candidate)
{
$res = XDB::query("SELECT COUNT(*) AS lists\n FROM register_subs\n WHERE uid = {?} AND type = 'list'", $user->id());
$mlCount = $res->fetchOneCell();
if (!$mlCount) {
Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
}
return $mlCount > 0;
}
开发者ID:Ekleog,项目名称:platal,代码行数:9,代码来源:ml.inc.php
示例18: fetch
protected function fetch(PlUser $user)
{
global $globals;
if (!is_null($user)) {
return new UserFilterIterator(XDB::iterator("SELECT id, titre AS title, texte, contacts,\n create_date AS publication,\n FIND_IN_SET('photo', flags) AS photo,\n CONCAT({?}, '/#art', id) AS link\n FROM group_announces\n WHERE expiration >= NOW() AND asso_id = {?}", $this->link, $globals->asso('id'), $user));
} else {
return XDB::iterator("SELECT id, titre AS title, texte, create_date AS publication,\n CONCAT({?}, '/#art', id) AS link,\n NULL AS photo, NULL AS contacts\n FROM group_announces\n WHERE FIND_IN_SET('public', flags) AND expiration >= NOW() AND asso_id = {?}", $this->link, $globals->asso('id'));
}
}
开发者ID:Ekleog,项目名称:platal,代码行数:9,代码来源:feed.inc.php
示例19: formu
public function formu()
{
$res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance)
FROM accounts AS a
LEFT JOIN register_pending AS p ON p.uid = a.uid
LEFT JOIN register_marketing AS m ON m.uid = a.uid
WHERE a.uid = {?}', $this->m_user->id());
$this->m_relance = $res->fetchOneCell();
return 'include/form.valid.mark.tpl';
}
开发者ID:Ekleog,项目名称:platal,代码行数:10,代码来源:marketing.inc.php
示例20: 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
注:本文中的XDB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论