Merge branch 'develop' into issue/#3062

* develop: (68 commits)
  Added documentation
  update to the translation
  update to the translations
  translation docs now contain basic usage of the Transifex client
  - Replace TinyMCE-enabled filebrowser.tpl by filebrowser_plain.tpl content
  - Remove misc TinyMCE mentions in docs and minifyjs
  - Remove $theme_richtext_editor boot var - Remove "richtext" feature - Remove fix_mce_lf() function - Remove nomce parameter
  - Remove TinyMCE mentions in themes
  - Remove tinyMCE mentions or convert to addeditortext() - Remove $editselect template value
  Remove tinyMCE libraries
  limit the description of the meta tag to 160 characters in /mod/display
  Improved handling of non string values in the config
  Bugfix: Caching of non string cache values now works.
  Reformatted stuff, improved query
  Auto-focus first input field of modal when shown
  Use cache instead of config for storing last proc_run time
  Some added logging
  Bugfix for masses of php warnings
  Rearranged the logging
  Some changed logging
  ...

# Conflicts:
#	view/theme/frost-mobile/js/theme.js
#	view/theme/frost/js/theme.js
This commit is contained in:
Hypolite Petovan 2017-01-27 15:30:21 -05:00
commit c38a5e443d
438 changed files with 108865 additions and 144355 deletions

View file

