Removed multiple require()
authorniekt0 <niekt0@kyberia.cz>
Mon, 4 Apr 2011 09:00:20 +0000 (11:00 +0200)
committerniekt0 <niekt0@kyberia.cz>
Mon, 4 Apr 2011 09:00:20 +0000 (11:00 +0200)
cron/citizen.php
cron/k.php
cron/ps.php
cron/search_update.php
doc/TODO
wwwroot/inc/smarty/node_methodz/function.get_nodes_by_parent.php
wwwroot/inc/smarty/node_methodz/function.gnodes.php [deleted file]

index e0a14139cadc52fc17318b149efea9089f2ce8a2..caa71fe32b9d201048e742aecdeed99aca8909a1 100755 (executable)
@@ -9,15 +9,15 @@
 // Use relative address of config file
 // Change this, if you move you cron directory.
 $dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
-require($dir.'/../wwwroot/config/config.inc');
+require_once($dir.'/../wwwroot/config/config.inc');
 
 
 //connecting to database and creating universal $db object
-require(INCLUDE_DIR.'/log.inc');
-require(INCLUDE_DIR.'/database.inc');
-require(INCLUDE_DIR.'/nodes.inc');
-require(INCLUDE_DIR.'/permissions.inc');
-require(INCLUDE_DIR.'/ubik.inc');
+require_once(INCLUDE_DIR.'/log.inc');
+require_once(INCLUDE_DIR.'/database.inc');
+require_once(INCLUDE_DIR.'/nodes.inc');
+require_once(INCLUDE_DIR.'/permissions.inc');
+require_once(INCLUDE_DIR.'/ubik.inc');
 
 $_SESSION['user_id']=UBIK_ID;
 
index 82399103eb0521a9a57baf699606e09778f85b37..8388ca9c477a87bcb9dfc428a37990e2b3da9cd8 100755 (executable)
@@ -9,11 +9,10 @@
 // Use relative address of config file
 // Change this, if you move you cron directory.
 $dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
-require($dir.'/../wwwroot/config/config.inc');
+require_once($dir.'/../wwwroot/config/config.inc');
 
-require(INCLUDE_DIR.'/database.inc');
-require(INCLUDE_DIR.'/senate.inc');
-require(INCLUDE_DIR.'/log.inc');
+require_once(INCLUDE_DIR.'/database.inc');
+require_once(INCLUDE_DIR.'/log.inc');
 
 $db = new CLASS_DATABASE();
 $db->query('update users set user_k = '. DAILY_K);
