From 1c9e806972564bb9f4cd980fc7a796d2aa636c4a Mon Sep 17 00:00:00 2001 From: "TOMAHOST\\xes" Date: Thu, 14 Aug 2025 22:36:35 +0200 Subject: [PATCH] upgrade --- custompages/README.md | 24 ++++ custompages/first_login-dist.php | 118 ++++++++++++++++++++ custompages/images/footer.png | Bin 0 -> 2610 bytes custompages/images/header.png | Bin 0 -> 2627 bytes custompages/images/login-form-submit-bg.jpg | Bin 0 -> 862 bytes custompages/images/page-background.png | Bin 0 -> 4210 bytes custompages/index-logged-dist.php | 15 +++ custompages/index-unlogged-dist.php | 56 ++++++++++ custompages/language.inc.php | 53 +++++++++ custompages/language.php | 50 +++++++++ custompages/loggedout-dist.php | 54 +++++++++ custompages/lostpassword-dist.php | 23 ++++ custompages/registration-dist.php | 36 ++++++ custompages/registration-feedback-dist.php | 48 ++++++++ custompages/url-images/README | 5 + 15 files changed, 482 insertions(+) create mode 100644 custompages/README.md create mode 100644 custompages/first_login-dist.php create mode 100644 custompages/images/footer.png create mode 100644 custompages/images/header.png create mode 100644 custompages/images/login-form-submit-bg.jpg create mode 100644 custompages/images/page-background.png create mode 100644 custompages/index-logged-dist.php create mode 100644 custompages/index-unlogged-dist.php create mode 100644 custompages/language.inc.php create mode 100644 custompages/language.php create mode 100644 custompages/loggedout-dist.php create mode 100644 custompages/lostpassword-dist.php create mode 100644 custompages/registration-dist.php create mode 100644 custompages/registration-feedback-dist.php create mode 100644 custompages/url-images/README diff --git a/custompages/README.md b/custompages/README.md new file mode 100644 index 000000000..e0c2bea50 --- /dev/null +++ b/custompages/README.md @@ -0,0 +1,24 @@ +Custom pages +============= + +CustomPages looks for alternatives in this directory, and displays them if present. +The user-provided custom pages must exactly be named as such : + +- index-logged.php for the general landing page before login +- index-unlogged.php for the general landing page when already logged-in +- registration.php for the registration form +- registration-feedback.php for the registration success feedback +- lostpassword.php for the password recovery form + + +### Installation + +- Enable the use_custom_pages setting +- Create your own modifications based in the files with the suffix "-dist.php" + +### Important notes + +- Do not replace the images in the images/ directory. + Instead, create new images, as the current ones will be overwritten + by each Chamilo upgrade. + diff --git a/custompages/first_login-dist.php b/custompages/first_login-dist.php new file mode 100644 index 000000000..3e8909aaa --- /dev/null +++ b/custompages/first_login-dist.php @@ -0,0 +1,118 @@ + + + + + Custompage - login + + + + + +
+ +
+
+ +

