Exemple #1
0
 public final function execute()
 {
     /*
      * kontroly funkcii
      */
     //prednastavena hodnota premnnej enabled je false
     if (empty($this->enabled)) {
         $this->enabled = false;
     }
     //zisti ci bola zadana funkcia
     if (empty($_GET['func'])) {
         $this->setMsg(false, "Nebola zadaná žiadna funkcia");
         return;
     }
     //zisti, ci zadana funkcia existuje
     if (empty($this->functions[$_GET['func']])) {
         $this->setMsg(false, "Zadaná funkcia neexistuje");
         return;
     }
     //kontrola identifikatora formulara
     if (!empty($_POST['nonce']) && !Nonce::checkNonce($_POST['nonce'])) {
         $this->setMsg(false, "Neplatný formulár.");
         return;
     }
     //pripojenie na databazu
     $db = CDatabaza::getInstance();
     //zisti, ci sa uskutocnilo spojenie s databazou
     if (empty($db)) {
         $this->setMsg(false, "Spojenie s databázou zlyhalo");
         return;
     }
     //skontoluje, ci je mozne spustit modul
     if (!$this->enabled) {
         $this->setMsg(false, "Nemáte oprávnenie na zmenu záznamov");
         return;
     }
     //spusti vybranu funkciu zvoleneho modulu
     $call = $this->functions[$_GET['func']]['execute'];
     $this->{$call}();
 }