mirror of
https://github.com/friendica/friendica
synced 2025-04-22 19:10:12 +00:00
Fix unused code in include
- Fix local formatting - Remove unused variable - Fix unreached breaks - Remove commented out code - Add some documentation
This commit is contained in:
parent
722782d553
commit
3b23f89ca2
24 changed files with 379 additions and 419 deletions
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
function create_files_from_item($itemid) {
|
||||
$a = get_app();
|
||||
|
||||
function create_files_from_item($itemid)
|
||||
{
|
||||
$messages = q("SELECT `guid`, `uid`, `id`, `edited`, `deleted`, `file`, `parent` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
|
||||
|
||||
if (!$messages)
|
||||
if (!$messages) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message = $messages[0];
|
||||
|
||||
|
@ -19,18 +19,23 @@ function create_files_from_item($itemid) {
|
|||
if ($message["deleted"])
|
||||
return;
|
||||
|
||||
if (preg_match_all("/\[(.*?)\]/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')",
|
||||
if (preg_match_all("/\[(.*?)\]/ism", $message["file"], $files)) {
|
||||
foreach ($files[1] as $file) {
|
||||
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_FILE), dbesc($file));
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match_all("/\<(.*?)\>/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')",
|
||||
if (preg_match_all("/\<(.*?)\>/ism", $message["file"], $files)) {
|
||||
foreach ($files[1] as $file) {
|
||||
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) {
|
||||
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)) {
|
||||
|
@ -39,11 +44,12 @@ function create_files_from_itemuri($itemuri, $uid) {
|
|||
}
|
||||
}
|
||||
|
||||
function update_files_for_items() {
|
||||
function update_files_for_items()
|
||||
{
|
||||
$messages = q("SELECT `id` FROM `item` where file !=''");
|
||||
|
||||
foreach ($messages as $message) {
|
||||
echo $message["id"]."\n";
|
||||
echo $message["id"] . "\n";
|
||||
create_files_from_item($message["id"]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue