| 1 | <?php |
| 2 | error_reporting(1); |
| 3 | require('../config/config.inc'); |
| 4 | require(INCLUDE_DIR.'database.inc'); |
| 5 | $db=new CLASS_DATABASE(); |
| 6 | $user_id = $_GET['user_id']; |
| 7 | $node_id = $_GET['node_id']; |
| 8 | |
| 9 | // listing amount |
| 10 | $set=$db->query("select users.listing_amount, users.listing_order from users where users.user_id='$user_id' limit 1"); |
| 11 | $set->next(); |
| 12 | $listing_amount=$set->getString('listing_amount'); |
| 13 | if (!is_numeric($listing_amount)) { |
| 14 | $listing_amount=23; |
| 15 | } |
| 16 | $offset=0; |
| 17 | |
| 18 | $q="select creator.node_name as creator,users.user_id,nodes.node_name,nodes.node_id as node_id from nodes |
| 19 | left join node_access on (nodes.node_id=node_access.node_id and node_access.user_id='$user_id') left join users on users.user_id=nodes.node_creator left join nodes as creator on nodes.node_creator=creator.node_id where nodes.node_parent='$node_id'"; |
| 20 | |
| 21 | $q.=" order by nodes.template_id,nodes.node_name LIMIT 0,3"; |
| 22 | $set=$db->query($q); |
| 23 | |
| 24 | while ($set->next()) { |
| 25 | $get_children_array[]=$set->getRecord(); |
| 26 | } |
| 27 | printf('<script language="JavaScript" type="text/javascript">function deti(){ var childrens = new Array();'); |
| 28 | foreach ($get_children_array as $index => $content) { |
| 29 | printf('childrens[%d] = new Array("%s", %d, "%s", %d);'."\n", $index, $content['creator'], $content['user_id'], $content['node_name'], $content['node_id']); |
| 30 | } |
| 31 | printf('for (x = 0; x < childrens.length; x++) {document.write(childrens[x] + "<br>");} }</script>'); |
| 32 | ?> |