Advertisement
Guest User

Untitled

a guest
May 20th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. function GetHTML()
  2.     {
  3.         // Change also in siteConfig.php
  4.         $modules_tbl = cache_engine::get("modules_lang" . CRM::$GLOBALS["lang"], function(){
  5.             return CRM::sql_getLines("
  6.                 SELECT *
  7.                 FROM
  8.                     " . CRM::$GLOBALS["fullprefix"] . "modules dat
  9.                     LEFT JOIN
  10.                     (
  11.                         SELECT *
  12.                         FROM " . CRM::$GLOBALS["fullprefix"] . "modules_content
  13.                         ORDER BY IF(langId = " . CRM::$GLOBALS["lang"] . ", 1, 0) DESC
  14.                     ) cnt ON dat.id = cnt.parentId
  15.                 GROUP BY dat.id
  16.             ", "moduleName");
  17.         }, 48);
  18.        
  19.         if (is_file($this->fileSrc) && ($modules_tbl[$this->module]["active"] == 1 || IsAdmin()))
  20.         {
  21.             // Admin mode
  22.             if ($modules_tbl[$this->module]["active"] != 1 && IsAdmin())
  23.             {
  24.                 echo "<form action=\"/admin/Modules/insert\" method=\"post\"><input type=\"hidden\" name=\"moduleName\" value=\"{$this->module}\" /><input type=\"hidden\" name=\"modulesDir\" value=\"{$this->module}\" /><div style=\"direction:ltr; text-align:left; padding:8px; border:1px dashed #dbdbdb; background:#ffffec; color:#333;\"><input type=\"submit\" class=\"u\" style=\"padding:0px; margin:0px; border:none; background:none; cursor:pointer;\" value=\"Click here\"> to activate this module so regular users can see this.</div></form>";
  25.             }
  26.            
  27.            
  28.             if ($this->page == "") $this->page = "index";
  29.             $pname = $this->page;
  30.            
  31.             $mdl = Module::GetObject($this->module);
  32.             if (!$mdl || !method_exists($mdl, $pname)) $returnValue = "ERRORPAGE";
  33.             else
  34.             {
  35.                 $chcVar = "chc_" . $this->page; // . "-" . $_SERVER['QUERY_STRING'];
  36.                 if (isset($mdl->$chcVar) && $mdl->$chcVar > 0)
  37.                 {
  38.                     $pg_content = cache_page($mdl, $pname, $mdl->$chcVar, $this->module . "_" . $pname);
  39.                 }
  40.                 else $pg_content = $mdl->$pname();
  41.                
  42.                 $returnValue = $mdl->Wrapper($pg_content);
  43.             }
  44.         }
  45.         else $returnValue = "ERRORPAGE";   
  46.                
  47.         if ($returnValue == "ERRORPAGE")
  48.         {
  49.             header("HTTP/1.1 404 Not Found");
  50.             header('Location: /404');
  51.             exit;
  52.         }
  53.  
  54.         if ($returnValue == "REQUIRE_LOGIN")
  55.         {
  56.             return "<script type=\"text/javascript\"> $(function(){ $('#page').trigger('REQUIRE_LOGIN'); }); </script>";
  57.         }
  58.        
  59.         return ($returnValue);
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement