require_once("include/pgettext.php");
-define ( 'FRIENDIKA_VERSION', '2.2.1059' );
+define ( 'FRIENDIKA_VERSION', '2.2.1080' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1076 );
+define ( 'DB_UPDATE_VERSION', 1081 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
-define ( 'DOWN_ARROW', '⇩' );
+
/**
*
/**
* 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
* 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).
*
*/
$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);
/**
* 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';
}
/**
$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')
}}
+
+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.
}}
+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'].
if(! (x($a->page,'aside')))
$a->page['aside'] = '';
- $a->page['aside'] .= profile_sidebar($a->profile);
- $a->page['aside'] .= contact_block();
+ $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
+
+ $a->page['aside'] .= profile_sidebar($a->profile, $block);
+
+ if(! $block)
+ $a->page['aside'] .= contact_block();
return;
}}
if(! function_exists('profile_sidebar')) {
-function profile_sidebar($profile) {
+function profile_sidebar($profile, $block = 0) {
$a = get_app();
$tabs = '';
- $photo = '<div id="profile-photo-wrapper"><img class="photo" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
+ $photo = '<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
// don't show connect link to yourself
-
$connect = (($profile['uid'] != local_user()) ? '<li><a id="dfrn-request-link" href="dfrn_request/' . $profile['nickname'] . '">' . t('Connect') . '</a></li>' : '');
// don't show connect link to authenticated visitors either
}
+
$gender = ((x($profile,'gender') == 1) ? '<div class="mf"><span class="gender-label">' . t('Gender:') . '</span> <span class="x-gender">' . $profile['gender'] . '</span></div><div class="profile-clear"></div>' : '');
$pubkey = ((x($profile,'pubkey') == 1) ? '<div class="key" style="display:none;">' . $profile['pubkey'] . '</div>' : '');
$homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
- if($profile['hidewall'] && (! local_user()) && (! remote_user())) {
- $location = $gender = $marital = $homepage = '';
+ if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
+ $location = $pdesc = $connect = $gender = $marital = $homepage = '';
}
$podloc = $a->get_baseurl();
$searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' );
- $nickname = $profile['nick'];
- $dphoto = $profile['photo'];
+ $nickname = $profile['nickname'];
+ $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
<dl class='entity_nickname'>
<dt>Nickname</dt>
<dd>
-<a class="nickname url uid" href="$podloc" rel="me">$nickname</a>
+<a class="nickname url uid" href="$podloc/" rel="me">$nickname</a>
+</dd>
+</dl>
+<dl class='entity_fn'>
+<dt>Full name</dt>
+<dd>
+<span class='fn'>$fullname</span>
</dd>
</dl>
<dl class="entity_url">
<dt>URL</dt>
<dd>
-<a class="url" href="$podloc" id="pod_location" rel="me">$podloc</a>
+<a class="url" href="$podloc/" id="pod_location" rel="me">$podloc/</a>
</dd>
</dl>
<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'>
+<dl class="entity_searchable">
<dt>Searchable</dt>
<dd>
-<span class='searchable'>$searchable</span>
+<span class="searchable">$searchable</span>
</dd>
</dl>
</div>
$a = get_app();
$args = func_get_args();
- call_hooks("proc_run", $args);
+ $arr = array('args' => $args, 'run_cmd' => true);
+
+ call_hooks("proc_run", $arr);
+ if(! $arr['run_cmd'])
+ return;
if(count($args) && $args[0] === 'php')
$args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
foreach ($args as $arg){
$arg = escapeshellarg($arg);
}