Merge pull request #1008 from annando/master

Expire, "attachment" element and database structure
This commit is contained in:
fabrixxm 2014-06-14 20:05:10 +02:00
commit adefb06ff7
13 changed files with 588 additions and 376 deletions

View file

@ -143,6 +143,7 @@ define ( 'NETWORK_PUMPIO', 'pump'); // pump.io
define ( 'NETWORK_TWITTER', 'twit'); // Twitter define ( 'NETWORK_TWITTER', 'twit'); // Twitter
define ( 'NETWORK_DIASPORA2', 'dspc'); // Diaspora connector define ( 'NETWORK_DIASPORA2', 'dspc'); // Diaspora connector
define ( 'NETWORK_STATUSNET', 'stac'); // Statusnet connector define ( 'NETWORK_STATUSNET', 'stac'); // Statusnet connector
define ( 'NETWORK_APPNET', 'apdn'); // app.net
define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
@ -169,6 +170,7 @@ $netgroup_ids = array(
NETWORK_TWITTER => (-14), NETWORK_TWITTER => (-14),
NETWORK_DIASPORA2 => (-15), NETWORK_DIASPORA2 => (-15),
NETWORK_STATUSNET => (-16), NETWORK_STATUSNET => (-16),
NETWORK_APPNET => (-17),
NETWORK_PHANTOM => (-127), NETWORK_PHANTOM => (-127),
); );
@ -1000,6 +1002,10 @@ if(! function_exists('update_db')) {
if(DB_UPDATE_VERSION == UPDATE_VERSION) { if(DB_UPDATE_VERSION == UPDATE_VERSION) {
// Compare the current structure with the defined structure
require_once("include/dbstructure.php");
update_structure(false, true);
for($x = $stored; $x < $current; $x ++) { for($x = $stored; $x < $current; $x ++) {
if(function_exists('update_' . $x)) { if(function_exists('update_' . $x)) {

View file

@ -2,6 +2,79 @@
require_once("include/oembed.php"); require_once("include/oembed.php");
require_once('include/event.php'); require_once('include/event.php');
function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$Text = preg_replace_callback("/\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
function ($match) use ($plaintext){
$attributes = $match[1];
$type = "";
preg_match("/type='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$type = $matches[1];
preg_match('/type="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$type = $matches[1];
if ($type == "")
return($match[0]);
if (!in_array($type, array("link", "audio", "video")))
return($match[0]);
$url = "";
preg_match("/url='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$url = $matches[1];
preg_match('/url="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$url = $matches[1];
$title = "";
preg_match("/title='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$title = $matches[1];
preg_match('/title="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$title = $matches[1];
$image = "";
preg_match("/image='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$image = $matches[1];
preg_match('/image="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$image = $matches[1];
if ($plaintext)
$text = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title);
else {
$text = sprintf('<span class="type-%s">', $type);
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $url, $title), $title, $url);
if ($tryoembed)
$oembed = tryoembed($bookmark);
else
$oembed = $bookmark[0];
if (($image != "") AND !strstr(strtolower($oembed), "<img "))
$text .= sprintf('<img src="%s" alt="%s" />', $image, $title); // To-Do: Anführungszeichen in "alt"
$text .= $oembed;
$text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[2]));
}
return($text);
},$Text);
return($Text);
}
function bb_rearrange_link($shared) { function bb_rearrange_link($shared) {
if ($shared[1] != "type-link") if ($shared[1] != "type-link")
return($shared[0]); return($shared[0]);
@ -535,6 +608,10 @@ function GetProfileUsername($profile, $username) {
if ($twitter != $profile) if ($twitter != $profile)
return($username." (".$twitter.")"); return($username." (".$twitter.")");
$appnet = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1@alpha.app.net", $profile);
if ($appnet != $profile)
return($username." (".$appnet.")");
$gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile); $gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile);
if ($gplus != $profile) if ($gplus != $profile)
return($username." (".$gplus.")"); return($username." (".$gplus.")");
@ -561,7 +638,7 @@ function GetProfileUsername($profile, $username) {
// pumpio (http://host.name/user) // pumpio (http://host.name/user)
$rest = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$3", $profile); $rest = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$3", $profile);
if ($rest == "") { if ($rest == "") {
$pumpio = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "*$2@$1*", $profile); $pumpio = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$2@$1", $profile);
if ($pumpio != $profile) if ($pumpio != $profile)
return($username." (".$pumpio.")"); return($username." (".$pumpio.")");
} }
@ -706,6 +783,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace("/\n\[code\]/ism", "[code]", $Text); $Text = preg_replace("/\n\[code\]/ism", "[code]", $Text);
$Text = preg_replace("/\[\/code\]\n/ism", "[/code]", $Text); $Text = preg_replace("/\[\/code\]\n/ism", "[/code]", $Text);
// Handle attached links or videos
$Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed);
// Rearrange shared links // Rearrange shared links
if (get_config("system", "rearrange_shared_links") AND (!$simplehtml OR $tryoembed)) if (get_config("system", "rearrange_shared_links") AND (!$simplehtml OR $tryoembed))
$Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_rearrange_link",$Text); $Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_rearrange_link",$Text);
@ -822,8 +902,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
// Check for sized text // Check for sized text
// [size=50] --> font-size: 50px (with the unit). // [size=50] --> font-size: 50px (with the unit).
$Text = preg_replace("(\[size=(\d*?)\](.*?)\[\/size\])ism","<span style=\"font-size: $1px;\">$2</span>",$Text); $Text = preg_replace("(\[size=(\d*?)\](.*?)\[\/size\])ism","<span style=\"font-size: $1px; line-height: initial;\">$2</span>",$Text);
$Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])ism","<span style=\"font-size: $1;\">$2</span>",$Text); $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])ism","<span style=\"font-size: $1; line-height: initial;\">$2</span>",$Text);
// Check for centered text // Check for centered text
$Text = preg_replace("(\[center\](.*?)\[\/center\])ism","<div style=\"text-align:center;\">$1</div>",$Text); $Text = preg_replace("(\[center\](.*?)\[\/center\])ism","<div style=\"text-align:center;\">$1</div>",$Text);

View file

@ -88,7 +88,8 @@ function network_to_name($s) {
NETWORK_PUMPIO => t('pump.io'), NETWORK_PUMPIO => t('pump.io'),
NETWORK_TWITTER => t('Twitter'), NETWORK_TWITTER => t('Twitter'),
NETWORK_DIASPORA2 => t('Diaspora Connector'), NETWORK_DIASPORA2 => t('Diaspora Connector'),
NETWORK_STATUSNET => t('Statusnet') NETWORK_STATUSNET => t('Statusnet'),
NETWORK_APPNET => t('App.net')
); );
call_hooks('network_to_name', $nets); call_hooks('network_to_name', $nets);

