Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Thomas Willingham
2013-07-03 16:10:58 +01:00
21 changed files with 302 additions and 214 deletions

View File

@@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 ); define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1048 ); define ( 'DB_UPDATE_VERSION', 1049 );
define ( 'EOL', '<br />' . "\r\n" ); define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -1419,7 +1419,7 @@ function get_max_import_size() {
* Function : profile_load * Function : profile_load
* @parameter App $a * @parameter App $a
* @parameter string $nickname * @parameter string $nickname
* @parameter int $profile * @parameter string $profile
* *
* Summary: Loads a profile into the page sidebar. * Summary: Loads a profile into the page sidebar.
* The function requires a writeable copy of the main App structure, and the nickname * The function requires a writeable copy of the main App structure, and the nickname
@@ -1436,7 +1436,9 @@ function get_max_import_size() {
*/ */
function profile_load(&$a, $nickname, $profile = 0) { function profile_load(&$a, $nickname, $profile = '') {
logger('profile_load: ' . $profile);
$user = q("select channel_id from channel where channel_address = '%s' limit 1", $user = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($nickname) dbesc($nickname)
@@ -1460,30 +1462,29 @@ function profile_load(&$a, $nickname, $profile = 0) {
return; return;
} }
$r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' limit 1", if(! $profile) {
dbesc($observer['xchan_hash']) $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' and abook_channel = '%d' limit 1",
); dbesc($observer['xchan_hash']),
if($r) intval($user[0]['channel_id'])
$profile = $r[0]['abook_profile']; );
if($r)
$profile = $r[0]['abook_profile'];
}
$r = null; $r = null;
if($profile) { if($profile) {
$profile_int = intval($profile); $r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , channel.* FROM `profile` LEFT JOIN channel ON profile.uid = channel.channel_id
LEFT JOIN channel ON `profile`.`uid` = channel.channel_id WHERE channel.channel_address = '%s' AND profile.profile_guid = '%s' LIMIT 1",
WHERE channel.channel_address = '%s' AND `profile`.`id` = %d LIMIT 1",
dbesc($nickname), dbesc($nickname),
intval($profile_int) dbesc($profile)
); );
} }
if(! ($r && count($r))) { if(! $r) {
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `channel`.* FROM `profile` $r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
LEFT JOIN `channel` ON `profile`.`uid` = channel.channel_id LEFT JOIN channel ON profile.uid = channel.channel_id
WHERE channel.channel_address = '%s' AND `profile`.`is_default` = 1 LIMIT 1", WHERE channel.channel_address = '%s' AND profile.is_default = 1 LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
} }

View File

@@ -1,21 +1,19 @@
<?php /** @file */ <?php /** @file */
function contact_profile_assign($current,$foreign_net) { function contact_profile_assign($current) {
$o = ''; $o = '';
$disabled = (($foreign_net) ? ' disabled="true" ' : ''); $o .= "<select id=\"contact-profile-selector\" name=\"profile-assign\" />\r\n";
$o .= "<select id=\"contact-profile-selector\" $disabled name=\"profile-assign\" />\r\n"; $r = q("SELECT profile_guid, profile_name FROM `profile` WHERE `uid` = %d",
intval($_SESSION['uid']));
$r = q("SELECT `id`, `profile_name` FROM `profile` WHERE `uid` = %d", if($r) {
intval($_SESSION['uid']));
if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$selected = (($rr['id'] == $current) ? " selected=\"selected\" " : ""); $selected = (($rr['profile_guid'] == $current) ? " selected=\"selected\" " : "");
$o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile_name']}</option>\r\n"; $o .= "<option value=\"{$rr['profile_guid']}\" $selected >{$rr['profile_name']}</option>\r\n";
} }
} }
$o .= "</select>\r\n"; $o .= "</select>\r\n";

View File

