]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #3528 from Hypolite/task/replace-explicit-php-logical-operators
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Fri, 9 Jun 2017 05:44:19 +0000 (07:44 +0200)
committerGitHub <noreply@github.com>
Fri, 9 Jun 2017 05:44:19 +0000 (07:44 +0200)
Replace explicit php logical operators

INSTALL.txt
doc/Install.md
doc/htconfig.md
include/acl_selectors.php
include/dfrn.php
mod/display.php
view/templates/display-head.tpl
view/templates/htconfig.tpl

index 81dfdfd27219a02febeb1afe15686909317435e4..c42c08971670c59a2c4e39b1120f34e814bea419 100644 (file)
@@ -71,9 +71,14 @@ write or create files in your web directory, create an empty file called
 .htconfig.php and make it writable by the web server.
 
 5. Visit your website with a web browser and follow the instructions. Please 
-note any error messages and correct these before continuing. If you are using
-SSL with a known signature authority (recommended), use the https: link to your
-website. If you are using a self-signed cert or no cert, use the http: link. 
+note any error messages and correct these before continuing.
+
+If you are using SSL with a known signature authority (recommended), use the
+https: link to your website. If you are using a self-signed cert or no cert,
+use the http: link.
+
+If you need to specify a port for the connection to the database, you can do
+so in the host name setting for the database.
 
 6. *If* the automated installation fails for any reason, check the following:
 
index a8ea2c050398631a087b6fccd7dd17238ea05e3c..53df55be067c8535291119d110e910f5608cb800 100644 (file)
@@ -82,6 +82,8 @@ Restart mysql and you should be fine.
 Point your web browser to the new site and follow the instructions.
 Please note any error messages and correct these before continuing.
 
+If you need to specify a port for the connection to the database, you can do so in the host name setting for the database.
+
 *If* the automated installation fails for any reason, check the following:
 
 * Does ".htconfig.php" exist? If not, edit htconfig.php and change the system settings. Rename to .htconfig.php
index 7887184d88b580d1cf51f318e83e6180032bab5d..9c556bb7cd49a647a588f173a508d86c1c3d046f 100644 (file)
@@ -117,3 +117,10 @@ If more then one account should be able to access the admin panel, seperate the
 If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name.
 
     $a->config['admin_name'] = "Marvin";
