From ac3bdc7218ef24f47f2d6adaae65c59079900665 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Mon, 6 Dec 2010 01:48:55 +0100 Subject: [PATCH] small events cleanup --- data/templates/own_templates/1549839.tpl | 4 +- wwwroot/inc/eventz/F.inc | 1 + wwwroot/inc/eventz/banlist.inc | 2 +- wwwroot/inc/eventz/book.inc | 27 +++++----- wwwroot/inc/eventz/bookstyl.inc | 4 +- wwwroot/inc/eventz/debugging.inc | 5 +- wwwroot/inc/eventz/destroy_synapse.inc | 10 ++-- wwwroot/inc/eventz/executorlist.inc | 44 +++++++-------- wwwroot/inc/eventz/get_templates.inc | 17 +++--- wwwroot/inc/eventz/k_wallet.inc | 4 +- wwwroot/inc/eventz/modules.inc | 10 ---- wwwroot/inc/eventz/spamuj_ubik.inc | 6 ++- wwwroot/inc/eventz/uprav_zaregistrovanych.inc | 9 +--- wwwroot/inc/eventz/verify.inc | 3 +- wwwroot/inc/eventz/vote.inc | 53 ++++++++++--------- wwwroot/inc/eventz/vycisti_registracky.inc | 1 + 16 files changed, 95 insertions(+), 105 deletions(-) delete mode 100644 wwwroot/inc/eventz/modules.inc diff --git a/data/templates/own_templates/1549839.tpl b/data/templates/own_templates/1549839.tpl index bc7f35b..66a060e 100644 --- a/data/templates/own_templates/1549839.tpl +++ b/data/templates/own_templates/1549839.tpl @@ -28,7 +28,7 @@ {*/if*} - + {* put.Ty hack *} {if $child.synapse_creator neq ''} @@ -39,7 +39,7 @@ {*end of put.Ty hack *} - +
 {$child.login} diff --git a/wwwroot/inc/eventz/F.inc b/wwwroot/inc/eventz/F.inc index 6e5ec5c..1ddf3a3 100644 --- a/wwwroot/inc/eventz/F.inc +++ b/wwwroot/inc/eventz/F.inc @@ -7,6 +7,7 @@ $kset=$db->query("select user_k from users where user_id='$user_id'"); $kset->next(); $user_k=$kset->getString('user_k'); +// XXX hard-coded $senat_id = 876611; $K_id = 1961061; $comms = getCommanders($K_id); diff --git a/wwwroot/inc/eventz/banlist.inc b/wwwroot/inc/eventz/banlist.inc index d817840..b806cb1 100644 --- a/wwwroot/inc/eventz/banlist.inc +++ b/wwwroot/inc/eventz/banlist.inc @@ -8,7 +8,7 @@ if ($node['node_permission']!=('owner' || 'master' || 'op')) { $error=$error_messages['EVENT_PERMISSION_ERROR']; return false; } - $bans=explode(";",$_POST['bans']); + $bans=explode(";",$_POST['bans']); // XXX sqli? $db->query("update node_access set node_permission='' where node_id=$node_id and node_permission='ban'"); foreach ($bans as $ban) { diff --git a/wwwroot/inc/eventz/book.inc b/wwwroot/inc/eventz/book.inc index d223a7e..292bd77 100644 --- a/wwwroot/inc/eventz/book.inc +++ b/wwwroot/inc/eventz/book.inc @@ -1,18 +1,21 @@ update($q); - if (!$result) { - $q="insert into neurons set synapse_created=NOW(),dst='".$_SESSION['user_id']."',src='".$node['node_id']."',synapse_creator='".$_SESSION['user_id']."',link='bookmark'"; - $db->query($q); - } - $q="update node_access set node_bookmark='yes' where user_id='".$_SESSION['user_id']."' and node_id='".$node['node_id']."'"; - $result=$db->query($q); - $_SESSION['bookmarks'][$node['node_id']]=$node['node_name']; -return true; +function book() { + global $db,$error,$node; + + $q="update neurons set link='bookmark',synapse_creator='".$_SESSION['user_id']."',synapse=synapse+1 where dst='".$_SESSION['user_id']."' and src='".$node['node_id']."'"; + $result=$db->update($q); + if (!$result) { + $q="insert into neurons set synapse_created=NOW(),dst='".$_SESSION['user_id']."',src='".$node['node_id']."',synapse_creator='".$_SESSION['user_id']."',link='bookmark'"; + $db->query($q); } + $q="update node_access set node_bookmark='yes' where user_id='".$_SESSION['user_id']."' and node_id='".$node['node_id']."'"; + $result=$db->query($q); + + $_SESSION['bookmarks'][$node['node_id']]=$node['node_name']; + + return true; +} ?> diff --git a/wwwroot/inc/eventz/bookstyl.inc b/wwwroot/inc/eventz/bookstyl.inc index e9b3456..6398b87 100644 --- a/wwwroot/inc/eventz/bookstyl.inc +++ b/wwwroot/inc/eventz/bookstyl.inc @@ -3,7 +3,7 @@ global $error,$node,$db; $user_id = $_SESSION['user_id']; - $bookstyl = $_POST['bookstyl']; + $bookstyl = $_POST['bookstyl']; //XXX sqli $set=$db->query("select * from nodes where node_parent=19 and external_link='session://bookstyl' and node_creator='$user_id'"); if($set->getNumRows() == 0) { @@ -27,4 +27,4 @@ $_SESSION['bookstyl']= $bookstyl; } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/debugging.inc b/wwwroot/inc/eventz/debugging.inc index 6a1de8f..ff834ec 100644 --- a/wwwroot/inc/eventz/debugging.inc +++ b/wwwroot/inc/eventz/debugging.inc @@ -3,7 +3,8 @@ // XXX permision check? function debugging() { -if ($_SESSION['debugging']) unset($_SESSION['debugging']); -else $_SESSION['debugging']=true; + if ($_SESSION['debugging']) unset($_SESSION['debugging']); + else $_SESSION['debugging']=true; } + ?> diff --git a/wwwroot/inc/eventz/destroy_synapse.inc b/wwwroot/inc/eventz/destroy_synapse.inc index 8b0410b..f1e66db 100644 --- a/wwwroot/inc/eventz/destroy_synapse.inc +++ b/wwwroot/inc/eventz/destroy_synapse.inc @@ -28,15 +28,13 @@ $db->update($q); //echo $q; } }else{ -global $error; -$error="Nemas pravomoci na vykonanie daneho skutku....viac ku tomu nemam co dodat:-)"; -return false; + global $error; + $error="Nemas pravomoci na vykonanie daneho skutku...."; + return false; } - - } return true; -}?> \ No newline at end of file +}?> diff --git a/wwwroot/inc/eventz/executorlist.inc b/wwwroot/inc/eventz/executorlist.inc index 8a0714f..04231bb 100644 --- a/wwwroot/inc/eventz/executorlist.inc +++ b/wwwroot/inc/eventz/executorlist.inc @@ -1,32 +1,32 @@ query("update node_access set node_permission='' where - node_id=$node_id and node_permission='exec'"); - foreach ($executors as $execitpr) { - $set=$db->query("select user_id from users where login='$executor'"); - $set->next(); - if ($set->getString('user_id')) { - $q="update node_access set node_permission='exec' where node_id=$node_id and + $executors=explode(";",$_POST['executorlist']); // XXX sqli + $db->query("update node_access set node_permission='' where + node_id=$node_id and node_permission='exec'"); + foreach ($executors as $execitpr) { + $set=$db->query("select user_id from users where login='$executor'"); + $set->next(); + if ($set->getString('user_id')) { + $q="update node_access set node_permission='exec' where node_id=$node_id and user_id='".$set->getString('user_id')."'"; - $changed=$db->update($q); - if (!$changed) { - $q="insert into node_access set + $changed=$db->update($q); + if (!$changed) { + $q="insert into node_access set node_permission='exec',node_id=$node_id,user_id=".$set->getString('user_id'); - $db->query($q); - $logger::log('add exec',$node_id,'ok',$executor); + $db->query($q); + $logger::log('add exec',$node_id,'ok',$executor); - } } - else { $error .= "$executor does not exist..."; } } + else { $error .= "$executor does not exist..."; } } +} ?> diff --git a/wwwroot/inc/eventz/get_templates.inc b/wwwroot/inc/eventz/get_templates.inc index 1279691..391bf75 100644 --- a/wwwroot/inc/eventz/get_templates.inc +++ b/wwwroot/inc/eventz/get_templates.inc @@ -6,18 +6,13 @@ if(mysql_num_rows($q)) { $count = mysql_num_rows($q); while($res = mysql_fetch_object($q)) { -$content = mysql_fetch_object(mysql_query("select * from `node_content` where `node_id` = '{$res->node_id}'")); -print $res->node_id; -print ">>>"; -print $content->node_content; -print "
