]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
More "LIMIT 1" removed - and some other SQL improvements.
[friendica.git] / include / text.php
index 0638f9e241f3a3936b9d1f72f09407498361d5cc..253b4827ffc0b5176113e30e3905da4b44583e2a 100644 (file)
@@ -482,9 +482,9 @@ if(! function_exists('photo_new_resource')) {
 /**
  * Generate a guaranteed unique photo ID.
  * safe from birthday paradox
- * 
+ *
  * @return string
- */    
+ */
 function photo_new_resource() {
 
        do {
@@ -505,7 +505,7 @@ if(! function_exists('load_view_file')) {
  * @deprecated
  * wrapper to load a view template, checking for alternate
  * languages before falling back to the default
- * 
+ *
  * @global string $lang
  * @global App $a
  * @param string $s view name
@@ -1608,16 +1608,19 @@ if(! function_exists('get_plink')) {
  * @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title)
  */
 function get_plink($item) {
-       $a = get_app(); 
-       if (x($item,'plink') && ($item['private'] != 1)) {
-               return array(
-                       'href' => $item['plink'],
+       $a = get_app();
+       $ret = array(
+                       'href' => $a->get_baseurl()."/display/".$a->user['nickname']."/".$item['id'],
                        'title' => t('link to source'),
                );
-       } 
-       else {
-               return false;
-       }
+
+       $ret["orig"] = $ret["href"];
+
+       //if (x($item,'plink') && ($item['private'] != 1))
+       if (x($item,'plink'))
+               $ret["href"] = $item['plink'];
+
+       return($ret);
 }}
 
 if(! function_exists('unamp')) {
@@ -2073,7 +2076,7 @@ function file_tag_save_file($uid,$item,$file) {
        );
        if(count($r)) {
                if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
-                       q("update item set file = '%s' where id = %d and uid = %d limit 1",
+                       q("update item set file = '%s' where id = %d and uid = %d",
                                dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),
                                intval($item),
                                intval($uid)
@@ -2104,7 +2107,7 @@ function file_tag_unsave_file($uid,$item,$file,$cat = false) {
        if(! count($r))
                return false;
 
-       q("update item set file = '%s' where id = %d and uid = %d limit 1",
+       q("update item set file = '%s' where id = %d and uid = %d",
                dbesc(str_replace($pattern,'',$r[0]['file'])),
                intval($item),
                intval($uid)