本文整理汇总了PHP中s::user方法的典型用法代码示例。如果您正苦于以下问题:PHP s::user方法的具体用法?PHP s::user怎么用?PHP s::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类s
的用法示例。
在下文中一共展示了s::user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: handler_participants_del
function handler_participants_del($page, $id)
{
S::assert_xsrf_token();
$activities = new ActivityInstanceFilter(new PFC_AND(new AIFC_CanBeSeen(S::user()), new AIFC_Id($id)));
$a = $activities->get(true);
if ($a === false) {
$page->jsonAssign('success', false);
return PL_JSON;
}
$a->select(ActivityInstanceSelect::base());
$a->delete_participants(S::user()->id());
$page->jsonAssign('participant', array('id' => s::user()->id()));
$page->jsonAssign('success', true);
return PL_JSON;
}
示例3: export
public function export($bits = null)
{
$a = parent::export($bits);
$a['aid'] = $this->activity->id();
$a['writer'] = array('displayName' => $this->writer->displayName(), 'id' => $this->writer->id(), 'login' => $this->writer->login(), 'photo' => $this->writer->image()->src('micro'));
$a['target'] = array('name' => $this->activity->target_group()->name(), 'label' => $this->activity->target_group()->label());
if ($this->activity->origin() != false) {
$a['origin'] = array('name' => $this->activity->origin()->name(), 'label' => $this->activity->origin()->label());
if ($this->activity->origin()->image() != false) {
$a['origin']['image'] = $this->activity->origin()->image()->src('micro');
}
}
$a['title'] = $this->activity->title();
$a['description'] = MiniWiki::wikiToHTML($this->activity->description(), false);
$a['comment'] = MiniWiki::wikiToHTML($this->comment, false);
$a['begin'] = $this->begin->format("m/d/Y H:i");
$a['end'] = $this->end->format("m/d/Y H:i");
$a['participants'] = array();
foreach ($this->participants as $user) {
$a['participants'][$user->id()] = array('displayName' => $user->displayName(), 'id' => $user->id());
if ($user->id() == s::user()->id()) {
$a['participate'] = true;
}
}
if (!isset($a['participate'])) {
$a['participate'] = false;
}
$a['regular'] = $this->regular();
$a['canEdit'] = S::user()->hasRights($this->activity->target()->group(), Rights::admin());
$a['isWriter'] = S::user()->id() == $this->writer->id();
return $a;
}