本文整理汇总了PHP中S::i方法的典型用法代码示例。如果您正苦于以下问题:PHP S::i方法的具体用法?PHP S::i怎么用?PHP S::i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event
function event()
{
if ($this->asso_id) {
$res = XDB::query("SELECT e.eid, a.diminutif\n FROM group_events AS e\n INNER JOIN groups AS a ON (e.asso_id = a.id)\n LEFT JOIN group_event_participants AS p ON (p.eid = e.eid AND p.uid = {?})\n WHERE e.paiement_id = {?} AND p.uid IS NULL", S::i('uid'), $this->id);
if ($res->numRows()) {
return $res->fetchOneAssoc();
}
}
return null;
}
示例2: Prepare
public function Prepare($page)
{
parent::Prepare($page);
$res = XDB::iterRow("SELECT sub, domain\n FROM register_subs\n WHERE uid = {?} AND type = 'list'\n ORDER BY domain", S::i('uid'));
$lists = array();
while (list($sub, $domain) = $res->next()) {
$mlist = new MailingList($sub, $domain);
list($details, ) = $mlist->getMembers();
$lists["{$sub}@{$domain}"] = $details;
}
$page->assign_by_ref('lists', $lists);
}
示例3: doAuth
protected function doAuth($level)
{
if (S::identified()) {
// Nothing to do there
return User::getSilentWithValues(null, array('uid' => S::i('uid')));
}
if (!Get::has('auth')) {
return null;
}
global $globals;
if (md5('1' . S::v('challenge') . $globals->xnet->secret . Get::i('uid') . '1') != Get::v('auth')) {
return null;
}
Get::kill('auth');
S::set('auth', AUTH_PASSWD);
return User::getSilentWithValues(null, array('uid' => Get::i('uid')));
}
示例4: handler_ig_events
function handler_ig_events($page)
{
require_once 'gadgets/gadgets.inc.php';
init_igoogle_html('gadgets/ig-events.tpl', AUTH_COOKIE);
$events = XDB::iterator("SELECT SQL_CALC_FOUND_ROWS\n e.id, e.titre, UNIX_TIMESTAMP(e.creation_date) AS creation_date,\n ev.uid IS NULL AS nonlu, e.uid\n FROM announces AS e\n LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})\n WHERE FIND_IN_SET('valide', e.flags) AND expiration >= NOW()\n ORDER BY e.creation_date DESC", S::i('uid'));
$page->assign('event_count', XDB::query("SELECT FOUND_ROWS()")->fetchOneCell());
Platal::load('events', 'feed.inc.php');
$user = S::user();
$data = array();
while ($e = PlFeed::nextEvent($events, $user)) {
$data[] = $e;
if (count($data) == 5) {
break;
}
}
$page->assign('events', $data);
}
示例5: handler_sso
function handler_sso($page)
{
$this->load('sso.inc.php');
// First, perform security checks.
if (!wats4u_sso_check()) {
return PL_BAD_REQUEST;
}
global $globals;
if (!S::logged()) {
// Request auth.
$page->assign('external_auth', true);
$page->assign('ext_url', $globals->wats4u->public_url);
$page->setTitle('Authentification');
$page->setDefaultSkin('group_login');
$page->assign('group', null);
return PL_DO_AUTH;
}
if (!S::user()->checkPerms(PERMS_USER)) {
// External (X.net) account
return PL_FORBIDDEN;
}
// Update the last login information (unless the user is in SUID).
$uid = S::i('uid');
if (!S::suid()) {
global $platal;
S::logger($uid)->log('connexion_wats4u', $platal->path . ' ' . urldecode($_GET['url']));
}
// If we logged in specifically for this 'external_auth' request
// and didn't want to "keep access to services", we kill the session
// just before returning.
// See classes/xorgsession.php:startSessionAs
if (S::b('external_auth_exit')) {
S::logger()->log('deconnexion', @$_SERVER['HTTP_REFERER']);
Platal::session()->killAccessCookie();
Platal::session()->destroy();
}
// Compute return URL
$full_return = wats4u_sso_build_return_url(S::user());
if ($full_return === "") {
// Something went wrong
$page->kill("Erreur dans le traitement de la requête Wats4U.");
}
http_redirect($full_return);
}
示例6: handler_skin
function handler_skin($page)
{
global $globals;
$page->changeTpl('platal/skins.tpl');
$page->setTitle('Skins');
if (Env::has('newskin')) {
// formulaire soumis, traitons les données envoyées
XDB::execute('UPDATE accounts
SET skin = {?}
WHERE uid = {?}', Env::i('newskin'), S::i('uid'));
S::kill('skin');
Platal::session()->setSkin();
}
$res = XDB::query('SELECT id
FROM skins
WHERE skin_tpl = {?}', S::v('skin'));
$page->assign('skin_id', $res->fetchOneCell());
$sql = 'SELECT s.*, auteur, COUNT(*) AS nb
FROM skins AS s
LEFT JOIN accounts AS a ON (a.skin = s.id)
WHERE skin_tpl != \'\' AND ext != \'\'
GROUP BY id ORDER BY s.date DESC';
$page->assign('skins', XDB::iterator($sql));
}
示例7: handler_ipwatch
function handler_ipwatch($page, $action = 'list', $ip = null)
{
$page->changeTpl('admin/ipwatcher.tpl');
$states = array('safe' => 'Ne pas surveiller', 'unsafe' => 'Surveiller les inscriptions', 'dangerous' => 'Surveiller tous les accès', 'ban' => 'Bannir cette adresse');
$page->assign('states', $states);
switch (Post::v('action')) {
case 'create':
if (trim(Post::v('ipN')) != '') {
S::assert_xsrf_token();
Xdb::execute('INSERT IGNORE INTO ip_watch (ip, mask, state, detection, last, uid, description)
VALUES ({?}, {?}, {?}, CURDATE(), NOW(), {?}, {?})', ip_to_uint(trim(Post::v('ipN'))), ip_to_uint(trim(Post::v('maskN'))), Post::v('stateN'), S::i('uid'), Post::v('descriptionN'));
}
break;
case 'edit':
S::assert_xsrf_token();
Xdb::execute('UPDATE ip_watch
SET state = {?}, last = NOW(), uid = {?}, description = {?}, mask = {?}
WHERE ip = {?}', Post::v('stateN'), S::i('uid'), Post::v('descriptionN'), ip_to_uint(Post::v('maskN')), ip_to_uint(Post::v('ipN')));
break;
default:
if ($action == 'delete' && !is_null($ip)) {
S::assert_xsrf_token();
Xdb::execute('DELETE FROM ip_watch WHERE ip = {?}', ip_to_uint($ip));
}
}
if ($action != 'create' && $action != 'edit') {
$action = 'list';
}
$page->assign('action', $action);
if ($action == 'list') {
$sql = "SELECT w.ip, IF(s.ip IS NULL,\n IF(w.ip = s2.ip, s2.host, s2.forward_host),\n IF(w.ip = s.ip, s.host, s.forward_host)),\n w.mask, w.detection, w.state, a.hruid\n FROM ip_watch AS w\n LEFT JOIN log_sessions AS s ON (s.ip = w.ip)\n LEFT JOIN log_sessions AS s2 ON (s2.forward_ip = w.ip)\n LEFT JOIN accounts AS a ON (a.uid = s.uid)\n GROUP BY w.ip, a.hruid\n ORDER BY w.state, w.ip, a.hruid";
$it = Xdb::iterRow($sql);
$table = array();
$props = array();
while (list($ip, $host, $mask, $date, $state, $hruid) = $it->next()) {
$ip = uint_to_ip($ip);
$mask = uint_to_ip($mask);
if (count($props) == 0 || $props['ip'] != $ip) {
if (count($props) > 0) {
$table[] = $props;
}
$props = array('ip' => $ip, 'mask' => $mask, 'host' => $host, 'detection' => $date, 'state' => $state, 'users' => array($hruid));
} else {
$props['users'][] = $hruid;
}
}
if (count($props) > 0) {
$table[] = $props;
}
$page->assign('table', $table);
} elseif ($action == 'edit') {
$sql = "SELECT w.detection, w.state, w.last, w.description, w.mask,\n a1.hruid AS edit, a2.hruid AS hruid, s.host\n FROM ip_watch AS w\n LEFT JOIN accounts AS a1 ON (a1.uid = w.uid)\n LEFT JOIN log_sessions AS s ON (w.ip = s.ip)\n LEFT JOIN accounts AS a2 ON (a2.uid = s.uid)\n WHERE w.ip = {?}\n GROUP BY a2.hruid\n ORDER BY a2.hruid";
$it = Xdb::iterRow($sql, ip_to_uint($ip));
$props = array();
while (list($detection, $state, $last, $description, $mask, $edit, $hruid, $host) = $it->next()) {
if (count($props) == 0) {
$props = array('ip' => $ip, 'mask' => uint_to_ip($mask), 'host' => $host, 'detection' => $detection, 'state' => $state, 'last' => $last, 'description' => $description, 'edit' => $edit, 'users' => array($hruid));
} else {
$props['users'][] = $hruid;
}
}
$page->assign('ip', $props);
}
}
示例8: handler_duplicated
function handler_duplicated($page, $action = 'list', $email = null)
{
$page->changeTpl('emails/duplicated.tpl');
$states = array('pending' => 'En attente...', 'safe' => 'Pas d\'inquiétude', 'unsafe' => 'Recherches en cours', 'dangerous' => 'Usurpations par cette adresse');
$page->assign('states', $states);
if (Post::has('action')) {
S::assert_xsrf_token();
}
switch (Post::v('action')) {
case 'create':
if (trim(Post::v('emailN')) != '') {
Xdb::execute('INSERT IGNORE INTO email_watch (email, state, detection, last, uid, description)
VALUES ({?}, {?}, CURDATE(), NOW(), {?}, {?})', trim(Post::v('emailN')), Post::v('stateN'), S::i('uid'), Post::v('descriptionN'));
}
break;
case 'edit':
Xdb::execute('UPDATE email_watch
SET state = {?}, last = NOW(), uid = {?}, description = {?}
WHERE email = {?}', Post::v('stateN'), S::i('uid'), Post::v('descriptionN'), Post::v('emailN'));
break;
default:
if ($action == 'delete' && !is_null($email)) {
Xdb::execute('DELETE FROM email_watch WHERE email = {?}', $email);
}
}
if ($action != 'create' && $action != 'edit') {
$action = 'list';
}
$page->assign('action', $action);
if ($action == 'list') {
$it = XDB::iterRow('SELECT w.email, w.detection, w.state, s.email AS forlife
FROM email_watch AS w
INNER JOIN email_redirect_account AS r ON (w.email = r.redirect)
INNER JOIN email_source_account AS s ON (s.uid = r.uid AND s.type = \'forlife\')
ORDER BY w.state, w.email, s.email');
$table = array();
$props = array();
while (list($email, $date, $state, $forlife) = $it->next()) {
if (count($props) == 0 || $props['mail'] != $email) {
if (count($props) > 0) {
$table[] = $props;
}
$props = array('mail' => $email, 'detection' => $date, 'state' => $state, 'users' => array($forlife));
} else {
$props['users'][] = $forlife;
}
}
if (count($props) > 0) {
$table[] = $props;
}
$page->assign('table', $table);
} elseif ($action == 'edit') {
$it = XDB::iterRow('SELECT w.detection, w.state, w.last, w.description,
a.hruid AS edit, s.email AS forlife
FROM email_watch AS w
INNER JOIN email_redirect_account AS r ON (w.email = r.redirect)
INNER JOIN email_source_account AS s ON (s.uid = r.uid AND s.type = \'forlife\')
LEFT JOIN accounts AS a ON (w.uid = a.uid)
WHERE w.email = {?}
ORDER BY s.email', $email);
$props = array();
while (list($detection, $state, $last, $description, $edit, $forlife) = $it->next()) {
if (count($props) == 0) {
$props = array('mail' => $email, 'detection' => $detection, 'state' => $state, 'last' => $last, 'description' => $description, 'edit' => $edit, 'users' => array($forlife));
} else {
$props['users'][] = $forlife;
}
}
$page->assign('doublon', $props);
}
}
示例9: handler_notifs
public function handler_notifs($page, $action = null, $arg = null)
{
$page->changeTpl('carnet/notifs.tpl');
if ($action) {
S::assert_xsrf_token();
switch ($action) {
case 'add_promo':
$this->addPromo($page, $arg);
break;
case 'del_promo':
$this->delPromo($page, $arg);
break;
case 'add_group':
$this->addGroup($page, $arg);
break;
case 'del_group':
$this->delGroup($page, $arg);
break;
case 'del_nonins':
$user = User::get($arg);
if ($user) {
$this->delNonRegistered($page, $user);
}
break;
case 'add_nonins':
$user = User::get($arg);
if ($user) {
$this->addNonRegistered($page, $user);
}
break;
}
}
if (Env::has('subs')) {
S::assert_xsrf_token();
$flags = new PlFlagSet();
foreach (Env::v('sub') as $key => $value) {
$flags->addFlag($key, $value);
}
XDB::execute('UPDATE watch
SET actions = {?}
WHERE uid = {?}', $flags, S::i('uid'));
S::user()->invalidWatchCache();
Platal::session()->updateNbNotifs();
}
if (Env::has('flags_contacts')) {
S::assert_xsrf_token();
XDB::execute('UPDATE watch
SET ' . XDB::changeFlag('flags', 'contacts', Env::b('contacts')) . '
WHERE uid = {?}', S::i('uid'));
S::user()->invalidWatchCache();
Platal::session()->updateNbNotifs();
}
if (Env::has('flags_mail')) {
S::assert_xsrf_token();
XDB::execute('UPDATE watch
SET ' . XDB::changeFlag('flags', 'mail', Env::b('mail')) . '
WHERE uid = {?}', S::i('uid'));
S::user()->invalidWatchCache();
Platal::session()->updateNbNotifs();
}
$user = S::user();
$nonins = new UserFilter(new UFC_WatchRegistration($user));
$promo = XDB::fetchColumn('SELECT promo
FROM watch_promo
WHERE uid = {?}
ORDER BY promo', S::i('uid'));
$page->assign('promo_count', count($promo));
$ranges = array();
$range_start = null;
$range_end = null;
foreach ($promo as $p) {
if (is_null($range_start)) {
$range_start = $range_end = $p;
} else {
if ($p != $range_end + 1) {
$ranges[] = array($range_start, $range_end);
$range_start = $range_end = $p;
} else {
$range_end = $p;
}
}
}
$ranges[] = array($range_start, $range_end);
$page->assign('promo_ranges', $ranges);
$page->assign('nonins', $nonins->getUsers());
$groups = XDB::fetchColumn('SELECT g.nom
FROM watch_group AS w
INNER JOIN groups AS g ON (g.id = w.groupid)
WHERE w.uid = {?}
ORDER BY g.nom', S::i('uid'));
$page->assign('groups', $groups);
$page->assign('groups_count', count($groups));
list($flags, $actions) = XDB::fetchOneRow('SELECT flags, actions
FROM watch
WHERE uid = {?}', S::i('uid'));
$flags = new PlFlagSet($flags);
$actions = new PlFlagSet($actions);
$page->assign('flags', $flags);
$page->assign('actions', $actions);
}
示例10: handler_xnet_payment
function handler_xnet_payment($page, $pid = null)
{
global $globals;
$perms = S::v('perms');
if (is_null($pid)) {
if (!(S::identified() && $perms->hasFlag('groupadmin'))) {
return PL_FORBIDDEN;
}
} else {
if (!(S::identified() && $perms->hasFlag('groupmember'))) {
$res = XDB::query("SELECT 1\n FROM group_events AS e\n INNER JOIN group_event_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})\n WHERE e.paiement_id = {?} AND e.asso_id = {?}", S::i('uid'), $pid, $globals->asso('id'));
$public = XDB::query("SELECT 1\n FROM payments AS p\n INNER JOIN group_events AS g ON (g.paiement_id = p.id)\n WHERE g.asso_id = {?} AND p.id = {?} AND FIND_IN_SET('public', p.flags)", $globals->asso('id'), $pid);
if ($res->numRows() == 0 && $public->numRows() == 0) {
return PL_FORBIDDEN;
}
}
}
if (!is_null($pid)) {
return $this->handler_payment($page, $pid);
}
$page->changeTpl('payment/xnet.tpl');
$res = XDB::query("SELECT id, text, url\n FROM payments\n WHERE asso_id = {?} AND NOT FIND_IN_SET('old', flags)\n ORDER BY id DESC", $globals->asso('id'));
$tit = $res->fetchAllAssoc();
$page->assign('titles', $tit);
$trans = array();
$event = array();
if (may_update()) {
static $orders = array('ts_confirmed' => 'p', 'directory_name' => 'a', 'promo' => 'pd', 'comment' => 'p', 'amount' => 'p');
if (Get::has('order_id') && Get::has('order') && array_key_exists(Get::v('order'), $orders)) {
$order_id = Get::i('order_id');
$order = Get::v('order');
$ordering = ' ORDER BY ' . $orders[$order] . '.' . $order;
if (Get::has('order_inv') && Get::i('order_inv') == 1) {
$ordering .= ' DESC';
$page->assign('order_inv', 0);
} else {
$page->assign('order_inv', 1);
}
$page->assign('order_id', $order_id);
$page->assign('order', $order);
$page->assign('anchor', 'legend_' . $order_id);
} else {
$order_id = false;
$ordering = '';
$page->assign('order', false);
}
} else {
$ordering = '';
$page->assign('order', false);
}
foreach ($tit as $foo) {
$pid = $foo['id'];
if (may_update()) {
$res = XDB::query('SELECT p.uid, IF(p.ts_confirmed = \'0000-00-00\', 0, p.ts_confirmed) AS date, p.comment, p.amount
FROM payment_transactions AS p
INNER JOIN accounts AS a ON (a.uid = p.uid)
LEFT JOIN account_profiles AS ap ON (ap.uid = p.uid AND FIND_IN_SET(\'owner\', ap.perms))
LEFT JOIN profile_display AS pd ON (ap.pid = pd.pid)
WHERE p.ref = {?}' . ($order_id == $pid ? $ordering : ''), $pid);
$trans[$pid] = User::getBulkUsersWithUIDs($res->fetchAllAssoc(), 'uid', 'user');
$sum = 0;
foreach ($trans[$pid] as $i => $t) {
$sum += $t['amount'];
$trans[$pid][$i]['amount'] = $t['amount'];
}
$trans[$pid][] = array('limit' => true, 'amount' => $sum);
}
$res = XDB::iterRow("SELECT e.eid, e.short_name, e.intitule, ep.nb, ei.montant, ep.paid\n FROM group_events AS e\n LEFT JOIN group_event_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})\n INNER JOIN group_event_items AS ei ON (ep.eid = ei.eid AND ep.item_id = ei.item_id)\n WHERE e.paiement_id = {?}", S::v('uid'), $pid);
$event[$pid] = array();
$event[$pid]['paid'] = 0;
if ($res->total()) {
$event[$pid]['topay'] = 0;
while (list($eid, $shortname, $title, $nb, $montant, $paid) = $res->next()) {
$event[$pid]['topay'] += $nb * $montant;
$event[$pid]['eid'] = $eid;
$event[$pid]['shortname'] = $shortname;
$event[$pid]['title'] = $title;
$event[$pid]['ins'] = !is_null($nb);
$event[$pid]['paid'] = $paid;
}
}
$res = XDB::query('SELECT SUM(amount) AS sum_amount
FROM payment_transactions
WHERE ref = {?} AND uid = {?}', $pid, S::v('uid'));
$event[$pid]['paid'] = $res->fetchOneCell();
}
$page->register_modifier('decode_comment', 'decode_comment');
$page->assign('trans', $trans);
$page->assign('event', $event);
}
示例11: handler_ev
function handler_ev($page, $action = 'list', $eid = null, $pound = null)
{
$page->changeTpl('events/index.tpl');
$user = S::user();
/** XXX: Tips and reminder only for user with 'email' permission.
* We can do better in the future by storing a userfilter
* with the tip/reminder.
*/
if ($user->checkPerms(User::PERM_MAIL)) {
$page->assign('tips', $this->get_tips());
}
// Adds a reminder onebox to the page.
require_once 'reminder.inc.php';
if ($reminder = Reminder::GetCandidateReminder($user)) {
$reminder->Prepare($page);
}
// Wishes "Happy birthday" when required
$profile = $user->profile();
if (!is_null($profile)) {
if ($profile->next_birthday == date('Y-m-d')) {
$birthyear = (int) date('Y', strtotime($profile->birthdate));
$curyear = (int) date('Y');
$page->assign('birthday', $curyear - $birthyear);
}
}
// Direct link to the RSS feed, when available.
if (S::hasAuthToken()) {
$page->setRssLink('Polytechnique.org :: News', '/rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
}
// Hide the read event, and reload the page to get to the next event.
if ($action == 'read' && $eid) {
XDB::execute('DELETE ev.*
FROM announce_read AS ev
INNER JOIN announces AS e ON e.id = ev.evt_id
WHERE expiration < NOW()');
XDB::execute('INSERT IGNORE INTO announce_read (evt_id, uid)
VALUES ({?}, {?})', $eid, S::v('uid'));
pl_redirect('events#' . $pound);
}
// Unhide the requested event, and reload the page to display it.
if ($action == 'unread' && $eid) {
XDB::execute('DELETE FROM announce_read
WHERE evt_id = {?} AND uid = {?}', $eid, S::v('uid'));
pl_redirect('events#newsid' . $eid);
}
// Fetch the events to display, along with their metadata.
$array = array();
$it = XDB::iterator("SELECT e.id, e.titre, e.texte, e.post_id, e.uid,\n p.x, p.y, p.attach IS NOT NULL AS img, FIND_IN_SET('wiki', e.flags) AS wiki,\n FIND_IN_SET('important', e.flags) AS important,\n e.creation_date > DATE_SUB(CURDATE(), INTERVAL 2 DAY) AS news,\n e.expiration < DATE_ADD(CURDATE(), INTERVAL 2 DAY) AS end,\n ev.uid IS NULL AS nonlu, e.promo_min, e.promo_max\n FROM announces AS e\n LEFT JOIN announce_photos AS p ON (e.id = p.eid)\n LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})\n WHERE FIND_IN_SET('valide', e.flags) AND expiration >= NOW()\n ORDER BY important DESC, news DESC, end DESC, e.expiration, e.creation_date DESC", S::i('uid'));
$cats = array('important', 'news', 'end', 'body');
$this->load('feed.inc.php');
$user = S::user();
$body = EventFeed::nextEvent($it, $user);
foreach ($cats as $cat) {
$data = array();
if (!$body) {
continue;
}
do {
if ($cat == 'body' || $body[$cat]) {
$data[] = $body;
} else {
break;
}
$body = EventFeed::nextEvent($it, $user);
} while ($body);
if (!empty($data)) {
$array[$cat] = $data;
}
}
$page->assign_by_ref('events', $array);
}
示例12: get_banana_params
function get_banana_params(array &$get, $group = null, $action = null, $artid = null)
{
if ($group == 'forums') {
$group = null;
} else {
if ($group == 'thread') {
$group = S::v('banana_group');
} else {
if ($group == 'message') {
$action = 'read';
$group = S::v('banana_group');
$artid = S::i('banana_artid');
} else {
if ($action == 'message') {
$action = 'read';
$artid = S::i('banana_artid');
} else {
if ($group == 'subscribe' || $group == 'subscription') {
$group = null;
$action = null;
$get['action'] = 'subscribe';
} else {
if ($group == 'profile') {
$group = null;
$action = null;
$get['action'] = 'profile';
}
}
}
}
}
}
if (!is_null($group)) {
$get['group'] = $group;
}
if (!is_null($action)) {
if ($action == 'new') {
$get['action'] = 'new';
} elseif (!is_null($artid)) {
$get['artid'] = $artid;
if ($action == 'reply') {
$get['action'] = 'new';
} elseif ($action == 'cancel') {
$get['action'] = $action;
} elseif ($action == 'from') {
$get['first'] = $artid;
unset($get['artid']);
} elseif ($action == 'read') {
$get['part'] = @$_GET['part'];
} elseif ($action == 'source') {
$get['part'] = 'source';
} elseif ($action == 'xface') {
$get['part'] = 'xface';
} elseif ($action) {
$get['part'] = str_replace('.', '/', $action);
}
if (Get::v('action') == 'showext') {
$get['action'] = 'showext';
}
}
}
}
示例13: handler_group_see
function handler_group_see($page, $group = null)
{
global $platal;
$page->addCssLink('groups.css');
$group = Group::fromId($group);
if (!$group) {
$page->assign('title', "Ce groupe n'existe pas");
$page->changeTpl('groups/no_group.tpl');
return;
}
// Fetch the group
$group->select(GroupSelect::base());
$page->assign('group', $group);
// Check rights
if (S::i('auth') <= AUTH_PUBLIC && !$group->external()) {
$platal->force_login($page);
return;
}
$group->select(GroupSelect::see());
$page->assign('roomMaster', $group->isRoomMaster());
$promos = S::user()->castes()->groups()->filter('ns', Group::NS_PROMO);
$page->assign('promos', $promos);
// Relation between the user & the group
$page->assign('user', S::user());
if ($group->ns() != 'user') {
$caste = $group->caste(Rights::member());
if (!is_null($caste)) {
$page->assign('member_allowed', $caste->userfilter());
}
}
$page->assign('title', $group->label());
$page->changeTpl('groups/group.tpl');
}
示例14: filteredFetch
public function filteredFetch($skin, array &$infos = null)
{
global $globals, $platal;
$this->register_prefilter('trimwhitespace');
$this->register_prefilter('form_force_encodings');
$this->register_prefilter('wiki_include');
$this->register_prefilter('core_include');
$this->register_prefilter('if_rewrites');
$this->assign_by_ref('platal', $platal);
$this->assign_by_ref('globals', $globals);
$this->register_modifier('escape_html', 'escape_html');
$this->default_modifiers = array('@escape_html');
if (S::i('auth') <= AUTH_PUBLIC) {
$this->register_outputfilter('hide_emails');
}
if ($infos !== null) {
$START_SMARTY = microtime(true);
}
$result = $this->fetch($skin);
if ($infos !== null) {
$infos['time'] = microtime(true) - $START_SMARTY;
}
return $result;
}
示例15: gpex_make
function gpex_make($chlg, $privkey, $datafields, $charset)
{
$tohash = "1{$chlg}{$privkey}";
$params = "";
$fieldarr = explode(',', $datafields);
$user =& S::user();
if ($user->hasProfile()) {
/* Transition table for authentification. */
$personnal_data = $user->profile()->data();
$personnal_data['full_promo'] = $personnal_data['promo'];
$personnal_data['promo'] = $personnal_data['entry_year'];
$personnal_data['matricule'] = $personnal_data['xorg_id'];
$personnal_data['matricule_ax'] = $personnal_data['ax_id'];
$personnal_data['promo_sortie'] = $personnal_data['grad_year'];
$personnal_data['nationalite'] = $personnal_data['nationality1'];
$personnal_data['naissance'] = $personnal_data['birthdate'];
$personnal_data['deces'] = $personnal_data['deathdate'];
$personnal_data['nom'] = $personnal_data['lastname'];
$personnal_data['prenom'] = $personnal_data['firstname'];
$personnal_data['flags'] = $user->profile()->isFemale() ? 'femme' : '';
} else {
// Missing fields: promo, entry_year, grad_year, ax_id, xorg_id, forlife
$personnal_data = array('lastname' => $user->lastname, 'firstname' => $user->firstname, 'sex' => $user->gender);
}
foreach ($fieldarr as $val) {
// Determine the requested value, and add it to the answer.
if ($val == 'perms') {
$params .= gpex_prepare_param($val, S::admin() ? 'admin' : 'user', $tohash, $charset);
} else {
if ($val == 'forlife') {
$params .= gpex_prepare_param($val, S::v('hruid'), $tohash, $charset);
} else {
if (S::has($val)) {
$params .= gpex_prepare_param($val, S::v($val), $tohash, $charset);
} else {
if (isset($personnal_data[$val])) {
$params .= gpex_prepare_param($val, $personnal_data[$val], $tohash, $charset);
} else {
if ($val == 'username') {
$min_username = XDB::fetchOneCell('SELECT email
FROM email_source_account
WHERE uid = {?} AND FIND_IN_SET(\'bestalias\', flags)', S::i('uid'));
$params .= gpex_prepare_param($val, is_null($min_username) ? '' : $min_username, $tohash, $charset);
} else {
if ($val == 'grpauth') {
if (isset($_GET['group'])) {
$res = XDB::query("SELECT perms\n FROM group_members\n INNER JOIN groups ON(id = asso_id)\n WHERE uid = {?} AND diminutif = {?}", S::v('uid'), $_GET['group']);
$perms = $res->fetchOneCell();
} else {
// if no group asked, return main rights
$perms = S::admin() ? 'admin' : 'membre';
}
$params .= gpex_prepare_param($val, $perms, $tohash, $charset);
} else {
$params .= gpex_prepare_param($val, '', $tohash, $charset);
}
}
}
}
}
}
}
$tohash .= "1";
$auth = md5($tohash);
return array($auth, "&auth=" . $auth . $params);
}