<?php

//error_reporting(1);
define('DS', strstr(PHP_OS, 'WIN') ? '\\' : '/');
define('APP_PATH', realpath(dirname(dirname(dirname(__FILE__)))) . DS);
include_once APP_PATH . 'core' . DS . 'ini.php';
include_once APP_PATH . 'core' . DS . 'appController.php';
include_once APP_PATH . 'helper' . DS . 'cpanelLayout.php';
define('AJAX_LOADER_PATH_IMAGE_INDEX', mapFile2URL(CSS_PATH . 'images' . DS . 'ajax-loader.gif'));
define('AJAX_LOADER_IMAGE_INDEX', '<img class="ajaxLoader" src="' . AJAX_LOADER_PATH_IMAGE_INDEX . '"/>');
$requestInfo = is_object($GLOBALS['registry']->session) ? json_decode($GLOBALS['registry']->session->getSession('requestSession'), true) : '';
$controller = $GLOBALS['registry']->request->getGet('co') != '' ? base64url_decode($GLOBALS['registry']->request->getGet('co')) : $requestInfo['controller'];
$action = $GLOBALS['registry']->request->getGet('ac') != '' ? base64url_decode($GLOBALS['registry']->request->getGet('ac')) : $requestInfo['action'];
//$ttag = ($GLOBALS['registry']->request->getGet('ttag') != '') ? base64url_decode($GLOBALS['registry']->request->getGet('ttag')) : $requestInfo['ttag'];
$tenantName = $GLOBALS['registry']->tenantName;
$strJS = <<<JS

\t\t
function setPagingHash(pageID){
setGlobalVar('pageID',pageID);
window.location.hash='pageID'+getGlobalVar('GET_PARAM_PATTERN')+pageID;
}
setGlobalVar('GET_PARAM_PATTERN', '%s');
setGlobalVar('currentController','%s');
setGlobalVar('currentAction','%s');
setGlobalVar('HTTP_HOST_PATH','%s');
setGlobalVar('HTTP_HOST_MASTER_PATH','%s');
        
setGlobalVar('AJAX_LOADER_IMAGE','%s');
setGlobalVar('AJAX_LOADER_IMAGE_PATH','%s');
\t\t
Example #2
0
<!DOCTYPE html>
<html lang="en" class="error_page">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title><?php 
echo $currentController->pageTitle;
?>
</title>
        <?php 
deployClientFiles($currentController->css, true, false, 'css');
foreach (glob(CSS_PATH . $currentController->controller . DS . $currentController->action . DS . "*.css") as $filename) {
    ?>
            <link rel="stylesheet" href="<?php 
    echo mapFile2URL($filename);
    ?>
" />
            <?php 
}
?>
	
    </head>
    <body >

        <?php 
App::import($currentController->view, 'view');
?>
                                 
        <?php 
