aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rwxr-xr-xmod/admin.php48
-rwxr-xr-xmod/community.php4
-rwxr-xr-xmod/contacts.php106
-rwxr-xr-xmod/dfrn_confirm.php98
-rwxr-xr-xmod/dfrn_poll.php1
-rwxr-xr-xmod/dfrn_request.php1
-rwxr-xr-xmod/directory.php2
-rwxr-xr-xmod/display.php18
-rwxr-xr-xmod/editpost.php8
-rwxr-xr-xmod/events.php145
-rwxr-xr-xmod/install.php11
-rwxr-xr-xmod/item.php39
-rwxr-xr-xmod/network.php50
-rwxr-xr-xmod/newmember.php28
-rwxr-xr-xmod/notifications.php3
-rwxr-xr-xmod/oembed.php15
-rwxr-xr-xmod/oexchange.php20
-rwxr-xr-xmod/parse_url.php40
-rwxr-xr-xmod/profile.php2
-rwxr-xr-xmod/redir.php79
-rwxr-xr-xmod/register.php4
-rwxr-xr-xmod/regmod.php2
-rwxr-xr-xmod/settings.php10
-rwxr-xr-xmod/smilies.php3
-rwxr-xr-xmod/wall_attach.php2
-rwxr-xr-xmod/wall_upload.php6
26 files changed, 522 insertions, 223 deletions
diff --git a/mod/admin.php b/mod/admin.php
index e44404097..028ed8624 100755
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -9,6 +9,10 @@ function admin_post(&$a){
if(!is_site_admin()) {
return;
}
+
+
+ if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
+ return;
// urls
if ($a->argc > 1){
@@ -50,6 +54,9 @@ function admin_content(&$a) {
return login(false);
}
+ if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
+ return;
+
/**
* Side bar links
*/
@@ -628,23 +635,36 @@ function admin_page_logs(&$a){
$t = get_markup_template("admin_logs.tpl");
$f = get_config('system','logfile');
- $size = filesize($f);
- if($size > 5000000 || $size < 0)
- $size = 5000000;
$data = '';
- $fp = fopen($f,'r');
- if($fp) {
- $seek = fseek($fp,0-$size,SEEK_END);
- if($seek === 0) {
- fgets($fp); // throw away the first partial line
- $data = escape_tags(fread($fp,$size));
- while(! feof($fp))
- $data .= escape_tags(fread($fp,4096));
- }
- fclose($fp);
- }
+ if(!file_exists($f)) {
+ $data = t("Error trying to open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f exist and is
+readable.");
+ }
+ else {
+ $fp = fopen($f, 'r');
+ if(!$fp) {
+ $data = t("Couldn't open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f is readable.");
+ }
+ else {
+ $fstat = fstat($fp);
+ $size = $fstat['size'];
+ if($size != 0)
+ {
+ if($size > 5000000 || $size < 0)
+ $size = 5000000;
+ $seek = fseek($fp,0-$size,SEEK_END);
+ if($seek === 0) {
+ fgets($fp); // throw away the first partial line
+ $data = escape_tags(fread($fp,$size));
+ while(! feof($fp))
+ $data .= escape_tags(fread($fp,4096));
+ }
+ }
+ fclose($fp);
+ }
+ }
return replace_macros($t, array(
'$title' => t('Administration'),
diff --git a/mod/community.php b/mod/community.php
index d578b469f..a98999942 100755
--- a/mod/community.php
+++ b/mod/community.php
@@ -80,12 +80,10 @@ function community_content(&$a, $update = 0) {
// we behave the same in message lists as the search module
- $o .= conversation($a,$r,'community',false);
+ $o .= conversation($a,$r,'community',$update);
$o .= paginate($a);
-// $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
-
return $o;
}
diff --git a/mod/contacts.php b/mod/contacts.php
index 51c6920d3..418cddf17 100755
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -42,6 +42,7 @@ function contacts_init(&$a) {
$a->page['aside'] .= findpeople_widget();
+ $a->page['aside'] .= networks_widget('contacts',$_GET['nets']);
}
function contacts_post(&$a) {
@@ -99,6 +100,14 @@ function contacts_post(&$a) {
info( t('Contact updated.') . EOL);
else
notice( t('Failed to update contact record.') . EOL);
+
+ $r = q("select * from contact where id = %d and uid = %d limit 1",
+ intval($contact_id),
+ intval(local_user())
+ );
+ if($r && count($r))
+ $a->data['contact'] = $r[0];
+
return;
}
@@ -111,7 +120,6 @@ function contacts_content(&$a) {
$o = '';
nav_set_selected('contacts');
- $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
if(! local_user()) {
notice( t('Permission denied.') . EOL);
@@ -211,7 +219,10 @@ function contacts_content(&$a) {
contact_remove($orig_record[0]['id']);
info( t('Contact has been removed.') . EOL );
- goaway($a->get_baseurl() . '/contacts');
+ if(x($_SESSION,'return_url'))
+ goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
+ else
+ goaway($a->get_baseurl() . '/contacts');
return; // NOTREACHED
}
}
@@ -354,32 +365,82 @@ function contacts_content(&$a) {
}
+ $blocked = false;
+ $hidden = false;
+ $ignored = false;
+ $all = false;
+
+ $_SESSION['return_url'] = $a->query_string;
- if(($a->argc == 2) && ($a->argv[1] === 'all'))
+ if(($a->argc == 2) && ($a->argv[1] === 'all')) {
$sql_extra = '';
+ $all = true;
+ }
+ elseif(($a->argc == 2) && ($a->argv[1] === 'blocked')) {
+ $sql_extra = " AND `blocked` = 1 ";
+ $blocked = true;
+ }
+ elseif(($a->argc == 2) && ($a->argv[1] === 'hidden')) {
+ $sql_extra = " AND `hidden` = 1 ";
+ $hidden = true;
+ }
+ elseif(($a->argc == 2) && ($a->argv[1] === 'ignored')) {
+ $sql_extra = " AND `readonly` = 1 ";
+ $ignored = true;
+ }
else
$sql_extra = " AND `blocked` = 0 ";
$search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
+ $nets = ((x($_GET,'nets')) ? notags(trim($_GET['nets'])) : '');
+
+ $tabs = array(
+ array(
+ 'label' => t('All Contacts'),
+ 'url' => $a->get_baseurl() . '/contacts/all',
+ 'sel' => ($all) ? 'active' : '',
+ ),
+ array(
+ 'label' => t('Unblocked Contacts'),
+ 'url' => $a->get_baseurl() . '/contacts',
+ 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '',
+ ),
+
+ array(
+ 'label' => t('Blocked Contacts'),
+ 'url' => $a->get_baseurl() . '/contacts/blocked',
+ 'sel' => ($blocked) ? 'active' : '',
+ ),
+
+ array(
+ 'label' => t('Ignored Contacts'),
+ 'url' => $a->get_baseurl() . '/contacts/ignored',
+ 'sel' => ($ignored) ? 'active' : '',
+ ),
+
+ array(
+ 'label' => t('Hidden Contacts'),
+ 'url' => $a->get_baseurl() . '/contacts/hidden',
+ 'sel' => ($hidden) ? 'active' : '',
+ ),
+
+ );
+
+ $tab_tpl = get_markup_template('common_tabs.tpl');
+ $t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
- $tpl = get_markup_template("contacts-top.tpl");
- $o .= replace_macros($tpl,array(
- '$header' => t('Contacts'),
- '$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ),
- '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')),
- '$search' => $search,
- '$desc' => t('Search your contacts'),
- '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
- '$submit' => t('Find'),
- '$cmd' => $a->cmd
- ));
- if($search)
+ if($search) {
+ $search_hdr = $search;
$search = dbesc($search.'*');
+ }
$sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : "");
+ if($nets)
+ $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
+
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
@@ -389,6 +450,21 @@ function contacts_content(&$a) {
if(count($r))
$a->set_pager_total($r[0]['total']);
+
+ $tpl = get_markup_template("contacts-top.tpl");
+ $o .= replace_macros($tpl,array(
+ '$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
+ '$tabs' => $t,
+ '$total' => $r[0]['total'],
+ '$search' => $search_hdr,
+ '$desc' => t('Search your contacts'),
+ '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
+ '$submit' => t('Find'),
+ '$cmd' => $a->cmd
+
+
+ ));
+
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ",
intval($_SESSION['uid']),
intval($a->pager['start']),
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 89b09ef77..abacd9906 100755
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -72,6 +72,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$intro_id = $handsfree['intro_id'];
$duplex = $handsfree['duplex'];
$hidden = ((array_key_exists('hidden',$handsfree)) ? intval($handsfree['hidden']) : 0 );
+ $activity = ((array_key_exists('activity',$handsfree)) ? intval($handsfree['activity']) : 0 );
}
else {
$dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : "");
@@ -79,6 +80,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 );
$cid = ((x($_POST,'contact_id')) ? intval($_POST['contact_id']) : 0 );
$hidden = ((x($_POST,'hidden')) ? intval($_POST['hidden']) : 0 );
+ $activity = ((x($_POST,'activity')) ? intval($_POST['activity']) : 0 );
}
/**
@@ -370,6 +372,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($network === NETWORK_DIASPORA) {
if($duplex)
$new_relation = CONTACT_IS_FRIEND;
+ else
+ $new_relation = CONTACT_IS_SHARING;
+
if($new_relation != CONTACT_IS_FOLLOWER)
$writable = 1;
}
@@ -425,64 +430,65 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
else
$contact = null;
- // Send a new friend post if we are allowed to...
-
- $r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
- intval($uid)
- );
- if((count($r)) && (! $hidden) && ($r[0]['hide-friends'] == 0) && (is_array($contact)) && isset($new_relation) && ($new_relation == CONTACT_IS_FRIEND)) {
+ if(isset($new_relation) && $new_relation == CONTACT_IS_FRIEND) {
- if($r[0]['network'] === NETWORK_DIASPORA) {
+ if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
require_once('include/diaspora.php');
$ret = diaspora_share($user[0],$r[0]);
logger('mod_follow: diaspora_share returns: ' . $ret);
}
- require_once('include/items.php');
+ // Send a new friend post if we are allowed to...
- $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
+ $r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($uid)
);
+ if((count($r)) && ($activity) && (! $hidden)) {
- if(count($self)) {
-
- $arr = array();
- $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
- $arr['uid'] = $uid;
- $arr['contact-id'] = $self[0]['id'];
- $arr['wall'] = 1;
- $arr['type'] = 'wall';
- $arr['gravity'] = 0;
- $arr['origin'] = 1;
- $arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
- $arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
- $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
- $arr['verb'] = ACTIVITY_FRIEND;
- $arr['object-type'] = ACTIVITY_OBJ_PERSON;
-
- $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
- $B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
- $BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
- $arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
-
- $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
- . '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
- $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
- $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
- $arr['object'] .= '</link></object>' . "\n";
- $arr['last-child'] = 1;
-
- $arr['allow_cid'] = $user[0]['allow_cid'];
- $arr['allow_gid'] = $user[0]['allow_gid'];
- $arr['deny_cid'] = $user[0]['deny_cid'];
- $arr['deny_gid'] = $user[0]['deny_gid'];
-
- $i = item_store($arr);
- if($i)
- proc_run('php',"include/notifier.php","activity","$i");
+ require_once('include/items.php');
- }
+ $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
+ intval($uid)
+ );
+ if(count($self)) {
+
+ $arr = array();
+ $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
+ $arr['uid'] = $uid;
+ $arr['contact-id'] = $self[0]['id'];
+ $arr['wall'] = 1;
+ $arr['type'] = 'wall';
+ $arr['gravity'] = 0;
+ $arr['origin'] = 1;
+ $arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
+ $arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
+ $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
+ $arr['verb'] = ACTIVITY_FRIEND;
+ $arr['object-type'] = ACTIVITY_OBJ_PERSON;
+
+ $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
+ $B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
+ $BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
+ $arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
+
+ $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
+ . '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
+ $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
+ $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
+ $arr['object'] .= '</link></object>' . "\n";
+ $arr['last-child'] = 1;
+
+ $arr['allow_cid'] = $user[0]['allow_cid'];
+ $arr['allow_gid'] = $user[0]['allow_gid'];
+ $arr['deny_cid'] = $user[0]['deny_cid'];
+ $arr['deny_gid'] = $user[0]['deny_gid'];
+
+ $i = item_store($arr);
+ if($i)
+ proc_run('php',"include/notifier.php","activity","$i");
+ }
+ }
}
// Let's send our user to the contact editor in case they want to
// do anything special with this new friend.
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 09f198b81..b12e07132 100755
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -86,6 +86,7 @@ function dfrn_poll_init(&$a) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['id'];
$_SESSION['visitor_home'] = $r[0]['url'];
+ $_SESSION['visitor_handle'] = $r[0]['addr'];
$_SESSION['visitor_visiting'] = $r[0]['uid'];
info( sprintf(t('%s welcomes %s'), $r[0]['username'] , $r[0]['name']) . EOL);
// Visitors get 1 day session.
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index aa14bc473..ceec83e90 100755
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -577,6 +577,7 @@ function dfrn_request_content(&$a) {
'language' => $r[0]['language'],
'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'],
+ 'uid' => $r[0]['uid'],
'link' => $a->get_baseurl() . '/notifications/intros',
'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
'source_link' => $r[0]['url'],
diff --git a/mod/directory.php b/mod/directory.php
index 5f00b4f5a..962188945 100755
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -26,6 +26,8 @@ function directory_post(&$a) {
function directory_content(&$a) {
$everything = (($a->argc > 1 && $a->argv[1] === 'all' && is_site_admin()) ? true : false);
+ if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
+ $everything = false;
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
diff --git a/mod/display.php b/mod/display.php
index 02f080a79..d96be4333 100755
--- a/mod/display.php
+++ b/mod/display.php
@@ -11,6 +11,7 @@ function display_content(&$a) {
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
+ require_once('include/acl_selectors.php');
$o = '<div id="live-display"></div>' . "\r\n";
@@ -66,6 +67,23 @@ function display_content(&$a) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
+
+ if ($is_owner)
+ $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
+
+ $x = array(
+ 'is_owner' => true,
+ 'allow_location' => $a->user['allow_location'],
+ 'default_location' => $a->user['default_location'],
+ 'nickname' => $a->user['nickname'],
+ 'lockstate' => ((($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
+ 'acl' => populate_acl((($group || $cid) ? $def_acl : $a->user), $celeb),
+ 'bang' => (($group || $cid) ? '!' : ''),
+ 'visitor' => 'block',
+ 'profile_uid' => local_user()
+ );
+ $o .= status_editor($a,$x,0,true);
+
$sql_extra = permissions_sql($a->profile['uid'],$remote_contact,$groups);
diff --git a/mod/editpost.php b/mod/editpost.php
index bceb9250a..778ac3dcc 100755
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -28,6 +28,10 @@ function editpost_content(&$a) {
return;
}
+ $plaintext = false;
+ if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
+ $plaintext = true;
+
$o .= '<h2>' . t('Edit post') . '</h2>';
@@ -35,6 +39,7 @@ function editpost_content(&$a) {
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
+ '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']
@@ -108,11 +113,14 @@ function editpost_content(&$a) {
'$emailcc' => t('CC: email addresses'),
'$public' => t('Public post'),
'$jotnets' => $jotnets,
+ '$title' => $itm[0]['title'],
+ '$placeholdertitle' => t('Set title'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb),
'$bang' => (($group) ? '!' : ''),
'$profile_uid' => $_SESSION['uid'],
+ '$preview' => t('Preview'),
'$jotplugins' => $jotplugins,
));
diff --git a/mod/events.php b/mod/events.php
index 5da8f17fc..0906d16c2 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -1,5 +1,6 @@
<?php
+require_once('include/bbcode.php');
require_once('include/datetime.php');
require_once('include/event.php');
require_once('include/items.php');
@@ -110,11 +111,14 @@ function events_content(&$a) {
return;
}
+
+ $htpl = get_markup_template('event_head.tpl');
+ $a->page['htmlhead'] .= replace_macros($htpl,array('$baseurl' => $a->get_baseurl()));
+
$o ="";
// tabs
- $o .= profile_tabs($a, True);
+ $tabs = profile_tabs($a, True);
- $o .= '<h2>' . t('Events') . '</h2>';
$mode = 'view';
@@ -138,6 +142,8 @@ function events_content(&$a) {
}
if($mode == 'view') {
+
+
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
if(! $y)
@@ -167,11 +173,16 @@ function events_content(&$a) {
$prevmonth = 12;
$prevyear --;
}
-
$dim = get_dim($y,$m);
$start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0);
$finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59);
+
+
+ if ($a->argv[1] === 'json'){
+ if (x($_GET,'start')) $start = date("Y-m-d h:i:s", $_GET['start']);
+ if (x($_GET,'end')) $finish = date("Y-m-d h:i:s", $_GET['end']);
+ }
$start = datetime_convert('UTC','UTC',$start);
$finish = datetime_convert('UTC','UTC',$finish);
@@ -180,17 +191,26 @@ function events_content(&$a) {
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
- $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
- `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id`
- WHERE `event`.`uid` = %d
- AND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' )
- OR ( `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ",
- intval(local_user()),
- dbesc($start),
- dbesc($finish),
- dbesc($adjust_start),
- dbesc($adjust_finish)
- );
+ if (x($_GET,'id')){
+ $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
+ `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id`
+ WHERE `event`.`uid` = %d AND `event`.`id` = %d",
+ intval(local_user()),
+ intval($_GET['id'])
+ );
+ } else {
+ $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
+ `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id`
+ WHERE `event`.`uid` = %d
+ AND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' )
+ OR ( `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ",
+ intval(local_user()),
+ dbesc($start),
+ dbesc($finish),
+ dbesc($adjust_start),
+ dbesc($adjust_finish)
+ );
+ }
$links = array();
@@ -204,17 +224,7 @@ function events_content(&$a) {
}
- $o .= '<div id="new-event-link"><a href="' . $a->get_baseurl() . '/events/new' . '" >' . t('Create New Event') . '</a></div>';
- $o .= '<div id="event-calendar-wrapper">';
-
- $o .= '<a href="' . $a->get_baseurl() . '/events/' . $prevyear . '/' . $prevmonth . '" class="prevcal"><div id="event-calendar-prev" class="icon prev" title="' . t('Previous') . '"></div></a>';
- $o .= cal($y,$m,$links, ' eventcal');
-
- $o .= '<a href="' . $a->get_baseurl() . '/events/' . $nextyear . '/' . $nextmonth . '" class="nextcal"><div id="event-calendar-next" class="icon next" title="' . t('Next') . '"></div></a>';
- $o .= '</div>';
- $o .= '<div class="event-calendar-end"></div>';
-
-
+ $events=array();
$last_date = '';
$fmt = t('l, F j');
@@ -222,25 +232,82 @@ function events_content(&$a) {
if(count($r)) {
$r = sort_by_date($r);
foreach($r as $rr) {
+
+
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
$d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt));
$d = day_translate($d);
- if($d !== $last_date)
- $o .= '<hr /><a name="link-' . $j . '" ><div class="event-list-date">' . $d . '</div></a>';
- $last_date = $d;
- if($rr['author-name']) {
- $o .= '<a href="' . $rr['author-link'] . '" ><img src="' . $rr['author-avatar'] . '" height="32" width="32" />' . $rr['author-name'] . '</a>';
+
+ $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c'));
+ if ($rr['nofinish']){
+ $end = null;
+ } else {
+ $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c'));
}
- $o .= format_event_html($rr);
- $o .= ((! $rr['cid']) ? '<a href="' . $a->get_baseurl() . '/events/event/' . $rr['id'] . '" title="' . t('Edit event') . '" class="edit-event-link icon pencil"></a>' : '');
- if($rr['plink'])
- $o .= '<a href="' . $rr['plink'] . '" title="' . t('link to source') . '" target="external-link" class="plink-event-link icon remote-link"></a></div>';
+
+
+ $is_first = ($d !== $last_date);
+
+ $last_date = $d;
+ $edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
+
+ list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
+ $title = strip_tags($title);
+ $html = format_event_html($rr);
+ $rr['desc'] = bbcode($rr['desc']);
+ $rr['location'] = bbcode($rr['location']);
+ $events[] = array(
+ 'id'=>$rr['id'],
+ 'start'=> $start,
+ 'end' => $end,
+ 'allDay' => false,
+ 'title' => $title,
+
+ 'j' => $j,
+ 'd' => $d,
+ 'edit' => $edit,
+ 'is_first'=>$is_first,
+ 'item'=>$rr,
+ 'html'=>$html,
+ 'plink' => array($rr['plink'],t('link to source'),'',''),
+ );
- $o .= '<div class="clear"></div>';
}
}
+
+ if ($a->argv[1] === 'json'){
+ echo json_encode($events); killme();
+ }
+
+ // links: array('href', 'text', 'extra css classes', 'title')
+ if (x($_GET,'id')){
+ $tpl = get_markup_template("event.tpl");
+ } else {
+ if (get_config('experimentals','new_calendar')==1){
+ $tpl = get_markup_template("events-js.tpl");
+ } else {
+ $tpl = get_markup_template("events.tpl");
+ }
+ }
+ $o = replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$tabs' => $tabs,
+ '$title' => t('Events'),
+ '$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''),
+ '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
+ '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
+ '$calendar' => cal($y,$m,$links, ' eventcal'),
+
+ '$events' => $events,
+
+
+ ));
+
+ if (x($_GET,'id')){ echo $o; killme(); }
+
return $o;
+
}
if($mode === 'edit' && $event_id) {
@@ -271,8 +338,7 @@ function events_content(&$a) {
if($cid)
$sh_checked .= ' disabled="disabled" ';
- $htpl = get_markup_template('event_head.tpl');
- $a->page['htmlhead'] .= replace_macros($htpl,array('$baseurl' => $a->get_baseurl()));
+
$tpl = get_markup_template('event_form.tpl');
@@ -311,8 +377,9 @@ function events_content(&$a) {
'$eid' => $eid,
'$cid' => $cid,
'$uri' => $uri,
- '$e_text' => t('Event details'),
- '$e_desc' => sprintf( t('Format is %s %s. Starting date and Description are required.'),$dateformat,$timeformat),
+ '$title' => t('Event details'),
+ '$desc' => sprintf( t('Format is %s %s. Starting date and Description are required.'),$dateformat,$timeformat),
+
'$s_text' => t('Event Starts:') . ' <span class="required">*</span> ',
'$s_dsel' => datesel($f,'start',$syear+5,$syear,false,$syear,$smonth,$sday),
'$s_tsel' => timesel('start',$shour,$sminute),
diff --git a/mod/install.php b/mod/install.php
index f7820fc80..003d81c6a 100755
--- a/mod/install.php
+++ b/mod/install.php
@@ -186,8 +186,8 @@ function install_content(&$a) {
check_keys($checks);
- if(x($_POST,'phppath'))
- $phpath = notags(trim($_POST['phppath']));
+ if(x($_POST,'phpath'))
+ $phpath = notags(trim($_POST['phpath']));
check_php($phpath, $checks);
@@ -210,6 +210,7 @@ function install_content(&$a) {
'$next' => t('Next'),
'$reload' => t('Check again'),
'$phpath' => $phpath,
+ '$baseurl' => $a->get_baseurl(),
));
return $o;
}; break;
@@ -220,7 +221,7 @@ function install_content(&$a) {
$dbuser = notags(trim($_POST['dbuser']));
$dbpass = notags(trim($_POST['dbpass']));
$dbdata = notags(trim($_POST['dbdata']));
- $phpath = notags(trim($_POST['phppath']));
+ $phpath = notags(trim($_POST['phpath']));
$tpl = get_markup_template('install_db.tpl');
@@ -258,7 +259,7 @@ function install_content(&$a) {
$dbuser = notags(trim($_POST['dbuser']));
$dbpass = notags(trim($_POST['dbpass']));
$dbdata = notags(trim($_POST['dbdata']));
- $phpath = notags(trim($_POST['phppath']));
+ $phpath = notags(trim($_POST['phpath']));
$adminmail = notags(trim($_POST['adminmail']));
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
@@ -322,7 +323,7 @@ function check_php(&$phpath, &$checks) {
$help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL;
$tpl = get_markup_template('field_input.tpl');
$help .= replace_macros($tpl, array(
- '$field' => array('phppath', t('PHP executable path'), $phpath, t('Enter full path to php executable')),
+ '$field' => array('phpath', t('PHP executable path'), $phpath, t('Enter full path to php executable')),
));
$phpath="";
}
diff --git a/mod/item.php b/mod/item.php
index ed3d7749c..3035989f3 100755
--- a/mod/item.php
+++ b/mod/item.php
@@ -4,7 +4,7 @@
*
* This is the POST destination for most all locally posted
* 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).
* Also processed here are posts and comments coming through the
* statusnet/twitter API.
@@ -17,6 +17,7 @@
require_once('include/crypto.php');
require_once('include/enotify.php');
+require_once('include/email.php');
function item_post(&$a) {
@@ -42,6 +43,7 @@ function item_post(&$a) {
$api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false);
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
+ $preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
/**
* Is this a reply to something?
@@ -56,8 +58,6 @@ function item_post(&$a) {
$parid = 0;
$r = false;
- $preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
-
if($parent || $parent_uri) {
if(! x($_REQUEST,'type'))
@@ -110,8 +110,6 @@ function item_post(&$a) {
if($parent) logger('mod_post: parent=' . $parent);
-
-
$profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0);
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : '');
@@ -606,6 +604,7 @@ function item_post(&$a) {
$datarray['thr-parent'] = $thr_parent;
$datarray['postopts'] = '';
$datarray['origin'] = $origin;
+ $datarray['moderated'] = $allow_moderated;
/**
* These fields are for the convenience of plugins...
@@ -635,9 +634,24 @@ function item_post(&$a) {
call_hooks('post_local',$datarray);
+ if(x($datarray,'cancel')) {
+ logger('mod_item: post cancelled by plugin.');
+ if($return_path) {
+ goaway($a->get_baseurl() . "/" . $return_path);
+ }
+
+ $json = array('cancel' => 1);
+ if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
+ $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
+
+ echo json_encode($json);
+ killme();
+ }
+
if($orig_post) {
- $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ dbesc($title),
dbesc($body),
dbesc(datetime_convert()),
intval($post_id),
@@ -657,8 +671,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin` )
- VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d )",
+ `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated` )
+ VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -695,7 +709,8 @@ function item_post(&$a) {
intval($datarray['pubmail']),
dbesc($datarray['attach']),
intval($datarray['bookmark']),
- intval($datarray['origin'])
+ intval($datarray['origin']),
+ intval($datarry['moderated'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@@ -731,6 +746,7 @@ function item_post(&$a) {
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
+ 'uid' => $user['uid'],
'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
@@ -773,6 +789,7 @@ function item_post(&$a) {
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
+ 'uid' => $user['uid'],
'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
@@ -840,8 +857,8 @@ function item_post(&$a) {
$disclaimer .= sprintf( t('You may visit them online at %s'), $a->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;
- $subject = '[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
- $headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
+ $subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8');
+ $headers = 'From: ' . email_header_encode($a->user['username'],'UTF-8') . ' <' . $a->user['email'] . '>' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
diff --git a/mod/network.php b/mod/network.php
index 271a1236d..03a671b61 100755
--- a/mod/network.php
+++ b/mod/network.php
@@ -56,7 +56,9 @@ function saved_searches($search) {
. ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
. ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'conv')) ? '?conv=' . $_GET['conv'] : '')
- . ((x($_GET,'nets')) ? '?nets=' . $_GET['nets'] : '');
+ . ((x($_GET,'nets')) ? '?nets=' . $_GET['nets'] : '')
+ . ((x($_GET,'cmin')) ? '?cmin=' . $_GET['cmin'] : '')
+ . ((x($_GET,'cmax')) ? '?cmax=' . $_GET['cmax'] : '');
$o = '';
@@ -113,6 +115,7 @@ function network_content(&$a, $update = 0) {
$all_active = '';
$search_active = '';
$conv_active = '';
+ $spam_active = '';
if(($a->argc > 1 && $a->argv[1] === 'new')
|| ($a->argc > 2 && $a->argv[2] === 'new')) {
@@ -135,12 +138,17 @@ function network_content(&$a, $update = 0) {
$conv_active = 'active';
}
+ if($_GET['spam']) {
+ $spam_active = 'active';
+ }
+
if (($new_active == '')
&& ($starred_active == '')
&& ($bookmarked_active == '')
&& ($conv_active == '')
- && ($search_active == '')) {
+ && ($search_active == '')
+ && ($spam_active == '')) {
$all_active = 'active';
}
@@ -151,9 +159,7 @@ function network_content(&$a, $update = 0) {
$all_active = '';
$postord_active = 'active';
}
-
-
-
+
// tabs
$tabs = array(
array(
@@ -187,6 +193,13 @@ function network_content(&$a, $update = 0) {
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&bmark=1',
'sel'=>$bookmarked_active,
),
+// array(
+// 'label' => t('Spam'),
+// 'url'=>$a->get_baseurl() . '/network?f=&spam=1'
+// 'sel'=> $spam_active,
+// ),
+
+
);
$tpl = get_markup_template('common_tabs.tpl');
$o .= replace_macros($tpl, array('$tabs'=>$tabs));
@@ -209,7 +222,10 @@ function network_content(&$a, $update = 0) {
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
+ $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0);
$nets = ((x($_GET,'nets')) ? $_GET['nets'] : '');
+ $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : 0);
+ $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99);
if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true;
@@ -271,11 +287,7 @@ function network_content(&$a, $update = 0) {
$sql_nets = (($nets) ? sprintf(" and `contact`.`network` = '%s' ", dbesc($nets)) : '');
- // We'll need the following line if starred/bookmarks are allowed in comments in the future
- // $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) ";
-
- // Otherwise, this is a bit faster:
- $sql_extra = $sql_options;
+ $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) ";
if($group) {
$r = q("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -337,14 +349,18 @@ function network_content(&$a, $update = 0) {
$o .= "<script> var profile_uid = " . $_SESSION['uid']
. "; var netargs = '" . substr($a->cmd,8)
. '?f='
- . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
+ . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
- . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
- . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '')
- . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
- . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '')
- . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
- . ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '')
+ . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
+ . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '')
+ . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
+ . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '')
+ . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
+ . ((x($_GET,'spam')) ? '&spam=' . $_GET['spam'] : '')
+ . ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '')
+ . ((x($_GET,'cmin')) ? '&cmin=' . $_GET['cmin'] : '')
+ . ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
+
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
diff --git a/mod/newmember.php b/mod/newmember.php
index 60ca49757..2ecc89024 100755
--- a/mod/newmember.php
+++ b/mod/newmember.php
@@ -9,35 +9,39 @@ function newmember_content(&$a) {
$o .= '<div style="font-size: 120%;">';
- $o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page.');
+ $o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
$o .= '<ul>';
- $o .= '<li>' . '<a href="settings">' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This will be useful in making friends.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="settings">' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="settings">' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="settings">' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="profile_photo">' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</a></li>' . EOL;
if(in_array('facebook', $a->plugins))
- $o .= '<li>' . '<a href="facebook">' . t("Authorise the Facebook Connector if you currently have a Facebook account and we will \x28optionally\x29 import all your Facebook friends and conversations.") . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="facebook">' . t("Authorise the Facebook Connector if you currently have a Facebook account and we will \x28optionally\x29 import all your Facebook friends and conversations.") . '</a></li>' . EOL;
+ else
+ $o .= '<li>' . '<a target="newmember" href="help/Installing-Connectors">' . t("<em>If</em> this is your own personal server, installing the Facebook addon may ease your transition to the free social web.") . '</a></li>' . EOL;
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(! $mail_disabled)
- $o .= '<li>' . '<a href="settings/connectors">' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="profiles">' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="profiles">' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="contacts">' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="directory">' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="directory">' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="contacts">' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="contacts">' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</a></li>' . EOL;
- $o .= '<li>' . '<a href="help">' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</a></li>' . EOL;
+ $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</a></li>' . EOL;
+
+ $o .= '<li>' . '<a target="newmember" href="help">' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</a></li>' . EOL;
$o .= '</div>';
diff --git a/mod/notifications.php b/mod/notifications.php
index 82d450a88..635639d89 100755
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -142,6 +142,8 @@ function notifications_content(&$a) {
'$fullname' => $rr['fname'],
'$url' => $rr['furl'],
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
+ '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')),
+
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
'$note' => $rr['note'],
@@ -187,6 +189,7 @@ function notifications_content(&$a) {
'$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
'$fullname' => $rr['name'],
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
+ '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')),
'$url' => $rr['url'],
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
diff --git a/mod/oembed.php b/mod/oembed.php
index 25995813a..236625f68 100755
--- a/mod/oembed.php
+++ b/mod/oembed.php
@@ -2,11 +2,26 @@
require_once("include/oembed.php");
function oembed_content(&$a){
+ // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
+
+ if ($a->argv[1]=='b2h'){
+ $url = array( "", trim(hex2bin($_REQUEST['url'])));
+ echo oembed_replacecb($url);
+ killme();
+ }
+
+ if ($a->argv[1]=='h2b'){
+ $text = trim(hex2bin($_REQUEST['text']));
+ echo oembed_html2bbcode($text);
+ killme();
+ }
+
if ($a->argc == 2){
echo "<html><body>";
$url = base64url_decode($a->argv[1]);
$j = oembed_fetch_url($url);
echo $j->html;
+// logger('mod-oembed ' . $j->html, LOGGER_ALL);
echo "</body></html>";
}
killme();
diff --git a/mod/oexchange.php b/mod/oexchange.php
index 53dce6446..bbb436e70 100755
--- a/mod/oexchange.php
+++ b/mod/oexchange.php
@@ -11,8 +11,6 @@ function oexchange_init(&$a) {
killme();
}
-
-
}
@@ -28,14 +26,14 @@ function oexchange_content(&$a) {
return;
}
- $url = (((x($_GET,'url')) && strlen($_GET['url']))
- ? urlencode(notags(trim($_GET['url']))) : '');
- $title = (((x($_GET,'title')) && strlen($_GET['title']))
- ? '&title=' . urlencode(notags(trim($_GET['title']))) : '');
- $description = (((x($_GET,'description')) && strlen($_GET['description']))
- ? '&description=' . urlencode(notags(trim($_GET['description']))) : '');
- $tags = (((x($_GET,'tags')) && strlen($_GET['tags']))
- ? '&tags=' . urlencode(notags(trim($_GET['tags']))) : '');
+ $url = (((x($_REQUEST,'url')) && strlen($_REQUEST['url']))
+ ? urlencode(notags(trim($_REQUEST['url']))) : '');
+ $title = (((x($_REQUEST,'title')) && strlen($_REQUEST['title']))
+ ? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '');
+ $description = (((x($_REQUEST,'description')) && strlen($_REQUEST['description']))
+ ? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '');
+ $tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
+ ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
$s = fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
@@ -51,7 +49,7 @@ function oexchange_content(&$a) {
$post['body'] = html2bbcode($s);
$post['type'] = 'wall';
- $_POST = $post;
+ $_REQUEST = $post;
require_once('mod/item.php');
item_post($a);
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 2df9de476..e0b378f68 100755
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -12,6 +12,13 @@ function parse_url_content(&$a) {
$text = null;
$str_tags = '';
+ $textmode = false;
+ if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
+ $textmode = true;
+
+ if($textmode)
+ $br = (($textmode) ? "\n" : '<br /?');
+
if(x($_GET,'binurl'))
$url = trim(hex2bin($_GET['binurl']));
else
@@ -27,14 +34,17 @@ function parse_url_content(&$a) {
$arr_tags = str_getcsv($_GET['tags']);
if(count($arr_tags)) {
array_walk($arr_tags,'arr_add_hashes');
- $str_tags = '<br />' . implode(' ',$arr_tags) . '<br />';
+ $str_tags = $br . implode(' ',$arr_tags) . $br;
}
}
logger('parse_url: ' . $url);
- $template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
+ if($textmode)
+ $template = $br . '[bookmark=%s]%s[/bookmark]%s' . $br;
+ else
+ $template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
$arr = array('url' => $url, 'text' => '');
@@ -49,7 +59,11 @@ function parse_url_content(&$a) {
if($url && $title && $text) {
- $text = '<br /><br /><blockquote>' . $text . '</blockquote><br />';
+ if($textmode)
+ $text = $br . $br . '[quote]' . $text . '[/quote]' . $br;
+ else
+ $text = '<br /><br /><blockquote>' . $text . '</blockquote><br />';
+
$title = str_replace(array("\r","\n"),array('',''),$title);
$result = sprintf($template,$url,($title) ? $title : $url,$text) . $str_tags;
@@ -208,10 +222,17 @@ function parse_url_content(&$a) {
$ph->scaleImage(300);
$new_width = $ph->getWidth();
$new_height = $ph->getHeight();
- $image = '<br /><br /><img height="' . $new_height . '" width="' . $new_width . '" src="' .$image . '" alt="photo" />';
+ if($textmode)
+ $image = $br . $br . '[img=' . $new_width . 'x' . $new_height . ']' . $image . '[/img]';
+ else
+ $image = '<br /><br /><img height="' . $new_height . '" width="' . $new_width . '" src="' .$image . '" alt="photo" />';
+ }
+ else {
+ if($textmode)
+ $image = $br . $br . '[img]' . $image . '[/img]';
+ else
+ $image = '<br /><br /><img src="' . $image . '" alt="photo" />';
}
- else
- $image = '<br /><br /><img src="' . $image . '" alt="photo" />';
}
else
$image = '';
@@ -223,11 +244,14 @@ function parse_url_content(&$a) {
}
if(strlen($text)) {
- $text = '<br /><br /><blockquote>' . $text . '</blockquote><br />';
+ if($textmode)
+ $text = $br .$br . '[quote]' . $text . '[/quote]' . $br ;
+ else
+ $text = '<br /><br /><blockquote>' . $text . '</blockquote><br />';
}
if($image) {
- $text = $image . '<br />' . $text;
+ $text = $image . $br . $text;
}
$title = str_replace(array("\r","\n"),array('',''),$title);
diff --git a/mod/profile.php b/mod/profile.php
index 5d89db93e..eba9874a8 100755
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -128,7 +128,7 @@ function profile_content(&$a, $update = 0) {
}
if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
- $o .= '<a href="newmember">' . t('Tips for New Members') . '</a>' . EOL;
+ $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
$commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
$commvisitor = (($commpage && $remote_contact == true) ? true : false);
diff --git a/mod/redir.php b/mod/redir.php
index eb9702b04..9223e5483 100755
--- a/mod/redir.php
+++ b/mod/redir.php
@@ -2,44 +2,59 @@
function redir_init(&$a) {
- if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1])))
- goaway(z_root());
- $cid = $a->argv[1];
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
- $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($cid),
- intval(local_user())
- );
+ // traditional DFRN
- if((! count($r)) || ($r[0]['network'] !== 'dfrn'))
- goaway(z_root());
+ if(local_user() && $a->argc == 2 && intval($a->argv[1])) {
- $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
+ $cid = $a->argv[1];
- if($r[0]['duplex'] && $r[0]['issued-id']) {
- $orig_id = $r[0]['issued-id'];
- $dfrn_id = '1:' . $orig_id;
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($cid),
+ intval(local_user())
+ );
+
+ if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ goaway(z_root());
+
+ $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
+
+ if($r[0]['duplex'] && $r[0]['issued-id']) {
+ $orig_id = $r[0]['issued-id'];
+ $dfrn_id = '1:' . $orig_id;
+ }
+ if($r[0]['duplex'] && $r[0]['dfrn-id']) {
+ $orig_id = $r[0]['dfrn-id'];
+ $dfrn_id = '0:' . $orig_id;
+ }
+
+ $sec = random_string();
+
+ q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)
+ VALUES( %d, %s, '%s', '%s', %d )",
+ intval(local_user()),
+ intval($cid),
+ dbesc($dfrn_id),
+ dbesc($sec),
+ intval(time() + 45)
+ );
+
+ logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
+ $dest = (($url) ? '&destination_url=' . $url : '');
+ goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
+ . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );
}
- if($r[0]['duplex'] && $r[0]['dfrn-id']) {
- $orig_id = $r[0]['dfrn-id'];
- $dfrn_id = '0:' . $orig_id;
+
+ if(local_user())
+ $handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3);
+ if(remote_user())
+ $handle = $_SESSION['handle'];
+
+ if($url) {
+ $url = str_replace('{zid}','&zid=' . $handle,$url);
+ goaway($url);
}
- $sec = random_string();
-
- q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)
- VALUES( %d, %s, '%s', '%s', %d )",
- intval(local_user()),
- intval($cid),
- dbesc($dfrn_id),
- dbesc($sec),
- intval(time() + 45)
- );
-
- logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
- $dest = (($url) ? '&destination_url=' . $url : '');
- goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
- . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );
-
+ goaway(z_root());
}
diff --git a/mod/register.php b/mod/register.php
index 89f561642..388b3e250 100755
--- a/mod/register.php
+++ b/mod/register.php
@@ -278,8 +278,8 @@ function register_post(&$a) {
return;
}
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
- `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date` )
- VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+ `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
+ VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
intval($newuid),
datetime_convert(),
dbesc($username),
diff --git a/mod/regmod.php b/mod/regmod.php
index 76ea4062e..17e728ba2 100755
--- a/mod/regmod.php
+++ b/mod/regmod.php
@@ -107,7 +107,7 @@ function regmod_content(&$a) {
return $o;
}
- if(!is_site_admin()) {
+ if((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) {
notice( t('Permission denied.') . EOL);
return '';
}
diff --git a/mod/settings.php b/mod/settings.php
index c61d5c227..57a4e6db0 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -734,8 +734,11 @@ function settings_content(&$a) {
if($files) {
foreach($files as $file) {
$f = basename($file);
- $theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
- $themes[$f]=$theme_name;
+ $is_experimental = file_exists($file . '/experimental');
+ if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
+ $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
+ $themes[$f]=$theme_name;
+ }
}
}
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
@@ -757,7 +760,7 @@ function settings_content(&$a) {
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
$expire_arr = array(
- 'days' => array('expire', t("Automatically expire posts after days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
+ 'days' => array('expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
'advanced' => t('Advanced expiration settings'),
'label' => t('Advanced Expiration'),
'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))),
@@ -818,6 +821,7 @@ function settings_content(&$a) {
'$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
'$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
'$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
+ '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
'$h_advn' => t('Advanced Page Settings'),
diff --git a/mod/smilies.php b/mod/smilies.php
new file mode 100755
index 000000000..c47f95da7
--- /dev/null
+++ b/mod/smilies.php
@@ -0,0 +1,3 @@
+<?php
+
+function smilies_content(&$a) { return smilies('',true); }
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index a66ed0d05..ecf475291 100755
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -61,8 +61,6 @@ function wall_attach_post(&$a) {
$filedata = @file_get_contents($src);
$mimetype = z_mime_content_type($filename);
- if(((! strlen($mimetype)) || ($mimetype === 'application/octet-stream')) && function_exists('mime_content_type'))
- $mimetype = mime_content_type($filename);
$hash = random_string();
$created = datetime_convert();
$r = q("INSERT INTO `attach` ( `uid`, `hash`, `filename`, `filetype`, `filesize`, `data`, `created`, `edited`, `allow_cid`, `allow_gid`,`deny_cid`, `deny_gid` )
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index b34f2cf6b..278c21354 100755
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -100,7 +100,11 @@ function wall_upload_post(&$a) {
}
$basename = basename($filename);
- echo '<br /><br /><a href="' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" /></a><br /><br />";
+
+ if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
+ echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.jpg[/img][/url]\n\n";
+ else
+ echo '<br /><br /><a href="' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" /></a><br /><br />";
killme();
// NOTREACHED