diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/display.php | 52 | ||||
-rw-r--r-- | mod/import.php | 20 | ||||
-rw-r--r-- | mod/network.php | 2 | ||||
-rw-r--r-- | mod/profiles.php | 56 |
4 files changed, 93 insertions, 37 deletions
diff --git a/mod/display.php b/mod/display.php index b2d9ba34b..40427846b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -116,7 +116,7 @@ function display_content(&$a, $update = 0, $load = false) { $simple_update = (($update) ? " AND item_unseen = 1 " : ''); if($update && $_SESSION['loadtime']) - $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; @@ -217,9 +217,54 @@ function display_content(&$a, $update = 0, $load = false) { } } - else { - $r = array(); + } + + elseif($update && !$load) { + $r = null; + + require_once('include/identity.php'); + $sys = get_sys_channel(); + $sysid = $sys['channel_id']; + + if(local_channel()) { + $r = q("SELECT * from item + WHERE uid = %d + and mid = '%s' + $item_normal + $simple_update + limit 1", + intval(local_channel()), + dbesc($target_item['parent_mid']) + ); + if($r) { + $updateable = true; + } } + if($r === null) { + // in case somebody turned off public access to sys channel content using permissions + // make that content unsearchable by ensuring the owner_xchan can't match + if(! perm_is_allowed($sysid,$observer_hash,'view_stream')) + $sysid = 0; + + $r = q("SELECT * from item + WHERE mid = '%s' + AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' + AND `item`.`deny_gid` = '' AND item_private = 0 ) + and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) + OR uid = %d ) + $sql_extra ) + $item_normal + $simple_update + limit 1", + dbesc($target_item['parent_mid']), + intval($sysid) + ); + } + $_SESSION['loadtime'] = datetime_convert(); + } + + else { + $r = array(); } if($r) { @@ -284,6 +329,5 @@ function display_content(&$a, $update = 0, $load = false) { } */ - return $o; } diff --git a/mod/import.php b/mod/import.php index 0b239d822..f91f261a5 100644 --- a/mod/import.php +++ b/mod/import.php @@ -108,10 +108,9 @@ function import_account(&$a, $account_id) { import_diaspora($data); return; } - - if(UNO) - return; - + + $moving = false; + if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) { $v1 = substr($data['compatibility']['database'],-4); $v2 = substr(DB_UPDATE_VERSION,-4); @@ -119,14 +118,13 @@ function import_account(&$a, $account_id) { $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 ); notice($t); } - if(array_key_exists('server_role',$data['compatibility']) - && $data['compatibility']['server_role'] != Zotlabs\Project\System::get_server_role()) { - notice( t('Server platform is not compatible. Operation not permitted.') . EOL); - return; - } - + if(array_key_exists('server_role',$data['compatibility']) && $data['compatibility']['server_role'] == 'basic') + $moving = true; } + if($moving) + $seize = 1; + // import channel if(array_key_exists('channel',$data)) { @@ -189,7 +187,7 @@ function import_account(&$a, $account_id) { if($completed < 4) { - if(is_array($data['hubloc'])) { + if(is_array($data['hubloc']) && (! $moving)) { import_hublocs($channel,$data['hubloc'],$seize); } diff --git a/mod/network.php b/mod/network.php index 17f57f498..134a4081d 100644 --- a/mod/network.php +++ b/mod/network.php @@ -174,8 +174,10 @@ function network_content(&$a, $update = 0, $load = false) { if($deftag) $x['pretext'] = $deftag; + $status_editor = status_editor($a,$x); $o .= $status_editor; + } diff --git a/mod/profiles.php b/mod/profiles.php index 3ae1390df..57d3561b1 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -272,9 +272,17 @@ function profiles_post(&$a) { $name = escape_tags(trim($_POST['name'])); - if($orig[0]['name'] != $name) + if($orig[0]['name'] != $name) { $namechanged = true; + $v = validate_channelname($name); + if($v) { + $notice($v); + $namechanged = false; + $name = $orig[0]['name']; + } + } + $pdesc = escape_tags(trim($_POST['pdesc'])); $gender = escape_tags(trim($_POST['gender'])); $address = escape_tags(trim($_POST['address'])); @@ -563,6 +571,10 @@ function profiles_post(&$a) { dbesc(datetime_convert()), dbesc($channel['xchan_hash']) ); + $r = q("UPDATE channel SET channel_name = '%s' WHERE channel_hash = '%s'", + dbesc($name), + dbesc($channel['xchan_hash']) + ); } if($is_default) { @@ -683,28 +695,28 @@ function profiles_content(&$a) { '$exportable' => feature_enabled(local_channel(),'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), - '$lbl_profname' => t('Profile Name:'), - '$lbl_fullname' => t('Your Full Name:'), - '$lbl_title' => t('Title/Description:'), - '$lbl_gender' => t('Your Gender:'), - '$lbl_bd' => t("Birthday :"), - '$lbl_address' => t('Street Address:'), - '$lbl_city' => t('Locality/City:'), - '$lbl_zip' => t('Postal/Zip Code:'), - '$lbl_country' => t('Country:'), - '$lbl_region' => t('Region/State:'), - '$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'), - '$lbl_with' => t("Who: \x28if applicable\x29"), + '$lbl_profname' => t('Profile Name'), + '$lbl_fullname' => t('Your Full Name'), + '$lbl_title' => t('Title/Description'), + '$lbl_gender' => t('Your Gender'), + '$lbl_bd' => t("Birthday"), + '$lbl_address' => t('Street Address'), + '$lbl_city' => t('Locality/City'), + '$lbl_zip' => t('Postal/Zip Code'), + '$lbl_country' => t('Country'), + '$lbl_region' => t('Region/State'), + '$lbl_marital' => t('<span class="heart">♥</span> Marital Status'), + '$lbl_with' => t("Who (if applicable)"), '$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'), - '$lbl_howlong' => t('Since [date]:'), - '$lbl_sexual' => t('Sexual Preference:'), - '$lbl_homepage' => t('Homepage URL:'), - '$lbl_hometown' => t('Hometown:'), - '$lbl_politic' => t('Political Views:'), - '$lbl_religion' => t('Religious Views:'), - '$lbl_pubkey' => t('Keywords:'), - '$lbl_likes' => t('Likes:'), - '$lbl_dislikes' => t('Dislikes:'), + '$lbl_howlong' => t('Since [date]'), + '$lbl_sexual' => t('Sexual Preference'), + '$lbl_homepage' => t('Homepage URL'), + '$lbl_hometown' => t('Hometown'), + '$lbl_politic' => t('Political Views'), + '$lbl_religion' => t('Religious Views'), + '$lbl_pubkey' => t('Keywords'), + '$lbl_likes' => t('Likes'), + '$lbl_dislikes' => t('Dislikes'), '$lbl_ex2' => t('Example: fishing photography software'), '$lbl_pubdsc' => t("Used in directory listings"), '$lbl_about' => t('Tell us about yourself...'), |