Update function calls

update function calls to new class.
This commit is contained in:
Adam Magness 2018-10-30 14:51:45 -04:00
parent 3a604029eb
commit d9b558a8ed
7 changed files with 47 additions and 28 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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