X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile.php;h=8bf1ec103302035de2b8d447a3dbc5b8e851d74e;hb=b0da2aeab683ac315678817df92eac288ba263db;hp=af931716e9b5c527651c5bca7323db4c1e81ac2a;hpb=d8131af66ae5430930a21b036aa7e7fa9483ff91;p=platal.git diff --git a/modules/profile.php b/modules/profile.php index af93171..8bf1ec1 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -102,10 +102,10 @@ class ProfileModule extends PLModule // Display the photo, or a default one when not available. if ($photo_type && $photo_data != null) { - header('Content-type: image/' . $photo_type); + pl_cached_dynamic_content_headers("image/$photo_type"); echo $photo_data; } else { - header('Content-type: image/png'); + pl_cached_dynamic_content_headers("image/png"); echo file_get_contents(dirname(__FILE__).'/../htdocs/images/none.png'); } exit; @@ -123,8 +123,7 @@ class ProfileModule extends PLModule $img = $thumb ? dirname(__FILE__).'/../htdocs/images/medals/thumb/' . $res->fetchOneCell() : dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell(); - $type = mime_content_type($img); - header("Content-Type: $type"); + pl_cached_content_headers(mime_content_type($img)); echo file_get_contents($img); exit; } @@ -170,6 +169,7 @@ class ProfileModule extends PLModule WHERE user_id = {?} AND type="photo"', S::v('uid')); $globals->updateNbValid(); + $page->trigSuccess("Ta photo a bien été supprimée. Elle ne sera plus visible sur le site dans au plus une heure."); } elseif (Env::v('cancel')) { S::assert_xsrf_token(); @@ -331,8 +331,8 @@ class ProfileModule extends PLModule // Build the page $page->addJsLink('ajax.js'); - $page->addJsLink('applis.js'); - $page->addJsLink('grades.js'); + $page->addJsLink('applis.js', false /* dynamic content */); + $page->addJsLink('grades.js', false /* dynamic content */); $page->addJsLink('profile.js'); $page->addJsLink('jquery.autocomplete.js'); $wiz = new PlWizard('Profil', PlPage::getCoreTpl('plwizard.tpl'), true, true); @@ -363,22 +363,14 @@ class ProfileModule extends PLModule function handler_applis_js(&$page) { - header('Content-Type: text/javascript; charset=utf-8'); - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); - header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT'); - header('Cache-Control: no-cache, must-revalidate'); - header('Pragma: no-cache'); + pl_cached_content_headers("text/javascript", "utf-8"); $page->changeTpl('profile/applis.js.tpl', NO_SKIN); require_once "applis.func.inc.php"; } function handler_grades_js(&$page) { - header('Content-Type: text/javascript; charset=utf-8'); - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); - header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT'); - header('Cache-Control: no-cache, must-revalidate'); - header('Pragma: no-cache'); + pl_cached_content_headers("text/javascript", "utf-8"); $page->changeTpl('profile/grades.js.tpl', NO_SKIN); $res = XDB::iterator("SELECT * FROM profile_medals_grades @@ -401,7 +393,7 @@ class ProfileModule extends PLModule function handler_ajax_address(&$page, $adid) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('profile/adresses.address.tpl', NO_SKIN); $page->assign('i', $adid); $page->assign('adr', array()); @@ -409,7 +401,7 @@ class ProfileModule extends PLModule function handler_ajax_tel(&$page, $adid, $telid) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('profile/adresses.tel.tpl', NO_SKIN); $page->assign('i', $adid); $page->assign('adid', "addresses_$adid"); @@ -420,7 +412,7 @@ class ProfileModule extends PLModule function handler_ajax_medal(&$page, $id) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('profile/deco.medal.tpl', NO_SKIN); $page->assign('id', $id); $page->assign('medal', array('valid' => 0, 'grade' => 0)); @@ -428,7 +420,7 @@ class ProfileModule extends PLModule function handler_ajax_job(&$page, $id) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('profile/jobs.job.tpl', NO_SKIN); $page->assign('i', $id); $page->assign('job', array()); @@ -444,7 +436,7 @@ class ProfileModule extends PLModule function handler_ajax_secteur(&$page, $id, $sect, $ssect = -1) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $res = XDB::iterator("SELECT id, label FROM emploi_ss_secteur WHERE secteur = {?}", $sect); @@ -456,7 +448,7 @@ class ProfileModule extends PLModule function handler_ajax_skill(&$page, $cat, $id) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('profile/skill.skill.tpl', NO_SKIN); $page->assign('cat', $cat); $page->assign('id', $id); @@ -630,7 +622,7 @@ class ProfileModule extends PLModule function handler_ref_sect(&$page, $sect) { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('include/field.select.tpl', NO_SKIN); $page->assign('onchange', 'setSSecteurs()'); $page->assign('id', 'ssect_field'); @@ -643,7 +635,7 @@ class ProfileModule extends PLModule function handler_ref_country(&$page, $sect, $ssect = '') { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $page->changeTpl('include/field.select.tpl', NO_SKIN); $page->assign('name', 'pays_sel'); $where = ($ssect ? ' AND ms.ss_secteur = {?}' : ''); @@ -675,8 +667,7 @@ class ProfileModule extends PLModule $page->assign('usage_old', $usage_old); $page->assign('alias_old', $alias_old); - $nom_usage = replace_accent(trim(Env::v('nom_usage'))); - $nom_usage = strtoupper($nom_usage); + $nom_usage = mb_strtoupper(trim(Env::v('nom_usage'))); $page->assign('usage_req', $nom_usage); if (Env::has('submit') && ($nom_usage != $usage_old)) { @@ -708,9 +699,9 @@ class ProfileModule extends PLModule $req = XDB::query(' SELECT m.asso_id, a.nom, diminutif, a.logo IS NOT NULL AS has_logo, COUNT(e.eid) AS events, mail_domain AS lists - FROM groupex.membres AS m - INNER JOIN groupex.asso AS a ON(m.asso_id = a.id) - LEFT JOIN groupex.evenements AS e ON(e.asso_id = m.asso_id AND e.archive = 0) + FROM #groupex#.membres AS m + INNER JOIN #groupex#.asso AS a ON(m.asso_id = a.id) + LEFT JOIN #groupex#.evenements AS e ON(e.asso_id = m.asso_id AND e.archive = 0) WHERE uid = {?} GROUP BY m.asso_id ORDER BY a.nom', S::i('uid')); $page->assign('assos', $req->fetchAllAssoc()); } @@ -722,15 +713,15 @@ class ProfileModule extends PLModule } $res = XDB::query('SELECT logo, logo_mime - FROM groupex.asso + FROM #groupex#.asso WHERE id = {?}', $id); list($logo, $logo_mime) = $res->fetchOneRow(); if (!empty($logo)) { - header("Content-type: $mime"); + pl_cached_dynamic_content_headers($logo_mime); echo $logo; } else { - header('Content-type: image/jpeg'); + pl_cached_dynamic_content_headers("image/jpeg"); readfile(dirname(__FILE__) . '/../htdocs/images/dflt_carre.jpg'); } @@ -766,10 +757,9 @@ class ProfileModule extends PLModule switch ($action) { case "original": - header("Content-type: image/jpeg"); + pl_cached_content_headers("image/jpeg"); readfile("/home/web/trombino/photos" . $user->promo() . "/" . $user->login() . ".jpg"); exit; - break; case "new": S::assert_xsrf_token();