function smarty_function_get_nodes_by_type($params, &$smarty) { global $node; $vector = ""; $orderby = ""; $type = $params['type']; if ($params['listing_amount'] == 'all') { $listing_amount = DEF_MAX_LISTING_AMMOUNT; } else { $listing_amount = $params['listing_amount']; } if (empty($params['offset'])) { $offset = 0; } else { $offset = $params['offset']; } if (isset($params['vector']) && $params['vector']) { $vector = $params['vector']; } if (isset($params['orderby']) && $params['orderby']) { $orderby = $params['orderby']; } $node_id = $node['node_id']; $user_id = $_SESSION['user_id']; $result = nodes::getNodesByType($vector, $user_id, $type, $orderby, $offset, $listing_amount); $smarty->assign('get_nodes_by_type', $result); }
function smarty_function_get_threaded_children($params, &$smarty) { global $error, $node; $offset = isset($params['offset']) ? $params['offset'] : ""; $limit = isset($params['listing_amount']) ? $params['listing_amount'] : DEF_LISTING_AMMOUNT; $limit = $limit > DEF_MAX_LISTING_AMMOUNT ? DEF_MAX_LISTING_AMMOUNT : $limit; $synapse_time = isset($_POST['synapse_time']) ? $_POST['synapse_time'] : ""; $orderby = isset($params['orderby']) ? $params['orderby'] : "desc"; $time = isset($params['time']) ? $params['time'] : ""; $link = isset($params['link']) && $params['link'] == 'yes' ? "yes" : ""; $node_id = $node['node_id']; $node_vector = $node['node_vector']; // XXX WTF if ($node['node_system_access'] == 'public') { $security = "yes"; } else { $security = ""; } if (!empty($params['search'])) { if ($params['search_type'] == 'content') { $search = 'content'; $search_param = $params['search']; } else { $id = nodes::getUserByLogin($params['search']); $search = 'user'; $search_param = $id; } } else { $search = ""; $search_param = ""; } $get_children_array = nodes::getThreadedChildren($node_id, $node_vector, $offset, $limit, $orderby, $time, $synapse_time, $security, $link, $search, $search_param); $smarty->assign('get_threaded_children', $get_children_array); }
function smarty_function_get_linked_nodes($params, &$smarty) { global $error, $node; if (empty($params['listing_amount'])) { $listing_amount = DEFAULT_LISTING_AMOUNT; } else { if ($params['listing_amount'] == 'all') { $listing_amount = DEF_MAX_LISTING_AMMOUNT; } elseif (is_numeric($params['listing_amount'])) { $listing_amount = $params['listing_amount']; } } if (isset($params['offset']) && is_numeric($params['offset'])) { $offset = $params['offset']; } elseif (isset($_POST['offset']) && is_numeric($_POST['offset'])) { $offset = $_POST['offset']; } else { $offset = 0; } if (isset($params['node_id'])) { $node_id = $params['node_id']; } else { $node_id = $node['node_id']; } if ($params['orderby'] = 'synapse') { $orderby = 'synapse_created'; } else { $orderby = 'node_id'; } $get_linked_nodes = nodes::getLinkedNodes($node_id, $orderby, $offset, $listing_amount); if ($get_linked_nodes) { $smarty->assign('get_linked_nodes', $get_linked_nodes); } }
function smarty_function_get_user_submissions_children($params, &$smarty) { if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; } else { return -1; } /* if (!isset($params['listing_amount'])) $listing_amount = DEFAULT_LISTING_AMMOUNT; else $listing_amount = $params['listing_amount']; if (empty($params['offset'])) $offset = 0; else $offset = $params['offset']; if (!isset($params['order_by'])) $order_by = $params['order_by']; else $order_by = 'node_id'; */ $replies = nodes::GetUserSubmissionsChildren($user_id); $smarty->assign('get_user_submissions_children', $replies); }
function smarty_function_get_k_neurons($params, &$smarty) { global $db; if (isset($params['offset']) && is_numeric($params['offset'])) { $offset = $params['offset']; } else { $offset = 20; } if (isset($params['listing_amount']) && is_numeric($params['listing_amount'])) { $listing_amount = $params['listing_amount']; } else { $listing_amount = DEFAULT_LISTING_AMOUNT; } if (isset($_POST['interval']) && is_numeric($_POST['interval'])) { $interval = $_POST['interval']; } else { $interval = 1; } if (isset($params['vector']) && $params['vector']) { $vector = $params['vector']; $interval = 365; } else { $vector = "00"; } // XXX other parameters $k_array = nodes::getKNeurons($_SESSION['user_id'], $offset); $smarty->assign('get_k_neurons', $k_array); }
function aaddnode($params) { //$_POST['code']=true; $params['node_creator'] = UBIK_ID; return nodes::addNode($params); //return(rand(3,100000)); }
function smarty_function_get_poll($params, &$smarty) { global $node; $user_id = $_SESSION['user_id']; $node_vector = $node['node_vector']; if (isset($params['poll_id']) && is_numeric($params['poll_id'])) { $poll_id = $params['poll_id']; } else { $poll_id = $node['node_id']; } if (isset($params['poll']) && is_array($params['poll'])) { $array = $params['poll']; $voted = 'yes'; } else { $array = nodes::getPoll($user_id, $poll_id); if (isset($array['node_permission']) && $array['node_permission'] == 'ban') { $voted = 'yes'; } else { $voted = 'no'; } } $option_array = unserialize($array['node_content']); $permission = $array['node_permission']; // XXX WTF? sec. hole? $poll = array("voted" => $voted, "node_id" => $array['node_id'], "question" => $array['node_name'], "total" => $array['node_views'], "options" => $option_array); $smarty->assign('get_poll', $poll); }
function smarty_function_get_synapse_weight($params, &$smarty) { global $db, $node; $user_id = $_SESSION['user_id']; $node_id = $params['node_id']; $synapse_weight = nodes::getSynapseWeight($user_id, $node_id); $smarty->assign('synapse_weight', $synapse_weight); }
function smarty_function_get_node_userlist($params, &$smarty) { global $node; if (isset($params['node_id']) && is_numeric($params['node_id'])) { $node_id = $params['node_id']; } else { $node_id = $node['node_id']; } $userlist = nodes::getNodeUserlist($node_id); $smarty->assign('userlist', $userlist); }
function smarty_function_get_node_commanders($brawco, &$smarty) { global $node; $node_id = $node['node_id']; $commanders = nodes::getNodeCommanders($node_id); $smarty->assign('get_node_commanders', empty($commanders) ? "" : $commanders); $smarty->assign('masters', empty($commanders['master']) ? "" : $commanders['master']); $smarty->assign('ops', empty($commanders['op']) ? "" : $commanders['op']); $smarty->assign('access', empty($commanders['access']) ? "" : $commanders['access']); $smarty->assign('bans', empty($commanders['ban']) ? "" : $commanders['ban']); $smarty->assign('silence', empty($commanders['silence']) ? "" : $commanders['silence']); $smarty->assign('execute', empty($commanders['execute']) ? "" : $commanders['execute']); }
function db_get_template($tpl_name, &$tpl_source, &$smarty_obj) { global $db, $error, $node, $error_messages; $template_id = preg_replace('/\\.tpl$/', '', $tpl_name); //from now on module names need not to be numeric! if (!is_numeric($template_id)) { $template_id = nodes::getNodeIdByName($tpl_name); if (!is_numeric($template_id)) { $error = $error_messages['NOT_NUMERIC']; return false; } } if (is_numeric($template_id)) { $tpl_source = nodes::getNodeById($template_id, empty($_SESSION['user_id']) ? "" : $_SESSION['user_id']); } $template_name = $tpl_source['node_name']; $template_signature = 'TEMPLATE /k/' . base_convert($template_id, 10, 36) . ' /id/' . $template_id . ' [' . $template_name . ']'; $tpl_source = "\n\n<!-- BEGIN {$template_signature} -->\n\n" . $tpl_source['node_content'] . "\n\n<!-- END {$template_signature} -->\n\n"; // return true on success, false to generate failure notification return (bool) $tpl_source; }
function smarty_function_get_children($params, &$smarty) { global $db, $node; $node_id = $node['node_id']; $listing_amount = $params['listing_amount']; if (!is_numeric($listing_amount)) { $listing_amount = 23; } $offset = $params['offset']; if (!is_numeric($offset)) { $offset = 0; } if ($_POST['get_children_orderby'] == "asc" || $params['orderby'] == 'asc') { $orderby = 'asc'; } else { $orderby = 'desc'; } $q = "select node_access.last_visit,creator.node_name as creator,users.*,nodes.*,nodes.node_id as node_id from nodes\nleft join node_access on (nodes.node_id=node_access.node_id\nand node_access.user_id='" . $_SESSION['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}'"; if (!empty($params['search'])) { if ($params['search_type'] == 'content') { $sql_type .= " and node_content like '%" . addslashes($params['sea rch']) . "%' "; } else { $id = nodes::getNodeByLogin($params['search']); $sql_type = " and nodes.node_creator='{$id}'"; } $q .= $sql_type; } if ($children_type == '4' || $params['orderby_type'] == 'time') { $q .= " order by nodes.node_created {$orderby} limit {$offset},{$listing_amount}"; } else { $q .= " order by nodes.template_id,nodes.node_name LIMIT {$offset},{$listing_amount}"; } $set = $db->query($q); while ($set->next()) { $get_children_array[] = addBase36id($set->getRecord()); } $smarty->assign('get_children', $get_children_array); }
function addPlugin() { global $db, $error, $node, $error_messages; $add_plugin_id = $_POST['add_plugin_id']; if (!is_numeric($add_plugin_id)) { $error = $error_messages['NOT_NUMERIC']; return false; } $set = $db->query("select node_parent, node_system_access, node_creator, template_id, node_content, node_name from nodes where nodes.node_id='{$add_plugin_id}'"); $set->next(); $node_parent = $set->getString('node_parent'); $node_system_access = $set->getString('node_system_access'); $node_creator = $set->getString('node_creator'); $node_template = $set->getString('template_id'); $node_content = $set->getString('node_content'); $plugin_name = $set->getString('node_name'); $fp = fopen(SMARTY_PLUGIN_DIR . "function." . $plugin_name . ".php", "w+"); fwrite($fp, $node_content); fclose($fp); chown(SMARTY_PLUGIN_DIR . $plugin_name . ".php", "www"); $q = "update nodes set external_link='plugin://{$plugin_name}' where node_id='" . $add_plugin_id . "'"; $db->query($q); //logging of every plugin for security reasons $params['node_creator'] = UBIK_ID; $params['node_parent'] = 2019772; $params['node_name'] = "addPlugin execute: node {$add_plugin_id}"; $params['node_content'] = "addPlugin execute: node <a href='{$add_plugin_id}'>{$add_plugin_id}</a> by user " . $_SESSION['user_name']; $params['node_content'] .= "<br />plugin_name: " . $plugin_name; $params['node_content'] .= "<br />template_id: <a href='{$node_template}'>" . $node_template . "</a>"; $params['node_content'] .= "<br />node_parent: <a href='{$node_parent}'>" . $node_parent . "</a>"; $params['node_content'] .= "<br />node_system_access: " . $node_system_access; $params['node_content'] .= "<br />node_creator: <a href='{$node_creator}'>" . $node_creator . "</a>"; $params['node_content'] = addslashes($params['node_content']); nodes::addNode($params); return true; }
/** * Sett opp menygruppe */ protected static function build_menu_group(&$html, $prefix, $node_id, &$parent_nodes, &$expand_max, $expand) { if (isset(self::$nodes_sub_active[$node_id])) { $expand_more = !$expand_max || $expand_max > $expand; $expand++; $prefix_sub = $prefix . "\t"; $prefix_next = $prefix_sub . "\t"; $html .= $prefix . "<ul>"; foreach (self::$nodes_sub_active[$node_id] as $row) { $row = self::$nodes[$row]; // er vi på denne? (uthev den) $active = $row['node_id'] == self::$node_id || !$expand_more && in_array($row['node_id'], $parent_nodes) ? ' class="active"' : ''; // innholdet switch ($row['node_type']) { case "url_absolute": $params = new params($row['node_params']); $row_prefix = '<a href="' . htmlspecialchars($params->get("url")) . '"' . $active . ($params->get("new_window") ? ' target="_blank"' : '') . '>'; $row_suffix = '</a>'; break; case "url_relative": $params = new params($row['node_params']); $row_prefix = '<a href="' . ess::$s['relative_path'] . htmlspecialchars($params->get("url")) . '"' . $active . ($params->get("new_window") ? ' target="_blank"' : '') . '>'; $row_suffix = '</a>'; break; default: // container if ($row['node_id'] == self::$default_node) { $url = ess::$s['relative_path'] . '/node'; } else { $url = ess::$s['relative_path'] . '/node/' . $row['node_id']; } $row_prefix = '<a href="' . $url . '"' . $active . '>'; $row_suffix = '</a>'; } $content = $row_prefix . htmlspecialchars($row['node_title']) . $row_suffix; // enheten $html .= $prefix_sub . '<li' . $active . '>'; // underelementer if (($row['node_expand_menu'] > 0 || in_array($row['node_id'], $parent_nodes) || $row['node_id'] == self::$node_id) && $expand_more) { $html .= $prefix_next . $content; nodes::build_menu_group($html, $prefix_next, $row['node_id'], $parent_nodes, $expand_max, $expand); $html .= $prefix_sub; } else { $html .= $content; } $html .= '</li>'; } $html .= $prefix . "</ul>"; } }
$node = nodes::getNodeById($_GET['node_id'], $_SESSION['user_id']); } if ($node['node_creator'] == $_SESSION['user_id']) { $node['node_permission'] = 'owner'; } if ($_SESSION['cube_vector']) { if (strpos($node['node_vector'], $_SESSION['cube_vector']) === false) { echo "node::" . $node['node_vector']; echo "cube_Vector::" . $_SESSION['cube_vector']; echo "you are out of allowed cwbe. access forbidden"; die; } } //if not existent node show our own 404 if (empty($node)) { $nodes = nodes::getNodesByName($_GET['node_name']); if ($nodes) { $smarty->assign('nodes', $nodes); $content = $smarty->display("404.tpl"); die; } elseif ($_SESSION['user_id']) { $smarty->assign('node_name', $_GET['node_name']); $content = $smarty->display("modules/addnode.tpl"); } } //modifying node glass pearl if (is_array($children_types[$node['node_type']])) { $smarty->assign('children_types', $children_types[$node['node_type']]); } $smarty->assign('types', $types); $node['node_type'] = $types[$node['node_type']];
$set2 = $db->query("select k,node_id,node_creator,login from nodes \n\t\tleft join users on nodes.node_creator=users.user_id where \n\t\tnode_name='request for citizenship'"); echo "TOTAL {$citizens} citizens \n"; while ($set2->next()) { $request_id = $set2->getString('node_id'); $votes = $set2->getString('k'); $login = $set2->getString('login'); $citizen = $set2->getString('node_creator'); echo "citizen {$citizen} - {$login} has {$votes} needs " . floor(log($citizens, "1.42")) . " \n"; if ($citizens < 66 && $votes >= floor($citizens / 6) || $citizens >= 66 && $votes > floor(log($citizens, "1.42"))) { $params['node_parent'] = $request_id; $params['node_creator'] = UBIK_ID; $params['node_content'] = "request of user {$login} approved by {$votes} citizens"; $params['node_name'] = "citizen {$citizen} approved"; //print_r($params); echo $votes . $citizen . "\n"; nodes::addNode($params); $t1 = $db->query("select * from node_access where \n\t\tnode_id='1961061' and \n\t\tuser_id='{$citizen}' \n\t\tand node_permission='execute'"); if (!$t1->getNumRows()) { $db->query("insert into node_access set \n\t\t\t\tnode_id='1961061',\n\t\t\t\tuser_id='{$citizen}',\n\t\t\t\tnode_permission='execute'"); } $t1 = $db->query("select * from node_access where \n\t\tnode_id='1061495' and \n\t\tuser_id='{$citizen}' and \n\t\tnode_permission='execute'"); if (!$t1->getNumRows()) { $db->query("insert into node_access set \n\t\t\t\t\tnode_id='1061495',\n\t\t\t\t\tuser_id='{$citizen}',\n\t\t\t\t\tnode_permission='execute'"); } $t1 = $db->query("select * from node_access where \n\t\tnode_id='1961070' and \n\t\tuser_id='{$citizen}' and \n\t\tnode_permission='execute'"); if (!$t1->getNumRows()) { $db->query("insert into node_access set \n\t\tnode_id='1961070',\n\t\tuser_id='{$citizen}',\n\t\tnode_permission='execute'"); } $db->query("update nodes set node_name='approved citizenship request' \n\t\twhere node_id='{$request_id}'"); $params['mail_to'] = $citizen; $params['mail_text'] = "you have become a citizen";
$db_old = new CLASS_DATABASE("kyberia", "kyberia", "cyb3ry", "127.0.0.1"); $q = "select * from articles"; $set = $db_old->query($q); $db->query("set autocommit=0"); while ($set->next()) { $q = "insert into nodes set "; if (!is_numeric($set->getString('autor'))) { $node_name = $set->getString('autor') . "::" . $set->getString('nazov'); } else { $node_name = $set->getString('nazov'); } $node_name = addslashes(strip_tags($node_name)); $q .= "node_name='{$node_name}'"; $q2 = "select * from nodes where node_type='2' and old_id='" . $set->getString('id_rubrika') . "'"; $res2 = $db->query($q2); $res2->next(); $q .= ",node_parent='" . $res2->getString('node_id') . "'"; $q .= ",node_thread_vector='" . $res2->getString('node_thread_vector') . ";" . $res2->getString('node_id') . "'"; if (is_numeric($set->getString('autor'))) { $autor = nodes::getNodeByOldId($set->getString('autor')); $q .= ",node_creator='" . $autor['node_id'] . "'"; } else { $q .= ",node_creator='548'"; } $q .= "\n,node_type='5'\n,node_created='" . $set->getString('datum') . "'\n,node_views='" . $set->getString('hits') . "'\n,node_system_access='public'\n,node_external_access='yes'\n,node_children_count='" . $set->getString('prispevky') . "'\n,old_id_diskuse='" . $set->getString('id_diskuse') . "'\n,old_id='" . $set->getString('id_article') . "'"; $db->query($q); echo $q; $q = "insert into node_content set node_content='" . AddSlashes($set->getString('short_desc')) . ":::" . AddSlashes($set->getString('text1')) . "',node_id=LAST_INSERT_ID()"; $db->query($q); $db->query("commit"); }
/** * Nodesøk */ protected function node_search($cid, $dest, $search) { $search = utf8_decode($search); // hent all informasjon $result = \Kofradia\DB::get()->query("SELECT node_id, node_parent_node_id, node_title, node_type, node_params, node_show_menu, node_expand_menu, node_enabled, node_priority, node_change FROM nodes"); $nodes = array(); while ($row = $result->fetch()) { $row['params'] = new params($row['node_params']); $row['enheter'] = array(); $row['plain'] = ""; $nodes[$row['node_id']] = $row; } if (count($nodes) == 0) { $this->msg($cid, $dest, "Ingen siden eksisterer."); return; } // sett opp søkekriteriene $search_list = search_query($search); $search_list = $search_list[1]; $search_list2 = $search_list; // for delvise treff foreach ($search_list as &$q) { $q = '/(\\P{L}|^)' . preg_replace(array('/([\\/\\\\\\[\\]()$.+?|{}])/', '/\\*\\*+/', '/\\*/'), array('\\\\$1', '*', '\\S*'), $q) . '(\\P{L}|$)/i'; } // sett opp søkeliste hvor vi søker med * på slutten av ordene foreach ($search_list2 as &$q) { $q = '/' . preg_replace(array('/([\\/\\\\\\[\\]()$.+?|{}])/', '/\\*\\*+/', '/\\*/'), array('\\\\$1', '*', '\\S*'), $q) . '/i'; } // hent alle enhetene $result = \Kofradia\DB::get()->query("SELECT ni_id, ni_node_id, ni_type, nir_content, nir_params, nir_time FROM nodes_items LEFT JOIN nodes_items_rev ON nir_id = ni_nir_id WHERE ni_enabled != 0 AND ni_deleted = 0 ORDER BY ni_priority"); while ($row = $result->fetch()) { if (!isset($nodes[$row['ni_node_id']])) { continue; } $data = nodes::content_build($row); $nodes[$row['ni_node_id']]['enheter'][] = $data; // bygg opp plain tekst $plain = preg_replace("/<br[^\\/>]*\\/?>/", "\n", $data); $plain = preg_replace("/(<\\/?(h[1-6]|p)[^>]*>)/", "\n\\1", $plain); $plain = html_entity_decode(strip_tags($plain)); $plain = preg_replace("/(^ +| +\$|\\r)/m", "", $plain); #$plain = preg_replace("/(?<![!,.\\n ])\\n/", " ", $plain); $plain = preg_replace("/\\n/", " ", $plain); $plain = preg_replace("/ +/", " ", $plain); $plain = trim($plain); $nodes[$row['ni_node_id']]['plain'] .= $plain . " "; } // sett opp riktige referanser og lag tree $sub = array(); foreach (nodes::$nodes as $row) { if ($row['node_enabled'] != 0) { $sub[$row['node_parent_node_id']][] = $row['node_id']; } } $tree = new tree($sub); $data = $tree->generate(0, NULL, $nodes); // sett opp paths $paths = array(); $path = array(); $number = 1; foreach ($data as $row) { for (; $row['number'] <= $number; $number--) { // fjern fra path array_pop($path); } if ($row['number'] >= $number) { // legg til i path $path[] = $row['data']['node_title']; } $paths[$row['data']['node_id']] = $path; $number = $row['number']; } // sett opp søkeresultater $result = array(); $points = array(); $points2 = array(); foreach ($data as $row) { if ($row['data']['node_type'] != "container") { continue; } // utfør søk $found = true; $p = 0; $p2 = 0; foreach ($search_list as $key => $regex) { $ok = false; $matches = null; // søk i teksten if (preg_match_all($regex, $row['data']['plain'], $matches)) { $ok = true; $p += count($matches[0]); } if (preg_match_all($search_list2[$key], $row['data']['plain'], $matches)) { $ok = true; $p2 += count($matches[0]); } // søk i tittelen if (preg_match_all($regex, $row['data']['node_title'], $matches)) { $ok = true; $p += count($matches[0]); } if (preg_match_all($search_list2[$key], $row['data']['node_title'], $matches)) { $ok = true; $p2 += count($matches[0]); } if ($ok) { continue; } $found = false; break; } // fant? if ($found) { $result[] = $row; $points[] = $p; $points2[] = $p2; } } // vis søkeresultater if (count($result) == 0) { $this->msg($cid, $dest, "Ingen treff ble funnet."); } // sorter søkeresultatene array_multisort($points, SORT_DESC, SORT_NUMERIC, $points2, SORT_DESC, SORT_NUMERIC, $result); $this->msg($cid, $dest, count($result) . " treff ble funnet - " . ess::$s['path'] . '/node/search?q=' . urlencode($search)); $i = 0; foreach ($result as $key => $row) { if ($i++ == 3) { break; } $partial = $points2[$key] - $points[$key]; if ($row['data']['node_id'] == nodes::$default_node) { $url = ess::$s['path'] . '/node'; } else { $url = ess::$s['path'] . '/node/' . $row['data']['node_id']; } $m = array(); if ($points[$key] > 0) { $m[] = $points[$key] . ' treff'; } if ($partial > 0) { $m[] = fwords("%d delvis treff", "%d delvise treff", $partial); } $this->msg($cid, $dest, implode(", ", $m) . ": " . implode(" -> ", $paths[$row['data']['node_id']]) . " {$url}"); } }
function smarty_function_get_last($params, &$smarty) { $last = nodes::GetLast($params); $smarty->assign('get_last', $last); }
function getRootNodes($db, $file_id, $iteration, $rootnodes) { $sql = "SELECT context,name,starttime,stoptime,stoptime - starttime AS runtime,HEX(correlator),HEX(parent_correlator),iteration FROM transaction_file T INNER JOIN transaction_types TT ON T.transaction_type = TT.transaction_uid AND TT.file_id = " . $file_id . " AND T.iteration = " . $iteration . " AND HEX(parent_correlator) IS NULL ORDER BY starttime;"; /* create a prepared statement */ if ($stmt = $db->prepare($sql)) { /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($t_name, $t_type, $t_start, $t_stop, $t_total, $t_corr, $t_pcorr, $t_iter); /* fetch value */ $stmt->fetch(); //echo $total_iter; while ($stmt->fetch()) { $temp_object = new nodes(); $object = $temp_object->createNode($t_name, $t_type, $t_start, $t_stop, $t_total, $t_corr, $t_pcorr, $t_iter); array_push($rootnodes, $object); } /* close statement */ $stmt->close(); return $rootnodes; } }
// $smarty->assign('bookstyl', isset($_SESSION['bookstyl']) ? $_SESSION['bookstyl'] :''); $smarty->assign('f**k', isset($_SESSION['f**k']) ? $_SESSION['f**k'] : ''); $smarty->assign('mail_notify', isset($_SESSION['mail_notify']) ? $_SESSION['mail_notify'] : ''); $smarty->assign('friend', isset($_SESSION['friend']) ? $_SESSION['friend'] : ''); $smarty->assign('friends', isset($_SESSION['friend']) ? $_SESSION['friend'] : ''); $smarty->assign('anticsrf', isset($_SESSION['anticsrf']) ? $_SESSION['anticsrf'] : NULL); $smarty->assign('_POST', isset($_POST) ? $_POST : ''); //XXX $smarty->assign('cube_vector', $_SESSION['cube_vector']); // $new_mail = $newmailset->getInt('user_mail'); // if ($new_mail > 0) // $smarty->assign('new_mail', $new_mail); // $smarty->assign('new_mail_name', $newmailset->getString('mail_sender')); // $smarty->assign('user_k', $newmailset->getInt('user_k')); // $smarty->assign('k_wallet', $newmailset->getInt('k_wallet')); } error_log("LOG: event: {$event}, node_id: {$node_id}, template_id: {$template_id}"); require_once INCLUDE_DIR . "eventz/{$event}.inc"; // Event is executed, now get $referer_id $referer_id = ""; if (preg_match('/id\\/(\\d+)/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) { $referer_id = $match[1]; } elseif (preg_match('/name\\/(.*?)\\/?$/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) { $referer_id = nodes::getNodeIdByName($match[1]); } // creating neural network + updating node counters nodes::update_nodes(isset($_SESSION['user_id']) ? $_SESSION['user_id'] : "", $node_id, $referer_id); $time = substr(Time() + substr(MicroTime(), 0, 8) - $timer_start, 0, 7); $smarty->assign('generation_time', $time); echo $content; // end of displaying
} #@include_once(INCLUDE_DIR.'mail_rss.inc'); //haluz... //checking permissions include_once BACKEND_DIR . '/' . DB_TYPE . '/permissions.inc'; $permissions = permissions::checkPerms($node); if (!empty($_SESSION['debugging']) && $_SESSION['debugging']) { print_r($permissions); } // DO NOT MESS WITH THIS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //creating neural network if (preg_match('/id\\/(\\d+)/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) { $referer_id = $match[1]; } elseif (preg_match('/k\\/([a-z0-9]{1,7})/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) { $referer_id = base_convert($match[1], 36, 10); } elseif (preg_match('/name\\/(.*?)\\/?$/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) { $referer_id = nodes::getNodeIdByName($match[1]); } $db->update("update nodes set node_views=node_views+1 where node_id='" . $node['node_id'] . "'"); if (isset($referer_id) && is_numeric($referer_id)) { $q = "update neurons set synapse=synapse+1 where dst='" . $node['node_id'] . "' and src='{$referer_id}'"; $result = $db->update($q); if (!$result) { $q = "insert into neurons set synapse_creator='" . $_SESSION['user_id'] . "',dst='" . $node['node_id'] . "',src='{$referer_id}',synapse=1"; $db->query($q); } } else { logger::log('enter', $node['node_id'], 'failed'); } //entering the node (executing the eventz) if ($permissions['r'] || $event != 'register') { //performing node_events (based on update/insert/delete db queries)
protected function show_node_info($node) { switch (nodes::$node_info['node_type']) { case "url_absolute": $type = "Adresse (absolutt)"; break; case "url_relative": $type = "Adresse (relativ)"; break; default: $type = "Vanlig side"; } echo ' <h1> <!--<span class="h_right red"><a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&delete" class="button">Slett side</a></span>--> ' . htmlspecialchars(nodes::$node_info['node_title']) . ' </h1> <p class="h_right"> <a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&move" class="large_button">Flytt side</a> <a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&delete" class="large_button red">Slett side</a> </p> <boxes /> <h2>Generell informasjon</h2> <dl class="dd_right"> <dt>Tittel</dt> <dd>' . htmlspecialchars(nodes::$node_info['node_title']) . ' [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&edit_title">rediger</a>]</dd> <dt>Aktivert</dt> <dd>' . (nodes::$node_info['node_enabled'] > 0 ? 'Ja [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&enabled=false">deaktiver</a>]' : '<span style="color:#FF0000">Nei</span> [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&enabled">aktiver</a>]') . '</dd> <dt>Type</dt> <dd>' . $type . '</dd> <dt>Vis i menyen</dt> <dd>' . (nodes::$node_info['node_show_menu'] > 0 ? 'Ja [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&show_menu=false">skjul</a>]' : '<span style="color:#FF0000">Nei</span> [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&show_menu">vis</a>]') . '</dd> <dt>Ekspander menyen</dt> <dd>' . (nodes::$node_info['node_expand_menu'] > 0 ? 'Ja [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&expand_menu=false">ikke ekspander</a>]' : 'Nei [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&expand_menu">ekspander</a>]') . '</dd> </dl>'; // enheter? if (nodes::$node_info['node_type'] == "container") { // hent enhetene $result = \Kofradia\DB::get()->query("SELECT ni_id, ni_type, nir_content, nir_params, nir_time, ni_enabled, nir_description FROM nodes_items LEFT JOIN nodes_items_rev ON nir_id = ni_nir_id WHERE ni_node_id = " . nodes::$node_id . " AND ni_deleted = 0 ORDER BY ni_priority"); echo ' <h2>Innstillinger</h2> <dl class="dd_right"> <dt>Vis tittel på siden</dt> <dd>' . (nodes::$node_params->get("hide_title") ? 'Nei [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&hide_title=false">vis tittel</a>]' : 'Ja [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&hide_title">skjul tittel</a>]') . '</dd> <dt>Vis sist endret</dt> <dd>' . (nodes::$node_params->get("hide_time_change") ? 'Nei [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&hide_time_change=false">vis dato</a>]' : 'Ja [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&hide_time_change">skjul dato</a>]') . '</dd> </dl> <h2>Enhetene</h2> <p class="h_right"><a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&unit_new" class="large_button">Ny enhet</a></p>'; if ($result->rowCount() == 0) { echo ' <p> Ingen enheter er opprettet enda. </p>'; } else { echo ' <table class="table tablemb" width="100%"> <thead> <tr> <th>Beskrivelse</th> <th>Type</th> <th>Vektøy</th> </tr> </thead> <tbody>'; $i = 0; $highlight = getval("unit_highlight"); while ($row = $result->fetch()) { $i++; $class = $highlight == $row['ni_id'] ? ' class="highlight"' : ($i % 2 == 0 ? ' class="color"' : ''); $tools = array(); if ($row['ni_enabled'] == 0) { $tools[] = '[<span style="color:#FF0000">deaktivert</span> - <a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&unit_enable=' . $row['ni_id'] . '">aktiver</a>]'; } else { $tools[] = '[<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&unit_disable=' . $row['ni_id'] . '">deaktiver</a>]'; } $tools[] = '[<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&unit_edit=' . $row['ni_id'] . '">rediger</a>]'; $tools[] = '[<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&unit_delete=' . $row['ni_id'] . '">slett</a>]'; $tools[] = '[ny: <a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&unit_new&previous_unit=' . $row['ni_id'] . '">under</a>]'; $tools = implode(" ", $tools); echo ' <tr' . $class . '> <td>' . (empty($row['nir_description']) ? '<span style="color:#888888; font-size: 10px">Ingen beskrivelse</span>' : htmlspecialchars($row['nir_description'])) . '</td> <td>' . nodes::content_type($row) . '</td> <td class="r">' . $tools . '</td> </tr>'; } echo ' </tbody> </table>'; } } elseif (nodes::$node_info['node_type'] == "url_absolute") { echo ' <h2>Adresseinformasjon</h2> <p> Dette er en direkteadresse som skal inneholde hele adressen til nettstedet. </p> <dl class="dd_right"> <dt>Adresse</dt> <dd><a href="' . htmlspecialchars(nodes::$node_params->get("url", '#')) . '">' . htmlspecialchars(nodes::$node_params->get("url", 'mangler adresse')) . '</a> [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&edit_url">rediger</a>]</dd> </dl>'; } elseif (nodes::$node_info['node_type'] == "url_relative") { echo ' <h2>Adresseinformasjon</h2> <p> Dette er en adresse internt på nettsiden som kun skal inneholde adressen under nettstedet det ønskes å linkes til. </p> <dl class="dd_right"> <dt>Adresse</dt> <dd>' . htmlspecialchars(ess::$s['path']) . ' <a href="' . htmlspecialchars(nodes::$node_params->get("url", '#')) . '">' . htmlspecialchars(nodes::$node_params->get("url", 'mangler adresse')) . '</a> [<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . nodes::$node_id . '&edit_url">rediger</a>]</dd> </dl>'; } }