+
+## Database Settings
+
+The configuration variables db_host, db_user, db_pass and db_data are holding your credentials for the database connection.
+If you need to specify a port to access the database, you can do so by appending ":portnumber" to the db_host variable.
+
+    $db_host = 'your.mysqlhost.com:123456';
index 665ed17bdf4e3be8a8bfdd8991ce9602aa6d7130..6f08523ca97dffded9ea03eb61229859667e9e45 100644 (file)
@@ -388,6 +388,9 @@ function populate_acl($user = null, $show_jotnets = false) {
 }
 
 function construct_acl_data(App $a, $user) {
+       // This function is now deactivated. It seems as if the generated data isn't used anywhere.
+       /// @todo Remove this function and all function calls before releasing Friendica 3.5.3
+       return;
 
        // Get group and contact information for html ACL selector
        $acl_data = acl_lookup($a, 'html');
index 1b97f39a2d939b404c273eb6759f07ac4f84e552..bc62de6ed9e60333262a48917b4b5a4cb550ac87 100644 (file)
@@ -284,6 +284,62 @@ class dfrn {
                return $atom;
        }
 
+       /**
+        * @brief Generate an atom entry for a given item id
+        *
+        * @param int $item_id The item id
+        *
+        * @return string DFRN feed entry
+        */
+       public static function itemFeed($item_id) {
+               $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
+                       `contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
+                       `contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
+                       `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+                       `sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
+                       FROM `item`
+                       STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+                               AND (NOT `contact`.`blocked` OR `contact`.`pending`)
+                       LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`
+                       WHERE `item`.`id` = %d AND `item`.`visible` AND NOT `item`.`moderated` AND `item`.`parent` != 0
+                       AND `item`.`wall` AND NOT `item`.`private`",
+                       intval($item_id)
+               );
+
+               if (!dbm::is_result($r)) {
+                       killme();
+               }
+
+               $item = $r[0];
+
+               $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`, `user`.`account-type`
+                       FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
+                       WHERE `contact`.`self` AND `user`.`uid` = %d LIMIT 1",
+                       intval($item['uid'])
+               );
+
+               if (!dbm::is_result($r)) {
+                       killme();
+               }
+
+               $owner = $r[0];
+
+               $doc = new DOMDocument('1.0', 'utf-8');
+               $doc->formatOutput = true;
+
+               $alternatelink = $owner['url'];
+
+               $root = self::add_header($doc, $owner, 'dfrn:owner', $alternatelink, true);
+
+               $type = 'html';
+
+               $entry = self::entry($doc, $type, $item, $owner, true);
+               $root->appendChild($entry);
+
+               $atom = trim($doc->saveXML());
+               return $atom;
+       }
+
        /**
         * @brief Create XML text for DFRN mails
         *
index c4cf381e93f49fb2f65c0388ed515a954a7f04b7..a9816b06cea4f582da32327406da37bc2352ce21 100644 (file)
@@ -2,6 +2,8 @@
 
 use Friendica\App;
 
+require_once('include/dfrn.php');
+
 function display_init(App $a) {
 
        if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@@ -11,6 +13,16 @@ function display_init(App $a) {
        $nick = (($a->argc > 1) ? $a->argv[1] : '');
        $profiledata = array();
 
+       if ($a->argc == 3) {
+               if (substr($a->argv[2], -5) == '.atom') {
+                       $item_id = substr($a->argv[2], 0, -5);
+                       $xml = dfrn::itemFeed($item_id);
+                       header("Content-type: application/atom+xml");
+                       echo $xml;
+                       http_status_exit(($xml) ? 200 : 500);
+               }
+       }
+
        // If there is only one parameter, then check if this parameter could be a guid
        if ($a->argc == 2) {
                $nick = "";
@@ -209,9 +221,6 @@ function display_content(App $a, $update = 0) {
 
        $o = '';
 
-       $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array());
-
-
        if ($update) {
                $nick = $_REQUEST['nick'];
        } else {
@@ -281,6 +290,16 @@ function display_content(App $a, $update = 0) {
                return;
        }
 
+       // We are displaying an "alternate" link if that post was public. See issue 2864
+       $items = q("SELECT `id` FROM `item` WHERE `id` = %d AND NOT `private` AND `wall`", intval($item_id));
+       if (dbm::is_result($items)) {
+               $alternate = App::get_baseurl().'/display/'.$nick.'/'.$item_id.'.atom';
+       } else {
+               $alternate = '';
+       }
+
+       $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'),
+                               array('$alternate' => $alternate));
 
        $groups = array();
 
index 9a96a23988fa36c27d05dbf1a1d1f215a0a82e80..dda816214624576873eadf3d00389cc0f9ffd579 100644 (file)
@@ -1,4 +1,4 @@
-
+{{if $alternate}}<link href='{{$alternate}}' rel='alternate' type='application/atom+xml'>{{/if}}
 <script>
 $(document).ready(function() {
        $(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acl");
@@ -6,4 +6,3 @@ $(document).ready(function() {
        $(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acl");
 });
 </script>
-
index 02cf67f39d1ee962f8e7a1f624c5af2e3d582d21..6a156012a282e533a085cca66dca52e48e21c50f 100644 (file)
@@ -1,14 +1,16 @@
 <?php
 
 /* ********************************************************************
- *  The following configuration has to be within the .htconfig file
- *  and will not be overruled by decisions made in the admin panel.
+ *  The following configuration has to be within the .htconfig.php
+ *  file and will not be overruled by decisions made in the admin panel.
  *
  *  See below for variables that may be overruled by the admin panel.
  * ********************************************************************/
 
 // Set the following for your MySQL installation
-// Copy or rename this file to .htconfig.php
+//
+// If you need to specify a port for reacing the database, you can do so by
+// adding ":portnumber" after "your.mysqlhost.com" in the $db_host config.
 
 $db_host = '{{$dbhost}}';
 $db_user = '{{$dbuser}}';