deployClientFiles($currentController->js, true, false, 'js');
?>
function generateJS(array $js, $cash = true, $justLinks = false, $outSource = false, $options = array())
{
    if (!empty($js)) {
        $propStr = getProperites($options);
        if (!$GLOBALS['noAutomation']) {
            $controllerName = $GLOBALS['registry']->controller;
            $actionName = $GLOBALS['registry']->action;
            $jsControllerActionFile = JS_PATH . $controllerName . DS . $actionName . '.js';
            if (file_exists($jsControllerActionFile)) {
                //Auto Load Control action js if found
                $jsControllerActionName = 'Controller-' . $controllerName . '-' . $actionName . '-Action';
                $js[] = $jsControllerActionName;
            }
            $jsControllerActionFileLang = JS_PATH . $controllerName . DS . $GLOBALS['registry']->currentLang . DS . $actionName . '.js';
            if (file_exists($jsControllerActionFileLang)) {
                //Auto Load Control action js lang if found
                $jsControllerActionNameLang = 'Controller-' . $controllerName . '-' . $actionName . '-Action-' . $GLOBALS['lang']->currentLang;
                $js[] = $jsControllerActionNameLang;
            }
        }
        if ($cash) {
            $jsCashString = base64url_encode(implode('|', $js));
            if ($jsCashString != '') {
                echo $justLinks ? mapFile2URL('js.php') . '?cash=' . $jsCashString : '<script type="text/javascript" src="' . mapFile2URL('js.php') . '?cash=' . $jsCashString . '" ' . $propStr . '></script>';
            }
        } else {
            foreach ($js as $jsFile) {
                if (is_array($jsFile)) {
                    $jsFile = $jsFile[0] . DS . $jsFile[1] . '.js';
                } elseif (!$outSource) {
                    $jsFile = $jsFile . '.js';
                }
                if (file_exists(JS_PATH . $jsFile)) {
                    echo $justLinks ? mapFile2URL('js' . DS . $jsFile) : '<script type="text/javascript" src="' . mapFile2URL('js' . DS . $jsFile) . '" ' . $propStr . ' ></script>';
                } elseif ($outSource) {
                    echo $justLinks ? $jsFile : '<script type="text/javascript" src="' . $jsFile . '" ' . $propStr . '></script>';
                }
            }
            if (!$GLOBALS['noAutomation']) {
                if (file_exists($jsControllerActionFile)) {
                    echo $justLinks ? mapFile2URL(JS_PATH . $controllerName . DS . $actionName . '.js') : '<script type="text/javascript" ' . $propStr . ' src="' . mapFile2URL(JS_PATH . $controllerName . DS . $actionName . '.js') . '"></script>';
                }
                if (file_exists($jsControllerActionFileLang)) {
                    echo $justLinks ? mapFile2URL(JS_PATH . $controllerName . DS . $GLOBALS['registry']->currentLang . DS . $actionName . '.js') : '<script type="text/javascript" ' . $propStr . ' src="' . mapFile2URL(JS_PATH . $controllerName . DS . $GLOBALS['registry']->currentLang . DS . $actionName . '.js') . '"></script>';
                }
            }
        }
    }
}
<?php

/**
 * ConstantsArray , Tidy PHP
 * grouping constants in arrays
 * @version       $Revision$
 * @modifiedby    $LastChangedBy$
 * @lastmodified  $Date$
 * @author Hussam El-Kurd <*****@*****.**>
 * @copyright Copyright (c) 2011, Hussam El-Kurd
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package Tidy
 * @subpackage Setting
 * @filesource
 */