+ +
+
+ '.$error_message.'
'; +}?> +
+
+ +
+ +
+
+
+
+ +
+
+ + + + diff --git a/custompages/images/footer.png b/custompages/images/footer.png new file mode 100644 index 0000000000000000000000000000000000000000..2cedac6018634e8bc99c9bcabfe2e943c5704d08 GIT binary patch literal 2610 zcmb_ei94Iw7mkkFhqS?DYRWfY;2 z7`2V1O=(SqpaxMDt=%-XTB*1tOA>_P8hz zNE&kZh=7WUm4Kjlw1cya_=F?`tgNXocoh$Xl%s9Dqph!phX+SQgRE}^6QhH#XvAKN z4$-i4aCY_jN%lM7tV{=#B{uHuatY1}LXhtf-!T+9ZZV1yIWgXBsN0!r3(;0e1Yb^Y zH8i(>7ikk@Rh}+~AWK?l+NR$Nc~L3%N<#9X(yicHx(pWo0>NyovZJHp@#DFV zV=VMzHwKo+{Zb9KX8S+8MA^Tan(7EWo{rMWLw{bGF5j55jCB>XouyLhbEdvM=MwlZv6Ru(0B>%KG}8w^$F4!uw56pLTb5uPreP3JUV` z^KIneFSeH_NF>rrdAOw&DsJmgyMGVui^|Wft-ypeKJ@1{r&yhitriAkBx8Z z>gsB0YVO~c|1ok^U^XP`SPia+f1Q3QJtG|W^UqTVL|tv|*ZsXV&svY#k*%$*!hOqElw^J(S@{8}plaCu1Z6Priv?Zq_yRA*x7MWu=;9R&piUD9L=nJWL~%a^Uq z&Bz~yhKH@)59a$HPD?9te=og6sSHvji#k3B6IvpFlDDz3xz>pH`NPM8%ws_B|OMicV|C?{V*}%V%SrH0n{V8^K;>KqY z2wsx4mF(yfT*LdhTcK?(&%ri!cDan@~J#x zf62^yI(uz%6MDgu>Ftccys1*}{_e@<=4R`Oej&{JNJ^TE$3+%|Xv&*A$_?bfk8*A- zrk2X78d+q0UY)wm`(;IP_sa(CpqF7lpvXg7eFbmdp20@}-+69*9MkJrNB4=OYHabp zCkdg01zpEeT3U>9mlVuhgK{P1OGO4#tg(m1FLF%q%%-w3O+7t5b8|YeU}$LQ z>C>mcC8mV5#dUZcL)Tz zD@RfmCz`KwALzks2IyuDFMSS^`vVQ%r%YK5~0fg z*HoN>!-Z4NDD!8AmZGDfabLH?LnlXnY~*k_-6=Ea{$-+$d@!LsE=T_7loVQK=J+%d z;J3pj2l#DRBHxb%gXGF|?dV^x@vBEWoJ|MeFZgORP5 zl#x+Ad6JMkv5C)2Pd8AK0Vqzyx?*^#yu7^ns)wiNji;gQH;G;>Uq3c{9;nAP(Tw2n z*i}JcyC;LqW-}PqLPG3+8){G5!|Ud*Cotbkw#8<`QnII$Q~a@avr87f`RRyIoPbI$Y@tFp!>qCzgRVDT#=SYhf~(ot^vL z=@3gx%Xb2)#XPRGVl2;sUF^X2&JT}>sEkdDXz}+oMj{)?Gq&biVS@Hs0(HBKla)cW zjiF-*ID8c2E~TKAAACYZMN3O7ZdW4@J=K0IXq6VF%E3S1tY0>sLFbM+TCx8$I_N7z zzGI19y1o76C38fKYN?w`PB7#2^i;L9@ZY)8swTR+x;FRDG&VMBN#rMMY6W$*w_n_C zD!e5rD~mXNy54ABVessjBAix?le#na%4C~P`#DjqlF3}|N|i%D{xyN}b6f<`XZVyz%RNF zCus&MRkpSHARg3WYiKmtJoL!al=`t_$JEtJv$Mf~FDmLis5L$kANqiVlmS3 zL#=Uy@VMZv7$_34rs)9!iAsb1lPQM^#exmU6+osON|*oRM)KqrbvJU7S)gwFG;jgP M!3Kk>vkJKLFC&w?)Bpeg literal 0 HcmV?d00001 diff --git a/custompages/images/header.png b/custompages/images/header.png new file mode 100644 index 0000000000000000000000000000000000000000..127265a6e2f0406e6b774bf59c1402dadaa2a599 GIT binary patch literal 2627 zcmai02{c>V8a}GmkUm#0MNOroHC|dYT3Y(lSo7R+4J{S7=A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MXs)ekD^A=2piWoeCY#Tf16Wbsi4`DZ z{W|*8TsssG(r6{A^Zvp2E3tij4&SW5J@OJ0%Q98Z0b@j)_YV%Ta+31P?FUCj_F|G6 z;P@6C1}r62RU>uCeVy2?t@~K&gpUmvi3e+v813UT<2z2H(cU>00#mcIx`+_bzFtKK z)-;zZc#$wS$5L&_ZaYG6?C~|5Dq3LAUOkOodK_?&f7dVep0rm>F3a78`gz{1Zg>72*H@ literal 0 HcmV?d00001 diff --git a/custompages/images/login-form-submit-bg.jpg b/custompages/images/login-form-submit-bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..19fec4a2a1624e4efa7f116c260977db43a9b647 GIT binary patch literal 862 zcmex=_pEtn&W4ZhKW8@wu`yng9IR+O`}| z!6!#fOC4MGY~DFF&a2l1KD*D4PL$@^v2(+T!`=GJ*8W^>KK1c_sVBu1k#}p>mWLkK z{I37*y4}7tn|BuOJ+pMvY2BXlkAIcC|MY9iCxhc@bCwl7o_=-ydi|fD^}j`?PG7CF zDU$84@sH~>YV5z&C6C$Gq3|pI#gm`8(v<1?zQDRTjHg z%YCoES319Tvede|$V!{A{|q^=ZuuK0ANV@|<9yRopXZtL#q0NO?%#c_yl8IX+|B!Q zWA9hD&P~;wTfaW0_~z>(oAce5ADf*i`DB`R+l@dT*OKGz$+>Y49r|7w@Mo4516%kt%SGG3P3=9^i}78TL`?sLQP z-`RO>=WmNeicA+Oja^j6am~=?;f8f*r(X-PxuKeLc)o02Jb(B3ixqp$7~VX7>T#ZB z&FR-u&XwD5zAc%vU#uoFb)&ib#NFN7@*Y2Zz0GIIe%bRmdFJc>tq=Q}e$M>4w9d4! PZVd-KPGn$^|9=wzoInjw literal 0 HcmV?d00001 diff --git a/custompages/images/page-background.png b/custompages/images/page-background.png new file mode 100644 index 0000000000000000000000000000000000000000..c897ca1586c620e802f193963652aaabefb356dd GIT binary patch literal 4210 zcmeAS@N?(olHy`uVBq!ia0y~yU~ObzV5;F@0*a`!{ag*C7>k44ofy`glX(f`uqAoB zyDx`7I;J!Gca%qgD@k*tT_@uLG}_)Usv|qoWcU)3OA!}CowSafAVy3 z45_&F_J$!Ng96V1g9H1Y`?Bs8;itt)|n zFxpfA2Eu4d36vj38;Za{7;Rbu17WmhG1{>jZ7I>VTYZRW?h*E{6ND=tgUVh{S3j3^ HP6assign('error', $error_message); +} + +$flash = Display::getFlashToString(); +Display::cleanFlashMessages(); + +if (api_get_setting('allow_registration') === 'true') { + $urlRegister = api_get_path(WEB_CODE_PATH).'auth/inscription.php?language='.api_get_interface_language(); + $template->assign('url_register', $urlRegister); +} +$urlLostPassword = api_get_path(WEB_CODE_PATH).'auth/lostPassword.php?language='.api_get_interface_language(); +$template->assign('url_lost_password', $urlLostPassword); +$template->assign('mgs_flash', $flash); + +$layout = $template->get_template('custompage/login.tpl'); +$content = $template->fetch($layout); +$template->assign('content', $content); +$template->display_blank_template(); diff --git a/custompages/language.inc.php b/custompages/language.inc.php new file mode 100644 index 000000000..ce3bc9843 --- /dev/null +++ b/custompages/language.inc.php @@ -0,0 +1,53 @@ + + * This requires the Chamilo system to be initialized + * (note that it's easier to do the following include in the parent page). + * + * @package chamilo.custompages + */ +/** + * Returns the best match between available languages and visitor preferences. + * + * @return string the best match as 2-chars code, null when none match + */ +function get_preferred_language($available_langs) +{ + // Parsing the Accept-languages HTTP header + $langs = []; + foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) { + $rawlang = explode(';q=', $httplang); + if (strpos($rawlang[0], '-') !== false) { + // We ignore the locale part, as in en-GB vs en-US + $rawlang[0] = substr($rawlang[0], 0, strpos($rawlang[0], '-')); + } + if (count($rawlang) == 1) { + $rawlang[1] = 1.0; // The absence of weighting means a weight of 1 (max) + } + $langs[$rawlang[1]][] = $rawlang[0]; + } + krsort($langs, SORT_NUMERIC); + // Choosing the best match + foreach ($langs as $weight => $codes) { + foreach ($codes as $code) { + if (in_array($code, $available_langs)) { + return $code; + } + } + } + + // No match + return null; +} + +/** + * Get a language variable in a specific language. + */ +function custompages_get_lang($variable) +{ + return get_lang($variable, null, $_SESSION['user_language_choice']); +} diff --git a/custompages/language.php b/custompages/language.php new file mode 100644 index 000000000..e7258bab6 --- /dev/null +++ b/custompages/language.php @@ -0,0 +1,50 @@ + 'english', + 'en' => 'english', + 'fr' => 'french', + 'nl' => 'dutch', + 'de' => 'german', + 'es' => 'spanish', + 'gl' => 'galician', + 'eu' => 'basque', +]; +$lang_match = $chamilo_langs[get_preferred_language($available_langs)]; +// recover previous value ... +if (isset($_SESSION['user_language_choice'])) { + $lang_match = $_SESSION['user_language_choice']; +} + +// Chamilo parameter, on logout +if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) { + $lang_match = $_REQUEST['language']; +} +// Incoming link parameter +if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], $available_langs)) { + $lang_match = $chamilo_langs[$_REQUEST['lang']]; +} + +$detect = api_get_setting('auto_detect_language_custom_pages'); +if ($detect === 'true') { + // Auto detect + $_user['language'] = $lang_match; + $_SESSION['user_language_choice'] = $lang_match; +} else { + // Chamilo default platform. + $defaultLanguage = api_get_interface_language(); + $_user['language'] = $defaultLanguage; + $_SESSION['user_language_choice'] = $defaultLanguage; +} diff --git a/custompages/loggedout-dist.php b/custompages/loggedout-dist.php new file mode 100644 index 000000000..b90b8235b --- /dev/null +++ b/custompages/loggedout-dist.php @@ -0,0 +1,54 @@ + + + + + Custompage - logged out + + + + + +
+ background +
+
+ + +
+
+ You have been logged out. +
+
+ Go to your portal + +
+ + diff --git a/custompages/lostpassword-dist.php b/custompages/lostpassword-dist.php new file mode 100644 index 000000000..8b8d08f50 --- /dev/null +++ b/custompages/lostpassword-dist.php @@ -0,0 +1,23 @@ +assign('error'); +$template->assign('form', $content['form']); +$layout = $template->get_template('custompage/lostpassword.tpl'); +$content = $template->fetch($layout); +$template->assign('content', $content); +$template->display_blank_template(); diff --git a/custompages/registration-dist.php b/custompages/registration-dist.php new file mode 100644 index 000000000..06449d5c6 --- /dev/null +++ b/custompages/registration-dist.php @@ -0,0 +1,36 @@ +_elementIndex['extra_mail_notify_invitation'])) { + $content['form']->removeElement('extra_mail_notify_invitation'); +} +if (isset($content['form']->_elementIndex['extra_mail_notify_message'])) { + $content['form']->removeElement('extra_mail_notify_message'); +} +if (isset($content['form']->_elementIndex['extra_mail_notify_group_message'])) { + $content['form']->removeElement('extra_mail_notify_group_message'); +} +$content['form']->removeElement('official_code'); +$content['form']->removeElement('phone'); + +$template->assign('form', $content['form']->returnForm()); +$layout = $template->get_template('custompage/registration.tpl'); +$content = $template->fetch($layout); +$template->assign('content', $content); +$template->display_blank_template(); diff --git a/custompages/registration-feedback-dist.php b/custompages/registration-feedback-dist.php new file mode 100644 index 000000000..b0b8671a0 --- /dev/null +++ b/custompages/registration-feedback-dist.php @@ -0,0 +1,48 @@ + + + + <?php echo custompages_get_lang('Registration'); ?> + + + + + + + +
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+ + diff --git a/custompages/url-images/README b/custompages/url-images/README new file mode 100644 index 000000000..543a49d0c --- /dev/null +++ b/custompages/url-images/README @@ -0,0 +1,5 @@ +Custom Pages : URL Images + +This features allows each access URL to have a number of images (currently three) specific to this URL. This allows easier customization of landing pages by access URL. + +You can access a URL's images by calling the static function CustomPages::getURLImages() in your custom page.