@ -6,6 +6,7 @@
* @brief Friendica admin
*/
use \Friendica\Core\Config;
require_once("include/enotify.php");
require_once("include/text.php");
@ -948,6 +949,16 @@ function admin_page_site(App $a) {
$diaspora_able = ($a->get_path() == "");
$optimize_max_tablesize = Config::get('system','optimize_max_tablesize', 100);
if ($optimize_max_tablesize < -1) {
$optimize_max_tablesize = -1;
}
if ($optimize_max_tablesize == 0) {
$optimize_max_tablesize = 100;
}
$t = get_markup_template("admin_site.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
@ -1019,7 +1030,7 @@ function admin_page_site(App $a) {
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$maxloadavg_frontend' => array('maxloadavg_frontend', t("Maximum Load Average (Frontend)"), ((intval(get_config('system','maxloadavg_frontend')) > 0)?get_config('system','maxloadavg_frontend'):50), t("Maximum system load before the frontend quits service - default 50.")),
'$optimize_max_tablesize'=> array('optimize_max_tablesize', t("Maximum table size for optimization"), ((intval(get_config('system','optimize_max_tablesize')) > 0)?get_config('system','optimize_max_tablesize'):100), t("Maximum table size (in MB) for the automatic optimization - default 100 MB. Enter -1 to disable it.")),
'$optimize_max_tablesize'=> array('optimize_max_tablesize', t("Maximum table size for optimization"), $optimize_max_tablesize, t("Maximum table size (in MB) for the automatic optimization - default 100 MB. Enter -1 to disable it.")),
'$optimize_fragmentation'=> array('optimize_fragmentation', t("Minimum level of fragmentation"), ((intval(get_config('system','optimize_fragmentation')) > 0)?get_config('system','optimize_fragmentation'):30), t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")),
'$poco_completion' => array('poco_completion', t("Periodical check of global contacts"), get_config('system','poco_completion'), t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")),

View file

@ -67,10 +67,6 @@ function cal_init(App $a) {
function cal_content(App $a) {
nav_set_selected('events');
$editselect = 'none';
if( feature_enabled(local_user(), 'richtext') )
$editselect = 'textareas';
// First day of the week (0 = Sunday)
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
if ($firstDay === false) $firstDay=0;
@ -84,13 +80,11 @@ function cal_content(App $a) {
'$module_url' => '/cal/' . $a->data['user']['nickname'],
'$modparams' => 2,
'$i18n' => $i18n,
'$editselect' => $editselect
));
$etpl = get_markup_template('event_end.tpl');
$a->page['end'] .= replace_macros($etpl,array(
'$baseurl' => App::get_baseurl(),
'$editselect' => $editselect
));
$o ="";
@ -275,7 +269,7 @@ function cal_content(App $a) {
'$tabs' => $tabs,
'$title' => t('Events'),
'$view' => t('View'),
'$previus' => array(App::get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$previous' => array(App::get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array(App::get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'),

View file

@ -191,13 +191,13 @@ function contacts_post(App $a) {
$fetch_further_information = intval($_POST['fetch_further_information']);
$ffi_keyword_blacklist = fix_mce_lf(escape_tags(trim($_POST['ffi_keyword_blacklist'])));
$ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
$priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0)
$priority = 0;
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
$info = escape_tags(trim($_POST['info']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
`hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d,
@ -489,17 +489,11 @@ function contacts_content(App $a) {
$contact_id = $a->data['contact']['id'];
$contact = $a->data['contact'];
$editselect = 'none';
if( feature_enabled(local_user(),'richtext') )
$editselect = 'exact';
$a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
$a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
require_once('include/contact_selectors.php');

View file

@ -224,9 +224,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
*
*/
$a->config['system']['curl_timeout'] = 120;
$res = post_url($dfrn_confirm,$params);
$res = post_url($dfrn_confirm, $params, null, $redirects, 120);
logger(' Confirm: received data: ' . $res, LOGGER_DATA);

View file

@ -425,6 +425,12 @@ function display_content(App $a, $update = 0) {
if ($title == "") {
$title = $author_name;
}
// Limit the description to 160 characters
if (strlen($description) > 160) {
$description = substr($description, 0, 157) . '...';
}
$description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
$title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
$author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here

View file

@ -28,14 +28,6 @@ function editpost_content(App $a) {
return;
}
/* $plaintext = false;
if( local_user() && intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Edit post')
));
@ -43,7 +35,6 @@ function editpost_content(App $a) {
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']
@ -52,7 +43,6 @@ function editpost_content(App $a) {
$tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']

View file

@ -220,11 +220,6 @@ function events_content(App $a) {
nav_set_selected('events');
}
$editselect = 'none';
if ( feature_enabled(local_user(), 'richtext') ) {
$editselect = 'textareas';
}
// get the translation strings for the callendar
$i18n = get_event_strings();
@ -234,13 +229,11 @@ function events_content(App $a) {
'$module_url' => '/events',
'$modparams' => 1,
'$i18n' => $i18n,
'$editselect' => $editselect
));
$etpl = get_markup_template('event_end.tpl');
$a->page['end'] .= replace_macros($etpl,array(
'$baseurl' => App::get_baseurl(),
'$editselect' => $editselect
));
$o ="";
@ -393,7 +386,7 @@ function events_content(App $a) {
'$title' => t('Events'),
'$view' => t('View'),
'$new_event' => array(App::get_baseurl().'/events/new',t('Create New Event'),'',''),
'$previus' => array(App::get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$previous' => array(App::get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array(App::get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'),

View file

@ -12,24 +12,23 @@ require_once('include/Photo.php');
*/
function fbrowser_content(App $a) {
if (!local_user())
if (!local_user()) {
killme();
}
if ($a->argc==1)
if ($a->argc == 1) {
killme();
}
$template_file = "filebrowser.tpl";
$mode = "";
if (x($_GET,'mode')) {
$template_file = "filebrowser_plain.tpl";
$mode = "?mode=".$_GET['mode'];
}
//echo "<pre>"; var_dump($a->argv); killme();
switch($a->argv[1]){
switch ($a->argv[1]) {
case "image":
$path = array( array("", t("Photos")));
$path = array(array("", t("Photos")));
$albums = false;
$sql_extra = "";
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";

View file

@ -42,7 +42,7 @@ function fetch_init(App $a) {
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
$r = q("SELECT `user`.`prvkey`, `contact`.`addr`, `user`.`nickname`, `contact`.`nick` FROM `user`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
WHERE `user`.`uid` = %d", intval($item[0]["uid"]));
if (!$r) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));

View file

@ -1,5 +1,7 @@
<?php
use \Friendica\Core\Config;
function friendica_init(App $a) {
if ($a->argv[1]=="json"){
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
@ -29,7 +31,7 @@ function friendica_init(App $a) {
$visible_plugins[] = $rr['name'];
}
load_config('feature_lock');
Config::load('feature_lock');
$locked_features = array();
if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
foreach($a->config['feature_lock'] as $k => $v) {

View file

@ -353,20 +353,6 @@ function item_post(App $a) {
$categories .= file_tag_list_to_file($filedas, 'file');
}
// Work around doubled linefeeds in Tinymce 3.5b2
// First figure out if it's a status post that would've been
// created using tinymce. Otherwise leave it alone.
/* $plaintext = (local_user() ? intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled($profile_uid,'richtext') : 0);
if((! $parent) && (! $api_source) && (! $plaintext)) {
$body = fix_mce_lf($body);
}*/
$plaintext = (local_user() ? !feature_enabled($profile_uid,'richtext') : 0);
if((! $parent) && (! $api_source) && (! $plaintext)) {
$body = fix_mce_lf($body);
}
// get contact info for poster
$author = null;

View file

@ -52,17 +52,6 @@ function message_post(App $a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 );
// Work around doubled linefeeds in Tinymce 3.5b2
/* $plaintext = intval(get_pconfig(local_user(),'system','plaintext') && !feature_enabled(local_user(),'richtext'));
if(! $plaintext) {
$body = fix_mce_lf($body);
}*/
$plaintext = intval(!feature_enabled(local_user(),'richtext'));
if(! $plaintext) {
$body = fix_mce_lf($body);
}
$ret = send_message($recipient, $body, $subject, $replyto);
$norecip = false;
@ -275,18 +264,9 @@ function message_content(App $a) {
$o .= $header;
/* $plaintext = false;
if(intval(get_pconfig(local_user(),'system','plaintext')))
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -294,7 +274,6 @@ function message_content(App $a) {
$tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -397,10 +376,6 @@ function message_content(App $a) {
$o .= $header;
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$r = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d AND `mail`.`id` = %d LIMIT 1",
@ -439,7 +414,6 @@ function message_content(App $a) {
$tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -447,12 +421,10 @@ function message_content(App $a) {
$tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$mails = array();
$seen = 0;
$unknown = false;

View file

@ -762,24 +762,23 @@ function network_content(App $a, $update = 0) {
// on they just get buried deeper. It has happened to me a couple of times also.
if((! $group) && (! $cid) && (! $star)) {
if (!$group && !$cid && !$star) {
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `uid` = %d",
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `uid` = %d LIMIT 1",
intval(local_user()));
if ($unseen)
if (dbm::is_result($unseen)) {
$r = q("UPDATE `item` SET `unseen` = 0
WHERE `unseen` = 1 AND `uid` = %d",
intval(local_user())
);
}
else {
if($update_unseen) {
}
} elseif ($update_unseen) {
$unseen = q("SELECT `id` FROM `item` ".$update_unseen);
$unseen = q("SELECT `id` FROM `item` ".$update_unseen. " LIMIT 1");
if ($unseen)
$r = q("UPDATE `item` SET `unseen` = 0 $update_unseen");
if (dbm::is_result($unseen)) {
$r = q("UPDATE `item` SET `unseen` = 0 $update_unseen");
}
}
@ -790,10 +789,10 @@ function network_content(App $a, $update = 0) {
$o .= conversation($a,$items,$mode,$update);
if(!$update) {
if(get_pconfig(local_user(),'system','infinite_scroll')) {
if (!$update) {
if (get_pconfig(local_user(),'system','infinite_scroll')) {
$o .= scroll_loader();
} elseif(!get_config('system', 'old_pager')) {
} elseif (!get_config('system', 'old_pager')) {
$o .= alt_pager($a,count($items));
} else {
$o .= paginate($a);

View file

@ -1,17 +1,13 @@
<?php
function oexchange_init(App $a) {
if(($a->argc > 1) && ($a->argv[1] === 'xrd')) {
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = get_markup_template('oexchange_xrd.tpl');
$o = replace_macros($tpl, array('$base' => App::get_baseurl()));
echo $o;
killme();
}
}
function oexchange_content(App $a) {
@ -37,8 +33,9 @@ function oexchange_content(App $a) {
$s = fetch_url(App::get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
if(! strlen($s))
if (! strlen($s)) {
return;
}
require_once('include/html2bbcode.php');
@ -52,7 +49,4 @@ function oexchange_content(App $a) {
$_REQUEST = $post;
require_once('mod/item.php');
item_post($a);
}

View file

@ -46,7 +46,7 @@ function p_init($a){
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
$r = q("SELECT `user`.`prvkey`, `contact`.`addr`, `user`.`nickname`, `contact`.`nick` FROM `user`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
WHERE `user`.`uid` = %d", intval($item[0]["uid"]));
if (!dbm::is_result($r)) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));

View file

@ -4,13 +4,8 @@
* @file mod/parse_url.php
* @brief The parse_url module
*
* This module does parse an url for embedable content (audio, video, image files or link)
* information and does format this information to BBCode or html (this depends
* on the user settings - default is BBCode output).
* If the user has enabled the richtext editor setting the output will be in html
* (Note: This is not always possible and in some case not useful because
* the richtext editor doesn't support all kind of html).
* Otherwise the output will be constructed BBCode.
* This module does parse an url for embeddable content (audio, video, image files or link)
* information and does format this information to BBCode
*
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
*/
@ -24,13 +19,7 @@ function parse_url_content(App $a) {
$text = null;
$str_tags = "";
$textmode = false;
if (local_user() && (!feature_enabled(local_user(), "richtext"))) {
$textmode = true;
}
$br = (($textmode) ? "\n" : "<br />");
$br = "\n";
if (x($_GET,"binurl")) {
$url = trim(hex2bin($_GET["binurl"]));
@ -97,11 +86,7 @@ function parse_url_content(App $a) {
}
}
if ($textmode) {
$template = "[bookmark=%s]%s[/bookmark]%s";
} else {
$template = "<a class=\"bookmark\" href=\"%s\" >%s</a>%s";
}
$template = "[bookmark=%s]%s[/bookmark]%s";
$arr = array("url" => $url, "text" => "");
@ -118,12 +103,7 @@ function parse_url_content(App $a) {
$title = str_replace(array("\r","\n"),array("",""),$title);
if ($textmode) {
$text = "[quote]" . trim($text) . "[/quote]" . $br;
} else {
$text = "<blockquote>" . htmlspecialchars(trim($text)) . "</blockquote><br />";
$title = htmlspecialchars($title);
}
$text = "[quote]" . trim($text) . "[/quote]" . $br;
$result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
@ -141,11 +121,6 @@ function parse_url_content(App $a) {
// Format it as BBCode attachment
$info = add_page_info_data($siteinfo);
if (!$textmode) {
// Replace ' with - not perfect - but the richtext editor has problems otherwise
$info = str_replace(array("&#039;"), array("&#8217;"), $info);
}
echo $info;
killme();

View file

@ -10,6 +10,8 @@ require_once('include/tags.php');
require_once('include/threads.php');
require_once('include/Probe.php');
use \Friendica\Core\Config;
function photos_init(App $a) {
if ($a->argc > 1)
@ -1339,35 +1341,38 @@ function photos_content(App $a) {
$prevlink = '';
$nextlink = '';
if ($_GET['order'] === 'posted')
$order = 'ASC';
else
$order = 'DESC';
/// @todo This query is totally bad, the whole functionality has to be changed
// The query leads to a really intense used index.
// By now we hide it if someone wants to.
if (!Config::get('system', 'no_count', false)) {
if ($_GET['order'] === 'posted')
$order = 'ASC';
else
$order = 'DESC';
$prvnxt = qu("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
$sql_extra ORDER BY `created` $order ",
dbesc($ph[0]['album']),
intval($owner_uid)
);
$prvnxt = qu("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
$sql_extra ORDER BY `created` $order ",
dbesc($ph[0]['album']),
intval($owner_uid)
);
if (count($prvnxt)) {
for($z = 0; $z < count($prvnxt); $z++) {
if ($prvnxt[$z]['resource-id'] == $ph[0]['resource-id']) {
$prv = $z - 1;
$nxt = $z + 1;
if ($prv < 0)
$prv = count($prvnxt) - 1;
if ($nxt >= count($prvnxt))
$nxt = 0;
break;
if (count($prvnxt)) {
for($z = 0; $z < count($prvnxt); $z++) {
if ($prvnxt[$z]['resource-id'] == $ph[0]['resource-id']) {
$prv = $z - 1;
$nxt = $z + 1;
if ($prv < 0)
$prv = count($prvnxt) - 1;
if ($nxt >= count($prvnxt))
$nxt = 0;
break;
}
}
}
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
$prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
$nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
}
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
$prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
$nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
}
}
if (count($ph) == 1)
$hires = $lores = $ph[0];

View file

@ -5,6 +5,7 @@ require_once('include/ForumManager.php');
require_once('include/group.php');
require_once('mod/proxy.php');
require_once('include/xml.php');
require_once('include/cache.php');
/**
* @brief Outputs the counts and the lists of various notifications
@ -195,13 +196,20 @@ function ping_init(App $a)
}
}
$ev = qu("SELECT count(`event`.`id`) AS total, type, start, adjust FROM `event`
WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0
ORDER BY `start` ASC ",
intval(local_user()),
dbesc(datetime_convert('UTC', 'UTC', 'now + 7 days')),
dbesc(datetime_convert('UTC', 'UTC', 'now'))
);
$cachekey = "ping_init:".local_user();
$ev = Cache::get($cachekey);
if (is_null($ev)) {
$ev = qu("SELECT count(`event`.`id`) AS total, type, start, adjust FROM `event`
WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0
ORDER BY `start` ASC ",
intval(local_user()),
dbesc(datetime_convert('UTC', 'UTC', 'now + 7 days')),
dbesc(datetime_convert('UTC', 'UTC', 'now'))
);
if (dbm::is_result($ev)) {
Cache::set($cachekey, $ev, CACHE_HOUR);
}
}
if (dbm::is_result($ev)) {
$all_events = intval($ev[0]['total']);

View file

@ -313,19 +313,19 @@ function profiles_post(App $a) {
$politic = notags(trim($_POST['politic']));
$religion = notags(trim($_POST['religion']));
$likes = fix_mce_lf(escape_tags(trim($_POST['likes'])));
$dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes'])));
$likes = escape_tags(trim($_POST['likes']));
$dislikes = escape_tags(trim($_POST['dislikes']));
$about = fix_mce_lf(escape_tags(trim($_POST['about'])));
$interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
$contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
$music = fix_mce_lf(escape_tags(trim($_POST['music'])));
$book = fix_mce_lf(escape_tags(trim($_POST['book'])));
$tv = fix_mce_lf(escape_tags(trim($_POST['tv'])));
$film = fix_mce_lf(escape_tags(trim($_POST['film'])));
$romance = fix_mce_lf(escape_tags(trim($_POST['romance'])));
$work = fix_mce_lf(escape_tags(trim($_POST['work'])));
$education = fix_mce_lf(escape_tags(trim($_POST['education'])));
$about = escape_tags(trim($_POST['about']));
$interest = escape_tags(trim($_POST['interest']));
$contact = escape_tags(trim($_POST['contact']));
$music = escape_tags(trim($_POST['music']));
$book = escape_tags(trim($_POST['book']));
$tv = escape_tags(trim($_POST['tv']));
$film = escape_tags(trim($_POST['film']));
$romance = escape_tags(trim($_POST['romance']));
$work = escape_tags(trim($_POST['work']));
$education = escape_tags(trim($_POST['education']));
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
@ -623,23 +623,13 @@ function profiles_content(App $a) {
require_once('include/profile_selectors.php');
/* $editselect = 'textareas';
if( intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
$editselect = 'none';*/
$editselect = 'none';
if( feature_enabled(local_user(),'richtext') )
$editselect = 'textareas';
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
$a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
$hide_friends = replace_macros($opt_tpl,array(
'$yesno' => array(

View file

@ -12,113 +12,119 @@ function uexport_init(App $a) {
/// @TODO Change space -> tab where wanted
function uexport_content(App $a) {
if ($a->argc > 1) {
header("Content-type: application/json");
header('Content-Disposition: attachment; filename="'.$a->user['nickname'].'.'.$a->argv[1].'"');
switch($a->argv[1]) {
case "backup": uexport_all($a); killme(); break;
case "account": uexport_account($a); killme(); break;
default:
killme();
}
}
/**
* options shown on "Export personal data" page
* list of array( 'link url', 'link text', 'help text' )
*/
$options = array(
array('uexport/account',t('Export account'),t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')),
array('uexport/backup',t('Export all'),t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')),
);
call_hooks('uexport_options', $options);
$tpl = get_markup_template("uexport.tpl");
return replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$title' => t('Export personal data'),
'$options' => $options
));
if ($a->argc > 1) {
header("Content-type: application/json");
header('Content-Disposition: attachment; filename="'.$a->user['nickname'].'.'.$a->argv[1].'"');
switch($a->argv[1]) {
case "backup":
uexport_all($a);
killme();
break;
case "account":
uexport_account($a);
killme();
break;
default:
killme();
}
}
/**
* options shown on "Export personal data" page
* list of array( 'link url', 'link text', 'help text' )
*/
$options = array(
array('uexport/account',t('Export account'),t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')),
array('uexport/backup',t('Export all'),t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')),
);
call_hooks('uexport_options', $options);
$tpl = get_markup_template("uexport.tpl");
return replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$title' => t('Export personal data'),
'$options' => $options
));
}
function _uexport_multirow($query) {
$result = array();
$r = q($query);
// if (dbm::is_result($r)) {
if ($r){
if (dbm::is_result($r)) {
foreach($r as $rr){
$p = array();
foreach($rr as $k => $v)
$p = array();
foreach($rr as $k => $v) {
$p[$k] = $v;
$result[] = $p;
}
}
$result[] = $p;
}
}
return $result;
return $result;
}
function _uexport_row($query) {
$result = array();
$r = q($query);
if ($r) {
foreach($r as $rr)
foreach($rr as $k => $v)
if (dbm::is_result($r)) {
foreach($r as $rr) {
foreach($rr as $k => $v) {
$result[$k] = $v;
}
}
}
return $result;
return $result;
}
function uexport_account($a){
$user = _uexport_row(
sprintf( "SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()) )
sprintf( "SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()) )
);
$contact = _uexport_multirow(
sprintf( "SELECT * FROM `contact` WHERE `uid` = %d ",intval(local_user()) )
sprintf( "SELECT * FROM `contact` WHERE `uid` = %d ",intval(local_user()) )
);
$profile =_uexport_multirow(
sprintf( "SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()) )
sprintf( "SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()) )
);
$photo = _uexport_multirow(
sprintf( "SELECT * FROM `photo` WHERE uid = %d AND profile = 1", intval(local_user()) )
);
foreach ($photo as &$p) $p['data'] = bin2hex($p['data']);
$photo = _uexport_multirow(
sprintf( "SELECT * FROM `photo` WHERE uid = %d AND profile = 1", intval(local_user()) )
);
foreach ($photo as &$p) {
$p['data'] = bin2hex($p['data']);
}
$pconfig = _uexport_multirow(
sprintf( "SELECT * FROM `pconfig` WHERE uid = %d",intval(local_user()) )
);
$pconfig = _uexport_multirow(
sprintf( "SELECT * FROM `pconfig` WHERE uid = %d",intval(local_user()) )
);
$group = _uexport_multirow(
sprintf( "SELECT * FROM `group` WHERE uid = %d",intval(local_user()) )
);
$group = _uexport_multirow(
sprintf( "SELECT * FROM `group` WHERE uid = %d",intval(local_user()) )
);
$group_member = _uexport_multirow(
sprintf( "SELECT * FROM `group_member` WHERE uid = %d",intval(local_user()) )
);
$group_member = _uexport_multirow(
sprintf( "SELECT * FROM `group_member` WHERE uid = %d",intval(local_user()) )
);
$output = array(
'version' => FRIENDICA_VERSION,
'schema' => DB_UPDATE_VERSION,
'baseurl' => App::get_baseurl(),
'user' => $user,
'contact' => $contact,
'profile' => $profile,
'photo' => $photo,
'pconfig' => $pconfig,
'group' => $group,
'group_member' => $group_member,
);
'version' => FRIENDICA_VERSION,
'schema' => DB_UPDATE_VERSION,
'baseurl' => App::get_baseurl(),
'user' => $user,
'contact' => $contact,
'profile' => $profile,
'photo' => $photo,
'pconfig' => $pconfig,
'group' => $group,
'group_member' => $group_member,
);
//echo "<pre>"; var_dump(json_encode($output)); killme();
//echo "<pre>"; var_dump(json_encode($output)); killme();
echo json_encode($output);
}
/**
@ -132,12 +138,12 @@ function uexport_all(App $a) {
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
intval(local_user())
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$total = $r[0]['total'];
}
// chunk the output to avoid exhausting memory
for($x = 0; $x < $total; $x += 500) {
for ($x = 0; $x < $total; $x += 500) {
$item = array();
$r = q("SELECT * FROM `item` WHERE `uid` = %d LIMIT %d, %d",
intval(local_user()),
@ -153,5 +159,4 @@ function uexport_all(App $a) {
$output = array('item' => $r);
echo json_encode($output)."\n";
}
}

View file

@ -8,45 +8,45 @@ require_once("include/uimport.php");
function uimport_post(App $a) {
switch($a->config['register_policy']) {
case REGISTER_OPEN:
$blocked = 0;
$verified = 1;
break;
case REGISTER_OPEN:
$blocked = 0;
$verified = 1;
break;
case REGISTER_APPROVE:
$blocked = 1;
$verified = 0;
break;
case REGISTER_APPROVE:
$blocked = 1;
$verified = 0;
break;
default:
case REGISTER_CLOSED:
if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
notice( t('Permission denied.') . EOL );
return;
}
$blocked = 1;
$verified = 0;
break;
default:
case REGISTER_CLOSED:
if ((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
notice( t('Permission denied.') . EOL );
return;
}
$blocked = 1;
$verified = 0;
break;
}
if (x($_FILES,'accountfile')){
/// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE
import_account($a, $_FILES['accountfile']);
return;
}
if (x($_FILES,'accountfile')){
/// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE
import_account($a, $_FILES['accountfile']);
return;
}
}
function uimport_content(App $a) {
if((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
if ((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
notice("Permission denied." . EOL);
return;
}
$max_dailies = intval(get_config('system','max_daily_registrations'));
if($max_dailies) {
if ($max_dailies) {
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
if($r && $r[0]['total'] >= $max_dailies) {
if ($r && $r[0]['total'] >= $max_dailies) {
logger('max daily registrations exceeded.');
notice( t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
return;
@ -54,21 +54,22 @@ function uimport_content(App $a) {
}
if(x($_SESSION,'theme'))
if (x($_SESSION,'theme')) {
unset($_SESSION['theme']);
if(x($_SESSION,'mobile-theme'))
}
if (x($_SESSION,'mobile-theme')) {
unset($_SESSION['mobile-theme']);
}
$tpl = get_markup_template("uimport.tpl");
return replace_macros($tpl, array(
'$regbutt' => t('Import'),
'$import' => array(
'title' => t("Move account"),
'intro' => t("You can import an account from another Friendica server."),
'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),
'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),
'field' => array('accountfile', t('Account file'),'<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),
),
));
$tpl = get_markup_template("uimport.tpl");
return replace_macros($tpl, array(
'$regbutt' => t('Import'),
'$import' => array(
'title' => t("Move account"),
'intro' => t("You can import an account from another Friendica server."),
'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),
'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),
'field' => array('accountfile', t('Account file'),'<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),
),
));
}

View file

@ -277,16 +277,10 @@ function wall_upload_post(App $a, $desktopmode = true) {
/* mod Waitman Gobble NO WARRANTY */
//if we get the signal then return the image url info in BBCODE, otherwise this outputs the info and bails (for the ajax image uploader on wall post)
// if we get the signal then return the image url info in BBCODE
if ($_REQUEST['hush']!='yeah') {
if(local_user() && (! feature_enabled(local_user(),'richtext') || x($_REQUEST['nomce'])) ) {
echo "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
}
else {
echo '<br /><br /><a href="' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."\" alt=\"$basename\" /></a><br /><br />";
}
}
else {
echo "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
} else {
$m = '[url='.App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.App::get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
return($m);
}

View file

@ -43,12 +43,6 @@ function wallmessage_post(App $a) {
return;
}
// Work around doubled linefeeds in Tinymce 3.5b2
$body = str_replace("\r\n","\n",$body);
$body = str_replace("\n\n","\n",$body);
$ret = send_wallmessage($user, $body, $subject, $replyto);
switch($ret){
@ -113,16 +107,9 @@ function wallmessage_content(App $a) {
return;
}
$editselect = 'none';
if( feature_enabled(local_user(), 'richtext') )
$editselect = '/(profile-jot-text|prvmail-text)/';
$tpl = get_markup_template('wallmsg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
'$editselect' => $editselect,
'$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -130,13 +117,10 @@ function wallmessage_content(App $a) {
$tpl = get_markup_template('wallmsg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
'$editselect' => $editselect,
'$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$tpl = get_markup_template('wallmessage.tpl');
$o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'),