Browse Source

Update function calls

update function calls to new class.
pull/6048/head
Adam Magness 3 years ago
parent
commit
d9b558a8ed
  1. 3
      mod/editpost.php
  2. 5
      mod/filer.php
  3. 19
      mod/filerm.php
  4. 19
      mod/item.php
  5. 8
      src/Content/Widget.php
  6. 19
      src/Model/Item.php
  7. 2
      src/Protocol/DFRN.php

3
mod/editpost.php

@ -8,6 +8,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendcia\Model\FileTag;
use Friendica\Model\Item;
use Friendica\Database\DBA;
@ -118,7 +119,7 @@ function editpost_content(App $a)
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($item['title']),
'$placeholdertitle' => L10n::t('Set title'),
'$category' => file_tag_file_to_list($item['file'], 'category'),
'$category' => FileTag::fileToList($item['file'], 'category'),
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,

5
mod/filer.php

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Model\FileTag;
require_once 'include/items.php';
@ -22,11 +23,11 @@ function filer_content(App $a)
if ($item_id && strlen($term)) {
// file item
file_tag_save_file(local_user(), $item_id, $term);
FileTag::saveFile(local_user(), $item_id, $term);
} else {
// return filer dialog
$filetags = PConfig::get(local_user(), 'system', 'filetags');
$filetags = file_tag_file_to_list($filetags, 'file');
$filetags = FileTag::fileToList($filetags, 'file');
$filetags = explode(",", $filetags);
$tpl = get_markup_template("filer_dialog.tpl");

19
mod/filerm.php

@ -3,10 +3,12 @@
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Model\FileTag;
function filerm_content(App $a) {
if (! local_user()) {
function filerm_content(App $a)
{
if (! local_user())
{
killme();
}
@ -14,7 +16,9 @@ function filerm_content(App $a) {
$cat = unxmlify(trim($_GET['cat']));
$category = (($cat) ? true : false);
if ($category) {
if ($category)
{
$term = $cat;
}
@ -22,11 +26,10 @@ function filerm_content(App $a) {
Logger::log('filerm: tag ' . $term . ' item ' . $item_id);
if ($item_id && strlen($term)) {
file_tag_unsave_file(local_user(),$item_id,$term, $category);
if ($item_id && strlen($term))
{
FileTag::unsaveFile(local_user(), $item_id, $term, $category);
}
//$a->internalRedirect('network');
killme();
}

19
mod/item.php

@ -29,6 +29,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Model\FileTag;
use Friendica\Model\Item;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email;
@ -291,17 +292,21 @@ function item_post(App $a) {
}
}
if (!empty($categories)) {
if (!empty($categories))
{
// get the "fileas" tags for this post
$filedas = file_tag_file_to_list($categories, 'file');
$filedas = FileTag::fileToList($categories, 'file');
}
// save old and new categories, so we can determine what needs to be deleted from pconfig
$categories_old = $categories;
$categories = file_tag_list_to_file(trim(defaults($_REQUEST, 'category', '')), 'category');
$categories = FileTag::listToFile(trim(defaults($_REQUEST, 'category', '')), 'category');
$categories_new = $categories;
if (!empty($filedas)) {
if (!empty($filedas))
{
// append the fileas stuff to the new categories list
$categories .= file_tag_list_to_file($filedas, 'file');
$categories .= FileTag::listToFile($filedas, 'file');
}
// get contact info for poster
@ -712,7 +717,7 @@ function item_post(App $a) {
Item::update($fields, ['id' => $post_id]);
// update filetags in pconfig
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
if (!empty($_REQUEST['return']) && strlen($return_path)) {
Logger::log('return: ' . $return_path);
@ -749,7 +754,7 @@ function item_post(App $a) {
}
// update filetags in pconfig
file_tag_update_pconfig($uid, $categories_old, $categories_new, 'category');
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
// These notifications are sent if someone else is commenting other your wall
if ($parent) {

8
src/Content/Widget.php

@ -14,6 +14,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\FileTag;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
@ -185,8 +186,9 @@ class Widget
$terms = array();
$cnt = preg_match_all('/\[(.*?)\]/', $saved, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1]));
foreach ($matches as $mtch)
{
$unescaped = xmlify(FileTag::decode($mtch[1]));
$terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
}
}
@ -226,7 +228,7 @@ class Widget
if ($cnt) {
foreach ($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1]));
$unescaped = xmlify(FileTag::decode($mtch[1]));
$terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
}
}

19
src/Model/Item.php

@ -18,6 +18,7 @@ use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\FileTag;
use Friendica\Model\PermissionSet;
use Friendica\Model\ItemURI;
use Friendica\Object\Image;
@ -1002,18 +1003,24 @@ class Item extends BaseObject
$matches = false;
$cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
file_tag_unsave_file($item['uid'], $item['id'], $mtch[1],true);
if ($cnt)
{
foreach ($matches as $mtch)
{
FileTag::unsaveFile($item['uid'], $item['id'], $mtch[1],true);
}
}
$matches = false;
$cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
file_tag_unsave_file($item['uid'], $item['id'], $mtch[1],false);
if ($cnt)
{
foreach ($matches as $mtch)
{
FileTag::unsaveFile($item['uid'], $item['id'], $mtch[1],false);
}
}

2
src/Protocol/DFRN.php

@ -245,7 +245,7 @@ class DFRN
intval(TERM_CATEGORY),
intval($owner_id)
);
//$sql_extra .= file_tag_file_query('item',$category,'category');
//$sql_extra .= FileTag::fileQuery('item',$category,'category');
}
if ($public_feed && ! $converse) {

Loading…
Cancel
Save