aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-06-22 22:43:08 -0700
committerzotlabs <mike@macgirvin.com>2017-06-22 22:43:08 -0700
commit6c771f84cedc71e7ffeecebe3e2fd7f912de3e7b (patch)
treec5a83b14454014795cc078cbabf1d056a8c8d609
parent02b7bc08033b21ea5438aa667e8dbb1fd72022bb (diff)
downloadvolse-hubzilla-6c771f84cedc71e7ffeecebe3e2fd7f912de3e7b.tar.gz
volse-hubzilla-6c771f84cedc71e7ffeecebe3e2fd7f912de3e7b.tar.bz2
volse-hubzilla-6c771f84cedc71e7ffeecebe3e2fd7f912de3e7b.zip
remove unused page_widgets.php include and provide a general function for loading sql from file to use in the cdav migration
-rw-r--r--Zotlabs/Module/Block.php2
-rw-r--r--Zotlabs/Module/Page.php1
-rw-r--r--Zotlabs/Module/Webpages.php9
-rwxr-xr-xinclude/dba/dba_driver.php14
-rw-r--r--include/page_widgets.php52
5 files changed, 14 insertions, 64 deletions
diff --git a/Zotlabs/Module/Block.php b/Zotlabs/Module/Block.php
index e671730f6..d0fed44fe 100644
--- a/Zotlabs/Module/Block.php
+++ b/Zotlabs/Module/Block.php
@@ -3,8 +3,6 @@ namespace Zotlabs\Module;
require_once('include/items.php');
require_once('include/conversation.php');
-require_once('include/page_widgets.php');
-
class Block extends \Zotlabs\Web\Controller {
diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php
index 7bc90c091..c142afe77 100644
--- a/Zotlabs/Module/Page.php
+++ b/Zotlabs/Module/Page.php
@@ -3,7 +3,6 @@ namespace Zotlabs\Module;
require_once('include/items.php');
require_once('include/conversation.php');
-require_once('include/page_widgets.php');
class Page extends \Zotlabs\Web\Controller {
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index 641e84b70..d59fcdb9f 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -179,11 +179,8 @@ class Webpages extends \Zotlabs\Web\Controller {
// so just list titles and an edit link.
- /** @TODO - this should be replaced with pagelist_widget */
-
$sql_extra = item_permissions_sql($owner);
-
$r = q("select * from iconfig left join item on iconfig.iid = item.id
where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'WEBPAGE' and item_type = %d
$sql_extra order by item.created desc",
@@ -191,12 +188,6 @@ class Webpages extends \Zotlabs\Web\Controller {
intval(ITEM_TYPE_WEBPAGE)
);
-// $r = q("select * from item_id left join item on item_id.iid = item.id
-// where item_id.uid = %d and service = 'WEBPAGE' and item_type = %d $sql_extra order by item.created desc",
-// intval($owner),
-// intval(ITEM_TYPE_WEBPAGE)
-// );
-
if(! $r)
$x['pagetitle'] = 'home';
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index b0ad7936c..4079bcaba 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -442,6 +442,20 @@ function db_getfunc($f) {
return $f;
}
+function db_load_file($f) {
+ // db errors should get logged to the logfile
+ $str = @file_get_contents($f);
+ $arr = explode(';', $str);
+ if($arr) {
+ foreach($arr as $a) {
+ if(strlen(trim($a))) {
+ $r = dbq(trim($a));
+ }
+ }
+ }
+}
+
+
// The logger function may make DB calls internally to query the system logging parameters.
// This can cause a recursion if database debugging is enabled.
// So this function preserves the current database debugging state and then turns it off
diff --git a/include/page_widgets.php b/include/page_widgets.php
deleted file mode 100644
index 3270de4a3..000000000
--- a/include/page_widgets.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-// A basic toolbar for observers with write_pages permissions
-
-function writepages_widget ($who,$which) {
- return replace_macros(get_markup_template('write_pages.tpl'), array(
- '$new' => t('New Page'),
- '$newurl' => "webpages/$who",
- '$edit' => t('Edit'),
- '$editurl' => "editwebpage/$who/$which"
- ));
-}
-
-
-
-// Chan is channel_id, $which is channel_address - we'll need to pass observer later too.
-
-function pagelist_widget ($owner,$which) {
-
- $r = q("select * from iconfig left join item on iconfig.iid = item.id where item_id.uid = %d
- and iconfig.cat = 'system' and iconfig.k = 'WEBPAGE' order by item.created desc",
- intval($owner)
- );
-
- $pages = null;
-
- if($r) {
- $pages = array();
- foreach($r as $rr) {
- $pages[$rr['iid']][] = array('url' => $rr['iid'],'pagetitle' => $rr['v'],'title' => $rr['title'],'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']),'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited']));
- }
- }
-
- //Build the base URL for edit links
- $url = z_root() . "/editwebpage/" . $which;
- // This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
- return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
- '$baseurl' => $url,
- '$edit' => t('Edit'),
- '$pages' => $pages,
- '$channel' => $which,
- '$view' => t('View'),
- '$preview' => t('Preview'),
- '$actions_txt' => t('Actions'),
- '$pagelink_txt' => t('Page Link'),
- '$title_txt' => t('Title'),
- '$created_txt' => t('Created'),
- '$edited_txt' => t('Edited')
-
- ));
-
-}