aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php126
-rw-r--r--include/channel.php4
-rw-r--r--include/conversation.php7
-rwxr-xr-xinclude/dba/dba_driver.php2
-rw-r--r--include/features.php17
-rw-r--r--include/photos.php2
-rw-r--r--include/widgets.php4
-rw-r--r--include/zot.php18
8 files changed, 154 insertions, 26 deletions
diff --git a/include/attach.php b/include/attach.php
index 6b17cdca1..137d2b11c 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -2040,4 +2040,128 @@ function copy_folder_to_cloudfiles($channel, $observer_hash, $srcpath, $cloudpat
}
return true;
-} \ No newline at end of file
+}
+/**
+ * attach_move()
+ * This function performs an in place directory-to-directory move of a stored attachment or photo.
+ * The data is physically moved in the store/nickname storage location and the paths adjusted
+ * in the attach structure (and if applicable the photo table). The new 'album name' is recorded
+ * for photos and will show up immediately there.
+ * This takes a channel_id, attach.hash of the file to move (this is the same as a photo resource_id), and
+ * the attach.hash of the new parent folder, which must already exist. If $new_folder_hash is blank or empty,
+ * the file is relocated to the root of the channel's storage area.
+ *
+ * @fixme: this operation is currently not synced to clones !!
+ */
+
+function attach_move($channel_id,$resource_id,$new_folder_hash) {
+
+ $c = channelx_by_n($channel_id);
+ if(! $c)
+ return false;
+
+ $r = q("select * from attach where hash = '%s' and uid = %d limit 1",
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+ if(! $r)
+ return false;
+
+ $oldstorepath = $r[0]['content'];
+
+ if($new_folder_hash) {
+ $n = q("select * from attach where hash = '%s' and uid = %d limit 1",
+ dbesc($new_folder_hash),
+ intval($channel_id)
+ );
+ if(! $n)
+ return;
+ $newdirname = $n[0]['filename'];
+ $newstorepath = $n[0]['content'] . '/' . $resource_id;
+ }
+ else {
+ $newstorepath = 'store/' . $c['channel_address'] . '/' . $resource_id;
+ }
+
+ rename($oldstorepath,$newstorepath);
+
+ // duplicate detection. If 'overwrite' is specified, return false because we can't yet do that.
+
+ $filename = $r[0]['filename'];
+
+ $s = q("select filename, id, hash, filesize from attach where filename = '%s' and folder = '%s' ",
+ dbesc($filename),
+ dbesc($new_folder_hash)
+ );
+
+ if($s) {
+ $overwrite = get_pconfig($channel_id,'system','overwrite_dup_files');
+ if($overwrite) {
+ // @fixme
+ return;
+ }
+ else {
+ if(strpos($filename,'.') !== false) {
+ $basename = substr($filename,0,strrpos($filename,'.'));
+ $ext = substr($filename,strrpos($filename,'.'));
+ }
+ else {
+ $basename = $filename;
+ $ext = '';
+ }
+
+ $v = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' ",
+ dbesc($basename . $ext),
+ dbesc($basename . '(%)' . $ext),
+ dbesc($new_folder_hash)
+ );
+
+ if($v) {
+ $x = 1;
+
+ do {
+ $found = false;
+ foreach($v as $vv) {
+ if($vv['filename'] === $basename . '(' . $x . ')' . $ext) {
+ $found = true;
+ break;
+ }
+ }
+ if($found)
+ $x++;
+ }
+ while($found);
+ $filename = $basename . '(' . $x . ')' . $ext;
+ }
+ else
+ $filename = $basename . $ext;
+ }
+ }
+
+ $t = q("update attach set content = '%s', folder = '%s', filename = '%s' where id = %d",
+ dbesc($newstorepath),
+ dbesc($new_folder_hash),
+ dbesc($filename),
+ intval($r[0]['id'])
+ );
+
+ if($r[0]['is_photo']) {
+ $t = q("update photo set album = '%s', filename = '%s' where resource_id = '%s' and uid = %d",
+ dbesc($newdirname),
+ dbesc($filename),
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+
+ $t = q("update photo set content = '%s' where resource_id = '%s' and uid = %d and imgscale = 0",
+ dbesc($newstorepath),
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+ }
+
+ return true;
+
+}
+
+
diff --git a/include/channel.php b/include/channel.php
index 47db7e806..2c892dbb9 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1103,8 +1103,8 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
require_once('include/widgets.php');
- if(! feature_enabled($profile['uid'],'hide_rating'))
- $z = widget_rating(array('target' => $profile['channel_hash']));
+// if(! feature_enabled($profile['uid'],'hide_rating'))
+ $z = widget_rating(array('target' => $profile['channel_hash']));
$o .= replace_macros($tpl, array(
'$zcard' => $zcard,
diff --git a/include/conversation.php b/include/conversation.php
index 637234bff..2e056b620 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -941,12 +941,9 @@ function item_photo_menu($item){
$clean_url = normalise_link($item['author-link']);
}
- $poco_rating = get_config('system','poco_rating_enable');
- // if unset default to enabled
- if($poco_rating === false)
- $poco_rating = true;
+ $rating_enabled = get_config('system','rating_enabled');
- $ratings_url = (($poco_rating) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
+ $ratings_url = (($rating_enabled) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
$post_menu = Array(
t("View Source") => $vsrc_link,
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index f6091f6e1..7225a9be2 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -62,6 +62,8 @@ class DBA {
if(is_object(self::$dba) && self::$dba->connected) {
+ if($server === 'localhost')
+ $port = $set_port;
$dns = ((self::$dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql')
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
. ';dbname=' . $db;
diff --git a/include/features.php b/include/features.php
index 356de35a2..4e86b7881 100644
--- a/include/features.php
+++ b/include/features.php
@@ -55,21 +55,18 @@ function get_features($filtered = true) {
array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')),
array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')),
array('wiki', t('Wiki'), t('Provide a wiki for your channel'),(($server_role === 'basic') ? false : true),get_config('feature_lock','wiki')),
- array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')),
+// array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')),
array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),
array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')),
array('ajaxchat', t('Access Controlled Chatrooms'), t('Provide chatrooms and chat services with access control.'),true,get_config('feature_lock','ajaxchat')),
array('smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'),true,get_config('feature_lock','smart_birthdays')),
array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')),
- array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')),
),
// Post composition
'composition' => array(
t('Post Composition Features'),
-// array('richtext', t('Richtext Editor'), t('Enable richtext editor'),falseget_config('feature_lock','richtext')),
-// array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false,get_config('feature_lock','markdown')),
array('large_photos', t('Large Photos'), t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'),false,get_config('feature_lock','large_photos')),
array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false,get_config('feature_lock','channel_sources')),
array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false,get_config('feature_lock','content_encrypt')),
@@ -106,6 +103,18 @@ function get_features($filtered = true) {
),
);
+
+
+ if(\Zotlabs\Lib\System::get_server_role() === 'pro') {
+ $arr['general'][] = [
+ 'premium_channel',
+ t('Premium Channel'),
+ t('Allows you to set restrictions and terms on those that connect with your channel'),
+ false,
+ get_config('feature_lock','premium_channel')
+ ];
+ }
+
// removed any locked features and remove the entire category if this makes it empty
if($filtered) {
diff --git a/include/photos.php b/include/photos.php
index d14c12d84..9d15d3692 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -588,6 +588,8 @@ function photos_album_rename($channel_id, $oldname, $newname) {
);
}
+
+
/**
* @brief
*
diff --git a/include/widgets.php b/include/widgets.php
index 2f8416f8e..9429df249 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1286,8 +1286,8 @@ function widget_random_block($arr) {
function widget_rating($arr) {
- $poco_rating = get_config('system','poco_rating_enable');
- if((! $poco_rating) && ($poco_rating !== false)) {
+ $rating_enabled = get_config('system','rating_enabled');
+ if(! $rating_enabled) {
return;
}
diff --git a/include/zot.php b/include/zot.php
index c3c924113..6187e8a61 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3785,20 +3785,14 @@ function zotinfo($arr) {
if($role === 'forum' || $role === 'repository') {
$public_forum = true;
}
- elseif($ztarget_hash) {
+ else {
// check if it has characteristics of a public forum based on custom permissions.
- $t = q("select * from abconfig where abconfig.cat = 'my_perms' and abconfig.chan = %d and abconfig.xchan = '%s' and abconfig.k in ('tag_deliver', 'send_stream') ",
- intval($e['channel_id']),
- dbesc($ztarget_hash)
- );
-
- $ch = 0;
-
- if($t) {
- foreach($t as $tt) {
- if($tt['k'] == 'tag_deliver' && $tt['v'] == 1)
+ $m = \Zotlabs\Access\Permissions::FilledAutoperms($e['channel_id']);
+ if($m) {
+ foreach($m as $k => $v) {
+ if($k == 'tag_deliver' && intval($v) == 1)
$ch ++;
- if($tt['k'] == 'send_stream' && $tt['v'] == 0)
+ if($k == 'send_stream' && intval($v) == 0)
$ch ++;
}
if($ch == 2)