public function prepare(PlPage $page, $id) { $wp = new PlWikiPage((@$GLOBALS['IS_XNET_SITE'] ? 'ReviewXnet' : 'Review') . '.' . ucfirst($id)); $wp->buildCache(); $page->assign('cacheExists', $wp->cacheFilename()); $page->assign('article', $wp->name); }
public static function prepare_map(PlPage $page) { global $globals; $page->changeTpl('geoloc/index.tpl'); $map_url = $globals->maps->dynamic_map . '?&sensor=false&v=' . $globals->maps->api_version . '&language=' . $globals->maps->language; $page->addJsLink($map_url, false); $page->addJsLink('maps.js'); $page->addJsLink('markerclusterer.js'); $page->assign('pl_extra_header', '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />'); }
public function force_login(PlPage $page) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); if (S::logged()) { $page->changeTpl('password_prompt_logged.tpl'); } else { $page->assign('title', 'Connexion'); $page->changeTpl('password_prompt.tpl'); } $page->assign_by_ref('platal', $this); $page->run(); }
function handler_ical(PlPage $page, PlUser $user) { require_once 'ical.inc.php'; $page->changeTpl('carnet/calendar.tpl', NO_SKIN); $page->register_function('display_ical', 'display_ical'); $filter = new UserFilter(new UFC_Contact($user)); $profiles = $filter->iterProfiles(); $page->assign('events', PlIteratorUtils::map($profiles, array($this, 'buildBirthRef'))); pl_cached_content_headers('text/calendar', 1); }
function handler_accounts(PlPage $page) { $page->changeTpl('admin/accounts.tpl'); $page->setTitle('Administration - Comptes'); if (Post::has('create_account')) { S::assert_xsrf_token(); $firstname = Post::t('firstname'); $lastname = mb_strtoupper(Post::t('lastname')); $sex = Post::s('sex'); $email = Post::t('email'); $type = Post::s('type'); if (!$type) { $page->trigError("Empty account type"); } elseif (!isvalid_email($email)) { $page->trigError("Invalid email address: {$email}"); } elseif (strlen(Post::s('pwhash')) != 40) { $page->trigError("Invalid password hash"); } else { $login = PlUser::makeHrid($firstname, $lastname, $type); $full_name = $firstname . ' ' . $lastname; $directory_name = $lastname . ' ' . $firstname; XDB::execute("INSERT INTO accounts (hruid, type, state, password,\n registration_date, email, full_name,\n display_name, sex, directory_name,\n lastname, firstname)\n VALUES ({?}, {?}, 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?})", $login, $type, Post::s('pwhash'), $email, $full_name, $full_name, $sex, $directory_name, $lastname, $firstname); } } $uf = new UserFilter(new UFC_AccountType('ax', 'school', 'fx')); $page->assign('users', $uf->iterUsers()); }
function fill_email_combobox(PlPage $page, array $retrieve, $user = null) { require_once 'emails.inc.php'; if (is_null($user)) { $user = S::user(); } /* Always refetch the profile. */ $profile = $user->profile(true); $emails = array(); if (in_array('source', $retrieve)) { $emails['Emails polytechniciens'] = XDB::fetchColumn('SELECT CONCAT(s.email, \'@\', d.name) FROM email_source_account AS s INNER JOIN email_virtual_domains AS m ON (s.domain = m.id) INNER JOIN email_virtual_domains AS d ON (d.aliasing = m.id) WHERE s.uid = {?} ORDER BY s.email, d.name', $user->id()); } if (in_array('redirect', $retrieve)) { $redirect = new Redirect($user); $emails['Redirections'] = array(); foreach ($redirect->emails as $redirect_it) { if ($redirect_it->is_redirection()) { $emails['Redirections'][] = $redirect_it->email; } } } if ($profile) { if (in_array('job', $retrieve)) { $emails['Emails professionels'] = XDB::fetchColumn('SELECT email FROM profile_job WHERE pid = {?} AND email IS NOT NULL AND email != \'\'', $profile->id()); } if ($profile->email_directory) { if (in_array('directory', $retrieve)) { foreach ($emails as &$email_list) { foreach ($email_list as $key => $email) { if ($profile->email_directory == $email) { unset($email_list[$key]); } } } $emails['Email annuaire AX'] = array($profile->email_directory); } elseif (in_array('stripped_directory', $retrieve)) { if (User::isForeignEmailAddress($profile->email_directory)) { $is_redirect = XDB::fetchOneCell('SELECT COUNT(*) FROM email_redirect_account WHERE uid = {?} AND redirect = {?}', $user->id(), $profile->email_directory); if ($is_redirect == 0) { $emails['Email annuaire AX'] = array($profile->email_directory); } } } } if (isset($emails['Emails professionels']) && isset($emails['Redirections'])) { $intersect = array_intersect($emails['Emails professionels'], $emails['Redirections']); foreach ($intersect as $key => $email) { unset($emails['Emails professionels'][$key]); } } } $emails_count = 0; foreach ($emails as $email_list) { $emails_count += count($email_list); } $page->assign('emails_count', $emails_count); $page->assign('email_lists', $emails); }
public function _prepare(PlPage $page, $id) { require_once "education.func.inc.php"; $res = XDB::query("SELECT id, field\n FROM profile_education_field_enum\n ORDER BY field"); $page->assign('edu_fields', $res->fetchAllAssoc()); require_once "emails.combobox.inc.php"; fill_email_combobox($page, array('source', 'redirect', 'job', 'directory'), $this->owner); $res = XDB::query("SELECT nw.nwid AS type, nw.name\n FROM profile_networking_enum AS nw\n ORDER BY name"); $page->assign('network_list', $res->fetchAllAssoc()); $page->assign('lastnames', array('main' => 'Nom patronymique', 'marital' => 'Nom marital', 'ordinary' => 'Nom usuel')); $page->assign('firstnames', array('firstname_main' => 'Prénom', 'firstname_ordinary' => 'Prénom usuel', 'pseudonym' => 'Pseudonyme (nom de plume)')); $page->assign('other_names', array('nickname' => 'Surnom', 'firstname' => 'Autre prénom', 'lastname' => 'Autre nom')); $page->assign('isFemale', $this->profile->isFemale() ? 1 : 0); }
public function apply(PlPage $page) { if (!empty($GLOBALS['IS_XNET_SITE'])) { global $globals; $page->assign('mainsiteurl', 'https://' . $globals->core->secure_domain . '/'); } $page->assign('full_count', $this->full_count); return parent::apply($page); }
public function _prepare(PlPage $page, $id) { $page->assign('mygroups', XDB::iterator("SELECT a.nom, a.site, a.diminutif, a.unsub_url, a.pub, m.perms\n FROM groups AS a\n INNER JOIN group_members AS m ON (m.asso_id = a.id)\n WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')", $this->owner->id())); $page->assign('listgroups', XDB::iterator("SELECT a.nom, a.diminutif, a.sub_url,\n IF (a.cat = 'Institutions', a.cat, d.nom) AS dom\n FROM groups AS a\n LEFT JOIN group_dom AS d ON (d.id = a.dom)\n WHERE a.inscriptible != 0\n AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')\n ORDER BY a.cat, a.dom, a.nom")); $page->assign('old', (int) date('Y') >= $this->profile->grad_year); }
public function _prepare(PlPage $page, $id) { $page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, country\n FROM geoloc_countries\n ORDER BY country")); $page->assign('hrpid', $this->profile->hrpid); $page->assign('comp_list', XDB::iterator("SELECT id, text_fr, FIND_IN_SET('titre',flags) AS title\n FROM profile_skill_enum")); $page->assign('comp_level', array('initié' => 'initié', 'bonne connaissance' => 'bonne connaissance', 'expert' => 'expert')); $page->assign('lang_list', XDB::iterator('SELECT iso_639_2b, language FROM profile_langskill_enum ORDER BY language')); $page->assign('lang_level', array(1 => 'connaissance basique', 2 => 'maîtrise des bases', 3 => 'maîtrise limitée', 4 => 'maîtrise générale', 5 => 'bonne maîtrise', 6 => 'maîtrise complète')); }
protected function prepareText(PlPage $page, array $user) { $page->assign('intro', $this->getIntro()); $page->assign('u', $user); $page->assign('sign', $this->getSignature()); $page->assign('personal_notes', $this->getPersonalNotes()); }
public function prepare(PlPage $page, $id) { if (count($this->values) == 0) { $this->fetchData(); } foreach ($this->values as $field => &$value) { $page->assign($field, $value); } $this->_prepare($page, $id); $page->assign('profile', $this->profile); $page->assign('owner', $this->owner); $page->assign('profile_page', $this->pg_template); $page->assign('errors', $this->errors); }
function handler_rss(PlPage $page, PlUser $user) { global $globals; $page->assign('asso', $globals->asso()); $this->load('feed.inc.php'); $feed = new XnetGrpEventFeed(); return $feed->run($page, $user, false); }
public function _prepare(PlPage $page, $id) { $res = XDB::iterator('SELECT *, FIND_IN_SET(\'validation\', flags) AS validate FROM profile_medal_enum ORDER BY type, text'); $mlist = array(); while ($tmp = $res->next()) { $mlist[$tmp['type']][] = $tmp; } $page->assign('medal_list', $mlist); $fullType = array('ordre' => 'Ordres', 'croix' => 'Croix', 'militaire' => 'Médailles militaires', 'honneur' => 'Médailles d\'honneur', 'resistance' => 'Médailles de la résistance', 'prix' => 'Prix', 'sport' => 'Médailles sportives'); $page->assign('fullType', $fullType); }
public function _prepare(PlPage $page, $id) { $page->assign('hrpid', $this->profile->hrpid); }