Merge remote-tracking branch 'upstream/dev' into website-export. Added attach_move() to include/attach.php.

This commit is contained in:
Andrew Manning 2016-08-27 06:52:01 -04:00
commit ddfc5209d3
26 changed files with 7117 additions and 6819 deletions

View File

@ -268,6 +268,8 @@ class Admin extends \Zotlabs\Web\Controller {
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
$server_role = ((x($_POST,'server_role')) ? notags(trim($_POST['server_role'])) : 'standard');
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
$admininfo = ((x($_POST,'admininfo')) ? trim($_POST['admininfo']) : false);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
@ -308,6 +310,8 @@ class Admin extends \Zotlabs\Web\Controller {
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
$verify_email = ((x($_POST,'verify_email')) ? 1 : 0);
set_config('system', 'server_role', $server_role);
set_config('system', 'feed_contacts', $feed_contacts);
set_config('system', 'delivery_interval', $delivery_interval);
set_config('system', 'delivery_batch_count', $delivery_batch_count);
@ -481,6 +485,12 @@ class Admin extends \Zotlabs\Web\Controller {
// now invert the logic for the setting.
$discover_tab = (1 - $discover_tab);
$server_roles = [
'basic' => t('Basic/Minimal Social Networking'),
'standard' => t('Standard Configuration (default)'),
'pro' => t('Professional')
];
$homelogin = get_config('system','login_on_homepage');
$enable_context_help = get_config('system','enable_context_help');
@ -498,6 +508,9 @@ class Admin extends \Zotlabs\Web\Controller {
'$baseurl' => z_root(),
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$server_role' => array('server_role', t("Server Configuration/Role"), get_config('system','server_role'),'',$server_roles),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),

View File

@ -663,13 +663,9 @@ class Connedit extends \Zotlabs\Web\Controller {
$rating_text = $xl[0]['xlink_rating_text'];
}
$poco_rating = get_config('system','poco_rating_enable');
$rating_enabled = get_config('system','rating_enabled');
// if unset default to enabled
if($poco_rating === false)
$poco_rating = true;
if($poco_rating) {
if($rating_enabled) {
$rating = replace_macros(get_markup_template('rating_slider.tpl'),array(
'$min' => -10,
'$val' => $rating_val

View File

@ -239,7 +239,7 @@ class Directory extends \Zotlabs\Web\Controller {
$page_type = '';
if($rr['total_ratings'])
if($rr['total_ratings'] && get_config('system','rating_enabled'))
$total_ratings = sprintf( tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
else
$total_ratings = '';

View File

@ -16,7 +16,9 @@ class Pubsites extends \Zotlabs\Web\Controller {
$url = $directory['url'] . '/dirsearch';
}
$url .= '/sites';
$rating_enabled = get_config('system','rating_enabled');
$o .= '<div class="generic-content-wrapper">';
$o .= '<div class="section-title-wrapper"><h2>' . t('Public Hubs') . '</h2></div>';
@ -28,7 +30,10 @@ class Pubsites extends \Zotlabs\Web\Controller {
if($ret['success']) {
$j = json_decode($ret['body'],true);
if($j) {
$o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Stats') . '</td><td>' . t('Software') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>';
$o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Stats') . '</td><td>' . t('Software') . '</td>';
if($rating_enabled)
$o .= '<td colspan="2">' . t('Ratings') . '</td>';
$o .= '</tr>';
if($j['sites']) {
foreach($j['sites'] as $jj) {
$m = parse_url($jj['url']);
@ -44,7 +49,10 @@ class Pubsites extends \Zotlabs\Web\Controller {
$location = '<br />&nbsp;';
}
$urltext = str_replace(array('https://'), '', $jj['url']);
$o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>';
$o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . '</td>';
if($rating_enabled)
$o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links ;
$o .= '</tr>';
}
}

View File

@ -119,8 +119,8 @@ class Rate extends \Zotlabs\Web\Controller {
// return;
// }
$poco_rating = get_config('system','poco_rating_enable');
if((! $poco_rating) && ($poco_rating !== false)) {
$rating_enabled = get_config('system','rating_enabled');
if(! $rating_enabled) {
notice('Ratings are disabled on this site.');
return;
}
@ -141,11 +141,7 @@ class Rate extends \Zotlabs\Web\Controller {
$rating_text = '';
}
// if unset default to enabled
if($poco_rating === false)
$poco_rating = true;
if($poco_rating) {
if($rating_enabled) {
$rating = replace_macros(get_markup_template('rating_slider.tpl'),array(
'$min' => -10,
'$val' => $rating_val

View File

@ -21,12 +21,9 @@ class Ratings extends \Zotlabs\Web\Controller {
if($x)
$url = $x['url'];
$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');
if(! $poco_rating)
if(! $rating_enabled)
return;
if(argc() > 1)
@ -87,12 +84,9 @@ class Ratings extends \Zotlabs\Web\Controller {
return;
}
$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');
if(! $poco_rating)
if(! $rating_enabled)
return;
$site_target = ((array_key_exists('target',\App::$data) && array_key_exists('site_url',\App::$data['target'])) ?

View File

@ -73,7 +73,9 @@ class Setup extends \Zotlabs\Web\Controller {
$phpath = trim($_POST['phpath']);
$adminmail = trim($_POST['adminmail']);
$siteurl = trim($_POST['siteurl']);
$advanced = ((intval($_POST['advanced'])) ? 1 : 0);
$server_role = trim($_POST['server_role']);
if(! $server_role)
$server_role = 'standard';
// $siteurl should not have a trailing slash
@ -101,7 +103,9 @@ class Setup extends \Zotlabs\Web\Controller {
$timezone = notags(trim($_POST['timezone']));
$adminmail = notags(trim($_POST['adminmail']));
$siteurl = notags(trim($_POST['siteurl']));
$advanced = ((intval($_POST['advanced'])) ? 'standard' : 'basic');
$server_role = notags(trim($_POST['server_role']));
if(! $server_role)
$server_role = 'standard';
if($siteurl != z_root()) {
$test = z_fetch_url($siteurl."/setup/testrewrite");
@ -130,7 +134,7 @@ class Setup extends \Zotlabs\Web\Controller {
'$dbpass' => $dbpass,
'$dbdata' => $dbdata,
'$dbtype' => $dbtype,
'$server_role' => $advanced,
'$server_role' => $server_role,
'$timezone' => $timezone,
'$siteurl' => $siteurl,
'$site_id' => random_string(),
@ -327,6 +331,12 @@ class Setup extends \Zotlabs\Web\Controller {
$siteurl = notags(trim($_POST['siteurl']));
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
$server_roles = [
'basic' => t('Basic/Minimal Social Networking'),
'standard' => t('Standard Configuration (default)'),
'pro' => t('Professional')
];
$tpl = get_markup_template('install_settings.tpl');
$o .= replace_macros($tpl, array(
'$title' => $install_title,
@ -344,7 +354,8 @@ class Setup extends \Zotlabs\Web\Controller {
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')),
'$advanced' => array('advanced', t('Enable $Projectname <strong>advanced</strong> features?'), 1, t('Some advanced features, while useful - may be best suited for technically proficient audiences')),
'$server_role' => array('server_role', t("Server Configuration/Role"), 'standard','',$server_roles),
'$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()),

View File

@ -99,18 +99,73 @@ class Comanche {
}
}
function get_condition_var($v) {
if($v) {
$x = explode('.',$v);
if($x[0] == 'config')
return get_config($x[1],$x[2]);
elseif($x[0] === 'observer') {
if(count($x) > 1) {
$y = \App::get_observer();
if(! $y)
return false;
if($x[1] == 'address')
return $y['xchan_addr'];
elseif($x[1] == 'name')
return $y['xchan_name'];
return false;
}
return get_observer_hash();
}
else
return false;
}
return false;
}
function test_condition($s) {
// This is extensible. The first version of variable testing supports tests of the form
// This is extensible. The first version of variable testing supports tests of the forms:
// [if $config.system.foo == baz] which will check if get_config('system','foo') is the string 'baz';
// [if $config.system.foo != baz] which will check if get_config('system','foo') is not the string 'baz';
// You may check numeric entries, but these checks are evaluated as strings.
// [if $config.system.foo {} baz] which will check if 'baz' is an array element in get_config('system','foo')
// [if $config.system.foo {*} baz] which will check if 'baz' is an array key in get_config('system','foo')
// [if $config.system.foo] which will check for a return of a true condition for get_config('system','foo');
// The values 0, '', an empty array, and an unset value will all evaluate to false.
if(preg_match("/[\$]config[\.](.*?)/",$s,$matches)) {
$x = explode('.',$s);
if(get_config($x[1],$x[2]))
if(preg_match('/[\$](.*?)\s\=\=\s(.*?)$/',$s,$matches)) {
$x = $this->get_condition_var($matches[1]);
if($x == trim($matches[2]))
return true;
return false;
}
if(preg_match('/[\$](.*?)\s\!\=\s(.*?)$/',$s,$matches)) {
$x = $this->get_condition_var($matches[1]);
if($x != trim($matches[2]))
return true;
return false;
}
if(preg_match('/[\$](.*?)\s\{\}\s(.*?)$/',$s,$matches)) {
$x = $this->get_condition_var($matches[1]);
if(is_array($x) && in_array(trim($matches[2]),$x))
return true;
return false;
}
if(preg_match('/[\$](.*?)\s\{\*\}\s(.*?)$/',$s,$matches)) {
$x = $this->get_condition_var($matches[1]);
if(is_array($x) && array_key_exists(trim($matches[2]),$x))
return true;
return false;
}
if(preg_match('/[\$](.*?)/',$s,$matches)) {
$x = $this->get_condition_var($matches[1]);
if($x)
return true;
return false;
}
return false;

View File

@ -27,6 +27,12 @@ class SmartyTemplate implements TemplateEngine {
public function replace_macros($s, $r) {
$template = '';
// these are available for use in all templates
$r['$z_baseurl'] = z_root();
$r['$z_server_role'] = \Zotlabs\Lib\System::get_server_role();
if(gettype($s) === 'string') {
$template = $s;
$s = new SmartyInterface();

View File

@ -65,17 +65,23 @@ By default, $nav is placed in the &quot;nav&quot; page region and $content is pl
To select a theme for your page, use the 'theme' tag.
[code]
[theme]apw[/theme]
[theme]suckerberg[/theme]
[/code]
This will select the theme named &quot;apw&quot;. By default your channel's preferred theme will be used.
This will select the theme named &quot;suckerberg&quot;. By default your channel's preferred theme will be used.
[code]
[theme=passion]apw[/theme]
[theme=passion]suckerberg[/theme]
[/code]
This will select the theme named &quot;apw&quot; and select the &quot;passion&quot; schema (theme variant).
This will select the theme named &quot;suckerberg&quot; and select the &quot;passion&quot; schema (theme variant). Alternatively it may be possible to use a condensed theme notation for this.
[code]
[theme]suckerberg:passion[/theme]
[/code]
The condensed notation isn't part of Comanche itself but is recognised by the $Projectname platform as a theme specifier.
[b]Regions[/b]
Each region has a name, as noted above. You will specify the region of interest using a 'region' tag, which includes the name. Any content you wish placed in this region should be placed between the opening region tag and the closing tag.
@ -164,7 +170,42 @@ The 'comment' tag is used to delimit comments. These comments will not appear on
[comment]This is a comment[/comment]
[/code]
[b]Conditional Execution[/b]
You can use an 'if' construct to make decisions. These are currently based on system configuration variable or the current observer.
[code]
[if $config.system.foo]
... the configuration variable system.foo evaluates to 'true'.
[else]
... the configuration variable system.foo evaluates to 'false'.
[/if]
[if $observer]
... this content will only be show to authenticated viewers
[/if]
[/code]
The 'else' clause is optional.
Several tests are supported besides boolean evaluation.
[code]
[if $config.system.foo == bar]
... the configuration variable system.foo is equal to the string 'bar'
[/if]
[if $config.system.foo != bar]
... the configuration variable system.foo is not equal to the string 'bar'
[/if]
[if $config.system.foo {} bar ]
... the configuration variable system.foo is a simple array containing a value 'bar'
[/if]
[if $config.system.foo {*} bar]
... the configuration variable system.foo is a simple array containing a key named 'bar'
[/if]
[/code]
[b]Complex Example[/b]
[code]
[comment]use an existing page template which provides a banner region plus 3 columns beneath it[/comment]

View File

@ -0,0 +1,12 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>This page allows you to change or edit any individual settings for a particular connection or delete a connection completely. You may have arrived at this page after creating or approving a new connection. If so, you are not required to do anything. Your connection has already been established. You <strong>may</strong> wish to add them to a group or adjust special permissions, and this page is presented so that you may do this while the opportunity is fresh.</dd>
<dt><a href='#' onclick='contextualHelpFocus(".section-title-wrapper", 0); return false;' title="Click to highlight element...">Connection Tools</a></dt>
<dd>The <a href='#' onclick='contextualHelpFocus(".section-title-wrapper", 0); return false;' title="Click to highlight element...">Connection Tools</a> menu access several settings. View Profile, View Recent Activity, Refresh Permissions, set or reset flags (Block, Ignore, Archive, Hide) and Delete the connection.</dd>
<dt><a href='#' onclick='contextualHelpFocus("#group-sidebar", 0); return false;' title="Click to highlight element...">Privacy Groups</a></dt>
<dd>Each connection may be assigned to one or more Privacy Groups for grouping collections of friends with access to specific posts, media and other content. You may add them to an existing privacy group here, or create a new privacy group. When you add them to an existing group the action is immediate and you are not required to submit a form. </dd>
<dt><a href='#' onclick='contextualHelpFocus("#perms-tool", 0); return false;' title="Click to highlight element...">Individual Permissions</a></dt>
<dd>Granting of permissions is usually automatic and require no action on your part. However you may wish to adjust specific permsisions for this connection which are different than for others.</dd>
<dt>Feature Specific Settings</dt>
<dd>A number of individual settings are controlled through additional features which may or may not be activated on your hub or for your channel. Several optional features have settings for each connection, and those may be set on this page through additional form tabs which may be present.</dd>
</dl>

View File

@ -0,0 +1,12 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>Esta página le permite cambiar o modificar cualquier ajuste individual para una conexión en concreto o eliminar una conexión completamente. Ha podido llegar a esta página tras crear o aprobar una conexión nueva. Si es así, no tiene por qué hacer nada. Su conexión ya se ha establecido. <strong>Es posible</strong> que desee añadirla a un grupo o ajustar para ella permisos especiales; si es así, esta página se presenta de modo que usted pueda hacerlo mientras todo el proceso es aún reciente.</dd>
<dt><a href='#' onclick='contextualHelpFocus(".section-title-wrapper", 0); return false;' title="Pulsar para resaltar el elemento...">Conexiones</a></dt>
<dd>El menú <a href='#' onclick='contextualHelpFocus(".section-title-wrapper", 0); return false;' title="Pulsar para resaltar el elemento...">Conexiones</a> le da acceso a varios ajustes: "Ver el perfil", "Ver la actividad reciente", "Recargar los permisos", añadir o quitar estados ("flags") ("Bloquear", "Ignorar", "Archivar", "Ocultar") y eliminar la conexión.</dd>
<dt><a href='#' onclick='contextualHelpFocus("#group-sidebar", 0); return false;' title="Pulsar para resaltar el elemento...">Grupos de canales</a></dt>
<dd>Todas las conexiones se puede incluir en uno o varios grupos de canales para formar conjuntos de amigos con acceso a publicaciones concretas, ficheros multimedia y otros tipos de contenido. Puede añadirla aquí a un grupo de canales ya existente o crear un grupo nuevo. Cuando añade la conexión a un grupo que ya existe, el efecto es inmediato y no será requerido para confirmarlo.</dd>
<dt><a href='#' onclick='contextualHelpFocus("#perms-tool", 0); return false;' title="Pulsar para resaltar el elemento...">Permisos individuales</a></dt>
<dd>La concesión de permisos es, generalmente, automática y no requiere ninguna acción por su parte. Sin embargo, puede, si lo desea, ajustar permisos especiales, diferentes de los permisos concedidos a otros, para una conexión concreta.</dd>
<dt>Ajustes de funcionalidades concretas</dt>
<dd>Una serie de ajustes individuales se controlan mediante funcionalidades adicionales que pueden, o no, estar activadas en un hub o para su canal en concreto. Varias funcionalidades adicionales tienen ajustes para cada conexión, Estas funcionalidades se pueden configurar en esta página, de forma adicional, mediante pestañas que pueden estar presentes.</dd>
</dl>

View File

@ -67,7 +67,7 @@ Options are:
[*= system.paranoia ] As the pconfig, but on a site-wide basis. Can be overwritten by member settings.
[*= system.photo_cache_time ] How long to cache photos, in seconds. Default is 86400 (1 day). Longer time increases performance, but it also means it takes longer for changed permissions to apply.
[*= system.platform_name ] What to report as the platform name in webpages and statistics. (*) Must be set in .htconfig.php
[*= system.poco_rating_enable ] Distributed reputation reporting and data collection may be disabled. If your site does not participate in distributed reputation you will also not be able to make use of the data from your connections on other sites. By default and in the absence of any setting it is enabled. Individual members can opt out by restricting who can see their connections or by not providing any reputation information for their connections.
[*= system.rating_enabled ] Distributed reputation reporting and data collection. This feature is currently being re-worked.
[*= system.poke_basic ] Reduce the number of poke verbs to exactly 1 ("poke"). Disable other verbs.
[*= system.proc_run_use_exec ] If 1, use the exec system call in proc_run to run background tasks. By default we use proc_open and proc_close. On some (currently rare) systems this does not work well.
[*= system.projecthome ] Display the project page on your home page for logged out viewers.

View File

@ -2040,4 +2040,128 @@ function copy_folder_to_cloudfiles($channel, $observer_hash, $srcpath, $cloudpat
}
return true;
}
}
/**
* 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;
}

View File

@ -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,

View File

@ -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,

View File

@ -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;

View File

@ -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) {

View File

@ -588,6 +588,8 @@ function photos_album_rename($channel_id, $oldname, $newname) {
);
}
/**
* @brief
*

View File

@ -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;
}

View File

@ -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)

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{include file="field_input.tpl" field=$sitename}}
{{include file="field_select.tpl" field=$server_role}}
{{include file="field_textarea.tpl" field=$banner}}
{{include file="field_textarea.tpl" field=$admininfo}}
{{include file="field_select.tpl" field=$language}}

View File

@ -1,13 +1,14 @@
<div id="contact-block" class="widget">
<h3>{{$contacts}}</h3>
{{if $micropro}}
{{if $viewconnections}}
<a class="allcontact-link" href="viewconnections/{{$nickname}}">{{$viewconnections}}</a>
{{/if}}
<div class='contact-block-content'>
{{foreach $micropro as $m}}
{{$m}}
{{/foreach}}
</div>
{{/if}}
<h3>{{$contacts}}</h3>
{{if $micropro}}
{{if $viewconnections}}
<a class="allcontact-link" href="viewconnections/{{$nickname}}">{{$viewconnections}}</a>
{{/if}}
<div class='contact-block-content'>
{{foreach $micropro as $m}}
{{$m}}
{{/foreach}}
</div>
{{/if}}
</div>
<div class="clear"></div>

View File

@ -1,22 +1,28 @@
<script>
var aside_padding_top;
var section_padding_top;
var coverSlid = false;
$(document).ready(function() {
aside_padding_top = parseInt($('aside').css('padding-top'));
section_padding_top = parseInt($('section').css('padding-top'));
$(document).on('click', slideUpCover);
if($('#cover-photo').length && $(window).width() > 755) {
$('.navbar-fixed-top').css('position', 'relative');
$('main').css('margin-top', - $('nav').outerHeight(true) + 'px');
$('aside').css('padding-top', aside_padding_top - $('nav').outerHeight() + 'px');
$('section').css('padding-top', section_padding_top - $('nav').outerHeight() + 'px');
$('main').css('opacity', 0);
$('header').hide();
if($(window).scrollTop() < $('#cover-photo').height()) {
$('main').css('margin-top', - $('nav').outerHeight(true) + 'px');
$('aside').css('padding-top', aside_padding_top - $('nav').outerHeight() + 'px');
$('section').css('padding-top', section_padding_top - $('nav').outerHeight() + 'px');
$('.navbar-fixed-top').css('position', 'relative');
$('main').css('opacity', 0);
$('header').hide();
}
}
else {
$('#cover-photo').remove();
coverSlid = true;
}
});
@ -26,10 +32,26 @@
$('main').css('opacity', 1);
$('aside').css('padding-top', aside_padding_top + 'px');
$('section').css('padding-top', section_padding_top + 'px');
$(window).scrollTop($(window).scrollTop() - $('#cover-photo').height())
$('.navbar-fixed-top').css('position', 'fixed');
$('.navbar-fixed-top').css('position', '');
$('main').css('margin-top', '');
$('#cover-photo').remove();
coverSlid = true;
}
else if ($('#cover-photo').length && $(window).width() > 755 && $(window).scrollTop() < $('#cover-photo').height()){
if(coverSlid) {
$(window).scrollTop(Math.ceil($('#cover-photo').height()));
setTimeout(function(){ coverSlid = false; }, 1000);
}
else {
if($(window).scrollTop() < $('#cover-photo').height()) {
$('main').css('margin-top', - $('nav').outerHeight(true) + 'px');
$('aside').css('padding-top', aside_padding_top - $('nav').outerHeight() + 'px');
$('section').css('padding-top', section_padding_top - $('nav').outerHeight() + 'px');
$('.navbar-fixed-top').css('position', 'relative');
$('main').css('opacity', 0);
$('header').hide();
}
}
}
if($('#cover-photo').length) {
$('main').css('opacity', ($(window).scrollTop()/$('#cover-photo').height()).toFixed(1));
@ -38,21 +60,26 @@
$(window).resize(function () {
if($('#cover-photo').length && $(window).width() < 755) {
$('#cover-photo').remove();
$('main').css('opacity', 1);
$('aside').css('padding-top', aside_padding_top + 'px');
$('section').css('padding-top', section_padding_top + 'px');
$('.navbar-fixed-top').css('position', 'fixed');
$('#cover-photo').remove();
$('.navbar-fixed-top').css('position', '');
coverSlid = true;
}
});
function slideUpCover() {
if(coverSlid) {
return;
}
$('html, body').animate({scrollTop: Math.ceil($('#cover-photo').height()) + 'px' });
return;
}
</script>
<div id="cover-photo" onclick="slideUpCover();" title="{{$hovertitle}}">
<div id="cover-photo" title="{{$hovertitle}}">
{{$photo_html}}
<div id="cover-photo-caption">
<div class="cover-photo-title">

View File

@ -19,7 +19,7 @@
{{include file="field_input.tpl" field=$adminmail}}
{{include file="field_input.tpl" field=$siteurl}}
{{include file="field_checkbox.tpl" field=$advanced}}
{{include file="field_select.tpl" field=$server_role}}
{{include file="field_select_grouped.tpl" field=$timezone}}