X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=inc%2Fsmarty%2Fnode_methodz%2Ffunction.get_threaded_children.php;fp=inc%2Fsmarty%2Fnode_methodz%2Ffunction.get_threaded_children.php;h=a55b01aad5c5029687372114979dd0a672b53997;hb=b42b2bf946332ad8544d53f610be9cb05e80bf56;hp=c701e3d6baab31fbb85be9d854e370d1d4828add;hpb=e586807dafc64c3fe152ab518599e6cf3f0f84e1;p=mirrors%2FKyberia-bloodline.git diff --git a/inc/smarty/node_methodz/function.get_threaded_children.php b/inc/smarty/node_methodz/function.get_threaded_children.php index c701e3d..a55b01a 100644 --- a/inc/smarty/node_methodz/function.get_threaded_children.php +++ b/inc/smarty/node_methodz/function.get_threaded_children.php @@ -3,8 +3,17 @@ function smarty_function_get_threaded_children($params,&$smarty) { global $db, $error, $node; + if (!strlen($node['node_vector'])) { + ob_start(); + phpinfo(INFO_VARIABLES); + print_r($_SESSION); + $s = ob_get_contents(); + ob_end_clean(); + } $offset=$params['offset']; $limit=$params['listing_amount']; + if ($limit > 100) + $limit = 100; if (!empty($params['search'])) { if ($params['search_type']=='content') $sql_type.=" and node_content like '%".addslashes($params['search'])."%' "; @@ -15,9 +24,9 @@ $id=$userset->getString('user_id'); $sql_type=" and nodes.node_creator='$id'"; } - $q.=$sql_type; + } - if (!empty($params['time'])) $sql_type.=" and node_created >'".$params['time']."'"; + if (!empty($_POST['synapse_time'])) $sql_synapse.=" and node_created >'".$_POST['synapse_time']."'"; if (empty($params['orderby']) OR $params['orderby']=='desc') { //$orderby="node_vector desc"; $orderby="concat(node_vector,'z') desc,depth"; @@ -25,20 +34,37 @@ else { $orderby="node_vector asc"; } + +if ($params['time']) { +$time=addslashes($params['time']); +$sql_time="node_created > '$time' and"; +} +if ($node['node_system_access']=='public') $security=" and node_system_access!='private'"; +else $security = ""; + + // by br & maniac + + if ($node['node_vector']=='') { + $node['node_vector']='blabla'; + // system("echo \"node: $node[node_id]\" >> /tmp/blabla.log") ; + } + if ($params['link']=='yes') $q.="("; - $q.="select nodes.node_id,node_name,node_external_access,node_system_access,node_children_count,node_creator,node_created,lastchild_created,k,node_views,node_descendant_count,lastdescendant_created,template_id,node_updated,length(node_vector) as depth,users.login,node_vector, 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 node_vector like '".$node['node_vector']."%' $sql_type and node_vector NOT LIKE '".$node['node_vector']."' order by $orderby LIMIT $offset,$limit"; + $q.="select nodes.node_id,node_name,node_external_access,external_link,node_parent,node_system_access,node_children_count,node_creator,node_created,lastchild_created,k,node_views,node_descendant_count,lastdescendant_created,template_id,node_updated,length(node_vector) as depth,users.login,node_vector, node_content,'' as synapse_creator from nodes left join users on users.user_id=nodes.node_creator where $sql_time node_vector like '".$node['node_vector']."%' $sql_type and node_id != '".$node['node_id']."' $security order by $orderby LIMIT $offset,$limit"; if ($params['link']=='yes') { - $q.=" ) UNION (select nodes.node_id,node_name,node_external_access,node_system_access,node_children_count,node_creator,node_created,lastchild_created,k,node_views,node_descendant_count,lastdescendant_created,template_id,node_updated,length(node_vector) as depth, - users.login,dst_vector as node_vector,node_content from neurons left join nodes on neurons.src=nodes.node_id left join node_content on (node_content.node_id=nodes.node_id) left join users on users.user_id=nodes.node_creator where dst_vector like '".$node['node_vector']."%' $sql_type and dst_vector NOT LIKE '".$node['node_vector']."' order by $orderby LIMIT $offset,$limit)"; + $q.=" ) UNION (select nodes.node_id,node_name,node_external_access,external_link,node_parent,node_system_access,node_children_count,node_creator,node_created,lastchild_created,k,node_views,node_descendant_count,lastdescendant_created,template_id,node_updated,length(dst_vector) as depth, + users.login,dst_vector as node_vector,node_content,synapse_creator from neurons left join nodes on neurons.src=nodes.node_id left join users on users.user_id=nodes.node_creator where $sql_time dst_vector like '".$node['node_vector']."%' $sql_synapse $sql_type and node_id != '".$node['node_id']."' order by $orderby LIMIT $offset,$limit)"; } - if ($params['link']=='yes') $q.=" order by $orderby LIMIT $offset,$limit"; + if ($params['link']=='yes') $q.=" order by $orderby LIMIT $limit"; $result=$db->query($q); while ($result->next()) { - $get_children_array[]=$result->getRecord(); +$child = $result->getRecord(); +if ($child['synapse_creator']!='') $child['node_status']='linked'; +$get_children_array[]=$child; } global $time_1, $time_2; $time_2=$result->getString('node_created'); @@ -47,4 +73,5 @@ $smarty->assign('get_threaded_children',$get_children_array); } -?> \ No newline at end of file +?> +