Merge remote-tracking branch 'upstream/dev' into wiki
This commit is contained in:
commit
83a42afddf
@ -5,18 +5,18 @@ namespace Zotlabs\Lib;
|
||||
|
||||
class AbConfig {
|
||||
|
||||
static public function Load($chash,$xhash) {
|
||||
$r = q("select * from abconfig where chan = '%s' and xchan = '%s'",
|
||||
dbesc($chash),
|
||||
static public function Load($chan,$xhash) {
|
||||
$r = q("select * from abconfig where chan = %d and xchan = '%s'",
|
||||
intval($chan),
|
||||
dbesc($xhash)
|
||||
);
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
static public function Get($chash,$xhash,$family,$key) {
|
||||
$r = q("select * from abconfig where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' limit 1",
|
||||
dbesc($chash),
|
||||
static public function Get($chan,$xhash,$family,$key) {
|
||||
$r = q("select * from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' limit 1",
|
||||
intval($chan),
|
||||
dbesc($xhash),
|
||||
dbesc($family),
|
||||
dbesc($key)
|
||||
@ -28,14 +28,14 @@ class AbConfig {
|
||||
}
|
||||
|
||||
|
||||
static public function Set($chash,$xhash,$family,$key,$value) {
|
||||
static public function Set($chan,$xhash,$family,$key,$value) {
|
||||
|
||||
$dbvalue = ((is_array($value)) ? serialize($value) : $value);
|
||||
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
|
||||
|
||||
if(self::Get($chash,$xhash,$family,$key) === false) {
|
||||
$r = q("insert into abconfig ( chan, xchan, cat, k, v ) values ( '%s', '%s', '%s', '%s', '%s' ) ",
|
||||
dbesc($chash),
|
||||
if(self::Get($chan,$xhash,$family,$key) === false) {
|
||||
$r = q("insert into abconfig ( chan, xchan, cat, k, v ) values ( %d, '%s', '%s', '%s', '%s' ) ",
|
||||
intval($chan),
|
||||
dbesc($xhash),
|
||||
dbesc($family),
|
||||
dbesc($key),
|
||||
@ -43,9 +43,9 @@ class AbConfig {
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("update abconfig set v = '%s' where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' ",
|
||||
$r = q("update abconfig set v = '%s' where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' ",
|
||||
dbesc($dbvalue),
|
||||
dbesc($chash),
|
||||
dbesc($chan),
|
||||
dbesc($xhash),
|
||||
dbesc($family),
|
||||
dbesc($key)
|
||||
@ -58,10 +58,10 @@ class AbConfig {
|
||||
}
|
||||
|
||||
|
||||
static public function Delete($chash,$xhash,$family,$key) {
|
||||
static public function Delete($chan,$xhash,$family,$key) {
|
||||
|
||||
$r = q("delete from abconfig where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' ",
|
||||
dbesc($chash),
|
||||
$r = q("delete from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' ",
|
||||
intval($chan),
|
||||
dbesc($xhash),
|
||||
dbesc($family),
|
||||
dbesc($key)
|
||||
@ -70,4 +70,4 @@ class AbConfig {
|
||||
return $r;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
46
Zotlabs/Lib/Cache.php
Normal file
46
Zotlabs/Lib/Cache.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php /** @file */
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
/**
|
||||
* cache api
|
||||
*/
|
||||
|
||||
class Cache {
|
||||
public static function get($key) {
|
||||
$r = q("SELECT v FROM cache WHERE k = '%s' limit 1",
|
||||
dbesc($key)
|
||||
);
|
||||
|
||||
if ($r)
|
||||
return $r[0]['v'];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function set($key,$value) {
|
||||
|
||||
$r = q("SELECT * FROM cache WHERE k = '%s' limit 1",
|
||||
dbesc($key)
|
||||
);
|
||||
if($r) {
|
||||
q("UPDATE cache SET v = '%s', updated = '%s' WHERE k = '%s'",
|
||||
dbesc($value),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($key));
|
||||
}
|
||||
else {
|
||||
q("INSERT INTO cache ( k, v, updated) VALUES ('%s','%s','%s')",
|
||||
dbesc($key),
|
||||
dbesc($value),
|
||||
dbesc(datetime_convert()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function clear() {
|
||||
q("DELETE FROM cache WHERE updated < '%s'",
|
||||
dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
|
||||
}
|
||||
|
||||
}
|
||||
|
112
Zotlabs/Lib/SuperCurl.php
Normal file
112
Zotlabs/Lib/SuperCurl.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
/**
|
||||
* @brief wrapper for z_fetch_url() which can be instantiated with several built-in parameters and
|
||||
* these can be modified and re-used. Useful for CalDAV and other processes which need to authenticate
|
||||
* and set lots of CURL options (many of which stay the same from one call to the next).
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
class SuperCurl {
|
||||
|
||||
|
||||
private $auth;
|
||||
private $url;
|
||||
|
||||
private $curlopt = array();
|
||||
|
||||
private $headers = null;
|
||||
public $filepos = 0;
|
||||
public $filehandle = 0;
|
||||
public $request_data = '';
|
||||
|
||||
private $request_method = 'GET';
|
||||
private $upload = false;
|
||||
|
||||
|
||||
private function set_data($s) {
|
||||
$this->request_data = $s;
|
||||
$this->filepos = 0;
|
||||
}
|
||||
|
||||
public function curl_read($ch,$fh,$size) {
|
||||
|
||||
if($this->filepos < 0) {
|
||||
unset($fh);
|
||||
return '';
|
||||
}
|
||||
|
||||
$s = substr($this->request_data,$this->filepos,$size);
|
||||
|
||||
if(strlen($s) < $size)
|
||||
$this->filepos = (-1);
|
||||
else
|
||||
$this->filepos = $this->filepos + $size;
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
public function __construct($opts = array()) {
|
||||
$this->set($opts);
|
||||
}
|
||||
|
||||
private function set($opts = array()) {
|
||||
if($opts) {
|
||||
foreach($opts as $k => $v) {
|
||||
switch($k) {
|
||||
case 'http_auth':
|
||||
$this->auth = $v;
|
||||
break;
|
||||
case 'custom':
|
||||
$this->request_method = $v;
|
||||
break;
|
||||
case 'url':
|
||||
$this->url = $v;
|
||||
break;
|
||||
case 'data':
|
||||
$this->set_data($v);
|
||||
if($v) {
|
||||
$this->upload = true;
|
||||
}
|
||||
else {
|
||||
$this->upload = false;
|
||||
}
|
||||
break;
|
||||
case 'headers':
|
||||
$this->headers = $v;
|
||||
break;
|
||||
default:
|
||||
$this->curlopts[$k] = $v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function exec() {
|
||||
$opts = $this->curlopts;
|
||||
if($this->auth)
|
||||
$opts['http_auth'] = $this->auth;
|
||||
if($this->custom)
|
||||
$opts['custom'] = $this->custom;
|
||||
if($this->headers)
|
||||
$opts['headers'] = $this->headers;
|
||||
if($this->upload) {
|
||||
$opts['upload'] = true;
|
||||
$opts['infile'] = $this->filehandle;
|
||||
$opts['infilesize'] = strlen($this->request_data);
|
||||
$opts['readfunc'] = [ $this, 'curl_read' ] ;
|
||||
}
|
||||
|
||||
$recurse = 0;
|
||||
return z_fetch_url($this->url,true,$recurse,(($opts) ? $opts : null));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -219,7 +219,7 @@ class Connedit extends \Zotlabs\Web\Controller {
|
||||
//Update profile photo permissions
|
||||
|
||||
logger('A new profile was assigned - updating profile photos');
|
||||
profile_photo_set_profile_perms($profile_id);
|
||||
profile_photo_set_profile_perms(local_channel(),$profile_id);
|
||||
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ class Connedit extends \Zotlabs\Web\Controller {
|
||||
unset($clone['abook_account']);
|
||||
unset($clone['abook_channel']);
|
||||
|
||||
$abconfig = load_abconfig($channel['channel_hash'],$clone['abook_xchan']);
|
||||
$abconfig = load_abconfig($channel['channel_id'],$clone['abook_xchan']);
|
||||
if($abconfig)
|
||||
$clone['abconfig'] = $abconfig;
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
|
||||
*
|
||||
*/
|
||||
|
||||
function post() {
|
||||
function post() {
|
||||
|
||||
if(! local_channel()) {
|
||||
return;
|
||||
@ -271,7 +271,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
|
||||
*/
|
||||
|
||||
|
||||
function get() {
|
||||
function get() {
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied.') . EOL );
|
||||
|
@ -43,7 +43,7 @@ class Follow extends \Zotlabs\Web\Controller {
|
||||
unset($clone['abook_account']);
|
||||
unset($clone['abook_channel']);
|
||||
|
||||
$abconfig = load_abconfig($channel['channel_hash'],$clone['abook_xchan']);
|
||||
$abconfig = load_abconfig($channel['channel_id'],$clone['abook_xchan']);
|
||||
if($abconfig)
|
||||
$clone['abconfig'] = $abconfig;
|
||||
|
||||
|
@ -389,8 +389,7 @@ class Import extends \Zotlabs\Web\Controller {
|
||||
if($abconfig) {
|
||||
// @fixme does not handle sync of del_abconfig
|
||||
foreach($abconfig as $abc) {
|
||||
if($abc['chan'] === $channel['channel_hash'])
|
||||
set_abconfig($abc['chan'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']);
|
||||
set_abconfig($channel['channel_id'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ class Pdledit extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
|
||||
function get() {
|
||||
function get() {
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
@ -32,18 +32,18 @@ class Pdledit extends \Zotlabs\Web\Controller {
|
||||
else {
|
||||
$o .= '<div class="generic-content-wrapper-styled">';
|
||||
$o .= '<h1>' . t('Edit System Page Description') . '</h1>';
|
||||
$files = glob('mod/*');
|
||||
$files = glob('Zotlabs/Module/*.php');
|
||||
if($files) {
|
||||
foreach($files as $f) {
|
||||
$name = basename($f,'.php');
|
||||
$name = lcfirst(basename($f,'.php'));
|
||||
$x = theme_include('mod_' . $name . '.pdl');
|
||||
if($x) {
|
||||
$o .= '<a href="pdledit/' . $name . '" >' . $name . '</a><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$o .= '</div>';
|
||||
|
||||
$o .= '</div>';
|
||||
|
||||
// list module pdl files
|
||||
return $o;
|
||||
|
@ -62,7 +62,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
||||
intval($uid),
|
||||
intval(PHOTO_PROFILE)
|
||||
);
|
||||
if(count($r)) {
|
||||
if($r) {
|
||||
$data = dbunescbin($r[0]['content']);
|
||||
$mimetype = $r[0]['mimetype'];
|
||||
}
|
||||
@ -79,7 +79,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
||||
* Other photos
|
||||
*/
|
||||
|
||||
/* Check for a cookie to indicate display pixel density, in order to detect high-resolution
|
||||
/* Check for a cookie to indicate display pixel density, in order to detect high-resolution
|
||||
displays. This procedure was derived from the "Retina Images" by Jeremey Worboys,
|
||||
used in accordance with the Creative Commons Attribution 3.0 Unported License.
|
||||
Project link: https://github.com/Retina-Images/Retina-Images
|
||||
|
@ -23,12 +23,11 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
|
||||
/* @brief Initalize the profile-photo edit view
|
||||
*
|
||||
* @param $a Current application
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
function init() {
|
||||
function init() {
|
||||
|
||||
if(! local_channel()) {
|
||||
return;
|
||||
@ -46,7 +45,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
*
|
||||
*/
|
||||
|
||||
function post() {
|
||||
function post() {
|
||||
|
||||
if(! local_channel()) {
|
||||
return;
|
||||
@ -54,24 +53,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
|
||||
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
|
||||
|
||||
if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
|
||||
|
||||
// unless proven otherwise
|
||||
$is_default_profile = 1;
|
||||
|
||||
if($_REQUEST['profile']) {
|
||||
$r = q("select id, profile_guid, is_default, gender from profile where id = %d and uid = %d limit 1",
|
||||
intval($_REQUEST['profile']),
|
||||
intval(local_channel())
|
||||
);
|
||||
if($r) {
|
||||
$profile = $r[0];
|
||||
if(! intval($profile['is_default']))
|
||||
$is_default_profile = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if((array_key_exists('postfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) {
|
||||
|
||||
// phase 2 - we have finished cropping
|
||||
|
||||
@ -86,7 +68,23 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
$scale = substr($image_id,-1,1);
|
||||
$image_id = substr($image_id,0,-2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// unless proven otherwise
|
||||
$is_default_profile = 1;
|
||||
|
||||
if($_REQUEST['profile']) {
|
||||
$r = q("select id, profile_guid, is_default, gender from profile where id = %d and uid = %d limit 1",
|
||||
intval($_REQUEST['profile']),
|
||||
intval(local_channel())
|
||||
);
|
||||
if($r) {
|
||||
$profile = $r[0];
|
||||
if(! intval($profile['is_default']))
|
||||
$is_default_profile = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$srcX = $_POST['xstart'];
|
||||
$srcY = $_POST['ystart'];
|
||||
@ -110,30 +108,38 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
|
||||
$aid = get_account_id();
|
||||
|
||||
$p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'],
|
||||
'filename' => $base_image['filename'], 'album' => t('Profile Photos'));
|
||||
$p = [
|
||||
'aid' => $aid,
|
||||
'uid' => local_channel(),
|
||||
'resource_id' => $base_image['resource_id'],
|
||||
'filename' => $base_image['filename'],
|
||||
'album' => t('Profile Photos')
|
||||
];
|
||||
|
||||
$p['imgscale'] = 4;
|
||||
$p['imgscale'] = PHOTO_RES_PROFILE_300;
|
||||
$p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL);
|
||||
|
||||
$r1 = $im->save($p);
|
||||
|
||||
$im->scaleImage(80);
|
||||
$p['imgscale'] = 5;
|
||||
$p['imgscale'] = PHOTO_RES_PROFILE_80;
|
||||
|
||||
$r2 = $im->save($p);
|
||||
|
||||
$im->scaleImage(48);
|
||||
$p['imgscale'] = 6;
|
||||
$p['imgscale'] = PHOTO_RES_PROFILE_48;
|
||||
|
||||
$r3 = $im->save($p);
|
||||
|
||||
if($r1 === false || $r2 === false || $r3 === false) {
|
||||
// if one failed, delete them all so we can start over.
|
||||
notice( t('Image resize failed.') . EOL );
|
||||
$x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale >= 4 ",
|
||||
$x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale in ( %d, %d, %d ) ",
|
||||
dbesc($base_image['resource_id']),
|
||||
local_channel()
|
||||
local_channel(),
|
||||
intval(PHOTO_RES_PROFILE_300),
|
||||
intval(PHOTO_RES_PROFILE_80),
|
||||
intval(PHOTO_RES_PROFILE_48)
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -183,10 +189,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
|
||||
// Now copy profile-permissions to pictures, to prevent privacyleaks by automatically created folder 'Profile Pictures'
|
||||
|
||||
profile_photo_set_profile_perms($_REQUEST['profile']);
|
||||
|
||||
|
||||
|
||||
profile_photo_set_profile_perms(local_channel(),$_REQUEST['profile']);
|
||||
}
|
||||
else
|
||||
notice( t('Unable to process image') . EOL);
|
||||
@ -196,7 +199,9 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
||||
// A new photo was uploaded. Store it and save some important details
|
||||
// in App::$data for use in the cropping function
|
||||
|
||||
|
||||
$hash = photo_new_resource();
|
||||
$smallest = 0;
|
||||
@ -220,7 +225,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
$os_storage = false;
|
||||
|
||||
foreach($i as $ii) {
|
||||
if(intval($ii['imgscale']) < 2) {
|
||||
if(intval($ii['imgscale']) < PHOTO_RES_640) {
|
||||
$smallest = intval($ii['imgscale']);
|
||||
$os_storage = intval($ii['os_storage']);
|
||||
$imagedata = $ii['content'];
|
||||
@ -238,7 +243,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
return $this->profile_photo_crop_ui_head($a, $ph, $hash, $smallest);
|
||||
|
||||
|
||||
// This will "fall through" to the get() method, and since
|
||||
// App::$data['imagecrop'] is set, it will proceed to cropping
|
||||
// rather than present the upload form
|
||||
}
|
||||
|
||||
|
||||
@ -269,11 +277,19 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
notice( t('Permission denied.') . EOL );
|
||||
return;
|
||||
};
|
||||
|
||||
// check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
|
||||
|
||||
|
||||
$resource_id = argv(2);
|
||||
|
||||
// When using an existing photo, we don't have a dialogue to offer a choice of profiles,
|
||||
// so it gets attached to the default
|
||||
|
||||
$p = q("select id from profile where is_default = 1 and uid = %d",
|
||||
intval(local_channel())
|
||||
);
|
||||
if($p) {
|
||||
$_REQUEST['profile'] = $p[0]['id'];
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
|
||||
intval(local_channel()),
|
||||
@ -285,11 +301,11 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
$havescale = false;
|
||||
foreach($r as $rr) {
|
||||
if($rr['imgscale'] == 5)
|
||||
if($rr['imgscale'] == PHOTO_RES_PROFILE_80)
|
||||
$havescale = true;
|
||||
}
|
||||
|
||||
// set an already loaded photo as profile photo
|
||||
// set an already loaded and cropped photo as profile photo
|
||||
|
||||
if(($r[0]['album'] == t('Profile Photos')) && ($havescale)) {
|
||||
// unset any existing profile photos
|
||||
@ -310,7 +326,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
dbesc($channel['xchan_hash'])
|
||||
);
|
||||
|
||||
profile_photo_set_profile_perms(); //Reset default photo permissions to public
|
||||
profile_photo_set_profile_perms(local_channel()); // Reset default photo permissions to public
|
||||
\Zotlabs\Daemon\Master::Summon(array('Directory',local_channel()));
|
||||
goaway(z_root() . '/profiles');
|
||||
}
|
||||
@ -342,17 +358,22 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
if($i) {
|
||||
$hash = $i[0]['resource_id'];
|
||||
foreach($i as $ii) {
|
||||
if(intval($ii['imgscale']) < 2) {
|
||||
if(intval($ii['imgscale']) < PHOTO_RES_640) {
|
||||
$smallest = intval($ii['imgscale']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
profile_photo_crop_ui_head($a, $ph, $hash, $smallest);
|
||||
$this->profile_photo_crop_ui_head($a, $ph, $hash, $smallest);
|
||||
|
||||
// falls through with App::$data['imagecrop'] set so we go straight to the cropping section
|
||||
}
|
||||
|
||||
$profiles = q("select id, profile_name as name, is_default from profile where uid = %d",
|
||||
|
||||
// present an upload form
|
||||
|
||||
$profiles = q("select id, profile_name as name, is_default from profile where uid = %d order by id asc",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
@ -379,6 +400,9 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
return $o;
|
||||
}
|
||||
else {
|
||||
|
||||
// present a cropping form
|
||||
|
||||
$filename = \App::$data['imagecrop'] . '-' . \App::$data['imagecrop_resolution'];
|
||||
$resolution = \App::$data['imagecrop_resolution'];
|
||||
$tpl = get_markup_template("cropbody.tpl");
|
||||
@ -416,13 +440,13 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
if($max_length > 0)
|
||||
$ph->scaleImage($max_length);
|
||||
|
||||
$width = $ph->getWidth();
|
||||
$height = $ph->getHeight();
|
||||
\App::$data['width'] = $ph->getWidth();
|
||||
\App::$data['height'] = $ph->getHeight();
|
||||
|
||||
if($width < 500 || $height < 500) {
|
||||
if(\App::$data['width'] < 500 || \App::$data['height'] < 500) {
|
||||
$ph->scaleImageUp(400);
|
||||
$width = $ph->getWidth();
|
||||
$height = $ph->getHeight();
|
||||
\App::$data['width'] = $ph->getWidth();
|
||||
\App::$data['height'] = $ph->getHeight();
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
|
||||
//Time to update the permissions on the profile-pictures as well
|
||||
|
||||
profile_photo_set_profile_perms($profile['id']);
|
||||
profile_photo_set_profile_perms(local_channel(),$profile['id']);
|
||||
|
||||
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = '%s'",
|
||||
intval(local_channel()),
|
||||
|
@ -45,7 +45,6 @@ class CalDAVClient {
|
||||
}
|
||||
|
||||
private function set_data($s) {
|
||||
logger('set data called');
|
||||
$this->request_data = $s;
|
||||
$this->filepos = 0;
|
||||
}
|
||||
|
3
boot.php
3
boot.php
@ -34,7 +34,6 @@ require_once('include/text.php');
|
||||
require_once('include/datetime.php');
|
||||
require_once('include/language.php');
|
||||
require_once('include/nav.php');
|
||||
require_once('include/cache.php');
|
||||
require_once('include/permissions.php');
|
||||
require_once('library/Mobile_Detect/Mobile_Detect.php');
|
||||
require_once('include/features.php');
|
||||
@ -48,7 +47,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
|
||||
define ( 'STD_VERSION', '1.9' );
|
||||
define ( 'ZOT_REVISION', '1.1' );
|
||||
|
||||
define ( 'DB_UPDATE_VERSION', 1178 );
|
||||
define ( 'DB_UPDATE_VERSION', 1179 );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,15 +1,15 @@
|
||||
[h2]Documentation for Hub Administrators[/h2]
|
||||
|
||||
[h3]Administrators[/h3]
|
||||
|
||||
[h3]Deploying your hub[/h3]
|
||||
[zrl=[baseurl]/help/install]Install[/zrl]
|
||||
[zrl=[baseurl]/help/red2pi]Installing $Projectname on the Raspberry Pi[/zrl]
|
||||
[zrl=[baseurl]/help/Hubzilla_on_OpenShift]$Projectname on OpenShift[/zrl]
|
||||
[h3]Taking care of your hub[/h3]
|
||||
[zrl=[baseurl]/help/troubleshooting]Troubleshooting Tips[/zrl]
|
||||
[zrl=[baseurl]/help/theme_management]Theme Management[/zrl]
|
||||
[zrl=[baseurl]/help/hidden_configs]Tweaking $Projectname's Hidden Configurations[/zrl]
|
||||
[zrl=[baseurl]/help/faq_admins]FAQ For Admins[/zrl]
|
||||
[zrl=[baseurl]/help/service_classes]Service Classes[/zrl]
|
||||
[zrl=[baseurl]/help/directories]Working with and configuring Directories[/zrl]
|
||||
[zrl=[baseurl]/help/theme_management]Theme Management[/zrl]
|
||||
|
||||
[h3]Frequently asked questions[/h3]
|
||||
[zrl=[baseurl]/help/faq_admins]FAQ For Admins[/zrl]
|
||||
|
||||
#include doc/macros/main_footer.bb;
|
||||
|
@ -1,19 +1,23 @@
|
||||
[b]Channels[/b]
|
||||
[h2]Channels[/h2]
|
||||
|
||||
[h3]What are channels?[/h3]
|
||||
|
||||
Channels are simply collections of content stored in one place. A channel can represent anything. It could represent you, a website, a forum, photo albums, anything. For most people, their first channel with be "Me".
|
||||
|
||||
The most important features for a channel that represents "me" are:
|
||||
[ul]
|
||||
[*]Secure and private "spam free" communications
|
||||
|
||||
Secure and private "spam free" communications
|
||||
[*]Identity and "single-signon" across the entire network
|
||||
|
||||
Identity and "single-signon" across the entire network
|
||||
|
||||
Privacy controls and permissions which extend to the entire network
|
||||
|
||||
Directory services (like a phone book)
|
||||
[*]Privacy controls and permissions which extend to the entire network
|
||||
|
||||
[*]Directory services (like a phone book)
|
||||
[/ul]
|
||||
In short, a channel that represents yourself is "me, on the internet".
|
||||
|
||||
[h3]Creating channels[/h3]
|
||||
|
||||
You will be required to create your first channel as part of the sign up process. You can also create additonal channels from the "Select channel" link.
|
||||
|
||||
You will be asked to provide a channel name, and a short nick name. For a channel that represents yourself, it is a good idea to use your real name here to ensure your friends can find you, and connect to your channel. The short nickname will be used to generate a "webbie". This is a bit like a username, and will look like an email address, taking the form nickname@domain. You should put a little thought into what you want to use here. Imagine somebody asking for your webbie and having to tell them it is "llamas-are_kewl.123". "llamasarecool" would be a much better choice.
|
||||
@ -22,9 +26,14 @@ Once you have created your channel, you will be taken to the settings page, wher
|
||||
|
||||
Once you have done this, your channel is ready to use. At [observer=1][observer.url][/observer][observer=0]example.com/channel/username[/observer] you will find your channel "stream". This is where your recent activity will appear, in reverse chronological order. If you post in the box marked "share", the entry will appear at the top of your stream. You will also find links to all the other communication areas for this channel here. The "About" tab contains your "profile", the photos page contain photo albums, and the events page contains events share by both yourself and your contacts.
|
||||
|
||||
[h3]The grid, permissions and delegation[/h3]
|
||||
|
||||
The "Grid" page contains all recent posts from across the $Projectname network, again in reverse chronologial order. The exact posts that appear here depend largely on your permissions. At their most permissive, you will receive posts from complete strangers. At the other end of the scale, you may see posts from only your friends - or if you're feeling really anti-social, only your own posts.
|
||||
|
||||
As mentioned at the start, many other kinds of channel are possible, however, the creation procedure is the same. The difference between channels lies primarily in the permissions assigned. For example, a channel for sharing documents with colleagues at work would probably want more permissive settings for "Can write to my "public" file storage" than a personal account. For more information, see the permissions section.
|
||||
As mentioned at the start, many other kinds of channel are possible, however, the creation procedure is the same. The difference between channels lies primarily in the permissions assigned. For example, a channel for sharing documents with colleagues at work would probably want more permissive settings for "Can write to my "public" file storage" than a personal account. For more information, see the [zrl=[baseurl]/help/roles]permissions section[/zrl].
|
||||
|
||||
You can also delegate control of your channels' posts and connections, but not its configurations, to another channel. That is done by editing a connection and assigning it the permission to administer your channel's resources.
|
||||
|
||||
#include doc/macros/main_footer.bb;
|
||||
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
[b]External Resource Links[/b]
|
||||
|
||||
[b][color= grey][size=24]External Links[/size][/color][/b]
|
||||
[b]Third-Party Themes[/b]
|
||||
|
||||
[h2]External resource links[/h2]
|
||||
[h3]Third-Party Themes[/h3]
|
||||
[ul]
|
||||
[*][url=https://github.com/omigeot/redstrap3]Redstrap[/url]
|
||||
[*][url=https://bitbucket.org/tobiasd/red-clean]Clean[/url]
|
||||
[*][url=https://github.com/tonybaldwin/redmatrixthemes/]nubasic[/url]
|
||||
[*][url=https://github.com/deadsuperhero/redmatrix-themes]Sean Tilley's themes[/url]
|
||||
|
||||
[b]Third-Party Addons[/b]
|
||||
[/ul]
|
||||
[h3]Third-Party addons[/h3]
|
||||
[ul]
|
||||
[*][url=https://abcentric.net/git/abcjsplugin.git]ABCjs integration - display scores in posts (WIP)[/url]
|
||||
[b]Related Projects[/b]
|
||||
|
||||
[/ul]
|
||||
[h3]Related projects[/h3]
|
||||
[ul]
|
||||
[*][url=https://addons.mozilla.org/en-US/firefox/addon/redshare/]Redshare for Firefox[/url]
|
||||
[*][url=https://github.com/cvogeley/red-for-android]Red for Android[/url]
|
||||
[*][url=https://github.com/zzottel/feed2red]feed2red.pl (posts Atom/RSS feeds to channel)[/url]
|
||||
[*][url=https://wordpress.org/plugins/hubzilla-wp/]WordPress gateway (combine with wppost addon for full features)[/url]
|
||||
[/ul]
|
||||
|
||||
#include doc/macros/main_footer.bb;
|
||||
|
@ -1,20 +1,16 @@
|
||||
|
||||
[h2]Project/Site Information[/h2]
|
||||
|
||||
[h2]Project and site information[/h2]
|
||||
[h3]$Projectname[/h3]
|
||||
[zrl=[baseurl]/help/Privacy]Privacy Policy[/zrl]
|
||||
|
||||
[zrl=[baseurl]/help/history]$Projectname history[/zrl]
|
||||
|
||||
[h3]External Resources[/h3]
|
||||
[zrl=[baseurl]/help/external-resource-links]External Resource Links[/zrl]
|
||||
|
||||
[h3]External resources[/h3]
|
||||
[zrl=[baseurl]/help/external-resource-links]List of external resources[/zrl]
|
||||
[url=https://github.com/redmatrix/hubzilla]Main Website[/url]
|
||||
[url=https://github.com/redmatrix/hubzilla-addons]Addon Website[/url]
|
||||
|
||||
[url=[baseurl]/help/credits]$Projectname Credits[/url]
|
||||
|
||||
[h3]About This $Projectname Hub[/h3]
|
||||
[h3]About this $Projectname hub[/h3]
|
||||
[zrl=[baseurl]/help/TermsOfService]Terms of Service For This Hub[/zrl]
|
||||
[zrl=[baseurl]/siteinfo]Hub Information (/siteinfo)[/zrl]
|
||||
[zrl=[baseurl]/siteinfo/json]Detailed Technical Hub Information in JSON format(/siteinfo/json)[/zrl]
|
||||
|
||||
#include doc/macros/main_footer.bb;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
[h2]Documentation for Hub Members[/h2]
|
||||
|
||||
[h3]Getting Started[/h3]
|
||||
[h2]Documentation for hub members[/h2]
|
||||
[h3]Getting started[/h3]
|
||||
[zrl=[baseurl]/help/registration]Account Registration[/zrl]
|
||||
[zrl=[baseurl]/help/accounts_profiles_channels_basics]You at $Projectname: accounts, profiles and channels in short[/zrl]
|
||||
[zrl=[baseurl]/help/profiles]Profiles[/zrl]
|
||||
@ -11,8 +10,7 @@
|
||||
[zrl=[baseurl]/help/permissions]Permissions And Encryption: You Are In Control[/zrl]
|
||||
[zrl=[baseurl]/help/cloud]Cloud Storage[/zrl]
|
||||
[zrl=[baseurl]/help/remove_account]Remove Channel or Account[/zrl]
|
||||
|
||||
[h3]Members Help[/h3]
|
||||
[h3]Members help[/h3]
|
||||
[zrl=[baseurl]/help/tags_and_mentions]Tags and Mentions[/zrl]
|
||||
[zrl=[baseurl]/help/webpages]Web Pages[/zrl]
|
||||
[zrl=[baseurl]/help/bbcode]BBcode reference for posts and comments[/zrl]
|
||||
@ -23,3 +21,5 @@
|
||||
[zrl=[baseurl]/help/diaspora_compat]Diaspora Communications Compatibility (Diaspora and Friendica)[/zrl]
|
||||
[zrl=[baseurl]/help/faq_members]FAQ For Members[/zrl]
|
||||
[zrl=[baseurl]/help/bugs]Bugs, Issues, and things that go bump in the night...[/zrl]
|
||||
|
||||
#include doc/macros/main_footer.bb;
|
||||
|
@ -1,6 +1,4 @@
|
||||
[b]Troubleshooting[/b]
|
||||
|
||||
[li][zrl=[baseurl]/help/problems-following-an-update]Problems following an update[/zrl][/li]
|
||||
[h2]Troubleshooting[/h2]
|
||||
|
||||
When reporting issues, please try to provide as much detail as may be necessary for developers to reproduce the issue and provide the complete text of all error messages.
|
||||
|
||||
@ -13,9 +11,12 @@ In the case of "500" errors, the issues may often be logged in your webserver lo
|
||||
|
||||
We encourage you to try to the best of your abilities to use these logs combined with the source code in your possession to troubleshoot issues and find their cause. The community is often able to help, but only you have access to your site logfiles and it is considered a security risk to share them.
|
||||
|
||||
|
||||
If a code issue has been uncovered, please report it on the project bugtracker (https://github.com/redmatrix/hubzilla/issues). Again provide as much detail as possible to avoid us going back and forth asking questions about your configuration or how to duplicate the problem, so that we can get right to the problem and figure out what to do about it. You are also welcome to offer your own solutions and submit patches. In fact we encourage this as we are all volunteers and have little spare time available. The more people that help, the easier the workload for everybody. It's OK if your solution isn't perfect. Every little bit helps and perhaps we can improve on it.
|
||||
|
||||
#include doc/macros/troubleshooting_footer.bb;
|
||||
[h3]Troubleshooting updates[/h3]
|
||||
[ul]
|
||||
[li][zrl=[baseurl]/help/problems-following-an-update]Problems following an update[/zrl][/li]
|
||||
[/ul]
|
||||
|
||||
#include doc/macros/main_footer.bb;
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
<?php /** @file */
|
||||
|
||||
/**
|
||||
* cache api
|
||||
*/
|
||||
|
||||
class Cache {
|
||||
public static function get($key){
|
||||
$r = q("SELECT v FROM cache WHERE k = '%s' limit 1",
|
||||
dbesc($key)
|
||||
);
|
||||
|
||||
if ($r)
|
||||
return $r[0]['v'];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function set($key,$value) {
|
||||
|
||||
$r = q("SELECT * FROM cache WHERE k = '%s' limit 1",
|
||||
dbesc($key)
|
||||
);
|
||||
if($r) {
|
||||
q("UPDATE cache SET v = '%s', updated = '%s' WHERE k = '%s'",
|
||||
dbesc($value),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($key));
|
||||
}
|
||||
else {
|
||||
q("INSERT INTO cache ( k, v, updated) VALUES ('%s','%s','%s')",
|
||||
dbesc($key),
|
||||
dbesc($value),
|
||||
dbesc(datetime_convert()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function clear(){
|
||||
q("DELETE FROM cache WHERE updated < '%s'",
|
||||
dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ function identity_basic_export($channel_id, $items = false) {
|
||||
|
||||
for($x = 0; $x < count($ret['abook']); $x ++) {
|
||||
$xchans[] = $ret['abook'][$x]['abook_chan'];
|
||||
$abconfig = load_abconfig($ret['channel']['channel_hash'],$ret['abook'][$x]['abook_xchan']);
|
||||
$abconfig = load_abconfig($channel_id,$ret['abook'][$x]['abook_xchan']);
|
||||
if($abconfig)
|
||||
$ret['abook'][$x]['abconfig'] = $abconfig;
|
||||
}
|
||||
@ -862,7 +862,7 @@ function profile_load(&$a, $nickname, $profile = '') {
|
||||
);
|
||||
if($z) {
|
||||
$p[0]['picdate'] = $z[0]['xchan_photo_date'];
|
||||
$p[0]['reddress'] = str_replace('@','@',$z[0]['xchan_addr']);
|
||||
$p[0]['reddress'] = str_replace('@','@',$z[0]['xchan_addr']);
|
||||
}
|
||||
|
||||
// fetch user tags if this isn't the default profile
|
||||
|
@ -98,20 +98,20 @@ function del_aconfig($account_id, $family, $key) {
|
||||
}
|
||||
|
||||
|
||||
function load_abconfig($chash,$xhash) {
|
||||
Zlib\AbConfig::Load($chash,$xhash);
|
||||
function load_abconfig($chan,$xhash) {
|
||||
Zlib\AbConfig::Load($chan,$xhash);
|
||||
}
|
||||
|
||||
function get_abconfig($chash,$xhash,$family,$key) {
|
||||
return Zlib\AbConfig::Get($chash,$xhash,$family,$key);
|
||||
function get_abconfig($chan,$xhash,$family,$key) {
|
||||
return Zlib\AbConfig::Get($chan,$xhash,$family,$key);
|
||||
}
|
||||
|
||||
function set_abconfig($chash,$xhash,$family,$key,$value) {
|
||||
return Zlib\AbConfig::Set($chash,$xhash,$family,$key,$value);
|
||||
function set_abconfig($chan,$xhash,$family,$key,$value) {
|
||||
return Zlib\AbConfig::Set($chan,$xhash,$family,$key,$value);
|
||||
}
|
||||
|
||||
function del_abconfig($chash,$xhash,$family,$key) {
|
||||
return Zlib\AbConfig::Delete($chash,$xhash,$family,$key);
|
||||
function del_abconfig($chan,$xhash,$family,$key) {
|
||||
return Zlib\AbConfig::Delete($chan,$xhash,$family,$key);
|
||||
}
|
||||
|
||||
function load_iconfig(&$item) {
|
||||
|
@ -90,7 +90,7 @@ abstract class dba_driver {
|
||||
protected $db;
|
||||
protected $pdo = array();
|
||||
|
||||
public $debug = 0;
|
||||
public $debug = 0;
|
||||
public $connected = false;
|
||||
public $error = false;
|
||||
|
||||
@ -332,6 +332,9 @@ function q($sql) {
|
||||
else
|
||||
db_logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true),LOGGER_NORMAL,LOG_CRIT);
|
||||
}
|
||||
if(\DBA::$dba->debug)
|
||||
db_logger('Sql: ' . $stmt, LOGGER_DEBUG, LOG_INFO);
|
||||
|
||||
return \DBA::$dba->q($stmt);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php /** @file */
|
||||
|
||||
|
||||
use Zotlabs\Lib as Zlib;
|
||||
|
||||
function oembed_replacecb($matches){
|
||||
|
||||
$embedurl=$matches[1];
|
||||
@ -25,12 +27,6 @@ function oembed_action($embedurl) {
|
||||
|
||||
logger('oembed_action: ' . $embedurl, LOGGER_DEBUG, LOG_INFO);
|
||||
|
||||
// These media files should now be caught in bbcode.php
|
||||
// left here as a fallback in case this is called from another source
|
||||
|
||||
$noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm","opus");
|
||||
$ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
|
||||
|
||||
if(strpos($embedurl,'http://') === 0) {
|
||||
if(intval(get_config('system','embed_sslonly'))) {
|
||||
$action = 'block';
|
||||
@ -119,18 +115,23 @@ function oembed_fetch_url($embedurl){
|
||||
// These media files should now be caught in bbcode.php
|
||||
// left here as a fallback in case this is called from another source
|
||||
|
||||
$noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm","opus");
|
||||
$ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
|
||||
$noexts = array(".mp3",".mp4",".ogg",".ogv",".oga",".ogm",".webm",".opus");
|
||||
|
||||
$result = oembed_action($embedurl);
|
||||
|
||||
$embedurl = $result['url'];
|
||||
$action = $result['action'];
|
||||
|
||||
foreach($noexts as $ext) {
|
||||
if(strpos(strtolower($embedurl),$ext) !== false) {
|
||||
$action = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
$txt = null;
|
||||
|
||||
if($action !== 'block') {
|
||||
$txt = Cache::get(App::$videowidth . $embedurl);
|
||||
$txt = Zlib\Cache::get('[' . App::$videowidth . '] ' . $embedurl);
|
||||
|
||||
if(strstr($txt,'youtu') && strstr(z_root(),'https:')) {
|
||||
$txt = str_replace('http:','https:',$txt);
|
||||
@ -151,7 +152,7 @@ function oembed_fetch_url($embedurl){
|
||||
}
|
||||
|
||||
|
||||
if (! in_array($ext, $noexts) && $action !== 'block') {
|
||||
if ($action !== 'block') {
|
||||
// try oembed autodiscovery
|
||||
$redirects = 0;
|
||||
$result = z_fetch_url($furl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true ));
|
||||
@ -199,7 +200,7 @@ function oembed_fetch_url($embedurl){
|
||||
//save in cache
|
||||
|
||||
if(! get_config('system','oembed_cache_disable'))
|
||||
Cache::set(App::$videowidth . $embedurl,$txt);
|
||||
Zlib\Cache::set('[' . App::$videowidth . '] ' . $embedurl,$txt);
|
||||
|
||||
}
|
||||
|
||||
|
@ -707,40 +707,65 @@ function gps2Num($coordPart) {
|
||||
return floatval($parts[0]) / floatval($parts[1]);
|
||||
}
|
||||
|
||||
function profile_photo_set_profile_perms($profileid = '') {
|
||||
function profile_photo_set_profile_perms($uid, $profileid = 0) {
|
||||
|
||||
$allowcid = '';
|
||||
if (x($profileid)) {
|
||||
|
||||
$r = q("SELECT photo, profile_guid, id, is_default, uid FROM profile WHERE profile.id = %d OR profile.profile_guid = '%s' LIMIT 1", intval($profileid), dbesc($profileid));
|
||||
|
||||
} else {
|
||||
|
||||
if($profileid) {
|
||||
$r = q("SELECT photo, profile_guid, id, is_default, uid
|
||||
FROM profile WHERE uid = %d and ( profile.id = %d OR profile.profile_guid = '%s') LIMIT 1",
|
||||
intval($profileid),
|
||||
dbesc($profileid)
|
||||
);
|
||||
}
|
||||
else {
|
||||
logger('Resetting permissions on default-profile-photo for user'.local_channel());
|
||||
$r = q("SELECT photo, profile_guid, id, is_default, uid FROM profile WHERE profile.uid = %d AND is_default = 1 LIMIT 1", intval(local_channel()) ); //If no profile is given, we update the default profile
|
||||
|
||||
$r = q("SELECT photo, profile_guid, id, is_default, uid FROM profile
|
||||
WHERE profile.uid = %d AND is_default = 1 LIMIT 1",
|
||||
intval($uid)
|
||||
); //If no profile is given, we update the default profile
|
||||
}
|
||||
if(! $r)
|
||||
return;
|
||||
|
||||
$profile = $r[0];
|
||||
if(x($profile['id']) && x($profile['photo'])) {
|
||||
preg_match("@\w*(?=-\d*$)@i", $profile['photo'], $resource_id);
|
||||
$resource_id = $resource_id[0];
|
||||
|
||||
if($profile['id'] && $profile['photo']) {
|
||||
preg_match("@\w*(?=-\d*$)@i", $profile['photo'], $resource_id);
|
||||
$resource_id = $resource_id[0];
|
||||
|
||||
if (intval($profile['is_default']) != 1) {
|
||||
$r0 = q("SELECT channel_hash FROM channel WHERE channel_id = %d LIMIT 1", intval(local_channel()) );
|
||||
$r1 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = '%d' ", intval($profile['id'])); //Should not be needed in future. Catches old int-profile-ids.
|
||||
$r2 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = '%s'", dbesc($profile['profile_guid']));
|
||||
if (! intval($profile['is_default'])) {
|
||||
$r0 = q("SELECT channel_hash FROM channel WHERE channel_id = %d LIMIT 1",
|
||||
intval($uid)
|
||||
);
|
||||
//Should not be needed in future. Catches old int-profile-ids.
|
||||
$r1 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = '%d' ",
|
||||
intval($profile['id'])
|
||||
);
|
||||
$r2 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = '%s'",
|
||||
dbesc($profile['profile_guid'])
|
||||
);
|
||||
$allowcid = "<" . $r0[0]['channel_hash'] . ">";
|
||||
foreach ($r1 as $entry) {
|
||||
$allowcid .= "<" . $entry['abook_xchan'] . ">";
|
||||
}
|
||||
foreach ($r2 as $entry) {
|
||||
$allowcid .= "<" . $entry['abook_xchan'] . ">";
|
||||
}
|
||||
$allowcid .= "<" . $entry['abook_xchan'] . ">";
|
||||
}
|
||||
|
||||
q("UPDATE `photo` SET allow_cid = '%s' WHERE resource_id = '%s' AND uid = %d",dbesc($allowcid),dbesc($resource_id),intval($profile['uid']));
|
||||
q("UPDATE photo SET allow_cid = '%s' WHERE resource_id = '%s' AND uid = %d",
|
||||
dbesc($allowcid),
|
||||
dbesc($resource_id),
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
} else {
|
||||
q("UPDATE `photo` SET allow_cid = '' WHERE profile = 1 AND uid = %d",intval($profile['uid'])); //Reset permissions on default profile picture to public
|
||||
}
|
||||
else {
|
||||
//Reset permissions on default profile picture to public
|
||||
q("UPDATE photo SET allow_cid = '' WHERE photo_usage = %d AND uid = %d",
|
||||
intval(PHOTO_PROFILE),
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,30 +376,6 @@ function unxmlify($s) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper, reverse the operation "bin2hex"
|
||||
* This is a built-in function in php >= 5.4
|
||||
*
|
||||
* @FIXME We already have php >= 5.4 requirements, so can we remove this?
|
||||
*/
|
||||
if(! function_exists('hex2bin')) {
|
||||
function hex2bin($s) {
|
||||
if(! (is_string($s) && strlen($s)))
|
||||
return '';
|
||||
|
||||
if(strlen($s) & 1) {
|
||||
logger('hex2bin: illegal hex string: ' . $s);
|
||||
return $s;
|
||||
}
|
||||
|
||||
if(! ctype_xdigit($s)) {
|
||||
return($s);
|
||||
}
|
||||
|
||||
return(pack("H*",$s));
|
||||
}}
|
||||
|
||||
|
||||
// Automatic pagination.
|
||||
// To use, get the count of total items.
|
||||
// Then call App::set_pager_total($number_items);
|
||||
@ -1283,7 +1259,7 @@ function normalise_link($url) {
|
||||
* is https and the other isn't, or if one is www.something and the other
|
||||
* isn't - and also ignore case differences.
|
||||
*
|
||||
* @see normalis_link()
|
||||
* @see normalise_link()
|
||||
*
|
||||
* @param string $a
|
||||
* @param string $b
|
||||
@ -1635,7 +1611,7 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
|
||||
|
||||
function create_export_photo_body(&$item) {
|
||||
if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) {
|
||||
$j = json_decode($item['object'],true);
|
||||
$j = json_decode($item['obj'],true);
|
||||
if($j) {
|
||||
$item['body'] .= "\n\n" . (($j['body']) ? $j['body'] : $j['bbcode']);
|
||||
$item['sig'] = '';
|
||||
@ -2089,9 +2065,9 @@ function xchan_query(&$items,$abook = true,$effective_uid = 0) {
|
||||
}
|
||||
|
||||
foreach($items as $item) {
|
||||
if($item['owner_xchan'] && (! in_array($item['owner_xchan'],$arr)))
|
||||
if($item['owner_xchan'] && (! in_array("'" . dbesc($item['owner_xchan']) . "'",$arr)))
|
||||
$arr[] = "'" . dbesc($item['owner_xchan']) . "'";
|
||||
if($item['author_xchan'] && (! in_array($item['author_xchan'],$arr)))
|
||||
if($item['author_xchan'] && (! in_array("'" . dbesc($item['author_xchan']) . "'",$arr)))
|
||||
$arr[] = "'" . dbesc($item['author_xchan']) . "'";
|
||||
}
|
||||
}
|
||||
@ -2124,9 +2100,9 @@ function xchan_mail_query(&$item) {
|
||||
$arr = array();
|
||||
$chans = null;
|
||||
if($item) {
|
||||
if($item['from_xchan'] && (! in_array($item['from_xchan'],$arr)))
|
||||
if($item['from_xchan'] && (! in_array("'" . dbesc($item['from_xchan']) . "'",$arr)))
|
||||
$arr[] = "'" . dbesc($item['from_xchan']) . "'";
|
||||
if($item['to_xchan'] && (! in_array($item['to_xchan'],$arr)))
|
||||
if($item['to_xchan'] && (! in_array("'" . dbesc($item['to_xchan']) . "'",$arr)))
|
||||
$arr[] = "'" . dbesc($item['to_xchan']) . "'";
|
||||
}
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ function widget_cover_photo($arr) {
|
||||
if(array_key_exists('subtitle', $arr) && isset($arr['subtitle']))
|
||||
$subtitle = $arr['subtitle'];
|
||||
else
|
||||
$subtitle = $channel['xchan_addr'];
|
||||
$subtitle = str_replace('@','@',$channel['xchan_addr']);
|
||||
|
||||
$c = get_cover_photo($channel_id,'html');
|
||||
|
||||
|
@ -552,7 +552,7 @@ function zot_refresh($them, $channel = null, $force = false) {
|
||||
unset($new_connection[0]['abook_account']);
|
||||
unset($new_connection[0]['abook_channel']);
|
||||
|
||||
$abconfig = load_abconfig($channel['channel_hash'],$new_connection['abook_xchan']);
|
||||
$abconfig = load_abconfig($channel['channel_id'],$new_connection['abook_xchan']);
|
||||
if($abconfig)
|
||||
$new_connection['abconfig'] = $abconfig;
|
||||
|
||||
@ -3335,8 +3335,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
|
||||
if($abconfig) {
|
||||
// @fixme does not handle sync of del_abconfig
|
||||
foreach($abconfig as $abc) {
|
||||
if($abc['chan'] === $channel['channel_hash'])
|
||||
set_abconfig($abc['chan'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']);
|
||||
set_abconfig($channel['channel_id'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `abconfig` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`chan` char(255) NOT NULL DEFAULT '',
|
||||
`chan` int(10) unsigned NOT NULL DEFAULT '',
|
||||
`xchan` char(255) NOT NULL DEFAULT '',
|
||||
`cat` char(255) NOT NULL DEFAULT '',
|
||||
`k` char(255) NOT NULL DEFAULT '',
|
||||
|
@ -1,6 +1,6 @@
|
||||
CREATE TABLE "abconfig" (
|
||||
"id" serial NOT NULL,
|
||||
"chan" text NOT NULL,
|
||||
"chan" bigint NOT NULL,
|
||||
"xchan" text NOT NULL,
|
||||
"cat" text NOT NULL,
|
||||
"k" text NOT NULL,
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1178 );
|
||||
define( 'UPDATE_VERSION' , 1179 );
|
||||
|
||||
/**
|
||||
*
|
||||
@ -2325,3 +2325,39 @@ function update_r1177() {
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
function update_r1178() {
|
||||
|
||||
$c2 = null;
|
||||
|
||||
$c1 = q("SELECT channel_id, channel_hash from channel where true");
|
||||
if($c1) {
|
||||
$c2 = q("SELECT id, chan from abconfig where true");
|
||||
if($c2) {
|
||||
for($x = 0; $x < count($c2); $x ++) {
|
||||
foreach($c1 as $c) {
|
||||
if($c['channel_hash'] == $c2[$x]['chan']) {
|
||||
$c2[$x]['chan'] = $c['channel_id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$r1 = q("ALTER TABLE abconfig CHANGE chan chan int(10) unsigned NOT NULL DEFAULT '0' ");
|
||||
|
||||
if($c2) {
|
||||
foreach($c2 as $c) {
|
||||
q("UPDATE abconfig SET chan = %d where id = %d",
|
||||
intval($c['chan']),
|
||||
intval($c['id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if($r1)
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
9561
util/hmessages.po
9561
util/hmessages.po
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
||||
</div>
|
||||
<div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;">
|
||||
{{/if}}
|
||||
<div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper{{/if}}">
|
||||
<div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite {{/if}}">
|
||||
<a name="{{$item.id}}" ></a>
|
||||
<div class="wall-item-outside-wrapper {{$item.indent}}{{$item.previewing}}" id="wall-item-outside-wrapper-{{$item.id}}" >
|
||||
<div class="wall-item-content-wrapper {{$item.indent}}" id="wall-item-content-wrapper-{{$item.id}}" style="clear:both;">
|
||||
@ -20,8 +20,8 @@
|
||||
{{/if}}
|
||||
<div class="wall-item-head">
|
||||
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
|
||||
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}}" id="wall-item-photo-wrapper-{{$item.id}}">
|
||||
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-photo-link" id="wall-item-photo-link-{{$item.id}}"><img src="{{$item.thumb}}" class="wall-item-photo{{$item.sparkle}}" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" /></a>
|
||||
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}">
|
||||
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-photo-link u-url" id="wall-item-photo-link-{{$item.id}}"><img src="{{$item.thumb}}" class="wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" /></a>
|
||||
</div>
|
||||
<div class="wall-item-photo-end" style="clear:both"></div>
|
||||
</div>
|
||||
@ -39,14 +39,14 @@
|
||||
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}} {{$item.via}} <a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
|
||||
</div>
|
||||
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">
|
||||
{{if $item.verified}}<i class="fa fa-check item-verified" title="{{$item.verified}}"></i> {{elseif $item.forged}}<i class="fa fa-exclamation item-forged" title="{{$item.forged}}"></i> {{/if}}{{if $item.location}}<span class="wall-item-location" id="wall-item-location-{{$item.id}}">{{$item.location}}, </span>{{/if}}<span class="autotime" title="{{$item.isotime}}">{{$item.localtime}}{{if $item.editedtime}} {{$item.editedtime}}{{/if}}{{if $item.expiretime}} {{$item.expiretime}}{{/if}}</span>{{if $item.editedtime}} <i class="fa fa-pencil"></i>{{/if}} {{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}
|
||||
{{if $item.verified}}<i class="fa fa-check item-verified" title="{{$item.verified}}"></i> {{elseif $item.forged}}<i class="fa fa-exclamation item-forged" title="{{$item.forged}}"></i> {{/if}}{{if $item.location}}<span class="wall-item-location p-location" id="wall-item-location-{{$item.id}}">{{$item.location}}, </span>{{/if}}<span class="autotime" title="{{$item.isotime}}"><time class="dt-published" datetime="{{$item.isotime}}">{{$item.localtime}}</time>{{if $item.editedtime}} {{$item.editedtime}}{{/if}}{{if $item.expiretime}} {{$item.expiretime}}{{/if}}</span>{{if $item.editedtime}} <i class="fa fa-pencil"></i>{{/if}} {{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
{{if $item.body}}
|
||||
<div class="wall-item-content" id="wall-item-content-{{$item.id}}">
|
||||
<div class="wall-item-body" id="wall-item-body-{{$item.id}}" >
|
||||
<div class="wall-item-body e-content" id="wall-item-body-{{$item.id}}" >
|
||||
{{$item.body}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
@ -66,7 +66,7 @@
|
||||
{{/if}}
|
||||
{{if $item.categories}}
|
||||
<div class="body-tags" id="item-categories">
|
||||
<span class="tag">{{$item.categories}}</span>
|
||||
<span class="tag p-category">{{$item.categories}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if $item.folders}}
|
||||
@ -133,7 +133,7 @@
|
||||
<li role="presentation"><a role="menuitem" href="#" onclick="jotShare({{$item.id}}); return false"><i class="fa fa-retweet" title="{{$item.share.0}}"></i> {{$item.share.0}}</a></li>
|
||||
{{/if}}
|
||||
{{if $item.plink}}
|
||||
<li role="presentation"><a role="menuitem" href="{{$item.plink.href}}" title="{{$item.plink.title}}" ><i class="fa fa-external-link"></i> {{$item.plink.title}}</a></li>
|
||||
<li role="presentation"><a role="menuitem" href="{{$item.plink.href}}" title="{{$item.plink.title}}" class="u-url"><i class="fa fa-external-link"></i> {{$item.plink.title}}</a></li>
|
||||
{{/if}}
|
||||
{{if $item.edpost}}
|
||||
<li role="presentation"><a role="menuitem" href="{{$item.edpost.0}}" title="{{$item.edpost.1}}"><i class="editpost fa fa-pencil"></i> {{$item.edpost.1}}</a></li>
|
||||
|
@ -28,7 +28,7 @@
|
||||
minWidth: 240,
|
||||
minHeight: 87,
|
||||
maxWidth: 320,
|
||||
maxHeight: 320,
|
||||
maxHeight: 116,
|
||||
ratioDim: { x: 100, y:36 },
|
||||
displayOnInit: true,
|
||||
onEndCrop: onEndCrop
|
||||
|
@ -17,7 +17,7 @@
|
||||
</button>
|
||||
{{/if}}
|
||||
{{if $userinfo}}
|
||||
<img class="dropdown-toggle fakelink" data-toggle="dropdown" id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}"><span class="caret" id="usermenu-caret"></span>
|
||||
<img class="dropdown-toggle fakelink" data-toggle="dropdown" id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}"><span class="caret dropdown-toggle fakelink" data-toggle="dropdown" id="usermenu-caret"></span>
|
||||
{{if $localuser}}
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="avatar">
|
||||
{{foreach $nav.usermenu as $usermenu}}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
{{if ! $zcard}}
|
||||
<div class="fn p-name">{{$profile.fullname}}{{if $profile.online}} <i class="fa fa-asterisk online-now" title="{{$profile.online}}"></i>{{/if}}</div>
|
||||
{{if $reddress}}<div class="reddress" oncopy="return false;">{{$profile.reddress}}</div>{{/if}}
|
||||
{{if $reddress}}<div class="reddress">{{$profile.reddress}}</div>{{/if}}
|
||||
{{/if}}
|
||||
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
|
||||
{{if $location}}
|
||||
|
Reference in New Issue
Block a user