diff options
-rw-r--r-- | Zotlabs/Module/Fsuggest.php | 117 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | install/schema_mysql.sql | 70 | ||||
-rw-r--r-- | install/schema_postgres.sql | 69 | ||||
-rw-r--r-- | install/update.php | 17 |
5 files changed, 17 insertions, 258 deletions
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 @@ -<?php -namespace Zotlabs\Module; - - - -class Fsuggest extends \Zotlabs\Web\Controller { - - function post() { - - if(! local_channel()) { - return; - } - - if(\App::$argc != 2) - return; - - $contact_id = intval(\App::$argv[1]); - - $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($contact_id), - intval(local_channel()) - ); - if(! count($r)) { - notice( t('Contact not found.') . EOL); - return; - } - $contact = $r[0]; - - $new_contact = intval($_POST['suggest']); - - $hash = random_string(); - - $note = escape_tags(trim($_POST['note'])); - - if($new_contact) { - $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($new_contact), - intval(local_channel()) - ); - if(count($r)) { - - $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) - VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", - intval(local_channel()), - intval($contact_id), - dbesc($r[0]['name']), - dbesc($r[0]['url']), - dbesc($r[0]['request']), - dbesc($r[0]['photo']), - dbesc($hash), - dbesc(datetime_convert()) - ); - $r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1", - dbesc($hash), - intval(local_channel()) - ); - if(count($r)) { - $fsuggest_id = $r[0]['id']; - q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d", - dbesc($note), - intval($fsuggest_id), - intval(local_channel()) - ); - \Zotlabs\Daemon\Master::Summon(array('Notifier', 'suggest' , $fsuggest_id)); - } - - info( t('Friend suggestion sent.') . EOL); - } - - } - - - } - - - - function get() { - - require_once('include/acl_selectors.php'); - - if(! local_channel()) { - notice( t('Permission denied.') . EOL); - return; - } - - if(\App::$argc != 2) - return; - - $contact_id = intval(\App::$argv[1]); - - $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($contact_id), - intval(local_channel()) - ); - if(! count($r)) { - notice( t('Contact not found.') . EOL); - return; - } - $contact = $r[0]; - - $o = '<h3>' . t('Suggest Friends') . '</h3>'; - - $o .= '<div id="fsuggest-desc" >' . sprintf( t('Suggest a friend for %s'), $contact['name']) . '</div>'; - - $o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >'; - - // FIXME contact_selector deprecated, removed - // $o .= contact_selector('suggest','suggest-select', false, - // array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true)); - - - $o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>'; - $o .= '</form>'; - - return $o; - } -} @@ -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 @@ <?php -define( 'UPDATE_VERSION' , 1170 ); +define( 'UPDATE_VERSION' , 1171 ); /** * @@ -2131,4 +2131,19 @@ function update_r1169() { if($r1 && $r2 && $r3) return UPDATE_SUCCESS; return UPDATE_FAILED; +} + + +function update_r1170() { + + $r1 = q("drop table fcontact"); + $r2 = q("drop table ffinder"); + $r3 = q("drop table fserver"); + $r4 = q("drop table fsuggest"); + $r5 = q("drop table spam"); + + if($r1 && $r2 && $r3 && $r4 && $r5) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + }
\ No newline at end of file |