Ejemplo n.º 1
0
 /**
  * Construct Method
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     parent::__construct($options);
     $this->StyleSheets = [];
     $this->JavaScripts = [];
     $this->Positions = [];
 }
Ejemplo n.º 2
0
 /**
  * @param array $URI
  */
 public function __construct($URI)
 {
     parent::__construct([]);
     if (is_string($URI)) {
         $this->URI = $URI;
         $this->parse($URI);
     }
 }
Ejemplo n.º 3
0
 /**
  * Load the active cookies of the current session
  *
  * @param array $Options
  */
 public function __construct($Options = [])
 {
     parent::__construct($Options);
     if (!isset($this->Cookies)) {
         $this->Cookies =& $_COOKIE;
     }
     $this->newCookies = [];
 }
Ejemplo n.º 4
0
 /**
  * @param array $Identities
  */
 public function __construct($Identities)
 {
     parent::__construct([]);
     $this->Identities = [];
     if (is_string($Identities)) {
         $Identities = json_decode($Identities, true);
     }
     $this->mergeIdentities($Identities);
 }
Ejemplo n.º 5
0
 /**
  * @param mixed $Rules
  */
 public function __construct($Rules = null)
 {
     parent::__construct([]);
     $this->Actions = [];
     if (is_string($Rules)) {
         $this->merge(json_decode($Rules, true));
     } elseif (is_object($Rules) || is_array($Rules)) {
         $this->mergeCollection((array) $Rules);
     }
 }
Ejemplo n.º 6
0
 /**
  * @param string $TemplateDir
  * @param string $Template
  * @param string $Position
  * @param array  $Variables
  * @param bool   $Buffer
  */
 public function __construct($TemplateDir, $Template, $Position, $Variables = [], $Buffer = true)
 {
     parent::__construct([]);
     $this->TemplateDir = $TemplateDir;
     $this->Template = $Template;
     $this->Position = $Position;
     $this->blBuffer = $Buffer;
     $this->Variables = [];
     $this->VariablesByRef = [];
     $this->assign($Variables);
 }
Ejemplo n.º 7
0
 /**
  * return option passed through cli
  *
  * @param string $Key
  * @return string
  */
 public function getCLIOption($Key)
 {
     return $this->CLIOptions->get($Key);
 }
Ejemplo n.º 8
0
 /**
  * @return mixed
  */
 public function getComponent()
 {
     if (!isset($this->Component)) {
         $dbh = Factory::getDBH();
         $_Component = Factory::getRouter()->getRoute('Component');
         $_Controller = Factory::getRouter()->getRoute('Controller');
         $Action = Factory::getRouter()->getRoute('Action');
         $ID = Factory::getRouter()->getRoute('ID');
         try {
             $stmt = $dbh->prepare('SELECT * FROM Component WHERE ApplicationID = :AppID AND blStatus = 1 AND Component = :Component;');
             try {
                 $stmt->bindValue(':AppID', $this->ApplicationID, PDO::PARAM_STR);
                 $stmt->bindValue(':Component', (string) ucfirst($_Component), PDO::PARAM_STR);
                 $stmt->execute();
                 $Component = new Object($stmt->fetch(PDO::FETCH_OBJ));
             } catch (PDOException $e) {
                 $dbh->catchException($e, $stmt->queryString);
                 throw new Exception('EpsilonCMS cannot Load Component DB');
             }
             if ($Component->get('ComponentID')) {
                 $AccessLevels = Factory::getUser()->getAuthorizedLevels();
                 /** Verify if the current user has access to the component */
                 if (!in_array($Component->get('AccessLevelID'), $AccessLevels)) {
                     if (Factory::getUser()->isGuest()) {
                         if (Factory::getApplication()->isCLI()) {
                             Factory::getLogger()->alert(Factory::getLanguage()->_('NOT_AUTHORIZED'));
                         } else {
                             Factory::getApplication()->redirectLogin();
                         }
                     } else {
                         Factory::getApplication()->redirectHome();
                     }
                 }
                 /** Creates the Class|Controller Namespace */
                 $Namespace = '\\Components\\' . $_Component . '\\Controllers\\';
                 /**
                  * If the route contains a controller use that controller
                  * else
                  * use the component name as default controller
                  */
                 if ($_Controller) {
                     $Controller = $_Controller;
                 } else {
                     $Controller = $_Component;
                 }
                 $Class = $Namespace . $Controller;
                 if (!class_exists($Class)) {
                     throw new \Exception("Controller does not exist {$Controller}->{$Action}({$ID})");
                 }
                 $Component = new $Class($dbh, $Component);
                 /** Verify if the method (Action) exist */
                 if (is_callable([$Component, $Action])) {
                     $Component->{$Action}($ID);
                 } else {
                     throw new \Exception("Controller method does not exist {$Controller}->{$Action}({$ID})");
                 }
                 $this->Component = $Component;
             } else {
                 throw new \Exception('Component {' . $_Component . '} does not exist in Database');
             }
         } catch (\Exception $e) {
             Factory::getLogger()->alert('ComponentManagerException: {Message} {File} {Line}', ['Message' => $e->getMessage(), 'File' => $e->getFile(), 'Line' => $e->getLine()]);
         }
     }
     return $this->Component;
 }
