]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
incoming diaspora share notification turned into Friendika friend request
[friendica.git] / boot.php
index 35cb152392687659d6d9929091820d3430ed483a..76b80ce04688cded821ce1320020129651eb2f40 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -7,9 +7,9 @@ require_once('include/text.php');
 require_once("include/pgettext.php");
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.1059' );
+define ( 'FRIENDIKA_VERSION',      '2.2.1070' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1076      );
+define ( 'DB_UPDATE_VERSION',      1079      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -55,13 +55,12 @@ define ( 'REGISTER_OPEN',          2 );
 
 /**
  * relationship types
- * When used in contact records, this indicates that 'uid' has 
- * this relationship with contact['name']
  */
 
-define ( 'REL_VIP',        1);     // other person is 'following' us
-define ( 'REL_FAN',        2);     // we are 'following' other person
-define ( 'REL_BUD',        3);     // mutual relationship
+define ( 'CONTACT_IS_FOLLOWER', 1);
+define ( 'CONTACT_IS_SHARING',  2);
+define ( 'CONTACT_IS_FRIEND',   3);
+
 
 /**
  * Hook array order
@@ -76,10 +75,10 @@ define ( 'HOOK_FUNCTION',  2);
  * page/profile types
  *
  * PAGE_NORMAL is a typical personal profile account
- * PAGE_SOAPBOX automatically approves all friend requests as REL_FAN, (readonly)
- * PAGE_COMMUNITY automatically approves all friend requests as REL_FAN, but with 
+ * PAGE_SOAPBOX automatically approves all friend requests as CONTACT_IS_SHARING, (readonly)
+ * PAGE_COMMUNITY automatically approves all friend requests as CONTACT_IS_SHARING, but with 
  *      write access to wall and comments (no email and not included in page owner's ACL lists)
- * PAGE_FREELOVE automatically approves all friend requests as full friends (REL_BUD). 
+ * PAGE_FREELOVE automatically approves all friend requests as full friends (CONTACT_IS_FRIEND). 
  *
  */
 
@@ -283,7 +282,12 @@ class App {
                                $this->path = $path;
                }
 
-               set_include_path("include/$this->hostname" . PATH_SEPARATOR . 'include' . PATH_SEPARATOR . '.' );
+               set_include_path(
+                       "include/$this->hostname" . PATH_SEPARATOR 
+                       . 'include' . PATH_SEPARATOR 
+                       . 'library' . PATH_SEPARATOR 
+                       . 'library/phpsec' . PATH_SEPARATOR 
+                       . '.' );
 
                if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=")
                        $this->query_string = substr($_SERVER['QUERY_STRING'],2);
@@ -320,13 +324,12 @@ class App {
 
                /**
                 * Special handling for the webfinger/lrdd host XRD file
-                * Just spit out the contents and exit.
                 */
 
                if($this->cmd === '.well-known/host-meta') {
-                       require_once('include/hostxrd.php');
-                       hostxrd($this->get_baseurl());
-                       // NOTREACHED
+                       $this->argc = 1;
+                       $this->argv = array('hostxrd');
+                       $this->module = 'hostxrd';
                }
 
                /**
@@ -402,7 +405,7 @@ class App {
                $this->page['title'] = $this->config['sitename'];
                $tpl = file_get_contents('view/head.tpl');
                $this->page['htmlhead'] = replace_macros($tpl,array(
-                       '$baseurl' => $this->get_baseurl(),
+                       '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
                        '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION,
                        '$delitem' => t('Delete this item?'),
                        '$comment' => t('Comment')
@@ -475,6 +478,34 @@ function system_unavailable() {
 }}
 
 
+
+function clean_urls() {
+       global $a;
+//     if($a->config['system']['clean_urls'])
+               return true;
+//     return false;
+}
+
+function z_path() {
+       global $a;
+       $base = $a->get_baseurl();
+       if(! clean_urls())
+               $base .= '/?q=';
+       return $base;
+}
+
+function z_root() {
+       global $a;
+       return $a->get_baseurl();
+}
+
+function absurl($path) {
+       if(strpos($path,'/') === 0)
+               return z_path() . $path;
+       return $path;
+}
+
+
 // Primarily involved with database upgrade, but also sets the 
 // base url for use in cmdline programs which don't have
 // $_SERVER variables, and synchronising the state of installed plugins.
@@ -579,6 +610,18 @@ function check_config(&$a) {
 }}
 
 
+function get_guid($size=16) {
+       $exists = true; // assume by default that we don't have a unique guid
+       do {
+               $s = random_string($size);
+               $r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
+               if(! count($r))
+                       $exists = false;
+       } while($exists);
+       q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s));
+       return $s;
+}
+
 
 // wrapper for adding a login box. If $register == true provide a registration
 // link. This will most always depend on the value of $a->config['register_policy'].
@@ -849,7 +892,9 @@ function profile_sidebar($profile) {
        $podloc = $a->get_baseurl();
        $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' );
        $nickname = $profile['nick'];
-       $dphoto = $profile['photo'];
+       $photo300 = $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg';
+       $photo100 = $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg';
+       $photo50  = $a->get_baseurl() . '/photo/custom/50/'  . $profile['uid'] . '.jpg';
 
        $diaspora_vcard = <<< EOT
 
@@ -869,7 +914,19 @@ function profile_sidebar($profile) {
 <dl class="entity_photo">
 <dt>Photo</dt>
 <dd>
-<img class="photo avatar" height="175px" src="$dphoto" width='175px'>
+<img class="photo avatar" height="300px" width="300px" src="$photo300">
+</dd>
+</dl>
+<dl class="entity_photo_medium">
+<dt>Photo</dt>
+<dd> 
+<img class="photo avatar" height="100px" width="100px" src="$photo100">
+</dd>
+</dl>
+<dl class="entity_photo_small">
+<dt>Photo</dt>
+<dd>
+<img class="photo avatar" height="50px" width="50px" src="$photo50">
 </dd>
 </dl>
 <dl class='entity_searchable'>