index 2a5f798da9a13b83aefab797c8a4d366f2363ecf..8b2199c5c6eafa9a0bf0b3d47921f49c6d2f1a0f 100755 (executable)
@@ -27,13 +27,12 @@ function update_template($params) {
 // Use relative address of config file
 // Change this, if you move you cron directory.
 $dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
-require($dir.'/../wwwroot/config/config.inc');
+require_once($dir.'/../wwwroot/config/config.inc');
 
 //connecting to database and creating universal $db object
-require(INCLUDE_DIR.'/log.inc');
-require(INCLUDE_DIR.'/database.inc');
-require(INCLUDE_DIR.'/nodes.inc');
-require(INCLUDE_DIR.'/senate.inc');
+require_once(INCLUDE_DIR.'/log.inc');
+require_once(INCLUDE_DIR.'/database.inc');
+require_once(INCLUDE_DIR.'/nodes.inc');
 $db=new CLASS_DATABASE();
 
 foreach ($requests as $request) {
index fecaeb328bb430ae848ed51f487f7f374490d895..318c823c694ab072c9fa92d688a7452e37b32027 100755 (executable)
@@ -8,10 +8,9 @@
 // Use relative address of config file
 // Change this, if you move you cron directory.
 $dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
-require($dir.'/../wwwroot/config/config.inc');
+require_once($dir.'/../wwwroot/config/config.inc');
 
-require(INCLUDE_DIR.'/database.inc');
-require(INCLUDE_DIR.'/senate.inc');
+require_once(INCLUDE_DIR.'/database.inc');
 
 $db = new CLASS_DATABASE();
 $db->query('insert into node_content select node_id,node_content from nodes where ( DATE_SUB(CURDATE(),INTERVAL 2 DAY) < node_created OR DATE_SUB(CURDATE(),INTERVAL 2 DAY) < node_updated)  ON DUPLICATE KEY UPDATE node_content.node_content = nodes.node_content;');
index d9a5a6fe64b50ccf9c3dde935807e82cb2f57e55..b81cdc13c928f1def738dde207d7b0ee3eb8f73b 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -77,4 +77,4 @@
 - put "setParent" everywhere
 
 - set_synapse_weigth not working sometimes (synapse from 904 to 332 for example)
-  Also weight is always shown as "1"
+  Also weight is always shown as "1" (add {$synapse.weight}
index b6fe822dc38648c8c97c08aeb7c8d56424152ce4..dc9c011cde8436451f34be8bfeee1a937e0eaebd 100644 (file)
@@ -1,54 +1,54 @@
 <?php
 
-       function smarty_function_get_nodes_by_parent($params,&$smarty) {
-               global $node;
-
-               $parent=$params['parent'];
-               $permissions=permissions::checkPerms($parent);
-               if (!$permissions['r']) {
-                       $error=$error_messages['READ_PERMISSION_ERROR'];
-                       return false;
-               }
-               $parent_vectot=$parent['node_vector'];
-
-               if ($params['listing_amount']=='all') $listing_amount='100';
-               else $listing_amount=$params['listing_amount'];
-               if (empty($params['offset'])) $offset=0;
-               else $offset=$params['offset'];
-
-               if ($params['orderby']) {
+function smarty_function_get_nodes_by_parent($params,&$smarty) {
+       global $node;
+
+       $parent=$params['parent'];
+       $permissions=permissions::checkPerms($parent);
+       if (!$permissions['r']) {
+               $error=$error_messages['READ_PERMISSION_ERROR'];
+               return false;
+       }
+       $parent_vectot=$parent['node_vector'];
+
+       if ($params['listing_amount']=='all') $listing_amount='100'; // XXX remove constant
+       else $listing_amount=$params['listing_amount'];
+       if (empty($params['offset'])) $offset=0;
+       else $offset=$params['offset'];
+
+       if ($params['orderby']) {
                        $orderby=addslashes($params['orderby']);
-               }
+       }
 
-               global $db,$node;
-               $node_id=$node['node_id'];
-               $user_id=$_SESSION['user_id'];
+       global $db,$node;
+       $node_id=$node['node_id'];
+       $user_id=$_SESSION['user_id'];
 if ($params['time']) $sql_time=" nodes.node_created > '".addslashes($params['time'])."' and ";
-               $q="select parent.node_name as parent_name,users.*,nodes.*,node_access.node_user_subchild_count from nodes left join nodes as parent on parent.node_id=nodes.node_parent left join node_access on node_access.node_id=nodes.node_id and node_access.user_id='$user_id' left  join users on users.user_id=nodes.node_creator where ";
-               $q.=" $sql_time nodes.node_parent='$parent' and nodes.node_system_access!='private'";
+       $q="select parent.node_name as parent_name,users.*,nodes.*,node_access.node_user_subchild_count from nodes left join nodes as parent on parent.node_id=nodes.node_parent left join node_access on node_access.node_id=nodes.node_id and node_access.user_id='$user_id' left  join users on users.user_id=nodes.node_creator where ";
+       $q.=" $sql_time nodes.node_parent='$parent' and nodes.node_system_access!='private'";
 
 
                 if ($_POST['template_event']=='filter_by') {
-                       if ($_POST['search_type']=='content')
+                if ($_POST['search_type']=='content')
                                         $sql_type.=" and node_content like '%".addslashes($_POST['node_content'])."%' ";
-                       else {
-                               $q2="select user_id from users where login='".$_POST['node_content']."'";
-                               $userset=$db->query($q2);
-                               $userset->next();
-                               $id=$userset->getString('user_id');
-                               $sql_type=" and nodes.node_creator='$id'";
-                       }
+               else {
+                       $q2="select user_id from users where login='".mysql_real_escape_string($_POST['node_content'])."'";
+                       $userset=$db->query($q2);
+                       $userset->next();
+                       $id=$userset->getString('user_id');
+                       $sql_type=" and nodes.node_creator='$id'";
+                }
                        $q.=$sql_type;
-               }
+        }
 
-               if ($orderby) $q.=" order by $orderby ";
-               else $q.=" order by nodes.node_id desc ";
-               $q.= " LIMIT $offset,$listing_amount ";
-               $set=$db->query($q);
-               while ($set->next()) $pole[]=$set->getRecord();
-               $smarty->assign('get_nodes_by_parent',$pole);
+       if ($orderby) $q.=" order by $orderby ";
+       else $q.=" order by nodes.node_id desc ";
+       $q.= " LIMIT $offset,$listing_amount ";
+       $set=$db->query($q);
+       while ($set->next()) $pole[]=$set->getRecord();
+       $smarty->assign('get_nodes_by_parent',$pole);
 
-       }
+}
 ?>
 
 
diff --git a/wwwroot/inc/smarty/node_methodz/function.gnodes.php b/wwwroot/inc/smarty/node_methodz/function.gnodes.php
deleted file mode 100644 (file)
index 89d70af..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-function smarty_function_get_nodes_by_external_link($params,&$smarty) {
-
-if ($params['orderby']=='desc') $orderby="desc"; else $orderby="asc";
-echo 'xxxxxxxxxxxxxxxx';
-$external_link=$params['external_link'];
-if ($params['listing_amount']=='all')
-$listing_amount='23232323232323323';
-else $listing_amount=$params['listing_amount'];
-
-if (empty($params['offset'])) $offset=0;
-else $offset=$params['offset'];
-
-global $db,$node;
-
-$q="select users.*,nodes.*,node_content.* from nodes left join
-node_content on (node_content.node_id=nodes.node_id) left
-join users on users.user_id=nodes.node_creator where external_link like '$external_link%' order by node_created $orderby LIMIT $offset,$listing_amount";
-
-$set=$db->query($q);
-while ($set->next()) $pole[]=$set->getRecord();
-$smarty->assign('get_nodes_by_external_link',$pole);
-}
-?>
\ No newline at end of file
This page took 0.531837 seconds and 4 git commands to generate.