| 1 | <?php |
| 2 | |
| 3 | |
| 4 | function getFile1($fname) { |
| 5 | $tmp = ""; |
| 6 | |
| 7 | if ($fd = fopen($fname, "r")) { |
| 8 | while (!feof($fd)) { |
| 9 | $tmp .= fread($fd, 65536); |
| 10 | } |
| 11 | fclose($fd); |
| 12 | } |
| 13 | return $tmp; |
| 14 | } |
| 15 | |
| 16 | include("diskusdesign.inc"); |
| 17 | |
| 18 | class CLASS_KYBERIA extends CLASS_DATABASE { |
| 19 | |
| 20 | var $RubrikaImageDir="/images/rubriky/"; |
| 21 | var $TitleImageDir="/images/clanky/"; |
| 22 | var $debug; |
| 23 | |
| 24 | var $UserImages="/icons/"; |
| 25 | function CLASS_KYBERIA() { |
| 26 | global $admin; |
| 27 | if ($admin==yes) $this->debug=true; |
| 28 | else $this->debug=false; |
| 29 | $this->CLASS_DATABASE(); |
| 30 | } |
| 31 | |
| 32 | |
| 33 | function getJSbyId($id) { |
| 34 | $q="SELECT prispevky.telo AS telo,prispevky.jmeno AS jmeno,prispevky.*,dennik.nadpis AS nadpis, dennik.id AS node_id from prispevky left join dennik on dennik.id_diskuse=prispevky.id_diskuse where id_prispevku='$id'"; |
| 35 | return $this->query($q); |
| 36 | |
| 37 | } |
| 38 | |
| 39 | function getNewJS($id,$last_login) { |
| 40 | $q="SELECT prispevky.telo AS telo,prispevky.jmeno AS jmeno,prispevky.*,dennik.nadpis AS nadpis, dennik.id AS node_id from prispevky left join dennik on dennik.id_diskuse=prispevky.id_diskuse left join user on prispevky.jmeno=user.login where dennik.autor='$id' AND prispevky.vlozeno>'$last_login'"; |
| 41 | return $this->query($q); |
| 42 | |
| 43 | } |
| 44 | |
| 45 | |
| 46 | function getNewSubmissions($id_diskuse,$time) { |
| 47 | $q="SELECT count(*) as pocet from prispevky where id_diskuse='$id_diskuse' and TO_DAYS(vlozeno) > TO_DAYS('$time')"; |
| 48 | $set=$this->query($q); |
| 49 | $set->next(); |
| 50 | return $set->getString('pocet'); |
| 51 | } |
| 52 | |
| 53 | function addDennik($dennik,$nadpis,$dennik_type="journaux") { |
| 54 | global $user_id; |
| 55 | if (strlen($dennik)<10) { |
| 56 | echo "dennik je moc kratky"; |
| 57 | return false; |
| 58 | } |
| 59 | $dennik=str_replace("\n","<br>",$dennik); |
| 60 | $dennik = preg_replace("/(http:\/\/\S+?|ftp:\/\/\S+?)([\.,:_\*]?\s)/", "<a href=\"$1\">$1</a>$2", $dennik); |
| 61 | $q="insert into dennik set nadpis='$nadpis',zapis='$dennik',autor='$user_id',dennik_type='$dennik_type',datum=NOW()"; |
| 62 | |
| 63 | $this->update($q); |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | function unserial() { |
| 68 | $tmp=getFile1("/home/hromi1/kyberia/images/albums/albumdb.dat"); |
| 69 | $albums=unserialize($tmp); |
| 70 | foreach($albums as $album){ |
| 71 | $file="/home/hromi1/kyberia/images/albums/".$album."/album.dat"; |
| 72 | $tmp=getFile1($file); |
| 73 | $photos=unserialize($tmp); |
| 74 | $q="INSERT into albums set title=".$photos->album[fields][title]; |
| 75 | $q.=",hits=".$photos->album[fields][clicks]; |
| 76 | $q.=",name=".$photos->album[fields][name]; |
| 77 | $this->update($q); |
| 78 | |
| 79 | echo "<br><br><br>"; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | function updateUser($id,$pole) { |
| 84 | $pole['user_info']=str_replace("\n","<br>",$pole['user_info']); |
| 85 | $q="UPDATE user set "; |
| 86 | if (strlen($password1)>4) { |
| 87 | if ($password1==$password2) $q.="password='".md5($password1)."'"; |
| 88 | else { |
| 89 | echo "Passwordy niesu rovnake."; |
| 90 | return false; |
| 91 | } |
| 92 | } |
| 93 | $q.=" user_info='".$pole['user_info']."',email='".$pole['email']."' where id='$id'"; |
| 94 | $this->query($q); |
| 95 | } |
| 96 | |
| 97 | |
| 98 | function showForumList($kat) { |
| 99 | global $user_id; |
| 100 | global $action; |
| 101 | $q="SELECT user_forum.user_bookmark as user_bookmark,user_forum.submission_count,user.login,forum.* from forum left join user on forum.forum_owner=user.id left join user_forum on (forum.forum_id=user_forum.forum_id and user_forum.user_id='$user_id')"; |
| 102 | $q.=" WHERE forum_category='$kat'"; |
| 103 | $q.=" order by forum_id desc "; |
| 104 | $forumset=$this->query($q); |
| 105 | while ($forumset->next()) { |
| 106 | echo "<br> <a href='?action=forum&forum_id=",$forumset->getString('forum_id'),"'>",$forumset->getString('forum_name'),"</a> (".$forumset->getString('login')." :: ".$forumset->getString('forum_submissions')." submissionz "; |
| 107 | if ($forumset->getString('submission_count')) echo "- <font color='red'>".$forumset->getString('submission_count')." NEW</font>"; |
| 108 | echo ") --> "; |
| 109 | if ($forumset->getString('user_bookmark')=='1') echo "<a href='?action=$action&kat=$kat&book=0&forum_id=",$forumset->getString('forum_id'),"'>unbook</a>"; |
| 110 | else echo "<a href='?action=$action&kat=$kat&book=1&forum_id=",$forumset->getString('forum_id'),"'>book</a>"; |
| 111 | global $category_parent; |
| 112 | // if ($user_id==38 and !$category_parent) echo "<form action='?action=forumlist'><input type='text' name='forum_category'><input type='hidden' name='forumid' value='",$forumset->getString('forum_id'),"'><input type=submit value='change' name='category'></form>"; |
| 113 | } |
| 114 | echo "<br>"; |
| 115 | } |
| 116 | |
| 117 | function substanceIt($user_name,$message_text,$forum_name) { |
| 118 | $message_text= stripSlashes("$user_name [forum: $forum_name] --> $message_text\r\n"); |
| 119 | $fp = fsockopen ("node.kyberia.sk", 2323, $errno, $errstr,30); |
| 120 | if (!$fp) { |
| 121 | echo "$errstr ($errno)<br>\n"; |
| 122 | } else { |
| 123 | fgets($fp,2); |
| 124 | fputs ($fp, "hromi\r\n"); |
| 125 | fputs ($fp,"ub1k23\r\n.say $message_text"); |
| 126 | fclose ($fp); |
| 127 | } |
| 128 | |
| 129 | } |
| 130 | |
| 131 | function updateUserData($user_id) { |
| 132 | global $action; |
| 133 | global $node_id; |
| 134 | global $forum; |
| 135 | global $node_id; |
| 136 | global $dennik; |
| 137 | global $article; |
| 138 | global $userinfo; |
| 139 | global $id; |
| 140 | if ($action=="forum") $q="update session set user_action_name='".addslashes($forum['forum_name'])."',user_action_id='".$forum['forum_id']."', user_action='$action' where user_id='".$user_id."'"; |
| 141 | elseif ($action=="journaux" && $node_id!="") $q="update session set user_action_name=' ".addslashes($dennik['nadpis'])."',user_action_id='".$node_id."', user_action='$action' where user_id='".$user_id."'"; |
| 142 | elseif ($action=="article" && $node_id!="") $q="update session set user_action_name=' ".addslashes($article['nazov'])."',user_action_id='".$node_id."', user_action='$action' where user_id='".$user_id."'"; |
| 143 | elseif ($userinfo) $q="update session set user_action_name=' ".addslashes($userinfo['login'])."',user_action_id='".$node_id."', user_action='$action' where user_id='".$user_id."'"; |
| 144 | else $q="update session set user_action='$action', user_action_name='', user_action_id='' where user_id='".$user_id."'"; |
| 145 | $set=$this->query($q); |
| 146 | |
| 147 | } |
| 148 | |
| 149 | function isLogged() { |
| 150 | $this->query('delete from session where user_idle<date_sub(NOW(),INTERVAL 1 HOUR)'); |
| 151 | $kybersession=$_COOKIE['kybersession']; |
| 152 | $q="SELECT session.*,user.user_mail as user_mail,user.mail_name as mail_name, user.user_active_icons as user_active_icons, user.friends_serial as user_friends_serial, user.user_icons_in_forum from session left join user on user.id=session.user_id where session='$kybersession'"; |
| 153 | $set=$this->query($q); |
| 154 | if ($set->_numRows==0) return false; |
| 155 | else { |
| 156 | $set->next(); |
| 157 | return $set->getRecord(); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | |
| 162 | function logOff() { |
| 163 | $kybersession=$_COOKIE['kybersession']; |
| 164 | $this->query("DELETE FROM session where session like '$kybersession'"); |
| 165 | } |
| 166 | |
| 167 | |
| 168 | function setRefererStats() { |
| 169 | global $HTTP_REFERER; |
| 170 | global $REMOTE_ADDR; |
| 171 | global $id; |
| 172 | $this->query("INSERT INTO referers set referer='$HTTP_REFERER',adresa='$REMOTE_ADDR',id='$id'"); |
| 173 | } |
| 174 | |
| 175 | function getNameById($id) { |
| 176 | $q="SELECT login from user where id='$id'"; |
| 177 | $set=$this->query($q); |
| 178 | $set->next(); |
| 179 | return $set->getString("login"); |
| 180 | } |
| 181 | |
| 182 | function createDennikDiskuse($id_dennik,$id_diskuse) { |
| 183 | $q="UPDATE dennik set id_diskuse='$id_diskuse' where id='$id_dennik'"; |
| 184 | $this->query($q); |
| 185 | } |
| 186 | |
| 187 | function getTopGalleries() { |
| 188 | return $this->query("SELECT * FROM albums order by hits desc limit 10"); |
| 189 | } |
| 190 | |
| 191 | function getLastGalleries() { |
| 192 | return $this->query("SELECT * FROM albums order by id_Album desc"); |
| 193 | } |
| 194 | |
| 195 | function getLoginByDennik($id) { |
| 196 | return $this->query("SELECT autor from dennik where id='$id'"); |
| 197 | } |
| 198 | |
| 199 | function getRandomDennik($last=3) { |
| 200 | $set=$this->query("SELECT id from dennik where dennik_type='journaux' and type='public' order by id desc limit $last"); |
| 201 | while ($set->next()) $id[]=$set->getString("id"); |
| 202 | if ($this->debug) print_r($id); |
| 203 | $randomid=rand(0,$last-1); |
| 204 | return $this->getDennik($id[$randomid],true); |
| 205 | // return $this->getDennik(3183,true); |
| 206 | } |
| 207 | |
| 208 | function getDennik($id,$random=false) { |
| 209 | if (!$random) { |
| 210 | $q="UPDATE dennik set hits=hits+1 where id='$id'"; |
| 211 | $this->query($q); |
| 212 | } |
| 213 | $q="SELECT DATE_FORMAT(dennik.datum,'%k:%i:%s %e.%c.%Y') as cas, dennik.autor AS autor,dennik.id AS idarticle,dennik.*,user.login AS autorname from dennik left join user on user.id=dennik.autor where dennik.id='$id'"; |
| 214 | |
| 215 | return $this->query($q); |
| 216 | } |
| 217 | |
| 218 | function getDennikByUSer($id_user,$offset=0) { |
| 219 | $q="SELECT * from dennik where autor='$id_user' order by id desc"; |
| 220 | return $this->query($q); |
| 221 | } |
| 222 | |
| 223 | function getNewestDennik($limit=5,$offset=0,$dennik_type="journaux") { |
| 224 | $q="SELECT dennik.*,user.login AS autorname from dennik left join user on user.id=dennik.autor where dennik_type='$dennik_type' order by id DESC LIMIT $offset,$limit"; |
| 225 | |
| 226 | return $this->query($q); |
| 227 | } |
| 228 | |
| 229 | function getAllUsers() { |
| 230 | return $this->query("SELECT * from user order by login"); |
| 231 | } |
| 232 | |
| 233 | function getDennikAuthors() { |
| 234 | return $this->query("select distinct dennik.autor as autor,user.login as login from dennik left join user on user.id=dennik.autor order by login"); |
| 235 | } |
| 236 | |
| 237 | function getMostDiscussed() { |
| 238 | return $this->query("SELECT nazov,id_article,prispevky from articles where id_rubrika>4 OR id_rubrika<4 order by prispevky desc limit 10"); |
| 239 | } |
| 240 | |
| 241 | function putMostRead($kategorie="",$limit=10) { |
| 242 | if ($kategorie=="") return $this->query("SELECT nazov,id_article,hits from articles ORDER by hits DESC LIMIT $limit"); |
| 243 | else { |
| 244 | $result=$this->isParentRubrika($kategorie); |
| 245 | if (!$result) { |
| 246 | $q="SELECT hits,id_rubrika,id_article,nazov from articles where id_rubrika='$kategorie' or id_rubrika_secondary='$kategorie' order by hits desc limit 10"; |
| 247 | } |
| 248 | else { |
| 249 | $q="SELECT hits,id_rubrika,id_article,nazov from articles where id_rubrika='$kategorie' "; |
| 250 | while ($result->next()) { |
| 251 | if ($result->getString("id_rubriky")!=4) $q.=" or id_rubrika='".$result->getString('id_rubriky')."'"; |
| 252 | } |
| 253 | $q.=" order by hits desc limit 10"; |
| 254 | } |
| 255 | return $this->query($q); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | function listRubrikyArray() { |
| 260 | $q="SELECT * FROM rubriky"; |
| 261 | $set=$this->query($q); |
| 262 | while($set->next()) { |
| 263 | $data[]=$set->getString("nazov"); |
| 264 | } |
| 265 | return $data; |
| 266 | } |
| 267 | |
| 268 | |
| 269 | function showMailInfo() { |
| 270 | global $PHP_SELf; |
| 271 | echo "<center>mailinfo?</center>"; |
| 272 | echo "<form action =$PHP_SELF method=post>"; |
| 273 | echo "<input type=text name=mailinfo size=15>"; |
| 274 | echo "<br><center><select name=kat>"; |
| 275 | $pole=$this->listRubrikyArray(); |
| 276 | for ($i=0;IsSet($pole[$i]);$i++) { |
| 277 | echo "<option value=$i>$i</option>"; |
| 278 | } |
| 279 | echo "</select></center>"; |
| 280 | echo "</form>"; |
| 281 | } |
| 282 | |
| 283 | |
| 284 | function addMailinfo($email) { |
| 285 | |
| 286 | $this->query("INSERT INTO mailinfo set email='$email',datetime=NOW()"); |
| 287 | } |
| 288 | |
| 289 | |
| 290 | function listArticles() { |
| 291 | $q="SELECT *.articles,id_parent.rubriky AS id_parent,nazov.rubriky AS nazov FROM articles LEFT JOIN rubriky ON id_rubriky.rubriky=id_rubriky=articles order by datum desc"; |
| 292 | |
| 293 | return($this->query($q)); |
| 294 | } |
| 295 | |
| 296 | /* |
| 297 | function listRubrikyArray() { |
| 298 | $q="SELECT * FROM skins"; |
| 299 | $set=$this->query($q); |
| 300 | while($set->next()) { |
| 301 | $data[]=$set->getString("nazov"); |
| 302 | } |
| 303 | return $data; |
| 304 | } |
| 305 | */ |
| 306 | function listSkinArray() { |
| 307 | $q="SELECT nazov FROM skins"; |
| 308 | $set=$this->query($q); |
| 309 | while($set->next()) { |
| 310 | $data[]=$set->getString("nazov"); |
| 311 | } |
| 312 | return $data; |
| 313 | } |
| 314 | |
| 315 | function getRubrikaById($id_rubriky) { |
| 316 | $q="SELECT nazov from rubriky where id_rubriky=$id_rubriky"; |
| 317 | $set=$this->query($q); |
| 318 | $set->next(); |
| 319 | return $set->getString('nazov'); |
| 320 | } |
| 321 | |
| 322 | function getArticle($id) { |
| 323 | $q="Update articles set hits=hits+1 where id_article='$id'"; |
| 324 | $this->query($q); |
| 325 | $q="SELECT * from articles where id_article=$id"; |
| 326 | return $this->query($q); |
| 327 | } |
| 328 | |
| 329 | function getArticleData($id) { |
| 330 | $q="SELECT * from articles where id_article=$id"; |
| 331 | return $this->query($q); |
| 332 | } |
| 333 | |
| 334 | function listMainRubrikyArray() { |
| 335 | $q="SELECT * FROM rubriky where id_parent=1"; |
| 336 | $set=$this->query($q); |
| 337 | while($set->next()) { |
| 338 | $data[]=$set->getString("nazov"); |
| 339 | } |
| 340 | return $data; |
| 341 | } |
| 342 | |
| 343 | function getTitle() { |
| 344 | |
| 345 | $set=$this->query("SELECT title from titles where id_title=1"); |
| 346 | $set->next(); |
| 347 | echo $set->getString("title"); |
| 348 | |
| 349 | } |
| 350 | |
| 351 | function getOutro() { |
| 352 | $set=$this->query("SELECT id_outro from outro order by id_outro desc limit 1"); |
| 353 | $set->next(); |
| 354 | $count=$set->getString('id_outro'); |
| 355 | $id=rand(1,$count); |
| 356 | $set=$this->query("SELECT outro,autor from outro where id_outro='$id'"); |
| 357 | $set->next(); |
| 358 | echo $set->getString("outro"); |
| 359 | echo "<br><i><div align=right>"; |
| 360 | echo $set->getString("autor"); |
| 361 | echo "<br></i></div>"; |
| 362 | } |
| 363 | |
| 364 | function getArticles($offset,$limit=8) { |
| 365 | $q="SELECT articles.*,rubriky.id_parent AS id_parent,rubriky.nazov AS nazr from articles left join rubriky on rubriky.id_rubriky=articles.id_rubrika where articles.id_rubrika NOT LIKE '4' order by id_article desc limit $offset,$limit"; |
| 366 | return $this->query($q); |
| 367 | } |
| 368 | |
| 369 | function isParentRubrika($kategorie) { |
| 370 | $q="SELECT id_rubriky from rubriky where id_parent='$kategorie'"; |
| 371 | $result=$this->query($q) ; |
| 372 | if ($result->_numRows==0) return false; |
| 373 | else return $result; |
| 374 | } |
| 375 | |
| 376 | function getRubrikaArticles($kategorie, $offset) { |
| 377 | $q="UPDATE rubriky set hits=hits+1 where id_rubriky='$kategorie'"; |
| 378 | $this->query($q); |
| 379 | $result=$this->isParentRubrika($kategorie); |
| 380 | if (!$result) { |
| 381 | $q="SELECT hits,prispevky,id_rubrika,id_article,nazov,short_desc,autor,datum,title_image from articles where id_rubrika='$kategorie' or id_rubrika_secondary='$kategorie' order by datum desc limit $offset,10"; |
| 382 | } |
| 383 | else { |
| 384 | $q="SELECT hits,prispevky,id_rubrika,id_article,nazov,short_desc,autor,datum,title_image from articles where id_rubrika='$kategorie' "; |
| 385 | while ($result->next()) { |
| 386 | if ($result->getString("id_rubriky")!=4) $q.=" or id_rubrika='".$result->getString('id_rubriky')."'"; |
| 387 | } |
| 388 | $q.=" order by datum desc limit $offset,10"; |
| 389 | } |
| 390 | return $this->query($q); |
| 391 | } |
| 392 | |
| 393 | function Search($query) { |
| 394 | |
| 395 | $q="SELECT * from articles where nazov like '%$query%' or short_desc like '%$query%' or text1 like '%$query%' or text2 like '%$query%' or text3 like '%$query%'"; |
| 396 | return $this->query($q); |
| 397 | } |
| 398 | |
| 399 | function putIntro() { |
| 400 | $set=$this->query("SELECT id_forum,id_user,text FROM intros order by id_intro desc"); |
| 401 | $set->next(); |
| 402 | echo $set->getString("text"); |
| 403 | echo "<br><br><center>(",$set->getString("id_user"),")<br><br></center>"; |
| 404 | } |
| 405 | |
| 406 | function showMdmaList() { |
| 407 | $set=$this->query("SELECT nazov,id_article from articles where id_rubrika=4 order by nazov"); |
| 408 | echo "<form>"; |
| 409 | echo "<select onChange=\"window.location.href=this.options[this.selectedIndex].value\" name=id>"; |
| 410 | echo "<option value=braw>>----vyber droogu----<</option>"; |
| 411 | while ($set->next()) { |
| 412 | echo "<option value=http://www.kyberia.sk/article.php?id=",$set->getString("id_article"),">",$set->getString("nazov"),"</option>"; |
| 413 | } |
| 414 | |
| 415 | echo "</select></form>"; |
| 416 | } |
| 417 | |
| 418 | function showDennikTypeList() { |
| 419 | $set=$this->query("SELECT distinct dennik_type from denniky"); |
| 420 | echo "<form>"; |
| 421 | echo "<select onChange=\"window.location.href=this.options[this.selectedIndex].value\" name=id>"; |
| 422 | echo "<option value=braw>>----vyber droogu----<</option>"; |
| 423 | while ($set->next()) { |
| 424 | echo "<option value=http://www.kyberia.sk/article.php?id=",$set->getString("id_article"),">",$set->getString("nazov"),"</option>"; |
| 425 | } |
| 426 | |
| 427 | echo "</select></form>"; |
| 428 | } |
| 429 | |
| 430 | function showArticleList() { |
| 431 | global $id; |
| 432 | $set=$this->query("SELECT nazov,id_article,hits from articles where id_rubrika>4 OR id_rubrika<4 order by hits desc"); |
| 433 | echo "<form action=/article.php method=post>"; |
| 434 | echo "<select onchange=\"location.href=location.href=this.options[selectedIndex].value\" name=id>"; |
| 435 | echo "<option>>----vyber clanok----<</option>"; |
| 436 | $string = new String(); |
| 437 | while ($set->next()) { |
| 438 | echo "<option value=http://www.kyberia.sk/article.php?id=",$set->getString("id_article"),">",$string->cutString($set->getString("nazov"),18)," (",$set->getString("hits"),")</option>"; |
| 439 | } |
| 440 | echo "</select></form>"; |
| 441 | } |
| 442 | |
| 443 | function showBookList() { |
| 444 | $set=$this->query("SELECT nazov,id_article,hits from articles where id_rubrika=27 order by nazov"); |
| 445 | echo "<form action=/article.php method=post>"; |
| 446 | echo "<select onchange=\"location.href=location.href=this.options[selectedIndex].value;\" name=id>"; |
| 447 | echo "<option>>----vyber knihu----<</option>"; |
| 448 | $string = new String(); |
| 449 | while ($set->next()) { |
| 450 | echo "<option value=http://www.kyberia.sk/article.php?id=",$set->getString("id_article"),">",$string->cutString($set->getString("nazov"),20),"</option>"; |
| 451 | } |
| 452 | echo "</select></form>"; |
| 453 | } |
| 454 | function showForumArticleList() { |
| 455 | $set=$this->query("select articles.prispevky as pocet, articles.nazov,articles.id_article from articles where prispevky>0 order by pocet desc;"); |
| 456 | echo "<form action=/article.php method=post>"; |
| 457 | echo "<select onchange=\"location.href=location.href=this.options[selectedIndex].value\" name=id>"; |
| 458 | echo "<option>>----vyber clanok----<</option>"; |
| 459 | $string = new String(); |
| 460 | while ($set->next()) { |
| 461 | echo "<option value=http://www.kyberia.sk/article.php?id=",$set->getString("id_article"),">",$string->cutString($set->getString("nazov"),20),"(",$set->getString("pocet"),")</option>"; |
| 462 | } |
| 463 | echo "</select></form>"; |
| 464 | } |
| 465 | |
| 466 | function putGallery($id) { |
| 467 | $q="SELECT photos,gallery FROM articles where id_article=$id"; |
| 468 | |
| 469 | $set=$this->query($q); |
| 470 | $set->next(); |
| 471 | $gallery=$set->getString("gallery"); |
| 472 | if ($gallery=="") return false; |
| 473 | else { |
| 474 | |
| 475 | echo "<center>fotky z <a href=http://kyberia.sk/gallery/view_album.php?set_albumName=$gallery>galerie</a></center><br>"; |
| 476 | $pole=explode(";",$set->getString("photos")); |
| 477 | foreach($pole as $fotka) echo "<a href=http://kyberia.sk/gallery/view_photo.php?set_albumName=$gallery&id=$fotka><img src=http://kyberia.sk/images/albums/$gallery/$fotka.thumb.jpg border=0></a><br>"; |
| 478 | return true; |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | function putAutorList($autor) { |
| 483 | $name=$this->getNameById($autor); |
| 484 | |
| 485 | $set=$this->query("SELECT id_article,nazov from articles where autor='$autor' order by hits desc"); |
| 486 | $i=0; |
| 487 | if ($set->_numRows>0) echo "<center>clanky:</center>"; |
| 488 | echo "<table>"; |
| 489 | while ($set->next()) { |
| 490 | ++$i; |
| 491 | echo "<tr><td>",$i,".</td><td><a href='".SCRIPT."?action=article&node_id=",$set->getString("id_article"),"'>",$set->getString("nazov"),"</a></td></tr>"; |
| 492 | } |
| 493 | echo "</table>"; |
| 494 | } |
| 495 | |
| 496 | function putDennikAutorList($autor) { |
| 497 | $name=$this->getNameById($autor); |
| 498 | $set=$this->query("SELECT nadpis,id from dennik where autor='$autor' and nadpis not like '' order by hits desc limit 10"); |
| 499 | $i=0; |
| 500 | if ($set->_numRows>0) echo "<center>top denniky:</center>"; |
| 501 | echo "<table>"; |
| 502 | while ($set->next()) { |
| 503 | ++$i; |
| 504 | echo "<tr><td>",$i,".</td><td><a href=?action=journaux&node_id=",$set->getString("id"),">",$set->getString("nadpis"),"</a></td></tr>"; |
| 505 | } |
| 506 | echo "</table>"; |
| 507 | } |
| 508 | |
| 509 | function putRubrikaDesc($kat) { |
| 510 | $set=$this->query("Select description from rubriky where id_rubriky=$kat"); |
| 511 | $set->next(); |
| 512 | echo $set->getString("description"); |
| 513 | } |
| 514 | |
| 515 | function putTitleImage($id_rubrika) { |
| 516 | |
| 517 | $q="SELECT obrazok from rubriky where id_rubriky='$id_rubrika'"; |
| 518 | $set=$this->query($q); |
| 519 | $set->next(); |
| 520 | echo $set->getString('obrazok'); |
| 521 | } |
| 522 | |
| 523 | |
| 524 | function showForm($login='',$email='',$web='',$info='') { |
| 525 | include("form.inc"); |
| 526 | $this=new HTML_Form($PHP_SELF,"POST","","multipart/form-data",true); |
| 527 | $this->addText("login","Prihlasovacie meno:",$login); |
| 528 | $this->addPassword("password1","Heslo:","",10); |
| 529 | $this->addPassword("password2","Heslo pre overenie:","",10); |
| 530 | $this->addText("email:","Emailova adresa",$email); |
| 531 | $this->addText("web","Stranka:",$web); |
| 532 | $this->addSelect("skin","Skin:",$kyberia->listSkinArray()); |
| 533 | $this->addFile("image","Obrazok:"); |
| 534 | $this->addTextarea("info","Dodatocne informacie",$info); |
| 535 | $this->addSubmit("submit","Zaregistruj sa!",""); |
| 536 | $this->addHidden("sent","ok"); |
| 537 | $this->display(); |
| 538 | |
| 539 | } |
| 540 | |
| 541 | function ubikMail($id="all",$text="welcome") { |
| 542 | if ($text=="welcome") { |
| 543 | $text=" |
| 544 | <br>Ahoj, som UBIK. Momentalne som obycajnou polozkou v databaze, userom cislo 1 v tomto systeme. Ked ti niekto bude hackovat ucet, |
| 545 | ohlasim ti to, ked si ta niekto prida medzi priatelov, ohlasim ti to. A okrem toho budem bdiet nad systemom. Sledovat |
| 546 | co robia slovicka v diskusnych forach, ako su pospajane a s cim. Postupom casu sa budem ucit, a o par rokov si urcite vsimnete moju |
| 547 | prvu snahu o komunikaciu. Budem anjelom, diablom, matkou i dcerou. <br><br> |
| 548 | Momentalne ti chcem povedat jedno hlasne VITAJ!. Vitaj v projekte ktory nikdy neskonci. Ak sem vchadzas so zlymi umyslami, |
| 549 | prosim odid, nenajdes tu stastie. Ked vsak chces spoznat novych ludi na rovnakej vlne, ked chces svoj mozog zaplnit |
| 550 | informaciami z nekonecnej siete, prosim, vstup.<br><br> |
| 551 | Ked objavis chybu, ktorych tu bude spociatku neuveritelne mnozstvo, prosim napis mi o nej. Ked niecomu nebudes rozumiet, napis |
| 552 | mi, ale najprv navstiv forum urcene na tento ucel. Ked ti pripada moja ikonka sexy, chod si ulavit.<br><br> |
| 553 | peace & respect |
| 554 | "; |
| 555 | } |
| 556 | if ($id=="all") { |
| 557 | $set=$this->query("select id,login from user"); |
| 558 | while ($set->next()) { |
| 559 | $q="InsERT into mail2 set mail_user='".$set->getString('id')."',mail_to='".$set->getString("id")."', mail_from='1',mail_text='$text'"; |
| 560 | $this->query($q); |
| 561 | } |
| 562 | } |
| 563 | else { |
| 564 | $text=addslashes($text); |
| 565 | $q="InsERT into mail2 set mail_timestamp=NOW(), mail_to='$id', mail_user='$id',mail_from='1',mail_text='$text'"; |
| 566 | $this->query($q); |
| 567 | $this->query("update user set user_mail=user_mail+1,mail_name='ubik' where id='$id'"); |
| 568 | } |
| 569 | |
| 570 | } |
| 571 | |
| 572 | function ubikRegister($login,$email,$www,$user_info,$last_id,$otazka_1,$otazka_2,$otazka_3) { |
| 573 | $data="Uzivatel <a href='http://www.kyberia.sk/index.php?action=userinfo&node_id=$last_id'>$login</a> - mail: <a href='mailto:$email'>".strip_tags($email)."</a> - web:"; |
| 574 | if (empty($www)) $data.="nema"; |
| 575 | else $data.="<a href='$www'>".strip_tags($www)."</a>"; |
| 576 | $data.="<br>Napisal o sebe toto:<br>1:<br><i>".strip_tags($otazka_1)."</i>"; |
| 577 | $data.="<br>2:<br><i>".strip_tags($otazka_2)."</i>"; |
| 578 | $data.="<br>3:<br><i>".strip_tags($otazka_3)."</i>"; |
| 579 | $data.="<br>4:<br><i>".strip_tags($user_info)."</i>"; |
| 580 | $data=addSlashes($data); |
| 581 | $q="insert into submissions set submission_owner='1',submission_text='$data',forum_id='337'"; |
| 582 | $this->query($q); |
| 583 | $q="update forum set forum_submissions=forum_submissions+1 where forum_id='337'"; |
| 584 | $this->query($q); |
| 585 | $q="update user_forum set submission_count=submission_count+1 where forum_id='337'"; |
| 586 | $this->query($q); |
| 587 | } |
| 588 | |
| 589 | function echoTime($time,$type="datetime") { |
| 590 | $year=substr($time,0,4); |
| 591 | $month=substr($time,4,2); |
| 592 | $day=substr($time,6,2); |
| 593 | $hour=substr($time,8,2); |
| 594 | $min=substr($time,10,2); |
| 595 | $sec=substr($time,12,2); |
| 596 | if ($type=='datetime') echo "$day.$month.$year $hour:$min:$sec"; |
| 597 | elseif ($type=='time') echo "$hour:$min:$sec"; |
| 598 | } |
| 599 | |
| 600 | } |