From 490ab9e2c593275c0cf3d705a4ae52c6a22db4d9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 30 May 2016 16:42:29 -0700 Subject: begin moving config to zotlabs. Leave procedural stubs for backward comaptibility --- Zotlabs/Lib/Config.php | 166 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 Zotlabs/Lib/Config.php (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Config.php b/Zotlabs/Lib/Config.php new file mode 100644 index 000000000..d4ee1aeda --- /dev/null +++ b/Zotlabs/Lib/Config.php @@ -0,0 +1,166 @@ + Date: Mon, 30 May 2016 19:44:30 -0700 Subject: start removing reserved words from database column names (this run: addon and hook) --- Zotlabs/Extend/Hook.php | 8 ++++---- Zotlabs/Module/Admin.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php index 713165faf..fc1e95367 100644 --- a/Zotlabs/Extend/Hook.php +++ b/Zotlabs/Extend/Hook.php @@ -10,7 +10,7 @@ class Hook { $function = serialize($function); } - $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' and priority = %d and hook_version = %d LIMIT 1", + $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d LIMIT 1", dbesc($hook), dbesc($file), dbesc($function), @@ -23,13 +23,13 @@ class Hook { // To aid in upgrade and transition, remove old settings for any registered hooks that match in all respects except // for priority or hook_version - $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'", + $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `fn` = '%s'", dbesc($hook), dbesc($file), dbesc($function) ); - $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )", + $r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )", dbesc($hook), dbesc($file), dbesc($function), @@ -44,7 +44,7 @@ class Hook { if(is_array($function)) { $function = serialize($function); } - $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `function` = '%s' and priority = %d and hook_version = %d", + $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d", dbesc($hook), dbesc($file), dbesc($function), diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 8f15035d1..4cabd78ca 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1291,7 +1291,7 @@ class Admin extends \Zotlabs\Web\Controller { $admin_form = ''; - $r = q("select * from addon where plugin_admin = 1 and name = '%s' limit 1", + $r = q("select * from addon where plugin_admin = 1 and aname = '%s' limit 1", dbesc($plugin) ); -- cgit v1.2.3 From ca78374f30bd1b3a98b8b82552741a54b131cbf8 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 30 May 2016 22:41:45 -0700 Subject: remove unused tables --- Zotlabs/Module/Fsuggest.php | 117 -------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 Zotlabs/Module/Fsuggest.php (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Fsuggest.php b/Zotlabs/Module/Fsuggest.php deleted file mode 100644 index a371f9d21..000000000 --- a/Zotlabs/Module/Fsuggest.php +++ /dev/null @@ -1,117 +0,0 @@ -' . t('Suggest Friends') . ''; - - $o .= '
' . sprintf( t('Suggest a friend for %s'), $contact['name']) . '
'; - - $o .= '
'; - - // FIXME contact_selector deprecated, removed - // $o .= contact_selector('suggest','suggest-select', false, - // array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true)); - - - $o .= '
'; - $o .= '
'; - - return $o; - } -} -- cgit v1.2.3 From dfb6255f59980835d364402b372dd39f2b41ee7c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 17:50:47 -0700 Subject: more removal of reserved words from DB schemas --- Zotlabs/Module/Api.php | 2 +- Zotlabs/Module/Settings.php | 6 +++--- Zotlabs/Web/SessionHandler.php | 6 +++--- Zotlabs/Zot/Verify.php | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Api.php b/Zotlabs/Module/Api.php index 3e7f23b6c..e4744c29f 100644 --- a/Zotlabs/Module/Api.php +++ b/Zotlabs/Module/Api.php @@ -107,7 +107,7 @@ class Api extends \Zotlabs\Web\Controller { $r = q("SELECT `clients`.* FROM `clients`, `tokens` WHERE `clients`.`client_id`=`tokens`.`client_id` - AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'", + AND `tokens`.`id`='%s' AND `tokens`.`auth_scope`='request'", dbesc($token)); if (!count($r)) diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 5687ce84b..43162a2b0 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -78,7 +78,7 @@ class Settings extends \Zotlabs\Web\Controller { $r = q("UPDATE clients SET client_id='%s', pw='%s', - name='%s', + clname='%s', redirect_uri='%s', icon='%s', uid=%d @@ -91,7 +91,7 @@ class Settings extends \Zotlabs\Web\Controller { intval(local_channel()), dbesc($key)); } else { - $r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid) + $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid) VALUES ('%s','%s','%s','%s','%s',%d)", dbesc($key), dbesc($secret), @@ -615,7 +615,7 @@ class Settings extends \Zotlabs\Web\Controller { '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), - '$name' => array('name', t('Name'), $app['name'] , ''), + '$name' => array('name', t('Name'), $app['clname'] , ''), '$key' => array('key', t('Consumer Key'), $app['client_id'], ''), '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''), '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''), diff --git a/Zotlabs/Web/SessionHandler.php b/Zotlabs/Web/SessionHandler.php index 6980a6408..6e7333b4b 100644 --- a/Zotlabs/Web/SessionHandler.php +++ b/Zotlabs/Web/SessionHandler.php @@ -18,10 +18,10 @@ class SessionHandler implements \SessionHandlerInterface { function read ($id) { if($id) { - $r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id)); + $r = q("SELECT `sess_data` FROM `session` WHERE `sid`= '%s'", dbesc($id)); if($r) { - return $r[0]['data']; + return $r[0]['sess_data']; } else { q("INSERT INTO `session` (sid, expire) values ('%s', '%s')", @@ -59,7 +59,7 @@ class SessionHandler implements \SessionHandlerInterface { } q("UPDATE `session` - SET `data` = '%s', `expire` = '%s' WHERE `sid` = '%s'", + SET `sess_data` = '%s', `expire` = '%s' WHERE `sid` = '%s'", dbesc($data), dbesc($expire), dbesc($id) diff --git a/Zotlabs/Zot/Verify.php b/Zotlabs/Zot/Verify.php index 1192202db..06bd3188c 100644 --- a/Zotlabs/Zot/Verify.php +++ b/Zotlabs/Zot/Verify.php @@ -6,7 +6,7 @@ namespace Zotlabs\Zot; class Verify { function create($type,$channel_id,$token,$meta) { - return q("insert into verify ( type, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )", + return q("insert into verify ( vtype, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )", dbesc($type), intval($channel_id), dbesc($token), @@ -16,7 +16,7 @@ class Verify { } function match($type,$channel_id,$token,$meta) { - $r = q("select id from verify where type = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1", + $r = q("select id from verify where vtype = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1", dbesc($type), intval($channel_id), dbesc($token), @@ -32,7 +32,7 @@ class Verify { } function purge($type,$interval) { - q("delete from verify where type = '%s' and created < %s - INTERVAL %s", + q("delete from verify where vtype = '%s' and created < %s - INTERVAL %s", dbesc($type), db_utcnow(), db_quoteinterval($interval) -- cgit v1.2.3 From b1259876bf398880e7b0c1b44d90f94983243e72 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 21:45:33 -0700 Subject: more db column renames --- Zotlabs/Module/Acl.php | 8 ++++---- Zotlabs/Module/Chat.php | 2 +- Zotlabs/Module/Contactgroup.php | 4 ++-- Zotlabs/Module/Events.php | 2 +- Zotlabs/Module/Filer.php | 2 +- Zotlabs/Module/Filerm.php | 2 +- Zotlabs/Module/Group.php | 14 +++++++------- Zotlabs/Module/Import.php | 6 +++++- Zotlabs/Module/Item.php | 8 ++++---- Zotlabs/Module/Lockview.php | 8 ++++---- Zotlabs/Module/Network.php | 2 +- Zotlabs/Module/Photos.php | 2 +- Zotlabs/Module/Profiles.php | 39 +++++++++++++++++---------------------- Zotlabs/Module/Search.php | 2 +- Zotlabs/Module/Search_ac.php | 2 +- Zotlabs/Module/Settings.php | 8 ++++---- Zotlabs/Module/Tagrm.php | 2 +- 17 files changed, 56 insertions(+), 57 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 62ac29286..7bc197a93 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -53,13 +53,13 @@ class Acl extends \Zotlabs\Web\Controller { if ($type=='' || $type=='g'){ - $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name` + $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`gname` FROM `groups`,`group_member` WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d AND `group_member`.`gid`=`groups`.`id` $sql_extra GROUP BY `groups`.`id` - ORDER BY `groups`.`name` + ORDER BY `groups`.`gname` LIMIT %d OFFSET %d", intval(local_channel()), intval($count), @@ -67,11 +67,11 @@ class Acl extends \Zotlabs\Web\Controller { ); foreach($r as $g){ - // logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id'])); + // logger('acl: group: ' . $g['gname'] . ' members: ' . group_get_members_xchan($g['id'])); $groups[] = array( "type" => "g", "photo" => "images/twopeople.png", - "name" => $g['name'], + "name" => $g['gname'], "id" => $g['id'], "xid" => $g['hash'], "uids" => group_get_members_xchan($g['id']), diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index d14c32b7d..026e8369a 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -243,7 +243,7 @@ class Chat extends \Zotlabs\Web\Controller { $rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( - '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['name']), + '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['fullname']), '$name' => t('Name'), '$baseurl' => z_root(), '$nickname' => \App::$profile['channel_address'], diff --git a/Zotlabs/Module/Contactgroup.php b/Zotlabs/Module/Contactgroup.php index 497442ff4..bbe56b4ad 100644 --- a/Zotlabs/Module/Contactgroup.php +++ b/Zotlabs/Module/Contactgroup.php @@ -41,10 +41,10 @@ class Contactgroup extends \Zotlabs\Web\Controller { if($change) { if(in_array($change,$preselected)) { - group_rmv_member(local_channel(),$group['name'],$change); + group_rmv_member(local_channel(),$group['gname'],$change); } else { - group_add_member(local_channel(),$group['name'],$change); + group_add_member(local_channel(),$group['gname'],$change); } } } diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 2b5e239f9..3996473b7 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -171,7 +171,7 @@ class Events extends \Zotlabs\Web\Controller { foreach($cats as $cat) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => TERM_CATEGORY, + 'ttype' => TERM_CATEGORY, 'otype' => TERM_OBJ_POST, 'term' => trim($cat), 'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat)) diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index 607d088db..6a57cdb2a 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -39,7 +39,7 @@ class Filer extends \Zotlabs\Web\Controller { } else { $filetags = array(); - $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc", + $r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc", intval(local_channel()), intval(TERM_FILE) ); diff --git a/Zotlabs/Module/Filerm.php b/Zotlabs/Module/Filerm.php index eb9a42c1e..cbf6a118d 100644 --- a/Zotlabs/Module/Filerm.php +++ b/Zotlabs/Module/Filerm.php @@ -22,7 +22,7 @@ class Filerm extends \Zotlabs\Web\Controller { logger('filerm: tag ' . $term . ' item ' . $item_id); if($item_id && strlen($term)) { - $r = q("delete from term where uid = %d and type = %d and oid = %d and term = '%s'", + $r = q("delete from term where uid = %d and ttype = %d and oid = %d and term = '%s'", intval(local_channel()), intval(($category) ? TERM_CATEGORY : TERM_FILE), intval($item_id), diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index 144797baf..254ee6ef2 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -47,8 +47,8 @@ class Group extends \Zotlabs\Web\Controller { $groupname = notags(trim($_POST['groupname'])); $public = intval($_POST['public']); - if((strlen($groupname)) && (($groupname != $group['name']) || ($public != $group['visible']))) { - $r = q("UPDATE `groups` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d", + if((strlen($groupname)) && (($groupname != $group['gname']) || ($public != $group['visible']))) { + $r = q("UPDATE `groups` SET `gname` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d", dbesc($groupname), intval($public), intval(local_channel()), @@ -106,7 +106,7 @@ class Group extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) - $result = group_rmv(local_channel(),$r[0]['name']); + $result = group_rmv(local_channel(),$r[0]['gname']); if($result) info( t('Privacy group removed.') . EOL); else @@ -156,10 +156,10 @@ class Group extends \Zotlabs\Web\Controller { if($change) { if(in_array($change,$preselected)) { - group_rmv_member(local_channel(),$group['name'],$change); + group_rmv_member(local_channel(),$group['gname'],$change); } else { - group_add_member(local_channel(),$group['name'],$change); + group_add_member(local_channel(),$group['gname'],$change); } $members = group_get_members($group['id']); @@ -181,7 +181,7 @@ class Group extends \Zotlabs\Web\Controller { $context = $context + array( '$title' => t('Privacy group editor'), - '$gname' => array('groupname',t('Privacy group name: '),$group['name'], ''), + '$gname' => array('groupname',t('Privacy group name: '),$group['gname'], ''), '$gid' => $group['id'], '$drop' => $drop_txt, '$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''), @@ -209,7 +209,7 @@ class Group extends \Zotlabs\Web\Controller { $groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode); } else - group_rmv_member(local_channel(),$group['name'],$member['xchan_hash']); + group_rmv_member(local_channel(),$group['gname'],$member['xchan_hash']); } $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_self = 0 and abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc", diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 57ced22a3..122e27e90 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -408,8 +408,12 @@ class Import extends \Zotlabs\Web\Controller { $saved = array(); foreach($groups as $group) { $saved[$group['hash']] = array('old' => $group['id']); + if(array_key_exists('name',$group)) { + $group['gname'] = $group['name']; + unset($group['name']); + } unset($group['id']); - $group['uid'] = $channel['channel_id']; + $group['uid'] = $channel['channel_id']; dbesc_array($group); $r = dbq("INSERT INTO groups (`" . implode("`, `", array_keys($group)) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 041939ad8..2601feb0a 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -581,7 +581,7 @@ class Item extends \Zotlabs\Web\Controller { if($success['replaced']) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => $success['termtype'], + 'ttype' => $success['termtype'], 'otype' => TERM_OBJ_POST, 'term' => $success['term'], 'url' => $success['url'] @@ -666,7 +666,7 @@ class Item extends \Zotlabs\Web\Controller { foreach($cats as $cat) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => TERM_CATEGORY, + 'ttype' => TERM_CATEGORY, 'otype' => TERM_OBJ_POST, 'term' => trim($cat), 'url' => $owner_xchan['xchan_url'] . '?f=&cat=' . urlencode(trim($cat)) @@ -676,7 +676,7 @@ class Item extends \Zotlabs\Web\Controller { if($orig_post) { // preserve original tags - $t = q("select * from term where oid = %d and otype = %d and uid = %d and type in ( %d, %d, %d )", + $t = q("select * from term where oid = %d and otype = %d and uid = %d and ttype in ( %d, %d, %d )", intval($orig_post['id']), intval(TERM_OBJ_POST), intval($profile_uid), @@ -688,7 +688,7 @@ class Item extends \Zotlabs\Web\Controller { foreach($t as $t1) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => $t1['type'], + 'ttype' => $t1['type'], 'otype' => TERM_OBJ_POST, 'term' => $t1['term'], 'url' => $t1['url'], diff --git a/Zotlabs/Module/Lockview.php b/Zotlabs/Module/Lockview.php index 0df0dd4da..4776e1c56 100644 --- a/Zotlabs/Module/Lockview.php +++ b/Zotlabs/Module/Lockview.php @@ -88,10 +88,10 @@ class Lockview extends \Zotlabs\Web\Controller { stringify_array_elms($deny_users,true); if(count($allowed_groups)) { - $r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); + $r = q("SELECT gname FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . $rr['name'] . '
  • '; + $l[] = '
  • ' . $rr['gname'] . '
  • '; } if(count($allowed_users)) { $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ',$allowed_users) . " )"); @@ -100,10 +100,10 @@ class Lockview extends \Zotlabs\Web\Controller { $l[] = '
  • ' . $rr['xchan_name'] . '
  • '; } if(count($deny_groups)) { - $r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); + $r = q("SELECT gname FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . $rr['name'] . '
  • '; + $l[] = '
  • ' . $rr['gname'] . '
  • '; } if(count($deny_users)) { $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ', $deny_users) . " )"); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 238df3593..87ed326e2 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -223,7 +223,7 @@ class Network extends \Zotlabs\Web\Controller { if($x) { $title = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => t('Privacy group: ') . $x['name'] + '$title' => t('Privacy group: ') . $x['gname'] )); } diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 7186209ba..ecf966032 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -440,7 +440,7 @@ class Photos extends \Zotlabs\Web\Controller { if($success['replaced']) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => $success['termtype'], + 'ttype' => $success['termtype'], 'otype' => TERM_OBJ_POST, 'term' => $success['term'], 'url' => $success['url'] diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 54780499b..06e5cfd7b 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -67,16 +67,16 @@ class Profiles extends \Zotlabs\Web\Controller { $name = t('Profile-') . ($num_profiles + 1); - $r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1", + $r1 = q("SELECT `fullname`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1", intval(local_channel())); - $r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `name`, `photo`, `thumb`) + $r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `fullname`, `photo`, `thumb`) VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s' )", intval(get_account_id()), intval(local_channel()), dbesc(random_string()), dbesc($name), - dbesc($r1[0]['name']), + dbesc($r1[0]['fullname']), dbesc($r1[0]['photo']), dbesc($r1[0]['thumb']) ); @@ -277,14 +277,14 @@ class Profiles extends \Zotlabs\Web\Controller { $name = escape_tags(trim($_POST['name'])); - if($orig[0]['name'] != $name) { + if($orig[0]['fullname'] != $name) { $namechanged = true; $v = validate_channelname($name); if($v) { notice($v); $namechanged = false; - $name = $orig[0]['name']; + $name = $orig[0]['fullname']; } } @@ -350,7 +350,7 @@ class Profiles extends \Zotlabs\Web\Controller { $withchanged = false; if(strlen($with)) { - if($with != strip_tags($orig[0]['with'])) { + if($with != strip_tags($orig[0]['partner'])) { $withchanged = true; $prf = ''; $lookup = $with; @@ -382,7 +382,7 @@ class Profiles extends \Zotlabs\Web\Controller { } } else - $with = $orig[0]['with']; + $with = $orig[0]['partner']; } $profile_fields_basic = get_profile_fields_basic(); @@ -439,7 +439,7 @@ class Profiles extends \Zotlabs\Web\Controller { $changes[] = t('Dislikes'); $value = $dislikes; } - if($work != $orig[0]['work']) { + if($work != $orig[0]['employment']) { $changes[] = t('Work/Employment'); } if($religion != $orig[0]['religion']) { @@ -486,7 +486,7 @@ class Profiles extends \Zotlabs\Web\Controller { $r = q("UPDATE `profile` SET `profile_name` = '%s', - `name` = '%s', + `fullname` = '%s', `pdesc` = '%s', `gender` = '%s', `dob` = '%s', @@ -496,7 +496,7 @@ class Profiles extends \Zotlabs\Web\Controller { `postal_code` = '%s', `country_name` = '%s', `marital` = '%s', - `with` = '%s', + `partner` = '%s', `howlong` = '%s', `sexual` = '%s', `homepage` = '%s', @@ -515,7 +515,7 @@ class Profiles extends \Zotlabs\Web\Controller { `tv` = '%s', `film` = '%s', `romance` = '%s', - `work` = '%s', + `employment` = '%s', `education` = '%s', `hide_friends` = %d WHERE `id` = %d AND `uid` = %d", @@ -591,7 +591,7 @@ class Profiles extends \Zotlabs\Web\Controller { } - function get() { + function get() { $o = ''; @@ -627,8 +627,6 @@ class Profiles extends \Zotlabs\Web\Controller { } $editselect = 'none'; - // if(feature_enabled(local_channel(),'richtext')) - // $editselect = 'textareas'; \App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( '$baseurl' => z_root(), @@ -712,7 +710,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, - '$name' => array('name', t('Your full name'), $r[0]['name'], t('Required'), '*'), + '$name' => array('name', t('Your full name'), $r[0]['fullname'], t('Required'), '*'), '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, @@ -725,7 +723,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), - '$with' => array('with', t("Who (if applicable)"), $r[0]['with'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), + '$with' => array('with', t("Who (if applicable)"), $r[0]['partner'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), '$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), @@ -743,7 +741,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']), '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), '$romance' => array('romance',t('Love/Romance'), $r[0]['romance']), - '$work' => array('work', t('Work/Employment'), $r[0]['work']), + '$work' => array('work', t('Work/Employment'), $r[0]['employment']), '$education' => array('education', t('School/Education'), $r[0]['education']), '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$channels' => array('channels', t('My other channels'), $r[0]['channels']), @@ -759,7 +757,7 @@ class Profiles extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_channel()); - if(count($r)) { + if($r) { $tpl = get_markup_template('profile_entry.tpl'); foreach($r as $rr) { @@ -780,10 +778,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$cr_new' => t('Create New'), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), '$profiles' => $profiles - )); - - - + )); } return $o; diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index fcc2506fc..402a27d40 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -79,7 +79,7 @@ class Search extends \Zotlabs\Web\Controller { return $o; if($tag) { - $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and type in ( %d , %d) and term = '%s') ", + $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and ttype in ( %d , %d) and term = '%s') ", intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG), diff --git a/Zotlabs/Module/Search_ac.php b/Zotlabs/Module/Search_ac.php index 78bcf374d..4e936d97b 100644 --- a/Zotlabs/Module/Search_ac.php +++ b/Zotlabs/Module/Search_ac.php @@ -46,7 +46,7 @@ class Search_ac extends \Zotlabs\Web\Controller { } } - $r = q("select distinct term, tid, url from term where type in ( %d, %d ) $tag_sql_extra group by term order by term asc", + $r = q("select distinct term, tid, url from term where ttype in ( %d, %d ) $tag_sql_extra group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG) ); diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 43162a2b0..875004fae 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -337,7 +337,7 @@ class Settings extends \Zotlabs\Web\Controller { } $hide_presence = 1 - (intval($role_permissions['online'])); if($role_permissions['default_collection']) { - $r = q("select hash from groups where uid = %d and name = '%s' limit 1", + $r = q("select hash from groups where uid = %d and gname = '%s' limit 1", intval(local_channel()), dbesc( t('Friends') ) ); @@ -345,7 +345,7 @@ class Settings extends \Zotlabs\Web\Controller { require_once('include/group.php'); group_add(local_channel(), t('Friends')); group_add_member(local_channel(),t('Friends'),$channel['channel_hash']); - $r = q("select hash from groups where uid = %d and name = '%s' limit 1", + $r = q("select hash from groups where uid = %d and gname = '%s' limit 1", intval(local_channel()), dbesc( t('Friends') ) ); @@ -537,7 +537,7 @@ class Settings extends \Zotlabs\Web\Controller { dbesc(datetime_convert()), dbesc($channel['channel_hash']) ); - $r = q("update profile set name = '%s' where uid = %d and is_default = 1", + $r = q("update profile set fullname = '%s' where uid = %d and is_default = 1", dbesc($username), intval($channel['channel_id']) ); @@ -562,7 +562,7 @@ class Settings extends \Zotlabs\Web\Controller { - function get() { + function get() { $o = ''; nav_set_selected('settings'); diff --git a/Zotlabs/Module/Tagrm.php b/Zotlabs/Module/Tagrm.php index 81ae30aa5..42aa6e90f 100644 --- a/Zotlabs/Module/Tagrm.php +++ b/Zotlabs/Module/Tagrm.php @@ -54,7 +54,7 @@ class Tagrm extends \Zotlabs\Web\Controller { - function get() { + function get() { if(! local_channel()) { goaway(z_root() . '/' . $_SESSION['photo_return']); -- cgit v1.2.3 From a9d7acda279ebb7f2b3cd61a91a5e1d8b590dcf2 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 1 Jun 2016 21:48:54 -0700 Subject: the rest of the schema updates - WARNING: some third party plugins may fail; e.g. embedphotos and chess. $item['object'] is now $item['obj'] and $photo['type'] is $photo['mimetype'], $photo['scale'] is $photo['imgscale'] and $photo['data'] is now $photo['content']. There are a number of other changes, but these are the ones noted to cause issues with third-party plugins. The project plugins have been updated. Please note any new issues as this effort touched a lot of code in a lot of files. --- Zotlabs/Daemon/Cron_daily.php | 2 +- Zotlabs/Lib/Enotify.php | 16 ++++----- Zotlabs/Module/Attach.php | 4 +-- Zotlabs/Module/Cal.php | 20 +++++------ Zotlabs/Module/Connedit.php | 2 +- Zotlabs/Module/Cover_photo.php | 44 ++++++++++++------------ Zotlabs/Module/Events.php | 42 +++++++++++------------ Zotlabs/Module/Fbrowser.php | 4 +-- Zotlabs/Module/Like.php | 2 +- Zotlabs/Module/Notifications.php | 6 ++-- Zotlabs/Module/Notify.php | 4 +-- Zotlabs/Module/Oep.php | 16 ++++----- Zotlabs/Module/Photo.php | 18 +++++----- Zotlabs/Module/Photos.php | 73 ++++++++++++++++++++-------------------- Zotlabs/Module/Ping.php | 38 ++++++++++----------- Zotlabs/Module/Poke.php | 2 +- Zotlabs/Module/Profile_photo.php | 44 ++++++++++++------------ Zotlabs/Module/Share.php | 2 +- Zotlabs/Module/Sharedwithme.php | 4 +-- Zotlabs/Module/Subthread.php | 2 +- Zotlabs/Module/Tagger.php | 2 +- Zotlabs/Module/Tasks.php | 20 ++++------- Zotlabs/Module/Thing.php | 2 +- Zotlabs/Storage/Directory.php | 2 +- Zotlabs/Storage/File.php | 14 ++++---- 25 files changed, 189 insertions(+), 196 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index fbc255d2f..a16d49853 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -34,7 +34,7 @@ class Cron_daily { // expire any read notifications over a month old - q("delete from notify where seen = 1 and date < %s - INTERVAL %s", + q("delete from notify where seen = 1 and created < %s - INTERVAL %s", db_utcnow(), db_quoteinterval('30 DAY') ); diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index ccb538ef5..56c717468 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -348,7 +348,7 @@ class Enotify { $hash = random_string(); $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1", dbesc($hash)); - if (count($r)) + if ($r) $dups = true; } while ($dups === true); @@ -356,16 +356,16 @@ class Enotify { $datarray = array(); $datarray['hash'] = $hash; $datarray['sender_hash'] = $sender['xchan_hash']; - $datarray['name'] = $sender['xchan_name']; + $datarray['xname'] = $sender['xchan_name']; $datarray['url'] = $sender['xchan_url']; $datarray['photo'] = $sender['xchan_photo_s']; - $datarray['date'] = datetime_convert(); + $datarray['created'] = datetime_convert(); $datarray['aid'] = $recip['channel_account_id']; $datarray['uid'] = $recip['channel_id']; $datarray['link'] = $itemlink; $datarray['parent'] = $parent_mid; $datarray['parent_item'] = $parent_item; - $datarray['type'] = $params['type']; + $datarray['ntype'] = $params['type']; $datarray['verb'] = $params['verb']; $datarray['otype'] = $params['otype']; $datarray['abort'] = false; @@ -394,19 +394,19 @@ class Enotify { } } - $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,seen,type,verb,otype) + $r = q("insert into notify (hash,xname,url,photo,created,aid,uid,link,parent,seen,ntype,verb,otype) values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')", dbesc($datarray['hash']), - dbesc($datarray['name']), + dbesc($datarray['xname']), dbesc($datarray['url']), dbesc($datarray['photo']), - dbesc($datarray['date']), + dbesc($datarray['created']), intval($datarray['aid']), intval($datarray['uid']), dbesc($datarray['link']), dbesc($datarray['parent']), intval($seen), - intval($datarray['type']), + intval($datarray['ntype']), dbesc($datarray['verb']), dbesc($datarray['otype']) ); diff --git a/Zotlabs/Module/Attach.php b/Zotlabs/Module/Attach.php index 8948b66d7..de941d52c 100644 --- a/Zotlabs/Module/Attach.php +++ b/Zotlabs/Module/Attach.php @@ -40,7 +40,7 @@ class Attach extends \Zotlabs\Web\Controller { header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"'); if(intval($r['data']['os_storage'])) { - $fname = dbunescbin($r['data']['data']); + $fname = dbunescbin($r['data']['content']); if(strpos($fname,'store') !== false) $istream = fopen($fname,'rb'); else @@ -53,7 +53,7 @@ class Attach extends \Zotlabs\Web\Controller { } } else - echo dbunescbin($r['data']['data']); + echo dbunescbin($r['data']['content']); killme(); } diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index a1adb30e5..1da42684d 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -91,7 +91,7 @@ class Cal extends \Zotlabs\Web\Controller { $mode = 'view'; $y = 0; $m = 0; - $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); + $ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : ''); // logger('args: ' . print_r(\App::$argv,true)); @@ -146,7 +146,7 @@ class Cal extends \Zotlabs\Web\Controller { $ftext = datetime_convert('UTC',$tz,$fdt); $ftext = substr($ftext,0,14) . "00:00"; - $type = ((x($orig_event)) ? $orig_event['type'] : 'event'); + $type = ((x($orig_event)) ? $orig_event['etype'] : 'event'); $f = get_config('system','event_input_format'); if(! $f) @@ -157,7 +157,7 @@ class Cal extends \Zotlabs\Web\Controller { $show_bd = perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_contacts'); if(! $show_bd) { - $sql_extra .= " and event.type != 'birthday' "; + $sql_extra .= " and event.etype != 'birthday' "; } @@ -225,8 +225,8 @@ class Cal extends \Zotlabs\Web\Controller { $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan from event left join item on event_hash = resource_id where resource_type = 'event' and event.uid = %d $ignored - AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' ) - OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) $sql_extra ", + AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) + OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) $sql_extra ", intval($channel['channel_id']), dbesc($start), dbesc($finish), @@ -247,7 +247,7 @@ class Cal extends \Zotlabs\Web\Controller { if($r) { foreach($r as $rr) { - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); if(! x($links,$j)) $links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j; } @@ -262,15 +262,15 @@ class Cal extends \Zotlabs\Web\Controller { foreach($r as $rr) { - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); - $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt)); + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); + $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt)); $d = day_translate($d); - $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c')); + $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c')); + $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c')); } diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index c5c38b96a..33deac4c8 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -270,7 +270,7 @@ class Connedit extends \Zotlabs\Web\Controller { array('rel' => 'photo', 'type' => \App::$poi['xchan_photo_mimetype'], 'href' => \App::$poi['xchan_photo_l']) ), ); - $xarr['object'] = json_encode($obj); + $xarr['obj'] = json_encode($obj); $xarr['obj_type'] = ACTIVITY_OBJ_PERSON; $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . \App::$poi['xchan_url'] . ']' . \App::$poi['xchan_name'] . '[/zrl]'; diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 371713c8d..a72c3389f 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -80,7 +80,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { $profile = $r[0]; } - $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND scale = 0 LIMIT 1", + $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = 0 LIMIT 1", dbesc($image_id), intval(local_channel()) ); @@ -88,9 +88,9 @@ class Cover_photo extends \Zotlabs\Web\Controller { if($r) { $base_image = $r[0]; - $base_image['data'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['data']) : dbunescbin($base_image['data'])); + $base_image['content'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['content']) : dbunescbin($base_image['content'])); - $im = photo_factory($base_image['data'], $base_image['type']); + $im = photo_factory($base_image['content'], $base_image['mimetype']); if($im->is_valid()) { // We are scaling and cropping the relative pixel locations to the original photo instead of the @@ -99,7 +99,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { // First load the scaled photo to check its size. (Should probably pass this in the post form and save // a query.) - $g = q("select width, height from photo where resource_id = '%s' and uid = %d and scale = 3", + $g = q("select width, height from photo where resource_id = '%s' and uid = %d and imgscale = 3", dbesc($image_id), intval(local_channel()) ); @@ -133,26 +133,26 @@ class Cover_photo extends \Zotlabs\Web\Controller { $p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'], 'filename' => $base_image['filename'], 'album' => t('Cover Photos')); - $p['scale'] = 7; + $p['imgscale'] = 7; $p['photo_usage'] = PHOTO_COVER; $r1 = $im->save($p); $im->doScaleImage(850,310); - $p['scale'] = 8; + $p['imgscale'] = 8; $r2 = $im->save($p); $im->doScaleImage(425,160); - $p['scale'] = 9; + $p['imgscale'] = 9; $r3 = $im->save($p); if($r1 === false || $r2 === false || $r3 === false) { // if one failed, delete them all so we can start over. notice( t('Image resize failed.') . EOL ); - $x = q("delete from photo where resource_id = '%s' and uid = %d and scale >= 7 ", + $x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale >= 7 ", dbesc($base_image['resource_id']), local_channel() ); @@ -183,7 +183,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { logger('attach_store: ' . print_r($res,true)); if($res && intval($res['data']['is_photo'])) { - $i = q("select * from photo where resource_id = '%s' and uid = %d and scale = 0", + $i = q("select * from photo where resource_id = '%s' and uid = %d and imgscale = 0", dbesc($hash), intval(local_channel()) ); @@ -195,10 +195,10 @@ class Cover_photo extends \Zotlabs\Web\Controller { $os_storage = false; foreach($i as $ii) { - $smallest = intval($ii['scale']); + $smallest = intval($ii['imgscale']); $os_storage = intval($ii['os_storage']); - $imagedata = $ii['data']; - $filetype = $ii['type']; + $imagedata = $ii['content']; + $filetype = $ii['mimetype']; } } @@ -224,10 +224,10 @@ class Cover_photo extends \Zotlabs\Web\Controller { $arr['obj_type'] = ACTIVITY_OBJ_PHOTO; $arr['verb'] = ACTIVITY_UPDATE; - $arr['object'] = json_encode(array( + $arr['obj'] = json_encode(array( 'type' => $arr['obj_type'], 'id' => z_root() . '/photo/' . $photo['resource_id'] . '-7', - 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7') + 'link' => array('rel' => 'photo', 'type' => $photo['mimetype'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7') )); if($profile && stripos($profile['gender'],t('female')) !== false) @@ -295,7 +295,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { $resource_id = argv(2); - $r = q("SELECT id, album, scale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY scale ASC", + $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC", intval(local_channel()), dbesc($resource_id) ); @@ -305,11 +305,11 @@ class Cover_photo extends \Zotlabs\Web\Controller { } $havescale = false; foreach($r as $rr) { - if($rr['scale'] == 7) + if($rr['imgscale'] == 7) $havescale = true; } - $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", + $r = q("SELECT `content`, `mimetype`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", intval($r[0]['id']), intval(local_channel()) @@ -320,15 +320,15 @@ class Cover_photo extends \Zotlabs\Web\Controller { } if(intval($r[0]['os_storage'])) - $data = @file_get_contents($r[0]['data']); + $data = @file_get_contents($r[0]['content']); else - $data = dbunescbin($r[0]['data']); + $data = dbunescbin($r[0]['content']); - $ph = photo_factory($data, $r[0]['type']); + $ph = photo_factory($data, $r[0]['mimetype']); $smallest = 0; if($ph->is_valid()) { // go ahead as if we have just uploaded a new photo to crop - $i = q("select resource_id, scale from photo where resource_id = '%s' and uid = %d and scale = 0", + $i = q("select resource_id, imgscale from photo where resource_id = '%s' and uid = %d and imgscale = 0", dbesc($r[0]['resource_id']), intval(local_channel()) ); @@ -336,7 +336,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { if($i) { $hash = $i[0]['resource_id']; foreach($i as $ii) { - $smallest = intval($ii['scale']); + $smallest = intval($ii['imgscale']); } } } diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 3996473b7..3f3f9fb4c 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -180,12 +180,12 @@ class Events extends \Zotlabs\Web\Controller { } $datarray = array(); - $datarray['start'] = $start; - $datarray['finish'] = $finish; + $datarray['dtstart'] = $start; + $datarray['dtend'] = $finish; $datarray['summary'] = $summary; $datarray['description'] = $desc; $datarray['location'] = $location; - $datarray['type'] = $type; + $datarray['etype'] = $type; $datarray['adjust'] = $adjust; $datarray['nofinish'] = $nofinish; $datarray['uid'] = local_channel(); @@ -269,14 +269,14 @@ class Events extends \Zotlabs\Web\Controller { nav_set_selected('all_events'); if((argc() > 2) && (argv(1) === 'ignore') && intval(argv(2))) { - $r = q("update event set ignore = 1 where id = %d and uid = %d", + $r = q("update event set dismissed = 1 where id = %d and uid = %d", intval(argv(2)), intval(local_channel()) ); } if((argc() > 2) && (argv(1) === 'unignore') && intval(argv(2))) { - $r = q("update event set ignore = 0 where id = %d and uid = %d", + $r = q("update event set dismissed = 0 where id = %d and uid = %d", intval(argv(2)), intval(local_channel()) ); @@ -301,7 +301,7 @@ class Events extends \Zotlabs\Web\Controller { $mode = 'view'; $y = 0; $m = 0; - $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); + $ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : ''); // logger('args: ' . print_r(\App::$argv,true)); @@ -358,9 +358,9 @@ class Events extends \Zotlabs\Web\Controller { if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary']; if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description']; if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location']; - if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start']; - if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish']; - if(x($_REQUEST,'type')) $orig_event['type'] = $_REQUEST['type']; + if(x($_REQUEST,'start')) $orig_event['dtstart'] = $_REQUEST['start']; + if(x($_REQUEST,'finish')) $orig_event['dtend'] = $_REQUEST['finish']; + if(x($_REQUEST,'type')) $orig_event['etype'] = $_REQUEST['type']; */ $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : ''); @@ -380,9 +380,9 @@ class Events extends \Zotlabs\Web\Controller { if($orig_event['event_xchan']) $sh_checked .= ' disabled="disabled" '; - $sdt = ((x($orig_event)) ? $orig_event['start'] : 'now'); + $sdt = ((x($orig_event)) ? $orig_event['dtstart'] : 'now'); - $fdt = ((x($orig_event)) ? $orig_event['finish'] : '+1 hour'); + $fdt = ((x($orig_event)) ? $orig_event['dtend'] : '+1 hour'); $tz = date_default_timezone_get(); if(x($orig_event)) @@ -406,7 +406,7 @@ class Events extends \Zotlabs\Web\Controller { $ftext = datetime_convert('UTC',$tz,$fdt); $ftext = substr($ftext,0,14) . "00:00"; - $type = ((x($orig_event)) ? $orig_event['type'] : 'event'); + $type = ((x($orig_event)) ? $orig_event['etype'] : 'event'); $f = get_config('system','event_input_format'); if(! $f) @@ -536,8 +536,8 @@ class Events extends \Zotlabs\Web\Controller { ); } elseif($export) { $r = q("SELECT * from event where uid = %d - AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' ) - OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ", + AND (( `adjust` = 0 AND ( `dtend` >= '%s' or nofinish = 1 ) AND `dtstart` <= '%s' ) + OR ( `adjust` = 1 AND ( `dtend` >= '%s' or nofinish = 1 ) AND `dtstart` <= '%s' )) ", intval(local_channel()), dbesc($start), dbesc($finish), @@ -554,8 +554,8 @@ class Events extends \Zotlabs\Web\Controller { $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan from event left join item on event_hash = resource_id where resource_type = 'event' and event.uid = %d $ignored - AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' ) - OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) ", + AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) + OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) ", intval(local_channel()), dbesc($start), dbesc($finish), @@ -576,7 +576,7 @@ class Events extends \Zotlabs\Web\Controller { if($r) { foreach($r as $rr) { - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); if(! x($links,$j)) $links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j; } @@ -591,15 +591,15 @@ class Events extends \Zotlabs\Web\Controller { foreach($r as $rr) { - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); - $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt)); + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); + $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt)); $d = day_translate($d); - $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c')); + $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c')); + $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c')); } diff --git a/Zotlabs/Module/Fbrowser.php b/Zotlabs/Module/Fbrowser.php index eef3cb67d..c534e8f72 100644 --- a/Zotlabs/Module/Fbrowser.php +++ b/Zotlabs/Module/Fbrowser.php @@ -45,10 +45,10 @@ class Fbrowser extends \Zotlabs\Web\Controller { $album = hex2bin(\App::$argv[2]); $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra2 = ""; - $path[]=array(z_root()."/fbrowser/image/".\App::$argv[2]."/", $album); + $path[]=array(z_root() . "/fbrowser/image/" . \App::$argv[2] . "/", $album); } - $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description` + $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`imgscale`) AS `hiq`,max(`imgscale`) AS `loq`, `description` FROM `photo` WHERE `uid` = %d $sql_extra GROUP BY `resource_id` $sql_extra2", intval(local_channel()) diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 3ef67ddcc..1ca37d646 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -483,7 +483,7 @@ class Like extends \Zotlabs\Web\Controller { $arr['verb'] = $activity; $arr['obj_type'] = $objtype; - $arr['object'] = $object; + $arr['obj'] = $object; if($target) { $arr['tgt_type'] = $tgttype; diff --git a/Zotlabs/Module/Notifications.php b/Zotlabs/Module/Notifications.php index d51d2861c..9da28a360 100644 --- a/Zotlabs/Module/Notifications.php +++ b/Zotlabs/Module/Notifications.php @@ -80,18 +80,18 @@ class Notifications extends \Zotlabs\Web\Controller { $not_tpl = get_markup_template('notify.tpl'); require_once('include/bbcode.php'); - $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", + $r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc", intval(local_channel()) ); - if (count($r) > 0) { + if ($r > 0) { $notifications_available =1; foreach ($r as $it) { $notif_content .= replace_macros($not_tpl,array( '$item_link' => z_root().'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), - '$item_when' => relative_date($it['date']) + '$item_when' => relative_date($it['created']) )); } } else { diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php index 227491145..f592f6f37 100644 --- a/Zotlabs/Module/Notify.php +++ b/Zotlabs/Module/Notify.php @@ -39,7 +39,7 @@ class Notify extends \Zotlabs\Web\Controller { $not_tpl = get_markup_template('notify.tpl'); require_once('include/bbcode.php'); - $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", + $r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc", intval(local_channel()) ); @@ -49,7 +49,7 @@ class Notify extends \Zotlabs\Web\Controller { '$item_link' => z_root().'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), - '$item_when' => relative_date($it['date']) + '$item_when' => relative_date($it['created']) )); } } diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php index 89824fc7e..dc0547a42 100644 --- a/Zotlabs/Module/Oep.php +++ b/Zotlabs/Module/Oep.php @@ -249,7 +249,7 @@ class Oep extends \Zotlabs\Web\Controller { $sql_extra = permissions_sql($c[0]['channel_id']); - $p = q("select resource_id from photo where album = '%s' and uid = %d and scale = 0 $sql_extra order by created desc limit 1", + $p = q("select resource_id from photo where album = '%s' and uid = %d and imgscale = 0 $sql_extra order by created desc limit 1", dbesc($res), intval($c[0]['channel_id']) ); @@ -258,7 +258,7 @@ class Oep extends \Zotlabs\Web\Controller { $res = $p[0]['resource_id']; - $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc", + $r = q("select height, width, imgscale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by imgscale asc", intval($c[0]['channel_id']), dbesc($res) ); @@ -276,7 +276,7 @@ class Oep extends \Zotlabs\Web\Controller { if($foundres) { $ret['type'] = 'link'; - $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale']; + $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['imgscale']; $ret['thumbnail_width'] = $rr['width']; $ret['thumbnail_height'] = $rr['height']; } @@ -310,7 +310,7 @@ class Oep extends \Zotlabs\Web\Controller { $sql_extra = permissions_sql($c[0]['channel_id']); - $p = q("select resource_id from photo where uid = %d and scale = 0 $sql_extra order by created desc limit 1", + $p = q("select resource_id from photo where uid = %d and imgscale = 0 $sql_extra order by created desc limit 1", intval($c[0]['channel_id']) ); if(! $p) @@ -318,7 +318,7 @@ class Oep extends \Zotlabs\Web\Controller { $res = $p[0]['resource_id']; - $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc", + $r = q("select height, width, imgscale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by imgscale asc", intval($c[0]['channel_id']), dbesc($res) ); @@ -336,7 +336,7 @@ class Oep extends \Zotlabs\Web\Controller { if($foundres) { $ret['type'] = 'link'; - $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale']; + $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['imgscale']; $ret['thumbnail_width'] = $rr['width']; $ret['thumbnail_height'] = $rr['height']; } @@ -372,7 +372,7 @@ class Oep extends \Zotlabs\Web\Controller { $sql_extra = permissions_sql($c[0]['channel_id']); - $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc", + $r = q("select height, width, imgscale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by imgscale asc", intval($c[0]['channel_id']), dbesc($res) ); @@ -390,7 +390,7 @@ class Oep extends \Zotlabs\Web\Controller { if($foundres) { $ret['type'] = 'link'; - $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale']; + $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['imgscale']; $ret['thumbnail_width'] = $rr['width']; $ret['thumbnail_height'] = $rr['height']; } diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 408688886..92c9ac3c0 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -57,14 +57,14 @@ class Photo extends \Zotlabs\Web\Controller { $uid = $person; - $r = q("SELECT * FROM photo WHERE scale = %d AND uid = %d AND photo_usage = %d LIMIT 1", + $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1", intval($resolution), intval($uid), intval(PHOTO_PROFILE) ); if(count($r)) { - $data = dbunescbin($r[0]['data']); - $mimetype = $r[0]['type']; + $data = dbunescbin($r[0]['content']); + $mimetype = $r[0]['mimetype']; } if(intval($r[0]['os_storage'])) $data = file_get_contents($data); @@ -113,7 +113,7 @@ class Photo extends \Zotlabs\Web\Controller { // If using resolution 1, make sure it exists before proceeding: if ($resolution == 1) { - $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1", + $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($photo), intval($resolution) ); @@ -121,7 +121,7 @@ class Photo extends \Zotlabs\Web\Controller { $resolution = 2; } - $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1", + $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($photo), intval($resolution) ); @@ -133,14 +133,14 @@ class Photo extends \Zotlabs\Web\Controller { // Now we'll see if we can access the photo - $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND scale = %d $sql_extra LIMIT 1", + $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d $sql_extra LIMIT 1", dbesc($photo), intval($resolution) ); if($r && $allowed) { - $data = dbunescbin($r[0]['data']); - $mimetype = $r[0]['type']; + $data = dbunescbin($r[0]['content']); + $mimetype = $r[0]['mimetype']; if(intval($r[0]['os_storage'])) $data = file_get_contents($data); } @@ -154,7 +154,7 @@ class Photo extends \Zotlabs\Web\Controller { // they won't have the photo link, so there's a reasonable chance that the person // might be able to obtain permission to view it. - $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d LIMIT 1", + $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `imgscale` = %d LIMIT 1", dbesc($photo), intval($resolution) ); diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index ecf966032..ada7b4ef1 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -255,13 +255,13 @@ class Photos extends \Zotlabs\Web\Controller { ( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) { logger('rotate'); - $r = q("select * from photo where `resource_id` = '%s' and uid = %d and scale = 0 limit 1", + $r = q("select * from photo where `resource_id` = '%s' and uid = %d and imgscale = 0 limit 1", dbesc($resource_id), intval($page_owner_uid) ); if(count($r)) { - $d = (($r[0]['os_storage']) ? @file_get_contents($r[0]['data']) : dbunescbin($r[0]['data'])); - $ph = photo_factory($d, $r[0]['type']); + $d = (($r[0]['os_storage']) ? @file_get_contents($r[0]['content']) : dbunescbin($r[0]['content'])); + $ph = photo_factory($d, $r[0]['mimetype']); if($ph->is_valid()) { $rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 ); $ph->rotate($rotate_deg); @@ -270,9 +270,9 @@ class Photos extends \Zotlabs\Web\Controller { $height = $ph->getHeight(); if(intval($r[0]['os_storage'])) { - @file_put_contents($r[0]['data'],$ph->imageString()); - $data = $r[0]['data']; - $fsize = @filesize($r[0]['data']); + @file_put_contents($r[0]['content'],$ph->imageString()); + $data = $r[0]['content']; + $fsize = @filesize($r[0]['content']); q("update attach set filesize = %d where hash = '%s' and uid = %d limit 1", intval($fsize), dbesc($resource_id), @@ -284,7 +284,7 @@ class Photos extends \Zotlabs\Web\Controller { $fsize = strlen($data); } - $x = q("update photo set data = '%s', `size` = %d, height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 0", + $x = q("update photo set content = '%s', filesize = %d, height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 0", dbescbin($data), intval($fsize), intval($height), @@ -299,7 +299,7 @@ class Photos extends \Zotlabs\Web\Controller { $width = $ph->getWidth(); $height = $ph->getHeight(); - $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 1", + $x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 1", dbescbin($ph->imageString()), intval($height), intval($width), @@ -314,7 +314,7 @@ class Photos extends \Zotlabs\Web\Controller { $width = $ph->getWidth(); $height = $ph->getHeight(); - $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 2", + $x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 2", dbescbin($ph->imageString()), intval($height), intval($width), @@ -329,7 +329,7 @@ class Photos extends \Zotlabs\Web\Controller { $width = $ph->getWidth(); $height = $ph->getHeight(); - $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 3", + $x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 3", dbescbin($ph->imageString()), intval($height), intval($width), @@ -340,12 +340,12 @@ class Photos extends \Zotlabs\Web\Controller { } } - $p = q("SELECT type, is_nsfw, description, resource_id, scale, allow_cid, allow_gid, deny_cid, deny_gid FROM photo WHERE resource_id = '%s' AND uid = %d ORDER BY scale DESC", + $p = q("SELECT mimetype, is_nsfw, description, resource_id, imgscale, allow_cid, allow_gid, deny_cid, deny_gid FROM photo WHERE resource_id = '%s' AND uid = %d ORDER BY imgscale DESC", dbesc($resource_id), intval($page_owner_uid) ); if($p) { - $ext = $phototypes[$p[0]['type']]; + $ext = $phototypes[$p[0]['mimetype']]; $r = q("UPDATE `photo` SET `description` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d", dbesc($desc), @@ -611,7 +611,7 @@ class Photos extends \Zotlabs\Web\Controller { /* Show space usage */ - $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", + $r = q("select sum(filesize) as total from photo where aid = %d and imgscale = 0 ", intval(\App::$data['channel']['channel_account_id']) ); @@ -704,8 +704,8 @@ class Photos extends \Zotlabs\Web\Controller { \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' - AND `scale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", + $r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' + AND `imgscale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", intval($owner_uid), dbesc($album), intval(PHOTO_NORMAL), @@ -725,9 +725,9 @@ class Photos extends \Zotlabs\Web\Controller { $order = 'DESC'; - $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.scale, p.description, p.created FROM photo p INNER JOIN - (SELECT resource_id, max(scale) scale FROM photo WHERE uid = %d AND album = '%s' AND scale <= 4 AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id) ph - ON (p.resource_id = ph.resource_id AND p.scale = ph.scale) + $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.imgscale, p.description, p.created FROM photo p INNER JOIN + (SELECT resource_id, max(imgscale) imgscale FROM photo WHERE uid = %d AND album = '%s' AND imgscale <= 4 AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id) ph + ON (p.resource_id = ph.resource_id AND p.imgscale = ph.imgscale) ORDER BY created $order LIMIT %d OFFSET %d", intval($owner_uid), dbesc($album), @@ -777,7 +777,7 @@ class Photos extends \Zotlabs\Web\Controller { else $twist = 'rotright'; - $ext = $phototypes[$rr['type']]; + $ext = $phototypes[$rr['mimetype']]; $imgalt_e = $rr['filename']; $desc_e = $rr['description']; @@ -790,7 +790,7 @@ class Photos extends \Zotlabs\Web\Controller { 'twist' => ' ' . $twist . rand(2,4), 'link' => $imagelink, 'title' => t('View Photo'), - 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext, + 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['imgscale'] . '.' .$ext, 'alt' => $imgalt_e, 'desc'=> $desc_e, 'ext' => $ext, @@ -852,8 +852,8 @@ class Photos extends \Zotlabs\Web\Controller { // fetch image, item containing image, then comments - $ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' - $sql_extra ORDER BY `scale` ASC ", + $ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,mimetype,height,width,filesize,imgscale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' + $sql_extra ORDER BY `imgscale` ASC ", intval($owner_uid), dbesc($datum) ); @@ -884,7 +884,7 @@ class Photos extends \Zotlabs\Web\Controller { $order = 'DESC'; - $prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0 + $prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `imgscale` = 0 $sql_extra ORDER BY `created` $order ", dbesc($ph[0]['album']), intval($owner_uid) @@ -911,7 +911,7 @@ class Photos extends \Zotlabs\Web\Controller { if(count($ph) == 1) $hires = $lores = $ph[0]; if(count($ph) > 1) { - if($ph[1]['scale'] == 2) { + if($ph[1]['imgscale'] == 2) { // original is 640 or less, we can display it directly $hires = $lores = $ph[0]; } @@ -949,9 +949,9 @@ class Photos extends \Zotlabs\Web\Controller { $prevlink = array($prevlink, t('Previous')); $photo = array( - 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], + 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['imgscale'] . '.' . $phototypes[$hires['mimetype']], 'title'=> t('View Full Size'), - 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis') + 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['imgscale'] . '.' . $phototypes[$lores['mimetype']] . '?f=&_u=' . datetime_convert('','','','ymdhis') ); if($nextlink) @@ -1277,7 +1277,7 @@ class Photos extends \Zotlabs\Web\Controller { \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' + $r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", intval(\App::$data['channel']['channel_id']), dbesc('Contact Photos'), @@ -1286,16 +1286,17 @@ class Photos extends \Zotlabs\Web\Controller { intval(PHOTO_PROFILE), intval($unsafe) ); - if(count($r)) { + if($r) { \App::set_pager_total(count($r)); \App::set_pager_itemspage(60); } - $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN - (SELECT resource_id, max(scale) scale FROM photo - WHERE uid=%d AND album != '%s' AND album != '%s' - AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra group by resource_id) ph - ON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d", + $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.album, p.imgscale, p.created FROM photo as p + INNER JOIN ( SELECT resource_id, max(imgscale) as imgscale FROM photo + WHERE uid = %d AND photo_usage IN ( %d, %d ) + AND is_nsfw = %d $sql_extra group by resource_id ) as ph + ON (p.resource_id = ph.resource_id and p.imgscale = ph.imgscale) + ORDER by p.created DESC LIMIT %d OFFSET %d", intval(\App::$data['channel']['channel_id']), dbesc('Contact Photos'), dbesc( t('Contact Photos')), @@ -1309,14 +1310,14 @@ class Photos extends \Zotlabs\Web\Controller { $photos = array(); - if(count($r)) { + if($r) { $twist = 'rotright'; foreach($r as $rr) { if($twist == 'rotright') $twist = 'rotleft'; else $twist = 'rotright'; - $ext = $phototypes[$rr['type']]; + $ext = $phototypes[$rr['mimetype']]; if(\App::get_template_engine() === 'internal') { $alt_e = template_escape($rr['filename']); @@ -1332,7 +1333,7 @@ class Photos extends \Zotlabs\Web\Controller { 'twist' => ' ' . $twist . rand(2,4), 'link' => z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id'], 'title' => t('View Photo'), - 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, + 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['imgscale']) == 6) ? 4 : $rr['imgscale']) . '.' . $ext, 'alt' => $alt_e, 'album' => array( 'link' => z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 32427b06f..5cbf45daa 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -173,7 +173,7 @@ class Ping extends \Zotlabs\Web\Controller { ); break; case 'all_events': - $r = q("update event set `ignore` = 1 where `ignore` = 0 and uid = %d AND start < '%s' AND start > '%s' ", + $r = q("update event set `dimissed` = 1 where `dismissed` = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ", intval(local_channel()), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) @@ -209,17 +209,17 @@ class Ping extends \Zotlabs\Web\Controller { ); if($t && intval($t[0]['total']) > 49) { $z = q("select * from notify where uid = %d - and seen = 0 order by date desc limit 50", + and seen = 0 order by created desc limit 50", intval(local_channel()) ); } else { $z1 = q("select * from notify where uid = %d - and seen = 0 order by date desc limit 50", + and seen = 0 order by created desc limit 50", intval(local_channel()) ); $z2 = q("select * from notify where uid = %d - and seen = 1 order by date desc limit %d", + and seen = 1 order by created desc limit %d", intval(local_channel()), intval(50 - intval($t[0]['total'])) ); @@ -230,10 +230,10 @@ class Ping extends \Zotlabs\Web\Controller { foreach($z as $zz) { $notifs[] = array( 'notify_link' => z_root() . '/notify/view/' . $zz['id'], - 'name' => $zz['name'], + 'name' => $zz['xname'], 'url' => $zz['url'], 'photo' => $zz['photo'], - 'when' => relative_date($zz['date']), + 'when' => relative_date($zz['created']), 'hclass' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'), 'message' => strip_tags(bbcode($zz['msg'])) ); @@ -325,9 +325,9 @@ class Ping extends \Zotlabs\Web\Controller { $result = array(); $r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash - WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0 - and type in ( 'event', 'birthday' ) - ORDER BY `start` DESC LIMIT 1000", + WHERE `event`.`uid` = %d AND dtstart < '%s' AND dtstart > '%s' and `dismissed` = 0 + and etype in ( 'event', 'birthday' ) + ORDER BY `dtstart` DESC LIMIT 1000", intval(local_channel()), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) @@ -336,14 +336,14 @@ class Ping extends \Zotlabs\Web\Controller { if($r) { foreach($r as $rr) { if($rr['adjust']) - $md = datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'Y/m'); + $md = datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'Y/m'); else - $md = datetime_convert('UTC', 'UTC', $rr['start'], 'Y/m'); + $md = datetime_convert('UTC', 'UTC', $rr['dtstart'], 'Y/m'); - $strt = datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['start']); + $strt = datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['dtstart']); $today = ((substr($strt, 0, 10) === datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d')) ? true : false); - $when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); + $when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['dtstart'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); $result[] = array( 'notify_link' => z_root() . '/events', // FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'], @@ -443,10 +443,10 @@ class Ping extends \Zotlabs\Web\Controller { $t5 = dba_timer(); if($vnotify & (VNOTIFY_EVENT|VNOTIFY_EVENTTODAY|VNOTIFY_BIRTHDAY)) { - $events = q("SELECT type, start, adjust FROM `event` - WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0 - and type in ( 'event', 'birthday' ) - ORDER BY `start` ASC ", + $events = q("SELECT etype, dtstart, adjust FROM `event` + WHERE `event`.`uid` = %d AND dtstart < '%s' AND dtstart > '%s' and `dismissed` = 0 + and etype in ( 'event', 'birthday' ) + ORDER BY `dtstart` ASC ", intval(local_channel()), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) @@ -459,14 +459,14 @@ class Ping extends \Zotlabs\Web\Controller { $str_now = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d'); foreach($events as $x) { $bd = false; - if($x['type'] === 'birthday') { + if($x['etype'] === 'birthday') { $result['birthdays'] ++; $bd = true; } else { $result['events'] ++; } - if(datetime_convert('UTC', ((intval($x['adjust'])) ? date_default_timezone_get() : 'UTC'), $x['start'], 'Y-m-d') === $str_now) { + if(datetime_convert('UTC', ((intval($x['adjust'])) ? date_default_timezone_get() : 'UTC'), $x['dtstart'], 'Y-m-d') === $str_now) { $result['all_events_today'] ++; if($bd) $result['birthdays_today'] ++; diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php index 123ecbc7b..cf8d83023 100644 --- a/Zotlabs/Module/Poke.php +++ b/Zotlabs/Module/Poke.php @@ -115,7 +115,7 @@ class Poke extends \Zotlabs\Web\Controller { ), ); - $arr['object'] = json_encode($obj); + $arr['obj'] = json_encode($obj); $arr['item_origin'] = 1; $arr['item_wall'] = 1; diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index a8cf3cbee..6129a7492 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -93,7 +93,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { $srcW = $_POST['xfinal'] - $srcX; $srcH = $_POST['yfinal'] - $srcY; - $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND scale = %d LIMIT 1", + $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1", dbesc($image_id), dbesc(local_channel()), intval($scale)); @@ -101,9 +101,9 @@ class Profile_photo extends \Zotlabs\Web\Controller { if($r) { $base_image = $r[0]; - $base_image['data'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['data']) : dbunescbin($base_image['data'])); + $base_image['content'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['content']) : dbunescbin($base_image['content'])); - $im = photo_factory($base_image['data'], $base_image['type']); + $im = photo_factory($base_image['content'], $base_image['mimetype']); if($im->is_valid()) { $im->cropImage(300,$srcX,$srcY,$srcW,$srcH); @@ -113,25 +113,25 @@ class Profile_photo extends \Zotlabs\Web\Controller { $p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'], 'filename' => $base_image['filename'], 'album' => t('Profile Photos')); - $p['scale'] = 4; + $p['imgscale'] = 4; $p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL); $r1 = $im->save($p); $im->scaleImage(80); - $p['scale'] = 5; + $p['imgscale'] = 5; $r2 = $im->save($p); $im->scaleImage(48); - $p['scale'] = 6; + $p['imgscale'] = 6; $r3 = $im->save($p); if($r1 === false || $r2 === false || $r3 === false) { // if one failed, delete them all so we can start over. notice( t('Image resize failed.') . EOL ); - $x = q("delete from photo where resource_id = '%s' and uid = %d and scale >= 4 ", + $x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale >= 4 ", dbesc($base_image['resource_id']), local_channel() ); @@ -208,7 +208,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { logger('attach_store: ' . print_r($res,true)); if($res && intval($res['data']['is_photo'])) { - $i = q("select * from photo where resource_id = '%s' and uid = %d order by scale", + $i = q("select * from photo where resource_id = '%s' and uid = %d order by imgscale", dbesc($hash), intval(local_channel()) ); @@ -220,11 +220,11 @@ class Profile_photo extends \Zotlabs\Web\Controller { $os_storage = false; foreach($i as $ii) { - if(intval($ii['scale']) < 2) { - $smallest = intval($ii['scale']); + if(intval($ii['imgscale']) < 2) { + $smallest = intval($ii['imgscale']); $os_storage = intval($ii['os_storage']); - $imagedata = $ii['data']; - $filetype = $ii['type']; + $imagedata = $ii['content']; + $filetype = $ii['mimetype']; } } } @@ -250,7 +250,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { */ - function get() { + function get() { if(! local_channel()) { notice( t('Permission denied.') . EOL ); @@ -275,7 +275,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { $resource_id = argv(2); - $r = q("SELECT id, album, scale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY scale ASC", + $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC", intval(local_channel()), dbesc($resource_id) ); @@ -285,7 +285,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { } $havescale = false; foreach($r as $rr) { - if($rr['scale'] == 5) + if($rr['imgscale'] == 5) $havescale = true; } @@ -315,7 +315,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { goaway(z_root() . '/profiles'); } - $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", + $r = q("SELECT content, mimetype, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", intval($r[0]['id']), intval(local_channel()) @@ -326,15 +326,15 @@ class Profile_photo extends \Zotlabs\Web\Controller { } if(intval($r[0]['os_storage'])) - $data = @file_get_contents($r[0]['data']); + $data = @file_get_contents($r[0]['content']); else - $data = dbunescbin($r[0]['data']); + $data = dbunescbin($r[0]['content']); - $ph = photo_factory($data, $r[0]['type']); + $ph = photo_factory($data, $r[0]['mimetype']); $smallest = 0; if($ph->is_valid()) { // go ahead as if we have just uploaded a new photo to crop - $i = q("select resource_id, scale from photo where resource_id = '%s' and uid = %d order by scale", + $i = q("select resource_id, imgscale from photo where resource_id = '%s' and uid = %d order by imgscale", dbesc($r[0]['resource_id']), intval(local_channel()) ); @@ -342,8 +342,8 @@ class Profile_photo extends \Zotlabs\Web\Controller { if($i) { $hash = $i[0]['resource_id']; foreach($i as $ii) { - if(intval($ii['scale']) < 2) { - $smallest = intval($ii['scale']); + if(intval($ii['imgscale']) < 2) { + $smallest = intval($ii['imgscale']); } } } diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php index 73db01657..fcc2486ba 100644 --- a/Zotlabs/Module/Share.php +++ b/Zotlabs/Module/Share.php @@ -48,7 +48,7 @@ class Share extends \Zotlabs\Web\Controller { $is_photo = (($r[0]['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false); if($is_photo) { - $object = json_decode($r[0]['object'],true); + $object = json_decode($r[0]['obj'],true); $photo_bb = $object['body']; } diff --git a/Zotlabs/Module/Sharedwithme.php b/Zotlabs/Module/Sharedwithme.php index 8eaa47dba..25bc7dba3 100644 --- a/Zotlabs/Module/Sharedwithme.php +++ b/Zotlabs/Module/Sharedwithme.php @@ -46,7 +46,7 @@ class Sharedwithme extends \Zotlabs\Web\Controller { } //list files - $r = q("SELECT id, uid, object, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'", + $r = q("SELECT id, uid, obj, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'", dbesc(ACTIVITY_POST), dbesc(ACTIVITY_OBJ_FILE), intval(local_channel()), @@ -59,7 +59,7 @@ class Sharedwithme extends \Zotlabs\Web\Controller { if($r) { foreach($r as $rr) { - $object = json_decode($rr['object'],true); + $object = json_decode($rr['obj'],true); $item = array(); $item['id'] = $rr['id']; diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php index 16a011a40..0226664d7 100644 --- a/Zotlabs/Module/Subthread.php +++ b/Zotlabs/Module/Subthread.php @@ -144,7 +144,7 @@ class Subthread extends \Zotlabs\Web\Controller { $arr['verb'] = $activity; $arr['obj_type'] = $objtype; - $arr['object'] = $obj; + $arr['obj'] = $obj; $arr['allow_cid'] = $item['allow_cid']; $arr['allow_gid'] = $item['allow_gid']; diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php index 26d1c58ea..0a46cf56d 100644 --- a/Zotlabs/Module/Tagger.php +++ b/Zotlabs/Module/Tagger.php @@ -124,7 +124,7 @@ class Tagger extends \Zotlabs\Web\Controller { $arr['tgt_type'] = $targettype; $arr['target'] = $target; $arr['obj_type'] = $objtype; - $arr['object'] = $obj; + $arr['obj'] = $obj; $arr['parent_mid'] = $item['mid']; store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_COMMUNITYTAG,$term,$tagid); diff --git a/Zotlabs/Module/Tasks.php b/Zotlabs/Module/Tasks.php index ab05f8be9..6d0a92d91 100644 --- a/Zotlabs/Module/Tasks.php +++ b/Zotlabs/Module/Tasks.php @@ -45,7 +45,7 @@ class Tasks extends \Zotlabs\Web\Controller { if((argc() > 2) && (argv(1) === 'complete') && intval(argv(2))) { $ret = array('success' => false); - $r = q("select * from event where `type` = 'task' and uid = %d and id = %d limit 1", + $r = q("select * from event where `etype` = 'task' and uid = %d and id = %d limit 1", intval(local_channel()), intval(argv(2)) ); @@ -80,9 +80,9 @@ class Tasks extends \Zotlabs\Web\Controller { $event['account'] = $channel['channel_account_id']; $event['uid'] = $channel['channel_id']; $event['event_xchan'] = $channel['channel_hash']; - $event['type'] = 'task'; + $event['etype'] = 'task'; $event['nofinish'] = true; - $event['created'] = $event['edited'] = $event['start'] = datetime_convert(); + $event['created'] = $event['edited'] = $event['dtstart'] = datetime_convert(); $event['adjust'] = 1; $event['allow_cid'] = '<' . $channel['channel_hash'] . '>'; $event['summary'] = escape_tags($_REQUEST['summary']); @@ -92,21 +92,13 @@ class Tasks extends \Zotlabs\Web\Controller { else $x = array('success' => false); json_return_and_die($x); - } - - + } } - - - - - function get() { - + function get() { if(! local_channel()) return; - - + return ''; } } diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php index 6fc5219d8..e23cce565 100644 --- a/Zotlabs/Module/Thing.php +++ b/Zotlabs/Module/Thing.php @@ -212,7 +212,7 @@ class Thing extends \Zotlabs\Web\Controller { $arr['verb'] = $verb; $arr['obj_type'] = $objtype; - $arr['object'] = $obj; + $arr['obj'] = $obj; if(! $profile['is_default']) { $arr['item_private'] = true; diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php index 84368d07e..06ae90a5f 100644 --- a/Zotlabs/Storage/Directory.php +++ b/Zotlabs/Storage/Directory.php @@ -246,7 +246,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota { $deny_gid = $c[0]['channel_deny_gid']; } - $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, folder, os_storage, filetype, filesize, revision, is_photo, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid ) + $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, folder, os_storage, filetype, filesize, revision, is_photo, content, created, edited, allow_cid, allow_gid, deny_cid, deny_gid ) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", intval($c[0]['channel_account_id']), intval($c[0]['channel_id']), diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php index d40fee0ea..ecd15cc55 100644 --- a/Zotlabs/Storage/File.php +++ b/Zotlabs/Storage/File.php @@ -124,7 +124,7 @@ class File extends DAV\Node implements DAV\IFile { ); if ($r) { if (intval($r[0]['os_storage'])) { - $d = q("select folder, data from attach where hash = '%s' and uid = %d limit 1", + $d = q("select folder, content from attach where hash = '%s' and uid = %d limit 1", dbesc($this->data['hash']), intval($c[0]['channel_id']) ); @@ -139,7 +139,7 @@ class File extends DAV\Node implements DAV\IFile { $direct = $f1[0]; } } - $fname = dbunescbin($d[0]['data']); + $fname = dbunescbin($d[0]['content']); if(strpos($fname,'store') === false) $f = 'store/' . $this->auth->owner_nick . '/' . $fname ; else @@ -158,12 +158,12 @@ class File extends DAV\Node implements DAV\IFile { } else { // this shouldn't happen any more - $r = q("UPDATE attach SET data = '%s' WHERE hash = '%s' AND uid = %d", + $r = q("UPDATE attach SET content = '%s' WHERE hash = '%s' AND uid = %d", dbescbin(stream_get_contents($data)), dbesc($this->data['hash']), intval($this->data['uid']) ); - $r = q("SELECT length(data) AS fsize FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1", + $r = q("SELECT length(content) AS fsize FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1", dbesc($this->data['hash']), intval($this->data['uid']) ); @@ -236,7 +236,7 @@ class File extends DAV\Node implements DAV\IFile { logger('get file ' . basename($this->name), LOGGER_DEBUG); logger('os_path: ' . $this->os_path, LOGGER_DATA); - $r = q("SELECT data, flags, os_storage, filename, filetype FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1", + $r = q("SELECT content, flags, os_storage, filename, filetype FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1", dbesc($this->data['hash']), intval($this->data['uid']) ); @@ -250,14 +250,14 @@ class File extends DAV\Node implements DAV\IFile { } if (intval($r[0]['os_storage'])) { - $x = dbunescbin($r[0]['data']); + $x = dbunescbin($r[0]['content']); if(strpos($x,'store') === false) $f = 'store/' . $this->auth->owner_nick . '/' . (($this->os_path) ? $this->os_path . '/' : '') . $x; else $f = $x; return fopen($f, 'rb'); } - return dbunescbin($r[0]['data']); + return dbunescbin($r[0]['content']); } } -- cgit v1.2.3 From 0f1fcd97433cd3b1251daee8a9064a189cb5c132 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jun 2016 16:38:15 -0700 Subject: install system apps if a) they have never been installed, or b) if the app version changes --- Zotlabs/Lib/Apps.php | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 6d2ef4e45..7e232af02 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -13,6 +13,8 @@ require_once('include/channel.php'); class Apps { + static public $installed_system_apps = null; + static public function get_system_apps($translate = true) { $ret = array(); @@ -49,22 +51,35 @@ class Apps { static public function import_system_apps() { if(! local_channel()) return; + $apps = self::get_system_apps(false); - // Eventually we want to look at modification dates and update system apps. - $installed = get_pconfig(local_channel(),'system','apps_installed'); - if($installed) - return; - $apps = self::get_system_apps(false); + self::$installed_system_apps = q("select * from app where app_system = 1 and app_channel = %d", + intval(local_channel()) + ); + if($apps) { foreach($apps as $app) { - $app['uid'] = local_channel(); - $app['guid'] = hash('whirlpool',$app['name']); - $app['system'] = 1; - self::app_install(local_channel(),$app); + if(self::check_install_system_app($app)) { + $app['uid'] = local_channel(); + $app['guid'] = hash('whirlpool',$app['name']); + $app['system'] = 1; + self::app_install(local_channel(),$app); + } } } - set_pconfig(local_channel(),'system','apps_installed',1); + } + + static public function check_install_system_app($app) { + if((! is_array(self::$installed_system_apps)) || (! count(self::$installed_system_apps))) { + return true; + } + foreach(self::$installed_system_apps as $iapp) { + if(($iapp['app_id'] == hash('whirlpool',$app['name'])) && ($iapp['app_version'] != $app['version'])) { + return true; + } + } + return false; } @@ -111,6 +126,10 @@ class Apps { if(array_key_exists('target',$ret)) $ret['target'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['target']); + if(array_key_exists('version',$ret)) + $ret['version'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['version']); + + if(array_key_exists('requires',$ret)) { $requires = explode(',',$ret['requires']); foreach($requires as $require) { -- cgit v1.2.3 From 4a3ec65409f1b89f7f96ca0b102716735be2108e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jun 2016 16:45:00 -0700 Subject: adjust algorithm to ensure new system apps are installed. --- Zotlabs/Lib/Apps.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 7e232af02..fd713a3f8 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -70,16 +70,25 @@ class Apps { } } + /** + * Install the system app if no system apps have been installed, or if a new system app + * is discovered, or if the version of a system app changes. + */ + static public function check_install_system_app($app) { if((! is_array(self::$installed_system_apps)) || (! count(self::$installed_system_apps))) { return true; } + $notfound = true; foreach(self::$installed_system_apps as $iapp) { - if(($iapp['app_id'] == hash('whirlpool',$app['name'])) && ($iapp['app_version'] != $app['version'])) { - return true; + if($iapp['app_id'] == hash('whirlpool',$app['name'])) { + $notfound = false; + if($iapp['app_version'] != $app['version']) { + return true; + } } } - return false; + return $notfound; } -- cgit v1.2.3 From e596bf025bc2cb700d2603871286df1102d41031 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jun 2016 17:08:47 -0700 Subject: preserve app categories when updating a system app --- Zotlabs/Lib/Apps.php | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index fd713a3f8..9dd4bf2d7 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -60,12 +60,30 @@ class Apps { if($apps) { foreach($apps as $app) { - if(self::check_install_system_app($app)) { - $app['uid'] = local_channel(); - $app['guid'] = hash('whirlpool',$app['name']); - $app['system'] = 1; - self::app_install(local_channel(),$app); - } + $id = self::check_install_system_app($app); + // $id will be boolean true or false to install an app, or an integer id to update an existing app + if($id === false) + continue; + if($id !== true) { + // if we already installed this app, but it changed, preserve any categories we created + $s = ''; + $r = q("select * from term where otype = %d and oid = d", + intval(TERM_OBJ_APP), + intval($id) + ); + if($r) { + foreach($r as $t) { + if($s) + $s .= ','; + $s .= $t['term']; + } + $app['categories'] = $s; + } + } + $app['uid'] = local_channel(); + $app['guid'] = hash('whirlpool',$app['name']); + $app['system'] = 1; + self::app_install(local_channel(),$app); } } } @@ -84,7 +102,7 @@ class Apps { if($iapp['app_id'] == hash('whirlpool',$app['name'])) { $notfound = false; if($iapp['app_version'] != $app['version']) { - return true; + return intval($iapp['app_id']); } } } -- cgit v1.2.3