本文整理汇总了PHP中S::v方法的典型用法代码示例。如果您正苦于以下问题:PHP S::v方法的具体用法?PHP S::v怎么用?PHP S::v使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::v方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_test_email
function smarty_function_test_email($params, $smarty)
{
$label = isset($params['title']) ? $params['title'] : 'Envoyer un email de test';
$token = "'" . S::v('xsrf_token') . (isset($params['hruid']) ? "', " : "'");
$hruid = isset($params['hruid']) ? "'" . $params['hruid'] . "'" : '';
return '<div class="center">' . ' <div id="mail_sent" style="position: absolute;"></div><br />' . ' <div><input type="submit" name="send" value="' . $label . '" onclick="sendTestEmail(' . $token . $hruid . ')" /></div>' . '</div>';
}
示例2: 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();
}
示例3: IsCandidate
public static function IsCandidate(User $user, $candidate)
{
if (!$user->checkPerms(User::PERM_MAIL)) {
return false;
}
return S::v('no_redirect');
}
示例4: IsCandidate
public static function IsCandidate(User $user, $candidate)
{
if (!$user->checkPerms(User::PERM_MAIL)) {
return false;
}
return count(S::v('mx_failures', array())) > 0;
}
示例5: force_login
public function force_login(PlPage $page)
{
$redirect = S::v('loginX');
if (!$redirect) {
$page->trigError('Impossible de s\'authentifier. Problème de configuration de plat/al.');
return;
}
http_redirect($redirect);
}
示例6: smarty_insert_getUsername
function smarty_insert_getUsername()
{
$id = Cookie::i('uid', -1);
$id = S::v('uid', $id);
if ($id < 0) {
return '';
}
$user = User::getSilentWithUID($id);
return $user->bestEmail();
}
示例7: handler_admin
function handler_admin($page)
{
$page->changeTpl('xnet/admin.tpl');
if (Get::has('del')) {
$res = XDB::query('SELECT id, nom, mail_domain
FROM groups WHERE diminutif={?}', Get::v('del'));
list($id, $nom, $domain) = $res->fetchOneRow();
$page->assign('nom', $nom);
if ($id && Post::has('del')) {
S::assert_xsrf_token();
XDB::query('DELETE FROM group_members WHERE asso_id={?}', $id);
$page->trigSuccess('membres supprimés');
if ($domain) {
XDB::execute('DELETE v
FROM email_virtual AS v
INNER JOIN email_virtual_domains AS d ON (v.domain = d.id)
WHERE d.name = {?}', $domain);
XDB::execute('DELETE FROM email_virtual_domains
WHERE name = {?}', $domain);
$page->trigSuccess('suppression des alias mails');
$mmlist = new MMList(S::v('uid'), S::v('password'), $domain);
if ($listes = $mmlist->get_lists()) {
foreach ($listes as $l) {
$mmlist->delete_list($l['list'], true);
}
$page->trigSuccess('mail lists surpprimées');
}
}
XDB::query('DELETE FROM groups WHERE id={?}', $id);
$page->trigSuccess("Groupe {$nom} supprimé");
Get::kill('del');
}
if (!$id) {
Get::kill('del');
}
}
if (Post::has('diminutif') && Post::v('diminutif') != "") {
S::assert_xsrf_token();
$res = XDB::query('SELECT COUNT(*)
FROM groups
WHERE diminutif = {?}', Post::v('diminutif'));
if ($res->fetchOneCell() == 0) {
XDB::execute('INSERT INTO groups (id, diminutif)
VALUES (NULL, {?})', Post::v('diminutif'));
pl_redirect(Post::v('diminutif') . '/edit');
} else {
$page->trigError('Le diminutif demandé est déjà pris.');
}
}
$res = XDB::query('SELECT nom, diminutif
FROM groups
ORDER BY nom');
$page->assign('assos', $res->fetchAllAssoc());
}
示例8: smarty_function_print_eleve_name
function smarty_function_print_eleve_name($params, &$smarty)
{
$user = $params['eleve'];
$name = $user->displayName();
if (isset($params['show_promo'])) {
$name .= " (" . $user->promo() . ")";
}
if (S::v('auth', AUTH_PUBLIC) >= AUTH_INTERNE) {
$name = "<a href='tol/" . $user->login() . "'>" . $name . "</a>";
}
return $name;
}
示例9: init
private static function init($type)
{
if (Platal::globals()->cacheEnabled() && S::has('__DE_' . $type)) {
self::$enumerations[$type] = S::v('__DE_' . $type);
} else {
$cls = "DE_" . ucfirst($type);
$obj = new $cls();
self::$enumerations[$type] = $obj;
if (Platal::globals()->cacheEnabled() && $obj->capabilities & DirEnumeration::SAVE_IN_SESSION) {
S::set('__DE_' . $type, $obj);
}
}
}
示例10: run
public function run()
{
global $globals, $platal;
if ($this->forced_skin !== null) {
$skin = $this->forced_skin . '.tpl';
} else {
if ($this->default_skin === null) {
$default_skin = $globals->skin;
} else {
$default_skin = $this->default_skin;
}
$skin = S::v('skin', $default_skin . '.tpl');
}
$this->_run('skin/' . $skin);
}
示例11: prepareform
function prepareform($pay, $user)
{
global $globals, $platal;
$log = S::v('log');
// Transaction's reference computation.
$prefix = rand_url_id();
$fullref = substr("{$prefix}-{$pay->id}", -12);
// FIXME : check for duplicates
$ts = time();
$trans_date = gmdate("YmdHis", $ts);
$trans_id = gmdate("His", $ts);
// FIXME : check for duplicates
// Form's content.
$this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/";
$this->infos['commercant'] = array('vads_site_id' => $globals->money->cyperplus_account, 'vads_return_mode' => 'NONE', 'vads_url_return' => $pay->url ? $pay->url : $globals->baseurl . '/' . $platal->ns);
$this->infos['client'] = array('vads_cust_email' => $user->bestEmail(), 'vads_cust_id' => $user->id(), 'vads_cust_name' => substr(self::replaceNonAlpha(replace_accent($user->shortName())), 0, 127));
$this->infos['commande'] = array('vads_amount' => $this->val, 'vads_currency' => '978', 'vads_payment_config' => 'SINGLE', 'vads_trans_date' => $trans_date, 'vads_trans_id' => $trans_id, 'vads_order_id' => $fullref, 'vads_order_info' => substr(self::replaceNonAlpha(replace_accent(Env::v('comment'))), 0, 255), 'vads_order_info2' => Post::i('display'));
$this->infos['divers'] = array('vads_version' => 'V2', 'vads_ctx_mode' => $globals->money->cyperplus_prod, 'vads_page_action' => 'PAYMENT', 'vads_action_mode' => 'INTERACTIVE');
// Entry key computation.
$all_params = array_merge($this->infos['commercant'], $this->infos['client'], $this->infos['commande'], $this->infos['divers']);
ksort($all_params);
$this->infos['divers']['signature'] = sha1(join('+', $all_params) . '+' . $globals->money->cyperplus_key);
}
示例12: init_igoogle_html
function init_igoogle_html($template, $auth = AUTH_PUBLIC)
{
$page =& Platal::page();
$page->changeTpl('gadgets/ig-skin.tpl', NO_SKIN);
$page->register_modifier('escape_html', 'escape_html');
$page->default_modifiers = array('@escape_html');
header('Accept-Charset: utf-8');
// Adds external JavaScript libraries provided by iGoogle to the page.
if (Env::has('libs')) {
$libs = preg_split('/,/', Env::s('libs'), -1, PREG_SPLIT_NO_EMPTY);
foreach ($libs as $lib) {
if (preg_match('@^[a-z0-9/._-]+$@i', $lib) && !preg_match('@([.][.])|([.]/)|(//)@', $lib)) {
$page->append('gadget_js', 'https://www.google.com/ig/f/' . $lib);
}
}
}
// Redirects the user to the login pagin if required.
if ($auth > S::v('auth', AUTH_PUBLIC)) {
$page->assign('gadget_tpl', 'gadgets/ig-login.tpl');
return false;
}
$page->assign('gadget_tpl', $template);
return true;
}
示例13: 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';
}
}
}
}
示例14: startSessionAs
protected function startSessionAs($user, $level)
{
if (!is_null(S::user()) && S::user()->id() != $user->id() || S::has('uid') && S::i('uid') != $user->id()) {
return false;
} else {
if (S::has('uid')) {
return true;
}
}
if ($level == AUTH_SUID) {
S::set('auth', AUTH_PASSWD);
}
// Loads uid and hruid into the session for developement conveniance.
$_SESSION = array_merge($_SESSION, array('uid' => $user->id(), 'hruid' => $user->hruid, 'token' => $user->token, 'user' => $user));
// Starts the session's logger, and sets up the permanent cookie.
if (S::suid()) {
S::logger()->log("suid_start", S::v('hruid') . ' by ' . S::suid('hruid'));
} else {
S::logger()->saveLastSession();
Cookie::set('uid', $user->id(), 300);
if (S::i('auth_by_cookie') == $user->id() || Post::v('remember', 'false') == 'true') {
$this->setAccessCookie(false, S::i('auth_by_cookie') != $user->id());
} else {
$this->killAccessCookie();
// If login for an external website and not activating cookie,
// mark that we want to disconnect once external auth checks
// have been performed.
if (Post::b('external_auth')) {
S::set('external_auth_exit', true);
}
}
}
// Finalizes the session setup.
$this->makePerms($user->perms, $user->is_admin);
$this->securityChecks();
$this->setSkin();
$this->updateNbNotifs();
// Only check email redirection for 'internal' users.
if ($user->checkPerms(PERMS_USER)) {
check_redirect();
}
// We should not have to use this private data anymore
S::kill('auth_by_cookie');
return true;
}
示例15: 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);
}