Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: (25 commits) diabook: theme.php remove code duplication last photos check for user "hidewall" remove unneeded regex move js code to close popup in main.js (missing stop event propagation in popup links) user settings: don't show emoticons fix in css right_aside small fix fix 1024resolution add right_aside to theme diabook ability to change tags in edited posts normalise comparison link on delegation page quattro(-green) styling the 'filed under: remove' text it's only item.filer ;-) non static filer text new lines removed removed some new lines to cut down number of changed files removed unneccessary stuff removed problem from previous commit tests for the template engine adding filer functionality to quattro(-green) missing tooltip for "file as" prevent re-registrations using a deleted username - not an issue with Friendica but could create a serious privacy issue with federated platforms add file_as-option to diabook-derivates ... * master:
This commit is contained in:
commit
803f79e091
43 changed files with 5589 additions and 127 deletions
|
@ -5,9 +5,6 @@ AddType audio/ogg .oga
|
|||
<FilesMatch "\.(out|log)$">
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
<Files "(include|library)">
|
||||
Deny from all
|
||||
</Files>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
|
|
4
boot.php
4
boot.php
|
@ -9,9 +9,9 @@ require_once('include/nav.php');
|
|||
require_once('include/cache.php');
|
||||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1288' );
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1289' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1132 );
|
||||
define ( 'DB_UPDATE_VERSION', 1133 );
|
||||
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
|
|
@ -861,3 +861,9 @@ INDEX ( `term` )
|
|||
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `userd` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`username` CHAR( 255 ) NOT NULL,
|
||||
INDEX ( `username` )
|
||||
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -15,6 +15,12 @@ function user_remove($uid) {
|
|||
|
||||
call_hooks('remove_user',$r[0]);
|
||||
|
||||
// save username (actually the nickname as it is guaranteed
|
||||
// unique), so it cannot be re-registered in the future.
|
||||
|
||||
q("insert into userd ( username ) values ( '%s' )",
|
||||
$r[0]['nickname']
|
||||
);
|
||||
|
||||
q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid));
|
||||
q("DELETE FROM `group` WHERE `uid` = %d", intval($uid));
|
||||
|
|
|
@ -1582,9 +1582,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['uid'])
|
||||
|
@ -1727,9 +1728,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['uid'])
|
||||
|
@ -1800,7 +1802,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
// but otherwise there's a possible data mixup on the sender's system.
|
||||
// the tgroup delivery code called from item_store will correct it if it's a forum,
|
||||
// but we're going to unconditionally correct it here so that the post will always be owned by our contact.
|
||||
logger('local_delivery: Correcting item owner.', LOGGER_DEBUG);
|
||||
logger('consume_feed: Correcting item owner.', LOGGER_DEBUG);
|
||||
$datarray['owner-name'] = $contact['name'];
|
||||
$datarray['owner-link'] = $contact['url'];
|
||||
$datarray['owner-avatar'] = $contact['thumb'];
|
||||
|
@ -2332,9 +2334,10 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['importer_uid'])
|
||||
|
@ -2497,9 +2500,10 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['importer_uid'])
|
||||
|
|
|
@ -1338,3 +1338,16 @@ function file_tag_unsave_file($uid,$item,$file) {
|
|||
function normalise_openid($s) {
|
||||
return trim(str_replace(array('http://','https://'),array('',''),$s),'/');
|
||||
}
|
||||
|
||||
|
||||
function undo_post_tagging($s) {
|
||||
$matches = null;
|
||||
$cnt = preg_match_all('/([@#])\[url=(.*?)\](.*?)\[\/url\]/ism',$s,$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
19
js/main.js
19
js/main.js
|
@ -28,13 +28,15 @@
|
|||
var in_progress = false;
|
||||
var langSelect = false;
|
||||
var commentBusy = false;
|
||||
var last_popup_menu = null;
|
||||
var last_popup_button = null;
|
||||
|
||||
$(function() {
|
||||
$.ajaxSetup({cache: false});
|
||||
|
||||
msie = $.browser.msie ;
|
||||
|
||||
/* setup tooltips */
|
||||
/* setup tooltips *//*
|
||||
$("a,.tt").each(function(){
|
||||
var e = $(this);
|
||||
var pos="bottom";
|
||||
|
@ -43,7 +45,7 @@
|
|||
if (e.hasClass("ttleft")) pos="left";
|
||||
if (e.hasClass("ttright")) pos="right";
|
||||
e.tipTip({defaultPosition: pos, edgeOffset: 8});
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
|
@ -76,8 +78,21 @@
|
|||
if (menu.attr('popup')=="false") return false;
|
||||
$(this).parent().toggleClass("selected");
|
||||
menu.toggle();
|
||||
if (menu.css("display") == "none") {
|
||||
last_popup_menu = null;
|
||||
last_popup_button = null;
|
||||
} else {
|
||||
last_popup_menu = menu;
|
||||
last_popup_button = $(this).parent();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('html').click(function() {
|
||||
last_popup_menu.hide();
|
||||
last_popup_button.removeClass("selected");
|
||||
last_popup_menu = null;
|
||||
last_popup_button = null;
|
||||
});
|
||||
|
||||
// fancyboxes
|
||||
$("a.popupbox").fancybox({
|
||||
|
|
|
@ -86,7 +86,7 @@ function delegate_content(&$a) {
|
|||
|
||||
$r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
|
||||
and contact.uid = %d and contact.self = 0 and network = '%s' ",
|
||||
dbesc($a->get_baseurl()),
|
||||
dbesc(normalise_link($a->get_baseurl())),
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_DFRN)
|
||||
);
|
||||
|
|
|
@ -104,7 +104,7 @@ function editpost_content(&$a) {
|
|||
'$wait' => t('Please wait'),
|
||||
'$permset' => t('Permission settings'),
|
||||
'$ptyp' => $itm[0]['type'],
|
||||
'$content' => $itm[0]['body'],
|
||||
'$content' => undo_post_tagging($itm[0]['body']),
|
||||
'$post_id' => $post_id,
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$defloc' => $a->user['default-location'],
|
||||
|
|
19
mod/item.php
19
mod/item.php
|
@ -177,10 +177,11 @@ function item_post(&$a) {
|
|||
$verb = $orig_post['verb'];
|
||||
$emailcc = $orig_post['emailcc'];
|
||||
$app = $orig_post['app'];
|
||||
|
||||
$categories = $orig_post['file'];
|
||||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
$private = $orig_post['private'];
|
||||
$pubmail_enable = $orig_post['pubmail'];
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -213,8 +214,10 @@ function item_post(&$a) {
|
|||
$coord = notags(trim($_REQUEST['coord']));
|
||||
$verb = notags(trim($_REQUEST['verb']));
|
||||
$emailcc = notags(trim($_REQUEST['emailcc']));
|
||||
|
||||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
|
||||
// $categories = TODO
|
||||
|
||||
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
|
||||
|
||||
if(($parent_item) &&
|
||||
|
@ -242,8 +245,6 @@ function item_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(! strlen($body)) {
|
||||
if($preview)
|
||||
killme();
|
||||
|
@ -500,6 +501,7 @@ function item_post(&$a) {
|
|||
$datarray['location'] = $location;
|
||||
$datarray['coord'] = $coord;
|
||||
$datarray['tag'] = $str_tags;
|
||||
$datarray['file'] = $categories;
|
||||
$datarray['inform'] = $inform;
|
||||
$datarray['verb'] = $verb;
|
||||
$datarray['allow_cid'] = $str_contact_allow;
|
||||
|
@ -559,9 +561,12 @@ function item_post(&$a) {
|
|||
|
||||
|
||||
if($orig_post) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($title),
|
||||
dbesc($body),
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc($datarray['attach']),
|
||||
dbesc($datarray['file']),
|
||||
dbesc(datetime_convert()),
|
||||
intval($post_id),
|
||||
intval($profile_uid)
|
||||
|
|
|
@ -150,6 +150,16 @@ function register_post(&$a) {
|
|||
if(count($r))
|
||||
$err .= t('Nickname is already registered. Please choose another.') . EOL;
|
||||
|
||||
// Check deleted accounts that had this nickname. Doesn't matter to us,
|
||||
// but could be a security issue for federated platforms.
|
||||
|
||||
$r = q("SELECT * FROM `userd`
|
||||
WHERE `username` = '%s' LIMIT 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
if(count($r))
|
||||
$err .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
|
||||
|
||||
if(strlen($err)) {
|
||||
notice( $err );
|
||||
return;
|
||||
|
|
|
@ -64,6 +64,11 @@ function user_allow($hash) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// This does not have to go through user_remove() and save the nickname
|
||||
// permanently against re-registration, as the person was not yet
|
||||
// allowed to have friends on this system
|
||||
|
||||
function user_deny($hash) {
|
||||
|
||||
$register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
|
||||
|
|
|
@ -263,7 +263,7 @@ function settings_post(&$a) {
|
|||
$suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
|
||||
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
|
||||
$hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
|
||||
|
||||
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
|
||||
|
||||
$notify = 0;
|
||||
|
||||
|
@ -347,6 +347,7 @@ function settings_post(&$a) {
|
|||
set_pconfig(local_user(),'system','suggestme', $suggestme);
|
||||
set_pconfig(local_user(),'system','update_interval', $browser_update);
|
||||
set_pconfig(local_user(),'system','itemspage_network', $itemspage_network);
|
||||
set_pconfig(local_user(),'system','no_smilies',$nosmile);
|
||||
|
||||
$r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1",
|
||||
dbesc($username),
|
||||
|
@ -674,6 +675,9 @@ function settings_content(&$a) {
|
|||
$itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network'));
|
||||
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
|
||||
|
||||
$nosmile = get_pconfig(local_user(),'system','no_smilies');
|
||||
$nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0
|
||||
|
||||
if(! strlen($a->user['timezone']))
|
||||
$timezone = date_default_timezone_get();
|
||||
|
||||
|
@ -841,6 +845,7 @@ function settings_content(&$a) {
|
|||
'$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes),
|
||||
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
|
||||
'$itemspage_network' => array('itemspage_network', t("Number of items to display on the network page:"), $itemspage_network, t('Maximum of 100 items')),
|
||||
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
|
||||
|
||||
'$h_prv' => t('Security and Privacy Settings'),
|
||||
|
||||
|
|
224
tests/template_test.php
Executable file
224
tests/template_test.php
Executable file
|
@ -0,0 +1,224 @@
|
|||
<?php
|
||||
/**
|
||||
* this file contains tests for the template engine
|
||||
*
|
||||
* @package test.util
|
||||
*/
|
||||
|
||||
/** required, it is the file under test */
|
||||
require_once('include/template_processor.php');
|
||||
require_once('include/text.php');
|
||||
|
||||
class TemplateMockApp {
|
||||
public $theme_info=array();
|
||||
}
|
||||
|
||||
if(!function_exists('current_theme')) {
|
||||
function current_theme() {
|
||||
return 'clean';
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('x')) {
|
||||
function x($s,$k = NULL) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('get_app')) {
|
||||
function get_app() {
|
||||
return new TemplateMockApp();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TestCase for the template engine
|
||||
*
|
||||
* @author Alexander Kampmann
|
||||
* @package test.util
|
||||
*/
|
||||
class TemplateTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
public function setUp() {
|
||||
global $t;
|
||||
$t=new Template;
|
||||
}
|
||||
|
||||
public function testListToShort() {
|
||||
@list($first, $second)=array('first');
|
||||
|
||||
$this->assertTrue(is_null($second));
|
||||
}
|
||||
|
||||
public function testSimpleVariableString() {
|
||||
$tpl='Hello $name!';
|
||||
|
||||
$text=replace_macros($tpl, array('$name'=>'Anna'));
|
||||
|
||||
$this->assertEquals('Hello Anna!', $text);
|
||||
}
|
||||
|
||||
public function testSimpleVariableInt() {
|
||||
$tpl='There are $num new messages!';
|
||||
|
||||
$text=replace_macros($tpl, array('$num'=>172));
|
||||
|
||||
$this->assertEquals('There are 172 new messages!', $text);
|
||||
}
|
||||
|
||||
public function testConditionalElse() {
|
||||
$tpl='There{{ if $num!=1 }} are $num new messages{{ else }} is 1 new message{{ endif }}!';
|
||||
|
||||
$text1=replace_macros($tpl, array('$num'=>1));
|
||||
$text22=replace_macros($tpl, array('$num'=>22));
|
||||
|
||||
$this->assertEquals('There is 1 new message!', $text1);
|
||||
$this->assertEquals('There are 22 new messages!', $text22);
|
||||
}
|
||||
|
||||
public function testConditionalNoElse() {
|
||||
$tpl='{{ if $num!=0 }}There are $num new messages!{{ endif }}';
|
||||
|
||||
$text0=replace_macros($tpl, array('$num'=>0));
|
||||
$text22=replace_macros($tpl, array('$num'=>22));
|
||||
|
||||
$this->assertEquals('', $text0);
|
||||
$this->assertEquals('There are 22 new messages!', $text22);
|
||||
}
|
||||
|
||||
public function testConditionalFail() {
|
||||
$tpl='There {{ if $num!=1 }} are $num new messages{{ else }} is 1 new message{{ endif }}!';
|
||||
|
||||
$text1=replace_macros($tpl, array());
|
||||
|
||||
//$this->assertEquals('There is 1 new message!', $text1);
|
||||
}
|
||||
|
||||
public function testSimpleFor() {
|
||||
$tpl='{{ for $messages as $message }} $message {{ endfor }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>array('message 1', 'message 2')));
|
||||
|
||||
$this->assertEquals(' message 1 message 2 ', $text);
|
||||
}
|
||||
|
||||
public function testFor() {
|
||||
$tpl='{{ for $messages as $message }} from: $message.from to $message.to {{ endfor }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>array(array('from'=>'Mike', 'to'=>'Alex'), array('from'=>'Alex', 'to'=>'Mike'))));
|
||||
|
||||
$this->assertEquals(' from: Mike to Alex from: Alex to Mike ', $text);
|
||||
}
|
||||
|
||||
public function testKeyedFor() {
|
||||
$tpl='{{ for $messages as $from=>$to }} from: $from to $to {{ endfor }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>array('Mike'=>'Alex', 'Sven'=>'Mike')));
|
||||
|
||||
$this->assertEquals(' from: Mike to Alex from: Sven to Mike ', $text);
|
||||
}
|
||||
|
||||
public function testForEmpty() {
|
||||
$tpl='messages: {{for $messages as $message}} from: $message.from to $message.to {{ endfor }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>array()));
|
||||
|
||||
$this->assertEquals('messages: ', $text);
|
||||
}
|
||||
|
||||
public function testForWrongType() {
|
||||
$tpl='messages: {{for $messages as $message}} from: $message.from to $message.to {{ endfor }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>11));
|
||||
|
||||
$this->assertEquals('messages: ', $text);
|
||||
}
|
||||
|
||||
public function testForConditional() {
|
||||
$tpl='new messages: {{for $messages as $message}}{{ if $message.new }} $message.text{{endif}}{{ endfor }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>array(
|
||||
array('new'=>true, 'text'=>'new message'),
|
||||
array('new'=>false, 'text'=>'old message'))));
|
||||
|
||||
$this->assertEquals('new messages: new message', $text);
|
||||
}
|
||||
|
||||
public function testConditionalFor() {
|
||||
$tpl='{{ if $enabled }}new messages:{{for $messages as $message}} $message.text{{ endfor }}{{endif}}';
|
||||
|
||||
$text=replace_macros($tpl, array('$enabled'=>true,
|
||||
'$messages'=>array(
|
||||
array('new'=>true, 'text'=>'new message'),
|
||||
array('new'=>false, 'text'=>'old message'))));
|
||||
|
||||
$this->assertEquals('new messages: new message old message', $text);
|
||||
}
|
||||
|
||||
public function testFantasy() {
|
||||
$tpl='Fantasy: {{fantasy $messages}}';
|
||||
|
||||
$text=replace_macros($tpl, array('$messages'=>'no no'));
|
||||
|
||||
$this->assertEquals('Fantasy: {{fantasy no no}}', $text);
|
||||
}
|
||||
|
||||
public function testInc() {
|
||||
$tpl='{{inc field_input.tpl with $field=$myvar}}{{ endinc }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$myvar'=>array('myfield', 'label', 'value', 'help')));
|
||||
|
||||
$this->assertEquals(" \n"
|
||||
." <div class='field input'>\n"
|
||||
." <label for='id_myfield'>label</label>\n"
|
||||
." <input name='myfield' id='id_myfield' value=\"value\">\n"
|
||||
." <span class='field_help'>help</span>\n"
|
||||
." </div>\n", $text);
|
||||
}
|
||||
|
||||
public function testIncNoVar() {
|
||||
$tpl='{{inc field_input.tpl }}{{ endinc }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$field'=>array('myfield', 'label', 'value', 'help')));
|
||||
|
||||
$this->assertEquals(" \n <div class='field input'>\n <label for='id_myfield'>label</label>\n"
|
||||
." <input name='myfield' id='id_myfield' value=\"value\">\n"
|
||||
." <span class='field_help'>help</span>\n"
|
||||
." </div>\n", $text);
|
||||
}
|
||||
|
||||
public function testDoubleUse() {
|
||||
$tpl='Hello $name! {{ if $enabled }} I love you! {{ endif }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$name'=>'Anna', '$enabled'=>false));
|
||||
|
||||
$this->assertEquals('Hello Anna! ', $text);
|
||||
|
||||
$tpl='Hey $name! {{ if $enabled }} I hate you! {{ endif }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$name'=>'Max', '$enabled'=>true));
|
||||
|
||||
$this->assertEquals('Hey Max! I hate you! ', $text);
|
||||
}
|
||||
|
||||
public function testIncDouble() {
|
||||
$tpl='{{inc field_input.tpl with $field=$var1}}{{ endinc }}'
|
||||
.'{{inc field_input.tpl with $field=$var2}}{{ endinc }}';
|
||||
|
||||
$text=replace_macros($tpl, array('$var1'=>array('myfield', 'label', 'value', 'help'),
|
||||
'$var2'=>array('myfield2', 'label2', 'value2', 'help2')));
|
||||
|
||||
$this->assertEquals(" \n"
|
||||
." <div class='field input'>\n"
|
||||
." <label for='id_myfield'>label</label>\n"
|
||||
." <input name='myfield' id='id_myfield' value=\"value\">\n"
|
||||
." <span class='field_help'>help</span>\n"
|
||||
." </div>\n"
|
||||
." \n"
|
||||
." <div class='field input'>\n"
|
||||
." <label for='id_myfield2'>label2</label>\n"
|
||||
." <input name='myfield2' id='id_myfield2' value=\"value2\">\n"
|
||||
." <span class='field_help'>help2</span>\n"
|
||||
." </div>\n", $text);
|
||||
}
|
||||
}
|
|
@ -27,12 +27,33 @@ class AntiXSSTest extends PHPUnit_Framework_TestCase {
|
|||
*/
|
||||
public function testXmlify() {
|
||||
$text="<tag>I want to break\n this!11!<?hard?></tag>";
|
||||
$xml=xmlify($text); //test whether it actually may be part of a xml document
|
||||
$xml=xmlify($text);
|
||||
$retext=unxmlify($text);
|
||||
|
||||
$this->assertEquals($text, $retext);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlify and put in a document
|
||||
*/
|
||||
public function testXmlifyDocument() {
|
||||
$tag="<tag>I want to break</tag>";
|
||||
$xml=xmlify($tag);
|
||||
$text='<text>'.$xml.'</text>';
|
||||
|
||||
$xml_parser=xml_parser_create();
|
||||
//should be possible to parse it
|
||||
$values=array(); $index=array();
|
||||
$this->assertEquals(1, xml_parse_into_struct($xml_parser, $text, $values, $index));
|
||||
|
||||
$this->assertEquals(array('TEXT'=>array(0)),
|
||||
$index);
|
||||
$this->assertEquals(array(array('tag'=>'TEXT', 'type'=>'complete', 'level'=>1, 'value'=>$tag)),
|
||||
$values);
|
||||
|
||||
xml_parser_free($xml_parser);
|
||||
}
|
||||
|
||||
/**
|
||||
* test hex2bin and reverse
|
||||
*/
|
||||
|
|
11
update.php
11
update.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1132 );
|
||||
define( 'UPDATE_VERSION' , 1133 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1127,3 +1127,12 @@ function update_1131() {
|
|||
}
|
||||
|
||||
|
||||
function update_1132() {
|
||||
q("CREATE TABLE IF NOT EXISTS `userd` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`username` CHAR( 255 ) NOT NULL,
|
||||
INDEX ( `username` )
|
||||
) ENGINE = MYISAM ");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<section><?php if(x($page,'content')) echo $page['content']; ?>
|
||||
<div id="page-footer"></div>
|
||||
</section>
|
||||
<right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
|
||||
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -31,7 +31,7 @@ $nickname_block
|
|||
{{inc field_select.tpl with $field=$theme }}{{endinc}}
|
||||
{{inc field_input.tpl with $field=$ajaxint }}{{endinc}}
|
||||
{{inc field_input.tpl with $field=$itemspage_network }}{{endinc}}
|
||||
|
||||
{{inc field_checkbox.tpl with $field=$nosmile}}{{endinc}}
|
||||
|
||||
<div class="settings-submit-wrapper" >
|
||||
<input type="submit" name="submit" class="settings-submit" value="$submit" />
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
|
||||
{{ endif }}
|
||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
|
||||
{{ endif }}
|
||||
|
||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
|
||||
{{ endif }}
|
||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
|
||||
{{ endif }}
|
||||
|
||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||
|
|
BIN
view/theme/diabook-blue/icons/file_as.png
Executable file
BIN
view/theme/diabook-blue/icons/file_as.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 352 B |
|
@ -102,6 +102,7 @@
|
|||
.icon.recycle { background-image: url("../../../view/theme/diabook-blue/icons/recycle.png");}
|
||||
.icon.remote-link { background-image: url("../../../view/theme/diabook-blue/icons/remote.png");}
|
||||
.icon.tagged { background-image: url("../../../view/theme/diabook-blue/icons/tagged.png");}
|
||||
.icon.file-as { background-image: url("../../../view/theme/diabook-blue/icons/file_as.png");}
|
||||
.star-item.icon.unstarred { background-image: url("../../../view/theme/diabook-blue/icons/unstarred.png");}
|
||||
.star-item.icon.starred { background-image: url("../../../view/theme/diabook-blue/icons/starred.png");}
|
||||
.icon.link { background-image: url("../../../view/theme/diabook-blue/icons/link.png");}
|
||||
|
|
|
@ -66,6 +66,10 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item icon file-as" title="$item.star.filer"></a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.plink }}<a class="icon link" title="$item.plink.title" href="$item.plink.href">$item.plink.title</a>{{ endif }}
|
||||
|
||||
|
||||
|
|
43
view/theme/diabook/communityhome.tpl
Executable file
43
view/theme/diabook/communityhome.tpl
Executable file
|
@ -0,0 +1,43 @@
|
|||
{{ if $lastusers_title }}
|
||||
<h3 style="margin-top:0px;">Help or #NewHere?</h3>
|
||||
<a href="https://helpers.pyxis.uberspace.de/profile/helpers" style="margin-left: 10px; color:#000;" title="Friendica Support" target="blank">Friendica Support</a><br>
|
||||
<a href="https://letstalk.pyxis.uberspace.de/profile/letstalk" style="margin-left: 10px; color:#000;" title="Let's talk" target="blank">Let's talk</a><br>
|
||||
<a href="http://kakste.com/profile/newhere" title="#NewHere" style="margin-left: 10px; color:#000;" target="blank">NewHere</a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $lastusers_title }}
|
||||
<h3>$lastusers_title</h3>
|
||||
<div class='items-wrapper'>
|
||||
{{ for $lastusers_items as $i }}
|
||||
$i
|
||||
{{ endfor }}
|
||||
</div>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $activeusers_title }}
|
||||
<h3>$activeusers_title</h3>
|
||||
<div class='items-wrapper'>
|
||||
{{ for $activeusers_items as $i }}
|
||||
$i
|
||||
{{ endfor }}
|
||||
</div>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $photos_title }}
|
||||
<h3>$photos_title</h3>
|
||||
<div class='items-wrapper'>
|
||||
{{ for $photos_items as $i }}
|
||||
$i
|
||||
{{ endfor }}
|
||||
</div>
|
||||
{{ endif }}
|
||||
|
||||
|
||||
{{ if $like_title }}
|
||||
<h3>$like_title</h3>
|
||||
<ul id='likes'>
|
||||
{{ for $like_items as $i }}
|
||||
<li>$i</li>
|
||||
{{ endfor }}
|
||||
</ul>
|
||||
{{ endif }}
|
10
view/theme/diabook/directory_item.tpl
Executable file
10
view/theme/diabook/directory_item.tpl
Executable file
|
@ -0,0 +1,10 @@
|
|||
|
||||
<div class="directory-item" id="directory-item-$id" >
|
||||
<div class="directory-photo-wrapper" id="directory-photo-wrapper-$id" >
|
||||
<div class="directory-photo" id="directory-photo-$id" >
|
||||
<a href="$profile-link" class="directory-profile-link" id="directory-profile-link-$id" >
|
||||
<img class="directory-photo-img" src="$photo" alt="$alt-text" title="$alt-text" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
BIN
view/theme/diabook/icons/file_as.png
Executable file
BIN
view/theme/diabook/icons/file_as.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 352 B |
|
@ -11,7 +11,7 @@
|
|||
<li id="profile-side-photos" class="menu-profile-list photos"><a class="menu-profile-list-item" href="$ps.usermenu.photos.0">$ps.usermenu.photos.1</a></li>
|
||||
<li id="profile-side-events" class="menu-profile-list events"><a class="menu-profile-list-item" href="$ps.usermenu.events.0">$ps.usermenu.events.1</a></li>
|
||||
<li id="profile-side-notes" class="menu-profile-list notes"><a class="menu-profile-list-item" href="$ps.usermenu.notes.0">$ps.usermenu.notes.1</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list foren"><a class="menu-profile-list-item" href="http://dir.friendika.com/directory/forum" target="blanc">Public Groups</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list foren"><a class="menu-profile-list-item" href="$ps.usermenu.pgroups.0" target="blanc">$ps.usermenu.pgroups.1</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list com_side"><a class="menu-profile-list-item" href="$ps.usermenu.community.0">$ps.usermenu.community.1</a></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
|
||||
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo?rev=$profile.picdate" alt="$profile.name" /></div>
|
||||
<div id="profile-photo-wrapper"><img class="photo" width="155" height="155" src="$profile.photo?rev=$profile.picdate" alt="$profile.name" /></div>
|
||||
|
||||
|
||||
|
||||
|
|
20
view/theme/diabook/right_aside.tpl
Normal file
20
view/theme/diabook/right_aside.tpl
Normal file
|
@ -0,0 +1,20 @@
|
|||
<div id="profile_side">
|
||||
<div id="ps-usernameicon">
|
||||
<a href="$ps.usermenu.status.0" title="$userinfo.name">
|
||||
<img src="$userinfo.icon" id="ps-usericon" alt="$userinfo.name">
|
||||
</a>
|
||||
<a href="$ps.usermenu.status.0" id="ps-username" title="$userinfo.name">$userinfo.name</a>
|
||||
</div>
|
||||
|
||||
<ul id="profile-side-menu" class="menu-profile-side">
|
||||
<li id="profile-side-status" class="menu-profile-list home"><a class="menu-profile-list-item" href="$ps.usermenu.status.0">$ps.usermenu.status.1</a></li>
|
||||
<li id="profile-side-photos" class="menu-profile-list photos"><a class="menu-profile-list-item" href="$ps.usermenu.photos.0">$ps.usermenu.photos.1</a></li>
|
||||
<li id="profile-side-events" class="menu-profile-list events"><a class="menu-profile-list-item" href="$ps.usermenu.events.0">$ps.usermenu.events.1</a></li>
|
||||
<li id="profile-side-notes" class="menu-profile-list notes"><a class="menu-profile-list-item" href="$ps.usermenu.notes.0">$ps.usermenu.notes.1</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list foren"><a class="menu-profile-list-item" href="http://dir.friendika.com/directory/forum" target="blanc">Public Groups</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list com_side"><a class="menu-profile-list-item" href="$ps.usermenu.community.0">$ps.usermenu.community.1</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
2461
view/theme/diabook/style-network.css
Normal file
2461
view/theme/diabook/style-network.css
Normal file
File diff suppressed because it is too large
Load diff
2461
view/theme/diabook/style-profile.css
Normal file
2461
view/theme/diabook/style-profile.css
Normal file
File diff suppressed because it is too large
Load diff
|
@ -11,109 +11,195 @@ $a->theme_info = array(
|
|||
'extends' => 'diabook',
|
||||
);
|
||||
|
||||
//profile_side
|
||||
//change css on network and profilepages
|
||||
$cssFile = null;
|
||||
|
||||
|
||||
/**
|
||||
* prints last community activity
|
||||
*/
|
||||
function diabook_community_info(){
|
||||
$a = get_app();
|
||||
//right_aside at networkpages
|
||||
|
||||
$nav['usermenu']=array();
|
||||
$userinfo = null;
|
||||
// last 12 users
|
||||
$aside['$lastusers_title'] = t('Last users');
|
||||
$aside['$lastusers_items'] = array();
|
||||
$sql_extra = "";
|
||||
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
|
||||
$order = " ORDER BY `register_date` DESC ";
|
||||
|
||||
if(local_user()) {
|
||||
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
|
||||
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
|
||||
0,
|
||||
12
|
||||
);
|
||||
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
|
||||
if(count($r)) {
|
||||
$photo = 'thumb';
|
||||
foreach($r as $rr) {
|
||||
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||
$entry = replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$profile-link' => $profile_link,
|
||||
'$photo' => $rr[$photo],
|
||||
'$alt-text' => $rr['name'],
|
||||
));
|
||||
$aside['$lastusers_items'][] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// last 10 liked items
|
||||
$aside['$like_title'] = t('Last likes');
|
||||
$aside['$like_items'] = array();
|
||||
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
|
||||
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
|
||||
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
|
||||
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
|
||||
WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
|
||||
GROUP BY `uri`
|
||||
ORDER BY `T1`.`created` DESC
|
||||
LIMIT 0,10",
|
||||
$a->get_baseurl(),$a->get_baseurl()
|
||||
);
|
||||
|
||||
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
|
||||
foreach ($r as $rr) {
|
||||
$author = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
|
||||
$objauthor = '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
|
||||
|
||||
$userinfo = array(
|
||||
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
|
||||
'name' => $a->user['username'],
|
||||
);
|
||||
//var_dump($rr['verb'],$rr['object-type']); killme();
|
||||
switch($rr['verb']){
|
||||
case 'http://activitystrea.ms/schema/1.0/post':
|
||||
switch ($rr['object-type']){
|
||||
case 'http://activitystrea.ms/schema/1.0/event':
|
||||
$post_type = t('event');
|
||||
break;
|
||||
default:
|
||||
$post_type = t('status');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($rr['resource-id']){
|
||||
$post_type = t('photo');
|
||||
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
||||
$rr['plink'] = $m[1];
|
||||
} else {
|
||||
$post_type = t('status');
|
||||
}
|
||||
}
|
||||
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
|
||||
|
||||
$ps['usermenu'][status] = Array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
|
||||
$ps['usermenu'][profile] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
|
||||
$ps['usermenu'][photos] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
|
||||
$ps['usermenu'][events] = Array('events/', t('Events'), "", t('Your events'));
|
||||
$ps['usermenu'][notes] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
|
||||
$ps['usermenu'][community] = Array('community/', t('Community'), "", "");
|
||||
$aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
|
||||
|
||||
if($is_url = preg_match ("/\bnetwork\b/i", $_SERVER['REQUEST_URI'])) {
|
||||
$tpl = get_markup_template('profile_side.tpl');
|
||||
}
|
||||
|
||||
|
||||
// last 12 photos
|
||||
$aside['$photos_title'] = t('Last photos');
|
||||
$aside['$photos_items'] = array();
|
||||
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
|
||||
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
|
||||
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
|
||||
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
|
||||
INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
|
||||
`user`
|
||||
WHERE `user`.`uid` = `photo`.`uid`
|
||||
AND `user`.`blockwall`=0
|
||||
AND `user`.`hidewall`=0
|
||||
ORDER BY `photo`.`edited` DESC
|
||||
LIMIT 0, 12",
|
||||
dbesc(t('Contact Photos')),
|
||||
dbesc(t('Profile Photos'))
|
||||
);
|
||||
if(count($r)) {
|
||||
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
|
||||
foreach($r as $rr) {
|
||||
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
|
||||
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
|
||||
|
||||
$entry = replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$profile-link' => $photo_page,
|
||||
'$photo' => $photo_url,
|
||||
'$alt-text' => $rr['username']." : ".$rr['desc'],
|
||||
));
|
||||
|
||||
$aside['$photos_items'][] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
|
||||
$a->page['right_aside'] = replace_macros($tpl, $aside);
|
||||
|
||||
$a->page['aside'] .= replace_macros($tpl, array(
|
||||
'$userinfo' => $userinfo,
|
||||
'$ps' => $ps,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
//profile_side at networkpages
|
||||
if ($a->argv[0] === "network"){
|
||||
|
||||
// USER MENU
|
||||
if(local_user()) {
|
||||
|
||||
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
|
||||
|
||||
$userinfo = array(
|
||||
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
|
||||
'name' => $a->user['username'],
|
||||
);
|
||||
$ps = array('usermenu'=>array());
|
||||
$ps['usermenu']['status'] = Array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
|
||||
$ps['usermenu']['profile'] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
|
||||
$ps['usermenu']['photos'] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
|
||||
$ps['usermenu']['events'] = Array('events/', t('Events'), "", t('Your events'));
|
||||
$ps['usermenu']['notes'] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
|
||||
$ps['usermenu']['community'] = Array('community/', t('Community'), "", "");
|
||||
$ps['usermenu']['pgroups'] = Array('http://dir.friendika.com/directory/forum', t('Public Groups'), "", "");
|
||||
|
||||
$tpl = get_markup_template('profile_side.tpl');
|
||||
|
||||
$a->page['aside'] .= replace_macros($tpl, array(
|
||||
'$userinfo' => $userinfo,
|
||||
'$ps' => $ps,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// COMMUNITY
|
||||
diabook_community_info();
|
||||
|
||||
// CUSTOM CSS
|
||||
$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-network.css";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//right_aside at profile pages
|
||||
if ($a->argv[0] === "profile"){
|
||||
|
||||
// COMMUNITY
|
||||
diabook_community_info();
|
||||
|
||||
// CUSTOM CSS
|
||||
$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-profile.css";
|
||||
|
||||
}
|
||||
|
||||
|
||||
// custom css
|
||||
if (!is_null($cssFile)) $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
|
||||
|
||||
//js scripts
|
||||
|
||||
$a->page['htmlhead'] .= <<< EOT
|
||||
|
||||
<script>
|
||||
|
||||
//contacts
|
||||
$('html').click(function() {
|
||||
$('#nav-contacts-linkmenu').removeClass('selected');
|
||||
document.getElementById( "nav-contacts-menu" ).style.display = "none";
|
||||
});
|
||||
|
||||
$('#nav-contacts-linkmenu').click(function(event){
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
//messages
|
||||
$('html').click(function() {
|
||||
$('#nav-messages-linkmenu').removeClass('selected');
|
||||
document.getElementById( "nav-messages-menu" ).style.display = "none";
|
||||
});
|
||||
|
||||
$('#nav-messages-linkmenu').click(function(event){
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
//notifications
|
||||
$('html').click(function() {
|
||||
$('#nav-notifications-linkmenu').removeClass('selected');
|
||||
document.getElementById( "nav-notifications-menu" ).style.display = "none";
|
||||
});
|
||||
|
||||
$('#nav-notifications-linkmenu').click(function(event){
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
//usermenu
|
||||
$('html').click(function() {
|
||||
$('#nav-user-linkmenu').removeClass('selected');
|
||||
document.getElementById( "nav-user-menu" ).style.display = "none";
|
||||
});
|
||||
|
||||
$('#nav-user-linkmenu').click(function(event){
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
//settingsmenu
|
||||
$('html').click(function() {
|
||||
$('#nav-site-linkmenu').removeClass('selected');
|
||||
document.getElementById( "nav-site-menu" ).style.display = "none";
|
||||
});
|
||||
|
||||
$('#nav-site-linkmenu').click(function(event){
|
||||
event.stopPropagation();
|
||||
});
|
||||
//appsmenu
|
||||
$('html').click(function() {
|
||||
$('#nav-apps-link').removeClass('selected');
|
||||
document.getElementById( "nav-apps-menu" ).style.display = "none";
|
||||
});
|
||||
|
||||
$('#nav-apps-link').click(function(event){
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$('a.lightbox').fancybox(); // Select all links with lightbox class
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
|
||||
|
|
|
@ -66,6 +66,10 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item icon file-as" title="$item.star.filer"></a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.plink }}<a class="icon link" title="$item.plink.title" href="$item.plink.href">$item.plink.title</a>{{ endif }}
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
|
||||
{{ endif }}
|
||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
|
||||
{{ endif }}
|
||||
|
||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||
|
|
|
@ -72,6 +72,8 @@
|
|||
@NoticeColor: @Grey1;
|
||||
@NoticeBackgroundColor: #511919;
|
||||
|
||||
@FieldHelpColor: @Grey3;
|
||||
|
||||
@ThreadBackgroundColor: #f6f7f8;
|
||||
@ShinyBorderColor: @Green4;
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ aside #profiles-menu {
|
|||
}
|
||||
#contact-block .contact-block-content {
|
||||
clear: both;
|
||||
overflow: idden;
|
||||
overflow: hidden;
|
||||
height: auto;
|
||||
}
|
||||
#contact-block .contact-block-link {
|
||||
|
@ -623,7 +623,7 @@ aside #profiles-menu {
|
|||
margin: 0px 2px 2px 0px;
|
||||
}
|
||||
#contact-block .contact-block-link img {
|
||||
widht: 48px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
/* mail view */
|
||||
|
@ -787,7 +787,7 @@ section {
|
|||
}
|
||||
.wall-item-decor {
|
||||
position: absolute;
|
||||
left: 790px;
|
||||
left: 97%;
|
||||
top: -10px;
|
||||
width: 16px;
|
||||
}
|
||||
|
@ -968,6 +968,10 @@ section {
|
|||
background: url("../../../images/tag.png") no-repeat center right;
|
||||
color: #ffffff;
|
||||
}
|
||||
.filesavetags {
|
||||
padding: 3px 0px 3px 0px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.wwto {
|
||||
position: absolute !important;
|
||||
width: 25px;
|
||||
|
@ -1304,6 +1308,37 @@ ul.tabs li {
|
|||
ul.tabs li .active {
|
||||
border-bottom: 1px solid #009100;
|
||||
}
|
||||
/** group editor **/
|
||||
#group-edit-desc {
|
||||
margin-top: 1em;
|
||||
color: #999999;
|
||||
}
|
||||
#group-update-wrapper {
|
||||
height: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
#group-update-wrapper #group {
|
||||
width: 300px;
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
}
|
||||
#group-update-wrapper #contacts {
|
||||
width: 300px;
|
||||
float: left;
|
||||
}
|
||||
#group-update-wrapper #group-separator {
|
||||
display: none;
|
||||
}
|
||||
#group-update-wrapper .contact_list {
|
||||
height: 300px;
|
||||
border: 1px solid #364e59;
|
||||
overflow: auto;
|
||||
}
|
||||
#group-update-wrapper .contact_list .contact-block-div {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
float: left;
|
||||
}
|
||||
/**
|
||||
* Form fields
|
||||
*/
|
||||
|
@ -1326,7 +1361,7 @@ ul.tabs li .active {
|
|||
.field .field_help {
|
||||
display: block;
|
||||
margin-left: 200px;
|
||||
color: #666666;
|
||||
color: #999999;
|
||||
}
|
||||
.field .onoff {
|
||||
float: left;
|
||||
|
|
|
@ -113,7 +113,7 @@ header {
|
|||
|
||||
#banner {
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
a, a:active, a:visited, a:link, a:hover { color: @Grey1; text-decoration: none; outline: none; vertical-align: bottom; }
|
||||
#logo-img { height: 22px; margin-top:5px;}
|
||||
|
@ -448,7 +448,7 @@ section {
|
|||
margin-bottom: 20px;
|
||||
width: 780px;
|
||||
}
|
||||
.wall-item-decor { position: absolute; left: 790px; top: -10px; width: 16px;}
|
||||
.wall-item-decor { position: absolute; left: 97%; top: -10px; width: 16px;}
|
||||
.unstarred { display: none; }
|
||||
|
||||
.wall-item-container {
|
||||
|
@ -570,6 +570,10 @@ section {
|
|||
color: @TagColor;
|
||||
}
|
||||
}
|
||||
.filesavetags {
|
||||
padding: 3px 0px 3px 0px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.wwto {
|
||||
position: absolute !important;
|
||||
|
|
|
@ -787,7 +787,7 @@ section {
|
|||
}
|
||||
.wall-item-decor {
|
||||
position: absolute;
|
||||
left: 790px;
|
||||
left: 97%;
|
||||
top: -10px;
|
||||
width: 16px;
|
||||
}
|
||||
|
@ -968,6 +968,10 @@ section {
|
|||
background: url("../../../images/tag.png") no-repeat center right;
|
||||
color: #ffffff;
|
||||
}
|
||||
.filesavetags {
|
||||
padding: 3px 0px 3px 0px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.wwto {
|
||||
position: absolute !important;
|
||||
width: 25px;
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
<a href="#" id="unstar-$item.id" onclick="dostar($item.id); return false;" class="$item.star.classundo" title="$item.star.undo">$item.star.undo</a>
|
||||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="$item.star.classtagger" title="$item.star.tagger">$item.star.tagger</a>
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer">$item.filer</a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.vote }}
|
||||
<a href="#" id="like-$item.id" title="$item.vote.like.0" onclick="dolike($item.id,'like'); return false">$item.vote.like.1</a>
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="$item.star.classtagger" title="$item.star.tagger">$item.star.tagger</a>
|
||||
|
||||
{{ endif }}
|
||||
{{ if $item.filer }}
|
||||
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer">$item.filer</a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.vote }}
|
||||
<a href="#" id="like-$item.id" title="$item.vote.like.0" onclick="dolike($item.id,'like'); return false">$item.vote.like.1</a>
|
||||
|
|
Loading…
Reference in a new issue