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 -------------------------------------------- boot.php | 2 +- install/schema_mysql.sql | 70 -------------------------- install/schema_postgres.sql | 69 -------------------------- install/update.php | 17 ++++++- 5 files changed, 17 insertions(+), 258 deletions(-) delete mode 100644 Zotlabs/Module/Fsuggest.php 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; - } -} diff --git a/boot.php b/boot.php index f1aa0cf9d..4ea2dc279 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '1.7.1' ); define ( 'ZOT_REVISION', 1.1 ); -define ( 'DB_UPDATE_VERSION', 1170 ); +define ( 'DB_UPDATE_VERSION', 1171 ); /** diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 68b739f7a..63be37f80 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -434,62 +434,6 @@ CREATE TABLE IF NOT EXISTS `event` ( KEY `event_priority` (`event_priority`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `fcontact` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `url` char(255) NOT NULL, - `name` char(255) NOT NULL, - `photo` char(255) NOT NULL, - `request` char(255) NOT NULL, - `nick` char(255) NOT NULL, - `addr` char(255) NOT NULL, - `batch` char(255) NOT NULL, - `notify` char(255) NOT NULL, - `poll` char(255) NOT NULL, - `confirm` char(255) NOT NULL, - `priority` tinyint(1) NOT NULL, - `network` char(32) NOT NULL, - `alias` char(255) NOT NULL, - `pubkey` text NOT NULL, - `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`id`), - KEY `addr` (`addr`), - KEY `network` (`network`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `ffinder` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `uid` int(10) unsigned NOT NULL, - `cid` int(10) unsigned NOT NULL, - `fid` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `uid` (`uid`), - KEY `cid` (`cid`), - KEY `fid` (`fid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `fserver` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `server` char(255) NOT NULL DEFAULT '', - `posturl` char(255) NOT NULL DEFAULT '', - `key` text NOT NULL, - PRIMARY KEY (`id`), - KEY `server` (`server`), - KEY `posturl` (`posturl`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `fsuggest` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL DEFAULT '0', - `cid` int(11) NOT NULL DEFAULT '0', - `name` char(255) NOT NULL DEFAULT '', - `url` char(255) NOT NULL DEFAULT '', - `request` char(255) NOT NULL DEFAULT '', - `photo` char(255) NOT NULL DEFAULT '', - `note` text NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - CREATE TABLE IF NOT EXISTS `groups` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hash` char(255) NOT NULL DEFAULT '', @@ -1194,20 +1138,6 @@ CREATE TABLE IF NOT EXISTS `source` ( KEY `src_xchan` (`src_xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `spam` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL DEFAULT '0', - `spam` int(11) NOT NULL DEFAULT '0', - `ham` int(11) NOT NULL DEFAULT '0', - `term` char(255) NOT NULL DEFAULT '', - `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`id`), - KEY `uid` (`uid`), - KEY `spam` (`spam`), - KEY `ham` (`ham`), - KEY `term` (`term`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - CREATE TABLE IF NOT EXISTS `sys_perms` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cat` char(255) NOT NULL DEFAULT '', diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 76a3a013e..1ae65068c 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -428,62 +428,6 @@ create index "event_status_idx" on event ("event_status"); create index "event_sequence_idx" on event ("event_sequence"); create index "event_priority_idx" on event ("event_priority"); - -CREATE TABLE "fcontact" ( - "id" serial NOT NULL, - "url" text NOT NULL, - "name" text NOT NULL, - "photo" text NOT NULL, - "request" text NOT NULL, - "nick" text NOT NULL, - "addr" text NOT NULL, - "batch" text NOT NULL, - "notify" text NOT NULL, - "poll" text NOT NULL, - "confirm" text NOT NULL, - "priority" numeric(1) NOT NULL, - "network" varchar(32) NOT NULL DEFAULT '', - "alias" text NOT NULL, - "pubkey" text NOT NULL, - "updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY ("id") -); -create index "fcontact_addr_idx" on fcontact ("addr"); -create index "fcontact_network_idx" on fcontact ("network"); - -CREATE TABLE "ffinder" ( - "id" serial NOT NULL, - "uid" bigint NOT NULL, - "cid" bigint NOT NULL, - "fid" bigint NOT NULL, - PRIMARY KEY ("id") -); -create index "ffinder_uid_idx" on ffinder ("uid"); -create index "ffinder_cid_idx" on ffinder ("cid"); -create index "ffinder_fid_idx" on ffinder ("fid"); - -CREATE TABLE "fserver" ( - "id" serial NOT NULL, - "server" text NOT NULL, - "posturl" text NOT NULL, - "key" text NOT NULL, - PRIMARY KEY ("id") -); -create index "fserver_server_idx" on fserver ("server"); -create index "fserver_posturl_idx" on fserver ("posturl"); - -CREATE TABLE "fsuggest" ( - "id" serial NOT NULL, - "uid" bigint NOT NULL, - "cid" bigint NOT NULL, - "name" text NOT NULL, - "url" text NOT NULL, - "request" text NOT NULL, - "photo" text NOT NULL, - "note" text NOT NULL, - "created" timestamp NOT NULL, - PRIMARY KEY ("id") -); CREATE TABLE "group_member" ( "id" serial NOT NULL, "uid" bigint NOT NULL, @@ -1179,19 +1123,6 @@ CREATE TABLE "source" ( create index "src_channel_id" on "source" ("src_channel_id"); create index "src_channel_xchan" on "source" ("src_channel_xchan"); create index "src_xchan" on "source" ("src_xchan"); -CREATE TABLE "spam" ( - "id" serial NOT NULL, - "uid" bigint NOT NULL, - "spam" bigint NOT NULL DEFAULT '0', - "ham" bigint NOT NULL DEFAULT '0', - "term" text NOT NULL, - "date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY ("id") -); -create index "spam_uid" on spam ("uid"); -create index "spam_spam" on spam ("spam"); -create index "spam_ham" on spam ("ham"); -create index "spam_term" on spam ("term"); CREATE TABLE "sys_perms" ( "id" serial NOT NULL, "cat" text NOT NULL, diff --git a/install/update.php b/install/update.php index 686c199b5..0bd8d59f9 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ Date: Tue, 31 May 2016 13:22:47 -0700 Subject: don't remove missing hooks while update_r1169 is happpening - temp fix --- include/plugin.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index 5dbfc218a..96ae0e543 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -301,11 +301,14 @@ function call_hooks($name, &$data = null) { else $func($a, $data); } else { - q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", - dbesc($name), - dbesc($hook[0]), - dbesc($origfn) - ); + // The hook should be removed so we don't process it. + // But not until everybody gets through a timing issue + // related to git pull and update_r1169 + // q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", + // dbesc($name), + // dbesc($hook[0]), + // dbesc($origfn) + // ); } } } -- cgit v1.2.3 From 00b4843425371e4ff55c82be577a279e248c29fc Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 16:16:54 -0700 Subject: provide a sort of mutex lock around db logging so it can't possibly recurse. Previous attempts to do something similar using other methods haven't worked out satisfactorily. --- include/dba/dba_driver.php | 7 ++++++- include/plugin.php | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 0ab5830ed..df072ed76 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -12,7 +12,7 @@ class DBA { static public $dba = null; static public $dbtype = null; - + static public $logging = false; /** * @brief Returns the database driver object. @@ -421,8 +421,13 @@ function db_getfunc($f) { function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) { + if(\DBA::$logging) + return; + $saved = \DBA::$dba->debug; \DBA::$dba->debug = false; + \DBA::$logging = true; logger($s,$level,$syslog); + \DBA::$logging = false; \DBA::$dba->debug = $saved; } \ No newline at end of file diff --git a/include/plugin.php b/include/plugin.php index 96ae0e543..be4e92f03 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -300,15 +300,18 @@ function call_hooks($name, &$data = null) { $func($data); else $func($a, $data); - } else { - // The hook should be removed so we don't process it. - // But not until everybody gets through a timing issue - // related to git pull and update_r1169 - // q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", - // dbesc($name), - // dbesc($hook[0]), - // dbesc($origfn) - // ); + } + else { + + // Don't do any DB write calls if we're currently logging a possibly failed DB call. + if(! DBA::$logging) { + // The hook should be removed so we don't process it. + q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", + dbesc($name), + dbesc($hook[0]), + dbesc($origfn) + ); + } } } } -- 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 +++--- boot.php | 2 +- include/account.php | 6 +++--- include/api.php | 2 +- include/oauth.php | 12 ++++++------ install/schema_mysql.sql | 14 +++++++------- install/schema_postgres.sql | 14 +++++++------- install/update.php | 19 ++++++++++++++++++- view/tpl/settings_oauth.tpl | 2 +- 12 files changed, 54 insertions(+), 37 deletions(-) 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) diff --git a/boot.php b/boot.php index 4ea2dc279..24ff3c5d1 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '1.7.1' ); define ( 'ZOT_REVISION', 1.1 ); -define ( 'DB_UPDATE_VERSION', 1171 ); +define ( 'DB_UPDATE_VERSION', 1172 ); /** diff --git a/include/account.php b/include/account.php index a442f3073..caf12878e 100644 --- a/include/account.php +++ b/include/account.php @@ -229,7 +229,7 @@ function verify_email_address($arr) { $hash = random_string(); - $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($arr['account']['account_id']), @@ -283,7 +283,7 @@ function send_reg_approval_email($arr) { $hash = random_string(); - $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($arr['account']['account_id']), @@ -387,7 +387,7 @@ function account_allow($hash) { intval($register[0]['uid']) ); - push_lang($register[0]['language']); + push_lang($register[0]['lang']); $email_tpl = get_intltext_template("register_open_eml.tpl"); $email_tpl = replace_macros($email_tpl, array( diff --git a/include/api.php b/include/api.php index af5a22a74..0833ae7b9 100644 --- a/include/api.php +++ b/include/api.php @@ -368,7 +368,7 @@ require_once('include/api_auth.php'); else $redirect = trim($_REQUEST['redirect_uris']); $icon = trim($_REQUEST['logo_uri']); - $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), diff --git a/include/oauth.php b/include/oauth.php index ec41a5dd2..984e0e6c6 100644 --- a/include/oauth.php +++ b/include/oauth.php @@ -37,7 +37,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { logger(__function__.":".$consumer.", ". $token_type.", ".$token, LOGGER_DEBUG); - $r = q("SELECT id, secret, scope, expires, uid FROM tokens WHERE client_id = '%s' AND scope = '%s' AND id = '%s'", + $r = q("SELECT id, secret, auth_scope, expires, uid FROM tokens WHERE client_id = '%s' AND auth_scope = '%s' AND id = '%s'", dbesc($consumer->key), dbesc($token_type), dbesc($token) @@ -45,7 +45,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { if (count($r)){ $ot=new OAuth1Token($r[0]['id'],$r[0]['secret']); - $ot->scope=$r[0]['scope']; + $ot->scope=$r[0]['auth_scope']; $ot->expires = $r[0]['expires']; $ot->uid = $r[0]['uid']; return $ot; @@ -79,7 +79,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { $k = $consumer; } - $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', %d)", + $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires) VALUES ('%s','%s','%s','%s', %d)", dbesc($key), dbesc($sec), dbesc($k), @@ -110,7 +110,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { $key = $this->gen_token(); $sec = $this->gen_token(); - $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)", + $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)", dbesc($key), dbesc($sec), dbesc($consumer->key), @@ -249,7 +249,7 @@ class FKOAuth2 extends OAuth2 { protected function getAuthCode($code) { - $r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'", + $r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'", dbesc($code)); if (count($r)) @@ -259,7 +259,7 @@ class FKOAuth2 extends OAuth2 { protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) { $r = q("INSERT INTO auth_codes - (id, client_id, redirect_uri, expires, scope) VALUES + (id, client_id, redirect_uri, expires, auth_scope) VALUES ('%s', '%s', '%s', %d, '%s')", dbesc($code), dbesc($client_id), diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 63be37f80..2b48afe98 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -188,7 +188,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` ( `client_id` varchar(20) NOT NULL DEFAULT '', `redirect_uri` varchar(200) NOT NULL DEFAULT '', `expires` int(11) NOT NULL DEFAULT '0', - `scope` varchar(250) NOT NULL DEFAULT '', + `auth_scope` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -342,7 +342,7 @@ CREATE TABLE IF NOT EXISTS `clients` ( `client_id` varchar(20) NOT NULL DEFAULT '', `pw` varchar(20) NOT NULL DEFAULT '', `redirect_uri` varchar(200) NOT NULL DEFAULT '', - `name` text, + `clname` text, `icon` text, `uid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`client_id`) @@ -1054,7 +1054,7 @@ CREATE TABLE IF NOT EXISTS `register` ( `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `uid` int(10) unsigned NOT NULL DEFAULT '0', `password` char(255) NOT NULL DEFAULT '', - `language` char(16) NOT NULL DEFAULT '', + `lang` char(16) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `hash` (`hash`), KEY `created` (`created`), @@ -1064,7 +1064,7 @@ CREATE TABLE IF NOT EXISTS `register` ( CREATE TABLE IF NOT EXISTS `session` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `sid` char(255) NOT NULL DEFAULT '', - `data` text NOT NULL, + `sess_data` text NOT NULL, `expire` bigint(20) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `sid` (`sid`), @@ -1176,7 +1176,7 @@ CREATE TABLE IF NOT EXISTS `tokens` ( `secret` text NOT NULL, `client_id` varchar(20) NOT NULL DEFAULT '', `expires` bigint(20) unsigned NOT NULL DEFAULT '0', - `scope` varchar(200) NOT NULL DEFAULT '', + `auth_scope` varchar(512) NOT NULL DEFAULT '', `uid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `client_id` (`client_id`), @@ -1204,13 +1204,13 @@ CREATE TABLE IF NOT EXISTS `updates` ( CREATE TABLE IF NOT EXISTS `verify` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel` int(10) unsigned NOT NULL DEFAULT '0', - `type` char(32) NOT NULL DEFAULT '', + `vtype` char(32) NOT NULL DEFAULT '', `token` char(255) NOT NULL DEFAULT '', `meta` char(255) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `channel` (`channel`), - KEY `type` (`type`), + KEY `vtype` (`vtype`), KEY `token` (`token`), KEY `meta` (`meta`), KEY `created` (`created`) diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 1ae65068c..05b53e1a3 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -184,7 +184,7 @@ CREATE TABLE "auth_codes" ( "client_id" varchar(20) NOT NULL, "redirect_uri" varchar(200) NOT NULL, "expires" bigint NOT NULL, - "scope" varchar(250) NOT NULL, + "auth_scope" varchar(512) NOT NULL, PRIMARY KEY ("id") ); CREATE TABLE "cache" ( @@ -333,7 +333,7 @@ CREATE TABLE "clients" ( "client_id" varchar(20) NOT NULL, "pw" varchar(20) NOT NULL, "redirect_uri" varchar(200) NOT NULL, - "name" text, + "clname" text, "icon" text, "uid" bigint NOT NULL DEFAULT '0', PRIMARY KEY ("client_id") @@ -1043,7 +1043,7 @@ CREATE TABLE "register" ( "created" timestamp NOT NULL, "uid" bigint NOT NULL, "password" text NOT NULL, - "language" varchar(16) NOT NULL, + "lang" varchar(16) NOT NULL, PRIMARY KEY ("id") ); create index "reg_hash" on register ("hash"); @@ -1052,7 +1052,7 @@ create index "reg_uid" on register ("uid"); CREATE TABLE "session" ( "id" serial, "sid" text NOT NULL, - "data" text NOT NULL, + "sess_data" text NOT NULL, "expire" numeric(20) NOT NULL, PRIMARY KEY ("id") ); @@ -1159,7 +1159,7 @@ CREATE TABLE "tokens" ( "secret" text NOT NULL, "client_id" varchar(20) NOT NULL, "expires" numeric(20) NOT NULL, - "scope" varchar(200) NOT NULL, + "auth_scope" varchar(512) NOT NULL, "uid" bigint NOT NULL, PRIMARY KEY ("id") ); @@ -1186,14 +1186,14 @@ create index "ud_last" on updates ("ud_last"); CREATE TABLE "verify" ( "id" serial NOT NULL, "channel" bigint NOT NULL DEFAULT '0', - "type" varchar(32) NOT NULL DEFAULT '', + "vtype" varchar(32) NOT NULL DEFAULT '', "token" text NOT NULL DEFAULT '', "meta" text NOT NULL DEFAULT '', "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY ("id") ); create index "verify_channel" on verify ("channel"); -create index "verify_type" on verify ("type"); +create index "verify_vtype" on verify ("vtype"); create index "verify_token" on verify ("token"); create index "verify_meta" on verify ("meta"); create index "verify_created" on verify ("created"); diff --git a/install/update.php b/install/update.php index 0bd8d59f9..4883d6561 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ - {{if $app.name}}

{{$app.name}}

{{else}}

{{$noname}}

{{/if}} + {{if $app.clname}}

{{$app.clname}}

{{else}}

{{$noname}}

{{/if}} {{if $app.my}} {{if $app.oauth_token}}
-- 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 +- boot.php | 4 +-- include/acl_selectors.php | 4 +-- include/channel.php | 20 +++++++-------- include/contact_widgets.php | 4 +-- include/event.php | 4 +-- include/feedutils.php | 2 +- include/group.php | 20 +++++++-------- include/import.php | 12 ++++++--- include/items.php | 54 +++++++++++++++++++++-------------------- include/taxonomy.php | 18 +++++++------- include/text.php | 2 +- include/widgets.php | 10 ++++---- include/zot.php | 25 +++++++++++++------ install/schema_mysql.sql | 15 ++++++------ install/schema_postgres.sql | 12 ++++----- install/update.php | 26 ++++++++++++++++++-- view/tpl/profile_advanced.tpl | 18 ++++++++++---- view/tpl/profile_edit.tpl | 6 ++--- view/tpl/profile_vcard.tpl | 4 +-- 36 files changed, 210 insertions(+), 163 deletions(-) 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']); diff --git a/boot.php b/boot.php index 24ff3c5d1..e105560e4 100755 --- a/boot.php +++ b/boot.php @@ -45,10 +45,10 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '1.7.1' ); +define ( 'STD_VERSION', '1.7.2' ); define ( 'ZOT_REVISION', 1.1 ); -define ( 'DB_UPDATE_VERSION', 1172 ); +define ( 'DB_UPDATE_VERSION', 1173 ); /** diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 54ea0304b..89d054e3b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -15,7 +15,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { $o .= "