$GLOBALS['registry']->constantResources = array('activeFlagsConstants' => array(ACTIVE_STATUS => _tr('Active'), IN_ACTIVE_STATUS => _tr('In Active')), 'yesNoFlagsConstants' => array(ACTIVE_STATUS => _tr('Yes'), IN_ACTIVE_STATUS => _tr('No')), 'langCurrentConstants' => array("en" => EN_LANG, "ar" => AR_LANG), 'imageOptions' => array('paths' => array('thumbs' => array('path' => UPLOAD_IMAGE_PATH . 'thumb' . DS, 'width' => 100, 'height' => 100, 'default' => UPLOAD_IMAGE_PATH . 'defaults' . DS . 'default_thumb.jpg'), 'users' => array('path' => UPLOAD_IMAGE_PATH . 'users' . DS, 'width' => 57, 'height' => 57, 'default' => CSS_PATH . 'cpanelAdminica' . DS . 'images' . DS . 'profile.jpg'), '276X131' => array('path' => UPLOAD_IMAGE_PATH . '276X131' . DS, 'width' => 276, 'height' => 131, 'default' => UPLOAD_IMAGE_PATH . 'defaults' . DS . '276X131.jpg')), 'extensions' => array('png', 'gif', 'jpg', 'jpeg')), 'defaultUpload' => array('script_url' => HTTP_HOST_PATH, 'upload_dir' => UPLOAD_PATH, 'upload_url' => mapFile2URL(UPLOAD_PATH, HTTP_HOST_PATH), 'access_control_allow_methods' => array('POST', 'GET'), 'max_file_size' => MAX_ATTACH_UPLOAD_SIZE, 'min_file_size' => 1, 'max_number_of_files' => null, 'accept_file_types' => '/.+$/i'), 'defaultImageUpload' => array('script_url' => HTTP_HOST_PATH, 'upload_dir' => UPLOAD_IMAGE_PATH, 'upload_url' => mapFile2URL(UPLOAD_IMAGE_PATH, HTTP_HOST_PATH), 'access_control_allow_methods' => array('POST', 'GET'), 'default' => '', 'max_file_size' => null, 'min_file_size' => 1, 'max_number_of_files' => null, 'max_width' => null, 'max_height' => null, 'min_width' => 1, 'min_height' => 1, 'accept_file_types' => '/\\.(gif|jpe?g|png)$/i', 'image_versions' => array('thumb' => array('max_width' => 100, 'max_height' => 100, 'jpeg_quality' => 80, 'upload_dir' => UPLOAD_IMAGE_PATH . 'thumb' . DS, 'upload_url' => mapFile2URL(UPLOAD_IMAGE_PATH . 'thumb' . DS, HTTP_HOST_PATH), 'path' => UPLOAD_IMAGE_PATH . 'thumb' . DS, 'default' => mapFile2URL(UPLOAD_IMAGE_PATH . 'defaults' . DS, HTTP_HOST_PATH) . 'thumb.png'), 'mediumThumb' => array('min_width' => 200, 'max_width' => 200, 'max_height' => 150, 'min_height' => 200, 'jpeg_quality' => 50, 'upload_dir' => UPLOAD_IMAGE_PATH . 'mediumThumb' . DS, 'upload_url' => mapFile2URL(UPLOAD_IMAGE_PATH . 'mediumThumb' . DS, HTTP_HOST_PATH), 'path' => UPLOAD_IMAGE_PATH . 'mediumThumb' . DS, 'default' => mapFile2URL(UPLOAD_IMAGE_PATH . 'defaults' . DS, HTTP_HOST_PATH) . 'thumb.png'))), 'attachOptions' => array('paths' => array('attachment' => array('path' => UPLOAD_PATH . 'attachments' . DS))), 'filterSections' => array('filter' => _tr('Search ->')), 'userLevels' => array(ADMIN_LEVEL => _tr('Administrator'), MANAGER_LEVEL => _tr('Manager'), REGULAR_USER_LEVEL => _tr('Regular User')), 'permissionHierarchy' => array(ADMIN_LEVEL => array(ADMIN_LEVEL, MANAGER_LEVEL, REGULAR_USER_LEVEL), MANAGER_LEVEL => array(MANAGER_LEVEL, REGULAR_USER_LEVEL), REGULAR_USER_LEVEL => array(REGULAR_USER_LEVEL)), 'orgTypes' => array(MISCELLANEOUS_ORG => _tr('Miscellaneous'), SCHOOL_ORG => _tr('School'), FUNDER_ORG => _tr('Funder')), 'Countries' => array('AF' => _tr('Afghanistan'), 'AX' => _tr('Åland Islands'), 'AL' => _tr('Albania'), 'DZ' => _tr('Algeria'), 'AS' => _tr('American Samoa'), 'AD' => _tr('Andorra'), 'AO' => _tr('Angola'), 'AI' => _tr('Anguilla'), 'AQ' => _tr('Antarctica'), 'AG' => _tr('Antigua and Barbuda'), 'AR' => _tr('Argentina'), 'AM' => _tr('Armenia'), 'AW' => _tr('Aruba'), 'AC' => _tr('Ascension Island'), 'AU' => _tr('Australia'), 'AT' => _tr('Austria'), 'AZ' => _tr('Azerbaijan'), 'BS' => _tr('Bahamas'), 'BH' => _tr('Bahrain'), 'BD' => _tr('Bangladesh'), 'BB' => _tr('Barbados'), 'BY' => _tr('Belarus'), 'BE' => _tr('Belgium'), 'BZ' => _tr('Belize'), 'BJ' => _tr('Benin'), 'BM' => _tr('Bermuda'), 'BT' => _tr('Bhutan'), 'BO' => _tr('Bolivia'), 'BQ' => _tr('Bonaire), Sint Eustatius), and Saba'), 'BA' => _tr('Bosnia and Herzegovina'), 'BW' => _tr('Botswana'), 'BV' => _tr('Bouvet Island'), 'BR' => _tr('Brazil'), 'IO' => _tr('British Indian Ocean Territory'), 'VG' => _tr('British Virgin Islands'), 'BN' => _tr('Brunei'), 'BG' => _tr('Bulgaria'), 'BF' => _tr('Burkina Faso'), 'BI' => _tr('Burundi'), 'KH' => _tr('Cambodia'), 'CM' => _tr('Cameroon'), 'CA' => _tr('Canada'), 'IC' => _tr('Canary Islands'), 'CV' => _tr('Cape Verde'), 'KY' => _tr('Cayman Islands'), 'CF' => _tr('Central African Republic'), 'EA' => _tr('Ceuta and Melilla'), 'TD' => _tr('Chad'), 'CL' => _tr('Chile'), 'CN' => _tr('China'), 'CX' => _tr('Christmas Island'), 'CP' => _tr('Clipperton Island'), 'CC' => _tr('Cocos [Keeling] Islands'), 'CO' => _tr('Colombia'), 'KM' => _tr('Comoros'), 'CG' => _tr('Congo - Brazzaville'), 'CD' => _tr('Congo - Kinshasa'), 'CK' => _tr('Cook Islands'), 'CR' => _tr('Costa Rica'), 'CI' => _tr('Côte d’Ivoire'), 'HR' => _tr('Croatia'), 'CU' => _tr('Cuba'), 'CW' => _tr('Curaçao'), 'CY' => _tr('Cyprus'), 'CZ' => _tr('Czech Republic'), 'DK' => _tr('Denmark'), 'DG' => _tr('Diego Garcia'), 'DJ' => _tr('Djibouti'), 'DM' => _tr('Dominica'), 'DO' => _tr('Dominican Republic'), 'EC' => _tr('Ecuador'), 'EG' => _tr('Egypt'), 'SV' => _tr('El Salvador'), 'GQ' => _tr('Equatorial Guinea'), 'ER' => _tr('Eritrea'), 'EE' => _tr('Estonia'), 'ET' => _tr('Ethiopia'), 'EU' => _tr('European Union'), 'FK' => _tr('Falkland Islands'), 'FO' => _tr('Faroe Islands'), 'FJ' => _tr('Fiji'), 'FI' => _tr('Finland'), 'FR' => _tr('France'), 'GF' => _tr('French Guiana'), 'PF' => _tr('French Polynesia'), 'TF' => _tr('French Southern Territories'), 'GA' => _tr('Gabon'), 'GM' => _tr('Gambia'), 'GE' => _tr('Georgia'), 'DE' => _tr('Germany'), 'GH' => _tr('Ghana'), 'GI' => _tr('Gibraltar'), 'GR' => _tr('Greece'), 'GL' => _tr('Greenland'), 'GD' => _tr('Grenada'), 'GP' => _tr('Guadeloupe'), 'GU' => _tr('Guam'), 'GT' => _tr('Guatemala'), 'GG' => _tr('Guernsey'), 'GN' => _tr('Guinea'), 'GW' => _tr('Guinea-Bissau'), 'GY' => _tr('Guyana'), 'HT' => _tr('Haiti'), 'HM' => _tr('Heard Island and McDonald Islands'), 'HN' => _tr('Honduras'), 'HK' => _tr('Hong Kong SAR China'), 'HU' => _tr('Hungary'), 'IS' => _tr('Iceland'), 'IN' => _tr('India'), 'ID' => _tr('Indonesia'), 'IR' => _tr('Iran'), 'IQ' => _tr('Iraq'), 'IE' => _tr('Ireland'), 'IM' => _tr('Isle of Man'), 'IL' => _tr('Israel'), 'IT' => _tr('Italy'), 'JM' => _tr('Jamaica'), 'JP' => _tr('Japan'), 'JE' => _tr('Jersey'), 'JO' => _tr('Jordan'), 'KZ' => _tr('Kazakhstan'), 'KE' => _tr('Kenya'), 'KI' => _tr('Kiribati'), 'KW' => _tr('Kuwait'), 'KG' => _tr('Kyrgyzstan'), 'LA' => _tr('Laos'), 'LV' => _tr('Latvia'), 'LB' => _tr('Lebanon'), 'LS' => _tr('Lesotho'), 'LR' => _tr('Liberia'), 'LY' => _tr('Libya'), 'LI' => _tr('Liechtenstein'), 'LT' => _tr('Lithuania'), 'LU' => _tr('Luxembourg'), 'MO' => _tr('Macau SAR China'), 'MK' => _tr('Macedonia'), 'MG' => _tr('Madagascar'), 'MW' => _tr('Malawi'), 'MY' => _tr('Malaysia'), 'MV' => _tr('Maldives'), 'ML' => _tr('Mali'), 'MT' => _tr('Malta'), 'MH' => _tr('Marshall Islands'), 'MQ' => _tr('Martinique'), 'MR' => _tr('Mauritania'), 'MU' => _tr('Mauritius'), 'YT' => _tr('Mayotte'), 'MX' => _tr('Mexico'), 'FM' => _tr('Micronesia'), 'MD' => _tr('Moldova'), 'MC' => _tr('Monaco'), 'MN' => _tr('Mongolia'), 'ME' => _tr('Montenegro'), 'MS' => _tr('Montserrat'), 'MA' => _tr('Morocco'), 'MZ' => _tr('Mozambique'), 'MM' => _tr('Myanmar [Burma]'), 'NA' => _tr('Namibia'), 'NR' => _tr('Nauru'), 'NP' => _tr('Nepal'), 'NL' => _tr('Netherlands'), 'AN' => _tr('Netherlands Antilles'), 'NC' => _tr('New Caledonia'), 'NZ' => _tr('New Zealand'), 'NI' => _tr('Nicaragua'), 'NE' => _tr('Niger'), 'NG' => _tr('Nigeria'), 'NU' => _tr('Niue'), 'NF' => _tr('Norfolk Island'), 'KP' => _tr('North Korea'), 'MP' => _tr('Northern Mariana Islands'), 'NO' => _tr('Norway'), 'OM' => _tr('Oman'), 'QO' => _tr('Outlying Oceania'), 'PK' => _tr('Pakistan'), 'PW' => _tr('Palau'), 'PS' => _tr('Palestinian Territories'), 'PA' => _tr('Panama'), 'PG' => _tr('Papua New Guinea'), 'PY' => _tr('Paraguay'), 'PE' => _tr('Peru'), 'PH' => _tr('Philippines'), 'PN' => _tr('Pitcairn Islands'), 'PL' => _tr('Poland'), 'PT' => _tr('Portugal'), 'PR' => _tr('Puerto Rico'), 'QA' => _tr('Qatar'), 'RE' => _tr('Réunion'), 'RO' => _tr('Romania'), 'RU' => _tr('Russia'), 'RW' => _tr('Rwanda'), 'BL' => _tr('Saint Barthélemy'), 'SH' => _tr('Saint Helena'), 'KN' => _tr('Saint Kitts and Nevis'), 'LC' => _tr('Saint Lucia'), 'MF' => _tr('Saint Martin'), 'PM' => _tr('Saint Pierre and Miquelon'), 'VC' => _tr('Saint Vincent and the Grenadines'), 'WS' => _tr('Samoa'), 'SM' => _tr('San Marino'), 'ST' => _tr('São Tomé and Príncipe'), 'SA' => _tr('Saudi Arabia'), 'SN' => _tr('Senegal'), 'RS' => _tr('Serbia'), 'CS' => _tr('Serbia and Montenegro'), 'SC' => _tr('Seychelles'), 'SL' => _tr('Sierra Leone'), 'SG' => _tr('Singapore'), 'SX' => _tr('Sint Maarten'), 'SK' => _tr('Slovakia'), 'SI' => _tr('Slovenia'), 'SB' => _tr('Solomon Islands'), 'SO' => _tr('Somalia'), 'ZA' => _tr('South Africa'), 'GS' => _tr('South Georgia and the South Sandwich Islands'), 'KR' => _tr('South Korea'), 'SS' => _tr('South Sudan'), 'ES' => _tr('Spain'), 'LK' => _tr('Sri Lanka'), 'SD' => _tr('Sudan'), 'SR' => _tr('Suriname'), 'SJ' => _tr('Svalbard and Jan Mayen'), 'SZ' => _tr('Swaziland'), 'SE' => _tr('Sweden'), 'CH' => _tr('Switzerland'), 'SY' => _tr('Syria'), 'TW' => _tr('Taiwan'), 'TJ' => _tr('Tajikistan'), 'TZ' => _tr('Tanzania'), 'TH' => _tr('Thailand'), 'TL' => _tr('Timor-Leste'), 'TG' => _tr('Togo'), 'TK' => _tr('Tokelau'), 'TO' => _tr('Tonga'), 'TT' => _tr('Trinidad and Tobago'), 'TA' => _tr('Tristan da Cunha'), 'TN' => _tr('Tunisia'), 'TR' => _tr('Turkey'), 'TM' => _tr('Turkmenistan'), 'TC' => _tr('Turks and Caicos Islands'), 'TV' => _tr('Tuvalu'), 'UM' => _tr('U.S. Minor Outlying Islands'), 'VI' => _tr('U.S. Virgin Islands'), 'UG' => _tr('Uganda'), 'UA' => _tr('Ukraine'), 'AE' => _tr('United Arab Emirates'), 'GB' => _tr('United Kingdom'), 'US' => _tr('United States'), 'UY' => _tr('Uruguay'), 'UZ' => _tr('Uzbekistan'), 'VU' => _tr('Vanuatu'), 'VA' => _tr('Vatican City'), 'VE' => _tr('Venezuela'), 'VN' => _tr('Vietnam'), 'WF' => _tr('Wallis and Futuna'), 'EH' => _tr('Western Sahara'), 'YE' => _tr('Yemen'), 'ZM' => _tr('Zambia'), 'ZW' => _tr('Zimbabwe')), 'curlSSLVerify' => array('CURLOPT_SSL_VERIFYPEER' => false, 'CURLOPT_SSL_VERIFYHOST' => IN_ACTIVE_STATUS));
function getStyleSwitch($styleName = '', $cookieName = 'colorStyle', $path = '')
{
    $path = CSS_PATH . 'cpanel' . DS;
    $fileName = $GLOBALS['registry']->request->getCookie($cookieName);
    if (isset($fileName) & $fileName != '') {
        $filePath = $path . $fileName . '.css';
    } else {
        $filePath = $path . 'blue.css';
    }
    return mapFile2URL($filePath);
}
 public function afterLoad()
 {
     if (is_array($this->jsOrdering) and sizeof($this->jsOrdering)) {
         foreach ($this->jsOrdering as $jsFile) {
             if (file_exists($jsFile)) {
                 $this->js = array_merge($this->js, array(array('links' => array(mapFile2URL($jsFile)), 'cash' => false, 'justLinks' => false, 'outSource' => true)));
             } else {
                 $this->js = array_merge($this->js, array(array('links' => array(mapFile2URL(JS_PATH . $this->controller . DS . $this->model . DS . $jsFile . '.js')), 'cash' => false, 'justLinks' => false, 'outSource' => true)));
             }
         }
     }
     if (is_array($this->cssOrdering) and sizeof($this->cssOrdering)) {
         foreach ($this->cssOrdering as $jsFile) {
             if (file_exists($jsFile)) {
                 $this->css = array_merge($this->css, array(array('links' => array(mapFile2URL($jsFile)), 'cash' => false, 'justLinks' => false, 'outSource' => true)));
             } else {
                 $this->css = array_merge($this->css, array(array('links' => array(mapFile2URL(CSS_PATH . $this->controller . DS . $this->model . DS . $jsFile . '.css')), 'cash' => false, 'justLinks' => false, 'outSource' => true)));
             }
         }
     }
 }