Example #1
0
 protected function reset_password()
 {
     if (empty($_POST['user_id'])) {
         $this->setMsg(false, "Zadajte užívateľa");
         return;
     }
     if (empty($this->users[$_POST['user_id']])) {
         $this->setMsg(false, "Zadaný užívateľ neexistuje");
         return;
     }
     if (empty($_POST['login'])) {
         $this->setMsg(false, "Zadajte prihlasovacie meno užívateľa");
         return;
     }
     if (strcmp($_POST['login'], $this->users[$_POST['user_id']]['login'])) {
         $this->setMsg(false, "Neoprávnená zmena údajov");
         return;
     }
     $data = new DBQuery(CDatabaza::getInstance());
     $data->setTable('Uzivatel');
     $data->setRecord("uzivatel_id", $_POST['user_id'], true);
     $data->setField("heslo", $_POST['login'], true, true);
     if (!$data->queryDB('update')) {
         $this->setMsg(false, "Nepodarilo resetovať heslo.");
         return;
     }
     $this->setMsg(true, "Heslo úspešne zresetované.");
 }
Example #2
0
 protected function setTimeStamp()
 {
     $data = new DBQuery(CDatabaza::getInstance());
     $data->setTable("Clanok");
     $data->setField("casova_znamka", time());
     $data->setRecord("clanok_id", $this->article['id']);
     if (!$data->queryDB("update")) {
         return false;
     }
     return true;
 }
Example #3
0
 private function removePost($post_id)
 {
     if (!$this->postEditable($post_id)) {
         return false;
     }
     $data = new DBQuery(CDatabaza::getInstance());
     $data->setTable("Prispevok");
     $data->setRecord("prispevok_id", $post_id);
     return $data->queryDB("delete");
 }
Example #4
0
 private function initialize()
 {
     $data = new DBQuery(CDatabaza::getInstance());
     //zakladne nastavenie zobrazenia
     $this->orders['theme']['key'] = "tema_id";
     $this->orders['theme']['order'] = "DESC";
     $this->orders['topic']['key'] = "rubrika_id";
     $this->orders['topic']['order'] = "DESC";
     /*nastavi usporiadanie zaznamov v tabulke*/
     //pole zoradienia temy
     if (isset($_GET['theme_key'])) {
         $key = $_GET['theme_key'];
         if (!strcmp($key, 'id')) {
             $this->orders['theme']['key'] = "tema_id";
         } else {
             if (!strcmp($key, 'name')) {
                 $this->orders['theme']['key'] = "nazov_temy";
             }
         }
     }
     //poradie zoradenia temy
     if (isset($_GET['theme_order'])) {
         if (!strcmp($_GET['theme_order'], "ASC")) {
             $this->orders['theme']['order'] = "ASC";
         }
     }
     if (isset($_GET['topic_key'])) {
         $key = $_GET['topic_key'];
         if (!strcmp($key, 'id')) {
             $this->orders['topic']['key'] = "rubrika_id";
         } else {
             if (!strcmp($key, 'name')) {
                 $this->orders['topic']['key'] = "nazov_rubriky";
             } else {
                 if (!strcmp($key, 'theme')) {
                     $this->orders['topic']['key'] = "tema_id";
                 }
             }
         }
     }
     if (isset($_GET['topic_order'])) {
         if (!strcmp($_GET['topic_order'], "ASC")) {
             $this->orders['topic']['order'] = "ASC";
         }
     }
     $data->setTable("Tema");
     $data->setOrder($this->orders['theme']['key'], $this->orders['theme']['order']);
     $themes = $data->queryDB("select");
     while ($theme = $themes->fetch_array()) {
         $id = $theme['tema_id'];
         $name = $theme['nazov_temy'];
         $this->themes[$id]['id'] = $id;
         $this->themes[$id]['name'] = $name;
     }
     $data->setTable("Rubrika");
     $data->setOrder($this->orders['topic']['key'], $this->orders['topic']['order']);
     $topics = $data->queryDB("select");
     while ($topic = $topics->fetch_array()) {
         $id = $topic['rubrika_id'];
         $name = $topic['nazov_rubriky'];
         $theme = $topic['tema_id'];
         $this->topics[$id]['id'] = $id;
         $this->topics[$id]['name'] = $name;
         $this->topics[$id]['theme'] = $theme;
     }
 }
Example #5
0
 private function initialize()
 {
     $data = new DBQuery(CDatabaza::getInstance());
     $data->setTable("Uzivatel_info");
     $data->setRecord("uzivatel_id", $_SESSION['user']);
     $query = $data->queryDB("select");
     if ($query) {
         $usr_nfo = $query->fetch_array();
         $this->user_info['name'] = $usr_nfo['meno'];
         $this->user_info['surname'] = $usr_nfo['priezvisko'];
         $this->user_info['class'] = $usr_nfo['trieda'];
     }
 }
Example #6
0
 private function display_filters()
 {
     $data = new DBQuery(CDatabaza::getInstance());
     echo "<script type='text/javascript'></script>";
     echo "<form id='filters'>";
     echo "<span class='label'>Hľadaj článok: </span><input id='name' type='text' name='nazov' /><br/>";
     echo "<span class='label'>Zverejnené: </span><select id='zverejnit' name='released'>";
     echo "<option value=''>Všetko</option><option value='1'>Áno</option><option value='0'>Nie</option></select> ";
     echo "<span class='label'>Rubrika: </span><select id='rubrika' name='topic'>";
     echo "<option value=''>Všetko</option>";
     $data->setTable('Rubrika');
     $query = $data->queryDB('select');
     while ($rubrika = $query->fetch_array()) {
         echo "<option value='" . $rubrika['rubrika_id'] . "'>";
         echo $rubrika['nazov_rubriky'];
         echo "</option>";
     }
     echo "</select>";
     echo "<span class='label'>Typ: </span><select id='typ' name='type'>";
     echo "<option value=''>Všetko</option>";
     $data->setTable('Typ_clanku');
     $query = $data->queryDB('select');
     while ($typ = $query->fetch_array()) {
         echo "<option value='" . $typ['typ_clanku_id'] . "'>";
         echo $typ['nazov'];
         echo "</option>";
     }
     echo "</select>";
     echo "</form>";
     echo "<div id='article_list'></div id='article_list'>";
     echo "";
     echo "<script type='text/javascript'>";
     echo "function filters_load(){";
     echo "\$('#filters').submit(function(e){e.preventDefault();});";
     echo "filter_manager.set_manager('article_list'," . $this->getProgramID() . ");";
     echo "filter_manager.add('name');";
     echo "filter_manager.add('zverejnit');";
     echo "filter_manager.add('rubrika');";
     echo "filter_manager.add('typ');";
     echo "filter_manager.set_max_page({$this->max_page});";
     echo "filter_manager.apply();}";
     /*
             echo "content='article_list';program=".$this->getProgramID().";";
             echo "apply_filter();";
             echo "add_filter('name');";
             echo "add_filter('zverejnit');";
             echo "add_filter('rubrika');";
             echo "add_filter('typ');}";
     * 
     */
     echo "if(typeof filter_manager!='undefined') filters_load();";
     echo "else scriptloader.load_script('redakcia/scripts/filters.js','js',filters_load);";
     echo "scriptloader.load_script('redakcia/styles/article_list.css','css');";
     echo "scriptloader.load_script('redakcia/styles/topics.css','css');";
     //echo "$('#article_list').load('./request/main.php?id=".$this->getProgramID()."&mode=display');";
     echo "</script>";
 }