Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master:
  replace split() by explode(); split is deprecated
  lost changes to tinymce/bbcode
  remove admin view of local directory
  bug #337, call template_unescape() only at the end of template processing
  queue optimisation - back off delivery attempts to once per hour after the first 12 hours.

* master:
This commit is contained in:
Simon L'nu 2012-03-18 12:02:33 -04:00
commit 8b13358ce3
8 changed files with 17 additions and 25 deletions

View file

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1283' ); define ( 'FRIENDICA_VERSION', '2.3.1284' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1132 ); define ( 'DB_UPDATE_VERSION', 1132 );

View file

@ -649,7 +649,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
// template to use to render item (wall, walltowall, search) // template to use to render item (wall, walltowall, search)
'template' => $template, 'template' => $template,
'type' => implode("",array_slice(split("/",$item['verb']),-1)), 'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
'tags' => $tags, 'tags' => $tags,
'body' => template_escape($body), 'body' => template_escape($body),
'text' => strip_tags(template_escape($body)), 'text' => strip_tags(template_escape($body)),

View file

@ -56,7 +56,7 @@ function email_msg_headers($mbox,$uid) {
$raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : ''); $raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
$raw_header = str_replace("\r",'',$raw_header); $raw_header = str_replace("\r",'',$raw_header);
$ret = array(); $ret = array();
$h = split("\n",$raw_header); $h = explode("\n",$raw_header);
if(count($h)) if(count($h))
foreach($h as $line ) { foreach($h as $line ) {
if (preg_match("/^[a-zA-Z]/", $line)) { if (preg_match("/^[a-zA-Z]/", $line)) {

View file

@ -303,7 +303,7 @@ function webfinger_dfrn($s,&$hcard) {
if(! function_exists('webfinger')) { if(! function_exists('webfinger')) {
function webfinger($s) { function webfinger($s, $debug = false) {
$host = ''; $host = '';
if(strstr($s,'@')) { if(strstr($s,'@')) {
$host = substr($s,strpos($s,'@') + 1); $host = substr($s,strpos($s,'@') + 1);
@ -328,7 +328,7 @@ function webfinger($s) {
}} }}
if(! function_exists('lrdd')) { if(! function_exists('lrdd')) {
function lrdd($uri) { function lrdd($uri, $debug = false) {
$a = get_app(); $a = get_app();

View file

@ -61,13 +61,18 @@ function queue_run($argv, $argc){
q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
} }
if($queue_id) if($queue_id) {
$r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1", $r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1",
intval($queue_id) intval($queue_id)
); );
else }
$r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); else {
// For the first 12 hours we'll try to deliver every 15 minutes
// After that, we'll only attempt delivery once per hour.
$r = q("SELECT `id` FROM `queue` WHERE (( `created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR && `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( `last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR ))");
}
if(! count($r)){ if(! count($r)){
return; return;
} }

View file

@ -203,7 +203,7 @@
$os=$s; $count++; $os=$s; $count++;
$s = $this->var_replace($s); $s = $this->var_replace($s);
} }
return template_unescape($s); return $s;
} }
} }

View file

@ -20,7 +20,7 @@ function replace_macros($s,$r) {
//$a = get_app(); //$a = get_app();
//$a->page['debug'] .= "$tt <br>\n"; //$a->page['debug'] .= "$tt <br>\n";
return $r; return template_unescape($r);
}} }}

View file

@ -25,10 +25,6 @@ function directory_post(&$a) {
function directory_content(&$a) { function directory_content(&$a) {
$everything = (($a->argc > 1 && $a->argv[1] === 'all' && is_site_admin()) ? true : false);
if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
$everything = false;
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice( t('Public access denied.') . EOL);
return; return;
@ -52,12 +48,6 @@ function directory_content(&$a) {
} }
$admin = ''; $admin = '';
if(is_site_admin()) {
if($everything)
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory' . '">' . t('Normal site view') . '</a></div></li></ul>';
else
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory/all' . '">' . t('Admin - View all site entries') . '</a></div></li></ul>';
}
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$search' => $search, '$search' => $search,
@ -73,16 +63,13 @@ function directory_content(&$a) {
$search = dbesc($search); $search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$publish = ((get_config('system','publish_all') || $everything) ? '' : " AND `publish` = 1 " ); $publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra "); $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
if(count($r)) if(count($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
if($everything)
$order = " ORDER BY `register_date` DESC ";
else
$order = " ORDER BY `name` ASC "; $order = " ORDER BY `name` ASC ";