From: Stéphane Jacob Date: Tue, 21 Jul 2009 13:49:45 +0000 (+0200) Subject: Merge commit 'origin/fusionax' into account X-Git-Tag: xorg/1.0.0~332^2~335 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d1e6167749fdad08c81e23d09e1bbbf76e3b989b;p=platal.git Merge commit 'origin/fusionax' into account --- d1e6167749fdad08c81e23d09e1bbbf76e3b989b diff --cc classes/user.php index c533bd1,edd030a..71b21c9 --- a/classes/user.php +++ b/classes/user.php @@@ -21,9 -21,9 +21,12 @@@ class User extends PlUser { + private $_profile_fetched = false; + private $_profile = null; + + // Additional fields (non core) + protected $promo = null; + // Implementation of the login to uid method. protected function getLogin($login) { diff --cc classes/xorgsession.php index f757337,0e55c97..d61c69d --- a/classes/xorgsession.php +++ b/classes/xorgsession.php @@@ -191,24 -206,21 +191,28 @@@ class XorgSession extends PlSessio } // Retrieves main user properties. - $res = XDB::query("SELECT u.user_id AS uid, u.hruid, prenom, prenom_ini, nom, nom_ini, nom_usage, perms, promo, promo_sortie, - matricule, password, FIND_IN_SET('femme', u.flags) AS femme, - q.core_mail_fmt AS mail_fmt, UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last, q.core_rss_hash, - FIND_IN_SET('watch', u.flags) AS watch_account, q.last_version, g.g_account_name IS NOT NULL AS googleapps, - UNIX_TIMESTAMP(s.start) AS lastlogin, s.host - FROM auth_user_md5 AS u - INNER JOIN auth_user_quick AS q USING(user_id) - LEFT JOIN gapps_accounts AS g ON (u.user_id = g.l_userid AND g.g_status = 'active') - LEFT JOIN logger.last_sessions AS ls ON (ls.uid = u.user_id) + /** TODO: Move needed informations to account tables */ + /** TODO: Currently suppressed data are matricule, promo */ + /** TODO: Use the User object to fetch all this */ + $res = XDB::query("SELECT a.uid, a.hruid, a.display_name, a.full_name, + a.sex = 'female' AS femme, a.email_format, + a.token, FIND_IN_SET('watch', a.flags) AS watch_account, + UNIX_TIMESTAMP(fp.last_seen) AS banana_last, UNIX_TIMESTAMP(w.last) AS watch_last, + a.last_version, g.g_account_name IS NOT NULL AS googleapps, + UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, + a.is_admin, at.perms + FROM accounts AS a + INNER JOIN account_types AS at ON(a.type = at.type) + INNER JOIN watch AS w ON(w.uid = a.uid) + LEFT JOIN forum_profiles AS fp ON(fp.uid = a.uid) + LEFT JOIN gapps_accounts AS g ON(a.uid = g.l_userid AND g.g_status = 'active') + LEFT JOIN logger.last_sessions AS ls ON (ls.uid = a.uid) LEFT JOIN logger.sessions AS s ON(s.id = ls.id) - WHERE a.uid = {?} AND a.state = 'active'", $user->id()); - WHERE u.user_id = {?} AND u.perms IN('admin', 'user')", $uid); ++ WHERE a.uid = {?} AND u.perms IN('admin', 'user')", $user->id()); + if ($res->numRows() != 1) { + return false; + } + $sess = $res->fetchOneAssoc(); $perms = $sess['perms']; unset($sess['perms']); diff --cc modules/admin.php index 1caaa6c,775d4ff..37bb102 --- a/modules/admin.php +++ b/modules/admin.php @@@ -24,33 -24,31 +24,33 @@@ class AdminModule extends PLModul function handlers() { return array( - 'phpinfo' => $this->make_hook('phpinfo', AUTH_MDP, 'admin'), - 'get_rights' => $this->make_hook('get_rights', AUTH_MDP, 'admin'), - 'admin' => $this->make_hook('default', AUTH_MDP, 'admin'), - 'admin/ax-xorg' => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'), - 'admin/dead-but-active' => $this->make_hook('dead_but_active', AUTH_MDP, 'admin'), - 'admin/deaths' => $this->make_hook('deaths', AUTH_MDP, 'admin'), - 'admin/downtime' => $this->make_hook('downtime', AUTH_MDP, 'admin'), - 'admin/homonyms' => $this->make_hook('homonyms', AUTH_MDP, 'admin'), - 'admin/logger' => $this->make_hook('logger', AUTH_MDP, 'admin'), - 'admin/logger/actions' => $this->make_hook('logger_actions', AUTH_MDP, 'admin'), - 'admin/postfix/blacklist' => $this->make_hook('postfix_blacklist', AUTH_MDP, 'admin'), - 'admin/postfix/delayed' => $this->make_hook('postfix_delayed', AUTH_MDP, 'admin'), + 'phpinfo' => $this->make_hook('phpinfo', AUTH_MDP, 'admin'), ++ 'get_rights' => $this->make_hook('get_rights', AUTH_MDP, 'admin'), + 'admin' => $this->make_hook('default', AUTH_MDP, 'admin'), + 'admin/ax-xorg' => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'), + 'admin/dead-but-active' => $this->make_hook('dead_but_active', AUTH_MDP, 'admin'), + 'admin/deaths' => $this->make_hook('deaths', AUTH_MDP, 'admin'), + 'admin/downtime' => $this->make_hook('downtime', AUTH_MDP, 'admin'), + 'admin/homonyms' => $this->make_hook('homonyms', AUTH_MDP, 'admin'), + 'admin/logger' => $this->make_hook('logger', AUTH_MDP, 'admin'), + 'admin/logger/actions' => $this->make_hook('logger_actions', AUTH_MDP, 'admin'), + 'admin/postfix/blacklist' => $this->make_hook('postfix_blacklist', AUTH_MDP, 'admin'), + 'admin/postfix/delayed' => $this->make_hook('postfix_delayed', AUTH_MDP, 'admin'), 'admin/postfix/regexp_bounces' => $this->make_hook('postfix_regexpsbounces', AUTH_MDP, 'admin'), - 'admin/postfix/whitelist' => $this->make_hook('postfix_whitelist', AUTH_MDP, 'admin'), - 'admin/mx/broken' => $this->make_hook('mx_broken', AUTH_MDP, 'admin'), - 'admin/skins' => $this->make_hook('skins', AUTH_MDP, 'admin'), - 'admin/synchro_ax' => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'), - 'admin/user' => $this->make_hook('user', AUTH_MDP, 'admin'), - 'admin/promo' => $this->make_hook('promo', AUTH_MDP, 'admin'), - 'admin/validate' => $this->make_hook('validate', AUTH_MDP, 'admin'), - 'admin/validate/answers' => $this->make_hook('validate_answers', AUTH_MDP, 'admin'), - 'admin/wiki' => $this->make_hook('wiki', AUTH_MDP, 'admin'), - 'admin/ipwatch' => $this->make_hook('ipwatch', AUTH_MDP, 'admin'), - 'admin/icons' => $this->make_hook('icons', AUTH_MDP, 'admin'), - 'admin/accounts' => $this->make_hook('accounts', AUTH_MDP, 'admin'), - 'admin/account/types' => $this->make_hook('account_types', AUTH_MDP, 'admin'), - 'admin/jobs' => $this->make_hook('jobs', AUTH_MDP, 'admin'), + 'admin/postfix/whitelist' => $this->make_hook('postfix_whitelist', AUTH_MDP, 'admin'), + 'admin/mx/broken' => $this->make_hook('mx_broken', AUTH_MDP, 'admin'), + 'admin/skins' => $this->make_hook('skins', AUTH_MDP, 'admin'), + 'admin/synchro_ax' => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'), + 'admin/user' => $this->make_hook('user', AUTH_MDP, 'admin'), + 'admin/promo' => $this->make_hook('promo', AUTH_MDP, 'admin'), + 'admin/validate' => $this->make_hook('validate', AUTH_MDP, 'admin'), + 'admin/validate/answers' => $this->make_hook('validate_answers', AUTH_MDP, 'admin'), + 'admin/wiki' => $this->make_hook('wiki', AUTH_MDP, 'admin'), + 'admin/ipwatch' => $this->make_hook('ipwatch', AUTH_MDP, 'admin'), + 'admin/icons' => $this->make_hook('icons', AUTH_MDP, 'admin'), + 'admin/accounts' => $this->make_hook('accounts', AUTH_MDP, 'admin'), ++ 'admin/account/types' => $this->make_hook('account_types', AUTH_MDP, 'admin'), + 'admin/jobs' => $this->make_hook('jobs', AUTH_MDP, 'admin'), ); } diff --cc modules/auth.php index 4599ab2,424361c..5376034 --- a/modules/auth.php +++ b/modules/auth.php @@@ -131,9 -146,9 +128,9 @@@ class AuthModule extends PLModul } $gpex_challenge = $_GET["challenge"]; - // mise à jour de l'heure et de la machine de dernier login sauf quand on est en suid + // Update the last login information (unless the user is in SUID). $uid = S::i('uid'); - if (!isset($_SESSION['suid'])) { + if (!S::suid()) { global $platal; S::logger($uid)->log('connexion_auth_ext', $platal->path); } diff --cc modules/auth/auth.inc.php index c158ff2,c2b5737..6febc2c --- a/modules/auth/auth.inc.php +++ b/modules/auth/auth.inc.php @@@ -74,11 -66,9 +74,11 @@@ function gpex_make($chlg, $privkey, $da $perms = $res->fetchOneCell(); } else { // if no group asked, return main rights - $perms = S::has_perms() ? 'admin' : 'membre'; + $perms = S::admin() ? 'admin' : 'membre'; } $params .= gpex_prepare_param($val, $perms, $tohash, $charset); + } else { + $params .= gpex_prepare_param($val, '', $tohash, $charset); } } $tohash .= "1"; diff --cc modules/axletter.php index 91d96f0,b1f3a86..1d695fd --- a/modules/axletter.php +++ b/modules/axletter.php @@@ -329,12 -343,39 +335,12 @@@ class AXLetterModule extends PLModul } } } - $email = $line[$field]; - if (strpos($email, '@') === false) { - $user = $email; - $domain = $globals->mail->domain2; - } else { - list($user, $domain) = explode('@', $email); - } - if ($domain != $globals->mail->domain && $domain != $globals->mail->domain2 - && $domain != $globals->mail->alias_dom && $domain != $globals->mail->alias_dom2) { - $res = XDB::query("SELECT uid FROM emails WHERE email = {?}", $email); - if ($res->numRows() == 1) { - return $res->fetchOneCell(); - } - return '0'; - } - list($user) = explode('+', $user); - list($user) = explode('_', $user); - if ($domain == $globals->mail->alias_dom || $domain == $globals->mail->alias_dom2) { - $res = XDB::query("SELECT a.id - FROM virtual AS v - INNER JOIN virtual_redirect AS r USING(vid) - INNER JOIN aliases AS a ON (a.type = 'a_vie' - AND r.redirect = CONCAT(a.alias, '@{$globals->mail->domain2}')) - WHERE v.alias = CONCAT({?}, '@{$globals->mail->alias_dom}')", $user); - $id = $res->fetchOneCell(); - return $id ? $id : '0'; - } - $res = XDB::query("SELECT id FROM aliases WHERE alias = {?}", $user); - $id = $res->fetchOneCell(); - return $id ? $id : '0'; + $uf = new UserFilter(new UFC_Email($line[$field])); + $id = $uf->getUIDs(); + return count($id) == 1 ? $id[0] : 0; } - function createHash($line, $partial_result, $key) + function createHash($line, $key, $relation) { $hash = implode(time(), $line) . rand(); $hash = md5($hash); diff --cc modules/events.php index 0a16d14,e49dc70..6cd7771 --- a/modules/events.php +++ b/modules/events.php @@@ -106,36 -106,26 +106,27 @@@ class EventsModule extends PLModul $page->addJsLink('ajax.js'); $page->assign('tips', $this->get_tips()); - // Profile update (appears when profile is > 400d old), and birthday - // oneboxes. + // Adds a reminder onebox to the page. $user = S::user(); + require_once 'reminder.inc.php'; + if (($reminder = Reminder::GetCandidateReminder($user))) { + $reminder->Prepare($page); + } + + // Wishes "Happy birthday" when required - $res = XDB::query( - 'SELECT MONTH(naissance) = MONTH(NOW()) - AND DAYOFMONTH(naissance) = DAYOFMONTH(NOW()) AS is_birthday - FROM auth_user_md5 - WHERE user_id = {?}', - $user->id()); - $page->assign('birthday', $res->fetchOneCell()); + $profile = $user->profile(); + if (!is_null($profile)) { - if (strtotime($profile->last_change) < time() - (400 * 86400)) { - $page->assign('fiche_incitation', $profile->last_change); - } + if ($profile->next_birthday == date('Y-m-d')) { + $birthyear = (int)date('Y', strtotime($profile->birthdate)); + $curyear = (int)date('Y'); + $page->assign('birthday', $curyear - $birthyear); + } + } - // No-photo onebox. - $res = XDB::query("SELECT COUNT(*) - FROM photo - WHERE uid = {?}", - S::user()->id()); - $page->assign('photo_incitation', $res->fetchOneCell() == 0); - - // Geo-location onebox. - require_once "geocoding.inc.php"; - $page->assign('geoloc_incitation', Geocoder::countNonGeocoded(S::user()->id())); - // Direct link to the RSS feed, when available. - if (S::rssActivated()) { + if (S::hasAuthToken()) { $page->setRssLink('Polytechnique.org :: News', - '/rss/'.S::v('hruid') .'/'.S::v('core_rss_hash').'/rss.xml'); + '/rss/'.S::v('hruid') .'/'.S::v('token').'/rss.xml'); } // Hide the read event, and reload the page to get to the next event. diff --cc modules/payment.php index 9324e08,8f1cd61..13c853c --- a/modules/payment.php +++ b/modules/payment.php @@@ -213,15 -217,18 +213,16 @@@ class PaymentModule extends PLModul } /* on fait l'insertion en base de donnees */ - XDB::execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle,comment) - VALUES ({?},{?},{?},{?},{?},{?},{?})", - $champ901, $uid, $ref, $champ200, $montant, $champ905,Env::v('comment')); + XDB::execute("INSERT INTO paiement.transactions (id, uid, ref, fullref, montant, cle, comment) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})", + $champ901, $user->id(), $ref, $champ200, $montant, $champ905, Env::v('comment')); /* on genere le mail de confirmation */ - $conf_text = str_replace(array('', '', '', '', '', ''), - array($user->firstName(), $user->lastName(), $user->promo(), $montant, - $user->isFemale() ? 'Chère' : 'Cher', - $user->isFemale() ? 'Chère' : 'Cher'), $conf_text); - $conf_text = str_replace("",$prenom,$conf_text); - $conf_text = str_replace("",$nom,$conf_text); - $conf_text = str_replace("",$promo,$conf_text); - $conf_text = str_replace("",$montant,$conf_text); - $conf_text = str_replace("", Env::v('comment'), $conf_text); - $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); - $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); ++ $conf_text = str_replace( ++ array('', '', '', '', '', '', 'comment>'), ++ array($user->firstName(), $user->lastName(), $user->promo(), $montant, ++ $user->isFemale() ? 'Chère' : 'Cher', $user->isFemale() ? 'Chère' : 'Cher', ++ Env::v('comment')), $conf_text); global $globals; $mymail = new PlMailer(); diff --cc modules/profile.php index abfbefa,298d49c..38e6dc8 --- a/modules/profile.php +++ b/modules/profile.php @@@ -333,13 -339,18 +332,13 @@@ class ProfileModule extends PLModul if (!$user) { return PL_NOT_FOUND; } - - $res = XDB::query("SELECT matricule_ax - FROM auth_user_md5 - WHERE user_id = {?}", $user->id()); - $mat = $res->fetchOneCell(); - if (!intval($mat)) { - $page->kill("Le matricule AX de {$user->login()} est inconnu"); + if (!$user->ax_id) { + $page->kill("Le matricule AX de {$user->hrid()} est inconnu"); } - http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=$mat"); + http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=" . $user->ax_id); } - function handler_p_edit(&$page, $user = null, $opened_tab = null, $mode = null) - function handler_p_edit(&$page, $opened_tab = null, $mode = null, $success = null) ++ function handler_p_edit(&$page, $user = null, $opened_tab = null, $mode = null, $success = null) { global $globals; diff --cc modules/profile/general.inc.php index 9856dc8,708c2dc..4884303 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@@ -81,16 -81,16 +82,18 @@@ class ProfileSearchNames implements Pro while ($sn_type = $sn_types->next()) { if ($sn_type['id'] == $sn['typeid']) { $value[] = $sn; - $sn = $sn_all->next(); + if ($sn) { + $sn = $sn_all->next(); + } } else { - $value[] = array('typeid' => $sn_type['id'], - 'type' => $sn_type['type'], - 'type_name' => $sn_type['name'], - 'pub' => 1, + $value[] = array('name' => '', + 'particle' => '', + 'typeid' => $sn_type['id'], + 'type' => $sn_type['type'], + 'type_name' => $sn_type['name'], 'has_particle' => $sn_type['has_particle'], - 'always_displayed' => 1); + 'always_displayed' => 1, + 'pub' => 1); } } if ($sn) { @@@ -387,20 -397,19 +389,20 @@@ class ProfileGeneral extends ProfilePag { // Checkout all data... $res = XDB::query("SELECT p.promo, e.entry_year AS entry_year, e.grad_year AS grad_year, - u.nationalite, u.nationalite2, u.nationalite3, u.naissance, + pr.nationality1, pr.nationality2, pr.nationality3, pr.birthdate, t.display_tel as mobile, t.pub as mobile_pub, d.email_directory as email_directory, - pr.freetext, pr.freetext_pub as freetext_pub - q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub, - u.matricule_ax, p.yourself - FROM auth_user_md5 AS u - INNER JOIN auth_user_quick AS q ON (u.user_id = q.user_id) - INNER JOIN profile_display AS p ON (p.pid = u.user_id) - INNER JOIN profile_education AS e ON (e.uid = u.user_id AND FIND_IN_SET('primary', e.flags)) - LEFT JOIN profile_phones AS t ON (u.user_id = t.uid AND link_type = 'user') - LEFT JOIN profile_directory AS d ON (d.uid = u.user_id) - WHERE u.user_id = {?}", S::v('uid', -1)); ++ pr.freetext, pr.freetext_pub, pr.ax_id AS matricule_ax, p.yourself + FROM profiles AS pr + INNER JOIN profile_display AS p ON (p.pid = pr.pid) + INNER JOIN profile_education AS e ON (e.uid = pr.pid AND FIND_IN_SET('primary', e.flags)) + LEFT JOIN profile_phones AS t ON (t.uid = pr.pid AND link_type = 'user') + LEFT JOIN profile_directory AS d ON (d.uid = pr.pid) + WHERE pr.pid = {?}", $this->pid()); $this->values = $res->fetchOneAssoc(); + if ($this->owner) { + $this->values['yourself'] = $this->owner->displayName(); + } // Retreive photo informations $res = XDB::query("SELECT pub @@@ -428,29 -433,33 +430,28 @@@ protected function _saveData() { - if ($this->changed['nationalite'] || $this->changed['nationalite2'] || $this->changed['nationalite3'] - || $this->changed['naissance']) { - if ($this->values['nationalite3'] == "") { - $this->values['nationalite3'] = NULL; + if ($this->changed['nationality1'] || $this->changed['nationality2'] || $this->changed['nationality3'] + || $this->changed['birthdate'] || $this->changed['freetext'] || $this->changed['freetext_pub']) { + if ($this->values['nationality3'] == "") { + $this->values['nationality3'] = NULL; } - if ($this->values['nationalite2'] == "") { - $this->values['nationalite2'] = $this->values['nationalite3']; - $this->values['nationalite3'] = NULL; + if ($this->values['nationality2'] == "") { + $this->values['nationality2'] = $this->values['nationality3']; + $this->values['nationality3'] = NULL; } - if ($this->values['nationalite'] == "") { - $this->values['nationalite'] = $this->values['nationalite2']; - $this->values['nationalite2'] = $this->values['nationalite3']; - $this->values['nationalite3'] = NULL; + if ($this->values['nationality1'] == "") { + $this->values['nationality1'] = $this->values['nationality2']; + $this->values['nationality2'] = $this->values['nationality3']; + $this->values['nationality3'] = NULL; } - XDB::execute("UPDATE auth_user_md5 - SET nationalite = {?}, nationalite2 = {?}, nationalite3 = {?}, naissance={?} - WHERE user_id = {?}", - $this->values['nationalite'], $this->values['nationalite2'], $this->values['nationalite3'], - preg_replace('@(\d{2})/(\d{2})/(\d{4})@', '\3-\2-\1', $this->values['naissance']), - S::v('uid')); - } - if ($this->changed['freetext'] || $this->changed['freetext_pub']) { - XDB::execute("UPDATE auth_user_quick - SET profile_freetext={?}, profile_freetext_pub={?} - WHERE user_id = {?}", - $this->values['freetext'], $this->values['freetext_pub'], S::v('uid')); + XDB::execute("UPDATE profiles + SET nationality1 = {?}, nationality2 = {?}, nationality3 = {?}, birthdate = {?}, + freetext = {?}, freetext_pub = {?} - WHERE user_id = {?}", ++ WHERE pid = {?}", + $this->values['nationality1'], $this->values['nationality2'], $this->values['nationality3'], + preg_replace('@(\d{2})/(\d{2})/(\d{4})@', '\3-\2-\1', $this->values['birthdate']), - $this->values['freetext'], $this->values['freetext_pub'], - $this->pid()); ++ $this->values['freetext'], $this->values['freetext_pub'], $this->pid()); } if ($this->changed['email_directory']) { $new_email = ($this->values['email_directory'] == "new@example.org") ? diff --cc modules/profile/jobs.inc.php index 424de8e,c376f12..18a8f6a --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@@ -227,99 -303,150 +303,150 @@@ class ProfileJobs extends ProfilePag LEFT JOIN profile_addresses AS ah ON (ah.jobid = j.jobid AND ah.type = 'hq') WHERE j.uid = {?} ORDER BY j.id", - S::i('uid')); + $this->pid()); $this->values['jobs'] = array(); - while (list($id, $jobid, $name, $sector, $subSector, $subSubSector, - $subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub, - $hq_acronym, $hq_url, $hq_email, - $w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId, - $w_subAdministrativeAreaId, $w_administrativeAreaId, $w_countryId, - $w_latitude, $w_longitude, $w_pub, $w_updateTime, - $w_north, $w_south, $w_east, $w_west, - $hq_accuracy, $hq_text, $hq_postalText, $hq_postalCode, $hq_localityId, - $hq_subAdministrativeAreaId, $hq_administrativeAreaId, $hq_countryId, - $hq_latitude, $hq_longitude, $hq_pub, $hq_updateTime, - $hq_north, $hq_south, $hq_east, $hq_west, - ) = $res->next()) { - $this->values['jobs'][] = array('id' => $id, - 'jobid' => $jobid, - 'name' => $name, - 'sector' => $sector, - 'subSector' => $subSector, - 'subSubSector' => $subSubSector, - 'subSubSectorName' => $subSubSectorName, - 'description' => $description, - 'pub' => $pub, - 'w_email' => $w_email, - 'w_email_pub' => $w_email_pub, - 'w_url' => $w_url, - 'hq_acronym' => $hq_acronym, - 'hq_url' => $hq_url, - 'hq_email' => $hq_email, - 'w_address' => array('accuracy' => $w_accuracy, - 'text' => $w_text, - 'postalText' => $w_postalText, - 'postalCode' => $w_postalCode, - 'localityId' => $w_localityId, - 'subAdministrativeAreaId' => $w_subAdministrativeAreaId, - 'administrativeAreaId' => $w_administrativeAreaId, - 'countryId' => $w_countryId, - 'latitude' => $w_latitude, - 'longitude' => $w_longitude, - 'pub' => $w_pub, - 'updateTime' => $w_update, - 'north' => $w_north, - 'south' => $w_south, - 'east' => $w_east, - 'west' => $w_west, - ), - 'hq_address' => array('accuracy' => $hq_accuracy, - 'text' => $hq_text, - 'postalText' => $hq_postalText, - 'postalCode' => $hq_postalCode, - 'localityId' => $hq_localityId, - 'subAdministrativeAreaId' => $hq_subAdministrativeAreaId, - 'administrativeAreaId' => $hq_administrativeAreaId, - 'countryId' => $hq_countryId, - 'latitude' => $hq_latitude, - 'longitude' => $hq_longitude, - 'pub' => $hq_pub, - 'updateTime' => $hq_update, - 'north' => $hq_north, - 'south' => $hq_south, - 'east' => $hq_east, - 'west' => $hq_west, - ), - ); - } - $res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment - FROM profile_phones - WHERE uid = {?} AND link_type = 'pro' - ORDER BY link_id", - $this->pid()); - $i = 0; - $jobNb = count($this->values['jobs']); - while ($phone = $res->next()) { - $jobid = $phone['jobid']; - while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) { - $i++; + if ($res->numRows() > 0) { + while (list($id, $jobid, $name, $sector, $subSector, $subSubSector, + $subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub, + $hq_acronym, $hq_url, $hq_email, + $w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId, + $w_subAdministrativeAreaId, $w_administrativeAreaId, $w_countryId, + $w_latitude, $w_longitude, $w_pub, $w_updateTime, + $w_north, $w_south, $w_east, $w_west, + $hq_accuracy, $hq_text, $hq_postalText, $hq_postalCode, $hq_localityId, + $hq_subAdministrativeAreaId, $hq_administrativeAreaId, $hq_countryId, + $hq_latitude, $hq_longitude, $hq_pub, $hq_updateTime, + $hq_north, $hq_south, $hq_east, $hq_west, + ) = $res->next()) { + $this->values['jobs'][] = array( + 'id' => $id, + 'jobid' => $jobid, + 'name' => $name, + 'sector' => $sector, + 'subSector' => $subSector, + 'subSubSector' => $subSubSector, + 'subSubSectorName' => $subSubSectorName, + 'description' => $description, + 'pub' => $pub, + 'w_email' => $w_email, + 'w_email_pub' => $w_emailPub, + 'w_url' => $w_url, + 'hq_acronym' => $hq_acronym, + 'hq_url' => $hq_url, + 'hq_email' => $hq_email, + 'w_address' => array( + 'accuracy' => $w_accuracy, + 'text' => $w_text, + 'postalText' => $w_postalText, + 'postalCode' => $w_postalCode, + 'localityId' => $w_localityId, + 'subAdministrativeAreaId' => $w_subAdministrativeAreaId, + 'administrativeAreaId' => $w_administrativeAreaId, + 'countryId' => $w_countryId, + 'latitude' => $w_latitude, + 'longitude' => $w_longitude, + 'pub' => $w_pub, + 'updateTime' => $w_updateTime, + 'north' => $w_north, + 'south' => $w_south, + 'east' => $w_east, + 'west' => $w_west, + ), + 'hq_address' => array( + 'accuracy' => $hq_accuracy, + 'text' => $hq_text, + 'postalText' => $hq_postalText, + 'postalCode' => $hq_postalCode, + 'localityId' => $hq_localityId, + 'subAdministrativeAreaId' => $hq_subAdministrativeAreaId, + 'administrativeAreaId' => $hq_administrativeAreaId, + 'countryId' => $hq_countryId, + 'latitude' => $hq_latitude, + 'longitude' => $hq_longitude, + 'pub' => $hq_pub, + 'updateTime' => $hq_updateTime, + 'north' => $hq_north, + 'south' => $hq_south, + 'east' => $hq_east, + 'west' => $hq_west, + ), + ); + } + + $res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment + FROM profile_phones + WHERE uid = {?} AND link_type = 'pro' + ORDER BY link_id", + S::i('uid')); + $i = 0; + $jobNb = count($this->values['jobs']); + while ($phone = $res->next()) { + $jobid = $phone['jobid']; + while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) { + $i++; + } + if ($i >= $jobNb) { + break; + } + $job =& $this->values['jobs'][$i]; + if (!isset($job['w_phone'])) { + $job['w_phone'] = array(); + } + if ($job['id'] == $jobid) { + $job['w_phone'][] = $phone; + } } - if ($i >= $jobNb) { - break; + foreach ($this->values['jobs'] as $id => &$job) { + if (!isset($job['w_phone'])) { + $job['w_phone'] = array( + 0 => array( + 'type' => 'fixed', + 'tel' => '', + 'pub' => 'private', + 'comment' => '', + ) + ); + } } - $job =& $this->values['jobs'][$i]; - if (!isset($job['w_phone'])) { - $job['w_phone'] = array(); + + $job['w_email_new'] = ''; + if (!isset($job['hq_phone'])) { + $job['hq_phone'] = ''; } - if ($job['id'] == $jobid) { - $job['w_phone'][] = $phone; + if (!isset($job['hq_fax'])) { + $job['hq_fax'] = ''; } - } - foreach ($this->values['jobs'] as $id => &$job) { - if (!isset($job['w_phone'])) { - $job['w_phone'] = array(); + if (!isset($job['w_email_pub'])) { + $job['w_email_pub'] = 'private'; } + if (!$job['hq_address']['text']) { + $job['hq_address'] = array( + 'text' => '', + 'accuracy' => '', + 'postalText' => '', + 'postalCode' => '', + 'administrativeAreaId' => '', + 'subAdministrativeAreaId' => '', + 'localityId' => '', + 'countryId' => '', + 'latitude' => '', + 'longitude' => '', + 'north' => '', + 'south' => '', + 'east' => '', + 'west' => '', + 'cedex' => '', + 'updateTime' => '', + 'changed' => '0', + 'removed' => '0', + ); + } + $job['w_address']['cedex'] = ''; + $job['w_address']['changed'] = '0'; + $job['w_address']['removed'] = '0'; + } else { + $this->values['jobs'][] = $this->settings['jobs']->emptyJob(); } } diff --cc modules/register.php index ba1ab62,3668521..7a64e32 --- a/modules/register.php +++ b/modules/register.php @@@ -320,15 -342,18 +342,18 @@@ class RegisterModule extends PLModul register_watch_op($uid, WATCH_INSCR); inscription_notifs_base($uid); - // Default registration on forums - $p_for = 'xorg.promo.x' . $promo; - $cible = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $p_for); - foreach ($cible as $val) { - XDB::execute('INSERT INTO forum_subs (fid,uid) + // Forcibly register the new user on default forums. + $promo_forum = 'xorg.promo.x' . $promo; + $registered_forums = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $promo_forum); + foreach ($registered_forums as $forum) { + XDB::execute("INSERT INTO forums.abos (fid,uid) SELECT fid, {?} - FROM forum - WHERE name = {?}', $uid, $val); - if (XDB::affectedRows() == 0 && $val == $p_for) { - FROM forums.list ++ FROM forums.list + WHERE nom = {?}", + $uid, $val); + + // Notify the newsgroup admin of the promotion forum needs be created. + if (XDB::affectedRows() == 0 && $forum == $promo_forum) { $res = XDB::query("SELECT SUM(perms IN ('admin','user') AND deces = 0), COUNT(*) FROM auth_user_md5 WHERE promo = {?}", $promo); diff --cc modules/register/register.inc.php index 6ac78ad,5e153d7..4d220c6 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@@ -225,13 -229,13 +229,12 @@@ function finish_ins($sub_state { global $globals; extract($sub_state); - require_once('secure_hash.inc.php'); - $pass = rand_pass(); - $pass_encrypted = sha1($pass); - $hash = rand_url_id(12); - - XDB::execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', $email, $mat); - + $hash = rand_url_id(12); + XDB::execute( + "UPDATE auth_user_md5 + SET last_known_email = {?} + WHERE matricule = {?}", $email, $mat); XDB::execute( "REPLACE INTO register_pending (uid, forlife, bestalias, mailorg2, password, email, date, relance, naissance, hash) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?})", diff --cc modules/xnetgrp.php index 938a6a6,e6ebd1e..bb1cda1 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@@ -188,9 -238,9 +181,9 @@@ class XnetGrpModule extends PLModul } else { $site = ""; } - if (S::admin()) { + if (S::has_perms()) { - if (strstr(Post::v('mail_domain'), '.') === false) { - $page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!"); + if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) { - $page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!"); ++ $page->trigError("Le domaine doit être un FQDN (aucune modification effectuée) !!!"); return; } XDB::execute( diff --cc templates/admin/deces_promo.tpl index 5c8b4f2,1bef29b..64dee3a --- a/templates/admin/deces_promo.tpl +++ b/templates/admin/deces_promo.tpl @@@ -23,13 -23,23 +23,13 @@@
- +
- - - -
- - - Promotion : - + - - -
diff --cc templates/emails/broken.tpl index 283e10b,69eefeb..29ab6bc --- a/templates/emails/broken.tpl +++ b/templates/emails/broken.tpl @@@ -47,9 -47,9 +47,9 @@@ correspondant si tu veux que nous puiss clique sur ce lien.

{elseif $x} -

Patte Cassée

+

Patte cassée

- Désolé, mais ton correspondant, {$x.prenom} {$x.nom} (X{$x.promo}), + Désolé, mais ton correspondant, {$x.user->fullName()}, n'a actuellement aucune adresse email de redirection active autre que celle que tu viens de rentrer. Nous t'invitons à prendre contact avec lui autrement que par email, diff --cc templates/include/minifiche.tpl index 735b25e,fe39841..53f7d6b --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@@ -112,31 -105,28 +112,31 @@@ {/if}

- {if $c.wasinscrit || !$c.dcd} - {if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || $c.freetext || (!$c.dcd && !$c.actif )} + {if !$dead} + {assign var=address value=$profile->getMainAddress()} + {assign var=web value=$profile->getWebSite()} + {assign var=job value=$profile->getMailJob()} + {if $web || $profile->mobile || $address.country || $job || (!$dead && !$registered)} - {if $c.web} + {if $web} - + {/if} - {if $address.country} - {if ($c.countrytxt || $c.city) && !$c.dcd} ++ {if $address.country && !$c.dcd} - + {/if} - {if $c.mobile && !$c.dcd} + {if $profile->mobile && !$dead} - + {/if} - {if $c.entreprise} + {if $job} - - - -
Page web :{$c.web}{$web}
Géographie :{$c.city}{if $c.city && $c.countrytxt}, {/if}{$c.countrytxt}{if $address.locality}{$address.locality}, {/if}{$address.country}
Mobile :{$c.mobile}{$profile->mobile}
Profession : diff --cc templates/xnetgrp/annuaire.tpl index 5d60921,0e46aaa..9d0d235 --- a/templates/xnetgrp/annuaire.tpl +++ b/templates/xnetgrp/annuaire.tpl @@@ -41,8 -42,9 +42,9 @@@ Le groupe {$asso->nom} compte {$nb_tot {/if} + {/if}
  • - + {icon name=page_excel title="Fichier Excel"} Obtenir au format Excel diff --cc templates/xnetgrp/edit.tpl index 5f0277b,2c5765f..112026e --- a/templates/xnetgrp/edit.tpl +++ b/templates/xnetgrp/edit.tpl @@@ -163,18 -170,11 +170,11 @@@
  • - -
    Diffusion de la liste des membres :