"; - - - - + $content = mysql_fetch_object(mysql_query("select * from `node_content` where `node_id` = '{$res->node_id}'")); + print $res->node_id; + print ">>>"; + print $content->node_content; + print "
"; } } - } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/k_wallet.inc b/wwwroot/inc/eventz/k_wallet.inc index 6012a47..939ff79 100644 --- a/wwwroot/inc/eventz/k_wallet.inc +++ b/wwwroot/inc/eventz/k_wallet.inc @@ -19,8 +19,8 @@ $k_request = (int) $k_request; //integer only.. if (($k_wallet+(-1*$k_request)) < 0 or ($user_k-(-1*$k_request)) < 0 or (!$k_request)) { -$error="Chybne zadanie alebo na to proste nemas:-)"; -return false; + $error="Chybne zadanie alebo na to proste nemas:-)"; + return false; } $db->query("update users set k_wallet=k_wallet+(-1*$k_request) , user_k=user_k-(-1*$k_request) where user_id='$user_id'"); diff --git a/wwwroot/inc/eventz/modules.inc b/wwwroot/inc/eventz/modules.inc deleted file mode 100644 index e1be7af..0000000 --- a/wwwroot/inc/eventz/modules.inc +++ /dev/null @@ -1,10 +0,0 @@ -/modules - - -announcment by bad admin: - -POZOR POZOR POZOR. V PRIEBEHU NAJBLIZSIEHO MESIACA DOJDE K ODMAZANIU -ADRESARA MODULES, PRETO JE ODPORUCANE UPRAVIT VSETKY VAM PATRIACE SABLONY A ODSTRANIT Z NICH ZAPISY {include file="modules/nazovsuboru.tpl"} -je treba zadavat -{include file="cislosablony.tpl"} - \ No newline at end of file diff --git a/wwwroot/inc/eventz/spamuj_ubik.inc b/wwwroot/inc/eventz/spamuj_ubik.inc index 49bc08b..d235761 100644 --- a/wwwroot/inc/eventz/spamuj_ubik.inc +++ b/wwwroot/inc/eventz/spamuj_ubik.inc @@ -1,6 +1,9 @@ "; // oznamovanie niektorych ficur z newlistu via ubik vsem userom @@ -31,6 +34,7 @@ $pocitadlo=$pocitadlo+1; echo "sprava $sprava
bola odoslana $pocitadlo userom"; +*/ return false; -}?> \ No newline at end of file +}?> diff --git a/wwwroot/inc/eventz/uprav_zaregistrovanych.inc b/wwwroot/inc/eventz/uprav_zaregistrovanych.inc index 02d97d7..fed3afa 100644 --- a/wwwroot/inc/eventz/uprav_zaregistrovanych.inc +++ b/wwwroot/inc/eventz/uprav_zaregistrovanych.inc @@ -3,16 +3,11 @@ function uprav_zaregistrovanych() { global $db,$error; // 2110364 >> debug user +// XXX hardcoded, rewrite $q="select users.login as persona,users.email as email,k,node_id,node_creator,login from nodes left join users on nodes.node_creator=users.user_id where node_name!='request for access' and node_parent=2091448 and k>=3"; -/* -$q="select users.login as persona,users.email as email,k,node_id,node_creator,login from nodes -left join users on nodes.node_creator=users.user_id where node_name!='request for access' and node_parent=2091448 and -k>=3 and user_id=2110364"; -*/ - $set=$db->query($q); while ($set->next()) { $noda=$set->getString('node_id'); @@ -54,4 +49,4 @@ echo "
"; return false; } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/verify.inc b/wwwroot/inc/eventz/verify.inc index c0a4293..b19a7ac 100644 --- a/wwwroot/inc/eventz/verify.inc +++ b/wwwroot/inc/eventz/verify.inc @@ -27,6 +27,7 @@ return false; else { // ouch!! this is gonna be dirty!!!!! will be revised later:-) +// XXX hardcoded, rewrite $q="update nodes set node_parent=2091448, node_vector='00876611020914480$userid' where node_id='$userid'"; $db->update($q); $q="update nodes set node_children_count=node_children_count+1 where node_id=2091448"; @@ -47,4 +48,4 @@ echo "
Verification successfull.