Ejemplo n.º 9
0
 /**
  * @param array $Options
  */
 public function __construct($Options = [])
 {
     parent::__construct($Options);
     $this->arRouteMaps = $this->getRouteMaps();
     $this->defaultRouteMap = $this->getDefaultRouteMap();
 }
Ejemplo n.º 10
0
 /**
  * @param      $Results
  * @param      $ElementID
  * @param null $MaxPageSize
  * @return \Epsilon\Object\Object
  */
 public static function foundationListPaging($Results, $ElementID, $MaxPageSize = null)
 {
     $CurrentPage = Input::getVar("CurrentPage", "REQUEST");
     if (is_integer($MaxPageSize)) {
         $PageSize = $MaxPageSize;
     } else {
         $PageSize = Config::MAX_PAGE_SIZE;
     }
     $Paging = new Object(['HTML' => null, 'Init' => 0, 'Max' => $PageSize, 'Results' => 0, 'PageInit' => 0, 'PageMax' => 0, 'TotalPages' => 0, 'TotalResults' => 0]);
     if (is_array($Results)) {
         $TotalResults = count($Results);
     } else {
         if (is_numeric($Results)) {
             $TotalResults = $Results;
         } else {
             $TotalResults = 0;
         }
     }
     if ($TotalResults > 0) {
         $TotalPages = self::getTotalPages($TotalResults, $PageSize);
         if ($CurrentPage > $TotalPages) {
             $CurrentPage = $TotalPages;
         } elseif (!is_numeric($CurrentPage) || !((int) $CurrentPage > 0) || (int) $CurrentPage == 0) {
             $CurrentPage = 1;
         }
         if ($CurrentPage > 1) {
             $Init = ($CurrentPage - 1) * $PageSize;
             $Max = $PageSize;
             $PageInit = ($CurrentPage - 1) * $PageSize + 1;
             $PageMax = $PageInit + $PageSize - 1;
         } else {
             $Init = 0;
             $Max = $PageSize;
             $PageInit = 1;
             $PageMax = $PageInit + $Max - 1;
         }
         if ($PageMax >= $TotalResults) {
             $PageMax = $TotalResults;
         }
         $Pages = self::getPages($CurrentPage, $TotalPages);
         $HTML = "";
         $PreviousSet = false;
         if (is_string($ElementID)) {
             $ElementID = "\"{$ElementID}\"";
         } else {
             $ElementID = "null";
         }
         $eLanguage = Factory::getLanguage();
         $PagesCount = 0;
         foreach ($Pages as $p) {
             $PagesCount++;
             if (!$PreviousSet) {
                 $Previus = $CurrentPage - 1;
                 if ($CurrentPage != 1) {
                     $HTML .= "<ul class=\"pagination text-center\" role=\"navigation\" aria-label=\"Pagination\">\n<li class=\"pagination-previous\"><a href='javascript:goToPage({$Previus}, {$ElementID})'><span class=\"show-for-sr\">page</span> " . $eLanguage->_("LIST-RESULT-PREVIOUS") . "</a></li>\n";
                 } else {
                     $HTML .= "<ul class=\"pagination text-center\" role=\"navigation\" aria-label=\"Pagination\">\n<li class=\"pagination-previous disabled\"><span class=\"show-for-sr\">page</span> " . $eLanguage->_("LIST-RESULT-PREVIOUS") . "</li>\n";
                 }
                 $PreviousSet = true;
             }
             if ($CurrentPage == $p) {
                 $HTML .= "<li class='current'><span class=\"show-for-sr\">You're on page </span > {$p}</li > \n";
             } else {
                 $HTML .= " <li><a href = 'javascript:goToPage({$p},{$ElementID})' > {$p}</a ></li > \n";
             }
             if ($PagesCount == count($Pages)) {
                 $Next = $CurrentPage + 1;
                 if ($CurrentPage != $p) {
                     $HTML .= "<li class=\"pagination-next\"><a aria-label=\"Next page\" href='javascript:goToPage({$Next},{$ElementID})'>" . $eLanguage->_("LIST-RESULT-NEXT") . " <span class=\"show-for-sr\">page</span></a></li></ul>";
                 } else {
                     $HTML .= "<li class=\"pagination-next disabled\"><span class=\"show-for-sr\">page</span>" . $eLanguage->_("LIST-RESULT-NEXT") . "</li>\n</ul>";
                 }
             }
         }
         $Paging->setProperties(['HTML' => $HTML, 'Init' => $Init, 'Max' => $Max, 'Results' => $PageMax - $PageInit + 1, 'PageInit' => $PageInit, 'PageMax' => $PageMax, 'TotalPages' => $TotalPages, 'TotalResults' => $TotalResults]);
     }
     return $Paging;
 }
Ejemplo n.º 11
0
 /**
  * @param array $ApplicationID
  */
 public function __construct($ApplicationID)
 {
     parent::__construct(['ApplicationID' => $ApplicationID]);
     $this->Modules;
     $this->AvailableMenuIDs = [];
 }
Ejemplo n.º 12
0
 /**
  * @param array $Options
  */
 public function __construct($Options = [])
 {
     parent::__construct($Options);
     $this->clearStatics();
 }