1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- class CustomPages
- {
- const INDEX_LOGGED = 'index-logged';
- const INDEX_UNLOGGED = 'index-unlogged';
- const LOGGED_OUT = 'loggedout';
- const REGISTRATION_FEEDBACK = 'registration-feedback';
- const REGISTRATION = 'registration';
- const LOST_PASSWORD = 'lostpassword';
-
- public static function enabled()
- {
- return api_get_setting('use_custom_pages') == 'true';
- }
-
- public static function path($name = '')
- {
- return api_get_path(SYS_PATH).'custompages/'.$name;
- }
-
- public static function display($page_name, $content = array())
- {
- if (!self::enabled()) {
- return false;
- }
- $file = self::path($page_name.'.php');
- if (file_exists($file)) {
- include($file);
- exit;
- } else {
- error_log('CustomPages::displayPage : could not read file '.$file);
- }
- }
-
- public static function getURLImages($url_id = null)
- {
- if (is_null($url_id)) {
- $url = 'http://'.$_SERVER['HTTP_HOST'].'/';
- $url_id = UrlManager::get_url_id($url);
- }
- $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
- $images = array();
- for ($img_id = 1; $img_id <= 3; $img_id++) {
- if (file_exists($url_images_dir.$url_id.'_url_image_'.$img_id.'.png')) {
- $images[] = api_get_path(WEB_PATH).'custompages/url-images/'.$url_id.'_url_image_'.$img_id.'.png';
- }
- }
- return $images;
- }
-
- public static function exists($pageName)
- {
- $fileName = self::path("$pageName.php");
- return file_exists($fileName);
- }
- }
|