Merge remote-tracking branch 'refs/remotes/friendica/develop' into develop

This commit is contained in:
Hypolite Petovan 2017-04-03 22:06:09 -04:00
commit 500f0985f8
45 changed files with 2603 additions and 2211 deletions

603
boot.php

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1496,17 +1496,19 @@ function item_is_remote_self($contact, &$datarray) {
return true; return true;
} }
function new_follower($importer,$contact,$datarray,$item,$sharing = false) { function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
$url = notags(trim($datarray['author-link'])); $url = notags(trim($datarray['author-link']));
$name = notags(trim($datarray['author-name'])); $name = notags(trim($datarray['author-name']));
$photo = notags(trim($datarray['author-avatar'])); $photo = notags(trim($datarray['author-avatar']));
if (is_object($item)) { if (is_object($item)) {
$rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor'); $rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor');
if ($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) if ($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) {
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']; $nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'];
} else }
} else {
$nick = $item; $nick = $item;
}
if (is_array($contact)) { if (is_array($contact)) {
if (($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING) if (($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)
@ -1544,11 +1546,9 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true); update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
} }
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid']) intval($importer['uid'])
); );
$a = get_app();
if (dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) { if (dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
@ -1567,8 +1567,9 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
$def_gid = get_default_group($importer['uid'], $contact_record["network"]); $def_gid = get_default_group($importer['uid'], $contact_record["network"]);
if (intval($def_gid)) if (intval($def_gid)) {
group_add_member($importer['uid'],'',$contact_record['id'],$def_gid); group_add_member($importer['uid'], '', $contact_record['id'], $def_gid);
}
if (($r[0]['notify-flags'] & NOTIFY_INTRO) && if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
in_array($r[0]['page-flags'], array(PAGE_NORMAL))) { in_array($r[0]['page-flags'], array(PAGE_NORMAL))) {
@ -1599,7 +1600,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
} }
} }
function lose_follower($importer,$contact,$datarray = array(),$item = "") { function lose_follower($importer, $contact, array $datarray = array(), $item = "") {
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) { if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d", q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d",
@ -1611,7 +1612,7 @@ function lose_follower($importer,$contact,$datarray = array(),$item = "") {
} }
} }
function lose_sharer($importer,$contact,$datarray = array(),$item = "") { function lose_sharer($importer, $contact, array $datarray = array(), $item = "") {
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) { if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d", q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d",
@ -1623,7 +1624,7 @@ function lose_sharer($importer,$contact,$datarray = array(),$item = "") {
} }
} }
function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') { function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') {
$a = get_app(); $a = get_app();

View File

@ -239,6 +239,23 @@ class ostatus {
} }
} }
/**
* @brief Read attributes from element
*
* @param object $element Element object
*
* @return array attributes
*/
private static function read_attributes($element) {
$attribute = array();
foreach ($element->attributes AS $attributes) {
$attribute[$attributes->name] = $attributes->textContent;
}
return $attribute;
}
/** /**
* @brief Imports an XML string containing OStatus elements * @brief Imports an XML string containing OStatus elements
* *
@ -252,9 +269,9 @@ class ostatus {
logger("Import OStatus message", LOGGER_DEBUG); logger("Import OStatus message", LOGGER_DEBUG);
if ($xml == "") if ($xml == "") {
return; return;
}
//$tempfile = tempnam(get_temppath(), "import"); //$tempfile = tempnam(get_temppath(), "import");
//file_put_contents($tempfile, $xml); //file_put_contents($tempfile, $xml);
@ -273,13 +290,14 @@ class ostatus {
$gub = ""; $gub = "";
$hub_attributes = $xpath->query("/atom:feed/atom:link[@rel='hub']")->item(0)->attributes; $hub_attributes = $xpath->query("/atom:feed/atom:link[@rel='hub']")->item(0)->attributes;
if (is_object($hub_attributes)) if (is_object($hub_attributes)) {
foreach($hub_attributes AS $hub_attribute) foreach ($hub_attributes AS $hub_attribute) {
if ($hub_attribute->name == "href") { if ($hub_attribute->name == "href") {
$hub = $hub_attribute->textContent; $hub = $hub_attribute->textContent;
logger("Found hub ".$hub, LOGGER_DEBUG); logger("Found hub ".$hub, LOGGER_DEBUG);
} }
}
}
$header = array(); $header = array();
$header["uid"] = $importer["uid"]; $header["uid"] = $importer["uid"];
$header["network"] = NETWORK_OSTATUS; $header["network"] = NETWORK_OSTATUS;
@ -292,11 +310,11 @@ class ostatus {
// depending on that, the first node is different // depending on that, the first node is different
$first_child = $doc->firstChild->tagName; $first_child = $doc->firstChild->tagName;
if ($first_child == "feed") if ($first_child == "feed") {
$entries = $xpath->query('/atom:feed/atom:entry'); $entries = $xpath->query('/atom:feed/atom:entry');
else } else {
$entries = $xpath->query('/atom:entry'); $entries = $xpath->query('/atom:entry');
}
$conversation = ""; $conversation = "";
$conversationlist = array(); $conversationlist = array();
$item_id = 0; $item_id = 0;
@ -304,25 +322,25 @@ class ostatus {
// Reverse the order of the entries // Reverse the order of the entries
$entrylist = array(); $entrylist = array();
foreach ($entries AS $entry) foreach ($entries AS $entry) {
$entrylist[] = $entry; $entrylist[] = $entry;
}
foreach (array_reverse($entrylist) AS $entry) { foreach (array_reverse($entrylist) AS $entry) {
$mention = false; $mention = false;
// fetch the author // fetch the author
if ($first_child == "feed") if ($first_child == "feed") {
$author = self::fetchauthor($xpath, $doc->firstChild, $importer, $contact, false); $author = self::fetchauthor($xpath, $doc->firstChild, $importer, $contact, false);
else } else {
$author = self::fetchauthor($xpath, $entry, $importer, $contact, false); $author = self::fetchauthor($xpath, $entry, $importer, $contact, false);
}
$value = $xpath->evaluate('atom:author/poco:preferredUsername/text()', $context)->item(0)->nodeValue; $value = $xpath->evaluate('atom:author/poco:preferredUsername/text()', $context)->item(0)->nodeValue;
if ($value != "") if ($value != "") {
$nickname = $value; $nickname = $value;
else } else {
$nickname = $author["author-name"]; $nickname = $author["author-name"];
}
$item = array_merge($header, $author); $item = array_merge($header, $author);
// Now get the item // Now get the item
@ -330,7 +348,7 @@ class ostatus {
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'", $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'",
intval($importer["uid"]), dbesc($item["uri"])); intval($importer["uid"]), dbesc($item["uri"]));
if ($r) { if (dbm::is_result($r)) {
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG); logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG);
continue; continue;
} }
@ -341,9 +359,9 @@ class ostatus {
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) OR ($item["object-type"] == ACTIVITY_OBJ_EVENT)) { if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) OR ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue; $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
$item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue; $item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
} elseif ($item["object-type"] == ACTIVITY_OBJ_QUESTION) } elseif ($item["object-type"] == ACTIVITY_OBJ_QUESTION) {
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue; $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
}
$item["object"] = $xml; $item["object"] = $xml;
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue; $item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
@ -387,9 +405,9 @@ class ostatus {
} }
// http://activitystrea.ms/schema/1.0/rsvp-yes // http://activitystrea.ms/schema/1.0/rsvp-yes
if (!in_array($item["verb"], array(ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE))) if (!in_array($item["verb"], array(ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE))) {
logger("Unhandled verb ".$item["verb"]." ".print_r($item, true)); logger("Unhandled verb ".$item["verb"]." ".print_r($item, true));
}
$item["created"] = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue; $item["created"] = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
$item["edited"] = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue; $item["edited"] = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue;
$conversation = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue; $conversation = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue;
@ -398,108 +416,108 @@ class ostatus {
$inreplyto = $xpath->query('thr:in-reply-to', $entry); $inreplyto = $xpath->query('thr:in-reply-to', $entry);
if (is_object($inreplyto->item(0))) { if (is_object($inreplyto->item(0))) {
foreach($inreplyto->item(0)->attributes AS $attributes) { foreach ($inreplyto->item(0)->attributes AS $attributes) {
if ($attributes->name == "ref") if ($attributes->name == "ref") {
$item["parent-uri"] = $attributes->textContent; $item["parent-uri"] = $attributes->textContent;
if ($attributes->name == "href") }
if ($attributes->name == "href") {
$related = $attributes->textContent; $related = $attributes->textContent;
} }
} }
}
$georsspoint = $xpath->query('georss:point', $entry); $georsspoint = $xpath->query('georss:point', $entry);
if ($georsspoint) if ($georsspoint) {
$item["coord"] = $georsspoint->item(0)->nodeValue; $item["coord"] = $georsspoint->item(0)->nodeValue;
}
$categories = $xpath->query('atom:category', $entry); $categories = $xpath->query('atom:category', $entry);
if ($categories) { if ($categories) {
foreach ($categories AS $category) { foreach ($categories AS $category) {
foreach($category->attributes AS $attributes) foreach ($category->attributes AS $attributes) {
if ($attributes->name == "term") { if ($attributes->name == "term") {
$term = $attributes->textContent; $term = $attributes->textContent;
if(strlen($item["tag"])) if(strlen($item["tag"])) {
$item["tag"] .= ','; $item["tag"] .= ',';
}
$item["tag"] .= "#[url=".App::get_baseurl()."/search?tag=".$term."]".$term."[/url]"; $item["tag"] .= "#[url=".App::get_baseurl()."/search?tag=".$term."]".$term."[/url]";
} }
} }
} }
}
$self = ""; $self = "";
$enclosure = ""; $enclosure = "";
$links = $xpath->query('atom:link', $entry); $links = $xpath->query('atom:link', $entry);
if ($links) { if ($links) {
$rel = "";
$href = "";
$type = "";
$length = "0";
$title = "";
foreach ($links AS $link) { foreach ($links AS $link) {
foreach($link->attributes AS $attributes) { $attribute = self::read_attributes($link);
if ($attributes->name == "href")
$href = $attributes->textContent; if (($attribute['rel'] != "") AND ($attribute['href'] != "")) {
if ($attributes->name == "rel") switch ($attribute['rel']) {
$rel = $attributes->textContent;
if ($attributes->name == "type")
$type = $attributes->textContent;
if ($attributes->name == "length")
$length = $attributes->textContent;
if ($attributes->name == "title")
$title = $attributes->textContent;
}
if (($rel != "") AND ($href != ""))
switch($rel) {
case "alternate": case "alternate":
$item["plink"] = $href; $item["plink"] = $attribute['href'];
if (($item["object-type"] == ACTIVITY_OBJ_QUESTION) OR if (($item["object-type"] == ACTIVITY_OBJ_QUESTION) OR
($item["object-type"] == ACTIVITY_OBJ_EVENT)) ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
$item["body"] .= add_page_info($href); $item["body"] .= add_page_info($attribute['href']);
}
break; break;
case "ostatus:conversation": case "ostatus:conversation":
$conversation = $href; $conversation = $attribute['href'];
break; break;
case "enclosure": case "enclosure":
$enclosure = $href; $enclosure = $attribute['href'];
if(strlen($item["attach"])) if (strlen($item["attach"])) {
$item["attach"] .= ','; $item["attach"] .= ',';
}
$item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'" title="'.$title.'"[/attach]'; if (!isset($attribute['length'])) {
$attribute['length'] = "0";
}
$item["attach"] .= '[attach]href="'.$attribute['href'].'" length="'.$attribute['length'].'" type="'.$attribute['type'].'" title="'.$attribute['title'].'"[/attach]';
break; break;
case "related": case "related":
if ($item["object-type"] != ACTIVITY_OBJ_BOOKMARK) { if ($item["object-type"] != ACTIVITY_OBJ_BOOKMARK) {
if (!isset($item["parent-uri"])) if (!isset($item["parent-uri"])) {
$item["parent-uri"] = $href; $item["parent-uri"] = $attribute['href'];
}
if ($related == "") if ($related == "") {
$related = $href; $related = $attribute['href'];
} else }
$item["body"] .= add_page_info($href); } else {
$item["body"] .= add_page_info($attribute['href']);
}
break; break;
case "self": case "self":
$self = $href; $self = $attribute['href'];
break; break;
case "mentioned": case "mentioned":
// Notification check // Notification check
if ($importer["nurl"] == normalise_link($href)) if ($importer["nurl"] == normalise_link($attribute['href'])) {
$mention = true; $mention = true;
}
break; break;
} }
} }
} }
}
$local_id = ""; $local_id = "";
$repeat_of = ""; $repeat_of = "";
$notice_info = $xpath->query('statusnet:notice_info', $entry); $notice_info = $xpath->query('statusnet:notice_info', $entry);
if ($notice_info AND ($notice_info->length > 0)) { if ($notice_info AND ($notice_info->length > 0)) {
foreach($notice_info->item(0)->attributes AS $attributes) { foreach ($notice_info->item(0)->attributes AS $attributes) {
if ($attributes->name == "source") if ($attributes->name == "source") {
$item["app"] = strip_tags($attributes->textContent); $item["app"] = strip_tags($attributes->textContent);
if ($attributes->name == "local_id") }
if ($attributes->name == "local_id") {
$local_id = $attributes->textContent; $local_id = $attributes->textContent;
if ($attributes->name == "repeat_of") }
if ($attributes->name == "repeat_of") {
$repeat_of = $attributes->textContent; $repeat_of = $attributes->textContent;
} }
} }
}
// Is it a repeated post? // Is it a repeated post?
if (($repeat_of != "") OR ($item["verb"] == ACTIVITY_SHARE)) { if (($repeat_of != "") OR ($item["verb"] == ACTIVITY_SHARE)) {
@ -508,25 +526,27 @@ class ostatus {
if (is_object($activityobjects)) { if (is_object($activityobjects)) {
$orig_uri = $xpath->query("activity:object/atom:id", $activityobjects)->item(0)->nodeValue; $orig_uri = $xpath->query("activity:object/atom:id", $activityobjects)->item(0)->nodeValue;
if (!isset($orig_uri)) if (!isset($orig_uri)) {
$orig_uri = $xpath->query('atom:id/text()', $activityobjects)->item(0)->nodeValue; $orig_uri = $xpath->query('atom:id/text()', $activityobjects)->item(0)->nodeValue;
}
$orig_links = $xpath->query("activity:object/atom:link[@rel='alternate']", $activityobjects); $orig_links = $xpath->query("activity:object/atom:link[@rel='alternate']", $activityobjects);
if ($orig_links AND ($orig_links->length > 0)) if ($orig_links AND ($orig_links->length > 0)) {
foreach($orig_links->item(0)->attributes AS $attributes) foreach ($orig_links->item(0)->attributes AS $attributes) {
if ($attributes->name == "href") if ($attributes->name == "href") {
$orig_link = $attributes->textContent; $orig_link = $attributes->textContent;
}
if (!isset($orig_link)) }
}
if (!isset($orig_link)) {
$orig_link = $xpath->query("atom:link[@rel='alternate']", $activityobjects)->item(0)->nodeValue; $orig_link = $xpath->query("atom:link[@rel='alternate']", $activityobjects)->item(0)->nodeValue;
}
if (!isset($orig_link)) if (!isset($orig_link)) {
$orig_link = self::convert_href($orig_uri); $orig_link = self::convert_href($orig_uri);
}
$orig_body = $xpath->query('activity:object/atom:content/text()', $activityobjects)->item(0)->nodeValue; $orig_body = $xpath->query('activity:object/atom:content/text()', $activityobjects)->item(0)->nodeValue;
if (!isset($orig_body)) if (!isset($orig_body)) {
$orig_body = $xpath->query('atom:content/text()', $activityobjects)->item(0)->nodeValue; $orig_body = $xpath->query('atom:content/text()', $activityobjects)->item(0)->nodeValue;
}
$orig_created = $xpath->query('atom:published/text()', $activityobjects)->item(0)->nodeValue; $orig_created = $xpath->query('atom:published/text()', $activityobjects)->item(0)->nodeValue;
$orig_edited = $xpath->query('atom:updated/text()', $activityobjects)->item(0)->nodeValue; $orig_edited = $xpath->query('atom:updated/text()', $activityobjects)->item(0)->nodeValue;
@ -550,9 +570,27 @@ class ostatus {
$item["verb"] = $xpath->query('activity:verb/text()', $activityobjects)->item(0)->nodeValue; $item["verb"] = $xpath->query('activity:verb/text()', $activityobjects)->item(0)->nodeValue;
$item["object-type"] = $xpath->query('activity:object/activity:object-type/text()', $activityobjects)->item(0)->nodeValue; $item["object-type"] = $xpath->query('activity:object/activity:object-type/text()', $activityobjects)->item(0)->nodeValue;
if (!isset($item["object-type"])) if (!isset($item["object-type"])) {
$item["object-type"] = $xpath->query('activity:object-type/text()', $activityobjects)->item(0)->nodeValue; $item["object-type"] = $xpath->query('activity:object-type/text()', $activityobjects)->item(0)->nodeValue;
} }
$enclosures = $xpath->query("atom:link[@rel='alternate']", $activityobjects);
if ($enclosures) {
foreach ($enclosures AS $link) {
$attribute = self::read_attributes($link);
if ($href != "") {
$enclosure = $attribute['href'];
if (strlen($item["attach"])) {
$item["attach"] .= ',';
}
if (!isset($attribute['length'])) {
$attribute['length'] = "0";
}
$item["attach"] .= '[attach]href="'.$attribute['href'].'" length="'.$attribute['length'].'" type="'.$attribute['type'].'" title="'.$attribute['title'].'"[/attach]';
}
}
}
}
} }
//if ($enclosure != "") //if ($enclosure != "")
@ -579,13 +617,13 @@ class ostatus {
intval($importer["uid"]), dbesc($item["parent-uri"])); intval($importer["uid"]), dbesc($item["parent-uri"]));
} }
} }
if ($r) { if (dbm::is_result($r)) {
$item["type"] = 'remote-comment'; $item["type"] = 'remote-comment';
$item["gravity"] = GRAVITY_COMMENT; $item["gravity"] = GRAVITY_COMMENT;
} }
} else } else {
$item["parent-uri"] = $item["uri"]; $item["parent-uri"] = $item["uri"];
}
$item_id = self::completion($conversation, $importer["uid"], $item, $self); $item_id = self::completion($conversation, $importer["uid"], $item, $self);
if (!$item_id) { if (!$item_id) {

View File

@ -2,11 +2,11 @@
use \Friendica\Core\Config; use \Friendica\Core\Config;
function update_gcontact_run(&$argv, &$argc){ function update_gcontact_run(&$argv, &$argc) {
global $a; global $a;
require_once('include/Scrape.php'); require_once 'include/Scrape.php';
require_once('include/socgraph.php'); require_once 'include/socgraph.php';
logger('update_gcontact: start'); logger('update_gcontact: start');
@ -21,11 +21,13 @@ function update_gcontact_run(&$argv, &$argc){
$r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id)); $r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id));
if (!$r) if (!dbm::_is_result($r)) {
return; return;
}
if (!in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) if (!in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
return; return;
}
$data = probe_url($r[0]["url"]); $data = probe_url($r[0]["url"]);

161
index.php
View File

@ -28,17 +28,17 @@ $a->backend = false;
/** /**
* *
* Load the configuration file which contains our DB credentials. * Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in installation mode. * Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode.
* *
*/ */
$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true); $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include(".htconfig.php"); // Only load config if found, don't surpress errors
if (!$install) {
include ".htconfig.php";
}
/** /**
* *
@ -46,9 +46,9 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
* *
*/ */
require_once("include/dba.php"); require_once "include/dba.php";
if(!$install) { if (!$install) {
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install); $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
unset($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data);
@ -59,17 +59,17 @@ if(!$install) {
Config::load(); Config::load();
if ($a->max_processes_reached() OR $a->maxload_reached()) { if ($a->max_processes_reached() OR $a->maxload_reached()) {
header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable'); header($_SERVER["SERVER_PROTOCOL"] . ' 503 Service Temporarily Unavailable');
header('Retry-After: 120'); header('Retry-After: 120');
header('Refresh: 120; url='.App::get_baseurl()."/".$a->query_string); header('Refresh: 120; url=' . App::get_baseurl() . "/" . $a->query_string);
die("System is currently unavailable. Please try again later"); die("System is currently unavailable. Please try again later");
} }
if (get_config('system','force_ssl') AND ($a->get_scheme() == "http") AND if (get_config('system', 'force_ssl') AND ($a->get_scheme() == "http") AND
(intval(get_config('system','ssl_policy')) == SSL_POLICY_FULL) AND (intval(get_config('system', 'ssl_policy')) == SSL_POLICY_FULL) AND
(substr(App::get_baseurl(), 0, 8) == "https://")) { (substr(App::get_baseurl(), 0, 8) == "https://")) {
header("HTTP/1.1 302 Moved Temporarily"); header("HTTP/1.1 302 Moved Temporarily");
header("Location: ".App::get_baseurl()."/".$a->query_string); header("Location: " . App::get_baseurl() . "/" . $a->query_string);
exit(); exit();
} }
@ -117,12 +117,12 @@ if (x($_SESSION,'authenticated') && !x($_SESSION,'language')) {
if (dbm::is_result($r)) $_SESSION['language'] = $r[0]['language']; if (dbm::is_result($r)) $_SESSION['language'] = $r[0]['language'];
} }
if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) { if ((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
$lang = $_SESSION['language']; $lang = $_SESSION['language'];
load_translation_table($lang); load_translation_table($lang);
} }
if((x($_GET,'zrl')) && (!$install && !$maintenance)) { if ((x($_GET,'zrl')) && (!$install && !$maintenance)) {
// Only continue when the given profile link seems valid // Only continue when the given profile link seems valid
// Valid profile links contain a path with "/profile/" and no query parameters // Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") AND if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") AND
@ -223,7 +223,7 @@ if ((local_user()) || (! $privateapps === "1")) {
* further processing. * further processing.
*/ */
if(strlen($a->module)) { if (strlen($a->module)) {
/** /**
* *
@ -233,12 +233,14 @@ if(strlen($a->module)) {
*/ */
// Compatibility with the Android Diaspora client // Compatibility with the Android Diaspora client
if ($a->module == "stream") if ($a->module == "stream") {
$a->module = "network"; $a->module = "network";
}
// Compatibility with the Firefox App // Compatibility with the Firefox App
if (($a->module == "users") AND ($a->cmd == "users/sign_in")) if (($a->module == "users") AND ($a->cmd == "users/sign_in")) {
$a->module = "login"; $a->module = "login";
}
$privateapps = get_config('config','private_addons'); $privateapps = get_config('config','private_addons');
@ -246,13 +248,13 @@ if(strlen($a->module)) {
//Check if module is an app and if public access to apps is allowed or not //Check if module is an app and if public access to apps is allowed or not
if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") { if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
info( t("You must be logged in to use addons. ")); info( t("You must be logged in to use addons. "));
} } else {
else {
include_once("addon/{$a->module}/{$a->module}.php"); include_once("addon/{$a->module}/{$a->module}.php");
if(function_exists($a->module . '_module')) if (function_exists($a->module . '_module')) {
$a->module_loaded = true; $a->module_loaded = true;
} }
} }
}
/** /**
* If not, next look for a 'standard' program module in the 'mod' directory * If not, next look for a 'standard' program module in the 'mod' directory
@ -320,29 +322,22 @@ if (!$install && !$maintenance) {
* Call module functions * Call module functions
*/ */
if($a->module_loaded) { if ($a->module_loaded) {
$a->page['page_title'] = $a->module; $a->page['page_title'] = $a->module;
$placeholder = ''; $placeholder = '';
if(function_exists($a->module . '_init')) { if (function_exists($a->module . '_init')) {
call_hooks($a->module . '_mod_init', $placeholder); call_hooks($a->module . '_mod_init', $placeholder);
$func = $a->module . '_init'; $func = $a->module . '_init';
$func($a); $func($a);
} }
if(function_exists(str_replace('-','_',current_theme()) . '_init')) { if (function_exists(str_replace('-','_',current_theme()) . '_init')) {
$func = str_replace('-','_',current_theme()) . '_init'; $func = str_replace('-','_',current_theme()) . '_init';
$func($a); $func($a);
} }
// elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) {
// require_once("view/theme/".$a->theme_info["extends"]."/theme.php");
// if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) {
// $func = str_replace('-','_',$a->theme_info["extends"]) . '_init';
// $func($a);
// }
// }
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error) if (($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
&& (function_exists($a->module . '_post')) && (function_exists($a->module . '_post'))
&& (! x($_POST,'auth-params'))) { && (! x($_POST,'auth-params'))) {
call_hooks($a->module . '_mod_post', $_POST); call_hooks($a->module . '_mod_post', $_POST);
@ -350,13 +345,13 @@ if($a->module_loaded) {
$func($a); $func($a);
} }
if((! $a->error) && (function_exists($a->module . '_afterpost'))) { if ((! $a->error) && (function_exists($a->module . '_afterpost'))) {
call_hooks($a->module . '_mod_afterpost',$placeholder); call_hooks($a->module . '_mod_afterpost',$placeholder);
$func = $a->module . '_afterpost'; $func = $a->module . '_afterpost';
$func($a); $func($a);
} }
if((! $a->error) && (function_exists($a->module . '_content'))) { if ((! $a->error) && (function_exists($a->module . '_content'))) {
$arr = array('content' => $a->page['content']); $arr = array('content' => $a->page['content']);
call_hooks($a->module . '_mod_content', $arr); call_hooks($a->module . '_mod_content', $arr);
$a->page['content'] = $arr['content']; $a->page['content'] = $arr['content'];
@ -366,7 +361,7 @@ if($a->module_loaded) {
$a->page['content'] .= $arr['content']; $a->page['content'] .= $arr['content'];
} }
if(function_exists(str_replace('-','_',current_theme()) . '_content_loaded')) { if (function_exists(str_replace('-','_',current_theme()) . '_content_loaded')) {
$func = str_replace('-','_',current_theme()) . '_content_loaded'; $func = str_replace('-','_',current_theme()) . '_content_loaded';
$func($a); $func($a);
} }
@ -374,82 +369,59 @@ if($a->module_loaded) {
/* /*
* Create the page head after setting the language * Create the page head after setting the language
* and getting any auth credentials * and getting any auth credentials.
* *
* Moved init_pagehead() and init_page_end() to after * Moved init_pagehead() and init_page_end() to after
* all the module functions have executed so that all * all the module functions have executed so that all
* theme choices made by the modules can take effect * theme choices made by the modules can take effect.
*/ */
$a->init_pagehead(); $a->init_pagehead();
/** /*
* Build the page ending -- this is stuff that goes right before * Build the page ending -- this is stuff that goes right before
* the closing </body> tag * the closing </body> tag
*/ */
$a->init_page_end(); $a->init_page_end();
// If you're just visiting, let javascript take you home // If you're just visiting, let javascript take you home
if (x($_SESSION, 'visitor_home')) {
if(x($_SESSION,'visitor_home'))
$homebase = $_SESSION['visitor_home']; $homebase = $_SESSION['visitor_home'];
elseif(local_user()) } elseif (local_user()) {
$homebase = 'profile/' . $a->user['nickname']; $homebase = 'profile/' . $a->user['nickname'];
}
if(isset($homebase)) if (isset($homebase)) {
$a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>'; $a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>';
}
// now that we've been through the module content, see if the page reported /*
// a permission problem and if so, a 403 response would seem to be in order. * now that we've been through the module content, see if the page reported
* a permission problem and if so, a 403 response would seem to be in order.
if(stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) { */
if (stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.')); header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.'));
} }
/** /*
*
* Report anything which needs to be communicated in the notification area (before the main body) * Report anything which needs to be communicated in the notification area (before the main body)
*
*/ */
/*if(x($_SESSION,'sysmsg')) {
$a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
. ((x($a->page,'content')) ? $a->page['content'] : '');
$_SESSION['sysmsg']="";
unset($_SESSION['sysmsg']);
}
if(x($_SESSION,'sysmsg_info')) {
$a->page['content'] = "<div id=\"sysmsg_info\" class=\"info-message\">{$_SESSION['sysmsg_info']}</div>\r\n"
. ((x($a->page,'content')) ? $a->page['content'] : '');
$_SESSION['sysmsg_info']="";
unset($_SESSION['sysmsg_info']);
}*/
call_hooks('page_end', $a->page['content']); call_hooks('page_end', $a->page['content']);
/*
/**
*
* Add the navigation (menu) template * Add the navigation (menu) template
*
*/ */
if ($a->module != 'install' && $a->module != 'maintenance') {
if($a->module != 'install' && $a->module != 'maintenance') {
nav($a); nav($a);
} }
/** /*
* Add a "toggle mobile" link if we're using a mobile device * Add a "toggle mobile" link if we're using a mobile device
*/ */
if ($a->is_mobile || $a->is_tablet) {
if($a->is_mobile || $a->is_tablet) { if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
$link = 'toggle_mobile?address=' . curPageURL(); $link = 'toggle_mobile?address=' . curPageURL();
} } else {
else {
$link = 'toggle_mobile?off=1&address=' . curPageURL(); $link = 'toggle_mobile?off=1&address=' . curPageURL();
} }
$a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array( $a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array(
@ -462,10 +434,11 @@ if($a->is_mobile || $a->is_tablet) {
* Build the page - now that we have all the components * Build the page - now that we have all the components
*/ */
if(!$a->theme['stylesheet']) if (!$a->theme['stylesheet']) {
$stylesheet = current_theme_url(); $stylesheet = current_theme_url();
else } else {
$stylesheet = $a->theme['stylesheet']; $stylesheet = $a->theme['stylesheet'];
}
$a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']); $a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']);
//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet)); //$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
@ -478,6 +451,7 @@ if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "min
$content = mb_convert_encoding($a->page["content"], 'HTML-ENTITIES', "UTF-8"); $content = mb_convert_encoding($a->page["content"], 'HTML-ENTITIES', "UTF-8");
/// @TODO one day, kill those error-surpressing @ stuff, or PHP should ban it
@$doc->loadHTML($content); @$doc->loadHTML($content);
$xpath = new DomXPath($doc); $xpath = new DomXPath($doc);
@ -485,7 +459,6 @@ if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "min
$list = $xpath->query("//*[contains(@id,'tread-wrapper-')]"); /* */ $list = $xpath->query("//*[contains(@id,'tread-wrapper-')]"); /* */
foreach ($list as $item) { foreach ($list as $item) {
$item = $target->importNode($item, true); $item = $target->importNode($item, true);
// And then append it to the target // And then append it to the target
@ -499,32 +472,30 @@ if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) {
echo substr($target->saveHTML(), 6, -8); echo substr($target->saveHTML(), 6, -8);
if (!$a->is_backend()) killme();
session_write_close();
exit;
} }
$page = $a->page; $page = $a->page;
$profile = $a->profile; $profile = $a->profile;
header("X-Friendica-Version: ".FRIENDICA_VERSION); header("X-Friendica-Version: " . FRIENDICA_VERSION);
header("Content-type: text/html; charset=utf-8"); header("Content-type: text/html; charset=utf-8");
// We use $_GET["mode"] for special page templates. So we will check if we have /*
// to load another page template than the default one * We use $_GET["mode"] for special page templates. So we will check if we have
// The page templates are located in /view/php/ or in the theme directory * to load another page template than the default one.
* The page templates are located in /view/php/ or in the theme directory.
*/
if (isset($_GET["mode"])) { if (isset($_GET["mode"])) {
$template = theme_include($_GET["mode"].'.php'); $template = theme_include($_GET["mode"] . '.php');
} }
// If there is no page template use the default page template // If there is no page template use the default page template
if(!$template) { if (!$template) {
$template = theme_include("default.php"); $template = theme_include("default.php");
} }
require_once($template); /// @TODO Looks unsafe (remote-inclusion), is maybe not but theme_include() uses file_exists() but does not escape anything
require_once $template;
if (!$a->is_backend()) killme();
session_write_close();
exit;

View File

@ -2004,22 +2004,22 @@ function admin_page_features_post(App $a) {
$features = get_features(false); $features = get_features(false);
foreach ($features as $fname => $fdata) { foreach ($features as $fname => $fdata) {
foreach (array_slice($fdata,1) as $f) { foreach (array_slice($fdata, 1) as $f) {
$feature = $f[0]; $feature = $f[0];
$feature_state = 'feature_'.$feature; $feature_state = 'feature_' . $feature;
$featurelock = 'featurelock_'.$feature; $featurelock = 'featurelock_' . $feature;
if (x($_POST[$feature_state])) { if (x($_POST, $feature_state)) {
$val = intval($_POST['feature_'.$feature]); $val = intval($_POST[$feature_state]);
} else { } else {
$val = 0; $val = 0;
} }
set_config('feature',$feature,$val); set_config('feature',$feature,$val);
if (x($_POST[$featurelock])) { if (x($_POST, $featurelock)) {
set_config('feature_lock',$feature,$val); set_config('feature_lock', $feature, $val);
} else { } else {
del_config('feature_lock',$feature); del_config('feature_lock', $feature);
} }
} }
} }

View File

@ -586,17 +586,18 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
dbesc($decrypted_source_url), dbesc($decrypted_source_url),
intval($local_uid) intval($local_uid)
); );
if(! count($ret)) { if (!dbm::is_result($ret)) {
if(strstr($decrypted_source_url,'http:')) if (strstr($decrypted_source_url,'http:')) {
$newurl = str_replace('http:','https:',$decrypted_source_url); $newurl = str_replace('http:','https:',$decrypted_source_url);
else } else {
$newurl = str_replace('https:','http:',$decrypted_source_url); $newurl = str_replace('https:','http:',$decrypted_source_url);
}
$ret = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1", $ret = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newurl), dbesc($newurl),
intval($local_uid) intval($local_uid)
); );
if(! count($ret)) { if (!dbm::is_result($ret)) {
// this is either a bogus confirmation (?) or we deleted the original introduction. // this is either a bogus confirmation (?) or we deleted the original introduction.
$message = t('Contact record was not found for you on our site.'); $message = t('Contact record was not found for you on our site.');
xml_status(3,$message); xml_status(3,$message);
@ -611,7 +612,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$foreign_pubkey = $ret[0]['site-pubkey']; $foreign_pubkey = $ret[0]['site-pubkey'];
$dfrn_record = $ret[0]['id']; $dfrn_record = $ret[0]['id'];
if(! $foreign_pubkey) { if (! $foreign_pubkey) {
$message = sprintf( t('Site public key not available in contact record for URL %s.'), $newurl); $message = sprintf( t('Site public key not available in contact record for URL %s.'), $newurl);
xml_status(3,$message); xml_status(3,$message);
} }
@ -619,7 +620,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$decrypted_dfrn_id = ""; $decrypted_dfrn_id = "";
openssl_public_decrypt($dfrn_id,$decrypted_dfrn_id,$foreign_pubkey); openssl_public_decrypt($dfrn_id,$decrypted_dfrn_id,$foreign_pubkey);
if(strlen($aes_key)) { if (strlen($aes_key)) {
$decrypted_aes_key = ""; $decrypted_aes_key = "";
openssl_private_decrypt($aes_key,$decrypted_aes_key,$my_prvkey); openssl_private_decrypt($aes_key,$decrypted_aes_key,$my_prvkey);
$dfrn_pubkey = openssl_decrypt($public_key,'AES-256-CBC',$decrypted_aes_key); $dfrn_pubkey = openssl_decrypt($public_key,'AES-256-CBC',$decrypted_aes_key);

View File

@ -28,14 +28,14 @@ function dfrn_notify_post(App $a) {
$prv = (($page == 2) ? 1 : 0); $prv = (($page == 2) ? 1 : 0);
$writable = (-1); $writable = (-1);
if($dfrn_version >= 2.21) { if ($dfrn_version >= 2.21) {
$writable = (($perm === 'rw') ? 1 : 0); $writable = (($perm === 'rw') ? 1 : 0);
} }
$direction = (-1); $direction = (-1);
if(strpos($dfrn_id,':') == 1) { if (strpos($dfrn_id, ':') == 1) {
$direction = intval(substr($dfrn_id,0,1)); $direction = intval(substr($dfrn_id, 0, 1));
$dfrn_id = substr($dfrn_id,2); $dfrn_id = substr($dfrn_id, 2);
} }
$r = q("SELECT * FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1", $r = q("SELECT * FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1",
@ -70,9 +70,11 @@ function dfrn_notify_post(App $a) {
break; // NOTREACHED break; // NOTREACHED
} }
// be careful - $importer will contain both the contact information for the contact /*
// sending us the post, and also the user information for the person receiving it. * be careful - $importer will contain both the contact information for the contact
// since they are mixed together, it is easy to get them confused. * sending us the post, and also the user information for the person receiving it.
* since they are mixed together, it is easy to get them confused.
*/
$r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, $r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
`contact`.`pubkey` AS `cpubkey`, `contact`.`pubkey` AS `cpubkey`,
@ -100,15 +102,16 @@ function dfrn_notify_post(App $a) {
logger("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DEBUG); logger("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DEBUG);
if((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) { if ((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) {
q("UPDATE `contact` SET `writable` = %d, forum = %d, prv = %d WHERE `id` = %d", q("UPDATE `contact` SET `writable` = %d, forum = %d, prv = %d WHERE `id` = %d",
intval(($writable == (-1)) ? $importer['writable'] : $writable), intval(($writable == (-1)) ? $importer['writable'] : $writable),
intval($forum), intval($forum),
intval($prv), intval($prv),
intval($importer['id']) intval($importer['id'])
); );
if($writable != (-1)) if ($writable != (-1)) {
$importer['writable'] = $writable; $importer['writable'] = $writable;
}
$importer['forum'] = $page; $importer['forum'] = $page;
} }
@ -120,7 +123,7 @@ function dfrn_notify_post(App $a) {
logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']);
logger('dfrn_notify: data: ' . $data, LOGGER_DATA); logger('dfrn_notify: data: ' . $data, LOGGER_DATA);
if($dissolve == 1) { if ($dissolve == 1) {
/* /*
* Relationship is dissolved permanently * Relationship is dissolved permanently
@ -133,19 +136,12 @@ function dfrn_notify_post(App $a) {
} }
$rino = get_config('system', 'rino_encrypt');
// If we are setup as a soapbox we aren't accepting input from this person
// This behaviour is deactivated since it really doesn't make sense to even disallow comments
// The check if someone is a friend or simply a follower is done in a later place so it needn't to be done here
//if($importer['page-flags'] == PAGE_SOAPBOX)
// xml_status(0);
$rino = get_config('system','rino_encrypt');
$rino = intval($rino); $rino = intval($rino);
logger("Local rino version: ". $rino, LOGGER_DEBUG); logger("Local rino version: " . $rino, LOGGER_DEBUG);
if(strlen($key)) { if (strlen($key)) {
// if local rino is lower than remote rino, abort: should not happen! // if local rino is lower than remote rino, abort: should not happen!
// but only for $remote_rino > 1, because old code did't send rino version // but only for $remote_rino > 1, because old code did't send rino version
@ -158,20 +154,17 @@ function dfrn_notify_post(App $a) {
logger('rino: md5 raw key: ' . md5($rawkey)); logger('rino: md5 raw key: ' . md5($rawkey));
$final_key = ''; $final_key = '';
if($dfrn_version >= 2.1) { if ($dfrn_version >= 2.1) {
if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) { if ((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']); openssl_private_decrypt($rawkey, $final_key, $importer['cprvkey']);
} else {
openssl_public_decrypt($rawkey, $final_key, $importer['cpubkey']);
} }
else { } else {
openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']); if ((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
} openssl_public_decrypt($rawkey, $final_key, $importer['cpubkey']);
} } else {
else { openssl_private_decrypt($rawkey, $final_key, $importer['cprvkey']);
if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
}
else {
openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
} }
} }
@ -180,27 +173,31 @@ function dfrn_notify_post(App $a) {
switch($rino_remote) { switch($rino_remote) {
case 0: case 0:
case 1: case 1:
// we got a key. old code send only the key, without RINO version. /*
// we assume RINO 1 if key and no RINO version *we got a key. old code send only the key, without RINO version.
$data = dfrn::aes_decrypt(hex2bin($data),$final_key); * we assume RINO 1 if key and no RINO version
*/
$data = dfrn::aes_decrypt(hex2bin($data), $final_key);
break; break;
case 2: case 2:
try { try {
$data = Crypto::decrypt(hex2bin($data),$final_key); $data = Crypto::decrypt(hex2bin($data), $final_key);
} catch (InvalidCiphertext $ex) { // VERY IMPORTANT } catch (InvalidCiphertext $ex) { // VERY IMPORTANT
// Either: /*
// 1. The ciphertext was modified by the attacker, * Either:
// 2. The key is wrong, or * 1. The ciphertext was modified by the attacker,
// 3. $ciphertext is not a valid ciphertext or was corrupted. * 2. The key is wrong, or
// Assume the worst. * 3. $ciphertext is not a valid ciphertext or was corrupted.
* Assume the worst.
*/
logger('The ciphertext has been tampered with!'); logger('The ciphertext has been tampered with!');
xml_status(0,'The ciphertext has been tampered with!'); xml_status(0, 'The ciphertext has been tampered with!');
} catch (Ex\CryptoTestFailed $ex) { } catch (Ex\CryptoTestFailed $ex) {
logger('Cannot safely perform dencryption'); logger('Cannot safely perform dencryption');
xml_status(0,'CryptoTestFailed'); xml_status(0, 'CryptoTestFailed');
} catch (Ex\CannotPerformOperation $ex) { } catch (Ex\CannotPerformOperation $ex) {
logger('Cannot safely perform decryption'); logger('Cannot safely perform decryption');
xml_status(0,'Cannot safely perform decryption'); xml_status(0, 'Cannot safely perform decryption');
} }
break; break;
default: default:
@ -223,8 +220,10 @@ function dfrn_notify_content(App $a) {
if(x($_GET,'dfrn_id')) { if(x($_GET,'dfrn_id')) {
// initial communication from external contact, $direction is their direction. /*
// If this is a duplex communication, ours will be the opposite. * initial communication from external contact, $direction is their direction.
* If this is a duplex communication, ours will be the opposite.
*/
$dfrn_id = notags(trim($_GET['dfrn_id'])); $dfrn_id = notags(trim($_GET['dfrn_id']));
$dfrn_version = (float) $_GET['dfrn_version']; $dfrn_version = (float) $_GET['dfrn_version'];
@ -296,34 +295,35 @@ function dfrn_notify_content(App $a) {
$pub_key = trim($r[0]['pubkey']); $pub_key = trim($r[0]['pubkey']);
$dplx = intval($r[0]['duplex']); $dplx = intval($r[0]['duplex']);
if((($dplx) && (strlen($prv_key))) || ((strlen($prv_key)) && (!(strlen($pub_key))))) { if ((($dplx) && (strlen($prv_key))) || ((strlen($prv_key)) && (!(strlen($pub_key))))) {
openssl_private_encrypt($hash,$challenge,$prv_key); openssl_private_encrypt($hash, $challenge, $prv_key);
openssl_private_encrypt($id_str,$encrypted_id,$prv_key); openssl_private_encrypt($id_str, $encrypted_id, $prv_key);
} } elseif (strlen($pub_key)) {
elseif(strlen($pub_key)) { openssl_public_encrypt($hash, $challenge, $pub_key);
openssl_public_encrypt($hash,$challenge,$pub_key); openssl_public_encrypt($id_str, $encrypted_id, $pub_key);
openssl_public_encrypt($id_str,$encrypted_id,$pub_key); } else {
} /// @TODO these kind of else-blocks are making the code harder to understand
else
$status = 1; $status = 1;
}
$challenge = bin2hex($challenge); $challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id); $encrypted_id = bin2hex($encrypted_id);
$rino = get_config('system','rino_encrypt'); $rino = get_config('system', 'rino_encrypt');
$rino = intval($rino); $rino = intval($rino);
logger("Local rino version: ". $rino, LOGGER_DEBUG); logger("Local rino version: ". $rino, LOGGER_DEBUG);
// if requested rino is lower than enabled local rino, lower local rino version // if requested rino is lower than enabled local rino, lower local rino version
// if requested rino is higher than enabled local rino, reply with local rino // if requested rino is higher than enabled local rino, reply with local rino
if ($rino_remote < $rino) $rino = $rino_remote; if ($rino_remote < $rino) {
$rino = $rino_remote;
}
if((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) { if((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) {
$perm = 'rw'; $perm = 'rw';
} } else {
else {
$perm = 'r'; $perm = 'r';
} }

View File

@ -460,9 +460,6 @@ function check_funcs(&$checks) {
$ck_funcs[6]['status'] = false; $ck_funcs[6]['status'] = false;
$ck_funcs[6]['help'] = t('Error, XML PHP module required but not installed.'); $ck_funcs[6]['help'] = t('Error, XML PHP module required but not installed.');
} }
/*if((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg']))
notice( t('Please see the file "INSTALL.txt".') . EOL);*/
} }

View File

@ -1,43 +1,44 @@
<?php <?php
/** /*
*
* This is the POST destination for most all locally posted * This is the POST destination for most all locally posted
* text stuff. This function handles status, wall-to-wall status, * text stuff. This function handles status, wall-to-wall status,
* local comments, and remote coments that are posted on this site * local comments, and remote coments that are posted on this site
* (as opposed to being delivered in a feed). * (as opposed to being delivered in a feed).
* Also processed here are posts and comments coming through the * Also processed here are posts and comments coming through the
* statusnet/twitter API. * statusnet/twitter API.
*
* All of these become an "item" which is our basic unit of * All of these become an "item" which is our basic unit of
* information. * information.
*
* Posts that originate externally or do not fall into the above * Posts that originate externally or do not fall into the above
* posting categories go through item_store() instead of this function. * posting categories go through item_store() instead of this function.
*
*/ */
require_once('include/crypto.php'); require_once 'include/crypto.php';
require_once('include/enotify.php'); require_once 'include/enotify.php';
require_once('include/email.php'); require_once 'include/email.php';
require_once('include/tags.php'); require_once 'include/tags.php';
require_once('include/files.php'); require_once 'include/files.php';
require_once('include/threads.php'); require_once 'include/threads.php';
require_once('include/text.php'); require_once 'include/text.php';
require_once('include/items.php'); require_once 'include/items.php';
require_once('include/Scrape.php'); require_once 'include/Scrape.php';
require_once('include/diaspora.php'); require_once 'include/diaspora.php';
require_once('include/Contact.php'); require_once 'include/Contact.php';
function item_post(App $a) { function item_post(App $a) {
if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter'))) if ((! local_user()) && (! remote_user()) && (! x($_REQUEST, 'commenter'))) {
return; return;
}
require_once('include/security.php'); require_once 'include/security.php';
$uid = local_user(); $uid = local_user();
if(x($_REQUEST,'dropitems')) { if (x($_REQUEST, 'dropitems')) {
$arr_drop = explode(',',$_REQUEST['dropitems']); $arr_drop = explode(',', $_REQUEST['dropitems']);
drop_items($arr_drop); drop_items($arr_drop);
$json = array('success' => 1); $json = array('success' => 1);
echo json_encode($json); echo json_encode($json);
@ -45,36 +46,33 @@ function item_post(App $a) {
} }
call_hooks('post_local_start', $_REQUEST); call_hooks('post_local_start', $_REQUEST);
// logger('postinput ' . file_get_contents('php://input')); // logger('postinput ' . file_get_contents('php://input'));
logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA); logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA);
$api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false); $api_source = ((x($_REQUEST, 'api_source') && $_REQUEST['api_source']) ? true : false);
$message_id = ((x($_REQUEST,'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : ''); $message_id = ((x($_REQUEST, 'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : '');
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : ''); $return_path = ((x($_REQUEST, 'return')) ? $_REQUEST['return'] : '');
$preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0); $preview = ((x($_REQUEST, 'preview')) ? intval($_REQUEST['preview']) : 0);
/*
// Check for doubly-submitted posts, and reject duplicates * Check for doubly-submitted posts, and reject duplicates
// Note that we have to ignore previews, otherwise nothing will post * Note that we have to ignore previews, otherwise nothing will post
// after it's been previewed * after it's been previewed
if (!$preview && x($_REQUEST['post_id_random'])) { */
if (x($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) { if (!$preview && x($_REQUEST, 'post_id_random')) {
if (x($_SESSION, 'post-random') && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
logger("item post: duplicate post", LOGGER_DEBUG); logger("item post: duplicate post", LOGGER_DEBUG);
item_post_return(App::get_baseurl(), $api_source, $return_path); item_post_return(App::get_baseurl(), $api_source, $return_path);
} } else {
else {
$_SESSION['post-random'] = $_REQUEST['post_id_random']; $_SESSION['post-random'] = $_REQUEST['post_id_random'];
} }
} }
/** // Is this a reply to something?
* Is this a reply to something? $parent = ((x($_REQUEST, 'parent')) ? intval($_REQUEST['parent']) : 0);
*/ $parent_uri = ((x($_REQUEST, 'parent_uri')) ? trim($_REQUEST['parent_uri']) : '');
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
$parent_uri = ((x($_REQUEST,'parent_uri')) ? trim($_REQUEST['parent_uri']) : '');
$parent_item = null; $parent_item = null;
$parent_contact = null; $parent_contact = null;
@ -87,7 +85,7 @@ function item_post(App $a) {
$objecttype = ACTIVITY_OBJ_COMMENT; $objecttype = ACTIVITY_OBJ_COMMENT;
if (! x($_REQUEST,'type')) { if (! x($_REQUEST, 'type')) {
$_REQUEST['type'] = 'net-comment'; $_REQUEST['type'] = 'net-comment';
} }
@ -116,7 +114,7 @@ function item_post(App $a) {
if (! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Unable to locate original post.') . EOL); notice( t('Unable to locate original post.') . EOL);
if (x($_REQUEST,'return')) { if (x($_REQUEST, 'return')) {
goaway($return_path); goaway($return_path);
} }
killme(); killme();
@ -133,8 +131,9 @@ function item_post(App $a) {
intval($parent_item['contact-id']), intval($parent_item['contact-id']),
intval($uid) intval($uid)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$parent_contact = $r[0]; $parent_contact = $r[0];
}
// If the contact id doesn't fit with the contact, then set the contact to null // If the contact id doesn't fit with the contact, then set the contact to null
$thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent)); $thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
@ -143,7 +142,7 @@ function item_post(App $a) {
$parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]); $parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]);
if (!isset($parent_contact["nick"])) { if (!isset($parent_contact["nick"])) {
require_once("include/Scrape.php"); require_once 'include/Scrape.php';
$probed_contact = probe_url($thrparent[0]["author-link"]); $probed_contact = probe_url($thrparent[0]["author-link"]);
if ($probed_contact["network"] != NETWORK_FEED) { if ($probed_contact["network"] != NETWORK_FEED) {
$parent_contact = $probed_contact; $parent_contact = $probed_contact;
@ -153,22 +152,26 @@ function item_post(App $a) {
$parent_contact["addr"] = $probed_contact["addr"]; $parent_contact["addr"] = $probed_contact["addr"];
} }
} }
logger('no contact found: '.print_r($thrparent, true), LOGGER_DEBUG); logger('no contact found: ' . print_r($thrparent, true), LOGGER_DEBUG);
} else } else {
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG); logger('parent contact: ' . print_r($parent_contact, true), LOGGER_DEBUG);
}
if ($parent_contact["nick"] == "") if ($parent_contact["nick"] == "") {
$parent_contact["nick"] = $parent_contact["name"]; $parent_contact["nick"] = $parent_contact["name"];
} }
} }
}
if($parent) logger('mod_item: item_post parent=' . $parent); if ($parent) {
logger('mod_item: item_post parent=' . $parent);
}
$profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0); $profile_uid = ((x($_REQUEST, 'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0); $post_id = ((x($_REQUEST, 'post_id')) ? intval($_REQUEST['post_id']) : 0);
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : ''); $app = ((x($_REQUEST, 'source')) ? strip_tags($_REQUEST['source']) : '');
$extid = ((x($_REQUEST,'extid')) ? strip_tags($_REQUEST['extid']) : ''); $extid = ((x($_REQUEST, 'extid')) ? strip_tags($_REQUEST['extid']) : '');
$object = ((x($_REQUEST,'object')) ? $_REQUEST['object'] : ''); $object = ((x($_REQUEST, 'object')) ? $_REQUEST['object'] : '');
// Check for multiple posts with the same message id (when the post was created via API) // Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') AND ($profile_uid != 0)) { if (($message_id != '') AND ($profile_uid != 0)) {
@ -189,22 +192,23 @@ function item_post(App $a) {
// First check that the parent exists and it is a wall item. // First check that the parent exists and it is a wall item.
if((x($_REQUEST,'commenter')) && ((! $parent) || (! $parent_item['wall']))) { if ((x($_REQUEST, 'commenter')) && ((! $parent) || (! $parent_item['wall']))) {
notice( t('Permission denied.') . EOL) ; notice(t('Permission denied.') . EOL) ;
if(x($_REQUEST,'return')) if (x($_REQUEST, 'return')) {
goaway($return_path); goaway($return_path);
}
killme(); killme();
} }
// Now check that it is a page_type of PAGE_BLOG, and that valid personal details /*
// have been provided, and run any anti-spam plugins * Now check that it is a page_type of PAGE_BLOG, and that valid personal details
* have been provided, and run any anti-spam plugins
*/
if ((! can_write_wall($a, $profile_uid)) && (! $allow_moderated)) {
if((! can_write_wall($a,$profile_uid)) && (! $allow_moderated)) { notice(t('Permission denied.') . EOL) ;
notice( t('Permission denied.') . EOL) ; if (x($_REQUEST, 'return')) {
if(x($_REQUEST,'return'))
goaway($return_path); goaway($return_path);
}
killme(); killme();
} }
@ -213,7 +217,7 @@ function item_post(App $a) {
$orig_post = null; $orig_post = null;
if($post_id) { if ($post_id) {
$i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1", $i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid), intval($profile_uid),
intval($post_id) intval($post_id)
@ -229,10 +233,11 @@ function item_post(App $a) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($profile_uid) intval($profile_uid)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$user = $r[0]; $user = $r[0];
}
if($orig_post) { if ($orig_post) {
$str_group_allow = $orig_post['allow_gid']; $str_group_allow = $orig_post['allow_gid'];
$str_contact_allow = $orig_post['allow_cid']; $str_contact_allow = $orig_post['allow_cid'];
$str_group_deny = $orig_post['deny_gid']; $str_group_deny = $orig_post['deny_gid'];
@ -254,21 +259,22 @@ function item_post(App $a) {
} else { } else {
// if coming from the API and no privacy settings are set, /*
// use the user default permissions - as they won't have * if coming from the API and no privacy settings are set,
// been supplied via a form. * use the user default permissions - as they won't have
* been supplied via a form.
if(($api_source) */
&& (! array_key_exists('contact_allow',$_REQUEST)) /// @TODO use x($_REQUEST, 'foo') here
&& (! array_key_exists('group_allow',$_REQUEST)) if (($api_source)
&& (! array_key_exists('contact_deny',$_REQUEST)) && (! array_key_exists('contact_allow', $_REQUEST))
&& (! array_key_exists('group_deny',$_REQUEST))) { && (! array_key_exists('group_allow', $_REQUEST))
&& (! array_key_exists('contact_deny', $_REQUEST))
&& (! array_key_exists('group_deny', $_REQUEST))) {
$str_group_allow = $user['allow_gid']; $str_group_allow = $user['allow_gid'];
$str_contact_allow = $user['allow_cid']; $str_contact_allow = $user['allow_cid'];
$str_group_deny = $user['deny_gid']; $str_group_deny = $user['deny_gid'];
$str_contact_deny = $user['deny_cid']; $str_contact_deny = $user['deny_cid'];
} } else {
else {
// use the posted permissions // use the posted permissions
@ -287,26 +293,25 @@ function item_post(App $a) {
$network = notags(trim($_REQUEST['network'])); $network = notags(trim($_REQUEST['network']));
$guid = get_guid(32); $guid = get_guid(32);
item_add_language_opt($_REQUEST); item_add_language_opt($_REQUEST);
$postopts = $_REQUEST['postopts'] ? $_REQUEST['postopts'] : ""; $postopts = $_REQUEST['postopts'] ? $_REQUEST['postopts'] : "";
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0); $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
if ($user['hidewall']) {
if($user['hidewall'])
$private = 2; $private = 2;
}
// If this is a comment, set the permissions from the parent. // If this is a comment, set the permissions from the parent.
if($parent_item) { if ($parent_item) {
// for non native networks use the network of the original post as network of the item // for non native networks use the network of the original post as network of the item
if (($parent_item['network'] != NETWORK_DIASPORA) if (($parent_item['network'] != NETWORK_DIASPORA)
AND ($parent_item['network'] != NETWORK_OSTATUS) AND ($parent_item['network'] != NETWORK_OSTATUS)
AND ($network == "")) AND ($network == "")) {
$network = $parent_item['network']; $network = $parent_item['network'];
}
$str_contact_allow = $parent_item['allow_cid']; $str_contact_allow = $parent_item['allow_cid'];
$str_group_allow = $parent_item['allow_gid']; $str_group_allow = $parent_item['allow_gid'];
@ -315,32 +320,36 @@ function item_post(App $a) {
$private = $parent_item['private']; $private = $parent_item['private'];
} }
$pubmail_enable = ((x($_REQUEST,'pubmail_enable') && intval($_REQUEST['pubmail_enable']) && (! $private)) ? 1 : 0); $pubmail_enable = ((x($_REQUEST, 'pubmail_enable') && intval($_REQUEST['pubmail_enable']) && (! $private)) ? 1 : 0);
// if using the API, we won't see pubmail_enable - figure out if it should be set // if using the API, we won't see pubmail_enable - figure out if it should be set
if($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) { if ($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) {
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); $mail_disabled = ((function_exists('imap_open') && (! get_config('system', 'imap_disabled'))) ? 0 : 1);
if(! $mail_disabled) { if (! $mail_disabled) {
/// @TODO Check if only pubmail is loaded, * loads all columns
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user()) intval(local_user())
); );
if (dbm::is_result($r) && intval($r[0]['pubmail'])) if (dbm::is_result($r) && intval($r[0]['pubmail'])) {
$pubmail_enabled = true; $pubmail_enabled = true;
} }
} }
}
if(! strlen($body)) { if (! strlen($body)) {
if($preview) if ($preview) {
killme(); killme();
info( t('Empty post discarded.') . EOL ); }
if(x($_REQUEST,'return')) info(t('Empty post discarded.') . EOL );
if (x($_REQUEST, 'return')) {
goaway($return_path); goaway($return_path);
}
killme(); killme();
} }
} }
if(strlen($categories)) { if (strlen($categories)) {
// get the "fileas" tags for this post // get the "fileas" tags for this post
$filedas = file_tag_file_to_list($categories, 'file'); $filedas = file_tag_file_to_list($categories, 'file');
} }
@ -348,7 +357,7 @@ function item_post(App $a) {
$categories_old = $categories; $categories_old = $categories;
$categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category'); $categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category');
$categories_new = $categories; $categories_new = $categories;
if(strlen($filedas)) { if (strlen($filedas)) {
// append the fileas stuff to the new categories list // append the fileas stuff to the new categories list
$categories .= file_tag_list_to_file($filedas, 'file'); $categories .= file_tag_list_to_file($filedas, 'file');
} }
@ -359,21 +368,20 @@ function item_post(App $a) {
$self = false; $self = false;
$contact_id = 0; $contact_id = 0;
if((local_user()) && (local_user() == $profile_uid)) { if ((local_user()) && (local_user() == $profile_uid)) {
$self = true; $self = true;
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
} } elseif(remote_user()) {
elseif(remote_user()) { if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
if(is_array($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $v) {
foreach($_SESSION['remote'] as $v) { if ($v['uid'] == $profile_uid) {
if($v['uid'] == $profile_uid) {
$contact_id = $v['cid']; $contact_id = $v['cid'];
break; break;
} }
} }
} }
if($contact_id) { if ($contact_id) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id) intval($contact_id)
); );
@ -387,30 +395,28 @@ function item_post(App $a) {
// get contact info for owner // get contact info for owner
if($profile_uid == local_user()) { if ($profile_uid == local_user()) {
$contact_record = $author; $contact_record = $author;
} } else {
else {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($profile_uid) intval($profile_uid)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$contact_record = $r[0]; $contact_record = $r[0];
} }
}
$post_type = notags(trim($_REQUEST['type'])); $post_type = notags(trim($_REQUEST['type']));
if($post_type === 'net-comment') { if ($post_type === 'net-comment' && $parent_item !== null) {
if($parent_item !== null) { if ($parent_item['wall'] == 1) {
if($parent_item['wall'] == 1)
$post_type = 'wall-comment'; $post_type = 'wall-comment';
else } else {
$post_type = 'remote-comment'; $post_type = 'remote-comment';
} }
} }
/** /*
*
* When a photo was uploaded into the message using the (profile wall) ajax * When a photo was uploaded into the message using the (profile wall) ajax
* uploader, The permissions are initially set to disallow anybody but the * uploader, The permissions are initially set to disallow anybody but the
* owner from seeing it. This is because the permissions may not yet have been * owner from seeing it. This is because the permissions may not yet have been
@ -418,14 +424,13 @@ function item_post(App $a) {
* appropriately. But we didn't know the final permissions on the post until * appropriately. But we didn't know the final permissions on the post until
* now. So now we'll look for links of uploaded messages that are in the * now. So now we'll look for links of uploaded messages that are in the
* post and set them to the same permissions as the post itself. * post and set them to the same permissions as the post itself.
*
*/ */
$match = null; $match = null;
if((! $preview) && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) { if ((! $preview) && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) {
$images = $match[2]; $images = $match[2];
if(count($images)) { if (count($images)) {
$objecttype = ACTIVITY_OBJ_IMAGE; $objecttype = ACTIVITY_OBJ_IMAGE;
@ -466,16 +471,15 @@ function item_post(App $a) {
} }
/** /*
* Next link in any attachment references we find in the post. * Next link in any attachment references we find in the post.
*/ */
$match = false; $match = false;
if((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) { if ((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/", $body, $match)) {
$attaches = $match[1]; $attaches = $match[1];
if(count($attaches)) { if (count($attaches)) {
foreach($attaches as $attach) { foreach ($attaches as $attach) {
$r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1", $r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid), intval($profile_uid),
intval($attach) intval($attach)
@ -507,49 +511,42 @@ function item_post(App $a) {
$body = bb_translate_video($body); $body = bb_translate_video($body);
/** // Fold multi-line [code] sequences
* Fold multi-line [code] sequences $body = preg_replace('/\[\/code\]\s*\[code\]/ism', "\n", $body);
*/
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
$body = scale_external_images($body,false);
$body = scale_external_images($body, false);
// Setting the object type if not defined before // Setting the object type if not defined before
if (!$objecttype) { if (!$objecttype) {
$objecttype = ACTIVITY_OBJ_NOTE; // Default value $objecttype = ACTIVITY_OBJ_NOTE; // Default value
require_once("include/plaintext.php"); require_once 'include/plaintext.php';
$objectdata = get_attached_data($body); $objectdata = get_attached_data($body);
if ($post["type"] == "link") if ($post["type"] == "link") {
$objecttype = ACTIVITY_OBJ_BOOKMARK; $objecttype = ACTIVITY_OBJ_BOOKMARK;
elseif ($post["type"] == "video") } elseif ($post["type"] == "video") {
$objecttype = ACTIVITY_OBJ_VIDEO; $objecttype = ACTIVITY_OBJ_VIDEO;
elseif ($post["type"] == "photo") } elseif ($post["type"] == "photo") {
$objecttype = ACTIVITY_OBJ_IMAGE; $objecttype = ACTIVITY_OBJ_IMAGE;
}
} }
/** // Look for any tags and linkify them
* Look for any tags and linkify them
*/
$str_tags = ''; $str_tags = '';
$inform = ''; $inform = '';
$tags = get_tags($body); $tags = get_tags($body);
/** /*
* add a statusnet style reply tag if the original post was from there * add a statusnet style reply tag if the original post was from there
* and we are replying, and there isn't one already * and we are replying, and there isn't one already
*/ */
if ($parent AND ($parent_contact['network'] == NETWORK_OSTATUS)) { if ($parent AND ($parent_contact['network'] == NETWORK_OSTATUS)) {
$contact = '@[url='.$parent_contact['url'].']'.$parent_contact['nick'].'[/url]'; $contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
if (!in_array($contact,$tags)) { if (!in_array($contact, $tags)) {
$body = $contact.' '.$body; $body = $contact . ' ' . $body;
$tags[] = $contact; $tags[] = $contact;
} }
@ -557,39 +554,44 @@ function item_post(App $a) {
$toplevel_parent = q("SELECT `contact`.* FROM `contact` $toplevel_parent = q("SELECT `contact`.* FROM `contact`
INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id` AND `contact`.`url` = `item`.`author-link` INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id` AND `contact`.`url` = `item`.`author-link`
WHERE `item`.`id` = `item`.`parent` AND `item`.`parent` = %d", intval($parent)); WHERE `item`.`id` = `item`.`parent` AND `item`.`parent` = %d", intval($parent));
if ($toplevel_parent) if (dbm::is_result($toplevel_parent)) {
$toplevel_contact = '@'.$toplevel_parent[0]['nick'].'+'.$toplevel_parent[0]['id']; $toplevel_contact = '@' . $toplevel_parent[0]['nick'] . '+' . $toplevel_parent[0]['id'];
else { } else {
$toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent)); $toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent));
$toplevel_contact = '@[url='.$toplevel_parent[0]['author-link'].']'.$toplevel_parent[0]['author-name'].'[/url]'; $toplevel_contact = '@[url=' . $toplevel_parent[0]['author-link'] . ']' . $toplevel_parent[0]['author-name'] . '[/url]';
} }
if (!in_array($toplevel_contact,$tags)) if (!in_array($toplevel_contact, $tags)) {
$tags[] = $toplevel_contact; $tags[] = $toplevel_contact;
} }
}
$tagged = array(); $tagged = array();
$private_forum = false; $private_forum = false;
if(count($tags)) { if (count($tags)) {
foreach($tags as $tag) { foreach ($tags as $tag) {
if(strpos($tag,'#') === 0) if (strpos($tag, '#') === 0) {
continue; continue;
}
// If we already tagged 'Robert Johnson', don't try and tag 'Robert'. /*
// Robert Johnson should be first in the $tags array * If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
* Robert Johnson should be first in the $tags array
*/
$fullnametagged = false; $fullnametagged = false;
for($x = 0; $x < count($tagged); $x ++) { /// @TODO $tagged is initialized above if() block and is not filled, maybe old-lost code?
if(stristr($tagged[$x],$tag . ' ')) { foreach ($tagged as $nextTag) {
if (stristr($nextTag, $tag . ' ')) {
$fullnametagged = true; $fullnametagged = true;
break; break;
} }
} }
if($fullnametagged) if ($fullnametagged) {
continue; continue;
}
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network); $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
if ($success['replaced']) { if ($success['replaced']) {
@ -647,7 +649,7 @@ function item_post(App $a) {
// even if the post arrived via API we are considering that it // even if the post arrived via API we are considering that it
// originated on this site by default for determining relayability. // originated on this site by default for determining relayability.
$origin = ((x($_REQUEST,'origin')) ? intval($_REQUEST['origin']) : 1); $origin = ((x($_REQUEST, 'origin')) ? intval($_REQUEST['origin']) : 1);
$notify_type = (($parent) ? 'comment-new' : 'wall-new' ); $notify_type = (($parent) ? 'comment-new' : 'wall-new' );
@ -668,11 +670,11 @@ function item_post(App $a) {
$datarray['owner-name'] = $contact_record['name']; $datarray['owner-name'] = $contact_record['name'];
$datarray['owner-link'] = $contact_record['url']; $datarray['owner-link'] = $contact_record['url'];
$datarray['owner-avatar'] = $contact_record['thumb']; $datarray['owner-avatar'] = $contact_record['thumb'];
$datarray["owner-id"] = get_contact($datarray["owner-link"], 0); $datarray['owner-id'] = get_contact($datarray['owner-link'], 0);
$datarray['author-name'] = $author['name']; $datarray['author-name'] = $author['name'];
$datarray['author-link'] = $author['url']; $datarray['author-link'] = $author['url'];
$datarray['author-avatar'] = $author['thumb']; $datarray['author-avatar'] = $author['thumb'];
$datarray["author-id"] = get_contact($datarray["author-link"], 0); $datarray['author-id'] = get_contact($datarray['author-link'], 0);
$datarray['created'] = datetime_convert(); $datarray['created'] = datetime_convert();
$datarray['edited'] = datetime_convert(); $datarray['edited'] = datetime_convert();
$datarray['commented'] = datetime_convert(); $datarray['commented'] = datetime_convert();
@ -707,31 +709,30 @@ function item_post(App $a) {
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name'])); "photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
$datarray['object'] = $object; $datarray['object'] = $object;
/** /*
* These fields are for the convenience of plugins... * These fields are for the convenience of plugins...
* 'self' if true indicates the owner is posting on their own wall * 'self' if true indicates the owner is posting on their own wall
* If parent is 0 it is a top-level post. * If parent is 0 it is a top-level post.
*/ */
$datarray['parent'] = $parent; $datarray['parent'] = $parent;
$datarray['self'] = $self; $datarray['self'] = $self;
// $datarray['prvnets'] = $user['prvnets']; // $datarray['prvnets'] = $user['prvnets'];
$datarray['parent-uri'] = ($parent == 0) ? $uri : $parent_item['uri']; $datarray['parent-uri'] = ($parent == 0) ? $uri : $parent_item['uri'];
$datarray['plink'] = App::get_baseurl().'/display/'.urlencode($datarray['guid']); $datarray['plink'] = App::get_baseurl() . '/display/' . urlencode($datarray['guid']);
$datarray['last-child'] = 1; $datarray['last-child'] = 1;
$datarray['visible'] = 1; $datarray['visible'] = 1;
if($orig_post) if ($orig_post) {
$datarray['edit'] = true; $datarray['edit'] = true;
}
// Search for hashtags // Search for hashtags
item_body_set_hashtags($datarray); item_body_set_hashtags($datarray);
// preview mode - prepare the body for display and send it via json // preview mode - prepare the body for display and send it via json
if ($preview) {
if($preview) { require_once 'include/conversation.php';
require_once('include/conversation.php');
// We set the datarray ID to -1 because in preview mode the dataray // We set the datarray ID to -1 because in preview mode the dataray
// doesn't have an ID. // doesn't have an ID.
$datarray["id"] = -1; $datarray["id"] = -1;
@ -741,17 +742,16 @@ function item_post(App $a) {
killme(); killme();
} }
call_hooks('post_local',$datarray); call_hooks('post_local',$datarray);
if(x($datarray,'cancel')) { if (x($datarray, 'cancel')) {
logger('mod_item: post cancelled by plugin.'); logger('mod_item: post cancelled by plugin.');
if($return_path) { if ($return_path) {
goaway($return_path); goaway($return_path);
} }
$json = array('cancel' => 1); $json = array('cancel' => 1);
if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) { if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) {
$json['reload'] = App::get_baseurl() . '/' . $_REQUEST['jsreload']; $json['reload'] = App::get_baseurl() . '/' . $_REQUEST['jsreload'];
} }
@ -762,7 +762,7 @@ function item_post(App $a) {
// Fill the cache field // Fill the cache field
put_item_in_cache($datarray); put_item_in_cache($datarray);
if($orig_post) { if ($orig_post) {
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d", $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($datarray['title']), dbesc($datarray['title']),
dbesc($datarray['body']), dbesc($datarray['body']),
@ -785,13 +785,14 @@ function item_post(App $a) {
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id); proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id);
if((x($_REQUEST,'return')) && strlen($return_path)) { if ((x($_REQUEST, 'return')) && strlen($return_path)) {
logger('return: ' . $return_path); logger('return: ' . $return_path);
goaway($return_path); goaway($return_path);
} }
killme(); killme();
} else } else {
$post_id = 0; $post_id = 0;
}
q("COMMIT"); q("COMMIT");
q("START TRANSACTION;"); q("START TRANSACTION;");
@ -900,7 +901,7 @@ function item_post(App $a) {
// update filetags in pconfig // update filetags in pconfig
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
if($parent) { if ($parent) {
// This item is the last leaf and gets the comment box, clear any ancestors // This item is the last leaf and gets the comment box, clear any ancestors
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d AND `last-child` AND `id` != %d", $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d AND `last-child` AND `id` != %d",
@ -916,7 +917,7 @@ function item_post(App $a) {
intval($parent) intval($parent)
); );
if($contact_record != $author) { if ($contact_record != $author) {
notification(array( notification(array(
'type' => NOTIFY_COMMENT, 'type' => NOTIFY_COMMENT,
'notify_flags' => $user['notify-flags'], 'notify_flags' => $user['notify-flags'],
@ -948,7 +949,7 @@ function item_post(App $a) {
intval($parent), intval($parent),
intval($post_id)); intval($post_id));
if($contact_record != $author) { if ($contact_record != $author) {
notification(array( notification(array(
'type' => NOTIFY_WALL, 'type' => NOTIFY_WALL,
'notify_flags' => $user['notify-flags'], 'notify_flags' => $user['notify-flags'],
@ -969,26 +970,27 @@ function item_post(App $a) {
call_hooks('post_local_end', $datarray); call_hooks('post_local_end', $datarray);
if(strlen($emailcc) && $profile_uid == local_user()) { if (strlen($emailcc) && $profile_uid == local_user()) {
$erecips = explode(',', $emailcc); $erecips = explode(',', $emailcc);
if(count($erecips)) { if (count($erecips)) {
foreach($erecips as $recip) { foreach ($erecips as $recip) {
$addr = trim($recip); $addr = trim($recip);
if(! strlen($addr)) if (! strlen($addr)) {
continue; continue;
$disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username']) }
$disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'), $a->user['username'])
. '<br />'; . '<br />';
$disclaimer .= sprintf( t('You may visit them online at %s'), App::get_baseurl() . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= sprintf( t('You may visit them online at %s'), App::get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$datarray['title']=='') { if (!$datarray['title']=='') {
$subject = email_header_encode($datarray['title'],'UTF-8'); $subject = email_header_encode($datarray['title'], 'UTF-8');
} else { } else {
$subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8'); $subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'), $a->user['username']), 'UTF-8');
} }
$link = '<a href="' . App::get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />'; $link = '<a href="' . App::get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
$html = prepare_body($datarray); $html = prepare_body($datarray);
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>'; $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
include_once('include/html2plain.php'); include_once 'include/html2plain.php';
$params = array ( $params = array (
'fromName' => $a->user['username'], 'fromName' => $a->user['username'],
'fromEmail' => $a->user['email'], 'fromEmail' => $a->user['email'],
@ -1032,15 +1034,16 @@ function item_post(App $a) {
function item_post_return($baseurl, $api_source, $return_path) { function item_post_return($baseurl, $api_source, $return_path) {
// figure out how to return, depending on from whence we came // figure out how to return, depending on from whence we came
if($api_source) if ($api_source) {
return; return;
}
if ($return_path) { if ($return_path) {
goaway($return_path); goaway($return_path);
} }
$json = array('success' => 1); $json = array('success' => 1);
if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) { if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) {
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload']; $json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
} }
@ -1058,7 +1061,7 @@ function item_content(App $a) {
return; return;
} }
require_once('include/security.php'); require_once 'include/security.php';
$o = ''; $o = '';
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
@ -1086,19 +1089,19 @@ function item_content(App $a) {
* *
* @return boolean true if replaced, false if not replaced * @return boolean true if replaced, false if not replaced
*/ */
function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") { function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") {
require_once("include/Scrape.php"); require_once 'include/Scrape.php';
require_once("include/socgraph.php"); require_once 'include/socgraph.php';
$replaced = false; $replaced = false;
$r = null; $r = null;
//is it a person tag? //is it a person tag?
if (strpos($tag,'@') === 0) { if (strpos($tag, '@') === 0) {
//is it already replaced? //is it already replaced?
if (strpos($tag,'[url=')) { if (strpos($tag, '[url=')) {
//append tag to str_tags //append tag to str_tags
if (!stristr($str_tags,$tag)) { if (!stristr($str_tags, $tag)) {
if (strlen($str_tags)) { if (strlen($str_tags)) {
$str_tags .= ','; $str_tags .= ',';
} }
@ -1111,19 +1114,22 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
$r = q("SELECT `alias`, `name` FROM `contact` WHERE `nurl` = '%s' AND `alias` != '' AND `uid` = 0", $r = q("SELECT `alias`, `name` FROM `contact` WHERE `nurl` = '%s' AND `alias` != '' AND `uid` = 0",
normalise_link($matches[1])); normalise_link($matches[1]));
if (!$r) if (!dbm::is_result($r)) {
$r = q("SELECT `alias`, `name` FROM `gcontact` WHERE `nurl` = '%s' AND `alias` != ''", $r = q("SELECT `alias`, `name` FROM `gcontact` WHERE `nurl` = '%s' AND `alias` != ''",
normalise_link($matches[1])); normalise_link($matches[1]));
if ($r) }
if (dbm::is_result($r)) {
$data = $r[0]; $data = $r[0];
else } else {
$data = probe_url($matches[1]); $data = probe_url($matches[1]);
}
if ($data["alias"] != "") { if ($data["alias"] != "") {
$newtag = '@[url='.$data["alias"].']'.$data["name"].'[/url]'; $newtag = '@[url=' . $data["alias"] . ']' . $data["name"] . '[/url]';
if(!stristr($str_tags,$newtag)) { if (!stristr($str_tags, $newtag)) {
if(strlen($str_tags)) if (strlen($str_tags)) {
$str_tags .= ','; $str_tags .= ',';
}
$str_tags .= $newtag; $str_tags .= $newtag;
} }
} }
@ -1133,7 +1139,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
} }
$stat = false; $stat = false;
//get the person's name //get the person's name
$name = substr($tag,1); $name = substr($tag, 1);
// Sometimes the tag detection doesn't seem to work right // Sometimes the tag detection doesn't seem to work right
// This is some workaround // This is some workaround
@ -1141,7 +1147,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
$name = $nameparts[0]; $name = $nameparts[0];
// Try to detect the contact in various ways // Try to detect the contact in various ways
if ((strpos($name,'@')) || (strpos($name,'http://'))) { if ((strpos($name, '@')) || (strpos($name, 'http://'))) {
// Is it in format @user@domain.tld or @http://domain.tld/...? // Is it in format @user@domain.tld or @http://domain.tld/...?
// First check the contact table for the address // First check the contact table for the address
@ -1155,7 +1161,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
); );
// Then check in the contact table for the url // Then check in the contact table for the url
if (!$r) if (!dbm::is_result($r)) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `contact` $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `contact`
WHERE `nurl` = '%s' AND `uid` = %d AND WHERE `nurl` = '%s' AND `uid` = %d AND
(`network` != '%s' OR (`notify` != '' AND `alias` != '')) (`network` != '%s' OR (`notify` != '' AND `alias` != ''))
@ -1164,26 +1170,29 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
intval($profile_uid), intval($profile_uid),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
}
// Then check in the global contacts for the address // Then check in the global contacts for the address
if (!$r) if (!dbm::is_result($r)) {
$r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact` $r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact`
WHERE `addr` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != '')) WHERE `addr` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != ''))
LIMIT 1", LIMIT 1",
dbesc($name), dbesc($name),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
}
// Then check in the global contacts for the url // Then check in the global contacts for the url
if (!$r) if (!dbm::is_result($r)) {
$r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact` $r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact`
WHERE `nurl` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != '')) WHERE `nurl` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != ''))
LIMIT 1", LIMIT 1",
dbesc(normalise_link($name)), dbesc(normalise_link($name)),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
}
if (!$r) { if (!dbm::is_result($r)) {
$probed = probe_url($name); $probed = probe_url($name);
if ($result['network'] != NETWORK_PHANTOM) { if ($result['network'] != NETWORK_PHANTOM) {
update_gcontact($probed); update_gcontact($probed);
@ -1193,9 +1202,9 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
} }
} else { } else {
$r = false; $r = false;
if (strrpos($name,'+')) { if (strrpos($name, '+')) {
// Is it in format @nick+number? // Is it in format @nick+number?
$tagcid = intval(substr($name,strrpos($name,'+') + 1)); $tagcid = intval(substr($name, strrpos($name, '+') + 1));
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($tagcid), intval($tagcid),
@ -1203,8 +1212,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
); );
} }
//select someone by attag or nick and the name passed in the current network // select someone by attag or nick and the name passed in the current network
if(!$r AND ($network != "")) if(!dbm::is_result($r) AND ($network != ""))
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name), dbesc($name),
dbesc($name), dbesc($name),
@ -1213,70 +1222,78 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
); );
//select someone from this user's contacts by name in the current network //select someone from this user's contacts by name in the current network
if (!$r AND ($network != "")) if (!dbm::is_result($r) AND ($network != "")) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
dbesc($name), dbesc($name),
dbesc($network), dbesc($network),
intval($profile_uid) intval($profile_uid)
); );
}
//select someone by attag or nick and the name passed in // select someone by attag or nick and the name passed in
if(!$r) if(!dbm::is_result($r)) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name), dbesc($name),
dbesc($name), dbesc($name),
intval($profile_uid) intval($profile_uid)
); );
}
// select someone from this user's contacts by name
//select someone from this user's contacts by name if(!dbm::is_result($r)) {
if(!$r)
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($name), dbesc($name),
intval($profile_uid) intval($profile_uid)
); );
} }
}
if ($r) { if (dbm::is_result($r)) {
if(strlen($inform) AND (isset($r[0]["notify"]) OR isset($r[0]["id"]))) if (strlen($inform) AND (isset($r[0]["notify"]) OR isset($r[0]["id"]))) {
$inform .= ','; $inform .= ',';
}
if (isset($r[0]["id"])) if (isset($r[0]["id"])) {
$inform .= 'cid:' . $r[0]["id"]; $inform .= 'cid:' . $r[0]["id"];
elseif (isset($r[0]["notify"])) } elseif (isset($r[0]["notify"])) {
$inform .= $r[0]["notify"]; $inform .= $r[0]["notify"];
}
$profile = $r[0]["url"]; $profile = $r[0]["url"];
$alias = $r[0]["alias"]; $alias = $r[0]["alias"];
$newname = $r[0]["nick"]; $newname = $r[0]["nick"];
if (($newname == "") OR (($r[0]["network"] != NETWORK_OSTATUS) AND ($r[0]["network"] != NETWORK_TWITTER) if (($newname == "") OR (($r[0]["network"] != NETWORK_OSTATUS) AND ($r[0]["network"] != NETWORK_TWITTER)
AND ($r[0]["network"] != NETWORK_STATUSNET) AND ($r[0]["network"] != NETWORK_APPNET))) AND ($r[0]["network"] != NETWORK_STATUSNET) AND ($r[0]["network"] != NETWORK_APPNET))) {
$newname = $r[0]["name"]; $newname = $r[0]["name"];
} }
}
//if there is an url for this persons profile //if there is an url for this persons profile
if (isset($profile) AND ($newname != "")) { if (isset($profile) AND ($newname != "")) {
$replaced = true; $replaced = true;
//create profile link // create profile link
$profile = str_replace(',','%2c',$profile); $profile = str_replace(',', '%2c', $profile);
$newtag = '@[url='.$profile.']'.$newname.'[/url]'; $newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
$body = str_replace('@'.$name, $newtag, $body); $body = str_replace('@' . $name, $newtag, $body);
//append tag to str_tags // append tag to str_tags
if(! stristr($str_tags,$newtag)) { if (! stristr($str_tags, $newtag)) {
if(strlen($str_tags)) if (strlen($str_tags)) {
$str_tags .= ','; $str_tags .= ',';
}
$str_tags .= $newtag; $str_tags .= $newtag;
} }
// Status.Net seems to require the numeric ID URL in a mention if the person isn't /*
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. * Status.Net seems to require the numeric ID URL in a mention if the person isn't
* subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) { */
$newtag = '@[url='.$alias.']'.$newname.'[/url]'; if (strlen($alias)) {
if(! stristr($str_tags,$newtag)) { $newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
if(strlen($str_tags)) if (! stristr($str_tags, $newtag)) {
if (strlen($str_tags)) {
$str_tags .= ','; $str_tags .= ',';
}
$str_tags .= $newtag; $str_tags .= $newtag;
} }
} }

View File

@ -22,34 +22,34 @@ function manage_post(App $a) {
} }
} }
$r = q("select * from manage where uid = %d", $r = q("SELECT * FROM `manage` WHERE `uid` = %d",
intval($uid) intval($uid)
); );
$submanage = $r; $submanage = $r;
$identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0); $identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0);
if(! $identity) if (! $identity) {
return; return;
}
$limited_id = 0; $limited_id = 0;
$original_id = $uid; $original_id = $uid;
if(count($submanage)) { if (dbm::is_result($submanage)) {
foreach($submanage as $m) { foreach ($submanage as $m) {
if($identity == $m['mid']) { if ($identity == $m['mid']) {
$limited_id = $m['mid']; $limited_id = $m['mid'];
break; break;
} }
} }
} }
if($limited_id) { if ($limited_id) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($limited_id) intval($limited_id)
); );
} } else {
else {
$r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1",
intval($identity), intval($identity),
dbesc($orig_record['email']), dbesc($orig_record['email']),
@ -70,18 +70,22 @@ function manage_post(App $a) {
unset($_SESSION['mobile-theme']); unset($_SESSION['mobile-theme']);
unset($_SESSION['page_flags']); unset($_SESSION['page_flags']);
unset($_SESSION['return_url']); unset($_SESSION['return_url']);
if(x($_SESSION,'submanage')) if (x($_SESSION, 'submanage')) {
unset($_SESSION['submanage']); unset($_SESSION['submanage']);
if(x($_SESSION,'sysmsg')) }
if (x($_SESSION, 'sysmsg')) {
unset($_SESSION['sysmsg']); unset($_SESSION['sysmsg']);
if(x($_SESSION,'sysmsg_info')) }
if (x($_SESSION, 'sysmsg_info')) {
unset($_SESSION['sysmsg_info']); unset($_SESSION['sysmsg_info']);
}
require_once('include/security.php'); require_once('include/security.php');
authenticate_success($r[0],true,true); authenticate_success($r[0], true, true);
if($limited_id) if ($limited_id) {
$_SESSION['submanage'] = $original_id; $_SESSION['submanage'] = $original_id;
}
$ret = array(); $ret = array();
call_hooks('home_init',$ret); call_hooks('home_init',$ret);
@ -113,26 +117,32 @@ function manage_content(App $a) {
dbesc($id['uid']) dbesc($id['uid'])
); );
$identities[$key][thumb] = $thumb[0][thumb]; $identities[$key]['thumb'] = $thumb[0]['thumb'];
$identities[$key]['selected'] = (($id['nickname'] === $a->user['nickname']) ? true : false); $identities[$key]['selected'] = ($id['nickname'] === $a->user['nickname']);
$notifications = 0; $notifications = 0;
$r = q("SELECT DISTINCT(`parent`) FROM `notify` WHERE `uid` = %d AND NOT `seen` AND NOT (`type` IN (%d, %d))", $r = q("SELECT DISTINCT(`parent`) FROM `notify` WHERE `uid` = %d AND NOT `seen` AND NOT (`type` IN (%d, %d))",
intval($id['uid']), intval(NOTIFY_INTRO), intval(NOTIFY_MAIL)); intval($id['uid']), intval(NOTIFY_INTRO), intval(NOTIFY_MAIL));
if ($r)
if (dbm::is_result($r)) {
$notifications = sizeof($r); $notifications = sizeof($r);
}
$r = q("SELECT DISTINCT(`convid`) FROM `mail` WHERE `uid` = %d AND NOT `seen`", $r = q("SELECT DISTINCT(`convid`) FROM `mail` WHERE `uid` = %d AND NOT `seen`",
intval($id['uid'])); intval($id['uid']));
if ($r)
if (dbm::is_result($r)) {
$notifications = $notifications + sizeof($r); $notifications = $notifications + sizeof($r);
}
$r = q("SELECT COUNT(*) AS `introductions` FROM `intro` WHERE NOT `blocked` AND NOT `ignore` AND `uid` = %d", $r = q("SELECT COUNT(*) AS `introductions` FROM `intro` WHERE NOT `blocked` AND NOT `ignore` AND `uid` = %d",
intval($id['uid'])); intval($id['uid']));
if ($r)
if (dbm::is_result($r)) {
$notifications = $notifications + $r[0]["introductions"]; $notifications = $notifications + $r[0]["introductions"];
}
$identities[$key]['notifications'] = $notifications; $identities[$key]['notifications'] = $notifications;
} }

View File

@ -6,7 +6,7 @@ function network_init(App $a) {
} }
$is_a_date_query = false; $is_a_date_query = false;
if (x($_GET['cid']) && intval($_GET['cid']) != 0) { if (x($_GET, 'cid') && intval($_GET['cid']) != 0) {
$cid = $_GET['cid']; $cid = $_GET['cid'];
} }
@ -103,24 +103,27 @@ function network_init(App $a) {
} }
} }
if(x($_GET['nets']) && $_GET['nets'] === 'all') // If nets is set to all, unset it
if (x($_GET, 'nets') && $_GET['nets'] === 'all') {
unset($_GET['nets']); unset($_GET['nets']);
}
$group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0); $group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0);
set_pconfig(local_user(), 'network.view', 'group.selected', $group_id); set_pconfig(local_user(), 'network.view', 'group.selected', $group_id);
require_once('include/group.php'); require_once 'include/group.php';
require_once('include/contact_widgets.php'); require_once 'include/contact_widgets.php';
require_once('include/items.php'); require_once 'include/items.php';
require_once('include/ForumManager.php'); require_once 'include/ForumManager.php';
if(! x($a->page,'aside')) if (! x($a->page, 'aside')) {
$a->page['aside'] = ''; $a->page['aside'] = '';
}
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : ''); $search = ((x($_GET, 'search')) ? escape_tags($_GET['search']) : '');
if(x($_GET,'save')) { if (x($_GET, 'save')) {
$r = qu("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1", $r = qu("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
@ -132,7 +135,7 @@ function network_init(App $a) {
); );
} }
} }
if(x($_GET,'remove')) { if (x($_GET, 'remove')) {
q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s'", q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s'",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
@ -140,7 +143,7 @@ function network_init(App $a) {
} }
// search terms header // search terms header
if(x($_GET,'search')) { if (x($_GET, 'search')) {
$a->page['content'] .= replace_macros(get_markup_template("section_title.tpl"),array( $a->page['content'] .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => sprintf( t('Results for: %s'), $search) '$title' => sprintf( t('Results for: %s'), $search)
)); ));
@ -157,8 +160,9 @@ function network_init(App $a) {
function saved_searches($search) { function saved_searches($search) {
if(! feature_enabled(local_user(),'savedsearch')) if (! feature_enabled(local_user(),'savedsearch')) {
return ''; return '';
}
$a = get_app(); $a = get_app();

View File

@ -1,23 +1,24 @@
<?php <?php
require_once('include/Photo.php'); require_once 'include/Photo.php';
require_once('include/photos.php'); require_once 'include/photos.php';
require_once('include/items.php'); require_once 'include/items.php';
require_once('include/acl_selectors.php'); require_once 'include/acl_selectors.php';
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
require_once('include/security.php'); require_once 'include/security.php';
require_once('include/redir.php'); require_once 'include/redir.php';
require_once('include/tags.php'); require_once 'include/tags.php';
require_once('include/threads.php'); require_once 'include/threads.php';
require_once('include/Probe.php'); require_once 'include/Probe.php';
use \Friendica\Core\Config; use \Friendica\Core\Config;
function photos_init(App $a) { function photos_init(App $a) {
if ($a->argc > 1) if ($a->argc > 1) {
auto_redir($a, $a->argv[1]); auto_redir($a, $a->argv[1]);
}
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if ((get_config('system', 'block_public')) && (! local_user()) && (! remote_user())) {
return; return;
} }
@ -29,8 +30,9 @@ function photos_init(App $a) {
dbesc($nick) dbesc($nick)
); );
if (! count($user)) if (! dbm::is_result($user)) {
return; return;
}
$a->data['user'] = $user[0]; $a->data['user'] = $user[0];
$a->profile_uid = $user[0]['uid']; $a->profile_uid = $user[0]['uid'];
@ -59,8 +61,9 @@ function photos_init(App $a) {
if ($albums) { if ($albums) {
$a->data['albums'] = $albums; $a->data['albums'] = $albums;
if ($albums_visible) if ($albums_visible) {
$ret['success'] = true; $ret['success'] = true;
}
$ret['albums'] = array(); $ret['albums'] = array();
foreach ($albums as $k => $album) { foreach ($albums as $k => $album) {
@ -80,24 +83,26 @@ function photos_init(App $a) {
$albums = $ret; $albums = $ret;
if (local_user() && $a->data['user']['uid'] == local_user()) if (local_user() && $a->data['user']['uid'] == local_user()) {
$can_post = true; $can_post = true;
}
if ($albums['success']) { if ($albums['success']) {
$photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'),array( $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), array(
'$nick' => $a->data['user']['nickname'], '$nick' => $a->data['user']['nickname'],
'$title' => t('Photo Albums'), '$title' => t('Photo Albums'),
'$recent' => t('Recent Photos'), '$recent' => t('Recent Photos'),
'$albums' => $albums['albums'], '$albums' => $albums['albums'],
'$baseurl' => z_root(), '$baseurl' => z_root(),
'$upload' => array( t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'), '$upload' => array(t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'),
'$can_post' => $can_post '$can_post' => $can_post
)); ));
} }
if (! x($a->page,'aside')) if (! x($a->page, 'aside')) {
$a->page['aside'] = ''; $a->page['aside'] = '';
}
$a->page['aside'] .= $vcard_widget; $a->page['aside'] .= $vcard_widget;
$a->page['aside'] .= $photo_albums_widget; $a->page['aside'] .= $photo_albums_widget;
@ -130,9 +135,9 @@ function photos_post(App $a) {
$page_owner_uid = $a->data['user']['uid']; $page_owner_uid = $a->data['user']['uid'];
$community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false); $community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
if ((local_user()) && (local_user() == $page_owner_uid)) if ((local_user()) && (local_user() == $page_owner_uid)) {
$can_post = true; $can_post = true;
else { } else {
if ($community_page && remote_user()) { if ($community_page && remote_user()) {
$contact_id = 0; $contact_id = 0;
if (is_array($_SESSION['remote'])) { if (is_array($_SESSION['remote'])) {
@ -295,10 +300,11 @@ function photos_post(App $a) {
// send the notification upstream/downstream as the case may be // send the notification upstream/downstream as the case may be
if ($rr['visible']) if ($rr['visible']) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id); proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
} }
} }
}
// Update the photo albums cache // Update the photo albums cache
photo_albums($page_owner_uid, true); photo_albums($page_owner_uid, true);
@ -371,10 +377,11 @@ function photos_post(App $a) {
// Update the photo albums cache // Update the photo albums cache
photo_albums($page_owner_uid, true); photo_albums($page_owner_uid, true);
if ($i[0]['visible']) if ($i[0]['visible']) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id); proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
} }
} }
}
goaway('photos/' . $a->data['user']['nickname']); goaway('photos/' . $a->data['user']['nickname']);
return; // NOTREACHED return; // NOTREACHED
@ -394,15 +401,16 @@ function photos_post(App $a) {
$resource_id = $a->argv[2]; $resource_id = $a->argv[2];
if (! strlen($albname)) if (! strlen($albname)) {
$albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
}
if ((x($_POST,'rotate') !== false) && if ((x($_POST,'rotate') !== false) &&
( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) { ( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) {
logger('rotate'); logger('rotate');
$r = q("select * from photo where `resource-id` = '%s' and uid = %d and scale = 0 limit 1", $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 0 LIMIT 1",
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
@ -415,7 +423,7 @@ function photos_post(App $a) {
$width = $ph->getWidth(); $width = $ph->getWidth();
$height = $ph->getHeight(); $height = $ph->getHeight();
$x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 0", $x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 0",
dbesc($ph->imageString()), dbesc($ph->imageString()),
intval($height), intval($height),
intval($width), intval($width),
@ -428,7 +436,7 @@ function photos_post(App $a) {
$width = $ph->getWidth(); $width = $ph->getWidth();
$height = $ph->getHeight(); $height = $ph->getHeight();
$x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 1", $x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 1",
dbesc($ph->imageString()), dbesc($ph->imageString()),
intval($height), intval($height),
intval($width), intval($width),
@ -442,7 +450,7 @@ function photos_post(App $a) {
$width = $ph->getWidth(); $width = $ph->getWidth();
$height = $ph->getHeight(); $height = $ph->getHeight();
$x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 2", $x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 2",
dbesc($ph->imageString()), dbesc($ph->imageString()),
intval($height), intval($height),
intval($width), intval($width),
@ -458,7 +466,7 @@ function photos_post(App $a) {
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
if (count($p)) { if (dbm::is_result($p)) {
$ext = $phototypes[$p[0]['type']]; $ext = $phototypes[$p[0]['type']];
$r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d", $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d",
dbesc($desc), dbesc($desc),
@ -470,6 +478,7 @@ function photos_post(App $a) {
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
// Update the photo albums cache if album name was changed // Update the photo albums cache if album name was changed
if ($albname !== $origaname) { if ($albname !== $origaname) {
photo_albums($page_owner_uid, true); photo_albums($page_owner_uid, true);
@ -479,8 +488,9 @@ function photos_post(App $a) {
/* Don't make the item visible if the only change was the album name */ /* Don't make the item visible if the only change was the album name */
$visibility = 0; $visibility = 0;
if ($p[0]['desc'] !== $desc || strlen($rawtags)) if ($p[0]['desc'] !== $desc || strlen($rawtags)) {
$visibility = 1; $visibility = 1;
}
if (! $item_id) { if (! $item_id) {
@ -540,40 +550,45 @@ function photos_post(App $a) {
// if the new tag doesn't have a namespace specifier (@foo or #foo) give it a hashtag // if the new tag doesn't have a namespace specifier (@foo or #foo) give it a hashtag
$x = substr($rawtags,0,1); $x = substr($rawtags,0,1);
if ($x !== '@' && $x !== '#') if ($x !== '@' && $x !== '#') {
$rawtags = '#' . $rawtags; $rawtags = '#' . $rawtags;
}
$taginfo = array(); $taginfo = array();
$tags = get_tags($rawtags); $tags = get_tags($rawtags);
if (count($tags)) { if (count($tags)) {
foreach ($tags as $tag) { foreach ($tags as $tag) {
if (isset($profile)) if (isset($profile)) {
unset($profile); unset($profile);
if (strpos($tag,'@') === 0) { }
if (strpos($tag, '@') === 0) {
$name = substr($tag,1); $name = substr($tag,1);
if ((strpos($name,'@')) || (strpos($name,'http://'))) { if ((strpos($name, '@')) || (strpos($name, 'http://'))) {
$newname = $name; $newname = $name;
$links = @Probe::lrdd($name); $links = @Probe::lrdd($name);
if (count($links)) { if (count($links)) {
foreach ($links as $link) { foreach ($links as $link) {
if ($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') if ($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
$profile = $link['@attributes']['href']; $profile = $link['@attributes']['href'];
}
if ($link['@attributes']['rel'] === 'salmon') { if ($link['@attributes']['rel'] === 'salmon') {
$salmon = '$url:' . str_replace(',','%sc',$link['@attributes']['href']); $salmon = '$url:' . str_replace(',', '%sc', $link['@attributes']['href']);
if (strlen($inform)) if (strlen($inform)) {
$inform .= ','; $inform .= ',';
}
$inform .= $salmon; $inform .= $salmon;
} }
} }
} }
$taginfo[] = array($newname,$profile,$salmon); $taginfo[] = array($newname, $profile, $salmon);
} else { } else {
$newname = $name; $newname = $name;
$alias = ''; $alias = '';
$tagcid = 0; $tagcid = 0;
if (strrpos($newname,'+')) if (strrpos($newname, '+')) {
$tagcid = intval(substr($newname,strrpos($newname,'+') + 1)); $tagcid = intval(substr($newname, strrpos($newname, '+') + 1));
}
if ($tagcid) { if ($tagcid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -589,7 +604,7 @@ function photos_post(App $a) {
intval($page_owner_uid) intval($page_owner_uid)
); );
if (! $r) { if (! dbm::is_result($r)) {
//select someone by attag or nick and the name passed in //select someone by attag or nick and the name passed in
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name), dbesc($name),
@ -598,53 +613,46 @@ function photos_post(App $a) {
); );
} }
} }
/* elseif (strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval($page_owner_uid)
);
} else {
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($page_owner_uid)
);
}*/
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
$newname = $r[0]['name']; $newname = $r[0]['name'];
$profile = $r[0]['url']; $profile = $r[0]['url'];
$notify = 'cid:' . $r[0]['id']; $notify = 'cid:' . $r[0]['id'];
if (strlen($inform)) if (strlen($inform)) {
$inform .= ','; $inform .= ',';
}
$inform .= $notify; $inform .= $notify;
} }
} }
if ($profile) { if ($profile) {
if (substr($notify,0,4) === 'cid:') if (substr($notify, 0, 4) === 'cid:') {
$taginfo[] = array($newname,$profile,$notify,$r[0],'@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]'); $taginfo[] = array($newname, $profile, $notify, $r[0], '@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]');
else } else {
$taginfo[] = array($newname,$profile,$notify,null,$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'); $taginfo[] = array($newname, $profile, $notify, null, $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]');
if (strlen($str_tags)) }
if (strlen($str_tags)) {
$str_tags .= ','; $str_tags .= ',';
$profile = str_replace(',','%2c',$profile); }
$profile = str_replace(',', '%2c', $profile);
$str_tags .= '@[url='.$profile.']'.$newname.'[/url]'; $str_tags .= '@[url='.$profile.']'.$newname.'[/url]';
} }
} elseif (strpos($tag,'#') === 0) { } elseif (strpos($tag, '#') === 0) {
$tagname = substr($tag, 1); $tagname = substr($tag, 1);
$str_tags .= '#[url='.App::get_baseurl()."/search?tag=".$tagname.']'.$tagname.'[/url]'; $str_tags .= '#[url=' . App::get_baseurl() . "/search?tag=" . $tagname . ']' . $tagname . '[/url]';
} }
} }
} }
$newtag = $old_tag; $newtag = $old_tag;
if (strlen($newtag) && strlen($str_tags)) if (strlen($newtag) && strlen($str_tags)) {
$newtag .= ','; $newtag .= ',';
}
$newtag .= $str_tags; $newtag .= $str_tags;
$newinform = $old_inform; $newinform = $old_inform;
if (strlen($newinform) && strlen($inform)) if (strlen($newinform) && strlen($inform)) {
$newinform .= ','; $newinform .= ',';
}
$newinform .= $inform; $newinform .= $inform;
$r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d", $r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
@ -707,8 +715,9 @@ function photos_post(App $a) {
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>'; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"); $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
if ($tagged[3]) if ($tagged[3]) {
$arr['object'] .= xmlify('<link rel="photo" type="'.$p[0]['type'].'" href="' . $tagged[3]['photo'] . '" />' . "\n"); $arr['object'] .= xmlify('<link rel="photo" type="'.$p[0]['type'].'" href="' . $tagged[3]['photo'] . '" />' . "\n");
}
$arr['object'] .= '</link></object>' . "\n"; $arr['object'] .= '</link></object>' . "\n";
$arr['target'] = '<target><type>' . ACTIVITY_OBJ_IMAGE . '</type><title>' . $p[0]['desc'] . '</title><id>' $arr['target'] = '<target><type>' . ACTIVITY_OBJ_IMAGE . '</type><title>' . $p[0]['desc'] . '</title><id>'
@ -720,9 +729,7 @@ function photos_post(App $a) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id); proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
} }
} }
} }
} }
goaway($_SESSION['photo_return']); goaway($_SESSION['photo_return']);
return; // NOTREACHED return; // NOTREACHED
@ -745,38 +752,39 @@ function photos_post(App $a) {
logger('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG); logger('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG);
if (! strlen($album)) { if (! strlen($album)) {
if (strlen($newalbum)) if (strlen($newalbum)) {
$album = $newalbum; $album = $newalbum;
else } else {
$album = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); $album = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
} }
}
/** /*
*
* We create a wall item for every photo, but we don't want to * We create a wall item for every photo, but we don't want to
* overwhelm the data stream with a hundred newly uploaded photos. * overwhelm the data stream with a hundred newly uploaded photos.
* So we will make the first photo uploaded to this album in the last several hours * So we will make the first photo uploaded to this album in the last several hours
* visible by default, the rest will become visible over time when and if * visible by default, the rest will become visible over time when and if
* they acquire comments, likes, dislikes, and/or tags * they acquire comments, likes, dislikes, and/or tags
*
*/ */
$r = q("SELECT * FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `created` > UTC_TIMESTAMP() - INTERVAL 3 HOUR ", $r = q("SELECT * FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `created` > UTC_TIMESTAMP() - INTERVAL 3 HOUR ",
dbesc($album), dbesc($album),
intval($page_owner_uid) intval($page_owner_uid)
); );
if ((! dbm::is_result($r)) || ($album == t('Profile Photos'))) if ((! dbm::is_result($r)) || ($album == t('Profile Photos'))) {
$visible = 1; $visible = 1;
else } else {
$visible = 0; $visible = 0;
}
if (intval($_REQUEST['not_visible']) || $_REQUEST['not_visible'] === 'true') if (intval($_REQUEST['not_visible']) || $_REQUEST['not_visible'] === 'true') {
$visible = 0; $visible = 0;
}
$str_group_allow = perms2str(((is_array($_REQUEST['group_allow'])) ? $_REQUEST['group_allow'] : explode(',',$_REQUEST['group_allow']))); $str_group_allow = perms2str(((is_array($_REQUEST['group_allow'])) ? $_REQUEST['group_allow'] : explode(',', $_REQUEST['group_allow'])));
$str_contact_allow = perms2str(((is_array($_REQUEST['contact_allow'])) ? $_REQUEST['contact_allow'] : explode(',',$_REQUEST['contact_allow']))); $str_contact_allow = perms2str(((is_array($_REQUEST['contact_allow'])) ? $_REQUEST['contact_allow'] : explode(',', $_REQUEST['contact_allow'])));
$str_group_deny = perms2str(((is_array($_REQUEST['group_deny'])) ? $_REQUEST['group_deny'] : explode(',',$_REQUEST['group_deny']))); $str_group_deny = perms2str(((is_array($_REQUEST['group_deny'])) ? $_REQUEST['group_deny'] : explode(',', $_REQUEST['group_deny'])));
$str_contact_deny = perms2str(((is_array($_REQUEST['contact_deny'])) ? $_REQUEST['contact_deny'] : explode(',',$_REQUEST['contact_deny']))); $str_contact_deny = perms2str(((is_array($_REQUEST['contact_deny'])) ? $_REQUEST['contact_deny'] : explode(',', $_REQUEST['contact_deny'])));
$ret = array('src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''); $ret = array('src' => '', 'filename' => '', 'filesize' => 0, 'type' => '');
@ -793,7 +801,9 @@ function photos_post(App $a) {
$filesize = intval($_FILES['userfile']['size']); $filesize = intval($_FILES['userfile']['size']);
$type = $_FILES['userfile']['type']; $type = $_FILES['userfile']['type'];
} }
if ($type=="") $type=guess_image_type($filename); if ($type == "") {
$type = guess_image_type($filename);
}
logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG); logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
@ -820,10 +830,10 @@ function photos_post(App $a) {
$imagedata = @file_get_contents($src); $imagedata = @file_get_contents($src);
$limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit'); $limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
if ($limit) { if ($limit) {
$r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ", $r = q("SELECT SUM(OCTET_LENGTH(`data`)) AS `total` FROM `photo` WHERE `uid` = %d AND `scale` = 0 AND `album` != 'Contact Photos'",
intval($a->data['user']['uid']) intval($a->data['user']['uid'])
); );
$size = $r[0]['total']; $size = $r[0]['total'];
@ -851,11 +861,13 @@ function photos_post(App $a) {
$exif = $ph->orient($src); $exif = $ph->orient($src);
@unlink($src); @unlink($src);
$max_length = get_config('system','max_image_length'); $max_length = get_config('system', 'max_image_length');
if (! $max_length) if (! $max_length) {
$max_length = MAX_IMAGE_LENGTH; $max_length = MAX_IMAGE_LENGTH;
if ($max_length > 0) }
if ($max_length > 0) {
$ph->scaleImage($max_length); $ph->scaleImage($max_length);
}
$width = $ph->getWidth(); $width = $ph->getWidth();
$height = $ph->getHeight(); $height = $ph->getHeight();
@ -891,6 +903,7 @@ function photos_post(App $a) {
$lat = $lon = null; $lat = $lon = null;
/// @TODO merge these 2 if() into one?
if ($exif && $exif['GPS']) { if ($exif && $exif['GPS']) {
if (feature_enabled($channel_id,'photo_location')) { if (feature_enabled($channel_id,'photo_location')) {
$lat = getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']); $lat = getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']);
@ -900,8 +913,9 @@ function photos_post(App $a) {
$arr = array(); $arr = array();
if ($lat && $lon) if ($lat && $lon) {
$arr['coord'] = $lat . ' ' . $lon; $arr['coord'] = $lat . ' ' . $lon;
}
$arr['guid'] = get_guid(32); $arr['guid'] = get_guid(32);
$arr['uid'] = $page_owner_uid; $arr['uid'] = $page_owner_uid;
@ -934,20 +948,21 @@ function photos_post(App $a) {
// Update the photo albums cache // Update the photo albums cache
photo_albums($page_owner_uid, true); photo_albums($page_owner_uid, true);
if ($visible) if ($visible) {
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id); proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);
}
call_hooks('photo_post_end',intval($item_id)); call_hooks('photo_post_end',intval($item_id));
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook /*
// if they do not wish to be redirected * addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
* if they do not wish to be redirected
*/
goaway($_SESSION['photo_return']); goaway($_SESSION['photo_return']);
// NOTREACHED // NOTREACHED
} }
function photos_content(App $a) { function photos_content(App $a) {
// URLs: // URLs:
@ -960,12 +975,11 @@ function photos_content(App $a) {
// photos/name/image/xxxxx/edit // photos/name/image/xxxxx/edit
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if ((get_config('system', 'block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice( t('Public access denied.') . EOL);
return; return;
} }
require_once('include/bbcode.php'); require_once('include/bbcode.php');
require_once('include/security.php'); require_once('include/security.php');
require_once('include/conversation.php'); require_once('include/conversation.php');
@ -986,15 +1000,17 @@ function photos_content(App $a) {
if ($a->argc > 3) { if ($a->argc > 3) {
$datatype = $a->argv[2]; $datatype = $a->argv[2];
$datum = $a->argv[3]; $datum = $a->argv[3];
} elseif (($a->argc > 2) && ($a->argv[2] === 'upload')) } elseif (($a->argc > 2) && ($a->argv[2] === 'upload')) {
$datatype = 'upload'; $datatype = 'upload';
else } else {
$datatype = 'summary'; $datatype = 'summary';
}
if ($a->argc > 4) if ($a->argc > 4) {
$cmd = $a->argv[4]; $cmd = $a->argv[4];
else } else {
$cmd = 'view'; $cmd = 'view';
}
// //
// Setup permissions structures // Setup permissions structures
@ -1010,9 +1026,9 @@ function photos_content(App $a) {
$community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false); $community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
if ((local_user()) && (local_user() == $owner_uid)) if ((local_user()) && (local_user() == $owner_uid)) {
$can_post = true; $can_post = true;
else { } else {
if ($community_page && remote_user()) { if ($community_page && remote_user()) {
if (is_array($_SESSION['remote'])) { if (is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) { foreach ($_SESSION['remote'] as $v) {
@ -1063,6 +1079,7 @@ function photos_content(App $a) {
} }
} }
/// @TODO merge these 2 if() into one?
if (! $remote_contact) { if (! $remote_contact) {
if (local_user()) { if (local_user()) {
$contact_id = $_SESSION['cid']; $contact_id = $_SESSION['cid'];
@ -1081,7 +1098,7 @@ function photos_content(App $a) {
// tabs // tabs
$is_owner = (local_user() && (local_user() == $owner_uid)); $is_owner = (local_user() && (local_user() == $owner_uid));
$o .= profile_tabs($a,$is_owner, $a->data['user']['nickname']); $o .= profile_tabs($a, $is_owner, $a->data['user']['nickname']);
/** /**
* Display upload form * Display upload form
@ -1089,7 +1106,7 @@ function photos_content(App $a) {
if ($datatype === 'upload') { if ($datatype === 'upload') {
if (! ($can_post)) { if (! ($can_post)) {
notice( t('Permission denied.')); notice(t('Permission denied.'));
return; return;
} }
@ -1103,8 +1120,9 @@ function photos_content(App $a) {
$albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>'; $albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
if (count($a->data['albums'])) { if (count($a->data['albums'])) {
foreach ($a->data['albums'] as $album) { foreach ($a->data['albums'] as $album) {
if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) {
continue; continue;
}
$selected = (($selname === $album['album']) ? ' selected="selected" ' : ''); $selected = (($selname === $album['album']) ? ' selected="selected" ' : '');
$albumselect .= '<option value="' . $album['album'] . '"' . $selected . '>' . $album['album'] . '</option>'; $albumselect .= '<option value="' . $album['album'] . '"' . $selected . '>' . $album['album'] . '</option>';
} }
@ -1116,7 +1134,6 @@ function photos_content(App $a) {
'addon_text' => $uploader, 'addon_text' => $uploader,
'default_upload' => true); 'default_upload' => true);
call_hooks('photo_upload_form',$ret); call_hooks('photo_upload_form',$ret);
$default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), array()); $default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), array());
@ -1125,34 +1142,37 @@ function photos_content(App $a) {
)); ));
$usage_message = ''; $usage_message = '';
$limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit'); $limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
if ($limit !== false) { if ($limit !== false) {
$r = q("select sum(datasize) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ", $r = q("SELECT SUM(`datasize`) AS `total` FROM `photo` WHERE `uid` = %d AND `scale` = 0 AND `album` != 'Contact Photos'",
intval($a->data['user']['uid']) intval($a->data['user']['uid'])
); );
$usage_message = sprintf( t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 ); $usage_message = sprintf(t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 );
} }
// Private/public post links for the non-JS ACL form // Private/public post links for the non-JS ACL form
$private_post = 1; $private_post = 1;
if ($_REQUEST['public']) if ($_REQUEST['public']) {
$private_post = 0; $private_post = 0;
}
$query_str = $a->query_string; $query_str = $a->query_string;
if (strpos($query_str, 'public=1') !== false) if (strpos($query_str, 'public=1') !== false) {
$query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str); $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
}
// I think $a->query_string may never have ? in it, but I could be wrong /*
// It looks like it's from the index.php?q=[etc] rewrite that the web * I think $a->query_string may never have ? in it, but I could be wrong
// server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61 * It looks like it's from the index.php?q=[etc] rewrite that the web
if (strpos($query_str, '?') === false) * server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
*/
if (strpos($query_str, '?') === false) {
$public_post_link = '?public=1'; $public_post_link = '?public=1';
else } else {
$public_post_link = '&public=1'; $public_post_link = '&public=1';
}
$tpl = get_markup_template('photos_upload.tpl'); $tpl = get_markup_template('photos_upload.tpl');
@ -1213,10 +1233,12 @@ function photos_content(App $a) {
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
if ($_GET['order'] === 'posted') /// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
if ($_GET['order'] === 'posted') {
$order = 'ASC'; $order = 'ASC';
else } else {
$order = 'DESC'; $order = 'DESC';
}
$r = q("SELECT `resource-id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s' $r = q("SELECT `resource-id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` $order LIMIT %d , %d", AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` $order LIMIT %d , %d",
@ -1226,7 +1248,7 @@ function photos_content(App $a) {
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );
//edit album name // edit album name
if ($cmd === 'edit') { if ($cmd === 'edit') {
if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
if ($can_post) { if ($can_post) {
@ -1249,27 +1271,27 @@ function photos_content(App $a) {
} }
} }
} else { } else {
if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos')) && $can_post) {
if ($can_post) {
$edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit'); $edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
} }
} }
}
if ($_GET['order'] === 'posted') if ($_GET['order'] === 'posted') {
$order = array(t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)); $order = array(t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album));
else } else {
$order = array(t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted'); $order = array(t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted');
}
$photos = array(); $photos = array();
if (dbm::is_result($r)) if (dbm::is_result($r))
$twist = 'rotright'; $twist = 'rotright';
foreach ($r as $rr) { foreach ($r as $rr) {
if ($twist == 'rotright') if ($twist == 'rotright') {
$twist = 'rotleft'; $twist = 'rotleft';
else } else {
$twist = 'rotright'; $twist = 'rotright';
}
$ext = $phototypes[$rr['type']]; $ext = $phototypes[$rr['type']];
@ -1310,10 +1332,9 @@ function photos_content(App $a) {
} }
/** /*
* Display one photo * Display one photo
*/ */
if ($datatype === 'image') { if ($datatype === 'image') {
//$o = ''; //$o = '';
@ -1325,16 +1346,17 @@ function photos_content(App $a) {
dbesc($datum) dbesc($datum)
); );
if (! count($ph)) { if (! dbm::is_result($ph)) {
$ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' $ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'
LIMIT 1", LIMIT 1",
intval($owner_uid), intval($owner_uid),
dbesc($datum) dbesc($datum)
); );
if (count($ph)) if (dbm::is_result($ph)) {
notice( t('Permission denied. Access to this item may be restricted.')); notice(t('Permission denied. Access to this item may be restricted.'));
else } else {
notice( t('Photo not available') . EOL ); notice(t('Photo not available') . EOL );
}
return; return;
} }
@ -1356,15 +1378,17 @@ function photos_content(App $a) {
intval($owner_uid) intval($owner_uid)
); );
if (count($prvnxt)) { if (dbm::is_result($prvnxt)) {
for($z = 0; $z < count($prvnxt); $z++) { foreach ($prvnxt as $z => $entry) {
if ($prvnxt[$z]['resource-id'] == $ph[0]['resource-id']) { if ($entry['resource-id'] == $ph[0]['resource-id']) {
$prv = $z - 1; $prv = $z - 1;
$nxt = $z + 1; $nxt = $z + 1;
if ($prv < 0) if ($prv < 0) {
$prv = count($prvnxt) - 1; $prv = count($prvnxt) - 1;
if ($nxt >= count($prvnxt)) }
if ($nxt >= count($prvnxt)) {
$nxt = 0; $nxt = 0;
}
break; break;
} }
} }
@ -1387,8 +1411,8 @@ function photos_content(App $a) {
} }
$album_link = 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']); $album_link = 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']);
$tools = Null; $tools = null;
$lock = Null; $lock = null;
if ($can_post && ($ph[0]['uid'] == $owner_uid)) { if ($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = array( $tools = array(
@ -1426,8 +1450,9 @@ function photos_content(App $a) {
'filename' => $hires['filename'], 'filename' => $hires['filename'],
); );
if ($nextlink) if ($nextlink) {
$nextlink = array($nextlink, '<div class="icon next"></div>'); $nextlink = array($nextlink, '<div class="icon next"></div>');
}
// Do we have an item for this photo? // Do we have an item for this photo?
@ -1444,8 +1469,9 @@ function photos_content(App $a) {
$map = null; $map = null;
if (count($linked_items)) { if (dbm::is_result($linked_items)) {
$link_item = $linked_items[0]; $link_item = $linked_items[0];
$r = qu("SELECT COUNT(*) AS `total` $r = qu("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 and `item`.`moderated` = 0
@ -1458,8 +1484,9 @@ function photos_content(App $a) {
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
}
$r = qu("SELECT `item`.*, `item`.`id` AS `item_id`, $r = qu("SELECT `item`.*, `item`.`id` AS `item_id`,
@ -1493,15 +1520,16 @@ function photos_content(App $a) {
} }
} }
$tags=Null; $tags = null;
if (count($linked_items) && strlen($link_item['tag'])) { if (count($linked_items) && strlen($link_item['tag'])) {
$arr = explode(',',$link_item['tag']); $arr = explode(',', $link_item['tag']);
// parse tags and add links // parse tags and add links
$tag_str = ''; $tag_str = '';
foreach ($arr as $t) { foreach ($arr as $t) {
if (strlen($tag_str)) if (strlen($tag_str)) {
$tag_str .= ', '; $tag_str .= ', ';
}
$tag_str .= bbcode($t); $tag_str .= bbcode($t);
} }
$tags = array(t('Tags: '), $tag_str); $tags = array(t('Tags: '), $tag_str);
@ -1518,21 +1546,25 @@ function photos_content(App $a) {
// Private/public post links for the non-JS ACL form // Private/public post links for the non-JS ACL form
$private_post = 1; $private_post = 1;
if ($_REQUEST['public']) if ($_REQUEST['public']) {
$private_post = 0; $private_post = 0;
}
$query_str = $a->query_string; $query_str = $a->query_string;
if (strpos($query_str, 'public=1') !== false) if (strpos($query_str, 'public=1') !== false) {
$query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str); $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
}
// I think $a->query_string may never have ? in it, but I could be wrong /*
// It looks like it's from the index.php?q=[etc] rewrite that the web * I think $a->query_string may never have ? in it, but I could be wrong
// server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61 * It looks like it's from the index.php?q=[etc] rewrite that the web
if (strpos($query_str, '?') === false) * server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
*/
if (strpos($query_str, '?') === false) {
$public_post_link = '?public=1'; $public_post_link = '?public=1';
else } else {
$public_post_link = '&public=1'; $public_post_link = '&public=1';
}
if ($a->theme['template_engine'] === 'internal') { if ($a->theme['template_engine'] === 'internal') {
$album_e = template_escape($ph[0]['album']); $album_e = template_escape($ph[0]['album']);
@ -1584,8 +1616,8 @@ function photos_content(App $a) {
$likebuttons = ''; $likebuttons = '';
if ($can_post || can_write_wall($a,$owner_uid)) { if ($can_post || can_write_wall($a, $owner_uid)) {
$likebuttons = replace_macros($like_tpl,array( $likebuttons = replace_macros($like_tpl, array(
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$likethis' => t("I like this \x28toggle\x29"), '$likethis' => t("I like this \x28toggle\x29"),
'$nolike' => (feature_enabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''), '$nolike' => (feature_enabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''),
@ -1596,9 +1628,8 @@ function photos_content(App $a) {
$comments = ''; $comments = '';
if (! dbm::is_result($r)) { if (! dbm::is_result($r)) {
if ($can_post || can_write_wall($a,$owner_uid)) { if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
if ($link_item['last-child']) { $comments .= replace_macros($cmnt_tpl, array(
$comments .= replace_macros($cmnt_tpl,array(
'$return_path' => '', '$return_path' => '',
'$jsreload' => $return_url, '$jsreload' => $return_url,
'$type' => 'wall-comment', '$type' => 'wall-comment',
@ -1617,7 +1648,6 @@ function photos_content(App $a) {
)); ));
} }
} }
}
$alike = array(); $alike = array();
$dlike = array(); $dlike = array();
@ -1630,8 +1660,6 @@ function photos_content(App $a) {
'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title')) 'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
); );
// display comments // display comments
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
@ -1639,13 +1667,10 @@ function photos_content(App $a) {
builtin_activity_puller($item, $conv_responses); builtin_activity_puller($item, $conv_responses);
} }
$like = ((x($conv_responses['like'],$link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']],$conv_responses['like'][$link_item['uri'] . '-l'],'like',$link_item['id']) : ''); $like = ((x($conv_responses['like'], $link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']], $conv_responses['like'][$link_item['uri'] . '-l'], 'like',$link_item['id']) : '');
$dislike = ((x($conv_responses['dislike'],$link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']],$conv_responses['dislike'][$link_item['uri'] . '-l'],'dislike',$link_item['id']) : ''); $dislike = ((x($conv_responses['dislike'], $link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike',$link_item['id']) : '');
if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
if ($can_post || can_write_wall($a,$owner_uid)) {
if ($link_item['last-child']) {
$comments .= replace_macros($cmnt_tpl,array( $comments .= replace_macros($cmnt_tpl,array(
'$return_path' => '', '$return_path' => '',
'$jsreload' => $return_url, '$jsreload' => $return_url,
@ -1664,7 +1689,6 @@ function photos_content(App $a) {
'$rand_num' => random_digits(12) '$rand_num' => random_digits(12)
)); ));
} }
}
foreach ($r as $item) { foreach ($r as $item) {
@ -1675,7 +1699,7 @@ function photos_content(App $a) {
if (((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) if (((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
continue; continue;
$redirect_url = 'redir/' . $item['cid'] ; $redirect_url = 'redir/' . $item['cid'];
if (local_user() && ($item['contact-uid'] == local_user()) if (local_user() && ($item['contact-uid'] == local_user())
@ -1694,8 +1718,6 @@ function photos_content(App $a) {
$profile_link = $profile_url; $profile_link = $profile_url;
$dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == local_user())); $dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == local_user()));
$drop = array( $drop = array(
'dropping' => $dropping, 'dropping' => $dropping,
@ -1704,7 +1726,6 @@ function photos_content(App $a) {
'delete' => t('Delete'), 'delete' => t('Delete'),
); );
if ($a->theme['template_engine'] === 'internal') { if ($a->theme['template_engine'] === 'internal') {
$name_e = template_escape($profile_name); $name_e = template_escape($profile_name);
$title_e = template_escape($item['title']); $title_e = template_escape($item['title']);
@ -1729,10 +1750,8 @@ function photos_content(App $a) {
'$comment' => $comment '$comment' => $comment
)); ));
if ($can_post || can_write_wall($a,$owner_uid)) { if (($can_post || can_write_wall($a, $owner_uid)) && $item['last-child']) {
$comments .= replace_macros($cmnt_tpl, array(
if ($item['last-child']) {
$comments .= replace_macros($cmnt_tpl,array(
'$return_path' => '', '$return_path' => '',
'$jsreload' => $return_url, '$jsreload' => $return_url,
'$type' => 'wall-comment', '$type' => 'wall-comment',
@ -1752,16 +1771,16 @@ function photos_content(App $a) {
} }
} }
} }
}
$paginate = paginate($a); $paginate = paginate($a);
} }
$response_verbs = array('like'); $response_verbs = array('like');
if (feature_enabled($owner_uid,'dislike')) if (feature_enabled($owner_uid, 'dislike')) {
$response_verbs[] = 'dislike'; $response_verbs[] = 'dislike';
$responses = get_responses($conv_responses,$response_verbs,'',$link_item); }
$responses = get_responses($conv_responses,$response_verbs, '', $link_item);
$photo_tpl = get_markup_template('photo_view.tpl'); $photo_tpl = get_markup_template('photo_view.tpl');
@ -1771,7 +1790,7 @@ function photos_content(App $a) {
$like_e = template_escape($like); $like_e = template_escape($like);
$dislike_e = template_escape($dislike); $dislike_e = template_escape($dislike);
} else { } else {
$album_e = array($album_link,$ph[0]['album']); $album_e = array($album_link, $ph[0]['album']);
$tags_e = $tags; $tags_e = $tags;
$like_e = $like; $like_e = $like;
$dislike_e = $dislike; $dislike_e = $dislike;
@ -1798,11 +1817,11 @@ function photos_content(App $a) {
'$paginate' => $paginate, '$paginate' => $paginate,
)); ));
$a->page['htmlhead'] .= "\n".'<meta name="twitter:card" content="photo" />'."\n"; $a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="photo" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:title" content="'.$photo["album"].'" />'."\n"; $a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image" content="'.$photo["href"].'" />'."\n"; $a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="'.$photo["width"].'" />'."\n"; $a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image:height" content="'.$photo["height"].'" />'."\n"; $a->page['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n";
return $o; return $o;
} }

View File

@ -10,7 +10,7 @@ function profiles_init(App $a) {
return; return;
} }
if(($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) { if (($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1", $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
@ -34,24 +34,22 @@ function profiles_init(App $a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if($r) if (dbm::is_result($r)) {
info(t('Profile deleted.').EOL); info(t('Profile deleted.').EOL);
}
goaway('profiles'); goaway('profiles');
return; // NOTREACHED return; // NOTREACHED
} }
if (($a->argc > 1) && ($a->argv[1] === 'new')) {
if(($a->argc > 1) && ($a->argv[1] === 'new')) {
check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't'); check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user())); intval(local_user()));
$num_profiles = count($r0);
$num_profiles = (dbm::is_result($r0) ? count($r0) : 0);
$name = t('Profile-') . ($num_profiles + 1); $name = t('Profile-') . ($num_profiles + 1);
@ -73,19 +71,21 @@ function profiles_init(App $a) {
); );
info( t('New profile created.') . EOL); info( t('New profile created.') . EOL);
if(count($r3) == 1) if (dbm::is_result($r3) && count($r3) == 1) {
goaway('profiles/'.$r3[0]['id']); goaway('profiles/' . $r3[0]['id']);
}
goaway('profiles'); goaway('profiles');
} }
if(($a->argc > 2) && ($a->argv[1] === 'clone')) { if (($a->argc > 2) && ($a->argv[1] === 'clone')) {
check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't'); check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user())); intval(local_user()));
$num_profiles = count($r0);
$num_profiles = (dbm::is_result($r0) ? count($r0) : 0);
$name = t('Profile-') . ($num_profiles + 1); $name = t('Profile-') . ($num_profiles + 1);
$r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
@ -116,8 +116,9 @@ function profiles_init(App $a) {
dbesc($name) dbesc($name)
); );
info( t('New profile created.') . EOL); info( t('New profile created.') . EOL);
if ((dbm::is_result($r3)) && (count($r3) == 1)) if ((dbm::is_result($r3)) && (count($r3) == 1)) {
goaway('profiles/'.$r3[0]['id']); goaway('profiles/'.$r3[0]['id']);
}
goaway('profiles'); goaway('profiles');
@ -125,7 +126,7 @@ function profiles_init(App $a) {
} }
if(($a->argc > 1) && (intval($a->argv[1]))) { if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT id FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT id FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
@ -136,7 +137,7 @@ function profiles_init(App $a) {
return; return;
} }
profile_load($a,$a->user['nickname'],$r[0]['id']); profile_load($a,$a->user['nickname'], $r[0]['id']);
} }
@ -144,16 +145,17 @@ function profiles_init(App $a) {
} }
function profile_clean_keywords($keywords) { function profile_clean_keywords($keywords) {
$keywords = str_replace(","," ",$keywords); $keywords = str_replace(",", " ", $keywords);
$keywords = explode(" ", $keywords); $keywords = explode(" ", $keywords);
$cleaned = array(); $cleaned = array();
foreach ($keywords as $keyword) { foreach ($keywords as $keyword) {
$keyword = trim(strtolower($keyword)); $keyword = trim(strtolower($keyword));
$keyword = trim($keyword, "#"); $keyword = trim($keyword, "#");
if ($keyword != "") if ($keyword != "") {
$cleaned[] = $keyword; $cleaned[] = $keyword;
} }
}
$keywords = implode(", ", $cleaned); $keywords = implode(", ", $cleaned);
@ -171,12 +173,12 @@ function profiles_post(App $a) {
call_hooks('profile_post', $_POST); call_hooks('profile_post', $_POST);
if(($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) { if (($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) {
$orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! count($orig)) { if (! dbm::is_result($orig)) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
return; return;
} }
@ -186,38 +188,40 @@ function profiles_post(App $a) {
$is_default = (($orig[0]['is-default']) ? 1 : 0); $is_default = (($orig[0]['is-default']) ? 1 : 0);
$profile_name = notags(trim($_POST['profile_name'])); $profile_name = notags(trim($_POST['profile_name']));
if(! strlen($profile_name)) { if (! strlen($profile_name)) {
notice( t('Profile Name is required.') . EOL); notice( t('Profile Name is required.') . EOL);
return; return;
} }
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated? $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$y = substr($dob,0,4); $y = substr($dob, 0, 4);
if((! ctype_digit($y)) || ($y < 1900)) if ((! ctype_digit($y)) || ($y < 1900)) {
$ignore_year = true; $ignore_year = true;
else } else {
$ignore_year = false; $ignore_year = false;
if($dob != '0000-00-00') {
if(strpos($dob,'0000-') === 0) {
$ignore_year = true;
$dob = substr($dob,5);
} }
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d')); if ($dob != '0000-00-00') {
if($ignore_year) if (strpos($dob, '0000-') === 0) {
$ignore_year = true;
$dob = substr($dob, 5);
}
$dob = datetime_convert('UTC', 'UTC', (($ignore_year) ? '1900-' . $dob : $dob), (($ignore_year) ? 'm-d' : 'Y-m-d'));
if ($ignore_year) {
$dob = '0000-' . $dob; $dob = '0000-' . $dob;
} }
}
$name = notags(trim($_POST['name'])); $name = notags(trim($_POST['name']));
if(! strlen($name)) { if (! strlen($name)) {
$name = '[No Name]'; $name = '[No Name]';
} }
if($orig[0]['name'] != $name) if ($orig[0]['name'] != $name) {
$namechanged = true; $namechanged = true;
}
$pdesc = notags(trim($_POST['pdesc'])); $pdesc = notags(trim($_POST['pdesc']));
$gender = notags(trim($_POST['gender'])); $gender = notags(trim($_POST['gender']));
@ -233,54 +237,42 @@ function profiles_post(App $a) {
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : ''); $with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
if(! strlen($howlong)) { if (! strlen($howlong)) {
$howlong = NULL_DATE; $howlong = NULL_DATE;
} else { } else {
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong); $howlong = datetime_convert(date_default_timezone_get(), 'UTC', $howlong);
} }
// linkify the relationship target if applicable // linkify the relationship target if applicable
$withchanged = false; $withchanged = false;
if(strlen($with)) { if (strlen($with)) {
if($with != strip_tags($orig[0]['with'])) { if ($with != strip_tags($orig[0]['with'])) {
$withchanged = true; $withchanged = true;
$prf = ''; $prf = '';
$lookup = $with; $lookup = $with;
if(strpos($lookup,'@') === 0) if (strpos($lookup, '@') === 0) {
$lookup = substr($lookup,1); $lookup = substr($lookup, 1);
}
$lookup = str_replace('_',' ', $lookup); $lookup = str_replace('_',' ', $lookup);
if(strpos($lookup,'@') || (strpos($lookup,'http://'))) { if (strpos($lookup, '@') || (strpos($lookup, 'http://'))) {
$newname = $lookup; $newname = $lookup;
$links = @Probe::lrdd($lookup); $links = @Probe::lrdd($lookup);
if(count($links)) { if (count($links)) {
foreach($links as $link) { foreach ($links as $link) {
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') { if ($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
$prf = $link['@attributes']['href']; $prf = $link['@attributes']['href'];
} }
} }
} }
} } else {
else {
$newname = $lookup; $newname = $lookup;
/* if(strstr($lookup,' ')) {
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval(local_user())
);
}
else {
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
dbesc($lookup),
intval(local_user())
);
}*/
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname), dbesc($newname),
intval(local_user()) intval(local_user())
); );
if(! $r) { if (! dbm::is_result($r)) {
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
dbesc($lookup), dbesc($lookup),
intval(local_user()) intval(local_user())
@ -292,16 +284,18 @@ function profiles_post(App $a) {
} }
} }
if($prf) { if ($prf) {
$with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with); $with = str_replace($lookup, '<a href="' . $prf . '">' . $newname . '</a>', $with);
if(strpos($with,'@') === 0) if (strpos($with, '@') === 0) {
$with = substr($with,1); $with = substr($with, 1);
} }
} }
else } else {
$with = $orig[0]['with']; $with = $orig[0]['with'];
} }
}
/// @TODO Not flexible enough for later expansion, let's have more OOP here
$sexual = notags(trim($_POST['sexual'])); $sexual = notags(trim($_POST['sexual']));
$xmpp = notags(trim($_POST['xmpp'])); $xmpp = notags(trim($_POST['xmpp']));
$homepage = notags(trim($_POST['homepage'])); $homepage = notags(trim($_POST['homepage']));
@ -329,65 +323,65 @@ function profiles_post(App $a) {
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
set_pconfig(local_user(),'system','detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0)); set_pconfig(local_user(), 'system', 'detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0));
$changes = array(); $changes = array();
$value = ''; $value = '';
if($is_default) { if ($is_default) {
if($marital != $orig[0]['marital']) { if ($marital != $orig[0]['marital']) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Marital Status'); $changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Marital Status');
$value = $marital; $value = $marital;
} }
if($withchanged) { if ($withchanged) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Romantic Partner'); $changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Romantic Partner');
$value = strip_tags($with); $value = strip_tags($with);
} }
if($likes != $orig[0]['likes']) { if ($likes != $orig[0]['likes']) {
$changes[] = t('Likes'); $changes[] = t('Likes');
$value = $likes; $value = $likes;
} }
if($dislikes != $orig[0]['dislikes']) { if ($dislikes != $orig[0]['dislikes']) {
$changes[] = t('Dislikes'); $changes[] = t('Dislikes');
$value = $dislikes; $value = $dislikes;
} }
if($work != $orig[0]['work']) { if ($work != $orig[0]['work']) {
$changes[] = t('Work/Employment'); $changes[] = t('Work/Employment');
} }
if($religion != $orig[0]['religion']) { if ($religion != $orig[0]['religion']) {
$changes[] = t('Religion'); $changes[] = t('Religion');
$value = $religion; $value = $religion;
} }
if($politic != $orig[0]['politic']) { if ($politic != $orig[0]['politic']) {
$changes[] = t('Political Views'); $changes[] = t('Political Views');
$value = $politic; $value = $politic;
} }
if($gender != $orig[0]['gender']) { if ($gender != $orig[0]['gender']) {
$changes[] = t('Gender'); $changes[] = t('Gender');
$value = $gender; $value = $gender;
} }
if($sexual != $orig[0]['sexual']) { if ($sexual != $orig[0]['sexual']) {
$changes[] = t('Sexual Preference'); $changes[] = t('Sexual Preference');
$value = $sexual; $value = $sexual;
} }
if($xmpp != $orig[0]['xmpp']) { if ($xmpp != $orig[0]['xmpp']) {
$changes[] = t('XMPP'); $changes[] = t('XMPP');
$value = $xmpp; $value = $xmpp;
} }
if($homepage != $orig[0]['homepage']) { if ($homepage != $orig[0]['homepage']) {
$changes[] = t('Homepage'); $changes[] = t('Homepage');
$value = $homepage; $value = $homepage;
} }
if($interest != $orig[0]['interest']) { if ($interest != $orig[0]['interest']) {
$changes[] = t('Interests'); $changes[] = t('Interests');
$value = $interest; $value = $interest;
} }
if($address != $orig[0]['address']) { if ($address != $orig[0]['address']) {
$changes[] = t('Address'); $changes[] = t('Address');
// New address not sent in notifications, potential privacy issues // New address not sent in notifications, potential privacy issues
// in case this leaks to unintended recipients. Yes, it's in the public // in case this leaks to unintended recipients. Yes, it's in the public
// profile but that doesn't mean we have to broadcast it to everybody. // profile but that doesn't mean we have to broadcast it to everybody.
} }
if($locality != $orig[0]['locality'] || $region != $orig[0]['region'] if ($locality != $orig[0]['locality'] || $region != $orig[0]['region']
|| $country_name != $orig[0]['country-name']) { || $country_name != $orig[0]['country-name']) {
$changes[] = t('Location'); $changes[] = t('Location');
$comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' '); $comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' ');
@ -473,11 +467,12 @@ function profiles_post(App $a) {
intval(local_user()) intval(local_user())
); );
if($r) if ($r) {
info( t('Profile updated.') . EOL); info(t('Profile updated.') . EOL);
}
if($namechanged && $is_default) { if ($namechanged && $is_default) {
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d", $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc($name), dbesc($name),
dbesc(datetime_convert()), dbesc(datetime_convert()),
@ -489,7 +484,7 @@ function profiles_post(App $a) {
); );
} }
if($is_default) { if ($is_default) {
$location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name)); $location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d", q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
@ -502,7 +497,7 @@ function profiles_post(App $a) {
// Update global directory in background // Update global directory in background
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if ($url && strlen(get_config('system','directory'))) { if ($url && strlen(get_config('system', 'directory'))) {
proc_run(PRIORITY_LOW, "include/directory.php", $url); proc_run(PRIORITY_LOW, "include/directory.php", $url);
} }
@ -519,14 +514,17 @@ function profiles_post(App $a) {
function profile_activity($changed, $value) { function profile_activity($changed, $value) {
$a = get_app(); $a = get_app();
if(! local_user() || ! is_array($changed) || ! count($changed)) if (! local_user() || ! is_array($changed) || ! count($changed)) {
return; return;
}
if($a->user['hidewall'] || get_config('system','block_public')) if ($a->user['hidewall'] || get_config('system', 'block_public')) {
return; return;
}
if(! get_pconfig(local_user(),'system','post_profilechange')) if (! get_pconfig(local_user(), 'system', 'post_profilechange')) {
return; return;
}
require_once('include/items.php'); require_once('include/items.php');
@ -534,8 +532,9 @@ function profile_activity($changed, $value) {
intval(local_user()) intval(local_user())
); );
if(! count($self)) if (! dbm::is_result($self)) {
return; return;
}
$arr = array(); $arr = array();
@ -559,25 +558,26 @@ function profile_activity($changed, $value) {
$changes = ''; $changes = '';
$t = count($changed); $t = count($changed);
$z = 0; $z = 0;
foreach($changed as $ch) { foreach ($changed as $ch) {
if(strlen($changes)) { if (strlen($changes)) {
if ($z == ($t - 1)) if ($z == ($t - 1)) {
$changes .= t(' and '); $changes .= t(' and ');
else } else {
$changes .= ', '; $changes .= ', ';
} }
}
$z ++; $z ++;
$changes .= $ch; $changes .= $ch;
} }
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]'; $prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
if($t == 1 && strlen($value)) { if ($t == 1 && strlen($value)) {
$message = sprintf( t('%1$s changed %2$s to &ldquo;%3$s&rdquo;'), $A, $changes, $value); $message = sprintf( t('%1$s changed %2$s to &ldquo;%3$s&rdquo;'), $A, $changes, $value);
$message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof); $message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof);
} } else {
else
$message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes); $message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
}
$arr['body'] = $message; $arr['body'] = $message;
@ -610,7 +610,7 @@ function profiles_content(App $a) {
$o = ''; $o = '';
if(($a->argc > 1) && (intval($a->argv[1]))) { if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
@ -649,15 +649,16 @@ function profiles_content(App $a) {
$personal_account = !(in_array($a->user["page-flags"], $personal_account = !(in_array($a->user["page-flags"],
array(PAGE_COMMUNITY, PAGE_PRVGROUP))); array(PAGE_COMMUNITY, PAGE_PRVGROUP)));
$detailled_profile = (get_pconfig(local_user(),'system','detailled_profile') AND $personal_account); $detailled_profile = (get_pconfig(local_user(), 'system', 'detailled_profile') AND $personal_account);
$f = get_config('system','birthday_input_format'); $f = get_config('system', 'birthday_input_format');
if(! $f) if (! $f) {
$f = 'ymd'; $f = 'ymd';
}
$is_default = (($r[0]['is-default']) ? 1 : 0); $is_default = (($r[0]['is-default']) ? 1 : 0);
$tpl = get_markup_template("profile_edit.tpl"); $tpl = get_markup_template("profile_edit.tpl");
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl, array(
'$personal_account' => $personal_account, '$personal_account' => $personal_account,
'$detailled_profile' => $detailled_profile, '$detailled_profile' => $detailled_profile,
@ -666,13 +667,13 @@ function profiles_content(App $a) {
t('Show more profile fields:'), //Label t('Show more profile fields:'), //Label
$detailled_profile, //Value $detailled_profile, //Value
'', //Help string '', //Help string
array(t('No'),t('Yes')) //Off - On strings array(t('No'), t('Yes')) //Off - On strings
), ),
'$multi_profiles' => feature_enabled(local_user(),'multi_profiles'), '$multi_profiles' => feature_enabled(local_user(), 'multi_profiles'),
'$form_security_token' => get_form_security_token("profile_edit"), '$form_security_token' => get_form_security_token("profile_edit"),
'$form_security_token_photo' => get_form_security_token("profile_photo"), '$form_security_token_photo' => get_form_security_token("profile_photo"),
'$profile_clone_link' => ((feature_enabled(local_user(),'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""), '$profile_clone_link' => ((feature_enabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
'$profile_action' => t('Profile Actions'), '$profile_action' => t('Profile Actions'),
@ -748,25 +749,22 @@ function profiles_content(App $a) {
call_hooks('profile_edit', $arr); call_hooks('profile_edit', $arr);
return $o; return $o;
} } else {
//Profiles list. // If we don't support multi profiles, don't display this list.
else { if (!feature_enabled(local_user(), 'multi_profiles')) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
//If we don't support multi profiles, don't display this list.
if(!feature_enabled(local_user(),'multi_profiles')){
$r = q(
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user() local_user()
); );
if (dbm::is_result($r)){ if (dbm::is_result($r)) {
//Go to the default profile. //Go to the default profile.
goaway('profiles/'.$r[0]['id']); goaway('profiles/' . $r[0]['id']);
} }
} }
$r = q("SELECT * FROM `profile` WHERE `uid` = %d", $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user()); local_user());
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
$tpl = get_markup_template('profile_entry.tpl'); $tpl = get_markup_template('profile_entry.tpl');

View File

@ -15,7 +15,8 @@
*/ */
if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) if (($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) {
echo $_SERVER["argv"][1]; echo $_SERVER["argv"][1];
else } else {
echo ''; echo '';
}

View File

@ -148,7 +148,7 @@ function update_1014() {
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$ph = new Photo($rr['data']); $ph = new Photo($rr['data']);
if($ph->is_valid()) { if ($ph->is_valid()) {
$ph->scaleImage(48); $ph->scaleImage(48);
$ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0)); $ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
} }
@ -308,9 +308,9 @@ function update_1030() {
function update_1031() { function update_1031() {
// Repair any bad links that slipped into the item table // Repair any bad links that slipped into the item table
$r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' "); $r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' ");
if($r && dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
if(strstr($rr['object'],'type=&quot;http')) { if (strstr($rr['object'],'type=&quot;http')) {
q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d", q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d",
dbesc(str_replace('type=&quot;http','href=&quot;http',$rr['object'])), dbesc(str_replace('type=&quot;http','href=&quot;http',$rr['object'])),
intval($rr['id']) intval($rr['id'])
@ -329,19 +329,20 @@ function update_1033() {
`k` CHAR( 255 ) NOT NULL PRIMARY KEY , `k` CHAR( 255 ) NOT NULL PRIMARY KEY ,
`v` TEXT NOT NULL, `v` TEXT NOT NULL,
`updated` DATETIME NOT NULL `updated` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8 "); ) DEFAULT CHARSET=utf8 ");
} }
function update_1034() { function update_1034() {
// If you have any of these parent-less posts they can cause problems, and /*
// we need to delete them. You can't see them anyway. * If you have any of these parent-less posts they can cause problems, and
// Legitimate items will usually get re-created on the next * we need to delete them. You can't see them anyway.
// pull from the hub. * Legitimate items will usually get re-created on the next
// But don't get rid of a post that may have just come in * pull from the hub.
// and may not yet have the parent id set. * But don't get rid of a post that may have just come in
* and may not yet have the parent id set.
*/
q("DELETE FROM `item` WHERE `parent` = 0 AND `created` < UTC_TIMESTAMP() - INTERVAL 2 MINUTE"); q("DELETE FROM `item` WHERE `parent` = 0 AND `created` < UTC_TIMESTAMP() - INTERVAL 2 MINUTE");
} }
@ -1671,7 +1672,7 @@ function update_1190() {
$plugins = get_config('system','addon'); $plugins = get_config('system','addon');
$plugins_arr = array(); $plugins_arr = array();
if($plugins) { if ($plugins) {
$plugins_arr = explode(",",str_replace(" ", "",$plugins)); $plugins_arr = explode(",",str_replace(" ", "",$plugins));
$idx = array_search($plugin, $plugins_arr); $idx = array_search($plugin, $plugins_arr);

View File

@ -12,117 +12,140 @@ function po2php_run(&$argv, &$argc) {
$pofile = $argv[1]; $pofile = $argv[1];
$outfile = dirname($pofile)."/strings.php"; $outfile = dirname($pofile)."/strings.php";
if(strstr($outfile,'util')) if (strstr($outfile, 'util')) {
$lang = 'en'; $lang = 'en';
else } else {
$lang = str_replace('-','_',basename(dirname($pofile))); $lang = str_replace('-','_',basename(dirname($pofile)));
}
if (!file_exists($pofile)) {
if (!file_exists($pofile)){
print "Unable to find '$pofile'\n"; print "Unable to find '$pofile'\n";
return; return;
} }
print "Out to '$outfile'\n"; print "Out to '$outfile'\n";
$out="<?php\n\n"; $out = "<?php\n\n";
$infile = file($pofile); $infile = file($pofile);
$k=""; $k = "";
$v=""; $v = "";
$arr = False; $arr = false;
$ink = False; $ink = false;
$inv = False; $inv = false;
$escape_s_exp = '|[^\\\\]\$[a-z]|'; $escape_s_exp = '|[^\\\\]\$[a-z]|';
function escape_s($match){ function escape_s($match) {
return str_replace('$','\$',$match[0]); return str_replace('$','\$',$match[0]);
} }
foreach ($infile as $l) { foreach ($infile as $l) {
$l = str_replace('\"', DQ_ESCAPE, $l); $l = str_replace('\"', DQ_ESCAPE, $l);
$len = strlen($l); $len = strlen($l);
if ($l[0]=="#") $l=""; if ($l[0] == "#") {
if (substr($l,0,15)=='"Plural-Forms: '){ $l = "";
$match=Array(); }
if (substr($l, 0, 15) == '"Plural-Forms: ') {
$match = array();
preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match); preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match);
$cond = str_replace('n','$n',$match[2]); $cond = str_replace('n', '$n', $match[2]);
// define plural select function if not already defined // define plural select function if not already defined
$fnname = 'string_plural_select_' . $lang; $fnname = 'string_plural_select_' . $lang;
$out .= 'if(! function_exists("'.$fnname.'")) {'."\n"; $out .= 'if(! function_exists("' . $fnname . '")) {' . "\n";
$out .= 'function '. $fnname . '($n){'."\n"; $out .= 'function '. $fnname . '($n){' . "\n";
$out .= ' return '.$cond.';'."\n"; $out .= ' return ' . $cond . ';' . "\n";
$out .= '}}'."\n"; $out .= '}}' . "\n";
} }
if ($k != "" && substr($l, 0, 7) == "msgstr ") {
if ($ink) {
$ink = false;
$out .= '$a->strings["' . $k . '"] = ';
}
if ($inv) {
$inv = false;
$out .= '"' . $v . '"';
}
$v = substr($l, 8, $len - 10);
$v = preg_replace_callback($escape_s_exp, 'escape_s', $v);
if ($k!="" && substr($l,0,7)=="msgstr "){ $inv = true;
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
$v = substr($l,8,$len-10);
$v = preg_replace_callback($escape_s_exp,'escape_s',$v);
$inv = True;
//$out .= $v; //$out .= $v;
} }
if ($k!="" && substr($l,0,7)=="msgstr["){ if ($k != "" && substr($l, 0, 7) == "msgstr[") {
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; } if ($ink) {
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } $ink = false;
$out .= '$a->strings["' . $k . '"] = ';
}
if ($inv) {
$inv = false;
$out .= '"' . $v . '"';
}
if (!$arr) { if (!$arr) {
$arr=True; $arr=True;
$out .= "array(\n"; $out .= "array(\n";
} }
$match=Array(); $match = array();
preg_match("|\[([0-9]*)\] (.*)|", $l, $match); preg_match("|\[([0-9]*)\] (.*)|", $l, $match);
$out .= "\t". $out .= "\t"
preg_replace_callback($escape_s_exp,'escape_s',$match[1]) . preg_replace_callback($escape_s_exp, 'escape_s', $match[1])
." => " . " => "
.preg_replace_callback($escape_s_exp,'escape_s',$match[2]) .",\n"; . preg_replace_callback($escape_s_exp, 'escape_s', $match[2])
. ",\n";
} }
if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }; if (substr($l, 0, 6) == "msgid_") {
$ink = false;
$out .= '$a->strings["' . $k . '"] = ';
}
if ($ink) { if ($ink) {
$k .= trim($l,"\"\r\n"); $k .= trim($l, "\"\r\n");
$k = preg_replace_callback($escape_s_exp,'escape_s',$k); $k = preg_replace_callback($escape_s_exp, 'escape_s', $k);
//$out .= '$a->strings['.$k.'] = '; //$out .= '$a->strings['.$k.'] = ';
} }
if (substr($l,0,6)=="msgid "){ if (substr($l, 0, 6) == "msgid ") {
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } if ($inv) {
if ($k!="") $out .= $arr?");\n":";\n"; $inv = false;
$arr=False; $out .= '"' . $v . '"';
$k = str_replace("msgid ","",$l); }
if ($k != '""' ) { if ($k != "") {
$k = trim($k,"\"\r\n"); $out .= ($arr) ? ");\n" : ";\n";
}
$arr = false;
$k = str_replace("msgid ", "", $l);
if ($k != '""') {
$k = trim($k, "\"\r\n");
} else { } else {
$k = ""; $k = "";
} }
$k = preg_replace_callback($escape_s_exp,'escape_s',$k); $k = preg_replace_callback($escape_s_exp, 'escape_s', $k);
$ink = True; $ink = true;
} }
if ($inv && substr($l,0,6)!="msgstr") { if ($inv && substr($l, 0, 6) != "msgstr") {
$v .= trim($l,"\"\r\n"); $v .= trim($l, "\"\r\n");
$v = preg_replace_callback($escape_s_exp,'escape_s',$v); $v = preg_replace_callback($escape_s_exp, 'escape_s', $v);
//$out .= '$a->strings['.$k.'] = '; //$out .= '$a->strings['.$k.'] = ';
} }
} }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } if ($inv) {
if ($k!="") $out .= $arr?");\n":";\n"; $inv = false;
$out .= '"' . $v . '"';
}
if ($k != "") {
$out .= ($arr ? ");\n" : ";\n");
}
$out = str_replace(DQ_ESCAPE, '\"', $out); $out = str_replace(DQ_ESCAPE, '\"', $out);
file_put_contents($outfile, $out); file_put_contents($outfile, $out);
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__FILE__, get_included_files()) === 0) {
po2php_run($_SERVER["argv"],$_SERVER["argc"]); po2php_run($_SERVER["argv"],$_SERVER["argc"]);
} }

View File

@ -273,19 +273,19 @@ img.acpopup-img {
/* plain text editor upload/select popup */ /* plain text editor upload/select popup */
.fbrowser .path a { padding: 5px; } .fbrowser .path a, .fbrowser .path .btn-link { padding: 5px; }
.fbrowser .path a:before { content: "/"; padding-right: 5px;} .fbrowser .path a:before, .fbrowser .path .btn-link:before { content: "/"; padding-right: 5px;}
.fbrowser .folders ul { list-style-type: none; padding-left: 10px;} .fbrowser .folders ul { list-style-type: none; padding-left: 10px;}
.fbrowser .list { height: auto; overflow-y: hidden; margin: 10px 0px; } .fbrowser .list { height: auto; overflow-y: hidden; margin: 10px 0px; }
.fbrowser.image .photo-album-image-wrapper { float: left; } .fbrowser.image .photo-album-image-wrapper { float: left; }
.fbrowser.image a img { height: 48px; } .fbrowser.image a img, .fbrowser.image .btn-link img { height: 48px; }
.fbrowser.image a p { display: none;} .fbrowser.image a p, .fbrowser.image .btn-link p { display: none;}
.fbrowser.file .photo-album-image-wrapper { float:none; white-space: nowrap; } .fbrowser.file .photo-album-image-wrapper { float:none; white-space: nowrap; }
.fbrowser.file img { display: inline; } .fbrowser.file img { display: inline; }
.fbrowser.file p { display: inline; white-space: nowrap; } .fbrowser.file p { display: inline; white-space: nowrap; }
.fbrowser .upload { clear: both; padding-top: 1em;} .fbrowser .upload { clear: both; padding-top: 1em;}
.fbrowser .error { background: #ffeeee; border: 1px solid #994444; color: #994444; padding: 0.5em;} .fbrowser .error { background: #ffeeee; border: 1px solid #994444; color: #994444; padding: 0.5em;}
.fbrowser .error a.close { float: right; font-weight: bold; } .fbrowser .error .close { float: right; font-weight: bold; }
.fbrowser .error.hidden { display: none; } .fbrowser .error.hidden { display: none; }
a { a {

View File

@ -25,7 +25,7 @@
#event-calendar-title { #event-calendar-title {
vertical-align: middle; vertical-align: middle;
} }
a#event-calendar-views { #event-calendar-views {
padding: 6px 9px; padding: 6px 9px;
font-size: 14px font-size: 14px
} }

View File

@ -51,10 +51,14 @@ body a[name]:not([href]) {
visibility: hidden; visibility: hidden;
} }
body a:hover, body a:focus, body a:active, body a.active, body .btn-link:hover{ body a:hover, .btn-link:hover,
body a:focus, .btn-link:focus,
body a:active, .btn-link:active,
body a.active, .btn-link.active {
/*color: #59d6e4;*/ /*color: #59d6e4;*/
color: $link_hover_color; color: $link_hover_color;
text-decoration: none; text-decoration: none;
outline: none;
} }
.wall-item-container a:hover { .wall-item-container a:hover {
@ -186,6 +190,12 @@ a#item-delete-selected {
outline: 0; outline: 0;
background: $btn_primary_hover_color !important; background: $btn_primary_hover_color !important;
} }
.btn-default:active, .btn-default.active {
color: $link_color;
}
.btn-default:active:hover, .btn-default.active:hover {
color: $link_hover_color;
}
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover,
.btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover,
.open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus, .open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus,
@ -196,10 +206,13 @@ a#item-delete-selected {
} }
.btn-link { .btn-link {
border: 0;
color: $link_color; color: $link_color;
padding-left: 0;
padding-right: 0;
} }
.btn-link:focus, .btn-link:hover { .btn {
color: #23527c; color: inherit;
} }
.btn-eventnav, btn-eventnav:hover { .btn-eventnav, btn-eventnav:hover {
font-size: 16px; font-size: 16px;
@ -395,7 +408,8 @@ header #banner #logo-img,
top: 2px; top: 2px;
right: 10px right: 10px
} }
.topbar .dropdown-header .dropdown-header-link a { .topbar .dropdown-header .dropdown-header-link a,
.topbar .dropdown-header .dropdown-header-link .btn-link {
/*color: #6fdbe8!important;*/ /*color: #6fdbe8!important;*/
color: $link_color !important; color: $link_color !important;
font-size: 12px; font-size: 12px;
@ -548,9 +562,8 @@ nav.navbar .nav>li>a:focus{
#topbar-first .dropdown-footer { #topbar-first .dropdown-footer {
margin: 10px 10px 5px margin: 10px 10px 5px
} }
#topbar-first a, #topbar-first a, #topbar-first .btn-link,
nav.navbar a { nav.navbar a, nav.navbar .btn-link {
/*color: #fff*/
color: $nav_icon_color; color: $nav_icon_color;
} }
#topbar-first .caret { #topbar-first .caret {
@ -644,10 +657,12 @@ nav.navbar a {
#myNavmenu li.nav-sitename { #myNavmenu li.nav-sitename {
font-weight: bold; font-weight: bold;
} }
#topbar-first .dropdown.account>a, #topbar-first .dropdown.account > a,
#topbar-first .dropdown.account.open>a, #topbar-first .dropdown.account.open > a,
#topbar-first .dropdown.account>a:hover, #topbar-first .dropdown.account > button,
#topbar-first .dropdown.account.open>a:hover { #topbar-first .dropdown.account.open > button,
#topbar-first .dropdown.account > :hover,
#topbar-first .dropdown.account.open > :hover {
background-color: $nav_bg; background-color: $nav_bg;
} }
#topbar-first .dropdown.account li#nav-sitename { #topbar-first .dropdown.account li#nav-sitename {
@ -815,6 +830,25 @@ nav.navbar a {
} }
/* Dropdown Menus */ /* Dropdown Menus */
.nav > li > .btn-link {
position: relative;
display: block;
padding: 10px 15px;
}
.nav > li > .btn-link:focus,
.nav > li > .btn-link:hover {
text-decoration: none;
background-color: #eee;
}
.nav .open > .btn-link,
.nav .open > .btn-link:focus,
.nav .open > .btn-link:hover {
background-color: #eee;
border-color: #337ab7;
}
.nav-pills > li > .btn-link {
border-radius: 4px;
}
.nav-pills .dropdown-menu, .nav-pills .dropdown-menu,
.nav-tabs .dropdown-menu, .nav-tabs .dropdown-menu,
.account .dropdown-menu, .account .dropdown-menu,
@ -836,41 +870,43 @@ nav.navbar a {
.contact-photo-wrapper .dropdown-menu li { .contact-photo-wrapper .dropdown-menu li {
border-left: 3px solid $nav_bg; border-left: 3px solid $nav_bg;
} }
.nav-pills .dropdown-menu li a, .nav-pills .dropdown-menu li a, .nav-pills .dropdown-menu li .btn-link,
.nav-tabs .dropdown-menu li a, .nav-tabs .dropdown-menu li a, .nav-tabs .dropdown-menu li .btn-link,
.account .dropdown-menu li a, .account .dropdown-menu li a, .account .dropdown-menu li .btn-link,
.contact-photo-wrapper .dropdown-menu li a { .contact-photo-wrapper .dropdown-menu li a, .contact-photo-wrapper .dropdown-menu li .btn-link {
color: $nav_icon_color; color: $nav_icon_color;
font-weight: 400; font-weight: 400;
font-size: 13px; font-size: 13px;
padding: 4px 15px; padding: 4px 15px;
text-transform: capitalize; text-transform: capitalize;
width: 100%;
text-align: left;
} }
.nav-pills .dropdown-menu li a i, .nav-pills .dropdown-menu li a i, .nav-pills .dropdown-menu li .btn-link i,
.nav-tabs .dropdown-menu li a i, .nav-tabs .dropdown-menu li a i, .nav-tabs .dropdown-menu li .btn-link i,
.account .dropdown-menu li a i, .account .dropdown-menu li a i, .account .dropdown-menu li .btn-link i,
.contact-photo-wrapper .dropdown-menu li a i { .contact-photo-wrapper .dropdown-menu li a i, .contact-photo-wrapper .dropdown-menu li .btn-link i {
margin-right: 5px; margin-right: 5px;
font-size: 14px; font-size: 14px;
display: inline-block; display: inline-block;
width: 14px width: 14px
} }
.nav-pills .dropdown-menu li a:hover, .nav-pills .dropdown-menu li a:hover, .nav-pills .dropdown-menu li .btn-link:hover,
.nav-tabs .dropdown-menu li a:hover, .nav-tabs .dropdown-menu li a:hover, .nav-tabs .dropdown-menu li .btn-link:hover,
.account .dropdown-menu li a:hover, .account .dropdown-menu li a:hover, .account .dropdown-menu li .btn-link:hover,
.contact-photo-wrapper .dropdown-menu li a:hover, .contact-photo-wrapper .dropdown-menu li a:hover, .contact-photo-wrapper .dropdown-menu li .btn-link:hover,
.nav-pills .dropdown-menu li a:visited, .nav-pills .dropdown-menu li a:visited, .nav-pills .dropdown-menu li .btn-link:visited,
.nav-tabs .dropdown-menu li a:visited, .nav-tabs .dropdown-menu li a:visited, .nav-tabs .dropdown-menu li .btn-link:visited,
.account .dropdown-menu li a:visited, .account .dropdown-menu li a:visited, .account .dropdown-menu li .btn-link:visited,
.contact-photo-wrapper .dropdown-menu li a:visited, .contact-photo-wrapper .dropdown-menu li a:visited, .contact-photo-wrapper .dropdown-menu li .btn-link:visited,
.nav-pills .dropdown-menu li a:hover, .nav-pills .dropdown-menu li a:hover, .nav-pills .dropdown-menu li .btn-link:hover,
.nav-tabs .dropdown-menu li a:hover, .nav-tabs .dropdown-menu li a:hover, .nav-tabs .dropdown-menu li .btn-link:hover,
.account .dropdown-menu li a:hover, .account .dropdown-menu li a:hover, .account .dropdown-menu li .btn-link:hover,
.contact-photo-wrapper .dropdown-menu li a:hover, .contact-photo-wrapper .dropdown-menu li a:hover, .contact-photo-wrapper .dropdown-menu li .btn-link:hover,
.nav-pills .dropdown-menu li a:focus, .nav-pills .dropdown-menu li a:focus, .nav-pills .dropdown-menu li .btn-link:focus,
.nav-tabs .dropdown-menu li a:focus, .nav-tabs .dropdown-menu li a:focus, .nav-tabs .dropdown-menu li .btn-link:focus,
.account .dropdown-menu li a:focus, .account .dropdown-menu li a:focus, .account .dropdown-menu li .btn-link:focus,
.contact-photo-wrapper .dropdown-menu li a:focus { .contact-photo-wrapper .dropdown-menu li a:focus, .contact-photo-wrapper .dropdown-menu li .btn-link:focus {
background: 0 0 background: 0 0
} }
.nav-pills .dropdown-menu li:hover, .nav-pills .dropdown-menu li:hover,
@ -1171,8 +1207,8 @@ section #jotOpen {
.jothidden { .jothidden {
/*display: none;*/ /*display: none;*/
} }
#jot-modal .modal-header a, #jot-modal .modal-header a, #jot-modal .modal-header .btn-link,
#profile-jot-submit-wrapper a { #profile-jot-submit-wrapper a, #profile-jot-submit-wrapper .btn-link {
color: #555; color: #555;
text-transform: capitalize; text-transform: capitalize;
} }
@ -1315,8 +1351,6 @@ section #jotOpen {
.wall-item-container a, .wall-item-container a,
.wall-item-container .fakelink, .wall-item-container .fakelink,
.toplevel_item .fakelink, .toplevel_item .fakelink,
.toplevel_item .wall-item-container .btn-link,
.wall-item-container .btn-link,
.toplevel_item .wall-item-container .wall-item-responses a { .toplevel_item .wall-item-container .wall-item-responses a {
color: #555; color: #555;
-webkit-transition: all 0.25s ease-in-out; -webkit-transition: all 0.25s ease-in-out;
@ -1327,7 +1361,6 @@ section #jotOpen {
} }
.toplevel_item:hover .fakelink, .wall-item-container:hover .fakelink, .toplevel_item:hover .fakelink, .wall-item-container:hover .fakelink,
.toplevel_item:hover .wall-item-container:hover .btn-link,
.toplevel_item:hover .wall-item-container:hover .wall-item-responses a, .toplevel_item:hover .wall-item-container:hover .wall-item-responses a,
.toplevel_item:hover .wall-item-content a, .toplevel_item:hover .wall-item-content a,
.toplevel_item:hover .wall-item-name, .toplevel_item:hover .wall-item-name,
@ -1543,19 +1576,18 @@ code > .hl-main {
} }
/* item social action buttons */ /* item social action buttons */
.wall-item-actions, .wall-item-actions a { .wall-item-actions {
margin-top: 15px;
}
.wall-item-actions, .wall-item-actions a, .wall-item-actions button {
font-size: 13px; font-size: 13px;
color: #555; color: #555;
margin-top: 15px;
margin-bottom: 0; margin-bottom: 0;
} }
.wall-item-actions a.active { .wall-item-actions .active {
font-weight: bold; font-weight: bold;
} }
.wall-item-actions a:hover { .wall-item-actions .active:hover {
color: #555;
}
.wall-item-actions a.active:hover {
color: $link_color; color: $link_color;
} }
.wall-item-actions-left { .wall-item-actions-left {
@ -1576,10 +1608,11 @@ code > .hl-main {
.wall-item-actions .button-comments, .wall-item-actions .button-comments,
.wall-item-actions .button-votes, .wall-item-actions .button-votes,
.wall-item-actions .button-likes { .wall-item-actions .button-likes {
padding-left: 0px;
padding-right: 0px;
text-transform: capitalize; text-transform: capitalize;
} }
.wall-item-actions .separator {
margin: 0 .3em;
}
/* wall item hover effects */ /* wall item hover effects */
.wall-item-container .wall-item-links, .wall-item-container .wall-item-links,
@ -1662,8 +1695,8 @@ code > .hl-main {
padding-top: 5px !important; padding-top: 5px !important;
padding-bottom: 5px !important; padding-bottom: 5px !important;
} }
.comment-icon-list a.icon, .comment-icon-list > li > .icon,
.comment-icon-list a.icon:hover { .comment-icon-list > li > .icon:hover {
color: #555; color: #555;
background-color: transparent; background-color: transparent;
} }
@ -1793,12 +1826,14 @@ ul.dropdown-menu li:hover {
/* Dropdown Menu */ /* Dropdown Menu */
.dropdown-menu li a { .dropdown-menu li a,
.dropdown-menu li .btn-link {
font-size: 13px!important; font-size: 13px!important;
font-weight: 600!important; font-weight: 600!important;
} }
.dropdown-menu li a:hover, .dropdown-menu li a:visited, .dropdown-menu li > :hover,
.dropdown-menu li a:hover, .dropdown-menu li a:focus { .dropdown-menu li > :visited,
.dropdown-menu li > :focus {
background: 0 0; background: 0 0;
} }
@ -2010,22 +2045,22 @@ ul.viewcontact_wrapper > li {
.contact-wrapper .contact-actions { .contact-wrapper .contact-actions {
display: flex; display: flex;
} }
.contact-wrapper a.contact-action-link { .contact-wrapper .contact-action-link,
.contact-wrapper .contact-action-link:hover,
.textcomplete-item .contact-wrapper .contact-action-link {
padding: 0 5px;
color: #555;
border: 0;
}
.contact-wrapper .contact-action-link {
opacity: 0.1; opacity: 0.1;
transition: all 0.25s ease-in-out; transition: all 0.25s ease-in-out;
} }
.contact-wrapper a.contact-action-link, ul li:hover .contact-wrapper .contact-action-link {
.contact-wrapper a.contact-action-link:hover,
.textcomplete-item .contact-wrapper a.contact-action-link {
padding-right: 5px;
padding-left: 5px;
color: #555;
}
ul li:hover .contact-wrapper a.contact-action-link {
opacity: 0.8; opacity: 0.8;
transition: all 0.25s ease-in-out; transition: all 0.25s ease-in-out;
} }
ul li:hover .contact-wrapper a.contact-action-link:hover { ul li:hover .contact-wrapper .contact-action-link:hover {
opacity: 1; opacity: 1;
} }
#contacts-search-wrapper, #contacts-search-wrapper,

View File

@ -91,13 +91,13 @@ var FileBrowser = {
// We need to add the AjaxUpload to the button // We need to add the AjaxUpload to the button
FileBrowser.uploadButtons(); FileBrowser.uploadButtons();
$(".error a.close").on("click", function(e) { $(".error .close").on("click", function(e) {
e.preventDefault(); e.preventDefault();
$(".error").addClass("hidden"); $(".error").addClass("hidden");
}); });
// Click on album link // Click on album link
$(".fbrowser").on("click", ".folders a, .path a", function(e) { $(".fbrowser").on("click", ".folders a, .path a, .folders button, .path button", function(e) {
e.preventDefault(); e.preventDefault();
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none"; var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none";
$(".fbrowser-content").hide(); $(".fbrowser-content").hide();
@ -112,7 +112,6 @@ var FileBrowser = {
FileBrowser.uploadButtons(); FileBrowser.uploadButtons();
} }
}); });
}); });
//embed on click //embed on click

View File

@ -283,49 +283,3 @@ function getHoverCardVariables(object) {
return variables; return variables;
} }
// This is the html template for the hover-card
// Since we grab the original hovercard.tpl we don't
// need it anymore
function hovercard_template() {
var tempate = '\
<div class="basic-content" >\
<div class="hover-card-details">\
<div class="hover-card-header left-align">\
<div class="hover-card-pic left-align">\
<span class="image-wrapper medium">\
<a href="{{$profile.url}}" title="{{$profile.name}}"><img href="" class="left-align thumbnail" src="{{$profile.thumb}}"></a>\
</span>\
</div>\
<div class="hover-card-content">\
<div class="profile-entry-name">\
<h4 class="left-align1"><a href="{{$profile.url}}">{{$profile.name}}</a></h4>{{if $profile.account_type}}<span>{{$profile.account_type}}</span>{{/if}}\
</div>\
<div class="profile-details">\
<span class="profile-addr">{{$profile.addr}}</span>\
{{if $profile.network}}<span class="profile-network"> ({{$profile.network}})</span>{{/if}}\
</div>\
{{*{{if $profile.about}}<div class="profile-details profile-about">{{$profile.about}}</div>{{/if}}*}}\
\
</div>\
<div class="hover-card-actions right-aligned">\
{{* here are the differnt actions like privat message, poke, delete and so on *}}\
{{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}\
<div class="hover-card-actions-social">\
{{if $profile.actions.pm}}<a class="btn btn-labeled btn-primary btn-sm" onclick="addToModal("{{$profile.actions.pm.1}}")" title="{{$profile.actions.pm.0}}"><i class="fa fa-envelope" aria-hidden="true"></i></a>{{/if}}\
{{if $profile.actions.poke}}<a class="btn btn-labeled btn-primary btn-sm" onclick="addToModal("{{$profile.actions.poke.1}}")" title="{{$profile.actions.poke.0}}"><i class="fa fa-heartbeat" aria-hidden="true"></i></a>{{/if}}\
</div>\
<div class="hover-card-actions-connection">\
{{if $profile.actions.edit}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.edit.1}}" title="{{$profile.actions.edit.0}}"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}}\
{{if $profile.actions.drop}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.drop.1}}" title="{{$profile.actions.drop.0}}"><i class="fa fa-user-times" aria-hidden="true"></i></a>{{/if}}\
{{if $profile.actions.follow}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.follow.1}}" title="{{$profile.actions.follow.0}}"><i class="fa fa-user-plus" aria-hidden="true"></i></a>{{/if}}\
</div>\
</div>\
</div>\
\
<div class="clearfix"></div>\
\
</div>\
</div>\
{{if $profile.tags}}<div class="hover-card-footer">{{$profile.tags}}</div>{{/if}}';
}

View File

@ -617,3 +617,24 @@ function htmlToText(htmlString) {
return text; return text;
} }
/**
* Sends a /like API call and updates the display of the relevant action button
* before the update reloads the item.
*
* @param {string} ident The id of the relevant item
* @param {string} verb The verb of the action
* @returns {undefined}
*/
function doLikeAction(ident, verb) {
unpause();
if (verb.indexOf('attend') === 0) {
$('.item-' + ident + ' .button-event:not(#' + verb + '-' + ident + ')').removeClass('active');
}
$('#' + verb + '-' + ident).toggleClass('active');
$('#like-rotator-' + ident.toString()).show();
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
liking = 1;
force_update = true;
}

View File

@ -27,52 +27,51 @@
<div class="comment-edit-text-end clear"></div> <div class="comment-edit-text-end clear"></div>
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;"> <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;">
<button class="btn btn-primary btn-sm" type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" name="submit"><i class="fa fa-envelope"></i> {{$submit}}</button> <button type="submit" class="btn btn-primary btn-sm" id="comment-edit-submit-{{$id}}" name="submit"><i class="fa fa-envelope"></i> {{$submit}}</button>
{{if $preview}} {{if $preview}}
<button class="btn btn-defaul btn-sm" type="button" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}"><i class="fa fa-eye"></i> {{$preview}}</button> <button type="button" class="btn btn-defaul btn-sm" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}"><i class="fa fa-eye"></i> {{$preview}}</button>
{{/if}} {{/if}}
<ul class="comment-edit-bb-{{$id}} comment-icon-list nav nav-pills pull-right"> <ul class="comment-edit-bb-{{$id}} comment-icon-list nav nav-pills pull-right">
<li> <li>
<a class="icon" style="cursor: pointer;" title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}"> <button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl}}" onclick="insertFormatting('url',{{$id}});"> <button type="button" class="btn-link icon bb-url" style="cursor: pointer;" title="{{$edurl}}" onclick="insertFormatting('url',{{$id}});">
<i class="fa fa-link"></i> <i class="fa fa-link"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bb-video" style="cursor: pointer;" title="{{$edvideo}}" onclick="insertFormatting('video',{{$id}});"> <button type="button" class="btn-link icon bb-video" style="cursor: pointer;" title="{{$edvideo}}" onclick="insertFormatting('video',{{$id}});">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon underline" style="cursor: pointer;" title="{{$eduline}}" onclick="insertFormatting('u',{{$id}});"> <button type="button" class="btn-link icon underline" style="cursor: pointer;" title="{{$eduline}}" onclick="insertFormatting('u',{{$id}});">
<i class="fa fa-underline"></i> <i class="fa fa-underline"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon italic" style="cursor: pointer;" title="{{$editalic}}" onclick="insertFormatting('i',{{$id}});"> <button type="button" class="btn-link icon italic" style="cursor: pointer;" title="{{$editalic}}" onclick="insertFormatting('i',{{$id}});">
<i class="fa fa-italic"></i> <i class="fa fa-italic"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bold" style="cursor: pointer;" title="{{$edbold}}" onclick="insertFormatting('b',{{$id}});"> <button type="button" class="btn-link icon bold" style="cursor: pointer;" title="{{$edbold}}" onclick="insertFormatting('b',{{$id}});">
<i class="fa fa-bold"></i> <i class="fa fa-bold"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon quote" style="cursor: pointer;" title="{{$edquote}}" onclick="insertFormatting('quote',{{$id}});"> <button type="button" class="btn-link icon quote" style="cursor: pointer;" title="{{$edquote}}" onclick="insertFormatting('quote',{{$id}});">
<i class="fa fa-quote-left"></i> <i class="fa fa-quote-left"></i>
</a> </button>
</li> </li>
</ul> </ul>
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
</div> </div>
<div class="comment-edit-end clear"></div> <div class="comment-edit-end clear"></div>
</form> </form>
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
</div> </div>

View File

@ -12,13 +12,13 @@
</li> </li>
{{* The extended dropdown menu - this would be shown if the tab menu points {{* The extended dropdown menu - this would be shown if the tab menu points
dosn't fit in the available space. This is done through flexMenu.js *}} doesn't fit in the available space. This is done through flexMenu.js *}}
<li class="pull-right"> <li class="pull-right">
<ul class="tabs tabs-extended" role="menu"> <ul class="tabs tabs-extended" role="menu">
<li role="menuitem" class="dropdown flex-target"> <li role="menuitem" class="dropdown flex-target">
<a class="dropdown-toggle" type="button" id="dropdownMenuTools" data-toggle="dropdown" aria-expanded="true"> <button type="button" class="btn-link dropdown-toggle" id="dropdownMenuTools" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-chevron-down"></i> <i class="fa fa-chevron-down"></i>
</a> </button>
</li> </li>
</ul> </ul>
</li> </li>
@ -45,9 +45,9 @@
<li class="pull-right"> <li class="pull-right">
<ul class="tabs tabs-extended"> <ul class="tabs tabs-extended">
<li class="dropdown"> <li class="dropdown">
<a class="dropdown-toggle" type="button" id="dropdownMenuTools" data-toggle="dropdown" aria-expanded="true"> <button type="button" class="btn-link dropdown-toggle" id="dropdownMenuTools" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-chevron-down"></i> <i class="fa fa-chevron-down"></i>
</a> </button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools"> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools">
{{foreach $exttabs as $tab}} {{foreach $exttabs as $tab}}
<li id="{{$tab.id}}" role="menuitem" {{if $tab.sel}} class="{{$tab.sel}}" {{/if}}><a href="{{$tab.url}}" {{if $tab.title}} title="{{$tab.title}}"{{/if}}>{{$tab.label}}</a></li> <li id="{{$tab.id}}" role="menuitem" {{if $tab.sel}} class="{{$tab.sel}}" {{/if}}><a href="{{$tab.url}}" {{if $tab.title}} title="{{$tab.title}}"{{/if}}>{{$tab.label}}</a></li>

View File

@ -14,18 +14,20 @@
{{* This is the Action menu where contact related actions like 'ignore', 'hide' can be performed *}} {{* This is the Action menu where contact related actions like 'ignore', 'hide' can be performed *}}
<ul id="contact-edit-actions" class="nav nav-pills preferences"> <ul id="contact-edit-actions" class="nav nav-pills preferences">
<li class="dropdown pull-right"> <li class="dropdown pull-right">
<a class="btn btn-link btn-sm dropdown-toggle" type="button" id="contact-edit-actions-button" data-toggle="dropdown" aria-expanded="true"> <button type="button" class="btn btn-link btn-sm dropdown-toggle" id="contact-edit-actions-button" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-angle-down"></i>&nbsp;{{$contact_action_button}} <i class="fa fa-angle-down"></i>&nbsp;{{$contact_action_button}}
</a> </button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="contact-edit-actions-button" aria-haspopup="true" id="contact-actions-menu" > <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="contact-edit-actions-button" aria-haspopup="true" id="contact-actions-menu" >
{{if $lblsuggest}}<li role="menuitem"><a href="#" title="{{$contact_actions.suggest.title}}" onclick="window.location.href='{{$contact_actions.suggest.url}}'; return false;">{{$contact_actions.suggest.label}}</a></li>{{/if}} {{if $lblsuggest}}<li role="menuitem"><a href="{{$contact_actions.suggest.url}}" title="{{$contact_actions.suggest.title}}">{{$contact_actions.suggest.label}}</a></li>{{/if}}
{{if $poll_enabled}}<li role="menuitem"><a href="#" title="{{$contact_actions.update.title}}" onclick="window.location.href='{{$contact_actions.update.url}}'; return false;">{{$contact_actions.update.label}}</a></li>{{/if}} {{if $poll_enabled}}<li role="menuitem"><a href="{{$contact_actions.update.url}}" title="{{$contact_actions.update.title}}">{{$contact_actions.update.label}}</a></li>{{/if}}
{{if $lblsuggest || $poll_enabled}}
<li class="divider"></li> <li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li> {{/if}}
<li role="menuitem"><a href="#" title="{{$contact_actions.ignore.title}}" onclick="window.location.href='{{$contact_actions.ignore.url}}'; return false;">{{$contact_actions.ignore.label}}</a></li> <li role="menuitem"><a href="{{$contact_actions.block.url}}" title="{{$contact_actions.block.title}}">{{$contact_actions.block.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.archive.title}}" onclick="window.location.href='{{$contact_actions.archive.url}}'; return false;">{{$contact_actions.archive.label}}</a></li> <li role="menuitem"><a href="{{$contact_actions.ignore.url}}" title="{{$contact_actions.ignore.title}}">{{$contact_actions.ignore.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.delete.title}}" onclick="addToModal('{{$contact_actions.delete.url}}?confirm=1'); return false;">{{$contact_actions.delete.label}}</a></li> <li role="menuitem"><a href="{{$contact_actions.archive.url}}" title="{{$contact_actions.archive.title}}">{{$contact_actions.archive.label}}</a></li>
<li role="menuitem"><button type="button" class="btn-link" title="{{$contact_actions.delete.title}}" onclick="addToModal('{{$contact_actions.delete.url}}?confirm=1');">{{$contact_actions.delete.label}}</button></li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -5,7 +5,7 @@
<div class="contact-photo-wrapper dropdown pull-left" > <div class="contact-photo-wrapper dropdown pull-left" >
<div class="contact-entry-photo mframe" id="contact-entry-photo-{{$contact.id}}" > <div class="contact-entry-photo mframe" id="contact-entry-photo-{{$contact.id}}" >
<a class="dropdown-toggle" id="contact-photo-menu-{{$contact.id}}" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" > <button type="button" class="btn btn-link dropdown-toggle" id="contact-photo-menu-{{$contact.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
<div class="contact-photo-image-wrapper hidden-xs"> <div class="contact-photo-image-wrapper hidden-xs">
<img class="contact-photo media-object xl" src="{{$contact.thumb}}" {{$contact.sparkle}} alt="{{$contact.name}}" /> <img class="contact-photo media-object xl" src="{{$contact.thumb}}" {{$contact.sparkle}} alt="{{$contact.name}}" />
@ -24,7 +24,7 @@
<span class="contact-photo-overlay-content overlay-xs"><i class="fa fa-angle-down"></i></span> <span class="contact-photo-overlay-content overlay-xs"><i class="fa fa-angle-down"></i></span>
</div> </div>
</div> </div>
</a> </button>
{{if $contact.photo_menu}} {{if $contact.photo_menu}}
@ -33,7 +33,7 @@
{{if $c.2}} {{if $c.2}}
<li role="menuitem"><a target="redir" href="{{$c.1}}">{{$c.0}}</a></li> <li role="menuitem"><a target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
{{elseif $c.3}} {{elseif $c.3}}
<li role="menuitem"><a onclick="addToModal('{{$c.1}}')">{{$c.0}}</a></li> <li role="menuitem"><button type="button" class="btn-link" onclick="addToModal('{{$c.1}}')">{{$c.0}}</button></li>
{{else}} {{else}}
<li role="menuitem"><a href="{{$c.1}}">{{$c.0}}</a></li> <li role="menuitem"><a href="{{$c.1}}">{{$c.0}}</a></li>
{{/if}} {{/if}}
@ -48,13 +48,13 @@
<div class="media-body"> <div class="media-body">
{{* The contact actions like private mail, delete contact, edit contact and so on *}} {{* The contact actions like private mail, delete contact, edit contact and so on *}}
<div class="contact-actions pull-right nav-pills preferences hidden-xs"> <div class="contact-actions pull-right nav-pills preferences hidden-xs">
{{if $contact.photo_menu.pm}}<a class="contact-action-link" onclick="addToModal('{{$contact.photo_menu.pm.1}}')" data-toggle="tooltip" title="{{$contact.photo_menu.pm.0}}"><i class="fa fa-envelope" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.pm }}<button type="button" class="contact-action-link btn-link" onclick="addToModal('{{$contact.photo_menu.pm.1}}')" data-toggle="tooltip" title="{{$contact.photo_menu.pm.0}}"><i class="fa fa-envelope" aria-hidden="true"></i></button>{{/if}}
{{if $contact.photo_menu.poke}}<a class="contact-action-link" onclick="addToModal('{{$contact.photo_menu.poke.1}}')" data-toggle="tooltip" title="{{$contact.photo_menu.poke.0}}"><i class="fa fa-heartbeat" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.poke }}<button type="button" class="contact-action-link btn-link" onclick="addToModal('{{$contact.photo_menu.poke.1}}')" data-toggle="tooltip" title="{{$contact.photo_menu.poke.0}}"><i class="fa fa-heartbeat" aria-hidden="true"></i></button>{{/if}}
{{if $contact.photo_menu.network}}<a class="contact-action-link" href="{{$contact.photo_menu.network.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.network}}<a class="contact-action-link btn-link" href="{{$contact.photo_menu.network.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}}
{{if $contact.photo_menu.edit}}<a class="contact-action-link" href="{{$contact.photo_menu.edit.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.edit.0}}"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.edit }}<a class="contact-action-link btn-link" href="{{$contact.photo_menu.edit.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.edit.0}}"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}}
{{if $contact.photo_menu.drop}}<a class="contact-action-link" onclick="addToModal('{{$contact.photo_menu.drop.1}}')" data-toggle="tooltip" title="{{$contact.photo_menu.drop.0}}"><i class="fa fa-user-times" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.drop }}<button type="button" class="contact-action-link btn-link" onclick="addToModal('{{$contact.photo_menu.drop.1}}')" data-toggle="tooltip" title="{{$contact.photo_menu.drop.0}}"><i class="fa fa-user-times" aria-hidden="true"></i></button>{{/if}}
{{if $contact.photo_menu.follow}}<a class="contact-action-link" href="{{$contact.photo_menu.follow.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.follow.0}}"><i class="fa fa-user-plus" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.follow }}<a class="contact-action-link btn-link" href="{{$contact.photo_menu.follow.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.follow.0}}"><i class="fa fa-user-plus" aria-hidden="true"></i></a>{{/if}}
{{if $contact.photo_menu.hide}}<a class="contact-action-link" href="{{$contact.photo_menu.hide.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.hide.0}}"><i class="fa fa-times" aria-hidden="true"></i></a>{{/if}} {{if $contact.photo_menu.hide }}<a class="contact-action-link btn-link" href="{{$contact.photo_menu.hide.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.hide.0}}"><i class="fa fa-times" aria-hidden="true"></i></a>{{/if}}
</div> </div>
{{* The contact description (e.g. Name, Network, kind of connection and so on *}} {{* The contact description (e.g. Name, Network, kind of connection and so on *}}
@ -86,7 +86,7 @@
</div> </div>
{{* the following part is a nearly a copy of the part above but it is modyfied for working with js. {{* the following part is a nearly a copy of the part above but it is modified for working with js.
We use this part to filter the contacts with jquery.textcomplete *}} We use this part to filter the contacts with jquery.textcomplete *}}
<div class="javascript-template" rel="contact-template" style="display: none"> <div class="javascript-template" rel="contact-template" style="display: none">
<div class="contact-wrapper media" id="contact-entry-wrapper-{$id}" > <div class="contact-wrapper media" id="contact-entry-wrapper-{$id}" >
@ -95,7 +95,7 @@ We use this part to filter the contacts with jquery.textcomplete *}}
<div class="contact-photo-wrapper dropdown pull-left" > <div class="contact-photo-wrapper dropdown pull-left" >
<div class="contact-entry-photo mframe" id="contact-entry-photo-{$id}" > <div class="contact-entry-photo mframe" id="contact-entry-photo-{$id}" >
<a class="dropdown-toggle" id="contact-photo-menu-{$id}" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" > <button type="button" class="btn btn-link dropdown-toggle" id="contact-photo-menu-{$id}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
<div class="contact-photo-image-wrapper hidden-xs"> <div class="contact-photo-image-wrapper hidden-xs">
<img class="contact-photo media-object xl" src="{$thumb}" {11} alt="{$name}" /> <img class="contact-photo media-object xl" src="{$thumb}" {11} alt="{$name}" />
@ -114,7 +114,7 @@ We use this part to filter the contacts with jquery.textcomplete *}}
<span class="contact-photo-overlay-content overlay-xs"><i class="fa fa-angle-down"></i></span> <span class="contact-photo-overlay-content overlay-xs"><i class="fa fa-angle-down"></i></span>
</div> </div>
</div> </div>
</a> </button>
{if $photo_menu} {if $photo_menu}
@ -123,7 +123,7 @@ We use this part to filter the contacts with jquery.textcomplete *}}
{if $c.2} {if $c.2}
<li role="menuitem"><a target="redir" href="{$c.1}">{$c.0}</a></li> <li role="menuitem"><a target="redir" href="{$c.1}">{$c.0}</a></li>
{elseif $c.3} {elseif $c.3}
<li role="menuitem"><a onclick="addToModal('{$c.1}')">{$c.0}</a></li> <li role="menuitem"><button type="button" class="btn-link" onclick="addToModal('{$c.1}')">{$c.0}</button></li>
{else} {else}
<li role="menuitem"><a href="{$c.1}">{$c.0}</a></li> <li role="menuitem"><a href="{$c.1}">{$c.0}</a></li>
{/if} {/if}
@ -138,12 +138,12 @@ We use this part to filter the contacts with jquery.textcomplete *}}
<div class="media-body"> <div class="media-body">
{{* The contact actions like private mail, delete contact, edit contact and so on *}} {{* The contact actions like private mail, delete contact, edit contact and so on *}}
<div class="contact-actions pull-right nav-pills preferences hidden-xs"> <div class="contact-actions pull-right nav-pills preferences hidden-xs">
{if $photo_menu.pm}<a class="contact-action-link" onclick="addToModal('{$photo_menu.pm.1}')" data-toggle="tooltip" title="{$photo_menu.pm.0}"><i class="fa fa-envelope" aria-hidden="true"></i></a>{/if} {if $photo_menu.pm}<button type="button" class="contact-action-link btn-link" onclick="addToModal('{$photo_menu.pm.1}')" data-toggle="tooltip" title="{$photo_menu.pm.0}"><i class="fa fa-envelope" aria-hidden="true"></i></button>{/if}
{if $photo_menu.poke}<a class="contact-action-link" onclick="addToModal('{$photo_menu.poke.1}')" data-toggle="tooltip" title="{$photo_menu.poke.0}"><i class="fa fa-heartbeat" aria-hidden="true"></i></a>{/if} {if $photo_menu.poke}<button type="button" class="contact-action-link btn-link" onclick="addToModal('{$photo_menu.poke.1}')" data-toggle="tooltip" title="{$photo_menu.poke.0}"><i class="fa fa-heartbeat" aria-hidden="true"></i></button>{/if}
{if $photo_menu.network}<a class="contact-action-link" href="{$photo_menu.network.1}" data-toggle="tooltip" title="{$photo_menu.network.0}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{/if} {if $photo_menu.network}<a class="contact-action-link btn-link" href="{$photo_menu.network.1}" data-toggle="tooltip" title="{$photo_menu.network.0}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{/if}
{if $photo_menu.edit}<a class="contact-action-link" href="{$photo_menu.edit.1}" data-toggle="tooltip" title="{$photo_menu.edit.0}"><i class="fa fa-pencil" aria-hidden="true"></i></a>{/if} {if $photo_menu.edit}<a class="contact-action-link btn-link" href="{$photo_menu.edit.1}" data-toggle="tooltip" title="{$photo_menu.edit.0}"><i class="fa fa-pencil" aria-hidden="true"></i></a>{/if}
{if $photo_menu.drop}<a class="contact-action-link" href="{$photo_menu.drop.1}" data-toggle="tooltip" title="{$photo_menu.drop.0}"><i class="fa fa-user-times" aria-hidden="true"></i></a>{/if} {if $photo_menu.drop}<a class="contact-action-link btn-link" href="{$photo_menu.drop.1}" data-toggle="tooltip" title="{$photo_menu.drop.0}"><i class="fa fa-user-times" aria-hidden="true"></i></a>{/if}
{if $photo_menu.follow}<a class="contact-action-link" href="{$photo_menu.follow.1}" data-toggle="tooltip" title="{$photo_menu.follow.0}"><i class="fa fa-user-plus" aria-hidden="true"></i></a>{/if} {if $photo_menu.follow}<a class="contact-action-link btn-link" href="{$photo_menu.follow.1}" data-toggle="tooltip" title="{$photo_menu.follow.0}"><i class="fa fa-user-plus" aria-hidden="true"></i></a>{/if}
</div> </div>
{{* The contact description (e.g. Name, Network, kind of connection and so on *}} {{* The contact description (e.g. Name, Network, kind of connection and so on *}}

View File

@ -36,14 +36,14 @@
{{* We put the contact batch actions in a dropdown menu *}} {{* We put the contact batch actions in a dropdown menu *}}
<ul class="nav nav-pills preferences"> <ul class="nav nav-pills preferences">
<li class="dropdown pull-right"> <li class="dropdown pull-right">
<a class="btn btn-link btn-sm dropdown-toggle" type="button" id="BatchActionDropdownMenuTools" data-toggle="dropdown" aria-expanded="true"> <button type="button" class="btn btn-link btn-sm dropdown-toggle" id="BatchActionDropdownMenuTools" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-angle-down"></i>&nbsp;{{$h_batch_actions}} <i class="fa fa-angle-down"></i>&nbsp;{{$h_batch_actions}}
</a> </button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="BatchActionDropdownMenuTools"> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="BatchActionDropdownMenuTools">
{{foreach $batch_actions as $n=>$l}} {{foreach $batch_actions as $n=>$l}}
<li role="menuitem"> <li role="menuitem">
{{* call the js batch_submit_handler. Have a look at the buttom of this file *}} {{* call the js batch_submit_handler. Have a look at the buttom of this file *}}
<a onclick="batch_submit_handler('{{$n}}', '{{$l}}')">{{$l}}</a> <button type="button" class="btn-link" onclick="batch_submit_handler('{{$n}}', '{{$l}}')">{{$l}}</button>
</li> </li>
{{/foreach}} {{/foreach}}
</ul> </ul>

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="event-buttons pull-right"> <div class="event-buttons pull-right">
{{if $event.edit}}<a onclick="eventEdit('{{$event.edit.0}}')" title="{{$event.edit.1}}" class="edit-event-link btn"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}} {{if $event.edit}}<button type="button" class="btn" onclick="eventEdit('{{$event.edit.0}}')" title="{{$event.edit.1}}"><i class="fa fa-pencil" aria-hidden="true"></i></button>{{/if}}
{{if $event.drop}}<a href="{{$event.drop.0}}" onclick="return confirmDelete();" title="{{$event.drop.1}}" class="drop-event-link btn"><i class="fa fa-trash-o" aria-hidden="true"></i></a>{{/if}} {{if $event.drop}}<a href="{{$event.drop.0}}" onclick="return confirmDelete();" title="{{$event.drop.1}}" class="drop-event-link btn"><i class="fa fa-trash-o" aria-hidden="true"></i></a>{{/if}}
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link btn "><i class="fa fa-external-link" aria-hidden="true"></i></a>{{/if}} {{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link btn "><i class="fa fa-external-link" aria-hidden="true"></i></a>{{/if}}
</div> </div>

View File

@ -7,10 +7,22 @@
<ul id="event-nav" class="nav nav-tabs event-nav" role="menubar" data-tabs="tabs"> <ul id="event-nav" class="nav nav-tabs event-nav" role="menubar" data-tabs="tabs">
{{* Mark the first list entry as active because it is the first which is active after opening {{* Mark the first list entry as active because it is the first which is active after opening
the modal. Changing of the activity status is done by js in event_head.tpl *}} the modal. Changing of the activity status is done by js in event_head.tpl *}}
<li class="active" role="menuitem"><a id="event-edit-lnk" onclick="eventEditActive(); return false;">{{$basic}}</a></li> <li class="active" role="menuitem">
<li role="menuitem"><a id="event-desc-lnk" onclick="eventDescActive(); return false;">{{$advanced}}</a></li> <a id="event-edit-lnk" onclick="eventEditActive(); return false;">{{$basic}}</a>
{{if $acl}}<li role="menuitem" {{if !$sh_checked}} style="display: none"{{/if}}><a id="event-perms-lnk" onclick="eventAclActive();return false;">{{$permissions}}</a></li>{{/if}} </li>
{{if $preview}}<li role="menuitem"><a id="event-preview-lnk" onclick="eventPreviewActive();return false;">{{$preview}}</a></li>{{/if}} <li role="menuitem">
<a id="event-desc-lnk" onclick="eventDescActive(); return false;">{{$advanced}}</a>
</li>
{{if $acl}}
<li role="menuitem" {{if !$sh_checked}} style="display: none"{{/if}}>
<a id="event-perms-lnk" onclick="eventAclActive(); return false;">{{$permissions}}</a>
</li>
{{/if}}
{{if $preview}}
<li role="menuitem">
<a id="event-preview-lnk" onclick="eventPreviewActive(); return false;">{{$preview}}</a>
</li>
{{/if}}
{{* commented out because it isn't implemented yet {{* commented out because it isn't implemented yet
<li role="menuitem"><a id="event-preview-link" onclick="fbrowserActive(); return false;"> Browser </a></li> <li role="menuitem"><a id="event-preview-link" onclick="fbrowserActive(); return false;"> Browser </a></li>
*}} *}}
@ -66,41 +78,41 @@
<ul id="event-desc-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left"> <ul id="event-desc-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
{{* commented out because it isn't implemented yet {{* commented out because it isn't implemented yet
<li> <li>
<a class="icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="desc"> <button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="desc">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</a> </button>
</li> </li>
*}} *}}
<li> <li>
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="desc"> <button type="button" class="btn-link icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="desc">
<i class="fa fa-link"></i> <i class="fa fa-link"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bb-video" style="cursor: pointer;" title="{{$edvideo|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="video" data-id="desc"> <button type="button" class="btn-link icon bb-video" style="cursor: pointer;" title="{{$edvideo|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="video" data-id="desc">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon underline" style="cursor: pointer;" title="{{$eduline|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="u" data-id="desc"> <button type="button" class="btn-link icon underline" style="cursor: pointer;" title="{{$eduline|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="u" data-id="desc">
<i class="fa fa-underline"></i> <i class="fa fa-underline"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon italic" style="cursor: pointer;" title="{{$editalic|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="i" data-id="desc"> <button type="button" class="btn-link icon italic" style="cursor: pointer;" title="{{$editalic|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="i" data-id="desc">
<i class="fa fa-italic"></i> <i class="fa fa-italic"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bold" style="cursor: pointer;" title="{{$edbold|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="b" data-id="desc"> <button type="button" class="btn-link icon bold" style="cursor: pointer;" title="{{$edbold|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="b" data-id="desc">
<i class="fa fa-bold"></i> <i class="fa fa-bold"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon quote" style="cursor: pointer;" title="{{$edquote|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="quote" data-id="desc"> <button type="button" class="btn-link icon quote" style="cursor: pointer;" title="{{$edquote|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="quote" data-id="desc">
<i class="fa fa-quote-left"></i> <i class="fa fa-quote-left"></i>
</a> </button>
</li> </li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
@ -113,41 +125,41 @@
<ul id="comment-tools-loc" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left"> <ul id="comment-tools-loc" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
{{* commented out because it isn't implemented yet {{* commented out because it isn't implemented yet
<li> <li>
<a class="icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="loc"> <button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="loc">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</a> </button>
</li> </li>
*}} *}}
<li> <li>
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="loc"> <button type="button" class="btn-link icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="loc">
<i class="fa fa-link"></i> <i class="fa fa-link"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bb-video" style="cursor: pointer;" title="{{$edvideo|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="video" data-id="loc"> <button type="button" class="btn-link icon bb-video" style="cursor: pointer;" title="{{$edvideo|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="video" data-id="loc">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon underline" style="cursor: pointer;" title="{{$eduline|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="u" data-id="loc"> <button type="button" class="btn-link icon underline" style="cursor: pointer;" title="{{$eduline|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="u" data-id="loc">
<i class="fa fa-underline"></i> <i class="fa fa-underline"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon italic" style="cursor: pointer;" title="{{$editalic|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="i" data-id="loc"> <button type="button" class="btn-link icon italic" style="cursor: pointer;" title="{{$editalic|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="i" data-id="loc">
<i class="fa fa-italic"></i> <i class="fa fa-italic"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bold" style="cursor: pointer;" title="{{$edbold|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="b" data-id="loc"> <button type="button" class="btn-link icon bold" style="cursor: pointer;" title="{{$edbold|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="b" data-id="loc">
<i class="fa fa-bold"></i> <i class="fa fa-bold"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon quote" style="cursor: pointer;" title="{{$edquote|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="quote" data-id="loc"> <button type="button" class="btn-link icon quote" style="cursor: pointer;" title="{{$edquote|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="quote" data-id="loc">
<i class="fa fa-quote-left"></i> <i class="fa fa-quote-left"></i>
</a> </button>
</li> </li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>

View File

@ -3,7 +3,7 @@
{{include file="section_title.tpl" title=$title}} {{include file="section_title.tpl" title=$title}}
{{* The link to create a new event *}} {{* The link to create a new event *}}
<div id="new-event-link"><a onclick="addToModal('{{$new_event.0}}')" >{{$new_event.1}}</a></div> <div id="new-event-link"><button type="button" class="btn-link" onclick="addToModal('{{$new_event.0}}')" >{{$new_event.1}}</button></div>
{{* We create our own fullcallendar header (with title & calendar view *}} {{* We create our own fullcallendar header (with title & calendar view *}}
<div id="fc-header"> <div id="fc-header">
@ -11,21 +11,21 @@
{{* The dropdown to change the callendar view *}} {{* The dropdown to change the callendar view *}}
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="dropdown pull-right"> <li class="dropdown pull-right">
<a class="btn btn-link btn-sm dropdown-toggle" type="button" id="event-calendar-views" data-toggle="dropdown" aria-expanded="true"> <button type="button" class="btn btn-link btn-sm dropdown-toggle" type="button" id="event-calendar-views" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-angle-down"></i> {{$view}} <i class="fa fa-angle-down"></i> {{$view}}
</a> </button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="event-calendar-views"> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="event-calendar-views">
<li role="menuitem"> <li role="menuitem">
<a onclick="changeView('changeView', 'month');$('#events-calendar').fullCalendar('option', {contentHeight: '', aspectRatio: 1});">{{$month}}</a> <button type="button" class="btn-link" onclick="changeView('changeView', 'month');$('#events-calendar').fullCalendar('option', {contentHeight: '', aspectRatio: 1});">{{$month}}</button>
</li> </li>
<li role="menuitem"> <li role="menuitem">
<a onclick="changeView('changeView', 'agendaWeek');$('#events-calendar').fullCalendar('option', 'contentHeight', 'auto');">{{$week}}</a> <button type="button" class="btn-link" onclick="changeView('changeView', 'agendaWeek');$('#events-calendar').fullCalendar('option', 'contentHeight', 'auto');">{{$week}}</button>
</li> </li>
<li role="menuitem"> <li role="menuitem">
<a onclick="changeView('changeView', 'agendaDay');$('#events-calendar').fullCalendar('option', 'contentHeight', 'auto');">{{$day}}</a> <button type="button" class="btn-link" onclick="changeView('changeView', 'agendaDay');$('#events-calendar').fullCalendar('option', 'contentHeight', 'auto');">{{$day}}</button>
</li> </li>
<li role="menuitem"> <li role="menuitem">
<a onclick="changeView('changeView', 'listMonth');$('#events-calendar').fullCalendar('option', 'contentHeight', 'auto');">{{$list}}</a> <button type="button" class="btn-link" onclick="changeView('changeView', 'listMonth');$('#events-calendar').fullCalendar('option', 'contentHeight', 'auto');">{{$list}}</button>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -13,17 +13,17 @@
<input id="fb-type" type="hidden" name="type" value="{{$type}}" /> <input id="fb-type" type="hidden" name="type" value="{{$type}}" />
<div class="error hidden"> <div class="error hidden">
<span></span> <a href="#" class='close'>X</a> <span></span> <button type="button" class="btn btn-link" class="close">X</a>
</div> </div>
<div class="path"> <div class="path">
{{foreach $path as $p}}<a href="#" data-folder="{{$p.0}}">{{$p.1}}</a>{{/foreach}} {{foreach $path as $p}}<button type="button" class="btn-link" data-folder="{{$p.0}}">{{$p.1}}</button>{{/foreach}}
</div> </div>
{{if $folders }} {{if $folders }}
<div class="folders"> <div class="folders">
<ul> <ul>
{{foreach $folders as $f}}<li><a href="#" data-folder="{{$f.0}}">{{$f.1}}</a></li>{{/foreach}} {{foreach $folders as $f}}<li><button type="button" class="btn-link" data-folder="{{$f.0}}">{{$f.1}}</button></li>{{/foreach}}
</ul> </ul>
</div> </div>
{{/if}} {{/if}}
@ -31,10 +31,10 @@
<div class="list"> <div class="list">
{{foreach $files as $f}} {{foreach $files as $f}}
<div class="photo-album-image-wrapper"> <div class="photo-album-image-wrapper">
<a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}"> <button type="button" class="btn btn-link photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
<img src="{{$f.2}}"> <img src="{{$f.2}}">
<p>{{$f.1}}</p> <p>{{$f.1}}</p>
</a> </button>
</div> </div>
{{/foreach}} {{/foreach}}
</div> </div>

View File

@ -34,7 +34,7 @@
{{if $newgroup}} {{if $newgroup}}
<div id="sidebar-new-group"> <div id="sidebar-new-group">
{{* show the input field by clicking "new group" *}} {{* show the input field by clicking "new group" *}}
<a onclick="javascript:$('#group-new-form').fadeIn('fast');return false;">{{$createtext}}</a> <button type="button" class="btn-link" onclick="javascript:$('#group-new-form').fadeIn('fast');">{{$createtext}}</button>
<form id="group-new-form" action="group/new" method="post" style="display:none;"> <form id="group-new-form" action="group/new" method="post" style="display:none;">
<div class="form-group"> <div class="form-group">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}"> <input type="hidden" name="form_security_token" value="{{$form_security_token}}">

View File

@ -1,6 +1,6 @@
{{* The button to open the jot - in This theme we move the button with js to the second nav bar *}} {{* The button to open the jot - in This theme we move the button with js to the second nav bar *}}
<button class="btn btn-sm btn-main pull-right" id="jotOpen" onclick="jotShow(); return false;"><i class="fa fa-pencil-square-o fa-2x"></i></button> <button class="btn btn-sm btn-main pull-right" id="jotOpen" onclick="jotShow();"><i class="fa fa-pencil-square-o fa-2x"></i></button>
<div id="jot-content"> <div id="jot-content">
@ -15,10 +15,22 @@
<ul class="nav nav-tabs hidden-xs jot-nav" role="menubar" data-tabs="tabs"> <ul class="nav nav-tabs hidden-xs jot-nav" role="menubar" data-tabs="tabs">
{{* Mark the first list entry as active because it is the first which is active after opening {{* Mark the first list entry as active because it is the first which is active after opening
the modal. Changing of the activity status is done by js in jot.tpl-header *}} the modal. Changing of the activity status is done by js in jot.tpl-header *}}
<li class="active" role="menuitem"><a id="jot-text-lnk" class="jot-text-lnk" onclick="jotActive(); return false;">{{$message}}</a></li> <li class="active" role="menuitem">
{{if $acl}}<li role="menuitem"><a id="jot-perms-lnk" class="jot-perms-lnk" onclick="aclActive();return false;">{{$shortpermset}}</a></li>{{/if}} <a class="jot-text-lnk" id="jot-text-lnk" onclick="jotActive(); return false;">{{$message}}</a>
{{if $preview}}<li role="menuitem"><a id="jot-preview-lnk" class="jot-preview-lnk" onclick="previewActive();return false;">{{$preview}}</a></li>{{/if}} </li>
<li role="menuitem"><a id="jot-browser-link" onclick="fbrowserActive(); return false;">{{$browser}}</a></li> {{if $acl}}
<li role="menuitem">
<a class="jot-perms-lnk" id="jot-perms-lnk" onclick="aclActive(); return false;">{{$shortpermset}}</a>
</li>
{{/if}}
{{if $preview}}
<li role="menuitem">
<a class="jot-preview-lnk" id="jot-preview-lnk" onclick="previewActive(); return false;">{{$preview}}</a>
</li>
{{/if}}
<li role="menuitem">
<a class="jot-browser-lnk" id="jot-browser-link" onclick="fbrowserActive(); return false;">{{$browser}}</a>
</li>
</ul> </ul>
<div class="dropdown dropdown-head dropdown-mobile-jot jot-nav hidden-lg hidden-md hidden-sm" role="menubar" data-tabs="tabs" style="float: left;"> <div class="dropdown dropdown-head dropdown-mobile-jot jot-nav hidden-lg hidden-md hidden-sm" role="menubar" data-tabs="tabs" style="float: left;">
@ -26,9 +38,19 @@
<ul class="dropdown-menu nav nav-pills"> <ul class="dropdown-menu nav nav-pills">
{{* mark the first list entry as active because it is the first which is active after opening {{* mark the first list entry as active because it is the first which is active after opening
the modal. Changing of the activity status is done by js in jot.tpl-header *}} the modal. Changing of the activity status is done by js in jot.tpl-header *}}
<li role="menuitem" style="display: none;"><a id="jot-text-lnk-mobile" class="jot-text-lnk" onclick="jotActive(); return false;">{{$message}}</a></li> <li role="menuitem" style="display: none;">
{{if $acl}}<li role="menuitem"><a id="jot-perms-lnk-mobile" class="jot-perms-lnk" onclick="aclActive();return false;">{{$shortpermset}}</a></li>{{/if}} <a class="jot-text-lnk" id="jot-text-lnk-mobile" onclick="jotActive(); return false;">{{$message}}</a>
{{if $preview}}<li role="menuitem"><a id="jot-preview-lnk-mobile" class="jot-preview-lnk" onclick="previewActive();return false;">{{$preview}}</a></li>{{/if}} </li>
{{if $acl}}
<li role="menuitem">
<a class="jot-perms-lnk" id="jot-perms-lnk-mobile" onclick="aclActive(); return false;">{{$shortpermset}}</a>
</li>
{{/if}}
{{if $preview}}
<li role="menuitem">
<a class="jot-preview-lnk" id="jot-preview-lnk-mobile" onclick="previewActive(); return false;">{{$preview}}</a>
</li>
{{/if}}
</ul> </ul>
</div> </div>
<button type="button" class="close hidden-lg hidden-md hidden-sm" data-dismiss="modal" style="float: right;">&times;</button> <button type="button" class="close hidden-lg hidden-md hidden-sm" data-dismiss="modal" style="float: right;">&times;</button>
@ -69,13 +91,13 @@
{{* uncomment the button for "wall-immage-upload" because we have integrated it directly in the jot modal {{* uncomment the button for "wall-immage-upload" because we have integrated it directly in the jot modal
<li><a href="#" id="wall-image-upload" title="{{$upload}}"><i class="fa fa-picture-o"></i></a></li> <li><a href="#" id="wall-image-upload" title="{{$upload}}"><i class="fa fa-picture-o"></i></a></li>
*}} *}}
<li><a href="#" onclick="return false;" id="wall-file-upload" title="{{$attach}}"><i class="fa fa-paperclip"></i></a></li> <li><button type="button" class="btn-link" id="wall-file-upload" title="{{$attach}}"><i class="fa fa-paperclip"></i></button></li>
<li><a id="profile-link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink(); return false;" title="{{$weblink}}"><i class="fa fa-link"></i></a></li> <li><button type="button" class="btn-link" id="profile-link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" title="{{$weblink}}"><i class="fa fa-link"></i></button></li>
<li><a id="profile-video" onclick="jotVideoURL();return false;" title="{{$video}}"><i class="fa fa-film"></i></a></li> <li><button type="button" class="btn-link" id="profile-video" onclick="jotVideoURL();" title="{{$video}}"><i class="fa fa-film"></i></button></li>
<li><a id="profile-audio" onclick="jotAudioURL();return false;" title="{{$audio}}"><i class="fa fa-music"></i></a></li> <li><button type="button" class="btn-link" id="profile-audio" onclick="jotAudioURL();" title="{{$audio}}"><i class="fa fa-music"></i></button></li>
<li><a id="profile-location" onclick="jotGetLocation();return false;" title="{{$setloc}}"><i class="fa fa-map-marker"></i></a></li> <li><button type="button" class="btn-link" id="profile-location" onclick="jotGetLocation();" title="{{$setloc}}"><i class="fa fa-map-marker"></i></button></li>
<!-- TODO: waiting for a better placement <!-- TODO: waiting for a better placement
<li><a id="profile-nolocation" onclick="jotClearLocation();return false;" title="{{$noloc}}">{{$shortnoloc}}</a></li> <li><button type="button" class="btn-link" id="profile-nolocation" onclick="jotClearLocation();" title="{{$noloc}}">{{$shortnoloc}}</button></li>
--> -->
<li class="pull-right"><button class="btn btn-primary" id="jot-submit" type="submit" id="profile-jot-submit" name="submit" ><i class="fa fa-slideshare fa-fw"></i> {{$share}}</button></li> <li class="pull-right"><button class="btn btn-primary" id="jot-submit" type="submit" id="profile-jot-submit" name="submit" ><i class="fa fa-slideshare fa-fw"></i> {{$share}}</button></li>

View File

@ -20,7 +20,7 @@
<div class="container"> <div class="container">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-padding"><!-- div for navbar width--> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-padding"><!-- div for navbar width-->
<!-- Brand and toggle get grouped for better mobile display --> <!-- Brand and toggle get grouped for better mobile display -->
<div class="topbar-nav" role=”navigation”> <div class="topbar-nav" role="navigation">
{{* Buttons for the mobile view *}} {{* Buttons for the mobile view *}}
<button role="menu" type="button" class="navbar-toggle collapsed pull-right" data-toggle="offcanvas" data-target="#myNavmenu"> <button role="menu" type="button" class="navbar-toggle collapsed pull-right" data-toggle="offcanvas" data-target="#myNavmenu">
@ -70,7 +70,7 @@
{{* The notifications dropdown *}} {{* The notifications dropdown *}}
{{if $nav.notifications}} {{if $nav.notifications}}
<li id="nav-notification" class="nav-segment hidden-xs" role="presentation"> <li id="nav-notification" class="nav-segment hidden-xs" role="presentation">
<a role="menuitem" href="{{$nav.notifications.0}}" rel="#nav-notifications-menu" data-toggle="tooltip" data-toggle="tooltip" title="{{$nav.notifications.1}}" class="btn-link" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a role="menuitem" href="{{$nav.notifications.0}}" rel="#nav-notifications-menu" data-toggle="tooltip" data-toggle="tooltip" title="{{$nav.notifications.1}}" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-exclamation-circle fa-lg"></i> <i class="fa fa-exclamation-circle fa-lg"></i>
<span class="sr-only">{{$nav.notifications.1}}</span> <span class="sr-only">{{$nav.notifications.1}}</span>
<span id="notify-update" class="nav-notify-badge badge nav-notify dropdown" data-toggle="dropdown"></span> <span id="notify-update" class="nav-notify-badge badge nav-notify dropdown" data-toggle="dropdown"></span>
@ -84,7 +84,7 @@
<div class="arrow"></div> <div class="arrow"></div>
{{$nav.notifications.1}} {{$nav.notifications.1}}
<div class="dropdown-header-link"> <div class="dropdown-header-link">
<a href="#" onclick="notifyMarkAll(); return false;" data-toggle="tooltip" title="{{$nav.notifications.mark.3}}" class="">{{$nav.notifications.mark.1}}</a> <button type="button" class="btn-link" onclick="notifyMarkAll();" data-toggle="tooltip" title="{{$nav.notifications.mark.3}}">{{$nav.notifications.mark.1}}</button>
</div> </div>
</li> </li>
@ -119,7 +119,7 @@
{{* The user dropdown menu *}} {{* The user dropdown menu *}}
{{if $nav.userinfo}} {{if $nav.userinfo}}
<li role="menu" id="nav-user-linkmenu" class="dropdown account nav-menu hidden-xs"> <li role="menu" id="nav-user-linkmenu" class="dropdown account nav-menu hidden-xs">
<a href="#" id="main-menu" class="dropdown-toggle nav-avatar " data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <button id="main-menu" class="btn-link dropdown-toggle nav-avatar" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
<div class="user-title pull-left hidden-xs hidden-sm hidden-md"> <div class="user-title pull-left hidden-xs hidden-sm hidden-md">
<strong>{{$nav.userinfo.name}}</strong><br> <strong>{{$nav.userinfo.name}}</strong><br>
{{if $nav.remote}}<span class="trunctate">{{$nav.remote}}</span>{{/if}} {{if $nav.remote}}<span class="trunctate">{{$nav.remote}}</span>{{/if}}
@ -127,8 +127,7 @@
<img id="avatar" src="{{$nav.userinfo.icon}}" alt="{{$nav.userinfo.name}}"> <img id="avatar" src="{{$nav.userinfo.icon}}" alt="{{$nav.userinfo.name}}">
<span class="caret"></span> <span class="caret"></span>
</button>
</a>
{{* The list of available usermenu links *}} {{* The list of available usermenu links *}}
<ul id="nav-user-menu" class="dropdown-menu pull-right menu-popup" role="group" aria-labelledby="main-menu"> <ul id="nav-user-menu" class="dropdown-menu pull-right menu-popup" role="group" aria-labelledby="main-menu">

View File

@ -1,23 +1,3 @@
<script language="javascript" type="text/javascript">
// the following functions show/hide the specific profile page content
// in dependence of the selected nav
function profileStandardActive() {
$("#profile-content-advanced").hide();
$("#profile-content-standard").show();
$("#profile-tab-advanced-link").parent("li").removeClass("active");
$("#profile-tab-standard-link").parent("li").addClass("active");
}
function profileAdvancedActive() {
$("#profile-content-standard").hide();
$("#profile-content-advanced").show();
$("#profile-tab-standard-link").parent("li").removeClass("active");
$("#profile-tab-advanced-link").parent("li").addClass("active");
}
</script>
<div id="profile-page" class="generic-page-wrapper"> <div id="profile-page" class="generic-page-wrapper">
<h3 class="">{{$title}}</h3> <h3 class="">{{$title}}</h3>
@ -34,12 +14,17 @@
{{/if}} {{/if}}
{{* Frio does split the profile information in "standard" and "advanced". This is the tab menu for swithching between this modes *}} {{* Frio does split the profile information in "standard" and "advanced". This is the tab menu for swithching between this modes *}}
<ul id="profile-menu" class="nav nav-tabs" role="menubar" data-tabs="tabs"> <ul id="profile-menu" class="nav nav-tabs" role="tablist">
<li class="active" role="menuitem"><a id="profile-tab-standard-link" onclick="profileStandardActive(); return false;">{{$basic}}</a></li> <li role="presentation" class="active">
<li role="menuitem"><a id="profile-tab-advanced-link" onclick="profileAdvancedActive(); return false;">{{$advanced}}</a></li> <a href="#profile-content-standard" aria-controls="profile-content-standard" role="tab" data-toggle="tab">{{$basic}}</a>
</li>
<li role="presentation">
<a href="#profile-content-advanced" aria-controls="profile-content-advanced" role="tab" data-toggle="tab">{{$advanced}}</a>
</li>
</ul> </ul>
<div id="profile-content-standard"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="profile-content-standard">
<div id="aprofile-fullname" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 aprofile"> <div id="aprofile-fullname" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 aprofile">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted">{{$profile.fullname.0}}</div> <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted">{{$profile.fullname.0}}</div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry">{{$profile.fullname.1}}</div> <div class="col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry">{{$profile.fullname.1}}</div>
@ -110,7 +95,7 @@
{{/if}} {{/if}}
</div> </div>
<div id="profile-content-advanced" style="display: none"> <div role="tabpanel" class="tab-pane advanced" id="profile-content-advanced">
{{if $profile.sexual}} {{if $profile.sexual}}
<div id="aprofile-sexual" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 aprofile"> <div id="aprofile-sexual" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 aprofile">
<hr class="profile-separator"> <hr class="profile-separator">
@ -238,4 +223,5 @@
</div> </div>
{{/if}} {{/if}}
</div> </div>
</div>
</div> </div>

View File

@ -6,12 +6,12 @@
<div id="profile-edit-links"> <div id="profile-edit-links">
<ul class="nav nav-pills preferences"> <ul class="nav nav-pills preferences">
<li class="dropdown pull-right"> <li class="dropdown pull-right">
<a class="btn btn-link btn-sm dropdown-toggle" type="button" id="profile-edit-links-dropdown" data-toggle="dropdown" aria-expanded="true"> <button type="button" class="btn btn-link btn-sm dropdown-toggle" id="profile-edit-links-dropdown" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-angle-down" aria-hidden="true"></i>&nbsp;{{$profile_action}} <i class="fa fa-angle-down" aria-hidden="true"></i>&nbsp;{{$profile_action}}
</a> </button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="profile-edit-links-dropdown"> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="profile-edit-links-dropdown">
<li role="menuitem"><a href="profile_photo" id="profile-photo_upload-link" title="{{$profpic|escape:'html'}}"><i class="fa fa-user" aria-hidden="true"></i>&nbsp;{{$profpic}}</a></li> <li role="menuitem"><a href="profile_photo" id="profile-photo_upload-link" title="{{$profpic|escape:'html'}}"><i class="fa fa-user" aria-hidden="true"></i>&nbsp;{{$profpic}}</a></li>
<li role="menuitem"><a id="profile-photo_upload-link" title="{{$profpic|escape:'html'}}" onclick="openClose('profile-photo-upload-section');"><i class="fa fa-user" aria-hidden="true"></i>&nbsp;{{$profpic}}</a></li> <li role="menuitem"><button type="button" class="btn-link" id="profile-photo_upload-link" title="{{$profpic|escape:'html'}}" onclick="openClose('profile-photo-upload-section');"><i class="fa fa-user" aria-hidden="true"></i>&nbsp;{{$profpic}}</button></li>
{{if ! $is_default}} {{if ! $is_default}}
<li class="nav-item"><a href="profperm/{{$profile_id}}" id="profile-edit-visibility-link" title="{{$editvis}}"><i class="fa fa-pencil" aria-hidden="true"></i>&nbsp;{{$editvis}}</a> <li class="nav-item"><a href="profperm/{{$profile_id}}" id="profile-edit-visibility-link" title="{{$editvis}}"><i class="fa fa-pencil" aria-hidden="true"></i>&nbsp;{{$editvis}}</a>
</li> </li>

View File

@ -61,10 +61,10 @@
{{/if}} {{/if}}
{{if $wallmessage}} {{if $wallmessage}}
<div id="wallmessage-link-botton"> <div id="wallmessage-link-botton">
<a id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="openWallMessage('{{$wallmessage_link}}')"> <button type="button" id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="openWallMessage('{{$wallmessage_link}}')">
<span class=""><i class="fa fa-envelope"></i></span> <span class=""><i class="fa fa-envelope"></i></span>
<span class="">{{$wallmessage}}</span> <span class="">{{$wallmessage}}</span>
</a> </button>
</div> </div>
{{/if}} {{/if}}

View File

@ -33,40 +33,40 @@
<ul id="prvmail-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left"> <ul id="prvmail-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
<li> <li>
<a class="icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="input"> <button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="input">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="input"> <button type="button" class="btn-link icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="input">
<i class="fa fa-link"></i> <i class="fa fa-link"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bb-video" style="cursor: pointer;" title="{{$edvideo|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="video" data-id="input"> <button type="button" class="btn-link icon bb-video" style="cursor: pointer;" title="{{$edvideo|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="video" data-id="input">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon underline" style="cursor: pointer;" title="{{$eduline|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="u" data-id="input"> <button type="button" class="btn-link icon underline" style="cursor: pointer;" title="{{$eduline|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="u" data-id="input">
<i class="fa fa-underline"></i> <i class="fa fa-underline"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon italic" style="cursor: pointer;" title="{{$editalic|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="i" data-id="input"> <button type="button" class="btn-link icon italic" style="cursor: pointer;" title="{{$editalic|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="i" data-id="input">
<i class="fa fa-italic"></i> <i class="fa fa-italic"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon bold" style="cursor: pointer;" title="{{$edbold|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="b" data-id="input"> <button type="button" class="btn-link icon bold" style="cursor: pointer;" title="{{$edbold|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="b" data-id="input">
<i class="fa fa-bold"></i> <i class="fa fa-bold"></i>
</a> </button>
</li> </li>
<li> <li>
<a class="icon quote" style="cursor: pointer;" title="{{$edquote|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="quote" data-id="input"> <button type="button" class="btn-link icon quote" style="cursor: pointer;" title="{{$edquote|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="quote" data-id="input">
<i class="fa fa-quote-left"></i> <i class="fa fa-quote-left"></i>
</a> </button>
</li> </li>
</ul> </ul>

View File

@ -1,13 +1,12 @@
<!-- TODO => Unknow block --> <!-- TODO => Unknow block -->
<div class="wall-item-decor" style="display:none;"> <div class="wall-item-decor" style="display:none;">
<span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span> <span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span>
{{if $item.lock}}<span class="navicon lock fakelink" onclick="lockview(event,{{$item.id}});" title="{{$item.lock}}"></span><span class="fa fa-lock"></span>{{/if}} {{if $item.lock}}<span class="navicon lock fakelink" onclick="lockview(event, {{$item.id}});" title="{{$item.lock}}"></span><span class="fa fa-lock"></span>{{/if}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
<!-- ./TODO => Unknow block --> <!-- ./TODO => Unknow block -->
<div class="panel" id="item-{{$item.guid}}"> <div class="panel item-{{$item.id}}" id="item-{{$item.guid}}">
<div class="wall-item-container panel-body{{$item.indent}} {{$item.shiny}} {{$item.previewing}}" > <div class="wall-item-container panel-body{{$item.indent}} {{$item.shiny}} {{$item.previewing}}" >
<div class="media"> <div class="media">
{{* Put additional actions in a top-right dropdown menu *}} {{* Put additional actions in a top-right dropdown menu *}}
@ -17,7 +16,7 @@
{{if $item.plink || $item.star || $item.drop.dropping || $item.edpost}} {{if $item.plink || $item.star || $item.drop.dropping || $item.edpost}}
<li class="dropdown"> <li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="dropdownMenuTools-{{$item.id}}" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-angle-down"></i></a> <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" id="dropdownMenuTools-{{$item.id}}" aria-haspopup="true" aria-expanded="false"><i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools-{{$item.id}}"> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools-{{$item.id}}">
{{if $item.plink}} {{*link to the original source of the item *}} {{if $item.plink}} {{*link to the original source of the item *}}
@ -28,33 +27,33 @@
{{if $item.edpost}} {{* edit the posting *}} {{if $item.edpost}} {{* edit the posting *}}
<li role="menuitem"> <li role="menuitem">
<a href="#" href="{{$item.edpost.0}}" title="{{$item.edpost.1}}" class="navicon pencil"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</a> <button type="button" href="{{$item.edpost.0}}" title="{{$item.edpost.1}}" class="btn-link navicon pencil"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.tagger}} {{* tag the post *}} {{if $item.tagger}} {{* tag the post *}}
<li role="menuitem"> <li role="menuitem">
<a href="#" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}}); return false;" class="{{$item.tagger.class}}" title="{{$item.tagger.add}}"><i class="fa fa-tag"></i> {{$item.tagger.add}}</a> <button type="button" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}});" class="btn-link {{$item.tagger.class}}" title="{{$item.tagger.add}}"><i class="fa fa-tag"></i> {{$item.tagger.add}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.filer}} {{if $item.filer}}
<li role="menuitem"> <li role="menuitem">
<a href="#" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item filer-icon" title="{{$item.filer}}"><i class="fa fa-folder"></i>&nbsp;{{$item.filer}}</a> <button type="button" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}});" class="btn-link filer-item filer-icon" title="{{$item.filer}}"><i class="fa fa-folder"></i>&nbsp;{{$item.filer}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.star}} {{if $item.star}}
<li role="menuitem"> <li role="menuitem">
<a href="#" id="star-{{$item.id}}" onclick="dostar({{$item.id}}); return false;" class="{{$item.star.classdo}}" title="{{$item.star.do}}"><i class="fa fa-star-o"></i>&nbsp;{{$item.star.do}}</a> <button type="button" id="star-{{$item.id}}" onclick="dostar({{$item.id}});" class="btn-link {{$item.star.classdo}}" title="{{$item.star.do}}"><i class="fa fa-star-o"></i>&nbsp;{{$item.star.do}}</button>
<a href="#" id="unstar-{{$item.id}}" onclick="dostar({{$item.id}}); return false;" class="{{$item.star.classundo}}" title="{{$item.star.undo}}"><i class="fa fa-star"></i>&nbsp;{{$item.star.undo}}</a> <button type="button" id="unstar-{{$item.id}}" onclick="dostar({{$item.id}});" class="btn-link {{$item.star.classundo}}" title="{{$item.star.undo}}"><i class="fa fa-star"></i>&nbsp;{{$item.star.undo}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.drop.dropping}} {{if $item.drop.dropping}}
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>
<li role="menuitem"> <li role="menuitem">
<a class="navicon delete" onclick="dropItem('item/drop/{{$item.id}}', 'item-{{$item.guid}}'); return false;" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</a> <button type="button" class="btn-link navicon delete" onclick="dropItem('item/drop/{{$item.id}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</button>
</li> </li>
{{/if}} {{/if}}
</ul> </ul>
@ -83,9 +82,9 @@
{{* contact info header*}} {{* contact info header*}}
<div role="heading " class="contact-info hidden-sm hidden-xs media-body"><!-- <= For computer --> <div role="heading " class="contact-info hidden-sm hidden-xs media-body"><!-- <= For computer -->
<h4 class="media-heading"><a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name btn-link {{$item.sparkle}}">{{$item.name}}</span></a> <h4 class="media-heading"><a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name {{$item.sparkle}}">{{$item.name}}</span></a>
{{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name{{$item.osparkle}} btn-link" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}} {{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name {{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
{{if $item.lock}}<span class="navicon lock fakelink" onClick="lockview(event,{{$item.id}});" title="{{$item.lock}}">&nbsp;<small><i class="fa fa-lock"></i></small></span>{{/if}} {{if $item.lock}}<span class="navicon lock fakelink" onClick="lockview(event, {{$item.id}});" title="{{$item.lock}}">&nbsp;<small><i class="fa fa-lock"></i></small></span>{{/if}}
<div class="additional-info text-muted"> <div class="additional-info text-muted">
<div id="wall-item-ago-{{$item.id}}" class="wall-item-ago"> <div id="wall-item-ago-{{$item.id}}" class="wall-item-ago">
@ -137,19 +136,19 @@
</div> </div>
<div class="wall-item-tags"> <div class="wall-item-tags">
{{foreach $item.hashtags as $tag}} {{foreach $item.hashtags as $tag}}
<span class='tag label btn-info sm'>{{$tag}} <i class="fa fa-bolt"></i></span> <span class="tag label btn-info sm">{{$tag}} <i class="fa fa-bolt"></i></span>
{{/foreach}} {{/foreach}}
{{foreach $item.mentions as $tag}} {{foreach $item.mentions as $tag}}
<span class='mention label btn-warning sm'>{{$tag}} <i class="fa fa-user"></i></span> <span class="mention label btn-warning sm">{{$tag}} <i class="fa fa-user"></i></span>
{{/foreach}} {{/foreach}}
{{foreach $item.folders as $cat}} {{foreach $item.folders as $cat}}
<span class='folder label btn-danger sm'>{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span> <span class="folder label btn-danger sm">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
{{/foreach}} {{/foreach}}
{{foreach $item.categories as $cat}} {{foreach $item.categories as $cat}}
<span class='category label btn-success sm'>{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span> <span class="category label btn-success sm">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
{{/foreach}} {{/foreach}}
</div> </div>
{{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}} {{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}}
@ -161,7 +160,7 @@
<div class="wall-item-actions-left pull-left"> <div class="wall-item-actions-left pull-left">
<!--comment this out to try something different {{if $item.threaded}}{{if $item.comment}} <!--comment this out to try something different {{if $item.threaded}}{{if $item.comment}}
<div id="button-reply" class="pull-left"> <div id="button-reply" class="pull-left">
<span class="btn-link" id="comment-{{$item.id}}" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"><i class="fa fa-reply" title="{{$item.switchcomment}}"></i> </span> <button type="button" class="btn-link" id="comment-{{$item.id}}" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"><i class="fa fa-reply" title="{{$item.switchcomment}}"></i> </span>
</div> </div>
{{/if}}{{/if}}--> {{/if}}{{/if}}-->
@ -170,36 +169,35 @@
{{* Buttons for like and dislike *}} {{* Buttons for like and dislike *}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}} {{if $item.vote.like}}
<a role="button" href="#" class="button-likes{{if $item.responses.like.self}} active{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false;">{{$item.vote.like.0}}</a> <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like');">{{$item.vote.like.0}}</button>
{{/if}} {{/if}}
{{if $item.vote.like AND $item.vote.dislike}} {{if $item.vote.like AND $item.vote.dislike}}
<span role="presentation" class="separator">&nbsp;&nbsp;</span> <span role="presentation" class="separator">•</span>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<a role="button" href="#" class="button-likes{{if $item.responses.like.self}} active{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false;">{{$item.vote.dislike.0}}</a> <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike');">{{$item.vote.dislike.0}}</button>
{{/if}} {{/if}}
{{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}}
<span role="presentation" class="separator">&nbsp;&nbsp;</span> <span role="presentation" class="separator">•</span>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{* Butten to open the comment text field *}} {{* Button to open the comment text field *}}
{{if $item.comment}} {{if $item.comment}}
<a role="button" class="" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});">{{$item.switchcomment}} </a> <button type="button" class="btn btn-default" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});">{{$item.switchcomment}}</button>
{{/if}} {{/if}}
{{* Button for sharing the item *}} {{* Button for sharing the item *}}
{{if $item.vote}} {{if $item.vote}}
{{if ($item.vote.like OR $item.vote.dislike OR $item.comment) AND $item.vote.share}}
<span role="presentation" class="separator">&nbsp;•&nbsp;</span>
{{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}
<a role="button" href="#" class="" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false;"><i class="fa fa-retweet"></i>&nbsp;{{$item.vote.share.0}}</a> {{if $item.vote.like OR $item.vote.dislike OR $item.comment}}
<span role="presentation" class="separator">•</span>
{{/if}}
<button type="button" class="btn btn-default" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}});"><i class="fa fa-retweet"></i>&nbsp;{{$item.vote.share.0}}</button>
{{/if}} {{/if}}
{{/if}} {{/if}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
@ -207,9 +205,9 @@
{{* Event attendance buttons *}} {{* Event attendance buttons *}}
{{if $item.isevent}} {{if $item.isevent}}
<div class="vote-event"> <div class="vote-event">
<a role="button" href="#" class="button-event{{if $item.responses.attendyes.self}} active{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;"><i class="fa fa-check"><span class="sr-only">{{$item.attend.0}}</span></i></a> <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes');"><i class="fa fa-check"><span class="sr-only">{{$item.attend.0}}</span></i></button>
<a role="button" href="#" class="button-event{{if $item.responses.attendno.self}} active{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;"><i class="fa fa-times"><span class="sr-only">{{$item.attend.1}}</span></i></a> <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno');"><i class="fa fa-times"><span class="sr-only">{{$item.attend.1}}</span></i></button>
<a role="button" href="#" class="button-event{{if $item.responses.attendmaybe.self}} active{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;"><i class="fa fa-question"><span class="sr-only">{{$item.attend.2}}</span></i></a> <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe');"><i class="fa fa-question"><span class="sr-only">{{$item.attend.2}}</span></i></button>
</div> </div>
{{/if}} {{/if}}
@ -234,7 +232,7 @@
<div class="wall-item-conv" id="wall-item-conv-{{$item.id}}" > <div class="wall-item-conv" id="wall-item-conv-{{$item.id}}" >
{{if $item.conv}} {{if $item.conv}}
<a href='{{$item.conv.href}}' id='context-{{$item.id}}' title='{{$item.conv.title}}'>{{$item.conv.title}}</a> <a href="{{$item.conv.href}}" id="context-{{$item.id}}" title="{{$item.conv.title}}">{{$item.conv.title}}</a>
{{/if}} {{/if}}
</div> </div>
</div><!--./media>--> </div><!--./media>-->

View File

@ -198,7 +198,7 @@
{{* commented out because it was commented out in the original template {{* commented out because it was commented out in the original template
<div class="field"> <div class="field">
<button onclick="javascript:Notification.requestPermission(function(perm){if(perm === 'granted')alert('{{$desktop_notifications_success_message}}');});return false;">{{$desktop_notifications}}</button> <button type="button" onclick="javascript:Notification.requestPermission(function(perm){if(perm === 'granted')alert('{{$desktop_notifications_success_message}}');});">{{$desktop_notifications}}</button>
<span class="field_help">{{$desktop_notifications_note}}</span> <span class="field_help">{{$desktop_notifications_note}}</span>
</div> </div>
*}} *}}

View File

@ -19,8 +19,8 @@
<div id="conversation-end"></div> <div id="conversation-end"></div>
{{if $dropping}} {{if $dropping}}
<a id="item-delete-selected" class="" href="#" title="{{$dropping}}" onclick="deleteCheckedItems();return false;" data-toggle="tooltip"> <button type="button" id="item-delete-selected" class="btn btn-link" title="{{$dropping}}" onclick="deleteCheckedItems();" data-toggle="tooltip">
<i class="fa fa-trash" aria-hidden="true"></i> <i class="fa fa-trash" aria-hidden="true"></i>
</a> </button>
<img id="item-delete-selected-rotator" class="like-rotator" src="images/rotator.gif" style="display: none;" /> <img id="item-delete-selected-rotator" class="like-rotator" src="images/rotator.gif" style="display: none;" />
{{/if}} {{/if}}

View File

@ -40,11 +40,11 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.thread_level<3}} {{if $item.thread_level<3}}
<div class="hide-comments-outer-wrapper"> <div class="hide-comments-outer-wrapper">
<div class="hide-comments-outer btn-link" onclick="showHideComments({{$item.id}});"> <div class="hide-comments-outer fakelink" onclick="showHideComments({{$item.id}});">
<span id="hide-comments-total-{{$item.id}}" <span id="hide-comments-total-{{$item.id}}"
class="hide-comments-total">{{$item.num_comments}}</span> class="hide-comments-total">{{$item.num_comments}}</span>
<span id="hide-comments-{{$item.id}}" <span id="hide-comments-{{$item.id}}"
class="hide-comments fakelink">{{$item.hide_text}}</span> class="hide-comments">{{$item.hide_text}}</span>
</div> </div>
<hr /> <hr />
</div> </div>
@ -68,9 +68,9 @@ as the value of $top_child_total (this is done at the end of this file)
{{* Use a different div container in dependence max thread-level = 7 *}} {{* Use a different div container in dependence max thread-level = 7 *}}
{{if $item.thread_level<7}} {{if $item.thread_level<7}}
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_{{$item.thread_level}} {{if $item.thread_level==1}}panel-body h-entry{{else}}u-comment h-cite{{/if}}" id="item-{{$item.guid}}"><!-- wall-item-container --> <div class="item-{{$item.id}} wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_{{$item.thread_level}} {{if $item.thread_level==1}}panel-body h-entry{{else}}u-comment h-cite{{/if}}" id="item-{{$item.guid}}"><!-- wall-item-container -->
{{else}} {{else}}
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_7 u-comment h-cite" id="item-{{$item.guid}}"> <div class="item-{{$item.id}} wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_7 u-comment h-cite" id="item-{{$item.guid}}">
{{/if}} {{/if}}
<div class="media"> <div class="media">
{{* Put addional actions in a top-right dropdown menu *}} {{* Put addional actions in a top-right dropdown menu *}}
@ -80,7 +80,7 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.plink || $item.drop.dropping || $item.edpost || $item.ignore || $item.tagger || $item.star || $item.filer}} {{if $item.plink || $item.drop.dropping || $item.edpost || $item.ignore || $item.tagger || $item.star || $item.filer}}
<li class="dropdown"> <li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" id="dropdownMenuTools-{{$item.id}}" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-angle-down"></i></a> <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" id="dropdownMenuTools-{{$item.id}}" aria-haspopup="true" aria-expanded="false"><i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools-{{$item.id}}"> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools-{{$item.id}}">
{{if $item.plink}} {{*link to the original source of the item *}} {{if $item.plink}} {{*link to the original source of the item *}}
@ -91,26 +91,26 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.edpost}} {{* edit the posting *}} {{if $item.edpost}} {{* edit the posting *}}
<li role="menuitem"> <li role="menuitem">
<a onclick="editpost('{{$item.edpost.0}}?mode=none'); return false;" title="{{$item.edpost.1}}" class="navicon pencil"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</a> <button type="button" onclick="editpost('{{$item.edpost.0}}?mode=none');" title="{{$item.edpost.1}}" class="btn-link navicon pencil"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.tagger}} {{* tag the post *}} {{if $item.tagger}} {{* tag the post *}}
<li role="menuitem"> <li role="menuitem">
<a id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}}); return false;" class="{{$item.tagger.class}}" title="{{$item.tagger.add}}"><i class="fa fa-tag"></i> {{$item.tagger.add}}</a> <button type="button" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}});" class="btn-link {{$item.tagger.class}}" title="{{$item.tagger.add}}"><i class="fa fa-tag"></i> {{$item.tagger.add}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.filer}} {{if $item.filer}}
<li role="menuitem"> <li role="menuitem">
<a id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item filer-icon" title="{{$item.filer}}"><i class="fa fa-folder"></i>&nbsp;{{$item.filer}}</a> <button type="button" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}});" class="btn-link filer-item filer-icon" title="{{$item.filer}}"><i class="fa fa-folder"></i>&nbsp;{{$item.filer}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.star}} {{if $item.star}}
<li role="menuitem"> <li role="menuitem">
<a id="star-{{$item.id}}" onclick="dostar({{$item.id}}); return false;" class="{{$item.star.classdo}}" title="{{$item.star.do}}"><i class="fa fa-star-o"></i>&nbsp;{{$item.star.do}}</a> <button type="button" id="star-{{$item.id}}" onclick="dostar({{$item.id}});" class="btn-link {{$item.star.classdo}}" title="{{$item.star.do}}"><i class="fa fa-star-o"></i>&nbsp;{{$item.star.do}}</button>
<a id="unstar-{{$item.id}}" onclick="dostar({{$item.id}}); return false;" class="{{$item.star.classundo}}" title="{{$item.star.undo}}"><i class="fa fa-star"></i>&nbsp;{{$item.star.undo}}</a> <button type="button" id="unstar-{{$item.id}}" onclick="dostar({{$item.id}});" class="btn-link {{$item.star.classundo}}" title="{{$item.star.undo}}"><i class="fa fa-star"></i>&nbsp;{{$item.star.undo}}</button>
</li> </li>
{{/if}} {{/if}}
@ -120,16 +120,16 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.ignore}} {{if $item.ignore}}
<li role="menuitem"> <li role="menuitem">
<a id="ignore-{{$item.id}}" onclick="doignore({{$item.id}}); return false;" class="{{$item.ignore.classdo}}" title="{{$item.ignore.do}}"><i class="fa fa-eye-slash"></i> {{$item.ignore.do}}</a> <button type="button" id="ignore-{{$item.id}}" onclick="doignore({{$item.id}});" class="btn-link {{$item.ignore.classdo}}" title="{{$item.ignore.do}}"><i class="fa fa-eye-slash"></i> {{$item.ignore.do}}</button>
</li> </li>
<li role="menuitem"> <li role="menuitem">
<a id="unignore-{{$item.id}}" onclick="doignore({{$item.id}}); return false;" class="{{$item.ignore.classundo}}" title="{{$item.ignore.undo}}"><i class="fa fa-eye"></i> {{$item.ignore.undo}}</a> <button type="button" id="unignore-{{$item.id}}" onclick="doignore({{$item.id}});" class="btn-link {{$item.ignore.classundo}}" title="{{$item.ignore.undo}}"><i class="fa fa-eye"></i> {{$item.ignore.undo}}</button>
</li> </li>
{{/if}} {{/if}}
{{if $item.drop.dropping}} {{if $item.drop.dropping}}
<li role="menuitem"> <li role="menuitem">
<a class="navicon delete" onclick="dropItem('item/drop/{{$item.id}}', 'item-{{$item.guid}}'); return false;" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</a> <button type="button" class="btn-link navicon delete" onclick="dropItem('item/drop/{{$item.id}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</button>
</li> </li>
{{/if}} {{/if}}
</ul> </ul>
@ -184,15 +184,14 @@ as the value of $top_child_total (this is done at the end of this file)
{{* contact info header*}} {{* contact info header*}}
{{if $item.thread_level==1}} {{if $item.thread_level==1}}
<div role="heading " aria-level="{{$item.thread_level}}" class="contact-info hidden-sm hidden-xs media-body"><!-- <= For computer --> <div role="heading " aria-level="{{$item.thread_level}}" class="contact-info hidden-sm hidden-xs media-body"><!-- <= For computer -->
<h4 class="media-heading"><a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name btn-link {{$item.sparkle}}">{{$item.name}}</span></a> <h4 class="media-heading"><a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name {{$item.sparkle}}">{{$item.name}}</span></a>
{{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name{{$item.osparkle}} btn-link" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}} {{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link userinfo"><span class="wall-item-name {{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
{{if $item.lock}}<span class="navicon lock fakelink" onClick="lockview(event,{{$item.id}});" title="{{$item.lock}}" data-toggle="tooltip">&nbsp;<small><i class="fa fa-lock"></i></small></span>{{/if}} {{if $item.lock}}<span class="navicon lock fakelink" onClick="lockview(event,{{$item.id}});" title="{{$item.lock}}" data-toggle="tooltip">&nbsp;<small><i class="fa fa-lock"></i></small></span>{{/if}}
</h4> </h4>
<div class="additional-info text-muted"> <div class="additional-info text-muted">
<div id="wall-item-ago-{{$item.id}}" class="wall-item-ago"> <div id="wall-item-ago-{{$item.id}}" class="wall-item-ago">
<small><a href="{{$item.plink.orig}}"><span class="time" title="{{$item.localtime}}" data-toggle="tooltip"><time class="dt-published" datetime="{{$item.localtime}}">{{$item.ago}}</time></span></a></small> <small><a href="{{$item.plink.orig}}"><span class="time" title="{{$item.localtime}}" data-toggle="tooltip"><time class="dt-published" datetime="{{$item.localtime}}">{{$item.ago}}</time></span></a></small>
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
{{if $item.location}} {{if $item.location}}
@ -220,7 +219,7 @@ as the value of $top_child_total (this is done at the end of this file)
<div class="media-body">{{*this is the media body for comments - this div must be closed at the end of the file *}} <div class="media-body">{{*this is the media body for comments - this div must be closed at the end of the file *}}
<div role="heading " aria-level="{{$item.thread_level}}" class="contact-info-comment"> <div role="heading " aria-level="{{$item.thread_level}}" class="contact-info-comment">
<h5 class="media-heading"> <h5 class="media-heading">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span class="btn-link">{{$item.name}}</span></a> <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span class="fakelink">{{$item.name}}</span></a>
<span class="text-muted"> <span class="text-muted">
<small><span title="{{$item.localtime}}" data-toggle="tooltip">{{$item.ago}}</span> {{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location}}){{/if}}</small> <small><span title="{{$item.localtime}}" data-toggle="tooltip">{{$item.ago}}</span> {{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location}}){{/if}}</small>
</span> </span>
@ -278,7 +277,7 @@ as the value of $top_child_total (this is done at the end of this file)
<div class="wall-item-actions-left pull-left"> <div class="wall-item-actions-left pull-left">
<!--comment this out to try something different {{if $item.threaded}}{{if $item.comment}} <!--comment this out to try something different {{if $item.threaded}}{{if $item.comment}}
<div id="button-reply" class="pull-left"> <div id="button-reply" class="pull-left">
<span class="btn-link" id="comment-{{$item.id}}" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"><i class="fa fa-reply" title="{{$item.switchcomment}}"></i> </span> <button type="button" class="btn-link" id="comment-{{$item.id}}" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"><i class="fa fa-reply" title="{{$item.switchcomment}}"></i> </span>
</div> </div>
{{/if}}{{/if}}--> {{/if}}{{/if}}-->
@ -287,45 +286,44 @@ as the value of $top_child_total (this is done at the end of this file)
{{* Buttons for like and dislike *}} {{* Buttons for like and dislike *}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}} {{if $item.vote.like}}
<a role="button" class="button-likes{{if $item.responses.like.self}} active{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false;"><i class="fa fa-thumbs-up"></i>&nbsp;{{$item.vote.like.1}}</a> <button type="button" class="btn-link button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}},'like');" data-toggle="button"><i class="fa fa-thumbs-up"></i>&nbsp;{{$item.vote.like.1}}</button>
{{/if}} {{/if}}
{{if $item.vote.like AND $item.vote.dislike}} {{if $item.vote.like AND $item.vote.dislike}}
<span role="presentation" class="separator">&nbsp;&nbsp;</span> <span role="presentation" class="separator">•</span>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<a role="button" class="button-likes{{if $item.responses.dislike.self}} active{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false;"><i class="fa fa-thumbs-down"></i>&nbsp;{{$item.vote.dislike.1}}</a> <button type="button" class="btn-link button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}},'dislike');" data-toggle="button"><i class="fa fa-thumbs-down"></i>&nbsp;{{$item.vote.dislike.1}}</button>
{{/if}} {{/if}}
{{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}}
<span role="presentation" class="separator">&nbsp;&nbsp;</span> <span role="presentation" class="separator">•</span>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{* Butten to open the comment text field *}} {{* Button to open the comment text field *}}
{{if $item.comment}} {{if $item.comment}}
<a role="button" class="button-comments" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" {{if $item.thread_level != 1}}onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" {{else}} onclick="showHide('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"{{/if}}><i class="fa fa-commenting"></i>&nbsp;{{$item.switchcomment}}</a> <button type="button" class="btn-link button-comments" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" {{if $item.thread_level != 1}}onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" {{else}} onclick="showHide('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"{{/if}}><i class="fa fa-commenting"></i>&nbsp;{{$item.switchcomment}}</button>
{{/if}} {{/if}}
{{* Button for sharing the item *}} {{* Button for sharing the item *}}
{{if $item.vote}} {{if $item.vote}}
{{if ($item.vote.like OR $item.vote.dislike OR $item.comment) AND $item.vote.share}}
<span role="presentation" class="separator">&nbsp;•&nbsp;</span>
{{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}
<a role="button" class="button-votes" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false;"><i class="fa fa-retweet"></i>&nbsp;{{$item.vote.share.1}}</a> {{if $item.vote.like OR $item.vote.dislike OR $item.comment}}
<span role="presentation" class="separator">•</span>
{{/if}}
<button type="button" class="btn-link button-votes" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}});"><i class="fa fa-retweet"></i>&nbsp;{{$item.vote.share.1}}</a>
{{/if}} {{/if}}
{{/if}} {{/if}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
<div class="wall-item-actions-right pull-right"> <div class="wall-item-actions-right pull-right">
{{* Event attendance buttons *}} {{* Event attendance buttons *}}
{{if $item.isevent}} {{if $item.isevent}}
<div class="vote-event"> <div class="vote-event">
<a role="button" class="button-event{{if $item.responses.attendyes.self}} active{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;"><i class="fa fa-check"><span class="sr-only">{{$item.attend.0}}</span></i></a> <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}},'attendyes');"><i class="fa fa-check"><span class="sr-only">{{$item.attend.0}}</span></i></button>
<a role="button" class="button-event{{if $item.responses.attendno.self}} active{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;"><i class="fa fa-times"><span class="sr-only">{{$item.attend.1}}</span></i></a> <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}},'attendno');"><i class="fa fa-times"><span class="sr-only">{{$item.attend.1}}</span></i></button>
<a role="button" class="button-event{{if $item.responses.attendmaybe.self}} active{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;"><i class="fa fa-question"><span class="sr-only">{{$item.attend.2}}</span></i></a> <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}},'attendmaybe');"><i class="fa fa-question"><span class="sr-only">{{$item.attend.2}}</span></i></button>
</div> </div>
{{/if}} {{/if}}

View File

@ -9,9 +9,9 @@
* Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/ * Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
*/ */
require_once("include/plugin.php"); require_once "include/plugin.php";
require_once("include/socgraph.php"); require_once "include/socgraph.php";
require_once("mod/proxy.php"); require_once "mod/proxy.php";
function vier_init(App $a) { function vier_init(App $a) {
@ -101,6 +101,7 @@ EOT;
} }
// Hide the left menu bar // Hide the left menu bar
/// @TODO maybe move this static array out where it should belong?
if (($a->page['aside'] == "") AND in_array($a->argv[0], array("community", "events", "help", "manage", "notifications", if (($a->page['aside'] == "") AND in_array($a->argv[0], array("community", "events", "help", "manage", "notifications",
"probe", "webfinger", "login", "invite", "credits"))) { "probe", "webfinger", "login", "invite", "credits"))) {
$a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />"; $a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
@ -110,13 +111,15 @@ EOT;
function get_vier_config($key, $default = false, $admin = false) { function get_vier_config($key, $default = false, $admin = false) {
if (local_user() AND !$admin) { if (local_user() AND !$admin) {
$result = get_pconfig(local_user(), "vier", $key); $result = get_pconfig(local_user(), "vier", $key);
if ($result !== false) if ($result !== false) {
return $result; return $result;
} }
}
$result = get_config("vier", $key); $result = get_config("vier", $key);
if ($result !== false) if ($result !== false) {
return $result; return $result;
}
return $default; return $default;
} }
@ -131,7 +134,7 @@ function vier_community_info() {
$show_friends = get_vier_config("show_friends", 1); $show_friends = get_vier_config("show_friends", 1);
$show_lastusers = get_vier_config("show_lastusers", 1); $show_lastusers = get_vier_config("show_lastusers", 1);
//get_baseurl // get_baseurl
$url = App::get_baseurl($ssl_state); $url = App::get_baseurl($ssl_state);
$aside['$url'] = $url; $aside['$url'] = $url;
@ -161,7 +164,7 @@ function vier_community_info() {
// last 9 users // last 9 users
if ($show_lastusers) { if ($show_lastusers) {
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 "); $publish = (get_config('system', 'publish_all') ? '' : " AND `publish` = 1 ");
$order = " ORDER BY `register_date` DESC "; $order = " ORDER BY `register_date` DESC ";
$tpl = get_markup_template('ch_directory_item.tpl'); $tpl = get_markup_template('ch_directory_item.tpl');
@ -191,12 +194,12 @@ function vier_community_info() {
//right_aside FIND FRIENDS //right_aside FIND FRIENDS
if ($show_friends AND local_user()) { if ($show_friends AND local_user()) {
$nv = array(); $nv = array();
$nv['title'] = Array("", t('Find Friends'), "", ""); $nv['title'] = array("", t('Find Friends'), "", "");
$nv['directory'] = Array('directory', t('Local Directory'), "", ""); $nv['directory'] = array('directory', t('Local Directory'), "", "");
$nv['global_directory'] = Array(get_server(), t('Global Directory'), "", ""); $nv['global_directory'] = Array(get_server(), t('Global Directory'), "", "");
$nv['match'] = Array('match', t('Similar Interests'), "", ""); $nv['match'] = array('match', t('Similar Interests'), "", "");
$nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", ""); $nv['suggest'] = array('suggest', t('Friend Suggestions'), "", "");
$nv['invite'] = Array('invite', t('Invite Friends'), "", ""); $nv['invite'] = array('invite', t('Invite Friends'), "", "");
$nv['search'] = '<form name="simple_bar" method="get" action="dirfind"> $nv['search'] = '<form name="simple_bar" method="get" action="dirfind">
<span class="sbox_l"></span> <span class="sbox_l"></span>
@ -211,10 +214,11 @@ function vier_community_info() {
//Community_Pages at right_aside //Community_Pages at right_aside
if ($show_pages AND local_user()) { if ($show_pages AND local_user()) {
require_once('include/ForumManager.php'); require_once 'include/ForumManager.php';
if (x($_GET['cid']) && intval($_GET['cid']) != 0) if (x($_GET, 'cid') && intval($_GET['cid']) != 0) {
$cid = $_GET['cid']; $cid = $_GET['cid'];
}
//sort by last updated item //sort by last updated item
$lastitem = true; $lastitem = true;
@ -227,7 +231,7 @@ function vier_community_info() {
$id = 0; $id = 0;
foreach($contacts as $contact) { foreach ($contacts as $contact) {
$selected = (($cid == $contact['id']) ? ' forum-selected' : ''); $selected = (($cid == $contact['id']) ? ' forum-selected' : '');
@ -246,7 +250,7 @@ function vier_community_info() {
$tpl = get_markup_template('widget_forumlist_right.tpl'); $tpl = get_markup_template('widget_forumlist_right.tpl');
$page .= replace_macros($tpl,array( $page .= replace_macros($tpl, array(
'$title' => t('Forums'), '$title' => t('Forums'),
'$forums' => $entries, '$forums' => $entries,
'$link_desc' => t('External link to forum'), '$link_desc' => t('External link to forum'),
@ -258,9 +262,9 @@ function vier_community_info() {
$aside['$page'] = $page; $aside['$page'] = $page;
} }
} }
//END Community Page // END Community Page
//helpers // helpers
if ($show_helpers) { if ($show_helpers) {
$r = array(); $r = array();
@ -283,14 +287,14 @@ function vier_community_info() {
foreach ($r AS $index => $helper) foreach ($r AS $index => $helper)
$r[$index]["url"] = zrl($helper["url"]); $r[$index]["url"] = zrl($helper["url"]);
$r[] = Array("url" => "help/Quick-Start-guide", "name" => t("Quick Start")); $r[] = array("url" => "help/Quick-Start-guide", "name" => t("Quick Start"));
$tpl = get_markup_template('ch_helpers.tpl'); $tpl = get_markup_template('ch_helpers.tpl');
if ($r) { if ($r) {
$helpers = array(); $helpers = array();
$helpers['title'] = Array("", t('Help'), "", ""); $helpers['title'] = array("", t('Help'), "", "");
$aside['$helpers_items'] = array(); $aside['$helpers_items'] = array();
@ -305,9 +309,9 @@ function vier_community_info() {
$aside['$helpers'] = $helpers; $aside['$helpers'] = $helpers;
} }
} }
//end helpers // end helpers
//connectable services // connectable services
if ($show_services) { if ($show_services) {
/// @TODO This whole thing is hard-coded, better rewrite to Intercepting Filter Pattern (future-todo) /// @TODO This whole thing is hard-coded, better rewrite to Intercepting Filter Pattern (future-todo)
@ -345,6 +349,7 @@ function vier_community_info() {
$r[] = array("photo" => "images/googleplus.png", "name" => "Google+"); $r[] = array("photo" => "images/googleplus.png", "name" => "Google+");
} }
/// @TODO old-lost code (and below)?
//if (plugin_enabled("ijpost")) { //if (plugin_enabled("ijpost")) {
// $r[] = array("photo" => "images/", "name" => ""); // $r[] = array("photo" => "images/", "name" => "");
//} //}
@ -382,7 +387,7 @@ function vier_community_info() {
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
$con_services = array(); $con_services = array();
$con_services['title'] = Array("", t('Connect Services'), "", ""); $con_services['title'] = array("", t('Connect Services'), "", "");
$aside['$con_services'] = $con_services; $aside['$con_services'] = $con_services;
foreach ($r as $rr) { foreach ($r as $rr) {