Exemple #1
0
 function getTplName($tpl_name)
 {
     if (file_exists($this->getTemplatePath($tpl_name))) {
         return $this->getTemplatePath($tpl_name);
     }
     // FIX FOR ajax_file_upload_handler function called from admin panel
     $httpReferrer = SJB_Request::getVar('HTTP_REFERER', '', 'SERVER');
     $requestUri = SJB_Request::getVar('REQUEST_URI', '', 'SERVER');
     if (!empty($httpReferrer) && !empty($requestUri) && strpos($httpReferrer, '/admin/') !== false && strpos($requestUri, '/ajax_file_upload_handler/') !== false) {
         $currValue = SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE');
         SJB_System::setSystemSettings('SYSTEM_ACCESS_TYPE', 'admin');
         $systemTpl = SJB_System::getSystemSettings('SYSTEM_TEMPLATE_DIR') . '/';
         // ok. Now - set previous value
         SJB_System::setSystemSettings('SYSTEM_ACCESS_TYPE', $currValue);
     } else {
         $systemTpl = SJB_System::getSystemSettings('SYSTEM_TEMPLATE_DIR') . '/';
     }
     // END OF FIX
     $fileName = SJB_TemplatePathManager::getAbsoluteTemplatesPath() . $systemTpl . $this->module_name . '/' . $tpl_name;
     // ?
     if (file_exists($fileName)) {
         return $fileName;
     }
     return null;
 }