public function main() { if (\helper\StringHelper::isNull($this->callback)) { throw new \Exception('Callback is required'); } if (!isset($_POST['exec'])) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, array('exec' => 'true')); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = trim(curl_exec($curl)); echo $result; curl_close($curl); } else { \core\Logger::info('start'); \helper\ReflectionHelper::getMethodResultFromInstance($this, $this->callback); \core\Logger::info('stop'); } }
public function destroy($key) { if (\helper\StringHelper::isNull($key)) { throw new \Exception('$key is null'); } if (isset($_SESSION[$key])) { unset($_SESSION[$key]); } }
private function controlAccess($routeRole) { $sessionRoles = SessionManager::getInstance()->getValue(SessionManager::USER_ROLE); $routeRoles = explode('|', $routeRole); $allowed = false; if (isset($sessionRoles) && isset($routeRoles)) { $sessionRoles = explode('|', $sessionRoles); foreach ($routeRoles as $role) { if (in_array($role, $sessionRoles)) { $allowed = true; break; } } } if (!$allowed && !\helper\StringHelper::isNull(Config::LOGIN)) { $aux = explode('.', Config::LOGIN); $this->redirect($this->findRoute($aux[0], $aux[1]), \core\Messages::RESTRICTED_AREA); exit; } }