mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-25 10:22:44 +00:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
3eca1c3696
36 changed files with 349 additions and 182 deletions
|
@ -1758,6 +1758,18 @@ class Admin extends \Zotlabs\Web\Controller {
|
||||||
$git = new GitRepo('sys', null, false, $repoName, $repoDir);
|
$git = new GitRepo('sys', null, false, $repoName, $repoDir);
|
||||||
try {
|
try {
|
||||||
if ($git->pull()) {
|
if ($git->pull()) {
|
||||||
|
$files = array_diff(scandir($repoDir), array('.', '..'));
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if (is_dir($repoDir . '/' . $file) && $file !== '.git') {
|
||||||
|
$source = '../extend/addon/' . $repoName . '/' . $file;
|
||||||
|
$target = realpath(__DIR__ . '/../../addon/') . '/' . $file;
|
||||||
|
unlink($target);
|
||||||
|
if (!symlink($source, $target)) {
|
||||||
|
logger('Error linking addons to /addon');
|
||||||
|
json_return_and_die(array('message' => 'Error linking addons to /addon', 'success' => false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
json_return_and_die(array('message' => 'Repo updated.', 'success' => true));
|
json_return_and_die(array('message' => 'Repo updated.', 'success' => true));
|
||||||
} else {
|
} else {
|
||||||
json_return_and_die(array('message' => 'Error updating addon repo.', 'success' => false));
|
json_return_and_die(array('message' => 'Error updating addon repo.', 'success' => false));
|
||||||
|
|
|
@ -64,6 +64,7 @@ class Dav extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
|
|
||||||
$auth = new \Zotlabs\Storage\BasicAuth();
|
$auth = new \Zotlabs\Storage\BasicAuth();
|
||||||
|
$auth->setRealm(ucfirst(\Zotlabs\Project\System::get_platform_name()) . 'WebDAV');
|
||||||
|
|
||||||
// $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function($userName,$password) {
|
// $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function($userName,$password) {
|
||||||
// if(account_verify_password($userName,$password))
|
// if(account_verify_password($userName,$password))
|
||||||
|
|
|
@ -28,10 +28,10 @@ class Pubsites extends \Zotlabs\Web\Controller {
|
||||||
if($ret['success']) {
|
if($ret['success']) {
|
||||||
$j = json_decode($ret['body'],true);
|
$j = json_decode($ret['body'],true);
|
||||||
if($j) {
|
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 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('Software') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>';
|
||||||
if($j['sites']) {
|
if($j['sites']) {
|
||||||
foreach($j['sites'] as $jj) {
|
foreach($j['sites'] as $jj) {
|
||||||
if($jj['project'] !== \Zotlabs\Project\System::get_platform_name())
|
if(strpos($jj['project'],\Zotlabs\Project\System::get_platform_name()) === false)
|
||||||
continue;
|
continue;
|
||||||
$host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3));
|
$host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3));
|
||||||
$rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="fa fa-check-square-o"></i> ' . t('Rate') . '</a></td>' : '');
|
$rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="fa fa-check-square-o"></i> ' . t('Rate') . '</a></td>' : '');
|
||||||
|
@ -43,7 +43,7 @@ class Pubsites extends \Zotlabs\Web\Controller {
|
||||||
$location = '<br /> ';
|
$location = '<br /> ';
|
||||||
}
|
}
|
||||||
$urltext = str_replace(array('https://'), '', $jj['url']);
|
$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 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>' . 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>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1062,11 +1062,11 @@ class Settings extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
'$lbl_p2macro' => t('Advanced Privacy Settings'),
|
'$lbl_p2macro' => t('Advanced Privacy Settings'),
|
||||||
|
|
||||||
'$expire' => array('expire',t('Expire other channel content after this many days'),$expire,sprintf( t('0 or blank to use the website limit. The website expires after %d days.'),intval($sys_expire))),
|
'$expire' => array('expire',t('Expire other channel content after this many days'),$expire, t('0 or blank to use the website limit.') . ' ' . ((intval($sys_expire)) ? sprintf( t('This website expires after %d days.'),intval($sys_expire)) : t('This website does not expire imported content.')) . ' ' . t('The website limit takes precedence if lower than your limit.')),
|
||||||
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
|
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
|
||||||
'$permissions' => t('Default Post Permissions'),
|
'$permissions' => t('Default Post and Publish Permissions'),
|
||||||
'$permdesc' => t("\x28click to open/close\x29"),
|
'$permdesc' => t("\x28click to open/close\x29"),
|
||||||
'$aclselect' => populate_acl($perm_defaults, false, \PermissionDescription::fromDescription(t('Use my default audience setting for the type of post'))),
|
'$aclselect' => populate_acl($perm_defaults, false, \PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
|
||||||
'$suggestme' => $suggestme,
|
'$suggestme' => $suggestme,
|
||||||
'$group_select' => $group_select,
|
'$group_select' => $group_select,
|
||||||
'$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', get_roles()),
|
'$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', get_roles()),
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace Zotlabs\Project;
|
||||||
class System {
|
class System {
|
||||||
|
|
||||||
static public function get_platform_name() {
|
static public function get_platform_name() {
|
||||||
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['platform_name'])
|
if(is_array(\App::$config) && is_array(\App::$config['system']) && array_key_exists('platform_name',\App::$config['system']))
|
||||||
return \App::$config['system']['platform_name'];
|
return \App::$config['system']['platform_name'];
|
||||||
return PLATFORM_NAME;
|
return PLATFORM_NAME;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class System {
|
||||||
static public function get_server_role() {
|
static public function get_server_role() {
|
||||||
if(UNO)
|
if(UNO)
|
||||||
return 'basic';
|
return 'basic';
|
||||||
return 'advanced';
|
return 'pro';
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function get_std_version() {
|
static public function get_std_version() {
|
||||||
|
|
131
Zotlabs/Render/Theme.php
Normal file
131
Zotlabs/Render/Theme.php
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Render;
|
||||||
|
|
||||||
|
|
||||||
|
class Theme {
|
||||||
|
|
||||||
|
static $system_theme = null;
|
||||||
|
static $system_mobile_theme = null;
|
||||||
|
|
||||||
|
static $session_theme = null;
|
||||||
|
static $session_mobile_theme = null;
|
||||||
|
|
||||||
|
static $base_themes = array('redbasic');
|
||||||
|
|
||||||
|
static public function current(){
|
||||||
|
|
||||||
|
self::$system_theme = ((isset(\App::$config['system']['theme']))
|
||||||
|
? \App::$config['system']['theme'] : '');
|
||||||
|
self::$session_theme = ((isset($_SESSION) && x($_SESSION,'theme'))
|
||||||
|
? $_SESSION['theme'] : self::$system_theme);
|
||||||
|
self::$system_mobile_theme = ((isset(\App::$config['system']['mobile_theme']))
|
||||||
|
? \App::$config['system']['mobile_theme'] : '');
|
||||||
|
self::$session_mobile_theme = ((isset($_SESSION) && x($_SESSION,'mobile_theme'))
|
||||||
|
? $_SESSION['mobile_theme'] : self::$system_mobile_theme);
|
||||||
|
|
||||||
|
$page_theme = null;
|
||||||
|
|
||||||
|
// Find the theme that belongs to the channel whose stuff we are looking at
|
||||||
|
|
||||||
|
if(\App::$profile_uid) {
|
||||||
|
$r = q("select channel_theme from channel where channel_id = %d limit 1",
|
||||||
|
intval(\App::$profile_uid)
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
$page_theme = $r[0]['channel_theme'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Themes from Comanche layouts over-ride the channel theme
|
||||||
|
|
||||||
|
if(array_key_exists('theme', \App::$layout) && \App::$layout['theme'])
|
||||||
|
$page_theme = \App::$layout['theme'];
|
||||||
|
|
||||||
|
// If the viewer is on a mobile device, ensure that we're using a mobile
|
||||||
|
// theme of some kind or whatever the viewer's preference is for mobile
|
||||||
|
// viewing (if applicable)
|
||||||
|
|
||||||
|
if(\App::$is_mobile || \App::$is_tablet) {
|
||||||
|
if(isset($_SESSION['show_mobile']) && (! $_SESSION['show_mobile'])) {
|
||||||
|
$chosen_theme = self::$session_theme;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$chosen_theme = self::$session_mobile_theme;
|
||||||
|
|
||||||
|
if($chosen_theme === '' || $chosen_theme === '---' ) {
|
||||||
|
// user has selected to have the mobile theme be the same as the normal one
|
||||||
|
$chosen_theme = self::$session_theme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$chosen_theme = self::$session_theme;
|
||||||
|
|
||||||
|
if($page_theme) {
|
||||||
|
$chosen_theme = $page_theme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow theme selection of the form 'theme_name:schema_name'
|
||||||
|
|
||||||
|
$themepair = explode(':', $chosen_theme);
|
||||||
|
|
||||||
|
if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) {
|
||||||
|
return($themepair);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(self::$base_themes as $t) {
|
||||||
|
if(file_exists('view/theme/' . $t . '/css/style.css') ||
|
||||||
|
file_exists('view/theme/' . $t . '/php/style.php')) {
|
||||||
|
return(array($t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Worst case scenario, the default base theme or themes don't exist; perhaps somebody renamed it/them.
|
||||||
|
|
||||||
|
// Find any theme at all and use it.
|
||||||
|
|
||||||
|
$fallback = array_merge(glob('view/theme/*/css/style.css'),glob('view/theme/*/php/style.php'));
|
||||||
|
if(count($fallback))
|
||||||
|
return(array(str_replace('view/theme/','', substr($fallback[0],0,-14))));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return full URL to theme which is currently in effect.
|
||||||
|
*
|
||||||
|
* Provide a sane default if nothing is chosen or the specified theme does not exist.
|
||||||
|
*
|
||||||
|
* @param bool $installing default false
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
function url($installing = false) {
|
||||||
|
|
||||||
|
if($installing)
|
||||||
|
return self::$base_themes[0];
|
||||||
|
|
||||||
|
$theme = self::current();
|
||||||
|
|
||||||
|
$t = $theme[0];
|
||||||
|
$s = ((count($theme) > 1) ? $t[1] : '');
|
||||||
|
|
||||||
|
$opts = '';
|
||||||
|
$opts = ((\App::$profile_uid) ? '?f=&puid=' . \App::$profile_uid : '');
|
||||||
|
|
||||||
|
$schema_str = ((x(\App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : '');
|
||||||
|
if(($s) && (! $schema_str))
|
||||||
|
$schema_str = '&schema=' . $s;
|
||||||
|
$opts .= $schema_str;
|
||||||
|
|
||||||
|
if(file_exists('view/theme/' . $t . '/php/style.php'))
|
||||||
|
return('view/theme/' . $t . '/php/style.pcss' . $opts);
|
||||||
|
|
||||||
|
return('view/theme/' . $t . '/css/style.css');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ class BasicAuth extends DAV\Auth\Backend\AbstractBasic {
|
||||||
/**
|
/**
|
||||||
* @brief Validates a username and password.
|
* @brief Validates a username and password.
|
||||||
*
|
*
|
||||||
* Guest access is granted with the password "+++".
|
|
||||||
*
|
*
|
||||||
* @see \Sabre\DAV\Auth\Backend\AbstractBasic::validateUserPass
|
* @see \Sabre\DAV\Auth\Backend\AbstractBasic::validateUserPass
|
||||||
* @param string $username
|
* @param string $username
|
||||||
|
|
|
@ -246,11 +246,13 @@ class Browser extends DAV\Browser\Plugin {
|
||||||
\App::$page['content'] = $html;
|
\App::$page['content'] = $html;
|
||||||
load_pdl($a);
|
load_pdl($a);
|
||||||
|
|
||||||
$theme_info_file = "view/theme/" . current_theme() . "/php/theme.php";
|
$current_theme = \Zotlabs\Render\Theme::current();
|
||||||
|
|
||||||
|
$theme_info_file = "view/theme/" . $current_theme[0] . "/php/theme.php";
|
||||||
if (file_exists($theme_info_file)){
|
if (file_exists($theme_info_file)){
|
||||||
require_once($theme_info_file);
|
require_once($theme_info_file);
|
||||||
if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
|
if (function_exists(str_replace('-', '_', $current_theme[0]) . '_init')) {
|
||||||
$func = str_replace('-', '_', current_theme()) . '_init';
|
$func = str_replace('-', '_', $current_theme[0]) . '_init';
|
||||||
$func($a);
|
$func($a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
|
||||||
* @return null|string ETag
|
* @return null|string ETag
|
||||||
*/
|
*/
|
||||||
public function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
logger($name, LOGGER_DEBUG);
|
logger('create file in directory ' . $name, LOGGER_DEBUG);
|
||||||
|
|
||||||
if (! $this->auth->owner_id) {
|
if (! $this->auth->owner_id) {
|
||||||
logger('permission denied ' . $name);
|
logger('permission denied ' . $name);
|
||||||
|
@ -358,7 +358,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
logger($name, LOGGER_DEBUG);
|
logger('create directory ' . $name, LOGGER_DEBUG);
|
||||||
|
|
||||||
if ((! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage'))) {
|
if ((! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage'))) {
|
||||||
throw new DAV\Exception\Forbidden('Permission denied.');
|
throw new DAV\Exception\Forbidden('Permission denied.');
|
||||||
|
@ -372,7 +372,9 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
|
||||||
$result = attach_mkdir($r[0], $this->auth->observer, array('filename' => $name, 'folder' => $this->folder_hash));
|
$result = attach_mkdir($r[0], $this->auth->observer, array('filename' => $name, 'folder' => $this->folder_hash));
|
||||||
|
|
||||||
if($result['success']) {
|
if($result['success']) {
|
||||||
$sync = attach_export_data($r[0],$ret['data']['hash']);
|
$sync = attach_export_data($r[0],$result['data']['hash']);
|
||||||
|
logger('createDirectory: attach_export_data returns $sync:' . print_r($sync, true), LOGGER_DEBUG);
|
||||||
|
|
||||||
if($sync) {
|
if($sync) {
|
||||||
build_sync_packet($r[0]['channel_id'],array('file' => array($sync)));
|
build_sync_packet($r[0]['channel_id'],array('file' => array($sync)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,13 +206,15 @@ class Router {
|
||||||
* load current theme info
|
* load current theme info
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$theme_info_file = 'view/theme/' . current_theme() . '/php/theme.php';
|
$current_theme = \Zotlabs\Render\Theme::current();
|
||||||
|
|
||||||
|
$theme_info_file = 'view/theme/' . $current_theme[0] . '/php/theme.php';
|
||||||
if (file_exists($theme_info_file)){
|
if (file_exists($theme_info_file)){
|
||||||
require_once($theme_info_file);
|
require_once($theme_info_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(function_exists(str_replace('-', '_', current_theme()) . '_init')) {
|
if(function_exists(str_replace('-', '_', $current_theme[0]) . '_init')) {
|
||||||
$func = str_replace('-', '_', current_theme()) . '_init';
|
$func = str_replace('-', '_', $current_theme[0]) . '_init';
|
||||||
$func($a);
|
$func($a);
|
||||||
}
|
}
|
||||||
elseif (x(\App::$theme_info, 'extends') && file_exists('view/theme/' . \App::$theme_info['extends'] . '/php/theme.php')) {
|
elseif (x(\App::$theme_info, 'extends') && file_exists('view/theme/' . \App::$theme_info['extends'] . '/php/theme.php')) {
|
||||||
|
|
|
@ -41,10 +41,15 @@ class Session {
|
||||||
|
|
||||||
|
|
||||||
$arr = session_get_cookie_params();
|
$arr = session_get_cookie_params();
|
||||||
|
|
||||||
|
// Note when setting cookies: set the domain to false which creates a single domain
|
||||||
|
// cookie. If you use a hostname it will create a .domain.com wildcard which will
|
||||||
|
// have some nasty side effects if you have any other subdomains running hubzilla.
|
||||||
|
|
||||||
session_set_cookie_params(
|
session_set_cookie_params(
|
||||||
((isset($arr['lifetime'])) ? $arr['lifetime'] : 0),
|
((isset($arr['lifetime'])) ? $arr['lifetime'] : 0),
|
||||||
((isset($arr['path'])) ? $arr['path'] : '/'),
|
((isset($arr['path'])) ? $arr['path'] : '/'),
|
||||||
(($arr['domain']) ? $arr['domain'] : \App::get_hostname()),
|
(($arr['domain']) ? $arr['domain'] : false),
|
||||||
((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),
|
((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),
|
||||||
((isset($arr['httponly'])) ? $arr['httponly'] : true)
|
((isset($arr['httponly'])) ? $arr['httponly'] : true)
|
||||||
);
|
);
|
||||||
|
@ -82,6 +87,7 @@ class Session {
|
||||||
$arr = session_get_cookie_params();
|
$arr = session_get_cookie_params();
|
||||||
|
|
||||||
if($this->handler && $this->session_started) {
|
if($this->handler && $this->session_started) {
|
||||||
|
|
||||||
session_regenerate_id(true);
|
session_regenerate_id(true);
|
||||||
|
|
||||||
// force SessionHandler record creation with the new session_id
|
// force SessionHandler record creation with the new session_id
|
||||||
|
@ -93,9 +99,9 @@ class Session {
|
||||||
logger('no session handler');
|
logger('no session handler');
|
||||||
|
|
||||||
if (x($_COOKIE, 'jsdisabled')) {
|
if (x($_COOKIE, 'jsdisabled')) {
|
||||||
setcookie('jsdisabled', $_COOKIE['jsdisabled'], $newxtime, '/', \App::get_hostname(),((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),((isset($arr['httponly'])) ? $arr['httponly'] : true));
|
setcookie('jsdisabled', $_COOKIE['jsdisabled'], $newxtime, '/', false,((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),((isset($arr['httponly'])) ? $arr['httponly'] : true));
|
||||||
}
|
}
|
||||||
setcookie(session_name(),session_id(),$newxtime, '/', \App::get_hostname(),((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),((isset($arr['httponly'])) ? $arr['httponly'] : true));
|
setcookie(session_name(),session_id(),$newxtime, '/', false,((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),((isset($arr['httponly'])) ? $arr['httponly'] : true));
|
||||||
|
|
||||||
$arr = array('expire' => $xtime);
|
$arr = array('expire' => $xtime);
|
||||||
call_hooks('new_cookie', $arr);
|
call_hooks('new_cookie', $arr);
|
||||||
|
@ -111,7 +117,7 @@ class Session {
|
||||||
$xtime = (($_SESSION['remember_me']) ? (60 * 60 * 24 * 365) : 0 );
|
$xtime = (($_SESSION['remember_me']) ? (60 * 60 * 24 * 365) : 0 );
|
||||||
|
|
||||||
if($xtime)
|
if($xtime)
|
||||||
setcookie(session_name(),session_id(),(time() + $xtime), '/', \App::get_hostname(),((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),((isset($arr['httponly'])) ? $arr['httponly'] : true));
|
setcookie(session_name(),session_id(),(time() + $xtime), '/', false,((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),((isset($arr['httponly'])) ? $arr['httponly'] : true));
|
||||||
$arr = array('expire' => $xtime);
|
$arr = array('expire' => $xtime);
|
||||||
call_hooks('extend_cookie', $arr);
|
call_hooks('extend_cookie', $arr);
|
||||||
|
|
||||||
|
|
106
boot.php
106
boot.php
|
@ -1874,105 +1874,6 @@ function is_windows() {
|
||||||
return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false);
|
return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function current_theme(){
|
|
||||||
$app_base_themes = array('redbasic');
|
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
$page_theme = null;
|
|
||||||
|
|
||||||
// Find the theme that belongs to the channel whose stuff we are looking at
|
|
||||||
|
|
||||||
if(App::$profile_uid && App::$profile_uid != local_channel()) {
|
|
||||||
$r = q("select channel_theme from channel where channel_id = %d limit 1",
|
|
||||||
intval(App::$profile_uid)
|
|
||||||
);
|
|
||||||
if($r)
|
|
||||||
$page_theme = $r[0]['channel_theme'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(array_key_exists('theme', App::$layout) && App::$layout['theme'])
|
|
||||||
$page_theme = App::$layout['theme'];
|
|
||||||
|
|
||||||
// Allow folks to over-rule channel themes and always use their own on their own site.
|
|
||||||
// The default is for channel themes to take precedence over your own on pages belonging
|
|
||||||
// to that channel.
|
|
||||||
|
|
||||||
if($page_theme && local_channel() && App::$profile_uid && local_channel() != App::$profile_uid) {
|
|
||||||
if(get_pconfig(local_channel(),'system','always_my_theme'))
|
|
||||||
$page_theme = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_mobile = App::$is_mobile || App::$is_tablet;
|
|
||||||
|
|
||||||
$standard_system_theme = ((isset(App::$config['system']['theme'])) ? App::$config['system']['theme'] : '');
|
|
||||||
$standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme);
|
|
||||||
|
|
||||||
if($is_mobile) {
|
|
||||||
if(isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
|
|
||||||
$system_theme = $standard_system_theme;
|
|
||||||
$theme_name = $standard_theme_name;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$system_theme = ((isset(App::$config['system']['mobile_theme'])) ? App::$config['system']['mobile_theme'] : '');
|
|
||||||
$theme_name = ((isset($_SESSION) && x($_SESSION,'mobile_theme')) ? $_SESSION['mobile_theme'] : $system_theme);
|
|
||||||
|
|
||||||
if($theme_name === '' || $theme_name === '---' ) {
|
|
||||||
// user has selected to have the mobile theme be the same as the normal one
|
|
||||||
$system_theme = $standard_system_theme;
|
|
||||||
$theme_name = $standard_theme_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$system_theme = $standard_system_theme;
|
|
||||||
$theme_name = $standard_theme_name;
|
|
||||||
|
|
||||||
if($page_theme)
|
|
||||||
$theme_name = $page_theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($theme_name &&
|
|
||||||
(file_exists('view/theme/' . $theme_name . '/css/style.css') ||
|
|
||||||
file_exists('view/theme/' . $theme_name . '/php/style.php')))
|
|
||||||
return($theme_name);
|
|
||||||
|
|
||||||
foreach($app_base_themes as $t) {
|
|
||||||
if(file_exists('view/theme/' . $t . '/css/style.css') ||
|
|
||||||
file_exists('view/theme/' . $t . '/php/style.php'))
|
|
||||||
return($t);
|
|
||||||
}
|
|
||||||
|
|
||||||
$fallback = array_merge(glob('view/theme/*/css/style.css'),glob('view/theme/*/php/style.php'));
|
|
||||||
if(count($fallback))
|
|
||||||
return (str_replace('view/theme/','', substr($fallback[0],0,-10)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return full URL to theme which is currently in effect.
|
|
||||||
*
|
|
||||||
* Provide a sane default if nothing is chosen or the specified theme does not exist.
|
|
||||||
*
|
|
||||||
* @param bool $installing default false
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function current_theme_url($installing = false) {
|
|
||||||
global $a;
|
|
||||||
|
|
||||||
$t = current_theme();
|
|
||||||
|
|
||||||
$opts = '';
|
|
||||||
$opts = ((App::$profile_uid) ? '?f=&puid=' . App::$profile_uid : '');
|
|
||||||
$opts .= ((x(App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : '');
|
|
||||||
if(file_exists('view/theme/' . $t . '/php/style.php'))
|
|
||||||
return('view/theme/' . $t . '/php/style.pcss' . $opts);
|
|
||||||
|
|
||||||
return('view/theme/' . $t . '/css/style.css');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if current user has admin role.
|
* @brief Check if current user has admin role.
|
||||||
*
|
*
|
||||||
|
@ -1980,6 +1881,7 @@ function current_theme_url($installing = false) {
|
||||||
*
|
*
|
||||||
* @return bool true if user is an admin
|
* @return bool true if user is an admin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function is_site_admin() {
|
function is_site_admin() {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -2209,7 +2111,9 @@ function construct_page(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($p = theme_include(current_theme() . '.js')) != '')
|
$current_theme = Zotlabs\Render\Theme::current();
|
||||||
|
|
||||||
|
if (($p = theme_include($current_theme[0] . '.js')) != '')
|
||||||
head_add_js($p);
|
head_add_js($p);
|
||||||
|
|
||||||
if (($p = theme_include('mod_' . App::$module . '.php')) != '')
|
if (($p = theme_include('mod_' . App::$module . '.php')) != '')
|
||||||
|
@ -2223,7 +2127,7 @@ function construct_page(&$a) {
|
||||||
head_add_css(((x(App::$page, 'template')) ? App::$page['template'] : 'default' ) . '.css');
|
head_add_css(((x(App::$page, 'template')) ? App::$page['template'] : 'default' ) . '.css');
|
||||||
|
|
||||||
head_add_css('mod_' . App::$module . '.css');
|
head_add_css('mod_' . App::$module . '.css');
|
||||||
head_add_css(current_theme_url($installing));
|
head_add_css(Zotlabs\Render\Theme::url($installing));
|
||||||
|
|
||||||
head_add_js('mod_' . App::$module . '.js');
|
head_add_js('mod_' . App::$module . '.js');
|
||||||
|
|
||||||
|
|
|
@ -230,14 +230,14 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
|
||||||
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
|
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
|
||||||
$showall_origin = '';
|
$showall_origin = '';
|
||||||
$showall_icon = 'fa-globe';
|
$showall_icon = 'fa-globe';
|
||||||
|
$role = get_pconfig(local_channel(),'system','permissions_role');
|
||||||
|
|
||||||
if(! $emptyACL_description) {
|
if(! $emptyACL_description) {
|
||||||
$showall_caption = t('Visible to your default audience');
|
$showall_caption = t('Visible to your default audience');
|
||||||
|
|
||||||
} else if (is_a($emptyACL_description, 'PermissionDescription')) {
|
} else if (is_a($emptyACL_description, 'PermissionDescription')) {
|
||||||
$showall_caption = $emptyACL_description->get_permission_description();
|
$showall_caption = $emptyACL_description->get_permission_description();
|
||||||
$showall_origin = $emptyACL_description->get_permission_origin_description();
|
$showall_origin = (($role === 'custom') ? $emptyACL_description->get_permission_origin_description() : '');
|
||||||
$showall_icon = $emptyACL_description->get_permission_icon();
|
$showall_icon = $emptyACL_description->get_permission_icon();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -271,7 +271,7 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
|
||||||
'$showall' => $showall_caption,
|
'$showall' => $showall_caption,
|
||||||
'$showallOrigin' => $showall_origin,
|
'$showallOrigin' => $showall_origin,
|
||||||
'$showallIcon' => $showall_icon,
|
'$showallIcon' => $showall_icon,
|
||||||
'$select_label' => t('Who can see this'),
|
'$select_label' => t('Who can see this?'),
|
||||||
'$showlimited' => t('Custom selection'),
|
'$showlimited' => t('Custom selection'),
|
||||||
'$showlimitedDesc' => t('Select "Show" to allow viewing. "Don\'t show" lets you override and limit the scope of "Show".'),
|
'$showlimitedDesc' => t('Select "Show" to allow viewing. "Don\'t show" lets you override and limit the scope of "Show".'),
|
||||||
'$show' => t("Show"),
|
'$show' => t("Show"),
|
||||||
|
|
|
@ -7,7 +7,7 @@ require_once('include/hubloc.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function checksites_run($argv, $argc){
|
function checksites_run($argc,$argv){
|
||||||
|
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
@ -57,6 +57,6 @@ function checksites_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
checksites_run($argv,$argc);
|
checksites_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,15 @@ require_once('include/cli_startup.php');
|
||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
|
|
||||||
|
|
||||||
function cli_suggest_run($argv, $argc){
|
function cli_suggest_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
update_suggestions();
|
update_suggestions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
cli_suggest_run($argv,$argc);
|
cli_suggest_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require_once('boot.php');
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
|
|
||||||
|
|
||||||
function cronhooks_run($argv, $argc){
|
function cronhooks_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -18,6 +18,6 @@ function cronhooks_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
cronhooks_run($argv,$argc);
|
cronhooks_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,17 +32,25 @@ function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) {
|
||||||
if(is_null($port)) $set_port = 5432;
|
if(is_null($port)) $set_port = 5432;
|
||||||
$dba = new dba_postgres($server, $set_port, $user, $pass, $db, $install);
|
$dba = new dba_postgres($server, $set_port, $user, $pass, $db, $install);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// Highly experimental at the present time.
|
||||||
|
// require_once('include/dba/dba_pdo.php');
|
||||||
|
// $dba = new dba_pdo($server, $set_port,$user,$pass,$db,$install);
|
||||||
|
// }
|
||||||
|
|
||||||
if(class_exists('mysqli')) {
|
if(class_exists('mysqli')) {
|
||||||
if (is_null($port)) $set_port = ini_get("mysqli.default_port");
|
if (is_null($port)) $set_port = ini_get("mysqli.default_port");
|
||||||
require_once('include/dba/dba_mysqli.php');
|
require_once('include/dba/dba_mysqli.php');
|
||||||
$dba = new dba_mysqli($server, $set_port,$user,$pass,$db,$install);
|
$dba = new dba_mysqli($server, $set_port,$user,$pass,$db,$install);
|
||||||
} else {
|
|
||||||
if (is_null($port)) $set_port = "3306";
|
|
||||||
require_once('include/dba/dba_mysql.php');
|
|
||||||
$dba = new dba_mysql($server, $set_port,$user,$pass,$db,$install);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Until we have a proper PDO driver, store the DB connection parameters for
|
||||||
|
// plugins/addons which use PDO natively (such as cdav). This is wasteful as
|
||||||
|
// it opens a separate connection to the DB, but saves a lot of effort re-writing
|
||||||
|
// third-party interfaces that are working and well tested.
|
||||||
|
|
||||||
|
|
||||||
if(is_object($dba) && $dba->connected) {
|
if(is_object($dba) && $dba->connected) {
|
||||||
$dns = (($dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql')
|
$dns = (($dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql')
|
||||||
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
|
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
|
||||||
|
|
95
include/dba/dba_pdo.php
Executable file
95
include/dba/dba_pdo.php
Executable file
|
@ -0,0 +1,95 @@
|
||||||
|
<?php /** @file */
|
||||||
|
|
||||||
|
require_once('include/dba/dba_driver.php');
|
||||||
|
|
||||||
|
class dba_pdo extends dba_driver {
|
||||||
|
|
||||||
|
|
||||||
|
public $driver_dbtype = null;
|
||||||
|
|
||||||
|
function connect($server,$port,$user,$pass,$db) {
|
||||||
|
|
||||||
|
$this->driver_dbtype = 'mysql'; // (($dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql');
|
||||||
|
$dns = $this->driver_dbtype
|
||||||
|
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
|
||||||
|
. ';dbname=' . $db;
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->db = new PDO($dns,$user,$pass);
|
||||||
|
$this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
if(file_exists('dbfail.out')) {
|
||||||
|
file_put_contents('dbfail.out', datetime_convert() . "\nConnect: " . $e->getMessage() . "\n", FILE_APPEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->connected = true;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function q($sql) {
|
||||||
|
if((! $this->db) || (! $this->connected))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$this->error = '';
|
||||||
|
$select = ((stripos($sql,'select') === 0) ? true : false);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
|
||||||
|
$this->error = $e->getMessage();
|
||||||
|
if($this->error) {
|
||||||
|
db_logger('dba_mysqli: ERROR: ' . printable($sql) . "\n" . $this->error, LOGGER_NORMAL, LOG_ERR);
|
||||||
|
if(file_exists('dbfail.out')) {
|
||||||
|
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . "\n" . $this->error . "\n", FILE_APPEND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!($select)) {
|
||||||
|
if($this->debug) {
|
||||||
|
db_logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false'), LOGGER_NORMAL,(($result) ? LOG_INFO : LOG_ERR));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->debug) {
|
||||||
|
db_logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returned ' . count($result) . ' results.', LOGGER_NORMAL, LOG_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = array();
|
||||||
|
if($result) {
|
||||||
|
foreach($result as $x) {
|
||||||
|
$r[] = $x;
|
||||||
|
}
|
||||||
|
if($this->debug) {
|
||||||
|
db_logger('dba_pdo: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
function escape($str) {
|
||||||
|
if($this->db && $this->connected) {
|
||||||
|
return substr(substr(@$this->db->quote($str),1),0,-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
if($this->db)
|
||||||
|
$this->db = null;
|
||||||
|
$this->connected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getdriver() {
|
||||||
|
return 'pdo';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ require_once('include/zot.php');
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
|
|
||||||
|
|
||||||
function deliver_run($argv, $argc) {
|
function deliver_run($argc,$argv) {
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -82,6 +82,6 @@ function deliver_run($argv, $argc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
deliver_run($argv,$argc);
|
deliver_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ require_once('include/cli_startup.php');
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
|
|
||||||
|
|
||||||
function deliver_hooks_run($argv, $argc) {
|
function deliver_hooks_run($argc,$argv) {
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -24,6 +24,6 @@ function deliver_hooks_run($argv, $argc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
deliver_hooks_run($argv,$argc);
|
deliver_hooks_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ require_once('include/queue_fn.php');
|
||||||
* @param array $argv
|
* @param array $argv
|
||||||
* @param array $argc
|
* @param array $argc
|
||||||
*/
|
*/
|
||||||
function directory_run($argv, $argc){
|
function directory_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -108,6 +108,6 @@ function directory_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__, get_included_files()) === 0) {
|
if (array_search(__file__, get_included_files()) === 0) {
|
||||||
directory_run($argv, $argc);
|
directory_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
require_once('boot.php');
|
require_once('boot.php');
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
|
|
||||||
function expire_run($argv, $argc){
|
function expire_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -93,6 +93,6 @@ function expire_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__, get_included_files()) === 0){
|
if (array_search(__file__, get_included_files()) === 0){
|
||||||
expire_run($argv, $argc);
|
expire_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ require_once('include/cli_startup.php');
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
require_once('include/identity.php');
|
require_once('include/identity.php');
|
||||||
|
|
||||||
function externals_run($argv, $argc){
|
function externals_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
@ -98,6 +98,6 @@ function externals_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
externals_run($argv,$argc);
|
externals_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
|
|
||||||
function gprobe_run($argv, $argc){
|
function gprobe_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -33,6 +33,6 @@ function gprobe_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
gprobe_run($argv,$argc);
|
gprobe_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -973,8 +973,11 @@ function sync_files($channel,$files) {
|
||||||
|
|
||||||
$attach_exists = false;
|
$attach_exists = false;
|
||||||
$x = attach_by_hash($att['hash']);
|
$x = attach_by_hash($att['hash']);
|
||||||
|
logger('sync_files duplicate check: attach_exists=' . $attach_exists, LOGGER_DEBUG);
|
||||||
|
logger('sync_files duplicate check: att=' . print_r($att,true), LOGGER_DEBUG);
|
||||||
|
logger('sync_files duplicate check: attach_by_hash() returned ' . print_r($x,true), LOGGER_DEBUG);
|
||||||
|
|
||||||
if($x) {
|
if($x['success']) {
|
||||||
$attach_exists = true;
|
$attach_exists = true;
|
||||||
$attach_id = $x[0]['id'];
|
$attach_id = $x[0]['id'];
|
||||||
}
|
}
|
||||||
|
@ -1043,15 +1046,17 @@ function sync_files($channel,$files) {
|
||||||
|
|
||||||
|
|
||||||
if($attach_exists) {
|
if($attach_exists) {
|
||||||
$str = '';
|
logger('sync_files attach exists: ' . print_r($att,true), LOGGER_DEBUG);
|
||||||
foreach($att as $k => $v) {
|
$str = '';
|
||||||
if($str)
|
foreach($att as $k => $v) {
|
||||||
$str .= ",";
|
if($str)
|
||||||
$str .= " `" . $k . "` = '" . $v . "' ";
|
$str .= ",";
|
||||||
}
|
$str .= " `" . $k . "` = '" . $v . "' ";
|
||||||
$r = dbq("update `attach` set " . $str . " where id = " . intval($attach_id) );
|
}
|
||||||
|
$r = dbq("update `attach` set " . $str . " where id = " . intval($attach_id) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
logger('sync_files attach does not exists: ' . print_r($att,true), LOGGER_DEBUG);
|
||||||
$r = dbq("INSERT INTO attach (`"
|
$r = dbq("INSERT INTO attach (`"
|
||||||
. implode("`, `", array_keys($att))
|
. implode("`, `", array_keys($att))
|
||||||
. "`) VALUES ('"
|
. "`) VALUES ('"
|
||||||
|
@ -1064,6 +1069,7 @@ function sync_files($channel,$files) {
|
||||||
|
|
||||||
if($att['filetype'] === 'multipart/mixed' && $att['is_dir']) {
|
if($att['filetype'] === 'multipart/mixed' && $att['is_dir']) {
|
||||||
os_mkdir($newfname, STORAGE_DEFAULT_PERMISSIONS,true);
|
os_mkdir($newfname, STORAGE_DEFAULT_PERMISSIONS,true);
|
||||||
|
$attachment_stored = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
|
|
||||||
|
|
||||||
function importdoc_run($argv, $argc){
|
function importdoc_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ function importdoc_run($argv, $argc){
|
||||||
|
|
||||||
}
|
}
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
importdoc_run($argv,$argc);
|
importdoc_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ require_once('include/bbcode.php');
|
||||||
require_once('include/identity.php');
|
require_once('include/identity.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
|
|
||||||
function notifier_run($argv, $argc){
|
function notifier_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -659,6 +659,6 @@ function notifier_run($argv, $argc){
|
||||||
|
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
notifier_run($argv,$argc);
|
notifier_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ require_once('include/zot.php');
|
||||||
require_once('include/dir_fns.php');
|
require_once('include/dir_fns.php');
|
||||||
|
|
||||||
|
|
||||||
function onedirsync_run($argv, $argc){
|
function onedirsync_run($argc,$argv){
|
||||||
|
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
@ -77,6 +77,6 @@ function onedirsync_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
onedirsync_run($argv,$argc);
|
onedirsync_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ require_once('include/socgraph.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
|
|
||||||
|
|
||||||
function onepoll_run($argv, $argc){
|
function onepoll_run($argc,$argv){
|
||||||
|
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
@ -154,6 +154,6 @@ function onepoll_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
onepoll_run($argv,$argc);
|
onepoll_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -648,12 +648,13 @@ function theme_include($file, $root = '') {
|
||||||
else
|
else
|
||||||
$parent = 'NOPATH';
|
$parent = 'NOPATH';
|
||||||
|
|
||||||
$theme = current_theme();
|
$theme = Zotlabs\Render\Theme::current();
|
||||||
|
$thname = $theme[0];
|
||||||
|
|
||||||
$ext = substr($file,strrpos($file,'.')+1);
|
$ext = substr($file,strrpos($file,'.')+1);
|
||||||
|
|
||||||
$paths = array(
|
$paths = array(
|
||||||
"{$root}view/theme/$theme/$ext/$file",
|
"{$root}view/theme/$thname/$ext/$file",
|
||||||
"{$root}view/theme/$parent/$ext/$file",
|
"{$root}view/theme/$parent/$ext/$file",
|
||||||
"{$root}view/site/$ext/$file",
|
"{$root}view/site/$ext/$file",
|
||||||
"{$root}view/$ext/$file",
|
"{$root}view/$ext/$file",
|
||||||
|
|
|
@ -4,7 +4,7 @@ require_once('boot.php');
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
|
|
||||||
|
|
||||||
function poller_run($argv, $argc){
|
function poller_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -440,6 +440,6 @@ function poller_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
poller_run($argv,$argc);
|
poller_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ require_once('include/cli_startup.php');
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
|
|
||||||
function queue_run($argv, $argc){
|
function queue_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -90,6 +90,6 @@ function queue_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
queue_run($argv,$argc);
|
queue_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ require_once('include/zot.php');
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
|
|
||||||
|
|
||||||
function ratenotif_run($argv, $argc){
|
function ratenotif_run($argc,$argv){
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
|
@ -114,6 +114,6 @@ function ratenotif_run($argv, $argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
ratenotif_run($argv,$argc);
|
ratenotif_run($argc,$argv);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,14 @@ class FriendicaSmarty extends Smarty {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$theme = current_theme();
|
$theme = Zotlabs\Render\Theme::current();
|
||||||
|
$thname = $theme[0];
|
||||||
|
|
||||||
// setTemplateDir can be set to an array, which Smarty will parse in order.
|
// setTemplateDir can be set to an array, which Smarty will parse in order.
|
||||||
// The order is thus very important here
|
// The order is thus very important here
|
||||||
$template_dirs = array('theme' => "view/theme/$theme/tpl/");
|
$template_dirs = array('theme' => "view/theme/$thname/tpl/");
|
||||||
if( x(App::$theme_info,"extends") )
|
if( x(App::$theme_info,"extends") )
|
||||||
$template_dirs = $template_dirs + array('extends' => "view/theme/".App::$theme_info["extends"]."/tpl/");
|
$template_dirs = $template_dirs + array('extends' => "view/theme/" . App::$theme_info["extends"] . "/tpl/");
|
||||||
$template_dirs = $template_dirs + array('base' => 'view/tpl/');
|
$template_dirs = $template_dirs + array('base' => 'view/tpl/');
|
||||||
$this->setTemplateDir($template_dirs);
|
$this->setTemplateDir($template_dirs);
|
||||||
|
|
||||||
|
|
|
@ -3944,7 +3944,7 @@ function zotinfo($arr) {
|
||||||
$ret['site']['sellpage'] = get_config('system','sellpage');
|
$ret['site']['sellpage'] = get_config('system','sellpage');
|
||||||
$ret['site']['location'] = get_config('system','site_location');
|
$ret['site']['location'] = get_config('system','site_location');
|
||||||
$ret['site']['realm'] = get_directory_realm();
|
$ret['site']['realm'] = get_directory_realm();
|
||||||
$ret['site']['project'] = Zotlabs\Project\System::get_platform_name();
|
$ret['site']['project'] = Zotlabs\Project\System::get_platform_name() . Zotlabs\Project\System::get_server_role();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
function po2php_run($argv, $argc) {
|
function po2php_run($argc,$argv) {
|
||||||
|
|
||||||
if ($argc!=2) {
|
if ($argc!=2) {
|
||||||
print "Usage: ".$argv[0]." <file.po>\n\n";
|
print "Usage: ".$argv[0]." <file.po>\n\n";
|
||||||
|
@ -140,5 +140,5 @@ function trim_message($str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
po2php_run($argv,$argc);
|
po2php_run($argc,$argv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue