public function __construct() { if (!isset($_SESSION['user'])) { return; } $user = $_SESSION['user']; $hasInfo = true; //ziska informacie z databazy $data = CDatabaza::getInstance(); $data->connect(); $rights = new UserRights($data); //ziska uzivatelske prava if (mysqli_num_rows($data->query("SELECT * FROM Uzivatel_info WHERE uzivatel_id={$user}")) == 0) { $hasInfo = false; } $data->close(); //prida polia hlavneho menu na zaklade uzivatelskych prav $this->addItem("Domov", ProgramManager::getId("Intro")); if ($hasInfo) { $this->addItem("Môj profil", ProgramManager::getId("User_info")); } if ($rights->approved('EDIT_USERS')) { $this->addItem("Užívatelia", ProgramManager::getId("Users")); } if ($rights->approved('EDIT_ENUMS')) { $this->addItem("Rubriky", ProgramManager::getId("Topics")); } $this->addItem("Články", ProgramManager::getId("Article_list")); //$this->addItem("Príspevky", 0); //$this->addItem("Nastavenia", 0); //$this->addItem("Odhlásiť","?id=".ProgramManager::getId("Login")."&func=logout",0); $this->displayed = true; }
function setClassName() { $className = "Intro"; if (isset($_GET['id'])) { $className = ProgramManager::getProgramName($_GET['id']); } if (!$className) { $className = "Intro"; } ProgramManager::includeProgram($className); return $className; }
public function display() { echo "<div id='main'>"; $this->displayErrorMsg(); $this->display_member_list(); echo "<div id='door'><img src='images/door.jpg'></div>"; echo "<div id='label'>Redakcia internetového časopisu</div>"; //display login form echo "<div id='login' name='login' style='login'>"; echo "<form method='post' action='./login.php?func=login'>"; echo "<input type='hidden' name='id' value='" . ProgramManager::getId("Login") . "'/>"; echo "<input type='hidden' name='func' value='login'/>"; echo "<span style='font-size:25px'>Nepovolaným vstup zákazaný!!!</span></br></br>"; echo "<i>Prihlasovacie meno:</i></br>"; echo "<input name='usr_name' type='text'/></br>"; echo "<i>Heslo:</i></br>"; echo "<input name='psswd' type='password'/></br></br>"; echo "<input style='font-family:DesyrelRegular' type='submit' value='Vstúpiť'/>"; echo "</form></div></div>"; }
protected function getProgramID() { return ProgramManager::getId("Users"); }
protected function displayBackButton() { $func = "nastavProgram({id:" . ProgramManager::getId("Article_list") . "});"; echo "<li onclick=\"" . $func . "\">Späť na články</li>"; }
protected function getProgramID() { return ProgramManager::getId("Article_post"); }
private function createThumbFile($url, $width, $height) { $path = ProgramManager::getHomeDir() . "/../" . $url; if (!file_exists(dirname($path) . "/thumbs")) { mkdir(dirname($path) . "/thumbs"); chmod(dirname($path) . "/thumbs", 0777); } else { chmod(dirname($path) . "/thumbs", 0777); } if (!file_exists($path)) { return null; } //get extention index $filename = basename($url); $extIndex = strrpos($filename, "."); //creates path to thumb file $thumbUrl = dirname($url) . "/thumbs/" . substr($filename, 0, $extIndex) . "_thumb.png"; $thumbPath = ProgramManager::getHomeDir() . "/../" . $thumbUrl; if (file_exists($thumbPath)) { chmod($thumbPath, 0777); return $thumbUrl; } //create source image $src_image = $this->getImage($path); if ($src_image == null) { return null; } //get size of source image $srcSize = getimagesize($path); //create thumb image $dest_image = $this->getThumb($src_image, $srcSize[0], $srcSize[1], $width, $height); //save thumb image as png file $file = fopen($thumbPath, "w"); fclose($file); chmod($thumbPath, 0777); imagepng($dest_image, $thumbPath); imagedestroy($src_image); imagedestroy($dest_image); //return path to new thumb file return $thumbUrl; }
protected function getProgramID() { return ProgramManager::getId("Article_interview"); }
private function getProgram($id) { switch ($id) { case 1: return ProgramManager::getId("Article_story"); case 2: return ProgramManager::getId("Article_interview"); case 3: return ProgramManager::getId("Article_post"); case 4: return ProgramManager::getId("Article_quiz"); case 5: return ProgramManager::getId("Article_galery"); } }
private function display_show() { echo ""; $path = ProgramManager::getHomeDir() . "/../articles/" . $this->article['id'] . "/" . $this->article['id'] . ".art"; $article = fopen($path, "r"); echo "<div style='text-align:left'>"; if (!$article) { echo "Prazdy clanok"; } else { while (!feof($article)) { echo fgets($article); } fclose($article); } echo "</div>"; }