@@ -53,7 +53,7 @@ function syncdirs($uid) {
logger('syncdirs', LOGGER_DEBUG); logger('syncdirs', LOGGER_DEBUG);
$p = q("select channel.channel_hash, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1", $p = q("select channel.channel_hash, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1",
intval($uid) intval($uid)
); );
@@ -64,6 +64,9 @@ function syncdirs($uid) {
$profile['description'] = $p[0]['pdesc']; $profile['description'] = $p[0]['pdesc'];
$profile['birthday'] = $p[0]['dob']; $profile['birthday'] = $p[0]['dob'];
if($age = age($p[0]['dob'],$p[0]['channel_timezone'],''))
$profile['age'] = $age;
$profile['gender'] = $p[0]['gender']; $profile['gender'] = $p[0]['gender'];
$profile['marital'] = $p[0]['marital']; $profile['marital'] = $p[0]['marital'];
$profile['sexual'] = $p[0]['sexual']; $profile['sexual'] = $p[0]['sexual'];

View File

@@ -58,6 +58,7 @@ function get_features() {
array('filing', t('Saved Folders'), t('Ability to file posts under folders')), array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')), array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')), array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your channel page')),
), ),
); );

View File

@@ -1858,9 +1858,6 @@ function tag_deliver($uid,$item_id) {
// See if we are the owner of the parent item and have given permission to tag our posts. // See if we are the owner of the parent item and have given permission to tag our posts.
// If so tag the parent post. // If so tag the parent post.
// FIXME --- If the item is deleted, remove the tag from the parent.
// (First ensure that deleted items use this function, or else do that part separately.)
logger('tag_deliver: community tag activity received'); logger('tag_deliver: community tag activity received');
if(($item['owner_xchan'] === $u[0]['channel_hash']) && (! get_pconfig($u[0]['channel_id'],'system','blocktags'))) { if(($item['owner_xchan'] === $u[0]['channel_hash']) && (! get_pconfig($u[0]['channel_id'],'system','blocktags'))) {

View File

@@ -96,12 +96,15 @@ function format_term_for_display($term) {
// Tag cloud functions - need to be adpated to this database format // Tag cloud functions - need to be adpated to this database format
function tagadelic($uid, $count = 0, $type = TERM_HASHTAG) { function tagadelic($uid, $count = 0, $flags = 0, $type = TERM_HASHTAG) {
if($flags)
$sql_options = " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") ";
// Fetch tags // Fetch tags
$r = q("select term, count(term) as total from term $r = q("select term, count(term) as total from term left join item on term.oid = item.id
where uid = %d and type = %d where term.uid = %d and term.type = %d
and otype = %d and otype = %d and item_restrict = 0
$sql_options
group by term order by total desc %s", group by term order by total desc %s",
intval($uid), intval($uid),
intval($type), intval($type),
@@ -145,15 +148,17 @@ function tags_sort($a,$b) {
} }
function tagblock($link,$uid,$count = 0,$type = TERM_HASHTAG) { function tagblock($link,$uid,$count = 0,$flags = 0,$type = TERM_HASHTAG) {
$o = '';
$tab = 0; $tab = 0;
$r = tagadelic($uid,$count,$type); $r = tagadelic($uid,$count,$flags,$type);
if($r) { if($r) {
echo '<div class="tags" align="center">'; $o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
foreach($r as $rr) { foreach($r as $rr) {
echo '<a href="'.$link .'/' . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> '; $o .= '<a href="'.$link .'/' . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n";
} }
echo '</div>'; $o .= '</div></div>';
} }
return $o;
} }

View File

@@ -1312,7 +1312,6 @@ function import_directory_profile($hash,$profile) {
$arr['xprof_keywords'] = implode(' ',$clean); $arr['xprof_keywords'] = implode(' ',$clean);
$r = q("select * from xprof where xprof_hash = '%s' limit 1", $r = q("select * from xprof where xprof_hash = '%s' limit 1",
dbesc($hash) dbesc($hash)
); );
@@ -1328,6 +1327,7 @@ function import_directory_profile($hash,$profile) {
$x = q("update xprof set $x = q("update xprof set
xprof_desc = '%s', xprof_desc = '%s',
xprof_dob = '%s', xprof_dob = '%s',
xprof_age = %d,
xprof_gender = '%s', xprof_gender = '%s',
xprof_marital = '%s', xprof_marital = '%s',
xprof_sexual = '%s', xprof_sexual = '%s',
@@ -1339,6 +1339,7 @@ function import_directory_profile($hash,$profile) {
where xprof_hash = '%s' limit 1", where xprof_hash = '%s' limit 1",
dbesc($arr['xprof_desc']), dbesc($arr['xprof_desc']),
dbesc($arr['xprof_dob']), dbesc($arr['xprof_dob']),
intval($arr['xprof_age']),
dbesc($arr['xprof_gender']), dbesc($arr['xprof_gender']),
dbesc($arr['xprof_marital']), dbesc($arr['xprof_marital']),
dbesc($arr['xprof_sexual']), dbesc($arr['xprof_sexual']),
@@ -1353,10 +1354,11 @@ function import_directory_profile($hash,$profile) {
} }
else { else {
$update = true; $update = true;
$x = q("insert into xprof (xprof_hash, xprof_desc, xprof_dob, xprof_gender, xprof_marital, xprof_sexual, xprof_locale, xprof_region, xprof_postcode, xprof_country, xprof_keywords) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", $x = q("insert into xprof (xprof_hash, xprof_desc, xprof_dob, xprof_age, xprof_gender, xprof_marital, xprof_sexual, xprof_locale, xprof_region, xprof_postcode, xprof_country, xprof_keywords) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
dbesc($arr['xprof_hash']), dbesc($arr['xprof_hash']),
dbesc($arr['xprof_desc']), dbesc($arr['xprof_desc']),
dbesc($arr['xprof_dob']), dbesc($arr['xprof_dob']),
intval($arr['xprof_age']),
dbesc($arr['xprof_gender']), dbesc($arr['xprof_gender']),
dbesc($arr['xprof_marital']), dbesc($arr['xprof_marital']),
dbesc($arr['xprof_sexual']), dbesc($arr['xprof_sexual']),

View File

@@ -599,6 +599,23 @@ CREATE TABLE IF NOT EXISTS `notify` (
KEY `otype` (`otype`) KEY `otype` (`otype`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `obj` (
`obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`obj_page` char(64) NOT NULL DEFAULT '',
`obj_verb` char(255) NOT NULL DEFAULT '',
`obj_type` int(10) unsigned NOT NULL DEFAULT '0',
`obj_obj` char(255) NOT NULL DEFAULT '',
`obj_channel` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`obj_id`),
KEY `obj_verb` (`obj_verb`),
KEY `obj_page` (`obj_page`),
KEY `obj_type` (`obj_type`),
KEY `obj_channel` (`obj_channel`),
KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `outq` ( CREATE TABLE IF NOT EXISTS `outq` (
`outq_hash` char(255) NOT NULL, `outq_hash` char(255) NOT NULL,
`outq_account` int(10) unsigned NOT NULL DEFAULT '0', `outq_account` int(10) unsigned NOT NULL DEFAULT '0',

View File

@@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1048 ); define( 'UPDATE_VERSION' , 1049 );
/** /**
* *
@@ -581,3 +581,23 @@ ADD INDEX ( `xprof_age` ) ");
return UPDATE_FAILED; return UPDATE_FAILED;
} }
function update_r1048() {
$r = q("CREATE TABLE IF NOT EXISTS `obj` (
`obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`obj_page` char(64) NOT NULL DEFAULT '',
`obj_verb` char(255) NOT NULL DEFAULT '',
`obj_type` int(10) unsigned NOT NULL DEFAULT '0',
`obj_obj` char(255) NOT NULL DEFAULT '',
`obj_channel` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`obj_id`),
KEY `obj_verb` (`obj_verb`),
KEY `obj_page` (`obj_page`),
KEY `obj_type` (`obj_type`),
KEY `obj_channel` (`obj_channel`),
KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@@ -343,26 +343,26 @@
function updateConvItems(mode,data) { function updateConvItems(mode,data) {
var expanded_comments = false;
if(mode === 'update') { if(mode === 'update') {
prev = 'threads-begin'; prev = 'threads-begin';
$('.thread-wrapper.toplevel_item',data).each(function() { $('.thread-wrapper.toplevel_item',data).each(function() {
var ident = $(this).attr('id'); var ident = $(this).attr('id');
var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
var itmId = commentWrap.replace('collapsed-comments-','');
var isVisible = false;
if($('#' + ident).length == 0 && profile_page == 1) { if($('#' + ident).length == 0 && profile_page == 1) {
$('img',this).each(function() { $('img',this).each(function() {
$(this).attr('src',$(this).attr('dst')); $(this).attr('src',$(this).attr('dst'));
}); });
// expanded_comments = false; if($('#collapsed-comments-'+itmId).is(':visible'))
// $('.collapsed-comments',this).each(function() { isVisible = true;
// if($(this).is(':visible'))
// expanded_comments = this;
// });
$('#' + prev).after($(this)); $('#' + prev).after($(this));
// if(expanded_comments) if(isVisible)
// $(expanded_comments).show(); showHideComments(itmId);
$(".autotime").timeago(); $(".autotime").timeago();
// divgrow doesn't prevent itself from attaching a second (or 500th) // divgrow doesn't prevent itself from attaching a second (or 500th)
// "show more" div to a content region - it also has a few other // "show more" div to a content region - it also has a few other
@@ -374,14 +374,12 @@ function updateConvItems(mode,data) {
$('img',this).each(function() { $('img',this).each(function() {
$(this).attr('src',$(this).attr('dst')); $(this).attr('src',$(this).attr('dst'));
}); });
// expanded_comments = false; // more FIXME related to expanded comments
// $('.collapsed-comments',this).each(function() { if($('#collapsed-comments-'+itmId).is(':visible'))
// if($(this).is(':visible')) isVisible = true;
// expanded_comments = this;
// });
$('#' + ident).replaceWith($(this)); $('#' + ident).replaceWith($(this));
// if(expanded_comments) if(isVisible)
// $(expanded_comments).show(); showHideComments(itmId);
$(".autotime").timeago(); $(".autotime").timeago();
// $("div.wall-item-body").divgrow({ initialHeight: 400 }); // $("div.wall-item-body").divgrow({ initialHeight: 400 });

View File

@@ -47,6 +47,9 @@ function channel_aside(&$a) {
$a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$a->profile['profile_uid'],true)); $a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$a->profile['profile_uid'],true));
$a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat)); $a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat));
} }
if(feature_enabled($a->profile['profile_uid'],'tagadelic'))
$a->set_widget('tagcloud',tagblock('search',$a->profile['profile_uid'],50,ITEM_WALL|ITEM_THREAD_TOP));
} }

View File

@@ -63,10 +63,10 @@ function connections_post(&$a) {
call_hooks('contact_edit_post', $_POST); call_hooks('contact_edit_post', $_POST);
$profile_id = intval($_POST['profile-assign']); $profile_id = $_POST['profile-assign'];
if($profile_id) { if($profile_id) {
$r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
intval($profile_id), dbesc($profile_id),
intval(local_user()) intval(local_user())
); );
if(! count($r)) { if(! count($r)) {
@@ -99,9 +99,9 @@ function connections_post(&$a) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING ); $abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
} }
$r = q("UPDATE abook SET abook_profile = %d, abook_my_perms = %d , abook_closeness = %d, abook_flags = %d $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d
where abook_id = %d AND abook_channel = %d LIMIT 1", where abook_id = %d AND abook_channel = %d LIMIT 1",
intval($profile_id), dbesc($profile_id),
intval($abook_my_perms), intval($abook_my_perms),
intval($closeness), intval($closeness),
intval($abook_flags), intval($abook_flags),
@@ -405,7 +405,7 @@ function connections_content(&$a) {
'$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your <a href="settings">privacy settings</a>, though you may wish to review the "Advanced Permissions"') : ''), '$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your <a href="settings">privacy settings</a>, though you may wish to review the "Advanced Permissions"') : ''),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$lbl_vis1' => t('Profile Visibility'), '$lbl_vis1' => t('Profile Visibility'),
'$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['name']), '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']),
'$lbl_info1' => t('Contact Information / Notes'), '$lbl_info1' => t('Contact Information / Notes'),
'$infedit' => t('Edit contact notes'), '$infedit' => t('Edit contact notes'),
'$close' => $contact['abook_closeness'], '$close' => $contact['abook_closeness'],
@@ -438,7 +438,8 @@ function connections_content(&$a) {
'$updpub' => t('Update public posts'), '$updpub' => t('Update public posts'),
'$last_update' => $last_update, '$last_update' => $last_update,
'$udnow' => t('Update now'), '$udnow' => t('Update now'),
// '$profile_select' => contact_profile_assign($contact['profile_id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)), '$profile_select' => contact_profile_assign($contact['abook_profile']),
'$multiprofs' => feature_enabled(local_user(),'multi_profiles'),
'$contact_id' => $contact['abook_id'], '$contact_id' => $contact['abook_id'],
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ), '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),

View File

@@ -633,6 +633,9 @@ function photos_content(&$a) {
// dispatch request // dispatch request
// //
/**
* Display upload form
*/
if($datatype === 'upload') { if($datatype === 'upload') {
if(! ($can_post)) { if(! ($can_post)) {
@@ -640,12 +643,8 @@ function photos_content(&$a) {
return; return;
} }
$selname = (($datum) ? hex2bin($datum) : ''); $selname = (($datum) ? hex2bin($datum) : '');
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">'; $albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
$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'])) {
@@ -673,6 +672,7 @@ function photos_content(&$a) {
$default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" > $default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
<input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>'; <input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
/* Show space usage */
$r = q("select sum(size) as total from photo where uid = %d and scale = 0 ", $r = q("select sum(size) as total from photo where uid = %d and scale = 0 ",
intval($a->data['channel']['channel_id']) intval($a->data['channel']['channel_id'])
@@ -687,15 +687,8 @@ function photos_content(&$a) {
$usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 ); $usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 );
} }
$albumselect_e = $albumselect;
if($a->get_template_engine() === 'internal') { $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
$albumselect_e = template_escape($albumselect);
$aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb)));
}
else {
$albumselect_e = $albumselect;
$aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
}
$tpl = get_markup_template('photos_upload.tpl'); $tpl = get_markup_template('photos_upload.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
@@ -718,6 +711,10 @@ function photos_content(&$a) {
return $o; return $o;
} }
/*
* Display a single photo album
*/
if($datatype === 'album') { if($datatype === 'album') {
$album = hex2bin($datum); $album = hex2bin($datum);
@@ -793,6 +790,7 @@ function photos_content(&$a) {
if(count($r)) if(count($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
@@ -839,12 +837,12 @@ function photos_content(&$a) {
} }
/**
* Display one photo
*/
if($datatype === 'image') { if($datatype === 'image') {
//$o = '';
// fetch image, item containing image, then comments // fetch image, item containing image, then comments
$ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
@@ -853,13 +851,16 @@ function photos_content(&$a) {
dbesc($datum) dbesc($datum)
); );
if(! count($ph)) { if(! $ph) {
/* Check again - this time without specifying permissions */
$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($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 );
@@ -893,9 +894,9 @@ function photos_content(&$a) {
break; break;
} }
} }
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
$prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
$nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
} }
@@ -918,7 +919,6 @@ function photos_content(&$a) {
if($can_post && ($ph[0]['uid'] == $owner_uid)) { if($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = array( $tools = array(
'edit' => array($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))),
'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')), 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')),
); );
@@ -931,7 +931,7 @@ function photos_content(&$a) {
} }
if(! $cmd !== 'edit') { if(! $can_post) {
$a->page['htmlhead'] .= '<script> $a->page['htmlhead'] .= '<script>
$(document).keydown(function(event) {' . "\n"; $(document).keydown(function(event) {' . "\n";
@@ -990,39 +990,33 @@ function photos_content(&$a) {
} }
$edit = Null; $edit = null;
if(($cmd === 'edit') && ($can_post)) { if($can_post) {
if($a->get_template_engine() === 'internal') {
$album_e = template_escape($ph[0]['album']);
$caption_e = template_escape($ph[0]['desc']);
$aclselect_e = template_escape(populate_acl($ph[0]));
}
else {
$album_e = $ph[0]['album'];
$caption_e = $ph[0]['desc'];
$aclselect_e = populate_acl($ph[0]);
}
$edit_tpl = get_markup_template('photo_edit.tpl'); $album_e = $ph[0]['album'];
$edit = replace_macros($edit_tpl, array( $caption_e = $ph[0]['desc'];
'$id' => $ph[0]['id'], $aclselect_e = populate_acl($ph[0]);
'$rotatecw' => t('Rotate CW (right)'),
'$rotateccw' => t('Rotate CCW (left)'), $edit = array(
'$album' => $album_e, 'edit' => t('Edit photo'),
'$newalbum' => t('New album name'), 'id' => $ph[0]['id'],
'$nickname' => $a->data['channel']['channel_address'], 'rotatecw' => t('Rotate CW (right)'),
'$resource_id' => $ph[0]['resource_id'], 'rotateccw' => t('Rotate CCW (left)'),
'$capt_label' => t('Caption'), 'album' => $album_e,
'$caption' => $caption_e, 'newalbum' => t('New album name'),
'$tag_label' => t('Add a Tag'), 'nickname' => $a->data['channel']['channel_address'],
'$tags' => $link_item['tag'], 'resource_id' => $ph[0]['resource_id'],
'$permissions' => t('Permissions'), 'capt_label' => t('Caption'),
'$aclselect' => $aclselect_e, 'caption' => $caption_e,
'$help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'), 'tag_label' => t('Add a Tag'),
'$item_id' => ((count($linked_items)) ? $link_item['id'] : 0), 'tags' => $link_item['tag'],
'$submit' => t('Submit'), 'permissions' => t('Permissions'),
'$delete' => t('Delete Photo') 'aclselect' => $aclselect_e,
)); 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
'item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
'submit' => t('Submit'),
'delete' => t('Delete Photo')
);
} }
if(count($linked_items)) { if(count($linked_items)) {
@@ -1154,16 +1148,10 @@ function photos_content(&$a) {
$drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete'))); $drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
if($a->get_template_engine() === 'internal') { $name_e = $profile_name;
$name_e = template_escape($profile_name); $title_e = $item['title'];
$title_e = template_escape($item['title']); $body_e = bbcode($item['body']);
$body_e = template_escape(bbcode($item['body']));
}
else {
$name_e = $profile_name;
$title_e = $item['title'];
$body_e = bbcode($item['body']);
}
$comments .= replace_macros($template,array( $comments .= replace_macros($template,array(
'$id' => $item['item_id'], '$id' => $item['item_id'],
@@ -1184,18 +1172,10 @@ function photos_content(&$a) {
$paginate = paginate($a); $paginate = paginate($a);
} }
if($a->get_template_engine() === 'internal') { $album_e = array($album_link,$ph[0]['album']);
$album_e = array($album_link,template_escape($ph[0]['album'])); $tags_e = $tags;
$tags_e = template_escape($tags); $like_e = $like;
$like_e = template_escape($like); $dislike_e = $dislike;
$dislike_e = template_escape($dislike);
}
else {
$album_e = array($album_link,$ph[0]['album']);
$tags_e = $tags;
$like_e = $like;
$dislike_e = $dislike;
}
$photo_tpl = get_markup_template('photo_view.tpl'); $photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array( $o .= replace_macros($photo_tpl, array(

View File

@@ -10,25 +10,35 @@ function profile_init(&$a) {
return; return;
} }
$profile = 0; $profile = '';
$channel = $a->get_channel(); $channel = $a->get_channel();
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) { if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address']; $which = $channel['channel_address'];
$profile = argv(1); $profile = argv(1);
$r = q("select profile_guid from profile where id = %d and uid = %d limit 1",
intval($profile),
intval(local_user())
);
if(! $r)
$profile = '';
$profile = $r[0]['profile_guid'];
} }
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
$x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", if(! $profile) {
dbesc(argv(1)) $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
); dbesc(argv(1))
if($x) { );
$a->profile = $x[0]; if($x) {
$a->profile = $x[0];
}
}
// $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format'); // $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format');
// if(! $channel_display) // if(! $channel_display)
profile_load($a,$which,$profile); profile_load($a,$which,$profile);
}
} }

View File

@@ -47,7 +47,7 @@ function profiles_init(&$a) {
if((argc() > 1) && (argv(1) === 'new')) { if((argc() > 1) && (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()));
@@ -519,6 +519,7 @@ function profiles_content(&$a) {
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t='
. get_form_security_token("profile_drop"), . get_form_security_token("profile_drop"),
'$guid' => $r[0]['profile_guid'],
'$banner' => t('Edit Profile Details'), '$banner' => t('Edit Profile Details'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$viewprof' => t('View this profile'), '$viewprof' => t('View this profile'),

View File

@@ -1 +1 @@
2013-07-01.361 2013-07-03.363

View File

@@ -3833,3 +3833,51 @@ span.mail-date {
float:left; float:left;
width: 200px; width: 200px;
} }
.tag1 {
font-size : 1.0em !important;
}
.tag2 {
font-size : 1.2em !important;
}
.tag3 {
font-size : 1.4em !important;
}
.tag4 {
font-size : 1.6em !important;
}
.tag5 {
font-size : 1.8em !important;
}
.tag6 {
font-size : 2.0em !important;
}
.tag7 {
font-size : 2.2em !important;
}
.tag8 {
font-size : 2.4em !important;
}
.tag9 {
font-size : 2.6em !important;
}
.tag10 {
font-size : 2.8em !important;
}

View File

@@ -75,6 +75,15 @@
</div> </div>
{{if $multiprofs }}
<div>
<h3>{{$lbl_vis1}}</h3>
<div>{{$lbl_vis2}}</div>
{{$profile_select}}
</div>
{{/if}}
<input class="contact-edit-submit" type="submit" name="done" value="{{$submit}}" /> <input class="contact-edit-submit" type="submit" name="done" value="{{$submit}}" />
</form> </form>

View File

@@ -1,55 +0,0 @@
{{*
* AUTOMATICALLY GENERATED TEMPLATE
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" >
<input type="hidden" name="item_id" value="{{$item_id}}" />
<label id="photo-edit-albumname-label" for="photo-edit-albumname">{{$newalbum}}</label>
<input id="photo-edit-albumname" type="text" size="32" name="albname" value="{{$album}}" />
<div id="photo-edit-albumname-end"></div>
<label id="photo-edit-caption-label" for="photo-edit-caption">{{$capt_label}}</label>
<input id="photo-edit-caption" type="text" size="84" name="desc" value="{{$caption}}" />
<div id="photo-edit-caption-end"></div>
<label id="photo-edit-tags-label" for="photo-edit-newtag" >{{$tag_label}}</label>
<input name="newtag" id="photo-edit-newtag" size="84" title="{{$help_tags}}" type="text" />
<div id="photo-edit-tags-end"></div>
<div id="photo-edit-rotate-wrapper">
<div id="photo-edit-rotate-label">
{{$rotatecw}}<br>
{{$rotateccw}}
</div>
<input type="radio" name="rotate" value="1" /><br>
<input type="radio" name="rotate" value="2" />
</div>
<div id="photo-edit-rotate-end"></div>
<div id="photo-edit-perms" class="photo-edit-perms" >
<a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button popupbox" title="{{$permissions}}"/>
<span id="jot-perms-icon" class="icon {{$lockstate}}" ></span>{{$permissions}}
</a>
<div id="photo-edit-perms-menu-end"></div>
<div style="display: none;">
<div id="photo-edit-perms-select" >
{{$aclselect}}
</div>
</div>
</div>
<div id="photo-edit-perms-end"></div>
<input id="photo-edit-submit-button" type="submit" name="submit" value="{{$submit}}" />
<input id="photo-edit-delete-button" type="submit" name="delete" value="{{$delete}}" onclick="return confirmDelete()"; />
<div id="photo-edit-end"></div>
</form>

View File

@@ -14,8 +14,6 @@
<div id="photo-edit-link-wrap"> <div id="photo-edit-link-wrap">
{{if $tools}} {{if $tools}}
<a id="photo-edit-link" href="{{$tools.edit.0}}">{{$tools.edit.1}}</a>
|
<a id="photo-toprofile-link" href="{{$tools.profile.0}}">{{$tools.profile.1}}</a> <a id="photo-toprofile-link" href="{{$tools.profile.0}}">{{$tools.profile.1}}</a>
{{/if}} {{/if}}
{{if $lock}} | <img src="images/lock_icon.gif" class="lockview" alt="{{$lock}}" onclick="lockview(event,'photo/{{$id}}');" /> {{/if}} {{if $lock}} | <img src="images/lock_icon.gif" class="lockview" alt="{{$lock}}" onclick="lockview(event,'photo/{{$id}}');" /> {{/if}}
@@ -32,7 +30,58 @@
{{/if}} {{/if}}
{{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}} {{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}}
{{if $edit}}{{$edit}}{{/if}} {{if $edit}}
<div id="photo-edit-edit-wrapper" class="fakelink" onclick="openClose('photo-edit-edit');">{{$edit.edit}}</div>
<div id="photo-edit-edit" style="display: none;">
<form action="photos/{{$edit.nickname}}/{{$edit.resource_id}}" method="post" id="photo_edit_form" >
<input type="hidden" name="item_id" value="{{$item_id}}" />
<label id="photo-edit-albumname-label" for="photo-edit-albumname">{{$edit.newalbum}}</label>
<input id="photo-edit-albumname" type="text" size="32" name="albname" value="{{$edit.album}}" />
<div id="photo-edit-albumname-end"></div>
<label id="photo-edit-caption-label" for="photo-edit-caption">{{$edit.capt_label}}</label>
<input id="photo-edit-caption" type="text" size="84" name="desc" value="{{$edit.caption}}" />
<div id="photo-edit-caption-end"></div>
<label id="photo-edit-tags-label" for="photo-edit-newtag" >{{$edit.tag_label}}</label>
<input name="newtag" id="photo-edit-newtag" size="84" title="{{$edit.help_tags}}" type="text" />
<div id="photo-edit-tags-end"></div>
<div id="photo-edit-rotate-wrapper">
<div id="photo-edit-rotate-label">
{{$edit.rotatecw}}<br>
{{$edit.rotateccw}}
</div>
<input type="radio" name="rotate" value="1" /><br>
<input type="radio" name="rotate" value="2" />
</div>
<div id="photo-edit-rotate-end"></div>
<div id="photo-edit-perms" class="photo-edit-perms" >
<a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button popupbox" title="{{$edit.permissions}}"/>
<span id="jot-perms-icon" class="icon {{$edit.lockstate}}" ></span>{{$edit.permissions}}
</a>
<div id="photo-edit-perms-menu-end"></div>
<div style="display: none;">
<div id="photo-edit-perms-select" >
{{$edit.aclselect}}
</div>
</div>
</div>
<div id="photo-edit-perms-end"></div>
<input id="photo-edit-submit-button" type="submit" name="submit" value="{{$edit.submit}}" />
<input id="photo-edit-delete-button" type="submit" name="delete" value="{{$edit.delete}}" onclick="return confirmDelete()"; />
<div id="photo-edit-end"></div>
</form>
</div>
{{/if}}
{{if $likebuttons}} {{if $likebuttons}}
<div id="photo-like-div"> <div id="photo-like-div">

View File

@@ -10,7 +10,7 @@
<div id="profile-edit-links"> <div id="profile-edit-links">
<ul> <ul>
<li><a href="profile_photo" id="profile-photo_upload-link" title="{{$profpic}}">{{$profpic}}</a></li> <li><a href="profile_photo" id="profile-photo_upload-link" title="{{$profpic}}">{{$profpic}}</a></li>
<li><a href="profile/{{$profile_id}}/view?tab=profile" id="profile-edit-view-link" title="{{$viewprof}}">{{$viewprof}}</a></li> <li><a href="profile/{{$profile_id}}/view" id="profile-edit-view-link" title="{{$viewprof}}">{{$viewprof}}</a></li>
<li><a href="{{$profile_clone_link}}" id="profile-edit-clone-link" title="{{$cr_prof}}">{{$cl_prof}}</a></li> <li><a href="{{$profile_clone_link}}" id="profile-edit-clone-link" title="{{$cr_prof}}">{{$cl_prof}}</a></li>
<li></li> <li></li>
<li><a href="{{$profile_drop_link}}" id="profile-edit-drop-link" title="{{$del_prof}}" {{$disabled}} >{{$del_prof}}</a></li> <li><a href="{{$profile_drop_link}}" id="profile-edit-drop-link" title="{{$del_prof}}" {{$disabled}} >{{$del_prof}}</a></li>