Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
zottel 2016-06-01 16:28:44 +02:00
commit 1f5529752f
456 changed files with 3890 additions and 59466 deletions

2
.gitignore vendored
View file

@ -14,6 +14,8 @@
*.rej
# OSX .DS_Store files
.DS_Store
# version scripts (repo master only)
.version*
Thumbs.db

View file

@ -1,4 +1,4 @@
Copyright (c) 2010-2016 Hubzilla
Copyright (c) 2010-2016 the Hubzilla Community
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy

View file

@ -62,11 +62,6 @@ class Poller {
$d = datetime_convert();
// TODO check to see if there are any cronhooks before wasting a process
if(! $restart)
Master::Summon(array('Cronhooks'));
// Only poll from those with suitable relationships
$abandon_sql = (($abandon_days)

View file

@ -6,6 +6,7 @@ require_once('include/queue_fn.php');
require_once('include/zot.php');
class Queue {
static public function run($argc,$argv) {
require_once('include/items.php');

View file

@ -10,7 +10,7 @@ class Hook {
$function = serialize($function);
}
$r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' and priority = %d and hook_version = %d LIMIT 1",
$r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d LIMIT 1",
dbesc($hook),
dbesc($file),
dbesc($function),
@ -23,13 +23,13 @@ class Hook {
// To aid in upgrade and transition, remove old settings for any registered hooks that match in all respects except
// for priority or hook_version
$r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'",
$r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `fn` = '%s'",
dbesc($hook),
dbesc($file),
dbesc($function)
);
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )",
$r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )",
dbesc($hook),
dbesc($file),
dbesc($function),
@ -44,7 +44,7 @@ class Hook {
if(is_array($function)) {
$function = serialize($function);
}
$r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `function` = '%s' and priority = %d and hook_version = %d",
$r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d",
dbesc($hook),
dbesc($file),
dbesc($function),

166
Zotlabs/Lib/Config.php Normal file
View file

@ -0,0 +1,166 @@
<?php /** @file */
namespace Zotlabs\Lib;
class Config {
/**
* @brief Loads the hub's configuration from database to a cached storage.
*
* Retrieve a category ($family) of config variables from database to a cached
* storage in the global App::$config[$family].
*
* @param string $family
* The category of the configuration value
*/
static public function Load($family) {
if(! array_key_exists($family, \App::$config))
\App::$config[$family] = array();
if(! array_key_exists('config_loaded', \App::$config[$family])) {
$r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family));
if($r !== false) {
if($r) {
foreach($r as $rr) {
$k = $rr['k'];
\App::$config[$family][$k] = $rr['v'];
}
}
\App::$config[$family]['config_loaded'] = true;
}
}
}
/**
* @brief Sets a configuration value for the hub.
*
* Stores a config value ($value) in the category ($family) under the key ($key).
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to set
* @param mixed $value
* The value to store in the configuration
* @return mixed
* Return the set value, or false if the database update failed
*/
static public function Set($family,$key,$value) {
// manage array value
$dbvalue = ((is_array($value)) ? serialize($value) : $value);
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
if(get_config($family, $key) === false || (! self::get_from_storage($family, $key))) {
$ret = q("INSERT INTO config ( cat, k, v ) VALUES ( '%s', '%s', '%s' ) ",
dbesc($family),
dbesc($key),
dbesc($dbvalue)
);
if($ret) {
\App::$config[$family][$key] = $value;
$ret = $value;
}
return $ret;
}
$ret = q("UPDATE config SET v = '%s' WHERE cat = '%s' AND k = '%s'",
dbesc($dbvalue),
dbesc($family),
dbesc($key)
);
if($ret) {
\App::$config[$family][$key] = $value;
$ret = $value;
}
return $ret;
}
/**
* @brief Get a particular config variable given the category name ($family)
* and a key.
*
* Get a particular config variable from the given category ($family) and the
* $key from a cached storage in App::$config[$family]. If a key is found in the
* DB but does not exist in local config cache, pull it into the cache so we
* do not have to hit the DB again for this item.
*
* Returns false if not set.
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to query
* @return mixed Return value or false on error or if not set
*/
static public function Get($family,$key) {
if((! array_key_exists($family, \App::$config)) || (! array_key_exists('config_loaded', \App::$config[$family])))
self::Load($family);
if(array_key_exists('config_loaded', \App::$config[$family])) {
if(! array_key_exists($key, \App::$config[$family])) {
return false;
}
return ((! is_array(\App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$family][$key]))
? unserialize(\App::$config[$family][$key])
: \App::$config[$family][$key]
);
}
return false;
}
/**
* @brief Deletes the given key from the hub's configuration database.
*
* Removes the configured value from the stored cache in App::$config[$family]
* and removes it from the database.
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to delete
* @return mixed
*/
static public function Delete($family,$key) {
$ret = false;
if(array_key_exists($family, \App::$config) && array_key_exists($key, \App::$config[$family]))
unset(\App::$config[$family][$key]);
$ret = q("DELETE FROM config WHERE cat = '%s' AND k = '%s'",
dbesc($family),
dbesc($key)
);
return $ret;
}
/**
* @brief Returns a value directly from the database configuration storage.
*
* This function queries directly the database and bypasses the chached storage
* from get_config($family, $key).
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to query
* @return mixed
*/
static private function get_from_storage($family,$key) {
$ret = q("SELECT * FROM config WHERE cat = '%s' AND k = '%s' LIMIT 1",
dbesc($family),
dbesc($key)
);
return $ret;
}
}

View file