from now on your registration is die(); } } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/vote.inc b/wwwroot/inc/eventz/vote.inc index 31571d7..77d4847 100644 --- a/wwwroot/inc/eventz/vote.inc +++ b/wwwroot/inc/eventz/vote.inc @@ -1,37 +1,38 @@ query("select * from node_access where node_id='$node_id' and user_id='$user_id' and node_permission='ban'"); - if($set->getNumRows()>0) { - global $error; - $error="F ankete si uz hlasoval. nene..uz sa to neda viackrat...dufam:-)"; - return false; } + $set=$db->query("select * from node_access where node_id='$node_id' + and user_id='$user_id' and node_permission='ban'"); + if($set->getNumRows()>0) { + global $error; + $error="One vote is enough for everyone"; + return false; + } -$option=$_POST['poll_option']; + $option=$_POST['poll_option']; + $option--; -$option--; + if (!is_numeric($option)) { + $error="incorrect poll_option. fck"; + } -if (!is_numeric($option)) { - $error="incorrect poll_option. fck"; - } + $poll=unserialize($node['node_content']); + ++$poll[$option]['number']; + $node_content=serialize($poll); + $db->query("update nodes set node_content='$node_content' + where node_id='$node_id'"); - $poll=unserialize($node['node_content']); - ++$poll[$option]['number']; - $node_content=serialize($poll); - $db->query("update nodes set node_content='$node_content' -where node_id='$node_id'"); + $db->query("update node_access set node_permission='ban' where + node_id='$node_id' and user_id='$user_id'"); + Header("Location: /id/".$node['node_parent']."/"); +} -$db->query("update node_access set node_permission='ban' where -node_id='$node_id' and user_id='$user_id'"); - Header("Location: /id/".$node['node_parent']."/"); - - } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/vycisti_registracky.inc b/wwwroot/inc/eventz/vycisti_registracky.inc index abd12c0..553a1a8 100644 --- a/wwwroot/inc/eventz/vycisti_registracky.inc +++ b/wwwroot/inc/eventz/vycisti_registracky.inc @@ -20,6 +20,7 @@ $q="delete from users where user_id=$noda"; echo $q; $db->update($q); echo "
"; +// XXX hard coded, fix $q="delete from nodes where node_vector like '020914480$noda%'"; echo $q; $db->update($q); -- 2.30.2