/** * @param string $URI */ public function parse($URI) { $parts = parse_url($URI); $this->Scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : null; $this->Host = isset($parts['host']) ? $parts['host'] : null; $this->Path = isset($parts['path']) ? $parts['path'] : null; $this->Query = isset($parts['query']) ? $parts['query'] : null; $this->Fragment = isset($parts['fragment']) ? $parts['fragment'] : null; $this->InversePath = Input::getVar('r', Input::GET); if (Config::PRETTY_URL && !$this->InversePath) { $this->InversePath = strpos($this->Path, 'index.php') ? substr($this->Path, strpos($this->Path, 'index.php') + 9, strlen($this->Path)) : $this->Path; } }
public function Authenticate() { $Credentials = Input::getVar('Login', 'POST'); $Authentication = false; $this->setLanguageFile(); if (count($Credentials) == 2 && isset($Credentials['Email']) && isset($Credentials['Password'])) { if (Factory::getUser()->authenticate($Credentials['Email'], $Credentials['Password'], true)) { $Authentication = true; } } if ($Authentication) { Factory::getApplication()->redirectHome(); } else { SystemMessage::addMessage('COM_AUTHENTICATION', SystemMessage::MSG_ERROR, 'COM_LOGIN-FAILED'); if (isset($Credentials['Email'])) { Factory::getApplication()->redirect('Authentication/Login/', ['Login[Email]' => $Credentials['Email']]); } else { Factory::getApplication()->redirectLogin(); } } }
/** * @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; }
/** * @return mixed */ public static function getInstance() { if (!isset(self::$Instance)) { $dbh = Factory::getDBH(); if (Input::getVar('TemplateID', 'REQUEST')) { $TemplateID = Input::getVar('TemplateID', 'REQUEST'); } elseif (Factory::getCookie()->get('TemplateID')) { $TemplateID = Factory::getCookie()->get('TemplateID'); } else { $TemplateID = null; } if ($TemplateID) { $stmt = $dbh->prepare('SELECT * FROM Template WHERE TemplateID = :TemplateID AND ApplicationID = :AppID'); try { $stmt->bindValue(':AppID', Factory::getApplication()->getApplicationID(), PDO::PARAM_STR); $stmt->bindValue(':TemplateID', $TemplateID, PDO::PARAM_INT); $stmt->execute(); $rst = $stmt->fetch(PDO::FETCH_OBJ); if (is_object($rst)) { $Class = $rst->Template; self::$Instance = new $Class($dbh, $rst); } else { unset($rst); } } catch (PDOException $e) { $dbh->catchException($e, $stmt->queryString); } } if (!self::$Instance instanceof Template) { $stmt = $dbh->prepare('SELECT * FROM Template WHERE ApplicationID = :AppID AND Root = 1'); $stmt->bindValue(':AppID', Factory::getApplication()->getApplicationID(), PDO::PARAM_STR); try { $stmt->execute(); $rst = $stmt->fetch(PDO::FETCH_OBJ); if (is_object($rst)) { $Class = "Templates\\{$rst->Template}\\{$rst->Template}"; self::$Instance = new $Class($dbh, $rst); } } catch (PDOException $e) { $dbh->catchException($e, $stmt->queryString); } if (!self::$Instance) { Factory::getLogger()->emergency('No Template found in Database exiting...'); } } } return self::$Instance; }
/** * @return Language */ public static function getInstance() { if (!isset(self::$Instance)) { $dbh = Factory::getDBH(); $ApplicationID = Factory::getApplication()->getApplicationID(); $Session = Factory::getSession(); $LanguageID = null; if (Input::getVar('LanguageID', 'REQUEST')) { $LanguageID = Input::getVar('LanguageID', 'REQUEST'); } elseif ($Session->get('LanguageID')) { $LanguageID = $Session->get('LanguageID'); } if ($LanguageID) { $stmt = $dbh->prepare('SELECT * FROM Language WHERE ApplicationID = :AppID AND LanguageID = :LangID'); try { $stmt->bindValue(':AppID', $ApplicationID, PDO::PARAM_STR); $stmt->bindValue(':LangID', $LanguageID, PDO::PARAM_INT); $stmt->execute(); $rst = $stmt->fetch(PDO::FETCH_OBJ); if (is_object($rst)) { self::$Instance = new Language($dbh, $rst); } else { unset($rst); } } catch (PDOException $e) { $dbh->catchException($e, $stmt->queryString); } } if (!self::$Instance instanceof Language) { $stmt = $dbh->prepare('SELECT * FROM Language WHERE ApplicationID = :AppID AND Root = 1'); try { $stmt->bindValue(':AppID', $ApplicationID, PDO::PARAM_STR); $stmt->execute(); $rst = $stmt->fetch(PDO::FETCH_OBJ); if (is_object($rst)) { self::$Instance = new Language($dbh, $rst); } else { Factory::getLogger()->emergency('No Language found in Database exiting...'); } } catch (PDOException $e) { $dbh->catchException($e, $stmt->queryString); } } if (self::$Instance instanceof Language && !$Session->get('LanguageID') || self::$Instance->get('ID') != $Session->get('LanguageID')) { $Session->set('LanguageID', self::$Instance->get('ID')); Factory::getSession()->set('Language', null); } else { $Language = Factory::getSession()->get('Language'); if (is_array($Language)) { if (isset($Language['arImportedFiles'])) { self::$Instance->set('arImportedFiles', $Language['arImportedFiles']); } if (isset($Language['arStrings'])) { self::$Instance->set('arStrings', $Language['arStrings']); } } } } return self::$Instance; }