View file

@ -100,7 +100,7 @@ class dba {
public function q($sql, $onlyquery = false) { public function q($sql, $onlyquery = false) {
global $a; global $a;
$strHandler = (true === $onlyquery) ? 'PDOStatement' : 'MULTI'; $strHandler = (true === $onlyquery) ? 'PDOStatement' : 'MULTI';
$strQueryAlias = md5($sql); $strQueryAlias = md5($sql);

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,7 @@ function expire_run(&$argv, &$argc){
if(is_null($a)) { if(is_null($a)) {
$a = new App; $a = new App;
} }
if(is_null($db)) { if(is_null($db)) {
@include(".htconfig.php"); @include(".htconfig.php");
require_once("include/dba.php"); require_once("include/dba.php");
@ -38,7 +38,7 @@ function expire_run(&$argv, &$argc){
q("optimize table item"); q("optimize table item");
logger('expire: start'); logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0"); $r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
@ -47,6 +47,10 @@ function expire_run(&$argv, &$argc){
} }
} }
load_hooks();
call_hooks('expire');
return; return;
} }

View file

@ -4102,7 +4102,7 @@ function item_getfeedattach($item) {
function item_expire($uid,$days) { function item_expire($uid, $days, $network = "", $force = false) {
if((! $uid) || ($days < 1)) if((! $uid) || ($days < 1))
return; return;
@ -4113,9 +4113,17 @@ function item_expire($uid,$days) {
$expire_network_only = get_pconfig($uid,'expire','network_only'); $expire_network_only = get_pconfig($uid,'expire','network_only');
$sql_extra = ((intval($expire_network_only)) ? " AND wall = 0 " : ""); $sql_extra = ((intval($expire_network_only)) ? " AND wall = 0 " : "");
if ($network != "") {
$sql_extra .= sprintf(" AND network = '%s' ", dbesc($network));
// There is an index "uid_network_received" but not "uid_network_created"
// This avoids the creation of another index just for one purpose.
// And it doesn't really matter wether to look at "received" or "created"
$range = "AND `received` < UTC_TIMESTAMP() - INTERVAL %d DAY ";
} else
$range = "AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY ";
$r = q("SELECT * FROM `item` $r = q("SELECT * FROM `item`
WHERE `uid` = %d WHERE `uid` = %d $range
AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY
AND `id` = `parent` AND `id` = `parent`
$sql_extra $sql_extra
AND `deleted` = 0", AND `deleted` = 0",
@ -4129,6 +4137,10 @@ function item_expire($uid,$days) {
$expire_items = get_pconfig($uid, 'expire','items'); $expire_items = get_pconfig($uid, 'expire','items');
$expire_items = (($expire_items===false)?1:intval($expire_items)); // default if not set: 1 $expire_items = (($expire_items===false)?1:intval($expire_items)); // default if not set: 1
// Forcing expiring of items - but not notes and marked items
if ($force)
$expire_items = true;
$expire_notes = get_pconfig($uid, 'expire','notes'); $expire_notes = get_pconfig($uid, 'expire','notes');
$expire_notes = (($expire_notes===false)?1:intval($expire_notes)); // default if not set: 1 $expire_notes = (($expire_notes===false)?1:intval($expire_notes)); // default if not set: 1

View file

@ -90,11 +90,32 @@ function community_content(&$a, $update = 0) {
return $o; return $o;
} }
$maxpostperauthor = get_config('system','max_author_posts_community_page');
if ($maxpostperauthor != 0) {
$previousauthor = "";
$numposts = 0;
$s = array();
foreach ($r AS $row=>$item) {
if ($previousauthor == $item["author-link"])
++$numposts;
else
$numposts = 0;
$previousauthor = $item["author-link"];
if ($numposts < $maxpostperauthor)
$s[] = $item;
}
} else
$s = $r;
// we behave the same in message lists as the search module // we behave the same in message lists as the search module
$o .= conversation($a,$r,'community',$update); $o .= conversation($a,$s,'community',$update);
if( get_config('alt_pager', 'global') || get_pconfig(local_user(),'system','alt_pager') ) { if(get_config('alt_pager', 'global') || get_pconfig(local_user(),'system','alt_pager') ) {
$o .= alt_pager($a,count($r)); $o .= alt_pager($a,count($r));
} }
else { else {

View file

@ -4,7 +4,7 @@ $install_wizard_pass=1;
function install_init(&$a){ function install_init(&$a){
// $baseurl/install/testrwrite to test if rewite in .htaccess is working // $baseurl/install/testrwrite to test if rewite in .htaccess is working
if ($a->argc==2 && $a->argv[1]=="testrewrite") { if ($a->argc==2 && $a->argv[1]=="testrewrite") {
echo "ok"; echo "ok";
@ -58,7 +58,7 @@ function install_post(&$a) {
$a->data['db_conn_failed']=true; $a->data['db_conn_failed']=true;
} }
return; return;
break; break;
case 4: case 4:
$urlpath = $a->get_path(); $urlpath = $a->get_path();
@ -107,7 +107,7 @@ function get_db_errno() {
return mysqli_connect_errno(); return mysqli_connect_errno();
else else
return mysql_errno(); return mysql_errno();
} }
function install_content(&$a) { function install_content(&$a) {
@ -115,9 +115,9 @@ function install_content(&$a) {
$o = ''; $o = '';
$wizard_status = ""; $wizard_status = "";
$install_title = t('Friendica Communications Server - Setup'); $install_title = t('Friendica Communications Server - Setup');
if(x($a->data,'db_conn_failed')) { if(x($a->data,'db_conn_failed')) {
$install_wizard_pass = 2; $install_wizard_pass = 2;
$wizard_status = t('Could not connect to database.'); $wizard_status = t('Could not connect to database.');
@ -126,7 +126,7 @@ function install_content(&$a) {
$install_wizard_pass = 2; $install_wizard_pass = 2;
$wizard_status = t('Could not create table.'); $wizard_status = t('Could not create table.');
} }
$db_return_text=""; $db_return_text="";
if(x($a->data,'db_installed')) { if(x($a->data,'db_installed')) {
$txt = '<p style="font-size: 130%;">'; $txt = '<p style="font-size: 130%;">';
@ -140,7 +140,7 @@ function install_content(&$a) {
$txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL ; $txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL ;
$db_return_text .= $txt; $db_return_text .= $txt;
} }
if($db && $db->connected) { if($db && $db->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`"); $r = q("SELECT COUNT(*) as `total` FROM `user`");
if($r && count($r) && $r[0]['total']) { if($r && count($r) && $r[0]['total']) {
@ -157,7 +157,7 @@ function install_content(&$a) {
if(x($a->data,'txt') && strlen($a->data['txt'])) { if(x($a->data,'txt') && strlen($a->data['txt'])) {
$db_return_text .= manual_config($a); $db_return_text .= manual_config($a);
} }
if ($db_return_text!="") { if ($db_return_text!="") {
$tpl = get_markup_template('install.tpl'); $tpl = get_markup_template('install.tpl');
return replace_macros($tpl, array( return replace_macros($tpl, array(
@ -166,7 +166,7 @@ function install_content(&$a) {
'$text' => $db_return_text . what_next(), '$text' => $db_return_text . what_next(),
)); ));
} }
switch ($install_wizard_pass){ switch ($install_wizard_pass){
case 1: { // System check case 1: { // System check
@ -180,21 +180,21 @@ function install_content(&$a) {
check_smarty3($checks); check_smarty3($checks);
check_keys($checks); check_keys($checks);
if(x($_POST,'phpath')) if(x($_POST,'phpath'))
$phpath = notags(trim($_POST['phpath'])); $phpath = notags(trim($_POST['phpath']));
check_php($phpath, $checks); check_php($phpath, $checks);
check_htaccess($checks); check_htaccess($checks);
function check_passed($v, $c){ function check_passed($v, $c){
if ($c['required']) if ($c['required'])
$v = $v && $c['status']; $v = $v && $c['status'];
return $v; return $v;
} }
$checkspassed = array_reduce($checks, "check_passed", true); $checkspassed = array_reduce($checks, "check_passed", true);
$tpl = get_markup_template('install_checks.tpl'); $tpl = get_markup_template('install_checks.tpl');
@ -211,7 +211,7 @@ function install_content(&$a) {
)); ));
return $o; return $o;
}; break; }; break;
case 2: { // Database config case 2: { // Database config
$dbhost = ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost'); $dbhost = ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
@ -219,7 +219,7 @@ function install_content(&$a) {
$dbpass = notags(trim($_POST['dbpass'])); $dbpass = notags(trim($_POST['dbpass']));
$dbdata = notags(trim($_POST['dbdata'])); $dbdata = notags(trim($_POST['dbdata']));
$phpath = notags(trim($_POST['phpath'])); $phpath = notags(trim($_POST['phpath']));
$tpl = get_markup_template('install_db.tpl'); $tpl = get_markup_template('install_db.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
@ -230,23 +230,23 @@ function install_content(&$a) {
'$info_03' => t('The database you specify below should already exist. If it does not, please create it before continuing.'), '$info_03' => t('The database you specify below should already exist. If it does not, please create it before continuing.'),
'$status' => $wizard_status, '$status' => $wizard_status,
'$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, ''), '$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, ''),
'$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, ''), '$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, ''),
'$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, ''), '$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, ''),
'$dbdata' => array('dbdata', t('Database Name'), $dbdata, ''), '$dbdata' => array('dbdata', t('Database Name'), $dbdata, ''),
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$lbl_10' => t('Please select a default timezone for your website'), '$lbl_10' => t('Please select a default timezone for your website'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$phpath' => $phpath, '$phpath' => $phpath,
'$submit' => t('Submit'), '$submit' => t('Submit'),
)); ));
return $o; return $o;
}; break; }; break;
@ -257,38 +257,38 @@ function install_content(&$a) {
$dbpass = notags(trim($_POST['dbpass'])); $dbpass = notags(trim($_POST['dbpass']));
$dbdata = notags(trim($_POST['dbdata'])); $dbdata = notags(trim($_POST['dbdata']));
$phpath = notags(trim($_POST['phpath'])); $phpath = notags(trim($_POST['phpath']));
$adminmail = notags(trim($_POST['adminmail'])); $adminmail = notags(trim($_POST['adminmail']));
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles'); $timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
$tpl = get_markup_template('install_settings.tpl'); $tpl = get_markup_template('install_settings.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$title' => $install_title, '$title' => $install_title,
'$pass' => t('Site settings'), '$pass' => t('Site settings'),
'$status' => $wizard_status, '$status' => $wizard_status,
'$dbhost' => $dbhost, '$dbhost' => $dbhost,
'$dbuser' => $dbuser, '$dbuser' => $dbuser,
'$dbpass' => $dbpass, '$dbpass' => $dbpass,
'$dbdata' => $dbdata, '$dbdata' => $dbdata,
'$phpath' => $phpath, '$phpath' => $phpath,
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''), '$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$submit' => t('Submit'), '$submit' => t('Submit'),
)); ));
return $o; return $o;
}; break; }; break;
} }
} }
@ -327,9 +327,9 @@ function check_php(&$phpath, &$checks) {
)); ));
$phpath=""; $phpath="";
} }
check_add($checks, t('Command line PHP').($passed?" (<tt>$phpath</tt>)":""), $passed, false, $help); check_add($checks, t('Command line PHP').($passed?" (<tt>$phpath</tt>)":""), $passed, false, $help);
if($passed) { if($passed) {
$cmd = "$phpath -v"; $cmd = "$phpath -v";
$result = trim(shell_exec($cmd)); $result = trim(shell_exec($cmd));
@ -342,8 +342,8 @@ function check_php(&$phpath, &$checks) {
} }
check_add($checks, t('PHP cli binary'), $passed2, true, $help); check_add($checks, t('PHP cli binary'), $passed2, true, $help);
} }
if($passed2) { if($passed2) {
$str = autoname(8); $str = autoname(8);
$cmd = "$phpath testargs.php $str"; $cmd = "$phpath testargs.php $str";
@ -356,7 +356,7 @@ function check_php(&$phpath, &$checks) {
} }
check_add($checks, t('PHP register_argc_argv'), $passed3, true, $help); check_add($checks, t('PHP register_argc_argv'), $passed3, true, $help);
} }
} }
@ -366,7 +366,7 @@ function check_keys(&$checks) {
$res = false; $res = false;
if(function_exists('openssl_pkey_new')) if(function_exists('openssl_pkey_new'))
$res=openssl_pkey_new(array( $res=openssl_pkey_new(array(
'digest_alg' => 'sha1', 'digest_alg' => 'sha1',
'private_key_bits' => 4096, 'private_key_bits' => 4096,
@ -390,8 +390,8 @@ function check_funcs(&$checks) {
check_add($ck_funcs, t('OpenSSL PHP module'), true, true, ""); check_add($ck_funcs, t('OpenSSL PHP module'), true, true, "");
check_add($ck_funcs, t('mysqli PHP module'), true, true, ""); check_add($ck_funcs, t('mysqli PHP module'), true, true, "");
check_add($ck_funcs, t('mb_string PHP module'), true, true, ""); check_add($ck_funcs, t('mb_string PHP module'), true, true, "");
if(function_exists('apache_get_modules')){ if(function_exists('apache_get_modules')){
if (! in_array('mod_rewrite',apache_get_modules())) { if (! in_array('mod_rewrite',apache_get_modules())) {
check_add($ck_funcs, t('Apache mod_rewrite module'), false, true, t('Error: Apache webserver mod-rewrite module is required but not installed.')); check_add($ck_funcs, t('Apache mod_rewrite module'), false, true, t('Error: Apache webserver mod-rewrite module is required but not installed.'));
@ -420,9 +420,9 @@ function check_funcs(&$checks) {
$ck_funcs[4]['status']= false; $ck_funcs[4]['status']= false;
$ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.'); $ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.');
} }
$checks = array_merge($checks, $ck_funcs); $checks = array_merge($checks, $ck_funcs);
/*if((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg'])) /*if((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg']))
notice( t('Please see the file "INSTALL.txt".') . EOL);*/ notice( t('Please see the file "INSTALL.txt".') . EOL);*/
} }
@ -433,14 +433,14 @@ function check_htconfig(&$checks) {
$help = ""; $help = "";
if( (file_exists('.htconfig.php') && !is_writable('.htconfig.php')) || if( (file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
(!file_exists('.htconfig.php') && !is_writable('.')) ) { (!file_exists('.htconfig.php') && !is_writable('.')) ) {
$status=false; $status=false;
$help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL; $help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL;
$help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL; $help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL;
$help .= t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.').EOL; $help .= t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.').EOL;
$help .= t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.').EOL; $help .= t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.').EOL;
} }
check_add($checks, t('.htconfig.php is writable'), $status, false, $help); check_add($checks, t('.htconfig.php is writable'), $status, false, $help);
} }
@ -449,14 +449,14 @@ function check_smarty3(&$checks) {
$status = true; $status = true;
$help = ""; $help = "";
if( !is_writable('view/smarty3') ) { if( !is_writable('view/smarty3') ) {
$status=false; $status=false;
$help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; $help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
$help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL; $help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').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 .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
$help .= t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL; $help .= t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL;
} }
check_add($checks, t('view/smarty3 is writable'), $status, true, $help); check_add($checks, t('view/smarty3 is writable'), $status, true, $help);
} }
@ -471,14 +471,14 @@ function check_htaccess(&$checks) {
$status = false; $status = false;
$help = t('Url rewrite in .htaccess is not working. Check your server configuration.'); $help = t('Url rewrite in .htaccess is not working. Check your server configuration.');
} }
check_add($checks, t('Url rewrite is working'), $status, true, $help); check_add($checks, t('Url rewrite is working'), $status, true, $help);
} else { } else {
// cannot check modrewrite if libcurl is not installed // cannot check modrewrite if libcurl is not installed
} }
} }
function manual_config(&$a) { function manual_config(&$a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8'); $data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
$o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
@ -498,27 +498,31 @@ function load_database_rem($v, $i){
function load_database($db) { function load_database($db) {
$str = file_get_contents('database.sql'); require_once("include/dbstructure.php");
$errors = update_structure(false, true);
/* $str = file_get_contents('database.sql');
$arr = explode(';',$str); $arr = explode(';',$str);
$errors = false; $errors = false;
foreach($arr as $a) { foreach($arr as $a) {
if(strlen(trim($a))) { if(strlen(trim($a))) {
$r = @$db->q(trim($a)); $r = @$db->q(trim($a));
if(false === $r) { if(false === $r) {
$errors .= t('Errors encountered creating database tables.') . $a . EOL; $errors .= t('Errors encountered creating database tables.') . $a . EOL;
} }
} }
} }*/
return $errors; return $errors;
} }
function what_next() { function what_next() {
$a = get_app(); $a = get_app();
$baseurl = $a->get_baseurl(); $baseurl = $a->get_baseurl();
return return
t('<h1>What next</h1>') t('<h1>What next</h1>')
."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') ."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.')
.t('Please see the file "INSTALL.txt".') .t('Please see the file "INSTALL.txt".')
."</p><p>" ."</p><p>"
.t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.") .t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
."</p>"; ."</p>";

View file

@ -1127,7 +1127,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
if(count($r)) { if(count($r)) {
$profile = $r[0]['url']; $profile = $r[0]['url'];
//set newname to nick, find alias //set newname to nick, find alias
if(($r[0]['network'] === NETWORK_OSTATUS) OR ($r[0]['network'] === NETWORK_TWITTER) OR ($r[0]['network'] === NETWORK_STATUSNET)) { if(($r[0]['network'] === NETWORK_OSTATUS) OR ($r[0]['network'] === NETWORK_TWITTER)
OR ($r[0]['network'] === NETWORK_STATUSNET) OR ($r[0]['network'] === NETWORK_APPNET)) {
$newname = $r[0]['nick']; $newname = $r[0]['nick'];
$stat = true; $stat = true;
if($r[0]['alias']) if($r[0]['alias'])

View file

@ -10,26 +10,25 @@ define( 'UPDATE_VERSION' , 1170 );
* copying the latest files from the source code repository will always perform a clean * copying the latest files from the source code repository will always perform a clean
* and painless upgrade. * and painless upgrade.
* *
* Each function in this file is named update_nnnn() where nnnn is an increasing number * Each function in this file is named update_nnnn() where nnnn is an increasing number
* which began counting at 1000. * which began counting at 1000.
* *
* At the top of the file "boot.php" is a define for DB_UPDATE_VERSION. Any time there is a change * At the top of the file "boot.php" is a define for DB_UPDATE_VERSION. Any time there is a change
* to the database schema or one which requires an upgrade path from the existing application, * to the database schema or one which requires an upgrade path from the existing application,
* the DB_UPDATE_VERSION and the UPDATE_VERSION at the top of this file are incremented. * the DB_UPDATE_VERSION and the UPDATE_VERSION at the top of this file are incremented.
* *
* The current DB_UPDATE_VERSION is stored in the config area of the database. If the application starts up * The current DB_UPDATE_VERSION is stored in the config area of the database. If the application starts up
* and DB_UPDATE_VERSION is greater than the last stored build number, we will process every update function * and DB_UPDATE_VERSION is greater than the last stored build number, we will process every update function
* in order from the currently stored value to the new DB_UPDATE_VERSION. This is expected to bring the system * in order from the currently stored value to the new DB_UPDATE_VERSION. This is expected to bring the system
* up to current without requiring re-installation or manual intervention. * up to current without requiring re-installation or manual intervention.
* *
* Once the upgrade functions have completed, the current DB_UPDATE_VERSION is stored as the current value. * Once the upgrade functions have completed, the current DB_UPDATE_VERSION is stored as the current value.
* The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file. * The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file.
* *
* If you change the database schema, the following are required: * If you change the database schema, the following are required:
* 1. Update the file database.sql to match the new schema. * 1. Update the file include/dbstructure.php to match the new schema.
* 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION. * 2. If there is a need for a post procession, update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
* This function should modify the current database schema and perform any other steps necessary * This function should perform some post procession steps but no database updates.
* to ensure that upgrade is silent and free from requiring interaction.
* 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it * 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it
* 4. TEST the upgrade prior to checkin and filing a pull request. * 4. TEST the upgrade prior to checkin and filing a pull request.
* *

View file

@ -193,26 +193,35 @@ img {
margin-bottom: 5px; margin-bottom: 5px;
} }
div.pager a {
margin-left: 5px;
margin-right: 5px;
}
span.pager_first a, span.pager_n a,
span.pager_last a, span.pager_prev a, span.pager_next a {
color: darkgray;
}
div.pager { div.pager {
/* .birthday-notice { */ clear: left;
text-align: center; text-align: center;
/*
height: 1.2em; height: 1.2em;
padding-bottom: 12px; padding-bottom: 12px;
color: black; color: black;
/*-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;*/
background-color: #f2f2f2; background-color: #f2f2f2;
clear: left;
margin-top: 5px; margin-top: 5px;
padding: 1%; padding: 1%;
height: 1em; height: 1em;
margin-bottom: 5px; margin-bottom: 5px;
}*/ */
}
.birthday-notice { .birthday-notice, .event-notice {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
background-color: #F5F5F5;
} }
#live-network { #live-network {
@ -383,7 +392,8 @@ code {
#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forum-list div:hover, #sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forum-list div:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, #message-new:hover { .nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, #message-new:hover {
/* background-color: #ddd; */ /* background-color: #ddd; */
background-color: #e5e5e5; /* background-color: #e5e5e5; */
background-color: #F5F5F5;
} }
#message-new a { #message-new a {
@ -1866,16 +1876,21 @@ h2 {
} }
/** /acl **/ /** /acl **/
/** tab buttons **/ /** tab buttons **/
ul.tabs { div.pager, ul.tabs {
list-style-type: none; list-style-type: none;
padding-bottom: 10px; padding-bottom: 10px;
padding-left: 0px; padding-left: 10px;
padding-top: 0px;
margin-bottom: 5px; margin-bottom: 5px;
line-height: 27px; line-height: 28px;
height: 27px; height: 20px;
font-size: 11px; /* font-size: 11px; */
font-size: 13px;
font-weight: bold; font-weight: bold;
/* margin-bottom: 30px; */ /* margin-bottom: 30px; */
background-color: #FAFAFA;
box-shadow: 1px 2px 0px 0px #D8D8D8;
border-bottom: 1px solid #D2D2D2;
} }
ul.tabs li { ul.tabs li {
float: left; float: left;
@ -1885,18 +1900,21 @@ ul.tabs li {
border-bottom: 1px solid #005c94; border-bottom: 1px solid #005c94;
}*/ }*/
ul.tabs a { ul.tabs a, div.pager a {
/* min-width: 34px; */ /* min-width: 34px; */
display: block; /* display: block;
float: left; float: left; */
padding-bottom: 0px; padding: 0px;
padding: 0px 12px 0px 12px; padding-bottom: 6px;
color: #444; /* padding: 0px 12px 0px 12px; */
/* color: #444; */
color: darkgray;
} }
ul.tabs a { ul.tabs a {
box-shadow: 1px 2px 0px 0px #D8D8D8; /* box-shadow: 1px 2px 0px 0px #D8D8D8; */
margin-right: 5px; margin-right: 15px;
margin-left: 5px;
} }
#birthday-notice, #event-notice { #birthday-notice, #event-notice {
@ -1914,30 +1932,49 @@ ul.tabs a {
margin-bottom: 0px; margin-bottom: 0px;
} }
div.pager, .birthday-notice, .comment-edit-submit-wrapper .fakelink { .birthday-notice, .event-notice {
padding: 2px 7px 2px 7px;
color: darkgrey;
font-weight: bold;
}
.comment-edit-submit-wrapper .fakelink {
padding: 2px 7px 2px 7px; padding: 2px 7px 2px 7px;
color: black; color: black;
} }
div.pager, .birthday-notice, ul.tabs a, .comment-edit-submit-wrapper .fakelink { .comment-edit-submit-wrapper .fakelink {
border: 1px solid lightgray; /* border: 1px solid lightgray; */
background: #F2F2F2; background: #F2F2F2;
margin-top: 2px; margin-top: 2px;
margin-bottom: 2px; margin-bottom: 2px;
} }
ul.tabs a:hover { #event-notice:hover, #birthday-notice:hover, ul.tabs li .active,
color: #333; .comment-edit-submit-wrapper .fakelink:hover {
}
#event-notice:hover, #birthday-notice:hover, ul.tabs li .active, .comment-edit-submit-wrapper .fakelink:hover {
color: black; color: black;
} }
ul.tabs a:hover, #event-notice:hover, #birthday-notice:hover, ul.tabs li .active, .comment-edit-submit-wrapper .fakelink:hover { span.pager_current, span.pager_n a:hover,
background-color: #e5e5e5; span.pager_first a:hover, span.pager_last a:hover,
span.pager_prev a:hover, span.pager_next a:hover,
ul.tabs a:hover {
border-bottom: 2px solid #244C5E;
text-decoration: none;
color: grey;
padding-bottom: 6px;
}
ul.tabs li .active, span.pager_current a {
border-bottom: 2px solid #244C5E;
text-decoration: none;
color: black;
}
#event-notice:hover, #birthday-notice:hover, .comment-edit-submit-wrapper .fakelink:hover {
/* background-color: #e5e5e5; */
color: grey;
text-decoration: none; text-decoration: none;
border: 1px solid darkgray; /* border: 1px solid darkgray; */
} }
.comment-edit-bb { .comment-edit-bb {
@ -2077,8 +2114,10 @@ aside form .field label {
/* contacts */ /* contacts */
.contact-entry-wrapper { .contact-entry-wrapper {
width: 120px; width: 120px;
height: 120px; height: 130px;
float: left; float: left;
/* overflow: hidden; */
margin-left: 5px;
} }
/* photo */ /* photo */
.lframe { .lframe {

View file

@ -99,7 +99,7 @@
{{if $item.threaded}} {{if $item.threaded}}
{{/if}} {{/if}}
{{if $item.comment}} {{if $item.comment}}
<span id="comment-{{$item.id}}" class="fakelink togglecomment" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"><i class="icon-reply"></i></span> <span id="comment-{{$item.id}}" class="fakelink togglecomment" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" title="{{$item.switchcomment}}"><i class="icon-reply"></i></span>
{{/if}} {{/if}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}} {{if $item.vote.like}}
@ -122,7 +122,7 @@
<a href="#" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item filer-icon" title="{{$item.filer}}"><i class="icon-folder-close icon-large"></i></a> <a href="#" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item filer-icon" title="{{$item.filer}}"><i class="icon-folder-close icon-large"></i></a>
{{/if}} {{/if}}
</div> </div>
<div class="wall-item-location">{{$item.location}} {{$item.postopts}}</div> <div class="wall-item-location">{{$item.location}} {{$item.postopts}}</div>
<div class="wall-item-actions-tools"> <div class="wall-item-actions-tools">
{{if $item.drop.pagedrop}} {{if $item.drop.pagedrop}}