aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Impel.php71
-rw-r--r--Zotlabs/Module/Import.php6
-rw-r--r--Zotlabs/Module/Item.php5
-rw-r--r--Zotlabs/Module/New_channel.php8
4 files changed, 45 insertions, 45 deletions
diff --git a/Zotlabs/Module/Impel.php b/Zotlabs/Module/Impel.php
index e05027d9f..869de2669 100644
--- a/Zotlabs/Module/Impel.php
+++ b/Zotlabs/Module/Impel.php
@@ -1,5 +1,9 @@
<?php
-namespace Zotlabs\Module; /** @file */
+namespace Zotlabs\Module;
+
+use URLify;
+
+/** @file */
// import page design element
@@ -9,33 +13,33 @@ require_once('include/menu.php');
class Impel extends \Zotlabs\Web\Controller {
function init() {
-
+
$ret = array('success' => false);
-
+
if(! local_channel())
json_return_and_die($ret);
-
+
logger('impel: ' . print_r($_REQUEST,true), LOGGER_DATA);
-
+
$elm = $_REQUEST['element'];
$x = base64url_decode($elm);
if(! $x)
json_return_and_die($ret);
-
+
$j = json_decode($x,true);
if(! $j)
json_return_and_die($ret);
-
+
// logger('element: ' . print_r($j,true));
$channel = \App::get_channel();
-
+
$arr = array();
$is_menu = false;
-
+
// a portable menu has its links rewritten with the local baseurl
$portable_menu = false;
-
+
switch($j['type']) {
case 'webpage':
$arr['item_type'] = ITEM_TYPE_WEBPAGE;
@@ -58,12 +62,12 @@ class Impel extends \Zotlabs\Web\Controller {
case 'menu':
$is_menu = true;
$installed_type = t('menu');
- break;
+ break;
default:
logger('mod_impel: unrecognised element type' . print_r($j,true));
break;
}
-
+
if($is_menu) {
$m = array();
$m['menu_channel_id'] = local_channel();
@@ -73,23 +77,23 @@ class Impel extends \Zotlabs\Web\Controller {
$m['menu_created'] = datetime_convert($j['created']);
if($j['edited'])
$m['menu_edited'] = datetime_convert($j['edited']);
-
+
$m['menu_flags'] = 0;
if($j['flags']) {
if(in_array('bookmark',$j['flags']))
$m['menu_flags'] |= MENU_BOOKMARK;
if(in_array('system',$j['flags']))
$m['menu_flags'] |= MENU_SYSTEM;
-
+
}
-
+
$menu_id = menu_create($m);
-
+
if($menu_id) {
if(is_array($j['items'])) {
foreach($j['items'] as $it) {
$mitem = array();
-
+
$mitem['mitem_link'] = str_replace('[channelurl]',z_root() . '/channel/' . $channel['channel_address'],$it['link']);
$mitem['mitem_link'] = str_replace('[pageurl]',z_root() . '/page/' . $channel['channel_address'],$it['link']);
$mitem['mitem_link'] = str_replace('[cloudurl]',z_root() . '/cloud/' . $channel['channel_address'],$it['link']);
@@ -115,7 +119,7 @@ class Impel extends \Zotlabs\Web\Controller {
intval(local_channel())
);
}
- }
+ }
$ret['success'] = true;
}
$x = $ret;
@@ -132,22 +136,21 @@ class Impel extends \Zotlabs\Web\Controller {
$arr['owner_xchan'] = get_observer_hash();
$arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : get_observer_hash());
$arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode');
-
+
if(! $j['mid']) {
$j['uuid'] = item_message_id();
$j['mid'] = z_root() . '/item/' . $j['uuid'];
}
$arr['uuid'] = $j['uuid'];
$arr['mid'] = $arr['parent_mid'] = $j['mid'];
-
-
+
+
if($j['pagetitle']) {
- require_once('library/urlify/URLify.php');
- $pagetitle = strtolower(\URLify::transliterate($j['pagetitle']));
+ $pagetitle = strtolower(URLify::transliterate($j['pagetitle']));
}
-
+
// Verify ability to use html or php!!!
-
+
$execflag = ((intval($channel['channel_id']) == intval(local_channel()) && ($channel['channel_pageflags'] & PAGE_ALLOWCODE)) ? true : false);
$i = q("select id, edited, item_deleted from item where mid = '%s' and uid = %d limit 1",
@@ -156,7 +159,7 @@ class Impel extends \Zotlabs\Web\Controller {
);
\Zotlabs\Lib\IConfig::Set($arr,'system',$namespace,(($pagetitle) ? $pagetitle : substr($arr['mid'],0,16)),true);
-
+
if($i) {
$arr['id'] = $i[0]['id'];
// don't update if it has the same timestamp as the original
@@ -174,24 +177,24 @@ class Impel extends \Zotlabs\Web\Controller {
else
$x = item_store($arr,$execflag);
}
-
+
if($x && $x['success']) {
$item_id = $x['item_id'];
}
}
-
+
if($x['success']) {
$ret['success'] = true;
- info( sprintf( t('%s element installed'), $installed_type));
+ info( sprintf( t('%s element installed'), $installed_type));
}
else {
- notice( sprintf( t('%s element installation failed'), $installed_type));
+ notice( sprintf( t('%s element installation failed'), $installed_type));
}
-
- //??? should perhaps return ret?
+
+ //??? should perhaps return ret?
json_return_and_die(true);
-
+
}
-
+
}
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 2a7ea100c..ec47e370b 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -5,14 +5,12 @@ namespace Zotlabs\Module;
require_once('include/channel.php');
require_once('include/import.php');
require_once('include/perm_upgrade.php');
-require_once('library/urlify/URLify.php');
use App;
+use URLify;
use Zotlabs\Daemon\Master;
use Zotlabs\Lib\Libzot;
use Zotlabs\Web\Controller;
-use Zotlabs\Web\HTTPSig;
-use Zotlabs\Lib\PConfig;
/**
@@ -175,7 +173,7 @@ class Import extends Controller {
}
if ((!$x) || strlen($x) > 64) {
- $x = strtolower(\URLify::transliterate($newname));
+ $x = strtolower(URLify::transliterate($newname));
}
$newname = $x;
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 7099a54e5..34ca4fcdf 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
+use URLify;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\IConfig;
use Zotlabs\Lib\Enotify;
@@ -15,7 +16,6 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\ThreadListener;
use Zotlabs\Access\PermissionRoles;
-use App;
require_once('include/crypto.php');
require_once('include/items.php');
@@ -415,8 +415,7 @@ class Item extends Controller {
}
if($pagetitle) {
- require_once('library/urlify/URLify.php');
- $pagetitle = strtolower(\URLify::transliterate($pagetitle));
+ $pagetitle = strtolower(URLify::transliterate($pagetitle));
}
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index 84d492f8f..3b0b35258 100644
--- a/Zotlabs/Module/New_channel.php
+++ b/Zotlabs/Module/New_channel.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Module;
+use URLify;
+
require_once('include/channel.php');
require_once('include/permissions.php');
@@ -13,7 +15,6 @@ class New_channel extends \Zotlabs\Web\Controller {
$cmd = ((argc() > 1) ? argv(1) : '');
if($cmd === 'autofill.json') {
- require_once('library/urlify/URLify.php');
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['name']);
@@ -24,7 +25,7 @@ class New_channel extends \Zotlabs\Web\Controller {
}
if((! $x) || strlen($x) > 64)
- $x = strtolower(\URLify::transliterate($n));
+ $x = strtolower(URLify::transliterate($n));
$test = array();
@@ -46,7 +47,6 @@ class New_channel extends \Zotlabs\Web\Controller {
}
if($cmd === 'checkaddr.json') {
- require_once('library/urlify/URLify.php');
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['nick']);
if(! $n) {
@@ -60,7 +60,7 @@ class New_channel extends \Zotlabs\Web\Controller {
}
if((! $x) || strlen($x) > 64)
- $x = strtolower(\URLify::transliterate($n));
+ $x = strtolower(URLify::transliterate($n));
$test = array();