From a03014a47c69e9bbda2cdc991bc7b49481bdbe7d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 20 Mar 2014 18:51:13 +0100 Subject: [PATCH] Adding functions for the file- and category handling --- include/files.php | 50 +++++++++++++++++++++++++++++++++++++++++++++++ mod/network.php | 5 ----- 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 include/files.php diff --git a/include/files.php b/include/files.php new file mode 100644 index 0000000000..b3bd7690fe --- /dev/null +++ b/include/files.php @@ -0,0 +1,50 @@ +/ism", $message["file"], $files)) + foreach ($files[1] as $file) + $r = q("INSERT INTO `term` (`uid`, `oid`, `otype`, `type`, `term`) VALUES (%d, %d, %d, %d, '%s')", + intval($message["uid"]), intval($itemid), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), dbesc($file)); +} + +function create_files_from_itemuri($itemuri, $uid) { + $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); + + if(count($messages)) { + foreach ($messages as $message) + create_files_from_item($message["id"]); + } +} + +function update_files_for_items() { + $messages = q("SELECT `id` FROM `item` where file !=''"); + + foreach ($messages as $message) { + echo $message["id"]."\n"; + create_files_from_item($message["id"]); + } +} +?> diff --git a/mod/network.php b/mod/network.php index 5b2908f0e9..e10e7b7880 100644 --- a/mod/network.php +++ b/mod/network.php @@ -1,9 +1,4 @@