<?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
$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;
+}
+
+?>