summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/class.Forum.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/classes/class.Forum.php')
-rw-r--r--admin/survey/classes/class.Forum.php190
1 files changed, 36 insertions, 154 deletions
diff --git a/admin/survey/classes/class.Forum.php b/admin/survey/classes/class.Forum.php
index a82ea10..88f365f 100644
--- a/admin/survey/classes/class.Forum.php
+++ b/admin/survey/classes/class.Forum.php
@@ -6,8 +6,6 @@ class Forum {
var $currentForum; // Trenutni forum kjer se nahaja user
var $currentThread; // Trenutna tema kjer se nahaja user
var $currentPost; // Trenutni post kjer se nahaja user
-
- var $currentForumNice; // NiceLink trenutnega foruma
var $displayPosts; // 0 zaporedno, 1 nitno, 2 stavcno
var $displayColumn; // 3, 2, 1 - stevilo stolpcev
@@ -34,11 +32,7 @@ class Forum {
$this->currentPost = $p;
$this->uid = $this->uid();
-
- $r = sisplet_query ("SELECT NiceLink FROM forum WHERE id='" .$this->currentForum ."'");
- $rr = mysqli_fetch_row ($r);
- $this->currentForumNice = $rr[0];
-
+
if (isset($_COOKIE['DP'])) {
$this->displayPosts = $_COOKIE['DP'];
} else {
@@ -135,7 +129,8 @@ class Forum {
if ($this->currentPost > 0) {
$parent = $this->currentPost;
- } elseif ($this->currentThread > 0) {
+ }
+ elseif ($this->currentThread > 0) {
$parent = $this->currentThread;
}
@@ -144,23 +139,13 @@ class Forum {
$resu = sisplet_query ("SELECT name FROM users WHERE id='" .$uid ."'");
$ru = mysqli_fetch_row ($resu);
$user = $ru[0];
- } else {
+ }
+ else {
$uid = 0;
$user = $avtor;
}
if ($admin_type == -1 || $global_user_id==0) {
- if (isset($_POST['SessID']) && isset($_POST['prepis'])) {
- // Prepis kode
- $handle = $_POST['SessID'];
- $resultCD = sisplet_query ("SELECT code FROM registers WHERE handle='$handle'");
- $sqlCD = mysqli_fetch_row($resultCD);
-
- if (strtolower ($_POST['prepis']) != strtolower ($sqlCD[0]) || mysqli_num_rows($resultCD)==0)
- die($lang['nu_regp_pict'] .'<br><br><a href="' .$site_url .'">' .$lang['home'] .'</a>');
-
- $vsebina = nl2br($vsebina); // neprijavljeni userji nimajo editorja in se ne nardijo <br>
- } else
die($lang['nu_regp_pict'] .'<br><br><a href="' .$site_url .'">' .$lang['home'] .'</a>');
}
@@ -173,9 +158,11 @@ class Forum {
$sql1 = sisplet_query("SELECT naslov FROM $t WHERE $_id = '$id'");
$row1 = mysqli_fetch_row($sql1);
$vsebina = $lang['news_comment_txt'].' <a href="'.$site_url.'index.php?fl=2&amp;lact=1&amp;bid='.$id.'">'.$row1[0].'</a>';
- } elseif ($new == '-1') { // navigacija
+ }
+ elseif ($new == '-1') { // navigacija
$vsebina = $lang['news_comment_txt'].' <a href="'.$site_url.'index.php?fl=1&amp;nt=9&amp;sid='.$id.'">'.$naslov.'</a>';
- } else { // novice
+ }
+ else { // novice
$t = $this->getTable($new);
$_id = 'sid';
@@ -187,52 +174,16 @@ class Forum {
}
}
- // obvescanje na mail - nov (neprijavljen) user se hoce narocit
- // Sem premaknil gor, da spremenimo ime avtorja preden dodamo post! --may
- if (isset($_POST['alertmail'])) {
+ $admin = isset($_POST['admin']) ? $_POST['admin'] : '';
- if ($_POST['alertmail'] != '') {
- $mail = $_POST['alertmail'];
- $sqla = sisplet_query("SELECT id FROM users WHERE email = '$mail'");
+ if (isset($_POST['admin_override']) && $_POST['admin_override'] == "1")
+ $admin = 0;
- if (mysqli_num_rows($sqla) > 0) {
- $rowa = mysqli_fetch_row($sqla);
- $narocnikID = $rowa[0];
- } else {
+ if (!isset($_POST['admin']))
+ $admin = 3;
- // Preveri ali je vzdevek ze zaseden- ce je, mu dodaj neko stevilko da bo unique
- $a2 = $avtor;
-
- $result = sisplet_query ("SELECT * FROM users WHERE name='$a2' AND surname=''");
- while (mysqli_num_rows ($result) > 0) {
- $a2 = $avtor .rand(0, 32767);
- $result = sisplet_query ("SELECT * FROM users WHERE name='$a2' AND surname=''");
- }
-
- $avtor = $a2;
- $g = base64_encode((hash('SHA256', '' .$pass_salt)));
-
- $sqln = sisplet_query("INSERT INTO users (email, name, when_reg, came_from, pass) VALUES ('" .$_POST['alertmail'] ."', '$avtor', NOW(), '2', '$g')");
- $narocnikID = mysqli_insert_id($GLOBALS['connect_db']);
-
- // Ker je noviregistriran mu dajmo se UID.
- $uid = $narocnikID;
- $user = "";
- }
-
- setcookie("uid", base64_encode ($mail), time()+3600*24*365, "/", $cookie_domain);
- setcookie("secret", base64_encode((hash('SHA256', '' .$pass_salt))), time()+3600*24*365, "/", $cookie_domain);
-
- $sqlaa = sisplet_query("INSERT INTO obvescanje_tema (uid, tid) VALUES ('" .$narocnikID ."', '" .$this->currentThread ."')");
- $sqlaa = sisplet_query("UPDATE post SET uid='" .$narocnikID ."', user='' WHERE id='" .$this->currentPost ."'");
- }
- }
-
- $admin = $_POST['admin'];
- if (isset ($_POST['admin_override']) && $_POST['admin_override'] == "1") $admin = 0;
-
- if (!isset ($_POST['admin'])) $admin = 3;
- if (isset ($_POST['sporocilo']) && !($new != 0 && $id != 0)) $admin = $_POST['sporocilo'];
+ if (isset($_POST['sporocilo']) && !($new != 0 && $id != 0))
+ $admin = $_POST['sporocilo'];
// preveri ce moras nastaviti dispauth
$la = sisplet_query ("SELECT lockedauth FROM forum WHERE id='" .$this->currentForum ."' AND lockedauth=1");
@@ -245,15 +196,6 @@ class Forum {
if (!$sql) $error = mysqli_error($GLOBALS['connect_db']);
$ittdd = mysqli_insert_id($GLOBALS['connect_db']); // tale ID je pomemben na koncu, ker se ga returna na koncu funkcije !
- // Ce je to nova tema, potem naredi link.
- if ($parent == 0) {
- $fnl = sisplet_query ("SELECT NiceLink FROM forum WHERE id='" .$this->currentForum ."'");
- $fnlr = mysqli_fetch_row ($fnl);
- $flink = preg_replace ("/(.*?[^\/])\/\/(.*?[^\/])\/(.*?[^\/])\/(.*?[^\/])\/(.*)/i", "$5", $rnlr[0]);
-
- sisplet_query ("UPDATE post SET NiceLink = '" .$site_url .'thread/' .$this->currentForum .'/' .$ittdd .'/' .$flink .'/' .$naslov .'/' ."' WHERE id='" .$ittdd ."'");
- }
-
// dodaj v index...
$this->setPost($ittdd);
@@ -266,59 +208,6 @@ class Forum {
}
$sql = sisplet_query("UPDATE post SET time2=NOW() WHERE id='".$this->currentThread."'");
-
-
- // obvescanje na mail
- if (isset($_POST['alert'])) {
- $sqlaa = sisplet_query("SELECT * FROM obvescanje_tema WHERE uid='" .$global_user_id ."' AND tid='" .$this->currentThread ."'");
- if (mysqli_num_rows($sqlaa) == 0) {
- $sqla = sisplet_query("INSERT INTO obvescanje_tema (uid, tid) VALUES ('" .$global_user_id ."', '" .$this->currentThread ."')");
- }
- } else {
- $sqlaa = sisplet_query("DELETE FROM obvescanje_tema WHERE uid='" .$global_user_id ."' AND tid='" .$this->currentThread ."'");
- }
-
- // hendlanje skupin - GROUP
- if (isset($_POST['group']) && $_POST['group']!='') {
-
- $group = $_POST['group'];
- $mails = explode("\n", $group);
-
- foreach ($mails as $key => $mail) {
- $mail = trim($mail);
- $sqla = sisplet_query("SELECT id FROM users WHERE email = '$mail'");
-
- if (mysqli_num_rows($sqla) > 0) {
- $rowa = mysqli_fetch_row($sqla);
- $narocnikID = $rowa[0];
- } else {
- $g = base64_encode((hash('SHA256', '' .$pass_salt)));
- $sqln = sisplet_query("INSERT INTO users (email, name, when_reg, camefrom, pass) VALUES ('$mail', '$mail', NOW(), '2', '$g')");
- $narocnikID = mysqli_insert_id($GLOBALS['connect_db']);
- }
-
- $sqlaa = sisplet_query("INSERT INTO obvescanje_tema (uid, tid) VALUES ('$narocnikID', '" .$this->currentThread ."')");
- $sqlaa = sisplet_query("INSERT INTO forum_group (uid, tid) VALUES ('$narocnikID', '" .$this->currentThread ."')");
- }
- $sqlaa = sisplet_query("INSERT INTO forum_group (uid, tid) VALUES ('" .$global_user_id ."', '" .$this->currentThread ."')");
- }
-
- if (isset($_GET['table'])) {
- $this->setTableID($_GET['table']);
- if (isset($_GET['column'])) {
- $this->setColumnID($_GET['column']);
- }
-
- $t = $this->getTable($this->tableID);
- $sqlc = sisplet_query("UPDATE $t SET thread='".$this->currentThread."' WHERE ".($this->tableID<=10?'s':'')."id='".$this->columnID."' AND thread='0'");
- }
- if (!isset($_GET['table']) && isset($_GET['column'])) {
- $sqlc = sisplet_query("UPDATE menu SET thread='" .$this->currentThread ."' WHERE id='" .$_GET['column'] ."'");
- }
- $user_id = $global_user_id;
-
- if ($mail_alert)
- include('alert.php');
}
return $ittdd;
@@ -368,24 +257,33 @@ class Forum {
global $skin_name;
if ($uid > 0) {
- $sql = sisplet_query("SELECT email, name, show_email FROM users WHERE id='$uid'");
+
+ $sql = sisplet_query("SELECT email, name, show_email FROM users WHERE id='$uid'");
$row = mysqli_fetch_row($sql);
- $return = '';
+
+ $return = '';
- if ($link == 1) $return .= '<a href="'.$site_url.'forums/?lact=2&amp;uid='.$uid.'">';
- if ($row[1] != '') {
+ if ($link == 1)
+ $return .= '<a href="'.$site_url.'forums/?lact=2&amp;uid='.$uid.'">';
+
+ if ($row[1] != '') {
$return .= $row[1];
- } elseif ($row[2] == 2) {
+ }
+ elseif ($row[2] == 2) {
$return .= $row[0];
- } else {
+ }
+ else {
$return .= $lang['user2'];
}
+
if ($link == 1) $return .= '</a>';
- return $return;
- } elseif ($user != '') {
+ return $return;
+ }
+ elseif ($user != '') {
return $user;
- } else {
- return $lang['guest'];
+ }
+ else {
+ return $lang['respondent'];
}
}
@@ -404,26 +302,10 @@ class Forum {
}
// Polepsa izpis datuma in ure
- function datetime($time) {
- global $admin_type;
-
- $sql = sisplet_query("SELECT value FROM misc WHERE what='ForumHourDisplay'");
- $row = mysqli_fetch_row($sql);
-
- // Funkcija se klice zelooooo pogosto, zato sem vrgel ven substr in sestavljam rocno, je hitreje.
- if ($row[0] == 0 || $admin_type==0)
- return $time[8] .$time[9] ."." .$time[5] .$time[6] ."." .$time[0] .$time[1] .$time[2] .$time[3] ." " .$time[11] .$time[12] .":" .$time[14] .$time[15];
- else
- return $time[8] .$time[9] ."." .$time[5] .$time[6] ."." .$time[0] .$time[1] .$time[2] .$time[3];
- }
-
- // Polepsa izpis datuma in ure
function datetime1($time) {
global $admin_type;
- $sql = sisplet_query("SELECT value FROM misc WHERE what='ForumHourDisplay'");
- $row = mysqli_fetch_row($sql);
- if ($row[0] == 0 || $admin_type==0)
+ if ($admin_type==0)
return $time[8] .$time[9] ."." .$time[5] .$time[6] ." " .$time[11] .$time[12] .":" .$time[14] .$time[15];
else
return $time[8] .$time[9] ."." .$time[5] .$time[6];