@ -1,95 +1,99 @@
<?php
/**
* @file include/enotify.php
*
* @brief File with functions and a class for email notifications.
*/
namespace Zotlabs\Lib;
/**
* @brief
*
* @param array $params an assoziative array with:
* * \e string \b from_xchan sender xchan hash
* * \e string \b to_xchan recipient xchan hash
* * \e array \b item an assoziative array
* * \e int \b type one of the NOTIFY_* constants from boot.php
* * \e string \b link
* * \e string \b parent_mid
* * \e string \b otype
* * \e string \b verb
* * \e string \b activity
* @brief File with functions and a class for generating system and email notifications.
*/
function notification($params) {
logger('notification: entry', LOGGER_DEBUG);
// throw a small amount of entropy into the system to breakup duplicates arriving at the same precise instant.
usleep(mt_rand(0, 10000));
$a = get_app();
if ($params['from_xchan']) {
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($params['from_xchan'])
);
}
if ($params['to_xchan']) {
$y = q("select channel.*, account.* from channel left join account on channel_account_id = account_id
where channel_hash = '%s' and channel_removed = 0 limit 1",
dbesc($params['to_xchan'])
);
}
if ($x & $y) {
$sender = $x[0];
$recip = $y[0];
} else {
logger('notification: no sender or recipient.');
logger('sender: ' . $params['from_xchan']);
logger('recip: ' . $params['to_xchan']);
return;
}
class Enotify {
// from here on everything is in the recipients language
/**
* @brief
*
* @param array $params an assoziative array with:
* * \e string \b from_xchan sender xchan hash
* * \e string \b to_xchan recipient xchan hash
* * \e array \b item an assoziative array
* * \e int \b type one of the NOTIFY_* constants from boot.php
* * \e string \b link
* * \e string \b parent_mid
* * \e string \b otype
* * \e string \b verb
* * \e string \b activity
*/
push_lang($recip['account_language']); // should probably have a channel language
$banner = t('$Projectname Notification');
$product = t('$projectname'); // PLATFORM_NAME;
$siteurl = z_root();
$thanks = t('Thank You,');
$sitename = get_config('system','sitename');
$site_admin = sprintf( t('%s Administrator'), $sitename);
static public function submit($params) {
$sender_name = $product;
$hostname = App::get_hostname();
if(strpos($hostname,':'))
logger('notification: entry', LOGGER_DEBUG);
// throw a small amount of entropy into the system to breakup duplicates arriving at the same precise instant.
usleep(mt_rand(0, 10000));
if ($params['from_xchan']) {
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($params['from_xchan'])
);
}
if ($params['to_xchan']) {
$y = q("select channel.*, account.* from channel left join account on channel_account_id = account_id
where channel_hash = '%s' and channel_removed = 0 limit 1",
dbesc($params['to_xchan'])
);
}
if ($x & $y) {
$sender = $x[0];
$recip = $y[0];
} else {
logger('notification: no sender or recipient.');
logger('sender: ' . $params['from_xchan']);
logger('recip: ' . $params['to_xchan']);
return;
}
// from here on everything is in the recipients language
push_lang($recip['account_language']); // should probably have a channel language
$banner = t('$Projectname Notification');
$product = t('$projectname'); // PLATFORM_NAME;
$siteurl = z_root();
$thanks = t('Thank You,');
$sitename = get_config('system','sitename');
$site_admin = sprintf( t('%s Administrator'), $sitename);
$sender_name = $product;
$hostname = \App::get_hostname();
if(strpos($hostname,':'))
$hostname = substr($hostname,0,strpos($hostname,':'));
// Do not translate 'noreply' as it must be a legal 7-bit email address
$sender_email = 'noreply' . '@' . $hostname;
// Do not translate 'noreply' as it must be a legal 7-bit email address
$sender_email = 'noreply' . '@' . $hostname;
$additional_mail_header = "";
$additional_mail_header = "";
if (array_key_exists('item', $params)) {
require_once('include/conversation.php');
// if it's a normal item...
if (array_key_exists('verb', $params['item'])) {
// localize_item() alters the original item so make a copy first
$i = $params['item'];
logger('calling localize');
localize_item($i);
$title = $i['title'];
$body = $i['body'];
$private = (($i['item_private']) || intval($i['item_obscured']));
if(array_key_exists('item', $params)) {
require_once('include/conversation.php');
// if it's a normal item...
if (array_key_exists('verb', $params['item'])) {
// localize_item() alters the original item so make a copy first
$i = $params['item'];
logger('calling localize');
localize_item($i);
$title = $i['title'];
$body = $i['body'];
$private = (($i['item_private']) || intval($i['item_obscured']));
}
else {
$title = $params['item']['title'];
$body = $params['item']['body'];
}
}
else {
$title = $params['item']['title'];
$body = $params['item']['body'];
$title = $body = '';
}
} else {
$title = $body = '';
}
// e.g. "your post", "David's photo", etc.
@ -424,7 +428,7 @@ function notification($params) {
// wretched hack, but we don't want to duplicate all the preamble variations and we also don't want to screw up a translation
if ((App::$language === 'en' || (! App::$language)) && strpos($msg,', '))
if ((\App::$language === 'en' || (! \App::$language)) && strpos($msg,', '))
$msg = substr($msg,strpos($msg,', ')+1);
$r = q("update notify set msg = '%s' where id = %d and uid = %d",
@ -441,7 +445,7 @@ function notification($params) {
logger('notification: sending notification email');
$hn = get_pconfig($recip['channel_id'],'system','email_notify_host');
if($hn && (! stristr(App::get_hostname(),$hn))) {
if($hn && (! stristr(\App::get_hostname(),$hn))) {
// this isn't the email notification host
pop_lang();
return;
@ -455,7 +459,7 @@ function notification($params) {
// use $_SESSION['zid_override'] to force zid() to use
// the recipient address instead of the current observer
$_SESSION['zid_override'] = $recip['channel_address'] . '@' . App::get_hostname();
$_SESSION['zid_override'] = $recip['channel_address'] . '@' . \App::get_hostname();
$_SESSION['zrl_override'] = z_root() . '/channel/' . $recip['channel_address'];
$textversion = zidify_links($textversion);
@ -529,7 +533,7 @@ function notification($params) {
$tpl = get_markup_template('email_notify_html.tpl');
$email_html_body = replace_macros($tpl,array(
'$banner' => $datarray['banner'],
'$notify_icon' => Zotlabs\Lib\System::get_notify_icon(),
'$notify_icon' => \Zotlabs\Lib\System::get_notify_icon(),
'$product' => $datarray['product'],
'$preamble' => $datarray['preamble'],
'$sitename' => $datarray['sitename'],
@ -570,7 +574,7 @@ function notification($params) {
// use the EmailNotification library to send the message
enotify::send(array(
self::send(array(
'fromName' => $sender_name,
'fromEmail' => $sender_email,
'replyTo' => $sender_email,
@ -587,12 +591,6 @@ function notification($params) {
}
/**
* @brief A class for sending email notifications.
*
* @fixme Class names start mostly with capital letter to distinguish them easier.
*/
class enotify {
/**
* @brief Send a multipart/alternative message with Text and HTML versions.
*
@ -649,4 +647,39 @@ class enotify {
);
logger("notification: enotify::send returns " . $res, LOGGER_DEBUG);
}
static public function format($item) {
$ret = '';
require_once('include/conversation.php');
// Call localize_item with the "brief" flag to get a one line status for activities.
// This should set $item['localized'] to indicate we have a brief summary.
localize_item($item);
if($item_localize) {
$itemem_text = $item['localize'];
}
else {
$itemem_text = (($item['item_thread_top'])
? t('created a new post')
: sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name']));
}
// convert this logic into a json array just like the system notifications
return array(
'notify_link' => $item['llink'],
'name' => $item['author']['xchan_name'],
'url' => $item['author']['xchan_url'],
'photo' => $item['author']['xchan_photo_s'],
'when' => relative_date($item['created']),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
'message' => strip_tags(bbcode($itemem_text))
);
}
}

View file

@ -53,13 +53,13 @@ class Acl extends \Zotlabs\Web\Controller {
if ($type=='' || $type=='g'){
$r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`
$r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`gname`
FROM `groups`,`group_member`
WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d
AND `group_member`.`gid`=`groups`.`id`
$sql_extra
GROUP BY `groups`.`id`
ORDER BY `groups`.`name`
ORDER BY `groups`.`gname`
LIMIT %d OFFSET %d",
intval(local_channel()),
intval($count),
@ -67,11 +67,11 @@ class Acl extends \Zotlabs\Web\Controller {
);
foreach($r as $g){
// logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id']));
// logger('acl: group: ' . $g['gname'] . ' members: ' . group_get_members_xchan($g['id']));
$groups[] = array(
"type" => "g",
"photo" => "images/twopeople.png",
"name" => $g['name'],
"name" => $g['gname'],
"id" => $g['id'],
"xid" => $g['hash'],
"uids" => group_get_members_xchan($g['id']),

View file

@ -1291,7 +1291,7 @@ class Admin extends \Zotlabs\Web\Controller {
$admin_form = '';
$r = q("select * from addon where plugin_admin = 1 and name = '%s' limit 1",
$r = q("select * from addon where plugin_admin = 1 and aname = '%s' limit 1",
dbesc($plugin)
);
@ -1421,13 +1421,15 @@ class Admin extends \Zotlabs\Web\Controller {
function listAddonRepos() {
$addonrepos = [];
$addonDir = __DIR__ . '/../../extend/addon/';
if ($handle = opendir($addonDir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$addonrepos[] = $entry;
if(is_dir($addonDir)) {
if ($handle = opendir($addonDir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$addonrepos[] = $entry;
}
}
closedir($handle);
}
closedir($handle);
}
return $addonrepos;
}

View file

@ -107,7 +107,7 @@ class Api extends \Zotlabs\Web\Controller {
$r = q("SELECT `clients`.*
FROM `clients`, `tokens`
WHERE `clients`.`client_id`=`tokens`.`client_id`
AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'",
AND `tokens`.`id`='%s' AND `tokens`.`auth_scope`='request'",
dbesc($token));
if (!count($r))

View file

@ -243,7 +243,7 @@ class Chat extends \Zotlabs\Web\Controller {
$rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']);
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array(
'$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['name']),
'$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['fullname']),
'$name' => t('Name'),
'$baseurl' => z_root(),
'$nickname' => \App::$profile['channel_address'],

View file

@ -100,9 +100,12 @@ class Cloud extends \Zotlabs\Web\Controller {
// require_once('\Zotlabs\Storage/QuotaPlugin.php');
// $server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth));
ob_start();
// All we need to do now, is to fire up the server
$server->exec();
ob_end_flush();
killme();
}

View file

@ -230,7 +230,7 @@ class Connedit extends \Zotlabs\Web\Controller {
if(\App::$poi && \App::$poi['abook_my_perms'] != $abook_my_perms
&& (! intval(\App::$poi['abook_self']))) {
\Zotlabs\Daemon\Master(array('Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id));
\Zotlabs\Daemon\Master::Summon(array('Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id));
}
if($new_friend) {

View file

@ -41,10 +41,10 @@ class Contactgroup extends \Zotlabs\Web\Controller {
if($change) {
if(in_array($change,$preselected)) {
group_rmv_member(local_channel(),$group['name'],$change);
group_rmv_member(local_channel(),$group['gname'],$change);
}
else {
group_add_member(local_channel(),$group['name'],$change);
group_add_member(local_channel(),$group['gname'],$change);
}
}
}

View file

@ -341,7 +341,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
}
}
cover_photo_crop_ui_head($a, $ph, $hash, $smallest);
$this->cover_photo_crop_ui_head($a, $ph, $hash, $smallest);
}

View file

@ -171,7 +171,7 @@ class Events extends \Zotlabs\Web\Controller {
foreach($cats as $cat) {
$post_tags[] = array(
'uid' => $profile_uid,
'type' => TERM_CATEGORY,
'ttype' => TERM_CATEGORY,
'otype' => TERM_OBJ_POST,
'term' => trim($cat),
'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat))
@ -232,7 +232,7 @@ class Events extends \Zotlabs\Web\Controller {
}
if($share)
\Zotlabs\Daemon\Master(array('Notifier','event',$item_id));
\Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id));
}

View file

@ -39,7 +39,7 @@ class Filer extends \Zotlabs\Web\Controller {
}
else {
$filetags = array();
$r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
$r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc",
intval(local_channel()),
intval(TERM_FILE)
);

View file

@ -22,7 +22,7 @@ class Filerm extends \Zotlabs\Web\Controller {
logger('filerm: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term)) {
$r = q("delete from term where uid = %d and type = %d and oid = %d and term = '%s'",
$r = q("delete from term where uid = %d and ttype = %d and oid = %d and term = '%s'",
intval(local_channel()),
intval(($category) ? TERM_CATEGORY : TERM_FILE),
intval($item_id),

View file

@ -1,117 +0,0 @@
<?php
namespace Zotlabs\Module;
class Fsuggest extends \Zotlabs\Web\Controller {
function post() {
if(! local_channel()) {
return;
}
if(\App::$argc != 2)
return;
$contact_id = intval(\App::$argv[1]);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval(local_channel())
);
if(! count($r)) {
notice( t('Contact not found.') . EOL);
return;
}
$contact = $r[0];
$new_contact = intval($_POST['suggest']);
$hash = random_string();
$note = escape_tags(trim($_POST['note']));
if($new_contact) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($new_contact),
intval(local_channel())
);
if(count($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
intval(local_channel()),
intval($contact_id),
dbesc($r[0]['name']),
dbesc($r[0]['url']),
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc(datetime_convert())
);
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
dbesc($hash),
intval(local_channel())
);
if(count($r)) {
$fsuggest_id = $r[0]['id'];
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($note),
intval($fsuggest_id),
intval(local_channel())
);
\Zotlabs\Daemon\Master::Summon(array('Notifier', 'suggest' , $fsuggest_id));
}
info( t('Friend suggestion sent.') . EOL);
}
}
}
function get() {
require_once('include/acl_selectors.php');
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
if(\App::$argc != 2)
return;
$contact_id = intval(\App::$argv[1]);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval(local_channel())
);
if(! count($r)) {
notice( t('Contact not found.') . EOL);
return;
}
$contact = $r[0];
$o = '<h3>' . t('Suggest Friends') . '</h3>';
$o .= '<div id="fsuggest-desc" >' . sprintf( t('Suggest a friend for %s'), $contact['name']) . '</div>';
$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
// FIXME contact_selector deprecated, removed
// $o .= contact_selector('suggest','suggest-select', false,
// array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));
$o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>';
$o .= '</form>';
return $o;
}
}

View file

@ -47,8 +47,8 @@ class Group extends \Zotlabs\Web\Controller {
$groupname = notags(trim($_POST['groupname']));
$public = intval($_POST['public']);
if((strlen($groupname)) && (($groupname != $group['name']) || ($public != $group['visible']))) {
$r = q("UPDATE `groups` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d",
if((strlen($groupname)) && (($groupname != $group['gname']) || ($public != $group['visible']))) {
$r = q("UPDATE `groups` SET `gname` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d",
dbesc($groupname),
intval($public),
intval(local_channel()),
@ -106,7 +106,7 @@ class Group extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r)
$result = group_rmv(local_channel(),$r[0]['name']);
$result = group_rmv(local_channel(),$r[0]['gname']);
if($result)
info( t('Privacy group removed.') . EOL);
else
@ -156,10 +156,10 @@ class Group extends \Zotlabs\Web\Controller {
if($change) {
if(in_array($change,$preselected)) {
group_rmv_member(local_channel(),$group['name'],$change);
group_rmv_member(local_channel(),$group['gname'],$change);
}
else {
group_add_member(local_channel(),$group['name'],$change);
group_add_member(local_channel(),$group['gname'],$change);
}
$members = group_get_members($group['id']);
@ -181,7 +181,7 @@ class Group extends \Zotlabs\Web\Controller {
$context = $context + array(
'$title' => t('Privacy group editor'),
'$gname' => array('groupname',t('Privacy group name: '),$group['name'], ''),
'$gname' => array('groupname',t('Privacy group name: '),$group['gname'], ''),
'$gid' => $group['id'],
'$drop' => $drop_txt,
'$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''),
@ -209,7 +209,7 @@ class Group extends \Zotlabs\Web\Controller {
$groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode);
}
else
group_rmv_member(local_channel(),$group['name'],$member['xchan_hash']);
group_rmv_member(local_channel(),$group['gname'],$member['xchan_hash']);
}
$r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_self = 0 and abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc",

View file

@ -408,6 +408,10 @@ class Import extends \Zotlabs\Web\Controller {
$saved = array();
foreach($groups as $group) {
$saved[$group['hash']] = array('old' => $group['id']);
if(array_key_exists('name',$group)) {
$group['gname'] = $group['name'];
unset($group['name']);
}
unset($group['id']);
$group['uid'] = $channel['channel_id'];
dbesc_array($group);

View file

@ -17,10 +17,10 @@ namespace Zotlabs\Module;
*/
require_once('include/crypto.php');
require_once('include/enotify.php');
require_once('include/items.php');
require_once('include/attach.php');
use \Zotlabs\Lib as Zlib;
class Item extends \Zotlabs\Web\Controller {
@ -581,7 +581,7 @@ class Item extends \Zotlabs\Web\Controller {
if($success['replaced']) {
$post_tags[] = array(
'uid' => $profile_uid,
'type' => $success['termtype'],
'ttype' => $success['termtype'],
'otype' => TERM_OBJ_POST,
'term' => $success['term'],
'url' => $success['url']
@ -666,7 +666,7 @@ class Item extends \Zotlabs\Web\Controller {
foreach($cats as $cat) {
$post_tags[] = array(
'uid' => $profile_uid,
'type' => TERM_CATEGORY,
'ttype' => TERM_CATEGORY,
'otype' => TERM_OBJ_POST,
'term' => trim($cat),
'url' => $owner_xchan['xchan_url'] . '?f=&cat=' . urlencode(trim($cat))
@ -676,7 +676,7 @@ class Item extends \Zotlabs\Web\Controller {
if($orig_post) {
// preserve original tags
$t = q("select * from term where oid = %d and otype = %d and uid = %d and type in ( %d, %d, %d )",
$t = q("select * from term where oid = %d and otype = %d and uid = %d and ttype in ( %d, %d, %d )",
intval($orig_post['id']),
intval(TERM_OBJ_POST),
intval($profile_uid),
@ -688,7 +688,7 @@ class Item extends \Zotlabs\Web\Controller {
foreach($t as $t1) {
$post_tags[] = array(
'uid' => $profile_uid,
'type' => $t1['type'],
'ttype' => $t1['type'],
'otype' => TERM_OBJ_POST,
'term' => $t1['term'],
'url' => $t1['url'],
@ -925,7 +925,7 @@ class Item extends \Zotlabs\Web\Controller {
// otherwise it will happen during delivery
if(($datarray['owner_xchan'] != $datarray['author_xchan']) && (intval($parent_item['item_wall']))) {
notification(array(
Zlib\Enotify::submit(array(
'type' => NOTIFY_COMMENT,
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
@ -943,7 +943,7 @@ class Item extends \Zotlabs\Web\Controller {
$parent = $post_id;
if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($datarray['item_type'] == ITEM_TYPE_POST)) {
notification(array(
Zlib\Enotify::submit(array(
'type' => NOTIFY_WALL,
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],

View file

@ -88,10 +88,10 @@ class Lockview extends \Zotlabs\Web\Controller {
stringify_array_elms($deny_users,true);
if(count($allowed_groups)) {
$r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )");
$r = q("SELECT gname FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )");
if($r)
foreach($r as $rr)
$l[] = '<li><b>' . $rr['name'] . '</b></li>';
$l[] = '<li><b>' . $rr['gname'] . '</b></li>';
}
if(count($allowed_users)) {
$r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ',$allowed_users) . " )");
@ -100,10 +100,10 @@ class Lockview extends \Zotlabs\Web\Controller {
$l[] = '<li>' . $rr['xchan_name'] . '</li>';
}
if(count($deny_groups)) {
$r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )");
$r = q("SELECT gname FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )");
if($r)
foreach($r as $rr)
$l[] = '<li><b><strike>' . $rr['name'] . '</strike></b></li>';
$l[] = '<li><b><strike>' . $rr['gname'] . '</strike></b></li>';
}
if(count($deny_users)) {
$r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ', $deny_users) . " )");

View file

@ -223,7 +223,7 @@ class Network extends \Zotlabs\Web\Controller {
if($x) {
$title = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Privacy group: ') . $x['name']
'$title' => t('Privacy group: ') . $x['gname']
));
}

View file

@ -440,7 +440,7 @@ class Photos extends \Zotlabs\Web\Controller {
if($success['replaced']) {
$post_tags[] = array(
'uid' => $profile_uid,
'type' => $success['termtype'],
'ttype' => $success['termtype'],
'otype' => TERM_OBJ_POST,
'term' => $success['term'],
'url' => $success['url']

View file

@ -1,12 +1,13 @@
<?php
namespace Zotlabs\Module;
/**
* @file mod/ping.php
*
*/
require_once('include/bbcode.php');
require_once('include/notify.php');
/**
* @brief do several updates when pinged.
@ -285,7 +286,7 @@ class Ping extends \Zotlabs\Web\Controller {
foreach($r as $item) {
if((argv(1) === 'home') && (! intval($item['item_wall'])))
continue;
$result[] = format_notification($item);
$result[] = \Zotlabs\Lib\Enotify::format($item);
}
}
// logger('ping (network||home): ' . print_r($result, true), LOGGER_DATA);

View file

@ -67,16 +67,16 @@ class Profiles extends \Zotlabs\Web\Controller {
$name = t('Profile-') . ($num_profiles + 1);
$r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1",
$r1 = q("SELECT `fullname`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1",
intval(local_channel()));
$r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `name`, `photo`, `thumb`)
$r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `fullname`, `photo`, `thumb`)
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s' )",
intval(get_account_id()),
intval(local_channel()),
dbesc(random_string()),
dbesc($name),
dbesc($r1[0]['name']),
dbesc($r1[0]['fullname']),
dbesc($r1[0]['photo']),
dbesc($r1[0]['thumb'])
);
@ -277,14 +277,14 @@ class Profiles extends \Zotlabs\Web\Controller {
$name = escape_tags(trim($_POST['name']));
if($orig[0]['name'] != $name) {
if($orig[0]['fullname'] != $name) {
$namechanged = true;
$v = validate_channelname($name);
if($v) {
notice($v);
$namechanged = false;
$name = $orig[0]['name'];
$name = $orig[0]['fullname'];
}
}
@ -350,7 +350,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$withchanged = false;
if(strlen($with)) {
if($with != strip_tags($orig[0]['with'])) {
if($with != strip_tags($orig[0]['partner'])) {
$withchanged = true;
$prf = '';
$lookup = $with;
@ -382,7 +382,7 @@ class Profiles extends \Zotlabs\Web\Controller {
}
}
else
$with = $orig[0]['with'];
$with = $orig[0]['partner'];
}
$profile_fields_basic = get_profile_fields_basic();
@ -439,7 +439,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$changes[] = t('Dislikes');
$value = $dislikes;
}
if($work != $orig[0]['work']) {
if($work != $orig[0]['employment']) {
$changes[] = t('Work/Employment');
}
if($religion != $orig[0]['religion']) {
@ -486,7 +486,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$r = q("UPDATE `profile`
SET `profile_name` = '%s',
`name` = '%s',
`fullname` = '%s',
`pdesc` = '%s',
`gender` = '%s',
`dob` = '%s',
@ -496,7 +496,7 @@ class Profiles extends \Zotlabs\Web\Controller {
`postal_code` = '%s',
`country_name` = '%s',
`marital` = '%s',
`with` = '%s',
`partner` = '%s',
`howlong` = '%s',
`sexual` = '%s',
`homepage` = '%s',
@ -515,7 +515,7 @@ class Profiles extends \Zotlabs\Web\Controller {
`tv` = '%s',
`film` = '%s',
`romance` = '%s',
`work` = '%s',
`employment` = '%s',
`education` = '%s',
`hide_friends` = %d
WHERE `id` = %d AND `uid` = %d",
@ -591,7 +591,7 @@ class Profiles extends \Zotlabs\Web\Controller {
}
function get() {
function get() {
$o = '';
@ -627,8 +627,6 @@ class Profiles extends \Zotlabs\Web\Controller {
}
$editselect = 'none';
// if(feature_enabled(local_channel(),'richtext'))
// $editselect = 'textareas';
\App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => z_root(),
@ -712,7 +710,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$is_default' => $is_default,
'$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])),
'$advanced' => $advanced,
'$name' => array('name', t('Your full name'), $r[0]['name'], t('Required'), '*'),
'$name' => array('name', t('Your full name'), $r[0]['fullname'], t('Required'), '*'),
'$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']),
'$dob' => dob($r[0]['dob']),
'$hide_friends' => $hide_friends,
@ -725,7 +723,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$gender_min' => gender_selector_min($r[0]['gender']),
'$marital' => marital_selector($r[0]['marital']),
'$marital_min' => marital_selector_min($r[0]['marital']),
'$with' => array('with', t("Who (if applicable)"), $r[0]['with'], t('Examples: cathy123, Cathy Williams, cathy@example.com')),
'$with' => array('with', t("Who (if applicable)"), $r[0]['partner'], t('Examples: cathy123, Cathy Williams, cathy@example.com')),
'$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
'$sexual' => sexpref_selector($r[0]['sexual']),
'$sexual_min' => sexpref_selector_min($r[0]['sexual']),
@ -743,7 +741,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']),
'$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']),
'$romance' => array('romance',t('Love/Romance'), $r[0]['romance']),
'$work' => array('work', t('Work/Employment'), $r[0]['work']),
'$work' => array('work', t('Work/Employment'), $r[0]['employment']),
'$education' => array('education', t('School/Education'), $r[0]['education']),
'$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']),
'$channels' => array('channels', t('My other channels'), $r[0]['channels']),
@ -759,7 +757,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_channel());
if(count($r)) {
if($r) {
$tpl = get_markup_template('profile_entry.tpl');
foreach($r as $rr) {
@ -782,9 +780,6 @@ class Profiles extends \Zotlabs\Web\Controller {
'$profiles' => $profiles
));
}
return $o;
}

View file

@ -28,9 +28,10 @@ class Pubsites extends \Zotlabs\Web\Controller {
if($ret['success']) {
$j = json_decode($ret['body'],true);
if($j) {
$o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Software') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>';
$o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Stats') . '</td><td>' . t('Software') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>';
if($j['sites']) {
foreach($j['sites'] as $jj) {
$m = parse_url($jj['url']);
if(strpos($jj['project'],\Zotlabs\Lib\System::get_platform_name()) === false)
continue;
$host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3));
@ -43,7 +44,7 @@ class Pubsites extends \Zotlabs\Web\Controller {
$location = '<br />&nbsp;';
}
$urltext = str_replace(array('https://'), '', $jj['url']);
$o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . ucwords($jj['project']) . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>';
$o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>';
}
}

View file

@ -79,7 +79,7 @@ class Search extends \Zotlabs\Web\Controller {
return $o;
if($tag) {
$sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and type in ( %d , %d) and term = '%s') ",
$sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and ttype in ( %d , %d) and term = '%s') ",
intval(TERM_OBJ_POST),
intval(TERM_HASHTAG),
intval(TERM_COMMUNITYTAG),

View file

@ -46,7 +46,7 @@ class Search_ac extends \Zotlabs\Web\Controller {
}
}
$r = q("select distinct term, tid, url from term where type in ( %d, %d ) $tag_sql_extra group by term order by term asc",
$r = q("select distinct term, tid, url from term where ttype in ( %d, %d ) $tag_sql_extra group by term order by term asc",
intval(TERM_HASHTAG),
intval(TERM_COMMUNITYTAG)
);

View file

@ -78,7 +78,7 @@ class Settings extends \Zotlabs\Web\Controller {
$r = q("UPDATE clients SET
client_id='%s',
pw='%s',
name='%s',
clname='%s',
redirect_uri='%s',
icon='%s',
uid=%d
@ -91,7 +91,7 @@ class Settings extends \Zotlabs\Web\Controller {
intval(local_channel()),
dbesc($key));
} else {
$r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
$r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
VALUES ('%s','%s','%s','%s','%s',%d)",
dbesc($key),
dbesc($secret),
@ -337,7 +337,7 @@ class Settings extends \Zotlabs\Web\Controller {
}
$hide_presence = 1 - (intval($role_permissions['online']));
if($role_permissions['default_collection']) {
$r = q("select hash from groups where uid = %d and name = '%s' limit 1",
$r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
intval(local_channel()),
dbesc( t('Friends') )
);
@ -345,7 +345,7 @@ class Settings extends \Zotlabs\Web\Controller {
require_once('include/group.php');
group_add(local_channel(), t('Friends'));
group_add_member(local_channel(),t('Friends'),$channel['channel_hash']);
$r = q("select hash from groups where uid = %d and name = '%s' limit 1",
$r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
intval(local_channel()),
dbesc( t('Friends') )
);
@ -537,7 +537,7 @@ class Settings extends \Zotlabs\Web\Controller {
dbesc(datetime_convert()),
dbesc($channel['channel_hash'])
);
$r = q("update profile set name = '%s' where uid = %d and is_default = 1",
$r = q("update profile set fullname = '%s' where uid = %d and is_default = 1",
dbesc($username),
intval($channel['channel_id'])
);
@ -562,7 +562,7 @@ class Settings extends \Zotlabs\Web\Controller {
function get() {
function get() {
$o = '';
nav_set_selected('settings');
@ -615,7 +615,7 @@ class Settings extends \Zotlabs\Web\Controller {
'$title' => t('Add application'),
'$submit' => t('Update'),
'$cancel' => t('Cancel'),
'$name' => array('name', t('Name'), $app['name'] , ''),
'$name' => array('name', t('Name'), $app['clname'] , ''),
'$key' => array('key', t('Consumer Key'), $app['client_id'], ''),
'$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''),
'$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''),

View file

@ -12,7 +12,6 @@ namespace Zotlabs\Module;
/**
* @brief Initialisation for the setup module.
*
* @param[in,out] App &$a
*/
class Setup extends \Zotlabs\Web\Controller {
@ -54,16 +53,15 @@ class Setup extends \Zotlabs\Web\Controller {
/**
* @brief Handle the actions of the different setup steps.
*
* @param[in,out] App &$a
*/
function post() {
global $db;
function post() {
switch($this->install_wizard_pass) {
case 1:
case 2:
return;
break; // just in case return don't return :)
// implied break;
case 3:
$urlpath = \App::get_path();
$dbhost = trim($_POST['dbhost']);
@ -82,39 +80,15 @@ class Setup extends \Zotlabs\Web\Controller {
$siteurl = rtrim($siteurl,'/');
require_once('include/dba/dba_driver.php');
unset($db);
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
if(! $db->connected) {
echo 'Database Connect failed: ' . $db->error;
$db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
if(! \DBA::$dba->connected) {
echo 'Database Connect failed: ' . DBA::$dba->error;
killme();
\App::$data['db_conn_failed']=true;
}
/*if(get_db_errno()) {
unset($db);
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true);
if(! get_db_errno()) {
$r = q("CREATE DATABASE '%s'",
dbesc($dbdata)
);
if($r) {
unset($db);
$db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
} else {
\App::$data['db_create_failed']=true;
}
} else {
\App::$data['db_conn_failed']=true;
return;
}
}*/
//if(get_db_errno()) {
//}
return;
break;
// implied break;
case 4:
$urlpath = \App::get_path();
$dbhost = notags(trim($_POST['dbhost']));
@ -138,10 +112,12 @@ class Setup extends \Zotlabs\Web\Controller {
}
}
// connect to db
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
if(! \DBA::$dba->connected) {
// connect to db
$db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
}
if(! $db->connected) {
if(! \DBA::$dba->connected) {
echo 'CRITICAL: DB not connected.';
killme();
}
@ -175,6 +151,8 @@ class Setup extends \Zotlabs\Web\Controller {
\App::$data['db_installed'] = true;
return;
// implied break;
default:
break;
}
}
@ -191,11 +169,10 @@ class Setup extends \Zotlabs\Web\Controller {
*
* Depending on the state we are currently in it returns different content.
*
* @param App &$a
* @return string parsed HTML output
*/
function get() {
global $db;
function get() {
$o = '';
$wizard_status = '';
@ -228,7 +205,7 @@ class Setup extends \Zotlabs\Web\Controller {
$txt .= "<pre>".\App::$data['db_failed'] . "</pre>". EOL ;
$db_return_text .= $txt;
}
if($db && $db->connected) {
if(\DBA::$dba && \DBA::$dba->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `account`");
if($r && count($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
@ -407,8 +384,8 @@ class Setup extends \Zotlabs\Web\Controller {
function check_php(&$phpath, &$checks) {
$help = '';
if(version_compare(PHP_VERSION, '5.4') < 0) {
$help .= t('PHP version 5.4 or greater is required.');
if(version_compare(PHP_VERSION, '5.5') < 0) {
$help .= t('PHP version 5.5 or greater is required.');
$this->check_add($checks, t('PHP version'), false, false, $help);
}
@ -598,7 +575,7 @@ class Setup extends \Zotlabs\Web\Controller {
if(! is_writable(TEMPLATE_BUILD_PATH) ) {
$status = false;
$help = t('Red uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
$help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the Red top level folder.'), TEMPLATE_BUILD_PATH) . EOL;
$help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the top level web folder.'), TEMPLATE_BUILD_PATH) . EOL;
$help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
$help .= sprintf( t('Note: as a security measure, you should give the web server write access to %s only--not the template files (.tpl) that it contains.'), TEMPLATE_BUILD_PATH) . EOL;
}
@ -698,12 +675,12 @@ class Setup extends \Zotlabs\Web\Controller {
function load_database($db) {
$str = file_get_contents($db->get_install_script());
$str = file_get_contents(\DBA::$dba->get_install_script());
$arr = explode(';',$str);
$errors = false;
foreach($arr as $a) {
if(strlen(trim($a))) {
$r = @$db->q(trim($a));
$r = dbq(trim($a));
if(! $r) {
$errors .= t('Errors encountered creating database tables.') . $a . EOL;
}

View file

@ -54,7 +54,7 @@ class Tagrm extends \Zotlabs\Web\Controller {
function get() {
function get() {
if(! local_channel()) {
goaway(z_root() . '/' . $_SESSION['photo_return']);

View file

@ -256,6 +256,7 @@ class Browser extends DAV\Browser\Plugin {
$func($a);
}
}
$this->server->httpResponse->setHeader('Content-Security-Policy', "script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'");
construct_page($a);
}

View file

@ -18,10 +18,10 @@ class SessionHandler implements \SessionHandlerInterface {
function read ($id) {
if($id) {
$r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
$r = q("SELECT `sess_data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
if($r) {
return $r[0]['data'];
return $r[0]['sess_data'];
}
else {
q("INSERT INTO `session` (sid, expire) values ('%s', '%s')",
@ -59,7 +59,7 @@ class SessionHandler implements \SessionHandlerInterface {
}
q("UPDATE `session`
SET `data` = '%s', `expire` = '%s' WHERE `sid` = '%s'",
SET `sess_data` = '%s', `expire` = '%s' WHERE `sid` = '%s'",
dbesc($data),
dbesc($expire),
dbesc($id)

130
Zotlabs/Web/WebServer.php Normal file
View file

@ -0,0 +1,130 @@
<?php /** @file */
namespace Zotlabs\Web;
class WebServer {
public function run() {
/*
* Bootstrap the application, load configuration, load modules, load theme, etc.
*/
require_once('boot.php');
sys_boot();
\App::$language = get_best_language();
load_translation_table(\App::$language,\App::$install);
/**
*
* Important stuff we always need to do.
*
* The order of these may be important so use caution if you think they're all
* intertwingled with no logical order and decide to sort it out. Some of the
* dependencies have changed, but at least at one time in the recent past - the
* order was critical to everything working properly
*
*/
if(\App::$session) {
\App::$session->start();
}
else {
session_start();
register_shutdown_function('session_write_close');
}
/**
* Language was set earlier, but we can over-ride it in the session.
* We have to do it here because the session was just now opened.
*/
if(array_key_exists('system_language',$_POST)) {
if(strlen($_POST['system_language']))
$_SESSION['language'] = $_POST['system_language'];
else
unset($_SESSION['language']);
}
if((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
\App::$language = $_SESSION['language'];
load_translation_table(\App::$language);
}
if((x($_GET,'zid')) && (! \App::$install)) {
\App::$query_string = strip_zids(\App::$query_string);
if(! local_channel()) {
$_SESSION['my_address'] = $_GET['zid'];
zid_init($a);
}
}
if((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (\App::$module === 'login'))
require('include/auth.php');
if(! x($_SESSION, 'sysmsg'))
$_SESSION['sysmsg'] = array();
if(! x($_SESSION, 'sysmsg_info'))
$_SESSION['sysmsg_info'] = array();
/*
* check_config() is responsible for running update scripts. These automatically
* update the DB schema whenever we push a new one out. It also checks to see if
* any plugins have been added or removed and reacts accordingly.
*/
if(\App::$install) {
/* Allow an exception for the view module so that pcss will be interpreted during installation */
if(\App::$module != 'view')
\App::$module = 'setup';
}
else
check_config($a);
nav_set_selected('nothing');
$Router = new Router($a);
/* initialise content region */
if(! x(\App::$page, 'content'))
\App::$page['content'] = '';
call_hooks('page_content_top', \App::$page['content']);
$Router->Dispatch($a);
// If you're just visiting, let javascript take you home
if(x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
} elseif(local_channel()) {
$homebase = z_root() . '/channel/' . \App::$channel['channel_address'];
}
if(isset($homebase)) {
\App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
// now that we've been through the module content, see if the page reported
// a permission problem and if so, a 403 response would seem to be in order.
if(stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
}
call_hooks('page_end', \App::$page['content']);
construct_page($a);
killme();
}
}

View file

@ -112,12 +112,12 @@ class Finger {
if($signed_token) {
$valid = rsa_verify('token.' . self::$token,base64url_decode($signed_token),$x['key']);
if(! $valid) {
logger('invalid signed token: ' . $url . $rhs, LOGGER_NORMAL, LOG_WARN);
logger('invalid signed token: ' . $url . $rhs, LOGGER_NORMAL, LOG_ERR);
return $ret;
}
}
else {
logger('No signed token from ' . $url . $rhs, LOGGER_NORMAL, LOG_WARN);
logger('No signed token from ' . $url . $rhs, LOGGER_NORMAL, LOG_WARNING);
// after 2017-01-01 this will be a hard error unless you over-ride it.
if((time() > 1483228800) && (! get_config('system','allow_unsigned_zotfinger')))
return $ret;

View file

@ -6,7 +6,7 @@ namespace Zotlabs\Zot;
class Verify {
function create($type,$channel_id,$token,$meta) {
return q("insert into verify ( type, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
return q("insert into verify ( vtype, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
dbesc($type),
intval($channel_id),
dbesc($token),
@ -16,7 +16,7 @@ class Verify {
}
function match($type,$channel_id,$token,$meta) {
$r = q("select id from verify where type = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
$r = q("select id from verify where vtype = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
dbesc($type),
intval($channel_id),
dbesc($token),
@ -32,7 +32,7 @@ class Verify {
}
function purge($type,$interval) {
q("delete from verify where type = '%s' and created < %s - INTERVAL %s",
q("delete from verify where vtype = '%s' and created < %s - INTERVAL %s",
dbesc($type),
db_utcnow(),
db_quoteinterval($interval)

156
boot.php
View file

@ -45,10 +45,10 @@ require_once('include/account.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '1.7.1' );
define ( 'STD_VERSION', '1.7.2' );
define ( 'ZOT_REVISION', 1.1 );
define ( 'DB_UPDATE_VERSION', 1168 );
define ( 'DB_UPDATE_VERSION', 1173 );
/**
@ -579,6 +579,72 @@ define ( 'ITEM_IS_STICKY', 1000 );
define ( 'DBTYPE_MYSQL', 0 );
define ( 'DBTYPE_POSTGRES', 1 );
function sys_boot() {
// our central App object
App::init();
/*
* Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode.
*/
// miniApp is a conversion object from old style .htconfig.php files
$a = new miniApp;
App::$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include('.htconfig.php');
if(! defined('UNO'))
define('UNO', 0);
if(array_key_exists('default_timezone',get_defined_vars())) {
App::$config['system']['timezone'] = $default_timezone;
}
$a->convert();
App::$timezone = ((App::$config['system']['timezone']) ? App::$config['system']['timezone'] : 'UTC');
date_default_timezone_set(App::$timezone);
/*
* Try to open the database;
*/
require_once('include/dba/dba_driver.php');
if(! App::$install) {
DBA::dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, App::$install);
if(! DBA::$dba->connected) {
system_unavailable();
}
unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
/**
* Load configs from db. Overwrite configs from .htconfig.php
*/
load_config('config');
load_config('system');
load_config('feature');
App::$session = new Zotlabs\Web\Session();
App::$session->init();
load_hooks();
call_hooks('init_1');
}
}
/**
*
* Reverse the effect of magic_quotes_gpc if it is enabled.
@ -625,7 +691,7 @@ function startup() {
class ZotlabsAutoloader {
static public function loader($className) {
$filename = str_replace('\\', '/', $className) . ".php";
if (file_exists($filename)) {
if(file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return TRUE;
@ -636,7 +702,7 @@ class ZotlabsAutoloader {
if(! $arr[0])
$arr = array_shift($arr);
$filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php");
if (file_exists($filename)) {
if(file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return TRUE;
@ -1197,7 +1263,6 @@ class App {
* @return App
*/
function get_app() {
global $a;
return $a;
}
@ -1247,7 +1312,6 @@ function system_unavailable() {
function clean_urls() {
global $a;
// if(App::$config['system']['clean_urls'])
return true;
@ -1255,8 +1319,6 @@ function clean_urls() {
}
function z_path() {
global $a;
$base = z_root();
if(! clean_urls())
$base .= '/?q=';
@ -1272,7 +1334,6 @@ function z_path() {
* @return string
*/
function z_root() {
global $a;
return App::get_baseurl();
}
@ -1461,11 +1522,11 @@ function check_config(&$a) {
if(count($installed)) {
foreach($installed as $i) {
if(! in_array($i['name'], $plugins_arr)) {
unload_plugin($i['name']);
if(! in_array($i['aname'], $plugins_arr)) {
unload_plugin($i['aname']);
}
else {
$installed_arr[] = $i['name'];
$installed_arr[] = $i['aname'];
}
}
}
@ -1604,7 +1665,6 @@ function fix_system_urls($oldurl, $newurl) {
// returns the complete html for inserting into the page
function login($register = false, $form_id = 'main-login', $hiddens=false) {
$a = get_app();
$o = '';
$reg = false;
$reglink = get_config('system', 'register_link');
@ -1674,9 +1734,7 @@ function goaway($s) {
}
function shutdown() {
global $db;
if(is_object($db) && $db->connected)
$db->close();
}
/**
@ -1710,7 +1768,9 @@ function get_account_id() {
* @return int|bool channel_id or false
*/
function local_channel() {
if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'uid')))
if(session_id()
&& array_key_exists('authenticated',$_SESSION) && $_SESSION['authenticated']
&& array_key_exists('uid',$_SESSION) && intval($_SESSION['uid']))
return intval($_SESSION['uid']);
return false;
@ -1741,7 +1801,9 @@ function local_user() {
* @return string|bool visitor_id or false
*/
function remote_channel() {
if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id')))
if(session_id()
&& array_key_exists('authenticated',$_SESSION) && $_SESSION['authenticated']
&& array_key_exists('visitor_id',$_SESSION) && $_SESSION['visitor_id'])
return $_SESSION['visitor_id'];
return false;
@ -1766,7 +1828,9 @@ function remote_user() {
* @param string $s Text to display
*/
function notice($s) {
$a = get_app();
if(! session_id())
return;
if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array();
// ignore duplicated error messages which haven't yet been displayed
@ -1790,8 +1854,10 @@ function notice($s) {
* @param string $s Text to display
*/
function info($s) {
$a = get_app();
if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array();
if(! session_id())
return;
if(! x($_SESSION, 'sysmsg_info'))
$_SESSION['sysmsg_info'] = array();
if(App::$interactive)
$_SESSION['sysmsg_info'][] = $s;
}
@ -1877,6 +1943,10 @@ function proc_run(){
* @brief Checks if we are running on M$ Windows.
*
* @return bool true if we run on M$ Windows
*
* It's possible you might be able to run on WAMP or XAMPP, and this
* has been accomplished, but is not officially supported. Good luck.
*
*/
function is_windows() {
return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false);
@ -1891,7 +1961,9 @@ function is_windows() {
*/
function is_site_admin() {
$a = get_app();
if(! session_id())
return false;
if($_SESSION['delegate'])
return false;
@ -1912,7 +1984,10 @@ function is_site_admin() {
* @return bool true if user is a developer
*/
function is_developer() {
$a = get_app();
if(! session_id())
return false;
if((intval($_SESSION['authenticated']))
&& (is_array(App::$account))
&& (App::$account['account_roles'] & ACCOUNT_ROLE_DEVELOPER))
@ -1923,7 +1998,6 @@ function is_developer() {
function load_contact_links($uid) {
$a = get_app();
$ret = array();
@ -1932,7 +2006,7 @@ function load_contact_links($uid) {
// logger('load_contact_links');
$r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ",
$r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ",
intval($uid)
);
if($r) {
@ -1955,6 +2029,7 @@ function load_contact_links($uid) {
*
* @return string
*/
function build_querystring($params, $name = null) {
$ret = '';
foreach($params as $key => $val) {
@ -1997,8 +2072,9 @@ function dba_timer() {
/**
* @brief Returns xchan_hash from the observer.
*
* @return string Empty if no observer, otherwise xchan_hash from observer
* @return empty string if no observer, otherwise xchan_hash from observer
*/
function get_observer_hash() {
$observer = App::get_observer();
if(is_array($observer))
@ -2055,8 +2131,6 @@ function load_pdl(&$a) {
App::$comanche = new Zotlabs\Render\Comanche();
// require_once('include/comanche.php');
if (! count(App::$layout)) {
$arr = array('module' => App::$module, 'layout' => '');
@ -2077,13 +2151,10 @@ function load_pdl(&$a) {
App::$pdl = $s;
}
}
}
function exec_pdl(&$a) {
// require_once('include/comanche.php');
if(App::$pdl) {
App::$comanche->parse(App::$pdl,1);
}
@ -2241,7 +2312,6 @@ function appdirpath() {
* @param string $icon
*/
function head_set_icon($icon) {
global $a;
App::$data['pageicon'] = $icon;
// logger('head_set_icon: ' . $icon);
@ -2253,7 +2323,6 @@ function head_set_icon($icon) {
* @return string absolut path to pageicon
*/
function head_get_icon() {
global $a;
$icon = App::$data['pageicon'];
if(! strpos($icon, '://'))
@ -2319,7 +2388,7 @@ function z_get_temp_dir() {
}
function z_check_cert() {
$a = get_app();
if(strpos(z_root(),'https://') !== false) {
$x = z_fetch_url(z_root() . '/siteinfo/json');
if(! $x['success']) {
@ -2340,8 +2409,6 @@ function z_check_cert() {
*/
function cert_bad_email() {
$a = get_app();
$email_tpl = get_intltext_template("cert_bad_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
'$sitename' => App::$config['system']['sitename'],
@ -2362,26 +2429,30 @@ function cert_bad_email() {
*/
function check_cron_broken() {
$t = get_config('system','lastpollcheck');
$d = get_config('system','lastcron');
if((! $d) || ($d < datetime_convert('UTC','UTC','now - 4 hours'))) {
Zotlabs\Daemon\Master::Summon(array('Cron'));
}
$t = get_config('system','lastcroncheck');
if(! $t) {
// never checked before. Start the timer.
set_config('system','lastpollcheck',datetime_convert());
set_config('system','lastcroncheck',datetime_convert());
return;
}
if($t > datetime_convert('UTC','UTC','now - 3 days')) {
// Wait for 3 days before we do anything so as not to swamp the admin with messages
return;
}
$d = get_config('system','lastpoll');
if(($d) && ($d > datetime_convert('UTC','UTC','now - 3 days'))) {
// Scheduled tasks have run successfully in the last 3 days.
set_config('system','lastpollcheck',datetime_convert());
set_config('system','lastcroncheck',datetime_convert());
return;
}
$a = get_app();
$email_tpl = get_intltext_template("cron_bad_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
'$sitename' => App::$config['system']['sitename'],
@ -2395,7 +2466,6 @@ function check_cron_broken() {
'From: Administrator' . '@' . App::get_hostname() . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit' );
set_config('system','lastpollcheck',datetime_convert());
return;
}

View file

@ -42,11 +42,11 @@ You MAY additionally provide other profile information. Any information which yo
Content you provide (status posts, photos, files, etc.) belongs to you. The $Projectname default is to publish content openly and visible to anybody on the internet (PUBLIC). You MAY control this in your channel settings and restrict the default permissions or you MAY restrict the visibility of any single published item separately (PRIVATE). $Projectname developers will ensure that restricted content is ONLY visible to those in the restriction list - to the best of their ability.
Content (especially status posts) that you share with other networks or that you have made visible to anybody on the internet (PUBLIC) cannot easily be taken back once it has been published. It MAY be shared with other networks and made available through RSS/Atom feeds. It may also be syndicated on other $Projectname sites. It MAY appear on spy networks and internet searches. If you do not wish this default behaviour please adjust your channel settings and restrict who can see your content.
Content (especially status posts) that you share with other networks or that you have made visible to anybody on the internet (PUBLIC) cannot easily be taken back once it has been published. It MAY be shared with other networks and made available through RSS/Atom feeds. It may also be syndicated on other $Projectname sites. It MAY appear on other networks and websites and be visible in internet searches. If you do not wish this default behaviour please adjust your channel settings and restrict who can see your content.
**Comments and Forum posts**
Comments to posts that were created by others and posts which are designated as forum posts belong to you as the creator/author, but the distribution of these posts is not under your direct control. These posts/comments MAY be re-distributed to others, and MAY be visible to anybody on the internet. In the case of comments, the creator of the "first message" in the thread to which you are replying controls the distribution of all comments and replies to that message.
Comments to posts that were created by others and posts which are designated as forum posts belong to you as the creator/author, but the distribution of these posts is not under your direct control, and you relinquish SOME rights to these items. These posts/comments MAY be re-distributed to others, and MAY be visible to anybody on the internet. In the case of comments, the creator of the "first message" in the thread (conversation) to which you are replying controls the distribution of all comments and replies to that message. They "own" and therefore have certain rights with regard to the entire conversation (including all comments contained within it). You can still edit or delete the comment, but the conversation owner also has rights to edit, delete, re-distribute, and backup/restore any or all the content from the conversation.
**Private Information**

View file

@ -5,11 +5,6 @@
Hubzilla Community Server is open source software which is maintained by "the community" - essentially unpaid volunteers.
[b]Hubzilla Enterprise Server[/b]
Hubzilla Enterprise Server is commercial software with a variety of support plans depending on the specific license terms.
The first thing you need to do is talk to your hub administrator - the person who runs and manages your site. They are in the unique position of having access to the internal software and database and [b]logfiles[/b] and will need to be involved in fixing your problem. Other people "on the net" can't really help with this. The first thing the hub administrator needs to do is look at their logs and/or try to reproduce the problem. So try to be as helpful and courteous as possible in helping them look into the problem.
To find your hub administrator (if you don't know who they are) please look at [url=[baseurl]/siteinfo]this page[/url]. If they have not provided any contact info on that page or provided an "Impressum" there, see [url=[baseurl]/siteinfo/json]this site info summary[/url] under the heading "admin:".
@ -24,13 +19,6 @@ If you get a blank white screen when doing something, this is almost always a co
[h3]I'm stumped. I can't figure out what is wrong.[/h3]
[b]Hubzilla Enterprise Server[/b]
Please make contact with the vendor - who will have provided you with support contact details. Preferably this contact will be made by the hub administrator so that he/she can assist us in collecting the necessary issue details. We will assign a ticket and notify you of progress.
[b]Hubzilla Community Server[/b]
At this point it might be worthwhile discussing the issue on one of the online forums. There may be several of these and some may be more suited to your spoken language. As a last resort, try "Channel One", which is in English.
If the community developers can't help you right away, understand that they are volunteers and may have a lot of other work and demands on their time. At this point you need to file a bug report. You will need an account on github.com to do this. So register, and then visit https://github.com/redmatrix/hubzilla/issues
@ -39,7 +27,5 @@ If the community developers can't help you right away, understand that they are
Then you wait. If it's a high profile issue, it may get fixed quickly. But nobody is in charge of fixing bugs. If it lingers without resolution, please spend some more time investigating the problem. Ask about anything you don't understand related to the behaviour. You will learn more about how the software works and quite possibly figure out why it isn't working now. Ultimately it is somebody in the community who is going to fix this and you are a member of the community; and this is how the open source process works.
[b]In either case[/b]
Other developers working to fix the problem may need to find out more, so do your homework and document what is happening and everything you've tried. Don't say "I did xyz and it didn't work." That doesn't tell us anything. Tell us precisely what steps you took and what you expected the result to be, and precisely what happened as a result. If there were any error messages, don't say "there was an error message". Tell us exactly what the message said.
Other developers working to fix the problem may need to find out more, so do your homework and document what is happening and everything you've tried. Don't say "I did xyz and it didn't work." That doesn't tell us anything. Tell us precisely what steps you took and what you expected the result to be, and precisely what happened as a result. If there were any error messages, don't say "there was an error message". Tell us exactly what the message said. Tell us what version you're running and any other details that may be unique about your site configuration.

View file

@ -26,9 +26,6 @@
[zrl=[baseurl]/help/git_for_non_developers]Git per a No-Desenvolupadors[/zrl]
[zrl=[baseurl]/help/dev_beginner]Manual pas-a-pas per a desenvolupadors principiants[/zrl]
[h3]Preguntes Més Freqüents (FAQ) Per Desenvolupadors[/h3]
[zrl=[baseurl]/help/faq_developers]FAQ Per Desenvoupadors[/zrl]
[h3]Recursos Externs[/h3]
[url=https://zothub.com/channel/one]Development Channel[/url]
[url=https://federated.social/channel/postgres]Postgres-specific $Projectname Admin Support Channel[/url]

View file

@ -25,9 +25,6 @@
[zrl=[baseurl]/help/git_for_non_developers]Git für Nicht-Entwickler[/zrl]
[zrl=[baseurl]/help/dev_beginner]Schritt-für-Schritt-Einführung für neue Entwickler[/zrl]
[h3]Häufig gestellte Fragen für Entwickler[/h3]
[zrl=[baseurl]/help/faq_developers]FAQ für Entwickler[/zrl]
[h3]Externe Ressourcen[/h3]
[url=https://zothub.com/channel/one]Entwickler-Kanal[/url]
[url=https://federated.social/channel/postgres]Postgres-spezifischer Admin-Support-Kanal[/url]

View file

@ -26,9 +26,6 @@
[zrl=[baseurl]/help/git_for_non_developers]Git for Non-Developers[/zrl]
[zrl=[baseurl]/help/dev_beginner]Step-for-step manual for beginning developers[/zrl]
[h3]Frequently Asked Questions For Developers[/h3]
[zrl=[baseurl]/help/faq_developers]FAQ For Developers[/zrl]
[h3]External Resources[/h3]
[url=https://zothub.com/channel/one]Development Channel[/url]
[url=https://federated.social/channel/postgres]Postgres-specific $Projectname Admin Support Channel[/url]

View file

@ -12,10 +12,6 @@ Returns authenticated numeric channel_id if authenticated and connected to a cha
Returns authenticated string hash of Red global identifier, if authenticated via remote auth, or an empty string.
[b]get_app()[/b]
Returns the global app structure ($a).
[b]App::get_observer()[/b]
returns an xchan structure representing the current viewer if authenticated (locally or remotely).

File diff suppressed because one or more lines are too long

View file

@ -67,9 +67,6 @@ Zot är en fantastisk ny kommunikationsprotokoll uppfunnit speciellt för $Proje
[zrl=[baseurl]/help/git_for_non_developers]Git for Non-Developers[/zrl]
[zrl=[baseurl]/help/dev_beginner]Sep-for-step manual for beginning developers[/zrl]
[h3]FAQ för utvecklare[/h3]
[zrl=[baseurl]/help/faq_developers]FAQ For Developers[/zrl]
[h3]Externa resurser[/h3]
[zrl=[baseurl]/help/external-resource-links]External Resource Links[/zrl]
[url=https://github.com/friendica/red]Main Website[/url]

View file

@ -6,7 +6,6 @@ require_once('include/follow.php');
require_once('include/photo/photo_driver.php');
function import_diaspora($data) {
$a = get_app();
$account = App::get_account();
if(! $account)

View file

@ -229,7 +229,7 @@ function verify_email_address($arr) {
$hash = random_string();
$r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
$r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($arr['account']['account_id']),
@ -283,7 +283,7 @@ function send_reg_approval_email($arr) {
$hash = random_string();
$r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
$r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($arr['account']['account_id']),
@ -387,7 +387,7 @@ function account_allow($hash) {
intval($register[0]['uid'])
);
push_lang($register[0]['language']);
push_lang($register[0]['lang']);
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
@ -656,7 +656,8 @@ function account_service_class_allows($aid, $property, $usage = false) {
* @todo Should we merge this with account_service_class_fetch()?
*/
function service_class_fetch($uid, $property) {
$a = get_app();
if($uid == local_channel()) {
$service_class = App::$account['account_service_class'];
}

View file

@ -11,13 +11,11 @@ require_once("include/PermissionDescription.php");
function group_select($selname,$selclass,$preselected = false,$size = 4) {
$a = get_app();
$o = '';
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
intval(local_channel())
);
@ -34,7 +32,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$selected = " selected=\"selected\" ";
else
$selected = '';
$trimmed = mb_substr($rr['name'],0,12);
$trimmed = mb_substr($rr['gname'],0,12);
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\r\n";
}
@ -51,7 +49,6 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
/* MicMee 20130114 function contact_selector no longer in use, sql table contact does no longer exist
function contact_selector($selname, $selclass, $preselected = false, $options) {
$a = get_app();
$mutual = false;
$networks = null;
@ -157,7 +154,6 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) {
$a = get_app();
$o = '';
@ -270,7 +266,6 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
$o = replace_macros($tpl, array(
'$showall' => $showall_caption,
'$onlyme' => t('Only me'),
'$add_others' => t('Add others'),
'$showallOrigin' => $showall_origin,
'$showallIcon' => $showall_icon,
'$select_label' => t('Who can see this?'),

View file

@ -1,7 +1,6 @@
<?php /** @file */
function profile_activity($changed, $value) {
$a = get_app();
if(! local_channel() || ! is_array($changed) || ! count($changed))
return;

View file

@ -368,7 +368,7 @@ require_once('include/api_auth.php');
else
$redirect = trim($_REQUEST['redirect_uris']);
$icon = trim($_REQUEST['logo_uri']);
$r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
$r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
VALUES ('%s','%s','%s','%s','%s',%d)",
dbesc($key),
dbesc($secret),
@ -451,8 +451,6 @@ require_once('include/api_auth.php');
*/
function api_apply_template($templatename, $type, $data){
$a = get_app();
switch($type){
case "atom":
case "rss":
@ -1904,7 +1902,6 @@ require_once('include/api_auth.php');
//logger('api_format_items: ' . print_r($user_info,true));
$a = get_app();
$ret = array();
if(! $r)

View file

@ -479,8 +479,6 @@ function unescape_underscores_in_links($m) {
function format_event_diaspora($ev) {
$a = get_app();
if(! ((is_array($ev)) && count($ev)))
return '';

View file

@ -168,7 +168,7 @@ function bb_parse_app($match) {
$app = Zotlabs\Lib\Apps::app_decode($match[1]);
if ($app)
return Zotlab\Lib\Apps::app_render($app);
return Zotlabs\Lib\Apps::app_render($app);
}
function bb_parse_element($match) {
@ -275,7 +275,6 @@ function bb_location($match) {
* @return string HTML iframe with content of $match[1]
*/
function bb_iframe($match) {
$a = get_app();
$sandbox = ((strpos($match[1], App::get_hostname())) ? ' sandbox="allow-scripts" ' : '');
@ -449,8 +448,6 @@ function bb_sanitize_style($input) {
function bb_observer($Text) {
$a = get_app();
$observer = App::get_observer();
if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) {
@ -480,9 +477,12 @@ function bb_observer($Text) {
return $Text;
}
function bb_code($match) {
if(strpos($match[0], "<br />"))
return '<code>' . trim($match[1]) . '</code>';
else
return '<code class="inline-code">' . trim($match[1]) . '</code>';
}
@ -788,12 +788,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $Text);
}
// Declare the format for [code] layout
$CodeLayout = '<code>$1</code>';
// Check for [code] text
if (strpos($Text,'[code]') !== false) {
$Text = preg_replace("/\[code\](.*?)\[\/code\]/ism", "$CodeLayout", $Text);
$Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text);
}
// Check for [spoiler] text
@ -984,6 +981,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
$Text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism",'',$Text);
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);

View file

@ -337,7 +337,7 @@ function create_identity($arr) {
// Not checking return value.
// It's ok for this to fail if it's an imported channel, and therefore the hash is a duplicate
$r = q("INSERT INTO profile ( aid, uid, profile_guid, profile_name, is_default, publish, name, photo, thumb)
$r = q("INSERT INTO profile ( aid, uid, profile_guid, profile_name, is_default, publish, fullname, photo, thumb)
VALUES ( %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s') ",
intval($ret['channel']['channel_account_id']),
intval($newuid),
@ -392,7 +392,7 @@ function create_identity($arr) {
// if our role_permissions indicate that we're using a default collection ACL, add it.
if(is_array($role_permissions) && $role_permissions['default_collection']) {
$r = q("select hash from groups where uid = %d and name = '%s' limit 1",
$r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
intval($newuid),
dbesc( t('Friends') )
);
@ -561,7 +561,7 @@ function identity_basic_export($channel_id, $items = false) {
// All other term types will be included in items, if requested.
$r = q("select * from term where type in (%d,%d) and uid = %d",
$r = q("select * from term where ttype in (%d,%d) and uid = %d",
intval(TERM_SAVEDSEARCH),
intval(TERM_THING),
intval($channel_id)
@ -1257,7 +1257,7 @@ function advanced_profile(&$a) {
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile'))
return '';
if(App::$profile['name']) {
if(App::$profile['fullname']) {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
@ -1281,7 +1281,7 @@ function advanced_profile(&$a) {
$profile = array();
$profile['fullname'] = array( t('Full Name:'), App::$profile['name'] ) ;
$profile['fullname'] = array( t('Full Name:'), App::$profile['fullname'] ) ;
if(App::$profile['gender']) $profile['gender'] = array( t('Gender:'), App::$profile['gender'] );
@ -1329,8 +1329,8 @@ function advanced_profile(&$a) {
if(App::$profile['marital'])
$profile['marital'] = array( t('Status:'), App::$profile['marital']);
if(App::$profile['with'])
$profile['marital']['with'] = bbcode(App::$profile['with']);
if(App::$profile['partner'])
$profile['marital']['partner'] = bbcode(App::$profile['partner']);
if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) {
$profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s'));
@ -1370,7 +1370,7 @@ function advanced_profile(&$a) {
if($txt = prepare_text(App::$profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt);
if($txt = prepare_text(App::$profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
if($txt = prepare_text(App::$profile['employment'])) $profile['employment'] = array( t('Work/employment:'), $txt);
if($txt = prepare_text(App::$profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
@ -1658,7 +1658,7 @@ function get_profile_fields_basic($filter = 0) {
$profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null);
if(! $profile_fields_basic)
$profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
$profile_fields_basic = array('fullname','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
$x = array();
if($profile_fields_basic)
@ -1673,7 +1673,7 @@ function get_profile_fields_advanced($filter = 0) {
$basic = get_profile_fields_basic($filter);
$profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null);
if(! $profile_fields_advanced)
$profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education');
$profile_fields_advanced = array('partner','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','employment','education');
$x = array();
if($basic)
@ -1945,3 +1945,26 @@ function get_zcard_embed($channel,$observer_hash = '',$args = array()) {
return $o;
}
function channelx_by_nick($nick) {
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and channel_removed = 0 LIMIT 1",
dbesc($nick)
);
return(($r) ? $r[0] : false);
}
function channelx_by_hash($hash) {
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and channel_removed = 0 LIMIT 1",
dbesc($hash)
);
return(($r) ? $r[0] : false);
}
function channelx_by_n($id) {
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and channel_removed = 0 LIMIT 1",
dbesc($id)
);
return(($r) ? $r[0] : false);
}

View file

@ -6,37 +6,7 @@ require_once('boot.php');
function cli_startup() {
global $a, $db, $default_timezone;
if(is_null($a)) {
$a = new miniApp;
}
App::init();
if(is_null($db)) {
@include(".htconfig.php");
$a->convert();
if(! defined('UNO'))
define('UNO', 0);
App::$timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set(App::$timezone);
require_once('include/dba/dba_driver.php');
$db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
};
App::$session = new Zotlabs\Web\Session();
App::$session->init();
load_config('system');
sys_boot();
App::set_baseurl(get_config('system','baseurl'));
load_hooks();
}

View file

@ -1,17 +1,13 @@
<?php
/**
* @file include/config.php
* @brief Arbitrary configuration storage.
*
* @note Please do not store booleans - convert to 0/1 integer values.
* The get_?config() functions return boolean false for keys that are unset,
* and this could lead to subtle bugs.
*
* Arrays get stored as serialize strings.
*
* @todo There are a few places in the code (such as the admin panel) where
* boolean configurations need to be fixed as of 10/08/2011.
* Arrays get stored as serialized strings.
* Booleans are stored as integer 0/1.
*
* - <b>config</b> is used for hub specific configurations. It overrides the
* configurations from .htconfig file. The storage is of size TEXT.
* - <b>pconfig</b> is used for channel specific configurations and takes a
@ -34,165 +30,39 @@
*
*/
/**
* @brief Loads the hub's configuration from database to a cached storage.
*
* Retrieve a category ($family) of config variables from database to a cached
* storage in the global App::$config[$family].
*
* @param string $family
* The category of the configuration value
*/
use Zotlabs\Lib as Zlib;
function load_config($family) {
global $a;
if(! array_key_exists($family, App::$config))
App::$config[$family] = array();
Zlib\Config::Load($family);
if(! array_key_exists('config_loaded', App::$config[$family])) {
$r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family));
if($r !== false) {
if($r) {
foreach($r as $rr) {
$k = $rr['k'];
App::$config[$family][$k] = $rr['v'];
}
}
App::$config[$family]['config_loaded'] = true;
}
}
}
/**
* @brief Get a particular config variable given the category name ($family)
* and a key.
*
* Get a particular config variable from the given category ($family) and the
* $key from a cached storage in App::$config[$family]. If a key is found in the
* DB but does not exist in local config cache, pull it into the cache so we
* do not have to hit the DB again for this item.
*
* Returns false if not set.
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to query
* @return mixed Return value or false on error or if not set
*/
function get_config($family, $key) {
global $a;
if((! array_key_exists($family, App::$config)) || (! array_key_exists('config_loaded', App::$config[$family])))
load_config($family);
return Zlib\Config::Get($family,$key);
if(array_key_exists('config_loaded', App::$config[$family])) {
if(! array_key_exists($key, App::$config[$family])) {
return false;
}
return ((! is_array(App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', App::$config[$family][$key]))
? unserialize(App::$config[$family][$key])
: App::$config[$family][$key]
);
}
return false;
}
/**
* @brief Returns a value directly from the database configuration storage.
*
* This function queries directly the database and bypasses the chached storage
* from get_config($family, $key).
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to query
* @return mixed
*/
function get_config_from_storage($family, $key) {
$ret = q("SELECT * FROM config WHERE cat = '%s' AND k = '%s' LIMIT 1",
dbesc($family),
dbesc($key)
);
return $ret;
}
/**
* @brief Sets a configuration value for the hub.
*
* Stores a config value ($value) in the category ($family) under the key ($key).
*
* @note Please do not store booleans - convert to 0/1 integer values!
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to set
* @param mixed $value
* The value to store in the configuration
* @return mixed
* Return the set value, or false if the database update failed
*/
function set_config($family, $key, $value) {
global $a;
// manage array value
$dbvalue = ((is_array($value)) ? serialize($value) : $value);
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
return Zlib\Config::Set($family,$key,$value);
if(get_config($family, $key) === false || (! get_config_from_storage($family, $key))) {
$ret = q("INSERT INTO config ( cat, k, v ) VALUES ( '%s', '%s', '%s' ) ",
dbesc($family),
dbesc($key),
dbesc($dbvalue)
);
if($ret) {
App::$config[$family][$key] = $value;
$ret = $value;
}
return $ret;
}
$ret = q("UPDATE config SET v = '%s' WHERE cat = '%s' AND k = '%s'",
dbesc($dbvalue),
dbesc($family),
dbesc($key)
);
if($ret) {
App::$config[$family][$key] = $value;
$ret = $value;
}
return $ret;
}
/**
* @brief Deletes the given key from the hub's configuration database.
*
* Removes the configured value from the stored cache in App::$config[$family]
* and removes it from the database.
*
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to delete
* @return mixed
*/
function del_config($family, $key) {
global $a;
$ret = false;
if(array_key_exists($family, App::$config) && array_key_exists($key, App::$config[$family]))
unset(App::$config[$family][$key]);
$ret = q("DELETE FROM config WHERE cat = '%s' AND k = '%s'",
dbesc($family),
dbesc($key)
);
return $ret;
return Zlib\Config::Delete($family,$key);
}
/**
* @brief Loads all configuration values of a channel into a cached storage.
*
@ -203,8 +73,8 @@ function del_config($family, $key) {
* The channel_id
* @return void|false Nothing or false if $uid is false
*/
function load_pconfig($uid) {
global $a;
if($uid === false)
return false;
@ -249,7 +119,6 @@ function load_pconfig($uid) {
*/
function get_pconfig($uid, $family, $key, $instore = false) {
// logger('include/config.php: get_pconfig() deprecated instore param used', LOGGER_DEBUG);
global $a;
if($uid === false)
return false;
@ -285,7 +154,6 @@ function get_pconfig($uid, $family, $key, $instore = false) {
* @return mixed Stored $value or false
*/
function set_pconfig($uid, $family, $key, $value) {
global $a;
// this catches subtle errors where this function has been called
// with local_channel() when not logged in (which returns false)
@ -372,7 +240,7 @@ function set_pconfig($uid, $family, $key, $value) {
* @return mixed
*/
function del_pconfig($uid, $family, $key) {
global $a;
$ret = false;
if (x(App::$config[$uid][$family], $key))
@ -398,7 +266,6 @@ function del_pconfig($uid, $family, $key) {
* @return void|false Returns false if xchan is not set
*/
function load_xconfig($xchan) {
global $a;
if(! $xchan)
return false;
@ -441,7 +308,6 @@ function load_xconfig($xchan) {
* @return mixed Stored $value or false if it does not exist
*/
function get_xconfig($xchan, $family, $key) {
global $a;
if(! $xchan)
return false;
@ -477,7 +343,6 @@ function get_xconfig($xchan, $family, $key) {
* @return mixed Stored $value or false
*/
function set_xconfig($xchan, $family, $key, $value) {
global $a;
// manage array value
$dbvalue = ((is_array($value)) ? serialize($value) : $value);
@ -530,7 +395,7 @@ function set_xconfig($xchan, $family, $key, $value) {
* @return mixed
*/
function del_xconfig($xchan, $family, $key) {
global $a;
$ret = false;
if(x(App::$config[$xchan][$family], $key))

View file

@ -48,32 +48,9 @@ function abook_self($channel_id) {
return(($r) ? $r[0] : array());
}
function channelx_by_nick($nick) {
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and channel_removed = 0 LIMIT 1",
dbesc($nick)
);
return(($r) ? $r[0] : false);
}
function channelx_by_hash($hash) {
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and channel_removed = 0 LIMIT 1",
dbesc($hash)
);
return(($r) ? $r[0] : false);
}
function channelx_by_n($id) {
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and channel_removed = 0 LIMIT 1",
dbesc($id)
);
return(($r) ? $r[0] : false);
}
function vcard_from_xchan($xchan, $observer = null, $mode = '') {
$a = get_app();
if(! $xchan) {
if(App::$poi) {
$xchan = App::$poi;
@ -267,7 +244,7 @@ function channel_remove($channel_id, $local = true, $unset_session=false) {
if(! $channel_id)
return;
$a = get_app();
logger('Removing channel: ' . $channel_id);
logger('channel_remove: local only: ' . intval($local));

View file

@ -39,7 +39,7 @@ function fileas_widget($baseurl,$selected = '') {
return '';
$terms = array();
$r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
$r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc",
intval(local_channel()),
intval(TERM_FILE)
);
@ -72,7 +72,7 @@ function categories_widget($baseurl,$selected = '') {
from term join item on term.oid = item.id
where item.uid = %d
and term.uid = item.uid
and term.type = %d
and term.ttype = %d
and term.otype = %d
and item.owner_xchan = '%s'
and item.item_wall = 1

View file

@ -858,8 +858,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
function best_link_url($item) {
$a = get_app();
$best_url = '';
$sparkle = false;
@ -888,7 +886,7 @@ function best_link_url($item) {
function item_photo_menu($item){
$a = get_app();
$contact = null;
$ssl_state = false;
@ -1408,7 +1406,7 @@ function render_location_default($item) {
function prepare_page($item) {
$a = get_app();
$naked = 1;
// $naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
$observer = App::get_observer();
@ -1442,7 +1440,7 @@ function prepare_page($item) {
function network_tabs() {
$a = get_app();
$no_active='';
$starred_active = '';
$new_active = '';

View file

@ -46,27 +46,15 @@ function pkcs5_unpad($text)
}
function AES256CBC_encrypt($data,$key,$iv) {
if(get_config('system','openssl_encrypt')) {
return openssl_encrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
}
return mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,
str_pad($key,32,"\0"),
pkcs5_pad($data,16),
MCRYPT_MODE_CBC,
str_pad($iv,16,"\0"));
return openssl_encrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
}
function AES256CBC_decrypt($data,$key,$iv) {
if(get_config('system','openssl_encrypt')) {
return openssl_decrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
}
return pkcs5_unpad(mcrypt_decrypt(
MCRYPT_RIJNDAEL_128,
str_pad($key,32,"\0"),
$data,
MCRYPT_MODE_CBC,
str_pad($iv,16,"\0")));
return openssl_decrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
}
function crypto_encapsulate($data,$pubkey,$alg='aes256cbc') {

View file

@ -119,7 +119,6 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
* @return string
*/
function dob($dob) {
$a = get_app();
list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d');
$f = get_config('system', 'birthday_input_format');

View file

@ -1,66 +1,78 @@
<?php
/**
* @file dba_driver.php
* @brief some database related functions and abstract driver class.
*
* This file contains the abstract database driver class dba_driver and some
* functions for working with databases.
*/
/**
* @brief Returns the database driver object.
*
* If available it will use PHP's mysqli otherwise mysql driver.
*
* @param string $server DB server name
* @param string $port DB port
* @param string $user DB username
* @param string $pass DB password
* @param string $db database name
* @param string $dbtype 0 for mysql, 1 for postgres
* @param bool $install Defaults to false
* @return null|dba_driver A database driver object (dba_mysql|dba_mysqli) or null if no driver found.
*/
function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) {
$dba = null;
class DBA {
$dbtype = intval($dbtype);
$set_port = $port;
/**
* @file dba_driver.php
* @brief some database related functions and abstract driver class.
*
* This file contains the abstract database driver class dba_driver and some
* functions for working with databases.
*/
if($dbtype == DBTYPE_POSTGRES) {
require_once('include/dba/dba_postgres.php');
if(is_null($port)) $set_port = 5432;
$dba = new dba_postgres($server, $set_port, $user, $pass, $db, $install);
} else {
static public $dba = null;
static public $dbtype = null;
static public $logging = false;
// Highly experimental at the present time.
// require_once('include/dba/dba_pdo.php');
// $dba = new dba_pdo($server, $set_port,$user,$pass,$db,$install);
// }
/**
* @brief Returns the database driver object.
*
* If available it will use PHP's mysqli otherwise mysql driver.
*
* @param string $server DB server name
* @param string $port DB port
* @param string $user DB username
* @param string $pass DB password
* @param string $db database name
* @param string $dbtype 0 for mysql, 1 for postgres
* @param bool $install Defaults to false
* @return null|dba_driver A database driver object (dba_mysql|dba_mysqli) or null if no driver found.
*/
if(class_exists('mysqli')) {
if (is_null($port)) $set_port = ini_get("mysqli.default_port");
require_once('include/dba/dba_mysqli.php');
$dba = new dba_mysqli($server, $set_port,$user,$pass,$db,$install);
static public function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) {
self::$dba = null;
self::$dbtype = intval($dbtype);
$set_port = $port;
if(self::$dbtype == DBTYPE_POSTGRES) {
require_once('include/dba/dba_postgres.php');
if(is_null($port)) $set_port = 5432;
self::$dba = new dba_postgres($server, $set_port, $user, $pass, $db, $install);
}
else {
// Highly experimental at the present time.
// require_once('include/dba/dba_pdo.php');
// self::$dba = new dba_pdo($server, $set_port,$user,$pass,$db,$install);
// }
if(class_exists('mysqli')) {
if (is_null($port)) $set_port = ini_get("mysqli.default_port");
require_once('include/dba/dba_mysqli.php');
self::$dba = new dba_mysqli($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(self::$dba) && self::$dba->connected) {
$dns = ((self::$dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql')
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
. ';dbname=' . $db;
self::$dba->pdo_set(array($dns,$user,$pass));
}
define('NULL_DATE', self::$dba->get_null_date());
define('ACTIVE_DBTYPE', self::$dbtype);
return self::$dba;
}
// 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) {
$dns = (($dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql')
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
. ';dbname=' . $db;
$dba->pdo_set(array($dns,$user,$pass));
}
define('NULL_DATE', $dba->get_null_date());
define('ACTIVE_DBTYPE', $dbtype);
return $dba;
}
/**
@ -232,8 +244,8 @@ function printable($s) {
function dbg($state) {
global $db;
if($db)
$db->dbg($state);
if(\DBA::$dba)
\DBA::$dba->dbg($state);
}
/**
@ -247,21 +259,18 @@ function dbg($state) {
* @return Return an escaped string of the value to pass to a DB query.
*/
function dbesc($str) {
global $db;
if($db && $db->connected)
return($db->escape($str));
if(\DBA::$dba && \DBA::$dba->connected)
return(\DBA::$dba->escape($str));
else
return(str_replace("'", "\\'", $str));
}
function dbescbin($str) {
global $db;
return $db->escapebin($str);
return \DBA::$dba->escapebin($str);
}
function dbunescbin($str) {
global $db;
return $db->unescapebin($str);
return \DBA::$dba->unescapebin($str);
}
function dbescdate($date) {
@ -274,36 +283,25 @@ function dbescdate($date) {
}
function db_quoteinterval($txt) {
global $db;
return $db->quote_interval($txt);
return \DBA::$dba->quote_interval($txt);
}
function dbesc_identifier($str) {
global $db;
return $db->escape_identifier($str);
return \DBA::$dba->escape_identifier($str);
}
function db_utcnow() {
global $db;
return $db->utcnow();
return \DBA::$dba->utcnow();
}
function db_optimizetable($table) {
global $db;
$db->optimize_table($table);
\DBA::$dba->optimize_table($table);
}
function db_concat($fld, $sep) {
global $db;
return $db->concat($fld, $sep);
return \DBA::$dba->concat($fld, $sep);
}
// Function: q($sql,$args);
// Description: execute SQL query with printf style args.
// Example: $r = q("SELECT * FROM `%s` WHERE `uid` = %d",
// 'user', 1);
/**
* @brief Execute a SQL query with printf style args.
*
@ -319,13 +317,13 @@ function db_concat($fld, $sep) {
* @param string $sql The SQL query to execute
* @return bool|array
*/
function q($sql) {
global $db;
$args = func_get_args();
unset($args[0]);
if($db && $db->connected) {
if(\DBA::$dba && \DBA::$dba->connected) {
$stmt = vsprintf($sql, $args);
if($stmt === false) {
if(version_compare(PHP_VERSION, '5.4.0') >= 0)
@ -334,13 +332,14 @@ function q($sql) {
else
db_logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true),LOGGER_NORMAL,LOG_CRIT);
}
return $db->q($stmt);
return \DBA::$dba->q($stmt);
}
/*
* This will happen occasionally trying to store the
* session data after abnormal program termination
*/
db_logger('dba: no database: ' . print_r($args,true),LOGGER_NORMAL,LOG_CRIT);
return false;
@ -354,10 +353,9 @@ function q($sql) {
* @param string $sql The SQL query to execute
*/
function dbq($sql) {
global $db;
if($db && $db->connected)
$ret = $db->q($sql);
if(\DBA::$dba && \DBA::$dba->connected)
$ret = \DBA::$dba->q($sql);
else
$ret = false;
@ -418,13 +416,18 @@ function db_getfunc($f) {
// The logger function may make DB calls internally to query the system logging parameters.
// This can cause a recursion if database debugging is enabled.
// So this function preserves the current database debugging state and then turns it off while
// doing the logger() call
// So this function preserves the current database debugging state and then turns it off
// temporarily while doing the logger() call
function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) {
global $db;
$saved = $db->debug;
$db->debug = false;
if(\DBA::$logging)
return;
$saved = \DBA::$dba->debug;
\DBA::$dba->debug = false;
\DBA::$logging = true;
logger($s,$level,$syslog);
$db->debug = $saved;
\DBA::$logging = false;
\DBA::$dba->debug = $saved;
}

View file

@ -94,6 +94,9 @@ function get_directory_setting($observer, $setting) {
if($ret === false)
$ret = get_config('directory', $setting);
// 'safemode' is the default if there is no observer or no established preference.
if($setting == 'safemode' && $ret === false)
$ret = 1;

View file

@ -175,6 +175,9 @@ function format_event_bbcode($ev) {
if($ev['location'])
$o .= '[event-location]' . $ev['location'] . '[/event-location]';
if($ev['event_hash'])
$o .= '[event-id]' . $ev['event_hash'] . '[/event-id]';
if($ev['adjust'])
$o .= '[event-adjust]' . $ev['adjust'] . '[/event-adjust]';
@ -212,6 +215,9 @@ function bbtoevent($s) {
if(preg_match("/\[event\-location\](.*?)\[\/event\-location\]/is",$s,$match))
$ev['location'] = $match[1];
$match = '';
if(preg_match("/\[event\-id\](.*?)\[\/event\-id\]/is",$s,$match))
$ev['event_hash'] = $match[1];
$match = '';
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
$ev['adjust'] = $match[1];
if(array_key_exists('start',$ev)) {
@ -278,34 +284,41 @@ function event_store_event($arr) {
else
$arr['event_status_date'] = NULL_DATE;
// Existing event being modified
if($arr['id'] || $arr['event_hash']) {
$existing_event = null;
// has the event actually changed?
if($arr['event_hash']) {
$r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1",
dbesc($arr['event_hash']),
intval($arr['uid'])
);
if($r) {
$existing_event = $r[0];
}
}
if($arr['event_hash']) {
$r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1",
dbesc($arr['event_hash']),
intval($arr['uid'])
);
if($arr['id']) {
$r = q("SELECT * FROM event WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['id']),
intval($arr['uid'])
);
if($r) {
$existing_event = $r[0];
}
else {
$r = q("SELECT * FROM event WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['id']),
intval($arr['uid'])
);
}
if(! $r)
return false;
}
}
if($r[0]['edited'] === $arr['edited']) {
// Nothing has changed. Return the ID.
return $r[0];
if($existing_event) {
if($existing_event['edited'] >= $arr['edited']) {
// Nothing has changed.
return $existing_event;
}
$hash = $r[0]['event_hash'];
$hash = $existing_event['event_hash'];
// The event changed. Update it.
@ -350,7 +363,7 @@ function event_store_event($arr) {
dbesc($arr['allow_gid']),
dbesc($arr['deny_cid']),
dbesc($arr['deny_gid']),
intval($r[0]['id']),
intval($existing_event['id']),
intval($arr['uid'])
);
} else {
@ -360,6 +373,8 @@ function event_store_event($arr) {
if(array_key_exists('external_id',$arr))
$hash = $arr['external_id'];
elseif(array_key_exists('event_hash',$arr))
$hash = $arr['event_hash'];
else
$hash = random_string() . '@' . App::get_hostname();
@ -436,7 +451,7 @@ function event_addtocal($item_id, $uid) {
// is this an edit?
if($item['resource_type'] === 'event') {
if($item['resource_type'] === 'event' && (! $ev['event_hash'])) {
$ev['event_hash'] = $item['resource_id'];
}
@ -472,7 +487,6 @@ function event_addtocal($item_id, $uid) {
if($z) {
build_sync_packet($channel['channel_id'],array('event_item' => array(encode_item($sync_item[0],true)),'event' => $z));
}
return true;
}
}
@ -764,6 +778,9 @@ function event_store_item($arr, $event) {
$prefix = '';
// $birthday = false;
if(($event) && array_key_exists('event_hash',$event) && (! array_key_exists('event_hash',$arr)))
$arr['event_hash'] = $event['event_hash'];
if($event['type'] === 'birthday') {
if(! is_sys_channel($arr['uid']))
$prefix = t('This event has been added to your calendar.');
@ -837,12 +854,12 @@ function event_store_item($arr, $event) {
if(($arr['term']) && (is_array($arr['term']))) {
foreach($arr['term'] as $t) {
q("insert into term (uid,oid,otype,type,term,url)
q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']),
intval($r[0]['id']),
intval(TERM_OBJ_POST),
intval($t['type']),
intval($t['ttype']),
dbesc($t['term']),
dbesc($t['url'])
);

View file

@ -515,7 +515,7 @@ function get_atom_elements($feed, $item, &$author) {
if($termterm) {
$terms[] = array(
'otype' => TERM_OBJ_POST,
'type' => $termtype,
'ttype' => $termtype,
'url' => $termurl,
'term' => $termterm,
);

View file

@ -17,7 +17,6 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$result = array('success' => false,'message' => '');
$a = get_app();
$is_red = false;
$is_http = ((strpos($url,'://') !== false) ? true : false);

View file

@ -18,7 +18,7 @@ function group_add($uid,$name,$public = 0) {
intval($r)
);
if(count($z) && $z[0]['deleted']) {
/*$r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
/*$r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);*/
@ -38,7 +38,7 @@ function group_add($uid,$name,$public = 0) {
} while($dups == true);
$r = q("INSERT INTO `groups` ( hash, uid, visible, name )
$r = q("INSERT INTO `groups` ( hash, uid, visible, gname )
VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash),
intval($uid),
@ -57,7 +57,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) {
$ret = false;
if(x($uid) && x($name)) {
$r = q("SELECT id, hash FROM `groups` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
$r = q("SELECT id, hash FROM `groups` WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@ -108,7 +108,7 @@ function group_rmv($uid,$name) {
);
// remove group
$r = q("UPDATE `groups` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s'",
$r = q("UPDATE `groups` SET `deleted` = 1 WHERE `uid` = %d AND `gname` = '%s'",
intval($uid),
dbesc($name)
);
@ -125,7 +125,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) {
if((! $uid) || (! strlen($name)))
return false;
$r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
$r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@ -232,13 +232,13 @@ function mini_group_select($uid,$group = '') {
$grps = array();
$o = '';
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
intval($uid)
);
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
if(count($r)) {
foreach($r as $rr) {
$grps[] = array('name' => $rr['name'], 'id' => $rr['hash'], 'selected' => (($group == $rr['hash']) ? 'true' : ''));
$grps[] = array('name' => $rr['gname'], 'id' => $rr['hash'], 'selected' => (($group == $rr['hash']) ? 'true' : ''));
}
}
@ -271,7 +271,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
);
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
intval($_SESSION['uid'])
);
$member_of = array();
@ -296,7 +296,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
'id' => $rr['id'],
'enc_cid' => base64url_encode($cid),
'cid' => $cid,
'text' => $rr['name'],
'text' => $rr['gname'],
'selected' => $selected,
'href' => (($mode == 0) ? $each.'?f=&gid='.$rr['id'] : $each."/".$rr['id']) . ((x($_GET,'new')) ? '&new=' . $_GET['new'] : '') . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : ''),
'edit' => $groupedit,
@ -340,7 +340,7 @@ function expand_groups($a) {
function member_of($c) {
$r = q("SELECT `groups`.`name`, `groups`.`id` FROM `groups` LEFT JOIN `group_member` ON `group_member`.`gid` = `groups`.`id` WHERE `group_member`.`xchan` = '%s' AND `groups`.`deleted` = 0 ORDER BY `groups`.`name` ASC ",
$r = q("SELECT `groups`.`gname`, `groups`.`id` FROM `groups` LEFT JOIN `group_member` ON `group_member`.`gid` = `groups`.`id` WHERE `group_member`.`xchan` = '%s' AND `groups`.`deleted` = 0 ORDER BY `groups`.`gname` ASC ",
dbesc($c)
);

View file

@ -24,8 +24,6 @@ function find_doc_file($s) {
function search_doc_files($s) {
$a = get_app();
$itemspage = get_pconfig(local_channel(),'system','itemspage');
\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));

View file

@ -20,6 +20,8 @@ function import_channel($channel, $account_id, $seize) {
dbesc($channel['channel_hash']),
dbesc($channel['channel_address'])
);
if($r && $r[0]['channel_guid'] == $channel['channel_guid'] && $r[0]['channel_pubkey'] === $channel['channel_pubkey'] && $r[0]['channel_hash'] === $channel['channel_hash'])
return $r[0];
if(($r) || (check_webbie(array($channel['channel_address'])) !== $channel['channel_address'])) {
if($r[0]['channel_guid'] === $channel['channel_guid'] || $r[0]['channel_hash'] === $channel['channel_hash']) {
@ -330,7 +332,9 @@ function import_apps($channel,$apps) {
);
if($x) {
foreach($term as $t) {
store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['type'],escape_tags($t['term']),escape_tags($t['url']));
if(array_key_exists('type',$t))
$t['ttype'] = $t['type'];
store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['ttype'],escape_tags($t['term']),escape_tags($t['url']));
}
}
}
@ -398,7 +402,9 @@ function sync_apps($channel,$apps) {
if($exists && $term) {
foreach($term as $t) {
store_item_tag($channel['channel_id'],$exists['id'],TERM_OBJ_APP,$t['type'],escape_tags($t['term']),escape_tags($t['url']));
if(array_key_exists('type',$t))
$t['ttype'] = $t['type'];
store_item_tag($channel['channel_id'],$exists['id'],TERM_OBJ_APP,$t['ttype'],escape_tags($t['term']),escape_tags($t['url']));
}
}
@ -434,7 +440,9 @@ function sync_apps($channel,$apps) {
);
if($x) {
foreach($term as $t) {
store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['type'],escape_tags($t['term']),escape_tags($t['url']));
if(array_key_exists('type',$t))
$t['ttype'] = $t['type'];
store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['ttype'],escape_tags($t['term']),escape_tags($t['url']));
}
}
}

View file

@ -6,6 +6,8 @@
// uncertain if this line is needed and why
use Sabre\HTTP\URLUtil;
use Zotlabs\Lib as Zlib;
require_once('include/bbcode.php');
require_once('include/oembed.php');
require_once('include/crypto.php');
@ -1180,8 +1182,8 @@ function encode_item_terms($terms,$mirror = false) {
if($terms) {
foreach($terms as $term) {
if(in_array($term['type'],$allowed_export_terms))
$ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'type' => termtype($term['type']));
if(in_array($term['ttype'],$allowed_export_terms))
$ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'ttype' => termtype($term['type']));
}
}
@ -1238,39 +1240,41 @@ function decode_tags($t) {
$ret = array();
foreach($t as $x) {
$tag = array();
if(array_key_exists('type',$x))
$x['ttype'] = $x['type'];
$tag['term'] = htmlspecialchars($x['tag'], ENT_COMPAT, 'UTF-8', false);
$tag['url'] = htmlspecialchars($x['url'], ENT_COMPAT, 'UTF-8', false);
switch($x['type']) {
switch($x['ttype']) {
case 'hashtag':
$tag['type'] = TERM_HASHTAG;
$tag['ttype'] = TERM_HASHTAG;
break;
case 'mention':
$tag['type'] = TERM_MENTION;
$tag['ttype'] = TERM_MENTION;
break;
case 'category':
$tag['type'] = TERM_CATEGORY;
$tag['ttype'] = TERM_CATEGORY;
break;
case 'private_category':
$tag['type'] = TERM_PCATEGORY;
$tag['ttype'] = TERM_PCATEGORY;
break;
case 'file':
$tag['type'] = TERM_FILE;
$tag['ttype'] = TERM_FILE;
break;
case 'search':
$tag['type'] = TERM_SEARCH;
$tag['ttype'] = TERM_SEARCH;
break;
case 'thing':
$tag['type'] = TERM_THING;
$tag['ttype'] = TERM_THING;
break;
case 'bookmark':
$tag['type'] = TERM_BOOKMARK;
$tag['ttype'] = TERM_BOOKMARK;
break;
case 'communitytag':
$tag['type'] = TERM_COMMUNITYTAG;
$tag['ttype'] = TERM_COMMUNITYTAG;
break;
default:
case 'unknown':
$tag['type'] = TERM_UNKNOWN;
$tag['ttype'] = TERM_UNKNOWN;
break;
}
$ret[] = $tag;
@ -1853,12 +1857,12 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
if(($terms) && (is_array($terms))) {
foreach($terms as $t) {
q("insert into term (uid,oid,otype,type,term,url)
q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']),
intval($current_post),
intval(TERM_OBJ_POST),
intval($t['type']),
intval($t['ttype']),
dbesc($t['term']),
dbesc($t['url'])
);
@ -2132,12 +2136,12 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
if(is_array($terms)) {
foreach($terms as $t) {
q("insert into term (uid,oid,otype,type,term,url)
q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($uid),
intval($orig_post_id),
intval(TERM_OBJ_POST),
intval($t['type']),
intval($t['ttype']),
dbesc($t['term']),
dbesc($t['url'])
);
@ -2284,8 +2288,8 @@ function send_status_notifications($post_id,$item) {
if(! $notify)
return;
require_once('include/enotify.php');
notification(array(
Zlib\Enotify::submit(array(
'type' => NOTIFY_COMMENT,
'from_xchan' => $item['author_xchan'],
'to_xchan' => $r[0]['channel_hash'],
@ -2378,8 +2382,7 @@ function tag_deliver($uid, $item_id) {
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
if($poke_notify) {
require_once('include/enotify.php');
notification(array(
Zlib\Enotify::submit(array(
'to_xchan' => $u[0]['channel_hash'],
'from_xchan' => $item['author_xchan'],
'type' => NOTIFY_POKE,
@ -2544,8 +2547,7 @@ function tag_deliver($uid, $item_id) {
* Kill two birds with one stone. As long as we're here, send a mention notification.
*/
require_once('include/enotify.php');
notification(array(
Zlib\Enotify::submit(array(
'to_xchan' => $u[0]['channel_hash'],
'from_xchan' => $item['author_xchan'],
'type' => NOTIFY_TAGSELF,
@ -2720,7 +2722,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
foreach($tags as $tt) {
$tt = trim($tt);
if($tt) {
q("insert into term (uid,oid,otype,type,term,url)
q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($channel['channel_id']),
intval($item_id),
@ -2863,7 +2865,7 @@ function check_item_source($uid, $item) {
foreach($words as $word) {
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if((($t['type'] == TERM_HASHTAG) || ($t['type'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@ -2916,7 +2918,7 @@ function post_is_importable($item,$abook) {
continue;
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if((($t['type'] == TERM_HASHTAG) || ($t['type'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return false;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@ -2937,7 +2939,7 @@ function post_is_importable($item,$abook) {
continue;
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if((($t['type'] == TERM_HASHTAG) || ($t['type'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@ -3046,7 +3048,6 @@ function mail_store($arr) {
);
}
else {
require_once('include/enotify.php');
$notif_params = array(
'from_xchan' => $arr['from_xchan'],
@ -3057,7 +3058,7 @@ function mail_store($arr) {
'otype' => 'mail'
);
notification($notif_params);
Zlib\Enotify::submit($notif_params);
}
call_hooks('post_mail_end',$arr);
@ -3215,7 +3216,7 @@ function item_getfeedtags($item) {
if(count($terms)) {
foreach($terms as $term) {
if(($term['type'] == TERM_HASHTAG) || ($term['type'] == TERM_COMMUNITYTAG))
if(($term['ttype'] == TERM_HASHTAG) || ($term['ttype'] == TERM_COMMUNITYTAG))
$ret[] = array('#',$term['url'],$term['term']);
else
$ret[] = array('@',$term['url'],$term['term']);
@ -3686,7 +3687,7 @@ function fetch_post_tags($items,$link = false) {
for($x = 0; $x < count($items); $x ++) {
if($tags) {
foreach($tags as $t) {
if(($link) && ($t['type'] == TERM_MENTION))
if(($link) && ($t['ttype'] == TERM_MENTION))
$t['url'] = chanlink_url($t['url']);
if(array_key_exists('item_id',$items[$x])) {
if($t['oid'] == $items[$x]['item_id']) {
@ -3896,8 +3897,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
$contact_str = '';
/** @FIXME $group is undefined */
$contacts = group_get_members($group);
$contacts = group_get_members($r[0]['id']);
if ($contacts) {
foreach($contacts as $c) {
if($contact_str)
@ -3914,7 +3915,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent $item_normal ) ";
$x = group_rec_byhash($uid,$r[0]['hash']);
$result['headline'] = sprintf( t('Privacy group: %s'),$x['name']);
$result['headline'] = sprintf( t('Privacy group: %s'),$x['gname']);
}
elseif($arr['cid'] && $uid) {

View file

@ -82,13 +82,11 @@ function get_best_language() {
if($arr['preferred'] !== 'unset')
return $arr['preferred'];
$a = get_app();
return ((isset(App::$config['system']['language'])) ? App::$config['system']['language'] : 'en');
}
function push_lang($language) {
global $a;
App::$langsave = App::$language;
@ -104,7 +102,6 @@ function push_lang($language) {
}
function pop_lang() {
global $a;
if(App::$language === App::$langsave)
return;
@ -124,7 +121,6 @@ function pop_lang() {
* @param boolean $install (optional) default false
*/
function load_translation_table($lang, $install = false) {
global $a;
App::$strings = array();
@ -136,10 +132,10 @@ function load_translation_table($lang, $install = false) {
}
if(! $install) {
$plugins = q("SELECT name FROM addon WHERE installed=1;");
$plugins = q("SELECT aname FROM addon WHERE installed=1;");
if ($plugins !== false) {
foreach($plugins as $p) {
$name = $p['name'];
$name = $p['aname'];
if(file_exists("addon/$name/lang/$lang/hstrings.php")) {
include("addon/$name/lang/$lang/hstrings.php");
}
@ -170,7 +166,6 @@ function load_translation_table($lang, $install = false) {
*
*/
function t($s, $ctx = '') {
global $a;
$cs = $ctx ? '__ctx:' . $ctx . '__ ' . $s : $s;
if (x(App::$strings, $cs)) {
@ -205,7 +200,6 @@ function translate_projectname($s) {
* @return string
*/
function tt($singular, $plural, $count, $ctx = ''){
$a = get_app();
$cs = $ctx ? "__ctx:" . $ctx . "__ " . $singular : $singular;
if (x(App::$strings,$cs)) {

View file

@ -595,8 +595,6 @@ function parse_xml_string($s,$strict = true) {
function scale_external_images($s, $include_link = true, $scale_replace = false) {
$a = get_app();
// Picture addresses can contain special characters
$s = htmlspecialchars_decode($s, ENT_COMPAT);
@ -1618,8 +1616,6 @@ function fetch_xrd_links($url) {
function scrape_vcard($url) {
$a = get_app();
$ret = array();
logger('scrape_vcard: url=' . $url);
@ -1699,8 +1695,6 @@ function scrape_vcard($url) {
function scrape_feed($url) {
$a = get_app();
$ret = array();
$level = 0;
$x = z_fetch_url($url,false,$level,array('novalidate' => true));
@ -1819,8 +1813,6 @@ function service_plink($contact, $guid) {
function format_and_send_email($sender,$xchan,$item) {
require_once('include/enotify.php');
$title = $item['title'];
$body = $item['body'];
@ -1885,7 +1877,7 @@ function format_and_send_email($sender,$xchan,$item) {
// use the EmailNotification library to send the message
enotify::send(array(
Zotlabs\Lib\Enotify::send(array(
'fromName' => $product,
'fromEmail' => $sender_email,
'replyTo' => $sender_email,
@ -1940,9 +1932,6 @@ function do_delivery($deliveries) {
function get_site_info() {
global $db;
global $a;
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
$directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_SECONDARY', 256 => 'DIRECTORY_MODE_STANDALONE');
@ -1978,7 +1967,7 @@ function get_site_info() {
$r = q("select * from addon where hidden = 0");
if(count($r))
foreach($r as $rr)
$visible_plugins[] = $rr['name'];
$visible_plugins[] = $rr['aname'];
}
sort($visible_plugins);
@ -2042,7 +2031,7 @@ function get_site_info() {
'admin' => $admin,
'site_name' => (($site_name) ? $site_name : ''),
'platform' => Zotlabs\Lib\System::get_platform_name(),
'dbdriver' => $db->getdriver(),
'dbdriver' => DBA::$dba->getdriver(),
'lastpoll' => get_config('system','lastpoll'),
'info' => (($site_info) ? $site_info : ''),
'channels_total' => $channels_total_stat,

View file

@ -1,37 +0,0 @@
<?php /** @file */
function format_notification($item) {
$ret = '';
require_once('include/conversation.php');
// Call localize_item with the "brief" flag to get a one line status for activities.
// This should set $item['localized'] to indicate we have a brief summary.
localize_item($item);
if($item_localize) {
$itemem_text = $item['localize'];
}
else {
$itemem_text = (($item['item_thread_top'])
? t('created a new post')
: sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name']));
}
// convert this logic into a json array just like the system notifications
return array(
'notify_link' => $item['llink'],
'name' => $item['author']['xchan_name'],
'url' => $item['author']['xchan_url'],
'photo' => $item['author']['xchan_photo_s'],
'when' => relative_date($item['created']),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
'message' => strip_tags(bbcode($itemem_text))
);
}

View file

@ -37,7 +37,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
logger(__function__.":".$consumer.", ". $token_type.", ".$token, LOGGER_DEBUG);
$r = q("SELECT id, secret, scope, expires, uid FROM tokens WHERE client_id = '%s' AND scope = '%s' AND id = '%s'",
$r = q("SELECT id, secret, auth_scope, expires, uid FROM tokens WHERE client_id = '%s' AND auth_scope = '%s' AND id = '%s'",
dbesc($consumer->key),
dbesc($token_type),
dbesc($token)
@ -45,7 +45,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
if (count($r)){
$ot=new OAuth1Token($r[0]['id'],$r[0]['secret']);
$ot->scope=$r[0]['scope'];
$ot->scope=$r[0]['auth_scope'];
$ot->expires = $r[0]['expires'];
$ot->uid = $r[0]['uid'];
return $ot;
@ -79,7 +79,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$k = $consumer;
}
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', %d)",
$r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires) VALUES ('%s','%s','%s','%s', %d)",
dbesc($key),
dbesc($sec),
dbesc($k),
@ -110,7 +110,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$key = $this->gen_token();
$sec = $this->gen_token();
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)",
$r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)",
dbesc($key),
dbesc($sec),
dbesc($consumer->key),
@ -249,7 +249,7 @@ class FKOAuth2 extends OAuth2 {
protected function getAuthCode($code) {
$r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
$r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
if (count($r))
@ -259,7 +259,7 @@ class FKOAuth2 extends OAuth2 {
protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
$r = q("INSERT INTO auth_codes
(id, client_id, redirect_uri, expires, scope) VALUES
(id, client_id, redirect_uri, expires, auth_scope) VALUES
('%s', '%s', '%s', %d, '%s')",
dbesc($code),
dbesc($client_id),

View file

@ -227,7 +227,7 @@ function oembed_fetch_url($embedurl){
}
function oembed_format_object($j){
$a = get_app();
$embedurl = $j->embedurl;
// logger('format: ' . print_r($j,true));

View file

@ -521,7 +521,7 @@ function guess_image_type($filename, $headers = '') {
logger('Photo: guess_image_type: '.$filename . ($headers?' from curl headers':''), LOGGER_DEBUG);
$type = null;
if ($headers) {
$a = get_app();
$hdrs=array();
$h = explode("\n",$headers);
foreach ($h as $l) {
@ -580,8 +580,6 @@ function guess_image_type($filename, $headers = '') {
function import_xchan_photo($photo,$xchan,$thing = false) {
$a = get_app();
$flags = (($thing) ? PHOTO_THING : PHOTO_XCHAN);
$album = (($thing) ? 'Things' : 'Contact Photos');
@ -703,8 +701,6 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
function import_channel_photo($photo,$type,$aid,$uid) {
$a = get_app();
logger('import_channel_photo: importing channel photo for ' . $uid, LOGGER_DEBUG);
$hash = photo_new_resource();

View file

@ -19,8 +19,6 @@ require_once('include/text.php');
*/
function photo_upload($channel, $observer, $args) {
$a = get_app();
$ret = array('success' => false);
$channel_id = $channel['channel_id'];
$account_id = $channel['channel_account_id'];

View file

@ -41,7 +41,7 @@ function uninstall_plugin($plugin) {
$func();
}
q("DELETE FROM `addon` WHERE `name` = '%s' ",
q("DELETE FROM `addon` WHERE `aname` = '%s' ",
dbesc($plugin)
);
}
@ -66,7 +66,7 @@ function install_plugin($plugin) {
$plugin_admin = (function_exists($plugin . '_plugin_admin') ? 1 : 0);
q("INSERT INTO `addon` (`name`, `installed`, `timestamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ",
q("INSERT INTO `addon` (`aname`, `installed`, `tstamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ",
dbesc($plugin),
intval($t),
$plugin_admin
@ -111,7 +111,7 @@ function load_plugin($plugin) {
}
function plugin_is_installed($name) {
$r = q("select name from addon where name = '%s' and installed = 1 limit 1",
$r = q("select aname from addon where aname = '%s' and installed = 1 limit 1",
dbesc($name)
);
if($r)
@ -143,8 +143,8 @@ function reload_plugins() {
if(file_exists($fname)) {
$t = @filemtime($fname);
foreach($installed as $i) {
if(($i['name'] == $pl) && ($i['timestamp'] != $t)) {
logger('Reloading plugin: ' . $i['name']);
if(($i['aname'] == $pl) && ($i['tstamp'] != $t)) {
logger('Reloading plugin: ' . $i['aname']);
@include_once($fname);
if(function_exists($pl . '_unload')) {
@ -155,7 +155,7 @@ function reload_plugins() {
$func = $pl . '_load';
$func();
}
q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d",
q("UPDATE `addon` SET `tstamp` = %d WHERE `id` = %d",
intval($t),
intval($i['id'])
);
@ -178,7 +178,7 @@ function reload_plugins() {
* @return mixed|bool
*/
function register_hook($hook, $file, $function, $priority = 0) {
$r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
$r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' LIMIT 1",
dbesc($hook),
dbesc($file),
dbesc($function)
@ -186,7 +186,7 @@ function register_hook($hook, $file, $function, $priority = 0) {
if($r)
return true;
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' )",
$r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`) VALUES ( '%s', '%s', '%s', '%s' )",
dbesc($hook),
dbesc($file),
dbesc($function),
@ -206,7 +206,7 @@ function register_hook($hook, $file, $function, $priority = 0) {
* @return array
*/
function unregister_hook($hook, $file, $function) {
$r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `function` = '%s'",
$r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s'",
dbesc($hook),
dbesc($file),
dbesc($function)
@ -233,7 +233,7 @@ function load_hooks() {
if(! array_key_exists($rr['hook'],App::$hooks))
App::$hooks[$rr['hook']] = array();
App::$hooks[$rr['hook']][] = array($rr['file'],$rr['function'],$rr['priority'],$rr['hook_version']);
App::$hooks[$rr['hook']][] = array($rr['file'],$rr['fn'],$rr['priority'],$rr['hook_version']);
}
}
//logger('hooks: ' . print_r(App::$hooks,true));
@ -300,12 +300,18 @@ function call_hooks($name, &$data = null) {
$func($data);
else
$func($a, $data);
} else {
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'",
dbesc($name),
dbesc($hook[0]),
dbesc($origfn)
);
}
else {
// Don't do any DB write calls if we're currently logging a possibly failed DB call.
if(! DBA::$logging) {
// The hook should be removed so we don't process it.
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'",
dbesc($name),
dbesc($hook[0]),
dbesc($origfn)
);
}
}
}
}
@ -500,7 +506,7 @@ function get_theme_info($theme){
* @return string
*/
function get_theme_screenshot($theme) {
$a = get_app();
$exts = array('.png', '.jpg');
foreach($exts as $ext) {
if(file_exists('view/theme/' . $theme . '/img/screenshot' . $ext))
@ -521,7 +527,7 @@ function head_add_css($src, $media = 'screen') {
}
function head_remove_css($src, $media = 'screen') {
$a = get_app();
$index = array_search(array($src, $media), App::$css_sources);
if ($index !== false)
unset(App::$css_sources[$index]);
@ -592,7 +598,7 @@ function head_add_js($src) {
}
function head_remove_js($src) {
$a = get_app();
$index = array_search($src, App::$js_sources);
if($index !== false)
unset(App::$js_sources[$index]);
@ -633,7 +639,6 @@ function format_js_if_exists($source) {
function theme_include($file, $root = '') {
$a = get_app();
// Make sure $root ends with a slash / if it's not blank
if($root !== '' && $root[strlen($root)-1] !== '/')
@ -671,7 +676,7 @@ function theme_include($file, $root = '') {
function get_intltext_template($s, $root = '') {
$a = get_app();
$t = App::template_engine();
$template = $t->get_intltext_template($s, $root);
@ -680,7 +685,7 @@ function get_intltext_template($s, $root = '') {
function get_markup_template($s, $root = '') {
$a = get_app();
$t = App::template_engine();
$template = $t->get_markup_template($s, $root);
return $template;

View file

@ -20,7 +20,7 @@ function file_tag_file_query($table,$s,$type = 'file') {
else
$termtype = TERM_CATEGORY;
return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.ttype = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
intval($termtype),
protect_sprintf(dbesc($s))
);
@ -29,14 +29,14 @@ function file_tag_file_query($table,$s,$type = 'file') {
function term_query($table,$s,$type = TERM_UNKNOWN, $type2 = '') {
if($type2) {
return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type in (%d, %d) and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.ttype in (%d, %d) and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
intval($type),
intval($type2),
protect_sprintf(dbesc($s))
);
}
else {
return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.ttype = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
intval($type),
protect_sprintf(dbesc($s))
);
@ -49,7 +49,7 @@ function store_item_tag($uid,$iid,$otype,$type,$term,$url = '') {
return false;
$r = q("select * from term
where uid = %d and oid = %d and otype = %d and type = %d
where uid = %d and oid = %d and otype = %d and ttype = %d
and term = '%s' and url = '%s' ",
intval($uid),
intval($iid),
@ -61,7 +61,7 @@ function store_item_tag($uid,$iid,$otype,$type,$term,$url = '') {
if($r)
return false;
$r = q("insert into term (uid, oid, otype, type, term, url)
$r = q("insert into term (uid, oid, otype, ttype, term, url)
values( %d, %d, %d, %d, '%s', '%s') ",
intval($uid),
intval($iid),
@ -85,7 +85,7 @@ function get_terms_oftype($arr,$type) {
foreach($type as $t)
foreach($arr as $x)
if($x['type'] == $t)
if($x['ttype'] == $t)
$ret[] = $x;
return $ret;
@ -93,9 +93,9 @@ function get_terms_oftype($arr,$type) {
function format_term_for_display($term) {
$s = '';
if(($term['type'] == TERM_HASHTAG) || ($term['type'] == TERM_COMMUNITYTAG))
if(($term['ttype'] == TERM_HASHTAG) || ($term['ttype'] == TERM_COMMUNITYTAG))
$s .= '#';
elseif($term['type'] == TERM_MENTION)
elseif($term['ttype'] == TERM_MENTION)
$s .= '@';
else
return $s;
@ -142,7 +142,7 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $re
// Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
where term.uid = %d and term.type = %d
where term.uid = %d and term.ttype = %d
and otype = %d and item_type = %d and item_private = 0
$sql_options $item_normal
group by term order by total desc %s",

View file

@ -20,7 +20,6 @@ define('RANDOM_STRING_TEXT', 0x01 );
* @return string substituted string
*/
function replace_macros($s, $r) {
$a = get_app();
$arr = array('template' => $s, 'params' => $r);
call_hooks('replace_macros', $arr);
@ -96,7 +95,6 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
if($type == 'application/x-pdl')
return escape_tags($s);
$a = get_app();
if(App::$is_sys) {
return $s;
}
@ -324,6 +322,15 @@ function autoname($len) {
function xmlify($str) {
$buffer = '';
if(is_array($str)) {
// allow to fall through so we ge a PHP error, as the log statement will
// probably get lost in the noise unless we're specifically looking for it.
btlogger('xmlify called with array: ' . print_r($str,true), LOGGER_NORMAL, LOG_WARNING);
}
$len = mb_strlen($str);
for($x = 0; $x < $len; $x ++) {
$char = mb_substr($str,$x,1);
@ -567,21 +574,25 @@ function attribute_contains($attr, $s) {
*/
function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
// turn off logger in install mode
global $a;
global $db;
if((App::$module == 'install') || (! ($db && $db->connected)))
return;
$debugging = get_config('system', 'debugging');
$loglevel = intval(get_config('system', 'loglevel'));
$logfile = get_config('system', 'logfile');
if(App::$module == 'setup' && is_writable('install.log')) {
$debugging = true;
$logfile = 'install.log';
$loglevel = LOGGER_ALL;
}
else {
$debugging = get_config('system', 'debugging');
$loglevel = intval(get_config('system', 'loglevel'));
$logfile = get_config('system', 'logfile');
}
if((! $debugging) || (! $logfile) || ($level > $loglevel))
return;
$where = '';
// We require > 5.4 but leave the version check so that install issues (including version) can be logged
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
@ -590,7 +601,8 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
$s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
$pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false);
call_hooks('logger',$pluginfo);
if(! (App::$module == 'setup'))
call_hooks('logger',$pluginfo);
if(! $pluginfo['logged'])
@file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND);
@ -648,11 +660,10 @@ function log_priority_str($priority) {
* @param int $level A log level.
*/
function dlogger($msg, $level = 0) {
// turn off logger in install mode
global $a;
global $db;
if((App::$module == 'install') || (! ($db && $db->connected)))
// turn off logger in install mode
if(App::$module == 'setup')
return;
$debugging = get_config('system','debugging');
@ -799,7 +810,7 @@ function get_mentions($item,$tags) {
return $o;
foreach($tags as $x) {
if($x['type'] == TERM_MENTION) {
if($x['ttype'] == TERM_MENTION) {
$o .= "\t\t" . '<link rel="mentioned" href="' . $x['url'] . '" />' . "\r\n";
$o .= "\t\t" . '<link rel="ostatus:attention" href="' . $x['url'] . '" />' . "\r\n";
}
@ -810,7 +821,6 @@ function get_mentions($item,$tags) {
function contact_block() {
$o = '';
$a = get_app();
if(! App::$profile['uid'])
return;
@ -923,7 +933,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
function search($s,$id='search-box',$url='/search',$save = false) {
$a = get_app();
return replace_macros(get_markup_template('searchbox.tpl'),array(
'$s' => $s,
'$id' => $id,
@ -1068,7 +1078,7 @@ function get_mood_verbs() {
// Function to list all smilies, both internal and from addons
// Returns array with keys 'texts' and 'icons'
function list_smilies() {
$a = get_app();
$texts = array(
'&lt;3',
'&lt;/3',
@ -1101,10 +1111,8 @@ function list_smilies() {
':coffee',
':facepalm',
':like',
':dislike',
'red#matrix',
'red#',
'r#'
':dislike'
);
$icons = array(
@ -1140,9 +1148,6 @@ function list_smilies() {
'<img class="smiley" src="' . z_root() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
'<img class="smiley" src="' . z_root() . '/images/like.gif" alt=":like" />',
'<img class="smiley" src="' . z_root() . '/images/dislike.gif" alt=":dislike" />',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="' . urlencode('red#matrix') . '" />matrix</strong></a>',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="' . urlencode('red#') . '" />matrix</strong></a>',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="r#" />matrix</strong></a>'
);
@ -1213,7 +1218,7 @@ function smile_unshield($m) {
* @param array $x
*/
function preg_heart($x) {
$a = get_app();
if (strlen($x[1]) == 1)
return $x[0];
@ -1486,7 +1491,6 @@ function format_event($jobject) {
}
function prepare_body(&$item,$attach = false) {
require_once('include/channel.php');
call_hooks('prepare_body_init', $item);
@ -1716,7 +1720,6 @@ function feed_hublinks() {
/* return atom link elements for salmon endpoints */
function feed_salmonlinks($nick) {
$a = get_app();
$salmon = '<link rel="salmon" href="' . xmlify(z_root() . '/salmon/' . $nick) . '" />' . "\n" ;
@ -1784,7 +1787,7 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
'application/x-pdl'
);
$a = get_app();
if(App::$is_sys) {
$x[] = 'application/x-php';
}
@ -1817,7 +1820,6 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
function lang_selector() {
global $a;
$langs = glob('view/*/hstrings.php');

View file

@ -212,13 +212,13 @@ function widget_savedsearch($arr) {
$search = ((x($_GET,'search')) ? $_GET['search'] : '');
if(x($_GET,'searchsave') && $search) {
$r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1",
$r = q("select * from `term` where `uid` = %d and `ttype` = %d and `term` = '%s' limit 1",
intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
);
if(! $r) {
q("insert into `term` ( `uid`,`type`,`term` ) values ( %d, %d, '%s') ",
q("insert into `term` ( `uid`,`ttype`,`term` ) values ( %d, %d, '%s') ",
intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
@ -227,7 +227,7 @@ function widget_savedsearch($arr) {
}
if(x($_GET,'searchremove') && $search) {
q("delete from `term` where `uid` = %d and `type` = %d and `term` = '%s'",
q("delete from `term` where `uid` = %d and `ttype` = %d and `term` = '%s'",
intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
@ -254,7 +254,7 @@ function widget_savedsearch($arr) {
$o = '';
$r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ",
$r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `ttype` = %d ",
intval(local_channel()),
intval(TERM_SAVEDSEARCH)
);
@ -296,7 +296,7 @@ function widget_filer($arr) {
$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
$terms = array();
$r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
$r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc",
intval(local_channel()),
intval(TERM_FILE)
);
@ -771,7 +771,6 @@ function widget_eventstools($arr) {
}
function widget_design_tools($arr) {
$a = get_app();
// mod menu doesn't load a profile. For any modules which load a profile, check it.
// otherwise local_channel() is sufficient for permissions.
@ -1398,7 +1397,7 @@ function widget_admin($arr) {
$plugins = array();
if($r) {
foreach ($r as $h){
$plugin = $h['name'];
$plugin = $h['aname'];
$plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin');
// temp plugins with admin
App::$plugins_admin[] = $plugin;

View file

@ -329,8 +329,12 @@ function zot_refresh($them, $channel = null, $force = false) {
return false;
}
$token = random_string();
$postvars = array();
$postvars['token'] = $token;
if($channel) {
$postvars['target'] = $channel['channel_guid'];
$postvars['target_sig'] = $channel['channel_guid_sig'];
@ -343,9 +347,9 @@ function zot_refresh($them, $channel = null, $force = false) {
$postvars['guid_hash'] = $them['xchan_hash'];
if (array_key_exists('xchan_guid',$them) && $them['xchan_guid']
&& array_key_exists('xchan_guid_sig',$them) && $them['xchan_guid_sig']) {
$postvars['guid'] = $them['xchan_guid'];
$postvars['guid_sig'] = $them['xchan_guid_sig'];
}
$rhs = '/.well-known/zot-info';
@ -363,6 +367,22 @@ function zot_refresh($them, $channel = null, $force = false) {
return false;
}
$signed_token = ((is_array($j) && array_key_exists('signed_token',$j)) ? $j['signed_token'] : null);
if($signed_token) {
$valid = rsa_verify('token.' . $token,base64url_decode($signed_token),$j['key']);
if(! $valid) {
logger('invalid signed token: ' . $url . $rhs, LOGGER_NORMAL, LOG_ERR);
return false;
}
}
else {
logger('No signed token from ' . $url . $rhs, LOGGER_NORMAL, LOG_WARNING);
// after 2017-01-01 this will be a hard error unless you over-ride it.
if((time() > 1483228800) && (! get_config('system','allow_unsigned_zotfinger'))) {
return false;
}
}
$x = import_xchan($j, (($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
if(! $x['success'])
@ -505,8 +525,7 @@ function zot_refresh($them, $channel = null, $force = false) {
if($new_connection) {
if($new_perms != $previous_perms)
Zotlabs\Daemon\Master::Summon(array('Notifier','permission_create',$new_connection[0]['abook_id']));
require_once('include/enotify.php');
notification(array(
Zotlabs\Lib\Enotify::submit(array(
'type' => NOTIFY_INTRO,
'from_xchan' => $x['hash'],
'to_xchan' => $channel['channel_hash'],
@ -1027,8 +1046,9 @@ function zot_process_response($hub, $arr, $outq) {
/**
* @brief
*
* We received a notification packet (in mod/post.php) that a message is waiting for us, and we've verified the sender.
* Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site private key.
* We received a notification packet (in mod_post) that a message is waiting for us, and we've verified the sender.
* Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site
* private key.
* The entire pickup message is encrypted with the remote site's public key.
* If everything checks out on the remote end, we will receive back a packet containing one or more messages,
* which will be processed and delivered before this function ultimately returns.
@ -1102,6 +1122,7 @@ function zot_fetch($arr) {
* * [1] => \e string $delivery_status
* * [2] => \e string $address
*/
function zot_import($arr, $sender_url) {
$data = json_decode($arr['body'], true);
@ -1494,7 +1515,7 @@ function public_recips($msg) {
/**
* @brief
*
* This is the second part of public_recipes().
* This is the second part of public_recips().
* We'll find all the channels willing to accept public posts from us, then
* match them against the sender privacy scope and see who in that list that
* the sender is allowing.
@ -1932,7 +1953,7 @@ function remove_community_tag($sender, $arr, $uid) {
return;
}
q("delete from term where uid = %d and oid = %d and otype = %d and type in ( %d, %d ) and term = '%s' and url = '%s'",
q("delete from term where uid = %d and oid = %d and otype = %d and ttype in ( %d, %d ) and term = '%s' and url = '%s'",
intval($uid),
intval($r[0]['id']),
intval(TERM_OBJ_POST),
@ -2381,11 +2402,14 @@ function sync_locations($sender, $arr, $absolute = false) {
$current_site = false;
$t = datetime_convert('UTC','UTC','now - 15 minutes');
if(array_key_exists('site',$arr) && $location['url'] == $arr['site']['url']) {
q("update hubloc set hubloc_connected = '%s', hubloc_updated = '%s' where hubloc_id = %d",
q("update hubloc set hubloc_connected = '%s', hubloc_updated = '%s' where hubloc_id = %d and hubloc_connected < '%s'",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($r[0]['hubloc_id'])
intval($r[0]['hubloc_id']),
dbesc($t)
);
$current_site = true;
}
@ -2945,8 +2969,6 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
if(UNO)
return;
$a = get_app();
logger('build_sync_packet');
if($packet)
@ -3029,7 +3051,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
}
if($groups_changed) {
$r = q("select hash as collection, visible, deleted, name from groups where uid = %d",
$r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d",
intval($uid)
);
if($r)
@ -3322,10 +3344,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
}
if($found) {
if(($y['name'] != $cl['name'])
if(($y['gname'] != $cl['name'])
|| ($y['visible'] != $cl['visible'])
|| ($y['deleted'] != $cl['deleted'])) {
q("update groups set name = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
dbesc($cl['name']),
intval($cl['visible']),
intval($cl['deleted']),
@ -3341,7 +3363,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
}
if(! $found) {
$r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, name )
$r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, gname )
VALUES( '%s', %d, %d, %d, '%s' ) ",
dbesc($cl['collection']),
intval($channel['channel_id']),
@ -3448,7 +3470,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(array_key_exists('profile',$arr) && is_array($arr['profile']) && count($arr['profile'])) {
$disallowed = array('id','aid','uid');
$disallowed = array('id','aid','uid','guid');
foreach($arr['profile'] as $profile) {
$x = q("select * from profile where profile_guid = '%s' and uid = %d limit 1",
@ -3473,12 +3495,21 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(in_array($k,$disallowed))
continue;
$clean[$k] = $v;
if($k === 'name')
$clean['fullname'] = $v;
elseif($k === 'with')
$clean['partner'] = $v;
elseif($k === 'work')
$clean['employment'] = $v;
elseif(array_key_exists($k,$x[0]))
$clean[$k] = $v;
/**
* @TODO check if these are allowed, otherwise we'll error
* @TODO
* We also need to import local photos if a custom photo is selected
*/
}
if(count($clean)) {
foreach($clean as $k => $v) {
$r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v)
@ -3933,8 +3964,6 @@ function zotinfo($arr) {
$ret['site']['admin'] = get_config('system','admin_email');
$a = get_app();
$visible_plugins = array();
if(is_array(App::$plugins) && count(App::$plugins)) {
$r = q("select * from addon where hidden = 0");
@ -3949,7 +3978,7 @@ function zotinfo($arr) {
$ret['site']['sellpage'] = get_config('system','sellpage');
$ret['site']['location'] = get_config('system','site_location');
$ret['site']['realm'] = get_directory_realm();
$ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . Zotlabs\Lib\System::get_server_role();
$ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . ' ' . Zotlabs\Lib\System::get_server_role();
}
@ -4108,7 +4137,7 @@ function update_hub_connected($hub,$sitekey = '') {
$sitekey = $hub['sitekey'];
}
// $sender['sitekey'] is a new addition to the protcol to distinguish
// $sender['sitekey'] is a new addition to the protocol to distinguish
// hublocs coming from re-installed sites. Older sites will not provide
// this field and we have to still mark them valid, since we can't tell
// if this hubloc has the same sitekey as the packet we received.
@ -4117,10 +4146,13 @@ function update_hub_connected($hub,$sitekey = '') {
// Update our DB to show when we last communicated successfully with this hub
// This will allow us to prune dead hubs from using up resources
$r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d and hubloc_sitekey = '%s' ",
$t = datetime_convert('UTC','UTC','now - 15 minutes');
$r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d and hubloc_sitekey = '%s' and hubloc_connected < '%s' ",
dbesc(datetime_convert()),
intval($hub['hubloc_id']),
dbesc($sitekey)
dbesc($sitekey),
dbesc($t)
);
// a dead hub came back to life - reset any tombstones we might have

180
index.php
View file

@ -1,183 +1,15 @@
<?php
namespace Zotlabs\Web;
/**
* @file index.php
*
* @brief The main entry point to the application.
*
* Bootstrap the application, load configuration, load modules, load theme, etc.
*/
/*
* bootstrap the application
*/
require_once('boot.php');
require_once('Zotlabs/Web/WebServer.php');
if(file_exists('.htsite.php'))
include('.htsite.php');
$server = new WebServer();
$server->run();
// our global App object
$a = new miniApp;
App::init();
/*
* Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode.
*/
App::$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include('.htconfig.php');
if(! defined('UNO'))
define('UNO', 0);
$a->convert();
App::$timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set(App::$timezone);
/*
* Try to open the database;
*/
require_once('include/dba/dba_driver.php');
if(! App::$install) {
$db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, App::$install);
if(! $db->connected) {
system_unavailable();
}
unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
/**
* Load configs from db. Overwrite configs from .htconfig.php
*/
load_config('config');
load_config('system');
load_config('feature');
App::$session = new \Zotlabs\Web\Session();
App::$session->init();
load_hooks();
call_hooks('init_1');
}
App::$language = get_best_language();
load_translation_table(App::$language,App::$install);
/**
*
* Important stuff we always need to do.
*
* The order of these may be important so use caution if you think they're all
* intertwingled with no logical order and decide to sort it out. Some of the
* dependencies have changed, but at least at one time in the recent past - the
* order was critical to everything working properly
*
*/
if(App::$session) {
App::$session->start();
}
else {
session_start();
register_shutdown_function('session_write_close');
}
/**
* Language was set earlier, but we can over-ride it in the session.
* We have to do it here because the session was just now opened.
*/
if(array_key_exists('system_language',$_POST)) {
if(strlen($_POST['system_language']))
$_SESSION['language'] = $_POST['system_language'];
else
unset($_SESSION['language']);
}
if((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
App::$language = $_SESSION['language'];
load_translation_table(App::$language);
}
if((x($_GET,'zid')) && (! App::$install)) {
App::$query_string = strip_zids(App::$query_string);
if(! local_channel()) {
$_SESSION['my_address'] = $_GET['zid'];
zid_init($a);
}
}
if((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (App::$module === 'login'))
require('include/auth.php');
if(! x($_SESSION, 'sysmsg'))
$_SESSION['sysmsg'] = array();
if(! x($_SESSION, 'sysmsg_info'))
$_SESSION['sysmsg_info'] = array();
/*
* check_config() is responsible for running update scripts. These automatically
* update the DB schema whenever we push a new one out. It also checks to see if
* any plugins have been added or removed and reacts accordingly.
*/
if(App::$install) {
/* Allow an exception for the view module so that pcss will be interpreted during installation */
if(App::$module != 'view')
App::$module = 'setup';
}
else
check_config($a);
nav_set_selected('nothing');
$Router = new Zotlabs\Web\Router($a);
/* initialise content region */
if(! x(App::$page, 'content'))
App::$page['content'] = '';
call_hooks('page_content_top', App::$page['content']);
$Router->Dispatch($a);
// If you're just visiting, let javascript take you home
if(x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
} elseif(local_channel()) {
$homebase = z_root() . '/channel/' . App::$channel['channel_address'];
}
if(isset($homebase)) {
App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
// now that we've been through the module content, see if the page reported
// a permission problem and if so, a 403 response would seem to be in order.
if(stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
}
call_hooks('page_end', App::$page['content']);
construct_page($a);
killme();

View file

@ -77,16 +77,15 @@ but may be an issue with nginx or other web server platforms.
Example config scripts are available for these platforms in doc/install.
Apache and nginx have the most support.
- PHP 5.4 or later. The later the better.
- PHP 5.5 or later.
- PHP *command line* access with register_argc_argv set to true in the
php.ini file - and with no hosting provider restrictions on the use of
exec() and proc_open().
- curl, gd (with at least jpeg and png support), mysqli, mbstring, mcrypt,
and openssl extensions. The imagick extension is not required but desirable.
- xml extension is required if you want webdav to work.
- curl, gd (with at least jpeg and png support), mysqli, mbstring, xml,
and openssl extensions. The imagick extension MAY be used instead of gd,
but is not required and MAY also be disabled via configuration option.
- some form of email server or email gateway such that PHP mail() works.

View file

@ -37,11 +37,11 @@ define( 'UNO', 0 );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = 'America/Los_Angeles';
App::$config['system']['timezone'] = 'America/Los_Angeles';
// What is your site name? DO NOT ADD A TRAILING SLASH!
App::$config['system']['baseurl'] = 'https://myredsite.example';
App::$config['system']['baseurl'] = 'https://mysite.example';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = 'if the auto install failed, put a unique random string here';

View file

@ -96,15 +96,15 @@ CREATE TABLE IF NOT EXISTS `account` (
CREATE TABLE IF NOT EXISTS `addon` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(255) NOT NULL DEFAULT '',
`aname` char(255) NOT NULL DEFAULT '',
`version` char(255) NOT NULL DEFAULT '',
`installed` tinyint(1) NOT NULL DEFAULT '0',
`hidden` tinyint(1) NOT NULL DEFAULT '0',
`timestamp` bigint(20) NOT NULL DEFAULT '0',
`tstamp` bigint(20) NOT NULL DEFAULT '0',
`plugin_admin` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `hidden` (`hidden`),
KEY `name` (`name`),
KEY `aname` (`aname`),
KEY `installed` (`installed`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -188,7 +188,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
`client_id` varchar(20) NOT NULL DEFAULT '',
`redirect_uri` varchar(200) NOT NULL DEFAULT '',
`expires` int(11) NOT NULL DEFAULT '0',
`scope` varchar(250) NOT NULL DEFAULT '',
`auth_scope` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -342,7 +342,7 @@ CREATE TABLE IF NOT EXISTS `clients` (
`client_id` varchar(20) NOT NULL DEFAULT '',
`pw` varchar(20) NOT NULL DEFAULT '',
`redirect_uri` varchar(200) NOT NULL DEFAULT '',
`name` text,
`clname` text,
`icon` text,
`uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`client_id`)
@ -434,74 +434,19 @@ CREATE TABLE IF NOT EXISTS `event` (
KEY `event_priority` (`event_priority`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`url` char(255) NOT NULL,
`name` char(255) NOT NULL,
`photo` char(255) NOT NULL,
`request` char(255) NOT NULL,
`nick` char(255) NOT NULL,
`addr` char(255) NOT NULL,
`batch` char(255) NOT NULL,
`notify` char(255) NOT NULL,
`poll` char(255) NOT NULL,
`confirm` char(255) NOT NULL,
`priority` tinyint(1) NOT NULL,
`network` char(32) NOT NULL,
`alias` char(255) NOT NULL,
`pubkey` text NOT NULL,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `addr` (`addr`),
KEY `network` (`network`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ffinder` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
`cid` int(10) unsigned NOT NULL,
`fid` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `cid` (`cid`),
KEY `fid` (`fid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fserver` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server` char(255) NOT NULL DEFAULT '',
`posturl` char(255) NOT NULL DEFAULT '',
`key` text NOT NULL,
PRIMARY KEY (`id`),
KEY `server` (`server`),
KEY `posturl` (`posturl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fsuggest` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`cid` int(11) NOT NULL DEFAULT '0',
`name` char(255) NOT NULL DEFAULT '',
`url` char(255) NOT NULL DEFAULT '',
`request` char(255) NOT NULL DEFAULT '',
`photo` char(255) NOT NULL DEFAULT '',
`note` text NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `groups` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hash` char(255) NOT NULL DEFAULT '',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`visible` tinyint(1) NOT NULL DEFAULT '0',
`deleted` tinyint(1) NOT NULL DEFAULT '0',
`name` char(255) NOT NULL DEFAULT '',
`gname` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `visible` (`visible`),
KEY `deleted` (`deleted`),
KEY `hash` (`hash`)
KEY `hash` (`hash`),
KEY `gname` (`gname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `group_member` (
@ -519,7 +464,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hook` char(255) NOT NULL DEFAULT '',
`file` char(255) NOT NULL DEFAULT '',
`function` char(255) NOT NULL DEFAULT '',
`fn` char(255) NOT NULL DEFAULT '',
`priority` int(11) unsigned NOT NULL DEFAULT '0',
`hook_version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
@ -883,6 +828,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
`obj_imgurl` char(255) NOT NULL DEFAULT '',
`obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_quantity` int(11) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@ -897,6 +843,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
KEY `obj_imgurl` (`obj_imgurl`),
KEY `obj_created` (`obj_created`),
KEY `obj_edited` (`obj_edited`),
KEY `obj_quantity` (`obj_quantity`),
KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -1033,7 +980,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`profile_name` char(255) NOT NULL DEFAULT '',
`is_default` tinyint(1) NOT NULL DEFAULT '0',
`hide_friends` tinyint(1) NOT NULL DEFAULT '0',
`name` char(255) NOT NULL DEFAULT '',
`fullname` char(255) NOT NULL DEFAULT '',
`pdesc` char(255) NOT NULL DEFAULT '',
`chandesc` text NOT NULL,
`dob` char(32) NOT NULL DEFAULT '0000-00-00',
@ -1046,7 +993,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`hometown` char(255) NOT NULL DEFAULT '',
`gender` char(32) NOT NULL DEFAULT '',
`marital` char(255) NOT NULL DEFAULT '',
`with` text NOT NULL,
`partner` text NOT NULL,
`howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`sexual` char(255) NOT NULL DEFAULT '',
`politic` char(255) NOT NULL DEFAULT '',
@ -1062,7 +1009,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`film` text NOT NULL,
`interest` text NOT NULL,
`romance` text NOT NULL,
`work` text NOT NULL,
`employment` text NOT NULL,
`education` text NOT NULL,
`contact` text NOT NULL,
`channels` text NOT NULL,
@ -1108,7 +1055,7 @@ CREATE TABLE IF NOT EXISTS `register` (
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`password` char(255) NOT NULL DEFAULT '',
`language` char(16) NOT NULL DEFAULT '',
`lang` char(16) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `hash` (`hash`),
KEY `created` (`created`),
@ -1118,7 +1065,7 @@ CREATE TABLE IF NOT EXISTS `register` (
CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`sid` char(255) NOT NULL DEFAULT '',
`data` text NOT NULL,
`sess_data` text NOT NULL,
`expire` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `sid` (`sid`),
@ -1192,20 +1139,6 @@ CREATE TABLE IF NOT EXISTS `source` (
KEY `src_xchan` (`src_xchan`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `spam` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`spam` int(11) NOT NULL DEFAULT '0',
`ham` int(11) NOT NULL DEFAULT '0',
`term` char(255) NOT NULL DEFAULT '',
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `spam` (`spam`),
KEY `ham` (`ham`),
KEY `term` (`term`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sys_perms` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cat` char(255) NOT NULL DEFAULT '',
@ -1221,7 +1154,7 @@ CREATE TABLE IF NOT EXISTS `term` (
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`oid` int(10) unsigned NOT NULL DEFAULT '0',
`otype` tinyint(3) unsigned NOT NULL DEFAULT '0',
`type` tinyint(3) unsigned NOT NULL DEFAULT '0',
`ttype` tinyint(3) unsigned NOT NULL DEFAULT '0',
`term` char(255) NOT NULL DEFAULT '',
`url` char(255) NOT NULL DEFAULT '',
`imgurl` char(255) NOT NULL DEFAULT '',
@ -1230,7 +1163,7 @@ CREATE TABLE IF NOT EXISTS `term` (
PRIMARY KEY (`tid`),
KEY `oid` (`oid`),
KEY `otype` (`otype`),
KEY `type` (`type`),
KEY `ttype` (`ttype`),
KEY `term` (`term`),
KEY `uid` (`uid`),
KEY `aid` (`aid`),
@ -1244,7 +1177,7 @@ CREATE TABLE IF NOT EXISTS `tokens` (
`secret` text NOT NULL,
`client_id` varchar(20) NOT NULL DEFAULT '',
`expires` bigint(20) unsigned NOT NULL DEFAULT '0',
`scope` varchar(200) NOT NULL DEFAULT '',
`auth_scope` varchar(512) NOT NULL DEFAULT '',
`uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `client_id` (`client_id`),
@ -1272,13 +1205,13 @@ CREATE TABLE IF NOT EXISTS `updates` (
CREATE TABLE IF NOT EXISTS `verify` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`channel` int(10) unsigned NOT NULL DEFAULT '0',
`type` char(32) NOT NULL DEFAULT '',
`vtype` char(32) NOT NULL DEFAULT '',
`token` char(255) NOT NULL DEFAULT '',
`meta` char(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `channel` (`channel`),
KEY `type` (`type`),
KEY `vtype` (`vtype`),
KEY `token` (`token`),
KEY `meta` (`meta`),
KEY `created` (`created`)

View file

@ -94,16 +94,16 @@ create index "account_level" on account ("account_level");
create index "account_password_changed" on account ("account_password_changed");
CREATE TABLE "addon" (
"id" serial NOT NULL,
"name" text NOT NULL,
"aname" text NOT NULL,
"version" text NOT NULL DEFAULT '0',
"installed" numeric(1) NOT NULL DEFAULT '0',
"hidden" numeric(1) NOT NULL DEFAULT '0',
"timestamp" numeric(20) NOT NULL DEFAULT '0',
"tstamp" numeric(20) NOT NULL DEFAULT '0',
"plugin_admin" numeric(1) NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
);
create index "addon_hidden_idx" on addon ("hidden");
create index "addon_name_idx" on addon ("name");
create index "addon_name_idx" on addon ("aname");
create index "addon_installed_idx" on addon ("installed");
CREATE TABLE "app" (
"id" serial NOT NULL,
@ -184,7 +184,7 @@ CREATE TABLE "auth_codes" (
"client_id" varchar(20) NOT NULL,
"redirect_uri" varchar(200) NOT NULL,
"expires" bigint NOT NULL,
"scope" varchar(250) NOT NULL,
"auth_scope" varchar(512) NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "cache" (
@ -333,7 +333,7 @@ CREATE TABLE "clients" (
"client_id" varchar(20) NOT NULL,
"pw" varchar(20) NOT NULL,
"redirect_uri" varchar(200) NOT NULL,
"name" text,
"clname" text,
"icon" text,
"uid" bigint NOT NULL DEFAULT '0',
PRIMARY KEY ("client_id")
@ -428,62 +428,6 @@ create index "event_status_idx" on event ("event_status");
create index "event_sequence_idx" on event ("event_sequence");
create index "event_priority_idx" on event ("event_priority");
CREATE TABLE "fcontact" (
"id" serial NOT NULL,
"url" text NOT NULL,
"name" text NOT NULL,
"photo" text NOT NULL,
"request" text NOT NULL,
"nick" text NOT NULL,
"addr" text NOT NULL,
"batch" text NOT NULL,
"notify" text NOT NULL,
"poll" text NOT NULL,
"confirm" text NOT NULL,
"priority" numeric(1) NOT NULL,
"network" varchar(32) NOT NULL DEFAULT '',
"alias" text NOT NULL,
"pubkey" text NOT NULL,
"updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")
);
create index "fcontact_addr_idx" on fcontact ("addr");
create index "fcontact_network_idx" on fcontact ("network");
CREATE TABLE "ffinder" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
"cid" bigint NOT NULL,
"fid" bigint NOT NULL,
PRIMARY KEY ("id")
);
create index "ffinder_uid_idx" on ffinder ("uid");
create index "ffinder_cid_idx" on ffinder ("cid");
create index "ffinder_fid_idx" on ffinder ("fid");
CREATE TABLE "fserver" (
"id" serial NOT NULL,
"server" text NOT NULL,
"posturl" text NOT NULL,
"key" text NOT NULL,
PRIMARY KEY ("id")
);
create index "fserver_server_idx" on fserver ("server");
create index "fserver_posturl_idx" on fserver ("posturl");
CREATE TABLE "fsuggest" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
"cid" bigint NOT NULL,
"name" text NOT NULL,
"url" text NOT NULL,
"request" text NOT NULL,
"photo" text NOT NULL,
"note" text NOT NULL,
"created" timestamp NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "group_member" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
@ -501,7 +445,7 @@ CREATE TABLE "groups" (
"uid" bigint NOT NULL,
"visible" numeric(1) NOT NULL DEFAULT '0',
"deleted" numeric(1) NOT NULL DEFAULT '0',
"name" text NOT NULL,
"gname" text NOT NULL,
PRIMARY KEY ("id")
);
@ -514,7 +458,7 @@ CREATE TABLE "hook" (
"id" serial NOT NULL,
"hook" text NOT NULL,
"file" text NOT NULL,
"function" text NOT NULL,
"fn" text NOT NULL,
"priority" bigint NOT NULL DEFAULT '0',
"hook_version" smallint NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
@ -873,6 +817,7 @@ CREATE TABLE "obj" (
"obj_imgurl" char(255) NOT NULL DEFAULT '',
"obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_quantity" int(11) NOT NULL DEFAUL '0'.
"allow_cid" text NOT NULL,
"allow_gid" text NOT NULL,
"deny_cid" text NOT NULL,
@ -890,6 +835,7 @@ create index "obj_url" on obj ("obj_url");
create index "obj_imgurl" on obj ("obj_imgurl");
create index "obj_created" on obj ("obj_created");
create index "obj_edited" on obj ("obj_edited");
create index "obj_quantity" on obj ("obj_quantity");
CREATE TABLE "outq" (
"outq_hash" text NOT NULL,
@ -1022,7 +968,7 @@ CREATE TABLE "profile" (
"profile_name" text NOT NULL,
"is_default" numeric(1) NOT NULL DEFAULT '0',
"hide_friends" numeric(1) NOT NULL DEFAULT '0',
"name" text NOT NULL,
"fullname" text NOT NULL,
"pdesc" text NOT NULL DEFAULT '',
"chandesc" text NOT NULL DEFAULT '',
"dob" varchar(32) NOT NULL DEFAULT '',
@ -1035,7 +981,7 @@ CREATE TABLE "profile" (
"hometown" text NOT NULL DEFAULT '',
"gender" varchar(32) NOT NULL DEFAULT '',
"marital" text NOT NULL DEFAULT '',
"with" text NOT NULL DEFAULT '',
"partner" text NOT NULL DEFAULT '',
"howlong" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"sexual" text NOT NULL DEFAULT '',
"politic" text NOT NULL DEFAULT '',
@ -1051,7 +997,7 @@ CREATE TABLE "profile" (
"film" text NOT NULL DEFAULT '',
"interest" text NOT NULL DEFAULT '',
"romance" text NOT NULL DEFAULT '',
"work" text NOT NULL DEFAULT '',
"employment" text NOT NULL DEFAULT '',
"education" text NOT NULL DEFAULT '',
"contact" text NOT NULL DEFAULT '',
"channels" text NOT NULL DEFAULT '',
@ -1097,7 +1043,7 @@ CREATE TABLE "register" (
"created" timestamp NOT NULL,
"uid" bigint NOT NULL,
"password" text NOT NULL,
"language" varchar(16) NOT NULL,
"lang" varchar(16) NOT NULL,
PRIMARY KEY ("id")
);
create index "reg_hash" on register ("hash");
@ -1106,7 +1052,7 @@ create index "reg_uid" on register ("uid");
CREATE TABLE "session" (
"id" serial,
"sid" text NOT NULL,
"data" text NOT NULL,
"sess_data" text NOT NULL,
"expire" numeric(20) NOT NULL,
PRIMARY KEY ("id")
);
@ -1177,19 +1123,6 @@ CREATE TABLE "source" (
create index "src_channel_id" on "source" ("src_channel_id");
create index "src_channel_xchan" on "source" ("src_channel_xchan");
create index "src_xchan" on "source" ("src_xchan");
CREATE TABLE "spam" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
"spam" bigint NOT NULL DEFAULT '0',
"ham" bigint NOT NULL DEFAULT '0',
"term" text NOT NULL,
"date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")
);
create index "spam_uid" on spam ("uid");
create index "spam_spam" on spam ("spam");
create index "spam_ham" on spam ("ham");
create index "spam_term" on spam ("term");
CREATE TABLE "sys_perms" (
"id" serial NOT NULL,
"cat" text NOT NULL,
@ -1204,7 +1137,7 @@ CREATE TABLE "term" (
"uid" bigint NOT NULL DEFAULT '0',
"oid" bigint NOT NULL,
"otype" numeric(3) NOT NULL,
"type" numeric(3) NOT NULL,
"ttype" numeric(3) NOT NULL,
"term" text NOT NULL,
"url" text NOT NULL,
"imgurl" text NOT NULL DEFAULT '',
@ -1214,7 +1147,7 @@ CREATE TABLE "term" (
);
create index "term_oid" on term ("oid");
create index "term_otype" on term ("otype");
create index "term_type" on term ("type");
create index "term_ttype" on term ("ttype");
create index "term_term" on term ("term");
create index "term_uid" on term ("uid");
create index "term_aid" on term ("aid");
@ -1226,7 +1159,7 @@ CREATE TABLE "tokens" (
"secret" text NOT NULL,
"client_id" varchar(20) NOT NULL,
"expires" numeric(20) NOT NULL,
"scope" varchar(200) NOT NULL,
"auth_scope" varchar(512) NOT NULL,
"uid" bigint NOT NULL,
PRIMARY KEY ("id")
);
@ -1253,14 +1186,14 @@ create index "ud_last" on updates ("ud_last");
CREATE TABLE "verify" (
"id" serial NOT NULL,
"channel" bigint NOT NULL DEFAULT '0',
"type" varchar(32) NOT NULL DEFAULT '',
"vtype" varchar(32) NOT NULL DEFAULT '',
"token" text NOT NULL DEFAULT '',
"meta" text NOT NULL DEFAULT '',
"created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")
);
create index "verify_channel" on verify ("channel");
create index "verify_type" on verify ("type");
create index "verify_vtype" on verify ("vtype");
create index "verify_token" on verify ("token");
create index "verify_meta" on verify ("meta");
create index "verify_created" on verify ("created");

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1168 );
define( 'UPDATE_VERSION' , 1173 );
/**
*
@ -2097,3 +2097,92 @@ function update_r1167() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1168() {
$r1 = q("alter table obj add obj_quantity int not null default '0' ");
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") ");
}
else {
$r2 = q("alter table obj add index ( obj_quantity ) ");
}
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1169() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
$r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' ");
$r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' ");
}
else {
$r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
$r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' ");
$r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' ");
}
if($r1 && $r2 && $r3)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1170() {
$r1 = q("drop table fcontact");
$r2 = q("drop table ffinder");
$r3 = q("drop table fserver");
$r4 = q("drop table fsuggest");
$r5 = q("drop table spam");
if($r1 && $r2 && $r3 && $r4 && $r5)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1171() {
$r1 = q("ALTER TABLE verify CHANGE `type` `vtype` varchar(32) NOT NULL DEFAULT '' ");
$r2 = q("ALTER TABLE tokens CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
$r3 = q("ALTER TABLE auth_codes CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
$r4 = q("ALTER TABLE clients CHANGE `name` `clname` TEXT ");
$r5 = q("ALTER TABLE session CHANGE `data` `sess_data` TEXT NOT NULL ");
$r6 = q("ALTER TABLE register CHANGE `language` `lang` varchar(16) NOT NULL DEFAULT '' ");
if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1172() {
$r1 = q("ALTER TABLE term CHANGE `type` `ttype` int(3) NOT NULL DEFAULT '0' ");
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r2 = q("ALTER TABLE groups CHANGE `name` `gname` TEXT NOT NULL ");
$r3 = q("ALTER TABLE profile CHANGE `name` `fullname` TEXT NOT NULL ");
$r4 = q("ALTER TABLE profile CHANGE `with` `partner` TEXT NOT NULL ");
$r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL ");
}
else {
$r2 = q("ALTER TABLE groups CHANGE `name` `gname` char(255) NOT NULL DEFAULT '' ");
$r3 = q("ALTER TABLE profile CHANGE `name` `fullname` char(255) NOT NULL DEFAULT '' ");
$r4 = q("ALTER TABLE profile CHANGE `with` `partner` char(255) NOT NULL DEFAULT '' ");
$r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL ");
}
if($r1 && $r2 && $r3 && $r4 && $r5)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View file

@ -1,9 +0,0 @@
.editorWYSIWYG {font: 10pt Tahoma;border:none;}
.editorBBCODE {font: 9pt "Courier New";}
div.richeditor div.editbar {margin-top:5px;background-image:url('images/editbar_bg.gif');border-left:1px solid silver;border-right:1px solid silver;border-top:1px solid silver;border-bottom:none;}
div.richeditor div button{vertical-align:middle;width:25px;height:25px;border:1px solid transparent;background-color:Transparent;cursor:pointer;color:Black;background-position:center;background-repeat:no-repeat;background-image:none;}
div.richeditor div button:hover{border:1px solid silver;}
div.richeditor div.container {border-top:none;border-bottom:1px solid silver;border-left:1px solid silver;border-right:1px solid silver;}
div.richeditor textarea{padding:0px 0px 0px 0px;border:none;}
div.richeditor iframe{background-color:#ffffff;border:none;}

View file

@ -1,524 +0,0 @@
/*
WYSIWYG-BBCODE editor
Copyright (c) 2009, Jitbit Sotware, http://www.jitbit.com/
PROJECT HOME: http://wysiwygbbcode.codeplex.com/
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Jitbit Software ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Jitbit Software BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function REDITOR(elm,wysiwyg) {
this.elm = elm;
this.wysiwyg = wysiwyg;
}
REDITOR.prototype.showEditor = function() {
if (! this.enableWysiwyg) return;
this.editorVisible = true;
this.content = document.getElementById(this.body_id).value;
this.myeditor = this.ifm.contentWindow.document;
bbcode2html();
this.myeditor.designMode = "on";
this.myeditor.open();
this.myeditor.write('<html><head><link href="editor.css" rel="Stylesheet" type="text/css" /></head>');
this.myeditor.write('<body style="margin:0px 0px 0px 0px" class="editorWYSIWYG">');
this.myeditor.write(content);
this.myeditor.write('</body></html>');
this.myeditor.close();
if (this.myeditor.attachEvent) {
if(parent.ProcessKeyPress)
this.myeditor.attachEvent("onkeydown", parent.ProcessKeyPress);
this.myeditor.attachEvent("onkeypress", kp);
}
else if (this.myeditor.addEventListener) {
if (parent.ProcessKeyPress)
this.myeditor.addEventListener("keydown", parent.ProcessKeyPress, true);
this.myeditor.addEventListener("keypress",kp,true);
}
}
var myeditor, ifm;
var body_id, textboxelement;
var content;
var isIE = /msie|MSIE/.test(navigator.userAgent);
var isChrome = /Chrome/.test(navigator.userAgent);
var isSafari = /Safari/.test(navigator.userAgent) && !isChrome;
var browser = isIE || window.opera;
var textRange;
var enter = 0;
var editorVisible = false;
var enableWysiwyg = false;
function rep(re, str) {
content = content.replace(re, str);
}
function initEditor(textarea_id, wysiwyg) {
if(wysiwyg!=undefined)
enableWysiwyg = wysiwyg;
else
enableWysiwyg = true;
body_id = textarea_id;
textboxelement = document.getElementById(body_id);
textboxelement.setAttribute('class', 'editorBBCODE');
textboxelement.className = "editorBBCODE";
if (enableWysiwyg) {
ifm = document.createElement("iframe");
ifm.setAttribute("id", "rte");
ifm.setAttribute("frameborder", "0");
ifm.style.width = textboxelement.style.width;
ifm.style.height = textboxelement.style.height;
textboxelement.parentNode.insertBefore(ifm, textboxelement);
textboxelement.style.display = 'none';
if (ifm) {
ShowEditor();
} else
setTimeout('ShowEditor()', 100);
}
}
function getStyle(el,styleProp)
{
var x = document.getElementById(el);
if (x.currentStyle)
var y = x.currentStyle[styleProp];
else if (window.getComputedStyle)
var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
return y;
}
function ShowEditor() {
if (!enableWysiwyg) return;
editorVisible = true;
content = document.getElementById(body_id).value;
myeditor = ifm.contentWindow.document;
bbcode2html();
myeditor.designMode = "on";
myeditor.open();
myeditor.write('<html><head><link href="editor.css" rel="Stylesheet" type="text/css" /></head>');
myeditor.write('<body style="margin:0px 0px 0px 0px" class="editorWYSIWYG">');
myeditor.write(content);
myeditor.write('</body></html>');
myeditor.close();
if (myeditor.attachEvent) {
if(parent.ProcessKeyPress)
myeditor.attachEvent("onkeydown", parent.ProcessKeyPress);
myeditor.attachEvent("onkeypress", kp);
}
else if (myeditor.addEventListener) {
if (parent.ProcessKeyPress)
myeditor.addEventListener("keydown", parent.ProcessKeyPress, true);
myeditor.addEventListener("keypress",kp,true);
}
}
function SwitchEditor() {
if (editorVisible) {
doCheck();
ifm.style.display = 'none';
textboxelement.style.display = '';
editorVisible = false;
}
else {
if (enableWysiwyg && ifm) {
ifm.style.display = '';
textboxelement.style.display = 'none';
ShowEditor();
editorVisible = true;
}
}
}
function html2bbcode() {
rep(/<img\s[^<>]*?src=\"?([^<>]*?)\"?(\s[^<>]*)?\/?>/gi,"[img]$1[/img]");
rep(/<\/(strong|b)>/gi, "[/b]");
rep(/<(strong|b)(\s[^<>]*)?>/gi,"[b]");
rep(/<\/(em|i)>/gi,"[/i]");
rep(/<(em|i)(\s[^<>]*)?>/gi,"[i]");
rep(/<\/u>/gi, "[/u]");
rep(/\n/gi, " ");
rep(/\r/gi, " ");
rep(/<u(\s[^<>]*)?>/gi, "[u]");
rep(/<div><br(\s[^<>]*)?>/gi, "<div>");//chrome-safari fix to prevent double linefeeds
rep(/<br(\s[^<>]*)?>/gi,"\n");
rep(/<p(\s[^<>]*)?>/gi,"");
rep(/<\/p>/gi, "\n");
rep(/<ul>/gi, "[ul]");
rep(/<\/ul>/gi, "[/ul]");
rep(/<ol>/gi, "[ol]");
rep(/<\/ol>/gi, "[/ol]");
rep(/<li>/gi, "[li]");
rep(/<\/li>/gi, "[/li]");
rep(/<\/div>\s*<div([^<>]*)>/gi, "</span>\n<span$1>");//chrome-safari fix to prevent double linefeeds
rep(/<div([^<>]*)>/gi,"\n<span$1>");
rep(/<\/div>/gi,"</span>\n");
rep(/&nbsp;/gi," ");
rep(/&quot;/gi,"\"");
rep(/&amp;/gi,"&");
var sc, sc2;
do {
sc = content;
rep(/<font\s[^<>]*?color=\"?([^<>]*?)\"?(\s[^<>]*)?>([^<>]*?)<\/font>/gi,"[color=$1]$3[/color]");
if(sc==content)
rep(/<font[^<>]*>([^<>]*?)<\/font>/gi,"$1");
rep(/<a\s[^<>]*?href=\"?([^<>]*?)\"?(\s[^<>]*)?>([^<>]*?)<\/a>/gi,"[url=$1]$3[/url]");
sc2 = content;
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-weight: ?bold;?\"?\s*([^<]*?)<\/\1>/gi,"[b]<$1 style=$2</$1>[/b]");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-weight: ?normal;?\"?\s*([^<]*?)<\/\1>/gi,"<$1 style=$2</$1>");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-style: ?italic;?\"?\s*([^<]*?)<\/\1>/gi,"[i]<$1 style=$2</$1>[/i]");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-style: ?normal;?\"?\s*([^<]*?)<\/\1>/gi,"<$1 style=$2</$1>");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?text-decoration: ?underline;?\"?\s*([^<]*?)<\/\1>/gi,"[u]<$1 style=$2</$1>[/u]");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?text-decoration: ?none;?\"?\s*([^<]*?)<\/\1>/gi,"<$1 style=$2</$1>");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?color: ?([^<>]*?);\"?\s*([^<]*?)<\/\1>/gi, "[color=$2]<$1 style=$3</$1>[/color]");
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-family: ?([^<>]*?);\"?\s*([^<]*?)<\/\1>/gi, "[font=$2]<$1 style=$3</$1>[/font]");
rep(/<(blockquote|pre)\s[^<>]*?style=\"?\"? (class=|id=)([^<>]*)>([^<>]*?)<\/\1>/gi, "<$1 $2$3>$4</$1>");
rep(/<pre>([^<>]*?)<\/pre>/gi, "[code]$1[/code]");
rep(/<span\s[^<>]*?style=\"?\"?>([^<>]*?)<\/span>/gi, "$1");
if(sc2==content) {
rep(/<span[^<>]*>([^<>]*?)<\/span>/gi, "$1");
sc2 = content;
}
}while(sc!=content)
rep(/<[^<>]*>/gi,"");
rep(/&lt;/gi,"<");
rep(/&gt;/gi,">");
do {
sc = content;
rep(/\[(b|i|u)\]\[quote([^\]]*)\]([\s\S]*?)\[\/quote\]\[\/\1\]/gi, "[quote$2][$1]$3[/$1][/quote]");
rep(/\[color=([^\]]*)\]\[quote([^\]]*)\]([\s\S]*?)\[\/quote\]\[\/color\]/gi, "[quote$2][color=$1]$3[/color][/quote]");
rep(/\[(b|i|u)\]\[code\]([\s\S]*?)\[\/code\]\[\/\1\]/gi, "[code][$1]$2[/$1][/code]");
rep(/\[color=([^\]]*)\]\[code\]([\s\S]*?)\[\/code\]\[\/color\]/gi, "[code][color=$1]$2[/color][/code]");
}while(sc!=content)
//clean up empty tags
do {
sc = content;
rep(/\[b\]\[\/b\]/gi, "");
rep(/\[i\]\[\/i\]/gi, "");
rep(/\[u\]\[\/u\]/gi, "");
rep(/\[quote[^\]]*\]\[\/quote\]/gi, "");
rep(/\[code\]\[\/code\]/gi, "");
rep(/\[url=([^\]]+)\]\[\/url\]/gi, "");
rep(/\[img\]\[\/img\]/gi, "");
rep(/\[color=([^\]]*)\]\[\/color\]/gi, "");
}while(sc!=content)
}
function bbcode2html() {
// example: [b] to <strong>
rep(/\</gi,"&lt;"); //removing html tags
rep(/\>/gi,"&gt;");
rep(/\n/gi, "<br />");
rep(/\[ul\]/gi, "<ul>");
rep(/\[\/ul\]/gi, "</ul>");
rep(/\[ol\]/gi, "<ol>");
rep(/\[\/ol\]/gi, "</ol>");
rep(/\[li\]/gi, "<li>");
rep(/\[\/li\]/gi, "</li>");
if(browser) {
rep(/\[b\]/gi,"<strong>");
rep(/\[\/b\]/gi,"</strong>");
rep(/\[i\]/gi,"<em>");
rep(/\[\/i\]/gi,"</em>");
rep(/\[u\]/gi,"<u>");
rep(/\[\/u\]/gi,"</u>");
}else {
rep(/\[b\]/gi,"<span style=\"font-weight: bold;\">");
rep(/\[i\]/gi,"<span style=\"font-style: italic;\">");
rep(/\[u\]/gi,"<span style=\"text-decoration: underline;\">");
rep(/\[\/(b|i|u)\]/gi,"</span>");
}
rep(/\[img\]([^\"]*?)\[\/img\]/gi,"<img src=\"$1\" />");
var sc;
do {
sc = content;
rep(/\[url=([^\]]+)\]([\s\S]*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
rep(/\[url\]([\s\S]*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
if(browser) {
rep(/\[color=([^\]]*?)\]([\s\S]*?)\[\/color\]/gi, "<font color=\"$1\">$2</font>");
rep(/\[font=([^\]]*?)\]([\s\S]*?)\[\/font\]/gi, "<font face=\"$1\">$2</font>");
} else {
rep(/\[color=([^\]]*?)\]([\s\S]*?)\[\/color\]/gi, "<span style=\"color: $1;\">$2</span>");
rep(/\[font=([^\]]*?)\]([\s\S]*?)\[\/font\]/gi, "<span style=\"font-family: $1;\">$2</span>");
}
rep(/\[code\]([\s\S]*?)\[\/code\]/gi,"<pre>$1</pre>&nbsp;");
}while(sc!=content);
}
function doCheck() {
if (!editorVisible) {
ShowEditor();
}
content = myeditor.body.innerHTML;
html2bbcode();
document.getElementById(body_id).value = content;
}
function stopEvent(evt){
evt || window.event;
if (evt.stopPropagation){
evt.stopPropagation();
evt.preventDefault();
}else if(typeof evt.cancelBubble != "undefined"){
evt.cancelBubble = true;
evt.returnValue = false;
}
return false;
}
function doQuote() {
if (editorVisible) {
ifm.contentWindow.focus();
if (isIE) {
textRange = ifm.contentWindow.document.selection.createRange();
var newTxt = "[quote=]" + textRange.text + "[/quote]";
textRange.text = newTxt;
}
else {
var edittext = ifm.contentWindow.getSelection().getRangeAt(0);
var original = edittext.toString();
edittext.deleteContents();
edittext.insertNode(document.createTextNode("[quote=]" + original + "[/quote]"));
}
}
else {
AddTag('[quote=]', '[/quote]');
}
}
function kp(e){
if(isIE)
var k = e.keyCode;
else
var k = e.which;
if(k==13) {
if(isIE) {
var r = myeditor.selection.createRange();
if (r.parentElement().tagName.toLowerCase() != "li") {
r.pasteHTML('<br/>');
if (r.move('character'))
r.move('character', -1);
r.select();
stopEvent(e);
return false;
}
}
}else
enter = 0;
}
function InsertSmile(txt) {
InsertText(txt);
document.getElementById('divSmilies').style.display = 'none';
}
function InsertYoutube() {
InsertText("http://www.youtube.com/watch?v=XXXXXXXXXXX");
}
function InsertText(txt) {
if (editorVisible)
insertHtml(txt);
else
textboxelement.value += txt;
}
function doClick(command) {
if (editorVisible) {
ifm.contentWindow.focus();
myeditor.execCommand(command, false, null);
}
else {
switch (command) {
case 'bold':
AddTag('[b]', '[/b]'); break;
case 'italic':
AddTag('[i]', '[/i]'); break;
case 'underline':
AddTag('[u]', '[/u]'); break;
case 'InsertUnorderedList':
AddTag('[ul][li]', '[/li][/ul]'); break;
}
}
}
function doColor(color) {
ifm.contentWindow.focus();
if (isIE) {
textRange = ifm.contentWindow.document.selection.createRange();
textRange.select();
}
myeditor.execCommand('forecolor', false, color);
}
function doLink() {
if (editorVisible) {
ifm.contentWindow.focus();
var mylink = prompt("Enter a URL:", "http://");
if ((mylink != null) && (mylink != "")) {
if (isIE) { //IE
var range = ifm.contentWindow.document.selection.createRange();
if (range.text == '') {
range.pasteHTML("<a href='" + mylink + "'>" + mylink + "</a>");
}
else
myeditor.execCommand("CreateLink", false, mylink);
}
else if (window.getSelection) { //FF
var userSelection = ifm.contentWindow.getSelection().getRangeAt(0);
if(userSelection.toString().length==0)
myeditor.execCommand('inserthtml', false, "<a href='" + mylink + "'>" + mylink + "</a>");
else
myeditor.execCommand("CreateLink", false, mylink);
}
else
myeditor.execCommand("CreateLink", false, mylink);
}
}
else {
AddTag('[url=',']click here[/url]');
}
}
function doImage() {
if (editorVisible) {
ifm.contentWindow.focus();
myimg = prompt('Enter Image URL:', 'http://');
if ((myimg != null) && (myimg != "")) {
myeditor.execCommand('InsertImage', false, myimg);
}
}
else {
AddTag('[img]', '[/img]');
}
}
function insertHtml(html) {
ifm.contentWindow.focus();
if (isIE)
ifm.contentWindow.document.selection.createRange().pasteHTML(html);
else
myeditor.execCommand('inserthtml', false, html);
}
//textarea-mode functions
function MozillaInsertText(element, text, pos) {
element.value = element.value.slice(0, pos) + text + element.value.slice(pos);
}
function AddTag(t1, t2) {
var element = textboxelement;
if (isIE) {
if (document.selection) {
element.focus();
var txt = element.value;
var str = document.selection.createRange();
if (str.text == "") {
str.text = t1 + t2;
}
else if (txt.indexOf(str.text) >= 0) {
str.text = t1 + str.text + t2;
}
else {
element.value = txt + t1 + t2;
}
str.select();
}
}
else if (typeof(element.selectionStart) != 'undefined') {
var sel_start = element.selectionStart;
var sel_end = element.selectionEnd;
MozillaInsertText(element, t1, sel_start);
MozillaInsertText(element, t2, sel_end + t1.length);
element.selectionStart = sel_start;
element.selectionEnd = sel_end + t1.length + t2.length;
element.focus();
}
else {
element.value = element.value + t1 + t2;
}
}
//=======color picker
function getScrollY() { var scrOfX = 0, scrOfY = 0; if (typeof (window.pageYOffset) == 'number') { scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return scrOfY; }
document.write("<style type='text/css'>.colorpicker201{visibility:hidden;display:none;position:absolute;background:#FFF;z-index:999;filter:progid:DXImageTransform.Microsoft.Shadow(color=#D0D0D0,direction=135);}.o5582brd{padding:0;width:12px;height:14px;border-bottom:solid 1px #DFDFDF;border-right:solid 1px #DFDFDF;}a.o5582n66,.o5582n66,.o5582n66a{font-family:arial,tahoma,sans-serif;text-decoration:underline;font-size:9px;color:#666;border:none;}.o5582n66,.o5582n66a{text-align:center;text-decoration:none;}a:hover.o5582n66{text-decoration:none;color:#FFA500;cursor:pointer;}.a01p3{padding:1px 4px 1px 2px;background:whitesmoke;border:solid 1px #DFDFDF;}</style>");
function getTop2() { csBrHt = 0; if (typeof (window.innerWidth) == 'number') { csBrHt = window.innerHeight; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { csBrHt = document.documentElement.clientHeight; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { csBrHt = document.body.clientHeight; } ctop = ((csBrHt / 2) - 115) + getScrollY(); return ctop; }
var nocol1 = "&#78;&#79;&#32;&#67;&#79;&#76;&#79;&#82;",
clos1 = "X";
function getLeft2() { var csBrWt = 0; if (typeof (window.innerWidth) == 'number') { csBrWt = window.innerWidth; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { csBrWt = document.documentElement.clientWidth; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { csBrWt = document.body.clientWidth; } cleft = (csBrWt / 2) - 125; return cleft; }
//function setCCbldID2(val, textBoxID) { document.getElementById(textBoxID).value = val; }
function setCCbldID2(val) { if (editorVisible) doColor(val); else AddTag('[color=' + val + ']', '[/color]'); }
function setCCbldSty2(objID, prop, val) {
switch (prop) {
case "bc": if (objID != 'none') { document.getElementById(objID).style.backgroundColor = val; }; break;
case "vs": document.getElementById(objID).style.visibility = val; break;
case "ds": document.getElementById(objID).style.display = val; break;
case "tp": document.getElementById(objID).style.top = val; break;
case "lf": document.getElementById(objID).style.left = val; break;
}
}
function putOBJxColor2(Samp, pigMent, textBoxId) { if (pigMent != 'x') { setCCbldID2(pigMent, textBoxId); setCCbldSty2(Samp, 'bc', pigMent); } setCCbldSty2('colorpicker201', 'vs', 'hidden'); setCCbldSty2('colorpicker201', 'ds', 'none'); }
function showColorGrid2(Sam, textBoxId) {
var objX = new Array('00', '33', '66', '99', 'CC', 'FF');
var c = 0;
var xl = '"' + Sam + '","x", "' + textBoxId + '"'; var mid = '';
mid += '<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" style="border:solid 0px #F0F0F0;padding:2px;"><tr>';
mid += "<td colspan='9' align='left' style='margin:0;padding:2px;height:12px;' ><input class='o5582n66' type='text' size='12' id='o5582n66' value='#FFFFFF'><input class='o5582n66a' type='text' size='2' style='width:14px;' id='o5582n66a' onclick='javascript:alert(\"click on selected swatch below...\");' value='' style='border:solid 1px #666;'></td><td colspan='9' align='right'><a class='o5582n66' href='javascript:onclick=putOBJxColor2(" + xl + ")'><span class='a01p3'>" + clos1 + "</span></a></td></tr><tr>";
var br = 1;
for (o = 0; o < 6; o++) {
mid += '</tr><tr>';
for (y = 0; y < 6; y++) {
if (y == 3) { mid += '</tr><tr>'; }
for (x = 0; x < 6; x++) {
var grid = '';
grid = objX[o] + objX[y] + objX[x];
var b = "'" + Sam + "','" + grid + "', '" + textBoxId + "'";
mid += '<td class="o5582brd" style="background-color:#' + grid + '"><a class="o5582n66" href="javascript:onclick=putOBJxColor2(' + b + ');" onmouseover=javascript:document.getElementById("o5582n66").value="#' + grid + '";javascript:document.getElementById("o5582n66a").style.backgroundColor="#' + grid + '"; title="#' + grid + '"><div style="width:12px;height:14px;"></div></a></td>';
c++;
}
}
}
mid += "</tr></table>";
//var ttop=getTop2();
//setCCbldSty2('colorpicker201','tp',ttop);
//document.getElementById('colorpicker201').style.left=getLeft2();
document.getElementById('colorpicker201').innerHTML = mid;
setCCbldSty2('colorpicker201', 'vs', 'visible');
setCCbldSty2('colorpicker201', 'ds', 'inline');
}

View file

@ -1,53 +0,0 @@
K 25
svn:wc:ra_dav:version-url
V 26
/svn/!svn/ver/43795/images
END
icon_html.gif
K 25
svn:wc:ra_dav:version-url
V 40
/svn/!svn/ver/43795/images/icon_html.gif
END
img.gif
K 25
svn:wc:ra_dav:version-url
V 34
/svn/!svn/ver/43795/images/img.gif
END
colors.gif
K 25
svn:wc:ra_dav:version-url
V 37
/svn/!svn/ver/43795/images/colors.gif
END
editbar_bg.gif
K 25
svn:wc:ra_dav:version-url
V 41
/svn/!svn/ver/43795/images/editbar_bg.gif
END
url.gif
K 25
svn:wc:ra_dav:version-url
V 34
/svn/!svn/ver/43795/images/url.gif
END
icon_list.gif
K 25
svn:wc:ra_dav:version-url
V 40
/svn/!svn/ver/43795/images/icon_list.gif
END
icon_quote.png
K 25
svn:wc:ra_dav:version-url
V 41
/svn/!svn/ver/43795/images/icon_quote.png
END
icon_youtube.gif
K 25
svn:wc:ra_dav:version-url
V 43
/svn/!svn/ver/43795/images/icon_youtube.gif
END

View file

@ -1,300 +0,0 @@
10
dir
43979
https://wysiwygbbcode.svn.codeplex.com/svn/images
https://wysiwygbbcode.svn.codeplex.com/svn
2010-04-07T14:06:43.507000Z
43795
unknown
1e68c9db-d3bb-46d7-945c-fd054d4afafc
icon_html.gif
file
2010-04-07T14:11:18.000000Z
67fe598a2ce41218bbe984ecb9ef5120
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
178
img.gif
file
2010-04-07T14:11:18.000000Z
9f86ef7d2cb43dc9211bc4527a4caa4a
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
570
colors.gif
file
2010-04-07T14:11:18.000000Z
2b1af4a86dc3c0c38066fed59a6b9284
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
1024
editbar_bg.gif
file
2010-04-07T14:11:18.000000Z
ab683894bf1f523a2c9e3888b88ff6fe
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
301
url.gif
file
2010-04-07T14:11:18.000000Z
80486c8b54c622eff5fbde9cbe941c36
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
209
icon_list.gif
file
2010-04-07T14:11:18.000000Z
33b13631551a0890584ccc2f9d9187d2
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
82
icon_quote.png
file
2010-04-07T14:11:18.000000Z
c1980342644a5392efefbb315b12b246
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
1239
icon_youtube.gif
file
2010-04-07T14:11:18.000000Z
406fca567bc8bd5655ae0d2cbb6c061c
2010-04-07T14:06:43.507000Z
43795
unknown
has-props
613

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -1,5 +0,0 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

Some files were not shown because too many files have changed in this diff Show more