psql db schema test
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / add.inc
index b18a2ca302c744f6736bda613386f1d0a08b8181..e4b68d03f65cc2e975ab867cf9a30c1f44b868a5 100644 (file)
@@ -1,12 +1,15 @@
 <?php
 //funkcie na pridanie Re: alebo Re[x]: do nazvu (by Maniax)
-function title_reply_callback($_matches) {return ($_matches[1].($_matches[2] + 1).$_matches[3]);}
+function title_reply_callback($_matches) {
+       return ($_matches[1].($_matches[2] + 1).$_matches[3]);
+}
+
 function title_reply($_in) {
-if (preg_match('/^Re[:\[]/', $_in)) {
-if (preg_match('/^Re\[/', $_in))
-return (preg_replace_callback('/^(Re\[)(\d*)(\].*)$/', 'title_reply_callback', $_in));
-else return (preg_replace('/^(Re)(:.*)$/', '\1[2]\2', $_in));
-} else return ('Re: '.$_in);
+       if (preg_match('/^Re[:\[]/', $_in)) {
+               if (preg_match('/^Re\[/', $_in))
+                       return (preg_replace_callback('/^(Re\[)(\d*)(\].*)$/', 'title_reply_callback', $_in));
+               else return (preg_replace('/^(Re)(:.*)$/', '\1[2]\2', $_in));
+       } else return ('Re: '.$_in);
 }
 
 //Pridanie prispevku
@@ -89,31 +92,31 @@ function add() {
 
     $node_content=nodes::processContent($node_content);
 
-    if ($node_system_access=='crypto') {
-
-    require(INCLUDE_DIR.'crypto.inc');
-
-    if ($_SESSION['crypto'][$node_parent]) {
-    $key=$_SESSION['crypto'][$node_parent];
-    }
-    else {
-    $key = substr(md5(uniqid(rand(), true)),0,8);
-    }
-
-    $node_content=crypto::crypto($node_content,$key);
-
-
-
-    }
-
     $params['node_name']=$node_name;
     $params['template_id']=$template_id;
     $params['node_parent']=$node_parent;
     $params['node_system_access']=$node_system_access;
     $params['node_creator']=$_SESSION['user_id'];
-    $params['node_content']=mysql_escape_string($node_content);
+    $params['node_content']=db_escape_string($node_content);
     $params['external_link']=$external_link;
-    nodes::addNode($params);
-    return true;
+    $node_id=nodes::addNode($params);
+
+       if (!$node_id) {
+               return false;
+       }
+    
+    if ($_FILES['data_file']['tmp_name']) {
+       require(INCLUDE_DIR.'filez.inc');
+       filez::upload_data_file($node_id);
+    }
+
+    //substitute @@@ token by a node_id of a newly created node
+    $nc=preg_replace('/@@@/',$node_id,$params['node_content']);
+    if ($nc!=$params['node_content']) {
+       $db->update("update nodes set node_content='$nc' where node_id=$node_id");
     }
-    ?>
+
+    return true;
+}
+
+?>
This page took 0.104471 seconds and 4 git commands to generate.