Merge pull request #1057 from annando/master

Removing of several warnings to make the dav addon work again
This commit is contained in:
Tobias Diekershoff 2014-07-25 08:41:19 +02:00
commit 599bc1eb0a
6 changed files with 42 additions and 28 deletions

View file

@ -452,7 +452,7 @@ function bb_ShareAttributes($share, $simplehtml) {
case 2:
$text = $preshare.html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.": <br />".$share[3];
break;
case 3:
case 3: // Diaspora
$headline = '<div class="shared_header">';
$headline .= '<span><b>'.html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8').$userid.':</b></span>';
$headline .= "</div>";
@ -484,15 +484,21 @@ function bb_ShareAttributes($share, $simplehtml) {
case 5:
$text = $preshare.html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.": <br />".$share[3];
break;
case 6:
case 6: // app.net
$text = $preshare."&gt;&gt; @".$userid_compact.": <br />".$share[3];
break;
case 7:
case 7: // statusnet/GNU Social
$text = $preshare.html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8')." @".$userid_compact.": ".$share[3];
break;
case 8:
case 8: // twitter
$text = $preshare."RT @".$userid_compact.": ".$share[3];
break;
case 9: // Google+/Facebook
$text = $preshare.html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.": <br />".$share[3];
if ($link != "")
$text .= "<br /><br />".$link;
break;
default:
$headline = trim($share[1]).'<div class="shared_header">';
if ($avatar != "")
@ -775,7 +781,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace("/#\[url\=[$URLSearchString]*\]\^\[\/url\]\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/i",
"[bookmark=$1]$2[/bookmark]", $Text);
if (in_array($simplehtml, array(2, 6, 7, 8))) {
if (in_array($simplehtml, array(2, 6, 7, 8, 9))) {
$Text = preg_replace_callback("/([^#@])\[url\=([^\]]*)\](.*?)\[\/url\]/ism","bb_expand_links",$Text);
//$Text = preg_replace("/[^#@]\[url\=([^\]]*)\](.*?)\[\/url\]/ism",' $2 [url]$1[/url]',$Text);
$Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",' $2 [url]$1[/url]',$Text);

View file

@ -182,13 +182,13 @@ class dba {
* These usually indicate SQL syntax errors that need to be resolved.
*/
if($result === false) {
if(isset($result) AND ($result === false)) {
logger('dba: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
if(file_exists('dbfail.out'))
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
}
if(($result === true) || ($result === false))
if(isset($result) AND (($result === true) || ($result === false)))
return $result;
if ($onlyquery) {

View file

@ -677,9 +677,10 @@ function logger($msg,$level = 0) {
if(($a->module == 'install') || (! ($db && $db->connected))) return;
if (count($LOGGER_LEVEL)==0){
if (count($LOGGER_LEVELS)==0){
foreach (get_defined_constants() as $k=>$v){
if (substr($k,0,7)=="LOGGER_") $LOGGER_LEVELS[$v] = substr($k,7,7);
if (substr($k,0,7)=="LOGGER_")
$LOGGER_LEVELS[$v] = substr($k,7,7);
}
}

View file

@ -432,7 +432,7 @@ else
$a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']);
//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
if (($_GET["mode"] == "raw") OR ($_GET["mode"] == "minimal")) {
if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "minimal"))) {
$doc = new DOMDocument();
$target = new DOMDocument();
@ -455,7 +455,7 @@ if (($_GET["mode"] == "raw") OR ($_GET["mode"] == "minimal")) {
}
}
if ($_GET["mode"] == "raw") {
if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) {
header("Content-type: text/html; charset=utf-8");
@ -528,7 +528,7 @@ $profile = $a->profile;
header("Content-type: text/html; charset=utf-8");
if ($_GET["mode"] == "minimal") {
if (isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
//$page['content'] = substr($target->saveHTML(), 6, -8)."\n\n".
// '<div id="conversation-end"></div>'."\n\n";

View file

@ -19,7 +19,7 @@ class QueryException extends \Exception {
* and print them as exception
*
**/
public function __construct(\PDOStatement $objPDO, $arrQueryDefinition) {
public function __construct(\PDOStatement $objPDO, array $arrQueryDefinition) {
$strMessage = self::createErrorMessage($objPDO, $arrQueryDefinition);
@ -38,7 +38,7 @@ class QueryException extends \Exception {
* and query definition
*
**/
private function createErrorMessage($objPDO, $arrQueryDefinition) {
private function createErrorMessage(\PDOStatement $objPDO, array $arrQueryDefinition) {
$strMessage = self::flattenQueryErrorInfo($objPDO);
$strMessage .= self::flattenQueryDefiniton($arrQueryDefinition);
@ -57,7 +57,7 @@ class QueryException extends \Exception {
* from the driver specific error message
*
**/
private function flattenQueryErrorInfo($objPDO) {
private function flattenQueryErrorInfo(\PDOStatement $objPDO) {
$arrErrorInfo = $objPDO->errorInfo();
@ -76,15 +76,17 @@ class QueryException extends \Exception {
*
* @return (string) a text version of the query definition
*
* create an text, which contains all information
* of the query definition
* create an text, which contains all *scalar* information
* of the query definition. if there are non-scalar information
* added, the will be excluded from output
*
**/
private function flattenQueryDefiniton($arrQueryDefinition) {
private function flattenQueryDefiniton(array $arrQueryDefinition) {
$strMessage = "\nQuery-Definiton:\n";
foreach($arrQueryDefinition AS $strKeyword => $strContent)
if(is_scalar($strContent))
$strMessage .= "$strKeyword: $strContent\n";
return $strMessage . "\n";

View file

@ -100,7 +100,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
// Fetch the first mentioned charset. Can be in body or header
$charset = "";
if (preg_match('/charset=(.*?)['."'".'"\s\n]/', $header, $matches))
$charset = trim(array_pop($matches));
$charset = trim(trim(trim(array_pop($matches)), ';,'));
if ($charset == "")
$charset = "utf-8";
@ -112,7 +112,12 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
else
$body = $header;
$body = mb_convert_encoding($body, "UTF-8", $charset);
if (($charset != '') AND (strtoupper($charset) != "UTF-8")) {
logger("parseurl_getsiteinfo: detected charset ".$charset, LOGGER_DEBUG);
//$body = mb_convert_encoding($body, "UTF-8", $charset);
$body = iconv($charset, "UTF-8//TRANSLIT", $body);
}
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
$doc = new DOMDocument();