diff options
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | include/Contact.php | 60 | ||||
-rw-r--r-- | include/gprobe.php | 4 | ||||
-rwxr-xr-x | include/items.php | 8 | ||||
-rw-r--r-- | install/database.sql | 4 | ||||
-rw-r--r-- | install/update.php | 10 | ||||
-rw-r--r-- | mod/post.php | 25 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/css/default.css | 3 | ||||
-rw-r--r-- | view/tpl/channel_import.tpl | 35 | ||||
-rw-r--r-- | view/tpl/smarty3/channel_import.tpl | 40 |
11 files changed, 187 insertions, 6 deletions
@@ -16,7 +16,7 @@ require_once('include/features.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica Red'); define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1029 ); +define ( 'DB_UPDATE_VERSION', 1030 ); define ( 'EOL', '<br />' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/include/Contact.php b/include/Contact.php index 7febe310d..36f4cbcf7 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -153,6 +153,66 @@ function channel_remove($channel_id) { } +function remove_all_xchan_resources($xchan, $channel_id = 0) { + + if(intval($channel_id)) { + + + + } + else { + + // this is somewhat destructive +// FIXME + // We don't want to be quite as destructive on directories, which will need to mirror the action + // and we also don't want to completely destroy an xchan that has moved to a new primary location + + $r = q("delete from photo where xchan = '%s'", + dbesc($xchan) + ); + $r = q("select resource_id, resource_type, uid, id from item where ( author_xchan = '%s' or owner_xchan = '%s' ) ", + dbesc($xchan), + dbesc($xchan) + ); + if($r) { + foreach($r as $rr) { + drop_item($rr,false); + } + } + $r = q("delete from event where event_xchan = '%s'", + dbesc($xchan) + ); + $r = q("delete from group_member where xchan = '%s'", + dbesc($xchan) + ); + $r = q("delete from mail where ( from_xchan = '%s' or to_xchan = '%s' )", + dbesc($xchan), + dbesc($xchan) + ); + $r = q("delete from xlink where ( xlink_xchan = '%s' or xlink_link = '%s' )", + dbesc($xchan), + dbesc($xchan) + ); + + + $r = q("delete from xchan where xchan_hash = '%s' limit 1", + dbesc($xchan) + ); + $r = q("delete from hubloc where hubloc_hash = '%s'", + dbesc($xchan) + ); + $r = q("delete from abook where abook_xchan = '%s'", + dbesc($xchan) + ); + $r = q("delete from xtag where xtag_hash = '%s'", + dbesc($xchan) + ); + + } +} + + + function contact_remove($channel_id, $abook_id) { diff --git a/include/gprobe.php b/include/gprobe.php index 25b56525a..2cc87d149 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -20,8 +20,8 @@ function gprobe_run($argv, $argc){ if(! $r) { $x = zot_finger($url,null); - if($x) { - $j = json_decode($x,true); + if($x['success']) { + $j = json_decode($x['body'],true); $y = import_xchan($j); } } diff --git a/include/items.php b/include/items.php index 59bb58eaa..3fd43ca4e 100755 --- a/include/items.php +++ b/include/items.php @@ -4265,6 +4265,14 @@ function delete_item_lowlevel($item) { intval($item['uid']) ); + q("delete from term where oid = %d and otype = %d", + intval($item['id']), + intval(TERM_OBJ_POST) + ); + +// FIXME remove notifications for this item + + return true; } diff --git a/install/database.sql b/install/database.sql index 3deb96c21..7fd200017 100644 --- a/install/database.sql +++ b/install/database.sql @@ -153,6 +153,7 @@ CREATE TABLE IF NOT EXISTS `channel` ( `channel_prvkey` text NOT NULL, `channel_notifyflags` int(10) unsigned NOT NULL DEFAULT '65535', `channel_pageflags` int(10) unsigned NOT NULL DEFAULT '0', + `channel_deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `channel_max_anon_mail` int(10) unsigned NOT NULL DEFAULT '10', `channel_max_friend_req` int(10) unsigned NOT NULL DEFAULT '10', `channel_expire_days` int(11) NOT NULL DEFAULT '0', @@ -209,7 +210,8 @@ CREATE TABLE IF NOT EXISTS `channel` ( KEY `channel_r_storage` (`channel_r_storage`), KEY `channel_w_storage` (`channel_w_storage`), KEY `channel_r_pages` (`channel_r_pages`), - KEY `channel_w_pages` (`channel_w_pages`) + KEY `channel_w_pages` (`channel_w_pages`), + KEY `channel_deleted` (`channel_deleted`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `clients` ( diff --git a/install/update.php b/install/update.php index 7c755dd2d..290b80cd1 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1029 ); +define( 'UPDATE_VERSION' , 1030 ); /** * @@ -357,3 +357,11 @@ ADD INDEX ( `xlink_rating` ) "); return UPDATE_SUCCESS; return UPDATE_FAILED; } + +function update_r1029() { + $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_pageflags` , +ADD INDEX ( `channel_deleted` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} diff --git a/mod/post.php b/mod/post.php index b7c16ff9a..e5fa1a418 100644 --- a/mod/post.php +++ b/mod/post.php @@ -236,6 +236,31 @@ function post_post(&$a) { if(array_key_exists('recipients',$data)) $recipients = $data['recipients']; + + if($msgtype === 'purge') { + if($recipients) { + // basically this means "unfriend" + foreach($recipients as $recip) { + + + + } + + + } + else { + // basically this means the channel has committed suicide + $arr = $data['sender']; + $sender_hash = base64url_encode(hash('whirlpool',$arr['guid'] . $arr['guid_sig'], true)); + + require_once('include/Contact.php'); + remove_all_xchan_resources($sender_hash); + + $ret['result'] = true; + json_return_and_die($ret); + + } + } if($msgtype === 'refresh') { // remote channel info (such as permissions or photo or something) diff --git a/version.inc b/version.inc index abe9cf720..7e1699df2 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-02-16.226 +2013-02-18.228 diff --git a/view/css/default.css b/view/css/default.css index 19eeb9a68..f3b34a86d 100644 --- a/view/css/default.css +++ b/view/css/default.css @@ -20,4 +20,7 @@ section { left: 250px; display: block; right: 15px; + padding-bottom: 350px; } + + diff --git a/view/tpl/channel_import.tpl b/view/tpl/channel_import.tpl new file mode 100644 index 000000000..8002b6e03 --- /dev/null +++ b/view/tpl/channel_import.tpl @@ -0,0 +1,35 @@ +<h2>$title</h2> + +<form action="import" method="post" id="import-channel-form"> + + <div id="import-desc" class="descriptive-paragraph">$desc</div> + + <label for="import-filename" id="label-import-filename" class="import-label" >$label_filename</label> + <input type="file" name="filename" id="import-filename" class="import-input" value="" /> + <div id="import-filename-end" class="import-field-end"></div> + + <div id="import-choice" class="descriptive-paragraph">$choice</div> + + <label for="import-old-address" id="label-import-old-address" class="import-label" >$label_old_address</label> + <input type="text" name="old_address" id="import-old-address" class="import-input" value="" /> + <div id="import-old-address-end" class="import-field-end"></div> + + <label for="import-old-email" id="label-import-old-email" class="import-label" >$label_old_email</label> + <input type="text" name="email" id="import-old-email" class="import-input" value="$email" /> + <div id="import-old-email-end" class="import-field-end"></div> + + <label for="import-old-pass" id="label-import-old-pass" class="import-label" >$label_old_pass</label> + <input type="password" name="password" id="import-old-pass" class="import-input" value="$pass" /> + <div id="import-old-pass-end" class="import-field-end"></div> + + <div id="import-common-desc" class="descriptive-paragraph">$common</div> + + <input type="checkbox" name="make_primary" id="import-make-primary" value="1" /> + <label for="import-make-primary" id="label-import-make-primary">$label_import_primary</label> + <div id="import-make-primary-end" class="import-field-end"></div> + + <input type="submit" name="submit" id="import-submit-button" value="$submit" /> + <div id="import-submit-end" class="import-field-end"></div> + +</form> + diff --git a/view/tpl/smarty3/channel_import.tpl b/view/tpl/smarty3/channel_import.tpl new file mode 100644 index 000000000..872f039b7 --- /dev/null +++ b/view/tpl/smarty3/channel_import.tpl @@ -0,0 +1,40 @@ +{{* + * AUTOMATICALLY GENERATED TEMPLATE + * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN + * + *}} +<h2>{{$title}}</h2> + +<form action="import" method="post" id="import-channel-form"> + + <div id="import-desc" class="descriptive-paragraph">{{$desc}}</div> + + <label for="import-filename" id="label-import-filename" class="import-label" >{{$label_filename}}</label> + <input type="file" name="filename" id="import-filename" class="import-input" value="" /> + <div id="import-filename-end" class="import-field-end"></div> + + <div id="import-choice" class="descriptive-paragraph">{{$choice}}</div> + + <label for="import-old-address" id="label-import-old-address" class="import-label" >{{$label_old_address}}</label> + <input type="text" name="old_address" id="import-old-address" class="import-input" value="" /> + <div id="import-old-address-end" class="import-field-end"></div> + + <label for="import-old-email" id="label-import-old-email" class="import-label" >{{$label_old_email}}</label> + <input type="text" name="email" id="import-old-email" class="import-input" value="{{$email}}" /> + <div id="import-old-email-end" class="import-field-end"></div> + + <label for="import-old-pass" id="label-import-old-pass" class="import-label" >{{$label_old_pass}}</label> + <input type="password" name="password" id="import-old-pass" class="import-input" value="{{$pass}}" /> + <div id="import-old-pass-end" class="import-field-end"></div> + + <div id="import-common-desc" class="descriptive-paragraph">{{$common}}</div> + + <input type="checkbox" name="make_primary" id="import-make-primary" value="1" /> + <label for="import-make-primary" id="label-import-make-primary">{{$label_import_primary}}</label> + <div id="import-make-primary-end" class="import-field-end"></div> + + <input type="submit" name="submit" id="import-submit-button" value="{{$submit}}" /> + <div id="import-submit-end" class="import-field-end"></div> + +</form> + |