本文整理汇总了PHP中Post::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::has方法的具体用法?PHP Post::has怎么用?PHP Post::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler_issues_promo
function handler_issues_promo($page, $action = '')
{
$page->changeTpl('fusionax/promo_issues.tpl');
if ($action == 'edit') {
S::assert_xsrf_token();
$issues = XDB::rawIterRow('SELECT p.pid, pd.directory_name, pd.promo, pm.entry_year_ax, pe.entry_year, pe.grad_year
FROM profile_merge_issues AS pm
INNER JOIN profiles AS p ON (pm.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
INNER JOIN profile_education AS pe ON (pe.pid = p.pid AND FIND_IN_SET(\'primary\', pe.flags))
WHERE FIND_IN_SET(\'promo\', pm.issues)
ORDER BY pd.directory_name');
while (list($pid, $name, $promo, $deathAX, $deathXorgEntry, $deathXorgGrad) = $issues->next()) {
$choiceXorg = Post::has('XORG_' . $pid);
if (!(Post::has('display_' . $pid) && Post::has('entry_' . $pid) && Post::has('grad_' . $pid))) {
continue;
}
$display = Post::i('display_' . $pid);
$entry = Post::i('entry_' . $pid);
$grad = Post::i('grad_' . $pid);
if (!($grad <= $entry + 5 && $grad >= $entry + 3 && ($display >= $entry && $display <= $grad - 3))) {
$page->trigError("La promotion de {$name} n'a pas été corrigée.");
continue;
}
XDB::execute('UPDATE profile_display
SET promo = {?}
WHERE pid = {?}', 'X' . $display, $pid);
XDB::execute('UPDATE profile_education
SET entry_year = {?}, grad_year = {?}
WHERE pid = {?} AND FIND_IN_SET(\'primary\', flags)', $entry, $grad, $pid);
$page->trigSuccess("La promotion de {$name} a bien été corrigée.");
}
}
$issues = XDB::rawFetchAllAssoc('SELECT p.pid, p.hrpid, pd.directory_name, pd.promo, pm.entry_year_ax, pe.entry_year, pe.grad_year
FROM profile_merge_issues AS pm
INNER JOIN profiles AS p ON (pm.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
INNER JOIN profile_education AS pe ON (pe.pid = p.pid AND FIND_IN_SET(\'primary\', pe.flags))
WHERE FIND_IN_SET(\'promo\', pm.issues)
ORDER BY pd.directory_name');
$page->assign('issues', $issues);
$page->assign('total', count($issues));
}
示例2: handler_licenses_final
public function handler_licenses_final($page, $no_reason = false)
{
$softwares = License::getSoftwares();
$keys = array();
if (Post::has('disagree') || !$no_reason && !Post::has('resend') && (!Post::has('reason') || Post::v('reason') == "") || !Post::has('software') || !in_array(Post::v('software'), array_keys($softwares))) {
$this->handler_licenses($page);
} else {
$page->changeTpl('licenses/licenses_final.tpl');
$page->assign('title', "Demande de licence pour {$softwares[Post::v('software')]}");
$page->assign('software', Post::s('software'));
$page->assign('software_name', $softwares[Post::s('software')]);
if (($key = License::adminKey(Post::s('software'))) && License::hasRights(S::user())) {
$key->give(S::user());
$page->assign('direct', true);
} elseif (Post::has('resend')) {
$l = License::fetch(array('id' => Post::i('id')));
if ($l[0]->uid() == S::user()->id()) {
License::send($l);
} else {
die("La license n'appartient pas à l'utilisateur courant");
}
$page->assign('direct', true);
} else {
$lv = new LicensesValidate(Post::s('software'), Post::s('reason'));
$v = new Validate(array('writer' => S::user(), 'group' => Group::from('licenses'), 'item' => $lv, 'type' => 'licenses'));
$v->insert();
$page->assign('direct', false);
}
}
}
示例3: handler_map_url
function handler_map_url($page)
{
pl_content_headers('text/plain');
if (Post::has('text')) {
$address = new Address(array('text' => Post::t('text')));
$gmapsGeocoder = new GMapsGeocoder();
$gmapsGeocoder->getGeocodedAddress($address);
echo GMapsGeocoder::buildStaticMapURL($address->latitude, $address->longitude, Post::t('color'));
}
exit;
}
示例4: handler_banana
function handler_banana($page, $group = null, $action = null, $artid = null)
{
$page->changeTpl('banana/index.tpl');
$page->setTitle('Forums & PA');
$get = array();
if (Post::has('updateall')) {
$get['updateall'] = Post::v('updateall');
}
require_once 'banana/forum.inc.php';
get_banana_params($get, $group, $action, $artid);
run_banana($page, 'ForumsBanana', $get);
}
示例5: send_robot_homonym
function send_robot_homonym(PlUser $user, $email)
{
$cc = "validation+homonyme@" . Platal::globals()->mail->domain;
$from = "\"Support Polytechnique.org\" <{$cc}>";
$body = Post::has('mailbody') ? Post::t('mailbody') : get_robot_mail_text($user, $email);
$user = User::getSilentWithUID($user->id());
$mymail = new PlMailer();
$mymail->setFrom($from);
$mymail->setSubject("Mise en place du robot {$email}@" . $user->mainEmailDomain());
$mymail->addCc($cc);
$mymail->setTxtBody($body);
$mymail->sendTo($user);
}
示例6: handler_admin_url
function handler_admin_url($page)
{
$page->changeTpl('urlshortener/admin.tpl');
if (!Post::has('url')) {
return;
}
$url = Post::t('url');
$alias = Post::t('alias');
$url_regex = '{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i';
if (strlen($url) > 255 || !preg_match($url_regex, $url)) {
$page->trigError("L'url donnée n'est pas valide.");
return;
}
$page->assign('url', $url);
if ($alias != '') {
if (!preg_match('/^[a-zA-Z0-9\\-\\/]+$/i', $alias)) {
$page->trigError("L'alias proposé n'est pas valide.");
return;
}
if (preg_match('/^a\\//i', $alias)) {
$page->trigError("L'alias commence par le préfixe 'a/' qui est réservé et donc non autorisé.");
return;
}
$page->assign('alias', $alias);
$used = XDB::fetchOneCell('SELECT COUNT(*)
FROM url_shortener
WHERE alias = {?}', $alias);
if ($used != 0) {
$page->trigError("L'alias proposé est déjà utilisé.");
return;
}
} else {
do {
$alias = 'a/' . rand_token(6);
$used = XDB::fetchOneCell('SELECT COUNT(*)
FROM url_shortener
WHERE alias = {?}', $alias);
} while ($used != 0);
$page->assign('alias', $alias);
}
XDB::execute('INSERT INTO url_shortener (url, alias)
VALUES ({?}, {?})', $url, $alias);
$page->trigSuccess("L'url « " . $url . ' » est maintenant accessible depuis « http://u.w4x.org/' . $alias . ' ».');
}
示例7: handler_coml_submit
function handler_coml_submit($page)
{
$page->changeTpl('comletter/submit.tpl');
$nl = $this->getNl();
if (!$nl) {
return PL_NOT_FOUND;
}
$wp = new PlWikiPage('Xorg.LettreCommunaute');
$wp->buildCache();
if (Post::has('see') || Post::has('valid') && (!trim(Post::v('title')) || !trim(Post::v('body')))) {
if (!Post::has('see')) {
$page->trigError("L'article doit avoir un titre et un contenu");
}
$art = new ComLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
$page->assign('art', $art);
} elseif (Post::has('valid')) {
$art = new ComLReq(S::user(), Post::v('title'), Post::v('body'), Post::v('append'));
$art->submit();
$page->assign('submited', true);
}
$page->addCssLink($nl->cssFile());
}
示例8: handler_admin_nl_enable
public function handler_admin_nl_enable($page)
{
global $globals;
$nl = $this->getNl();
if ($nl) {
return PL_FORBIDDEN;
}
if (Post::has('title')) {
if (!S::has_xsrf_token()) {
return PL_FORBIDDEN;
}
XDB::execute('INSERT INTO newsletters
SET group_id = {?}, name = {?}', $globals->asso('id'), Post::s('title'));
$mailer = new PlMailer();
$mailer->assign('group', $globals->asso('nom'));
$mailer->assign('user', S::user());
$mailer->send();
$page->trigSuccessRedirect("La lettre d'informations du groupe " . $globals->asso('nom') . " a bien été créée", $globals->asso('shortname') . '/admin/nl');
}
$page->setTitle('Activation de la newsletter');
$page->changeTpl('newsletter/enable.tpl');
}
示例9: handler_batch
function handler_batch($page)
{
$page->changeTpl('carnet/batch.tpl');
$errors = false;
$incomplete = array();
if (Post::has('add')) {
S::assert_xsrf_token();
require_once 'userset.inc.php';
require_once 'emails.inc.php';
require_once 'marketing.inc.php';
$list = explode("\n", Post::v('list'));
$origin = Post::v('origin');
foreach ($list as $item) {
if ($item = trim($item)) {
$elements = preg_split("/\\s/", $item);
$email = array_pop($elements);
if (!isvalid_email($email)) {
$page->trigError('Email invalide : ' . $email);
$incomplete[] = $item;
$errors = true;
continue;
}
$user = User::getSilent($email);
if (is_null($user)) {
$details = implode(' ', $elements);
$promo = trim(array_pop($elements));
$cond = new PFC_And();
if (preg_match('/^[MDX]\\d{4}$/', $promo)) {
$cond->addChild(new UFC_Promo('=', UserFilter::DISPLAY, $promo));
} else {
$cond->addChild(new UFC_NameTokens($promo));
}
foreach ($elements as $element) {
$cond->addChild(new UFC_NameTokens($element));
}
$uf = new UserFilter($cond);
$count = $uf->getTotalCount();
if ($count == 0) {
$page->trigError('Les informations : « ' . $item . ' » ne correspondent à aucun camarade.');
$incomplete[] = $item;
$errors = true;
continue;
} elseif ($count > 1) {
$page->trigError('Les informations : « ' . $item . ' » sont ambigues et correspondent à plusieurs camarades.');
$incomplete[] = $item;
$errors = true;
continue;
} else {
$user = $uf->getUser();
}
}
if ($user->state == 'active') {
$this->addRegistered($page, $user->profile());
} else {
if (!User::isForeignEmailAddress($email)) {
$page->trigError('Email pas encore attribué : ' . $email);
$incomplete[] = $item;
$errors = true;
} else {
$this->addNonRegistered($page, $user);
if (!Marketing::get($user->id(), $email, true)) {
check_email($email, "Une adresse surveillée est proposée au marketing par " . S::user()->login());
$market = new Marketing($user->id(), $email, 'default', null, $origin, S::v('uid'), null);
$market->add();
}
}
}
}
}
}
$page->assign('errors', $errors);
$page->assign('incomplete', $incomplete);
}
示例10: handler_aaliases
function handler_aaliases($page, $alias = null)
{
global $globals;
require_once 'emails.inc.php';
$page->setTitle('Administration - Aliases');
if (Post::has('new_alias')) {
pl_redirect('admin/aliases/' . Post::t('new_alias') . '@' . $globals->mail->domain);
}
// If no alias, list them all.
if (is_null($alias)) {
$page->changeTpl('lists/admin_aliases.tpl');
$page->assign('aliases', array_merge(iterate_list_alias($globals->mail->domain), iterate_list_alias($globals->mail->domain2)));
return;
}
list($local_part, $domain) = explode('@', $alias);
if (!($globals->mail->domain == $domain || $globals->mail->domain2 == $domain) || !preg_match("/^[a-zA-Z0-9\\-\\.]*\$/", $local_part)) {
$page->trigErrorRedirect('Le nom de l\'alias est erroné.', $globals->asso('diminutif') . 'admin/aliases');
}
// Now we can perform the action.
if (Post::has('del_alias')) {
S::assert_xsrf_token();
delete_list_alias($local_part, $domain);
$page->trigSuccessRedirect($alias . ' supprimé.', 'admin/aliases');
}
if (Post::has('add_member')) {
S::assert_xsrf_token();
if (add_to_list_alias(Post::t('add_member'), $local_part, $domain)) {
$page->trigSuccess('Ajout réussit.');
} else {
$page->trigError('Ajout infructueux.');
}
}
if (Get::has('del_member')) {
S::assert_xsrf_token();
if (delete_from_list_alias(Get::t('del_member'), $local_part, $domain)) {
$page->trigSuccess('Suppression réussie.');
} else {
$page->trigError('Suppression infructueuse.');
}
}
$page->changeTpl('lists/admin_edit_alias.tpl');
$page->assign('members', list_alias_members($local_part, $domain));
$page->assign('alias', $alias);
}
示例11: action_updateProfile
protected function action_updateProfile()
{
global $globals;
$page =& Platal::page();
$colors = glob(dirname(__FILE__) . '/../../htdocs/images/banana/m2*.gif');
foreach ($colors as $key => $path) {
$path = basename($path, '.gif');
$colors[$key] = substr($path, 2);
}
$page->assign('colors', $colors);
if (Post::has('action') && Post::v('action') == 'Enregistrer') {
S::assert_xsrf_token();
$flags = new PlFlagSet();
if (Post::b('bananadisplay')) {
$flags->addFlag('threads');
}
if (Post::b('bananaupdate')) {
$flags->addFlag('automaj');
}
if (Post::b('bananaxface')) {
$flags->addFlag('xface');
}
$unread = Post::s('unread');
$read = Post::s('read');
if (!in_array($unread, $colors) || !in_array($read, $colors)) {
$page->trigError('Le choix de type pour l\'arborescence est invalide');
} else {
$last_seen = XDB::query('SELECT last_seen
FROM forum_profiles
WHERE uid = {?}', $this->user->id());
if ($last_seen->numRows() > 0) {
$last_seen = $last_seen->fetchOneCell();
} else {
$last_seen = '0000-00-00';
}
XDB::execute('INSERT INTO forum_profiles (uid, sig, mail, name, flags, tree_unread, tree_read, last_seen)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})
ON DUPLICATE KEY UPDATE sig = VALUES(sig), mail = VALUES(mail), name = VALUES(name), flags = VALUES(flags),
tree_unread = VALUES(tree_unread), tree_read = VALUES(tree_read), last_seen = VALUES(last_seen)', $this->user->id(), Post::v('bananasig'), Post::v('bananamail'), Post::v('banananame'), $flags, $unread, $read, $last_seen);
$page->trigSuccess('Ton profil a été mis à jour');
}
}
$infos = $this->fetchProfile();
$page->assign('nom', $infos['name']);
$page->assign('mail', $infos['mail']);
$page->assign('sig', $infos['sig']);
$page->assign('disp', $infos['threads']);
$page->assign('maj', $infos['maj']);
$page->assign('xface', $infos['xface']);
$page->assign('unread', $infos['tree_unread']);
$page->assign('read', $infos['tree_read']);
return null;
}
示例12: foreach
foreach (Post::val('groupsIds', array()) as $key => $value) {
$dbStorage->InsertAddressGroupContact($addressBookRecord->IdAddress, $value);
}
}
if (isset($_SESSION[SARRAY][SEARCH_ARRAY])) {
unset($_SESSION[SARRAY][SEARCH_ARRAY]);
}
SetReport(ReportContactSuccessfulyAdded);
} else {
SetError(PROC_CANT_INS_NEW_CONT);
}
} else {
if ($dbStorage->UpdateAddressBookRecord($addressBookRecord)) {
if ($addressBookRecord->IdAddress) {
$dbStorage->DeleteAddressGroupsContactsByIdAddress($addressBookRecord->IdAddress);
if (Post::has('groupsIds') && count(Post::val('groupsIds', array())) > 0) {
foreach (Post::val('groupsIds', array()) as $key => $value) {
$dbStorage->InsertAddressGroupContact($addressBookRecord->IdAddress, $value);
}
}
SetReport(ReportContactUpdatedSuccessfuly);
} else {
SetError(PROC_CANT_UPDATE_CONT);
}
} else {
SetError(PROC_CANT_UPDATE_CONT . "<br />\r\n" . getGlobalError());
}
}
} else {
SetError(getGlobalError());
}
示例13: handler_relance
function handler_relance($page)
{
$page->changeTpl('marketing/relance.tpl');
if (Post::has('relancer')) {
global $globals;
$nbdix = $globals->core->NbIns;
$sent = array();
$users = User::getBulkUsersWithUIDs($_POST['relance']);
foreach ($users as $user) {
if ($tmp = Marketing::relance($user, $nbdix)) {
$sent[] = $tmp . ' a été relancé.';
}
}
$page->assign('sent', $sent);
}
$page->assign('relance', XDB::iterator('SELECT r.date, r.relance, r.uid
FROM register_pending AS r
WHERE hash != \'INSCRIT\'
ORDER BY date DESC'));
}
示例14: die
// If someone used the 'show task' form, redirect them
if (is_numeric($show_task)) {
Flyspray::Redirect(CreateURL('details', $show_task));
} else {
Flyspray::Redirect($baseurl . '?string=' . $show_task);
}
}
if (Flyspray::requestDuplicated()) {
// Check that this page isn't being submitted twice
Flyspray::show_error(3);
}
# handle all forms request that modify data
if (Req::has('action')) {
# enforcing if the form sent the correct anti csrf token
# only allow token by post
if (!Post::has('csrftoken')) {
die('missingtoken');
} elseif (Post::val('csrftoken') == $_SESSION['csrftoken']) {
require_once BASEDIR . '/includes/modify.inc.php';
} else {
die('wrongtoken');
}
}
# start collecting infos for the answer page
if ($proj->id && $user->perms('manage_project')) {
// Find out if there are any PM requests wanting attention
$sql = $db->Query('SELECT COUNT(*) FROM {admin_requests} WHERE project_id = ? AND resolved_by = 0', array($proj->id));
list($count) = $db->fetchRow($sql);
$page->assign('pm_pendingreq_num', $count);
}
if ($user->perms('is_admin')) {
示例15: array
WHERE p.task_id = ? OR s.task_id = ?', array($task['task_id'], $task['task_id']));
$check = $db->fetchRow($result);
// if there are any subtasks or a parent, check that the project is not changed.
if ($check && $check['sub_id']) {
if ($check['project'] != Post::val('project_id')) {
Flyspray::show_error(L('movingtodifferentproject'));
break;
}
}
$time = time();
$result = $db->Query('SELECT * from {tasks} WHERE task_id = ?', array($task['task_id']));
$defaults = $db->fetchRow($result);
if (!Post::has('due_date')) {
$due_date = $defaults['due_date'];
}
if (!Post::has('estimated_effort')) {
$estimated_effort = $defaults['estimated_effort'];
}
$db->Query('UPDATE {tasks}
SET project_id = ?, task_type = ?, item_summary = ?,
detailed_desc = ?, item_status = ?, mark_private = ?,
product_category = ?, closedby_version = ?, operating_system = ?,
task_severity = ?, task_priority = ?, last_edited_by = ?,
last_edited_time = ?, due_date = ?, percent_complete = ?, product_version = ?,
estimated_effort = ?
WHERE task_id = ?', array(Post::val('project_id', $defaults['project_id']), Post::val('task_type', $defaults['task_type']), Post::val('item_summary', $defaults['item_summary']), Post::val('detailed_desc', $defaults['detailed_desc']), Post::val('item_status', $defaults['item_status']), intval($user->can_change_private($task) && Post::val('mark_private', $defaults['mark_private'])), Post::val('product_category', $defaults['product_category']), Post::val('closedby_version', $defaults['closedby_version']), Post::val('operating_system', $defaults['operating_system']), Post::val('task_severity', $defaults['task_severity']), Post::val('task_priority', $defaults['task_priority']), intval($user->id), $time, intval($due_date), Post::val('percent_complete', $defaults['percent_complete']), Post::val('reportedver', $defaults['product_version']), intval($estimated_effort), $task['task_id']));
// Update the list of users assigned this task
$assignees = (array) Post::val('rassigned_to');
$assignees_changed = count(array_diff($task['assigned_to'], $assignees)) + count(array_diff($assignees, $task['assigned_to']));
if ($user->perms('edit_assignments') && $assignees_changed) {
// Delete the current assignees for this task