本文整理汇总了PHP中XDB::formatWildcards方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::formatWildcards方法的具体用法?PHP XDB::formatWildcards怎么用?PHP XDB::formatWildcards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::formatWildcards方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildCondition
public function buildCondition(PlFilter $rf)
{
$right = XDB::formatWildcards(XDB::WILDCARD_PREFIX, $this->prefix);
return 'r.rid ' . $right;
}
示例2: buildCondition
public function buildCondition(PlFilter $uf)
{
$right = XDB::formatWildcards($this->mode, $this->text);
return 'n.title' . $right;
}
示例3: buildCondition
public function buildCondition(PlFilter $uf)
{
$sub = $uf->addRoomFilter();
if ($this->exact) {
return XDB::format("{$sub}.rid IN {?}", $this->rooms);
} else {
if (count($this->rooms) == 0) {
return false;
} else {
if (count($this->rooms) == 1) {
return $sub . '.rid ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->rooms[0]);
} else {
foreach ($this->rooms as $room) {
$temp[] = $sub . '.rid ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $room);
}
return '(' . implode(') ' . 'OR' . ' (', $temp) . ')';
}
}
}
}
示例4: getGroup
private function getGroup(PlPage $page, $group)
{
$groupid = XDB::fetchOneCell("SELECT id\n FROM groups\n WHERE (nom = {?} OR diminutif = {?}) AND NOT FIND_IN_SET('private', pub)", $group, $group);
if (is_null($groupid)) {
$search = XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $group);
$res = XDB::query('SELECT id
FROM groups
WHERE (nom ' . $search . ' OR diminutif ' . $search . ") AND NOT FIND_IN_SET('private', pub)", $search, $search);
if ($res->numRows() == 1) {
$groupid = $res->fetchOneCell();
}
}
return $groupid;
}
示例5: articleSearch
public function articleSearch($search, $field, $user)
{
$search = XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $search);
if ($field == self::SEARCH_ALL) {
$where = '(a.title ' . $search . ' OR a.body ' . $search . ' OR a.append ' . $search . ')';
} else {
$where = 'a.' . $field . $search;
}
$list = XDB::fetchAllAssoc('SELECT i.short_name, a.aid, i.id, a.title
FROM newsletter_art AS a
INNER JOIN newsletter_issues AS i ON (a.id = i.id)
WHERE i.nlid = {?} AND i.state = \'sent\' AND ' . $where . '
GROUP BY a.id, a.aid
ORDER BY i.date DESC, a.aid', $this->id);
$articles = array();
foreach ($list as $item) {
$issue = new NLIssue($item['id'], $this, false);
if ($issue->checkUser($user)) {
$articles[] = $item;
}
}
return $articles;
}
示例6: buildCondition
public function buildCondition(PlFilter $uf)
{
$sub = $uf->addRoomFilter();
$right = XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->number);
return $sub . '.phone ' . $right;
}
示例7: handler_laf
function handler_laf($page, $id = 0)
{
if (Env::has('trouve') && Env::has('obj')) {
if (S::logged()) {
XDB::execute("INSERT INTO laf\n SET uid = {?}, found = NOW(), description = {?}, context = {?}", S::user()->id(), Env::t('obj'), Env::t('desc'));
$page->assign('message', 'Pense à supprimer l\'objet une fois rendu à son propriétaire.');
require_once 'banana/hooks.inc.php';
$body = 'L\'objet ' . Env::t('obj') . ' a été retrouvé';
if (Env::t('desc') != '') {
$body .= ' dans les circonstances suivantes : ' . Env::t('desc');
}
$body .= '.\\n\\n' . S::user()->displayName() . '\\n\\n\\n' . 'Ceci est un message automatique, merci de le signaler sur frankiz une fois l\'objet rendu.';
send_message('br.pa', 'pong ' . Env::t('obj'), $body);
} else {
$page->assign('not_logged', 'true');
}
}
if (Env::has('perdu') && Env::has('obj')) {
if (S::logged()) {
XDB::execute("INSERT INTO laf\n SET uid = {?}, lost = NOW(), description = {?}, context = {?}", S::user()->id(), Env::t('obj'), Env::t('desc'));
$page->assign('message', 'Pense à supprimer l\'objet dès que celui-ci est retrouvé.');
require_once 'banana/hooks.inc.php';
$body = 'L\'objet ' . Env::t('obj') . ' a été perdu';
if (Env::t('desc') != '') {
$body .= ' dans les circonstances suivantes : ' . Env::t('desc');
}
$body .= '.\\n\\n' . S::user()->displayName() . '\\n\\n\\n' . 'Ceci est un message automatique, merci de le signaler sur frankiz une fois l\'objet retrouvé.';
send_message('br.pa', 'ping ' . Env::t('obj'), $body);
} else {
$page->assign('not_logged', 'true');
}
}
if (Env::has('pong')) {
$this->manage_pong($page, $id);
}
if (Env::has('del_pong')) {
if (S::logged()) {
$res = XDB::query("SELECT * FROM laf WHERE oid = {?}", $id)->fetchAllRow();
$res = $res[0];
if (S::user()->id() == $res[1]) {
XDB::execute("UPDATE laf SET lost = NOW() WHERE oid = {?}", $id);
$page->assign('message', 'L\'objet a été supprimé de la base.');
} else {
$page->assign('message', 'Seul celui qui a trouvé l\'objet peut le supprimer de la liste.');
}
} else {
$page->assign('no-logged', 'true');
}
}
if (Env::has('ping')) {
if (S::logged()) {
$this->manage_ping($page, $id);
} else {
$page->assign('not_logged', 'true');
}
}
if (Env::has('del_ping')) {
if (S::logged()) {
$res = XDB::query("SELECT * FROM laf WHERE oid = {?}", $id)->fetchAllRow();
$res = $res[0];
if (S::user()->id() == $res[1]) {
XDB::execute("UPDATE laf SET found = NOW() WHERE oid = {?}", $id);
$page->assign('message', 'L\'objet a été supprimé de la base.');
} else {
$page->assign('message', 'Seul celui qui a perdu l\'objet peut le supprimer de la liste.');
}
} else {
$page->assign('not_logged', 'true');
}
}
if (Env::has('ping_obj')) {
$res = XDB::query("SELECT * FROM laf WHERE ISNULL(found) \n \t\t\t\tAND description " . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, Env::t('ping_obj')) . "\n \t\t\t\tOR context " . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, Env::t('ping_obj')) . "\n \t\t\t\tORDER BY lost DESC LIMIT 30");
$lost = $res->fetchAllRow();
$page->assign('query', 'ping');
} else {
$res = XDB::query("SELECT * FROM laf WHERE ISNULL(found) ORDER BY lost DESC LIMIT 30");
$lost = $res->fetchAllRow();
}
if (Env::has('pong_obj')) {
$res = XDB::query("SELECT *\n FROM laf\n WHERE ISNULL(lost)\n \t\t\t\t AND description " . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, Env::t('pong_obj')) . "\n \t\t\t\t OR context " . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, Env::t('pong_obj')) . "\n \t\t\t\t ORDER BY found\n \t\t\t DESC LIMIT 30");
$found = $res->fetchAllRow();
$page->assign('query', 'pong');
} else {
$res = XDB::query("SELECT * FROM laf WHERE ISNULL(lost) ORDER BY found DESC LIMIT 30");
$found = $res->fetchAllRow();
}
$page->addCssLink('laf.css');
$page->assign('uid', s::user()->id());
$page->assign('title', 'Objets Trouvés');
$page->assign('lost', $lost);
$page->assign('found', $found);
$page->changeTpl('lostandfound/laf.tpl');
}
示例8: getIDs
public function getIDs($text, $mode, $subid = null)
{
if ($mode == XDB::WILDCARD_EXACT) {
$options = $this->getOptions($subid);
return array_keys($options, $text);
} else {
if ($this->where == null) {
$where = 'WHERE ';
} else {
$where = $this->where . ' AND ';
}
if ($subid != null && array_key_exists($subid, $this->suboptions)) {
$where .= XDB::format($this->optfield . ' = {?} AND ', $subid);
}
$conds = array();
$conds[] = $this->valfield . XDB::formatWildcards($mode, $text);
if ($this->valfield2 != null) {
$conds[] = $this->valfield2 . XDB::formatWildcards($mode, $text);
}
$where .= '(' . implode(' OR ', $conds) . ')';
return XDB::fetchColumn('SELECT ' . $this->idfield . '
FROM ' . $this->from . '
' . $this->join . '
' . $where . '
GROUP BY ' . $this->idfield);
}
}
示例9: buildCondition
public function buildCondition(PlFilter $uf)
{
$sub = $uf->addDeltaTenFilter(UserFilter::DELTATEN_MESSAGE);
return $sub . '.message ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->message);
}