aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2011-09-05 21:05:24 +0200
committerfabrixxm <fabrix.xm@gmail.com>2011-09-05 21:05:24 +0200
commit2f5a34ad1791f01cacb3b86c11501f0e11c67df4 (patch)
treedd9242b14387c833346f4172e3f190659db56ff7 /mod
parent5ec4a4e6deb5d28cbfab54093f8b4180912738d4 (diff)
parent08e54234e30c10e3130b7d71caba9fd43e3593e3 (diff)
downloadvolse-hubzilla-2f5a34ad1791f01cacb3b86c11501f0e11c67df4.tar.gz
volse-hubzilla-2f5a34ad1791f01cacb3b86c11501f0e11c67df4.tar.bz2
volse-hubzilla-2f5a34ad1791f01cacb3b86c11501f0e11c67df4.zip
Merge branch 'newui' of github.com:fabrixxm/friendika into newui
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php6
-rw-r--r--mod/apps.php19
-rw-r--r--mod/contacts.php18
-rw-r--r--mod/crepair.php18
-rw-r--r--mod/item.php51
-rw-r--r--mod/localtime.php44
-rw-r--r--mod/network.php58
-rw-r--r--mod/parse_url.php10
-rw-r--r--mod/photos.php3
-rw-r--r--mod/ping.php22
10 files changed, 201 insertions, 48 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 7799e64ab..da561d554 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -344,7 +344,7 @@ function admin_page_site(&$a) {
* Users admin page
*/
function admin_page_users_post(&$a){
- $pending = ( x(£_POST, 'pending') ? $_POST['pending'] : Array() );
+ $pending = ( x($_POST, 'pending') ? $_POST['pending'] : Array() );
$users = ( x($_POST, 'user') ? $_POST['user'] : Array() );
if (x($_POST,'page_users_block')){
@@ -540,7 +540,7 @@ function admin_page_plugins(&$a){
}
$admin_form="";
- if (in_array($plugin, $a->plugins_admin)){
+ if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)){
@require_once("addon/$plugin/$plugin.php");
$func = $plugin.'_plugin_admin';
$func($a, $admin_form);
@@ -632,7 +632,7 @@ function admin_page_logs(&$a){
$f = get_config('system','logfile');
$size = filesize($f);
- if($size > 5000000)
+ if($size > 5000000 || $size < 0)
$size = 5000000;
$data = '';
diff --git a/mod/apps.php b/mod/apps.php
index 7a0a3f59e..8049b45fb 100644
--- a/mod/apps.php
+++ b/mod/apps.php
@@ -1,15 +1,18 @@
<?php
-
function apps_content(&$a) {
+ $title = t('Applications');
- $o .= '<h3>' . t('Applications') . '</h3>';
-
- if($a->apps)
- $o .= $a->apps;
- else
+ if(count($a->apps)==0)
notice( t('No installed applications.') . EOL);
- return $o;
-} \ No newline at end of file
+ $tpl = get_markup_template("apps.tpl");
+ return replace_macros($tpl, array(
+ '$title' => $title,
+ '$apps' => $a->apps,
+ ));
+
+
+
+}
diff --git a/mod/contacts.php b/mod/contacts.php
index 3b2b16acf..4decc5042 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -87,25 +87,15 @@ function contacts_post(&$a) {
$priority = intval($_POST['poll']);
- if($priority == (-1))
-
if($priority > 5 || $priority < 0)
$priority = 0;
- $rating = intval($_POST['reputation']);
- if($rating > 5 || $rating < 0)
- $rating = 0;
-
- $reason = notags(trim($_POST['reason']));
-
$info = escape_tags(trim($_POST['info']));
- $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s', `info` = '%s'
+ $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s'
WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id),
intval($priority),
- intval($rating),
- dbesc($reason),
dbesc($info),
intval($contact_id),
intval(local_user())
@@ -277,8 +267,6 @@ function contacts_content(&$a) {
$sparkle = '';
}
- $grps = '';
-
$insecure = '<div id="profile-edit-insecure"><p><img src="images/unlock_icon.gif" alt="' . t('Privacy Unavailable') . '" />&nbsp;'
. t('Private communications are not available for this contact.') . '</p></div>';
@@ -313,7 +301,6 @@ function contacts_content(&$a) {
'$lblcrepair' => t("Repair contact URL settings \x28WARNING: Advanced\x29"),
'$lblrecent' => t('View conversations'),
'$lblsuggest' => $lblsuggest,
- '$grps' => $grps,
'$delete' => t('Delete contact'),
'$nettype' => $nettype,
'$poll_interval' => contact_poll_interval($r[0]['priority'],(! $poll_enabled)),
@@ -330,9 +317,6 @@ function contacts_content(&$a) {
'$info' => $r[0]['info'],
'$blocked' => (($r[0]['blocked']) ? '<div id="block-message">' . t('Currently blocked') . '</div>' : ''),
'$ignored' => (($r[0]['readonly']) ? '<div id="ignore-message">' . t('Currently ignored') . '</div>' : ''),
- '$rating' => contact_reputation($r[0]['rating']),
- '$reason' => $r[0]['reason'],
- '$groups' => '', // group_selector(),
'$photo' => $r[0]['photo'],
'$name' => $r[0]['name'],
'$dir_icon' => $dir_icon,
diff --git a/mod/crepair.php b/mod/crepair.php
index 4babd6bf7..afa45e881 100644
--- a/mod/crepair.php
+++ b/mod/crepair.php
@@ -18,15 +18,16 @@ function crepair_post(&$a) {
$contact = $r[0];
- $nick = ((x($_POST,'nick')) ? $_POST['nick'] : null);
- $url = ((x($_POST,'url')) ? $_POST['url'] : null);
- $request = ((x($_POST,'request')) ? $_POST['request'] : null);
- $confirm = ((x($_POST,'confirm')) ? $_POST['confirm'] : null);
- $notify = ((x($_POST,'notify')) ? $_POST['notify'] : null);
- $poll = ((x($_POST,'poll')) ? $_POST['poll'] : null);
+ $nick = ((x($_POST,'nick')) ? $_POST['nick'] : '');
+ $url = ((x($_POST,'url')) ? $_POST['url'] : '');
+ $request = ((x($_POST,'request')) ? $_POST['request'] : '');
+ $confirm = ((x($_POST,'confirm')) ? $_POST['confirm'] : '');
+ $notify = ((x($_POST,'notify')) ? $_POST['notify'] : '');
+ $poll = ((x($_POST,'poll')) ? $_POST['poll'] : '');
+ $attag = ((x($_POST,'attag')) ? $_POST['attag'] : '');
- $r = q("UPDATE `contact` SET `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s'
+ $r = q("UPDATE `contact` SET `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s'
WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc($nick),
dbesc($url),
@@ -34,6 +35,7 @@ function crepair_post(&$a) {
dbesc($confirm),
dbesc($notify),
dbesc($poll),
+ dbesc($attag),
intval($contact['id']),
local_user()
);
@@ -84,6 +86,7 @@ function crepair_content(&$a) {
$o .= replace_macros($tpl, array(
'$label_name' => t('Name'),
'$label_nick' => t('Account Nickname'),
+ '$label_attag' => t('@Tagname - overrides Name/Nickname'),
'$label_url' => t('Account URL'),
'$label_request' => t('Friend Request URL'),
'$label_confirm' => t('Friend Confirm URL'),
@@ -97,6 +100,7 @@ function crepair_content(&$a) {
'$confirm' => $contact['confirm'],
'$notify' => $contact['notify'],
'$poll' => $contact['poll'],
+ '$contact_attag' => $contact['attag'],
'$lbl_submit' => t('Submit')
));
diff --git a/mod/item.php b/mod/item.php
index ef0b232d5..b4ec7666f 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -15,6 +15,8 @@
*
*/
+require_once('include/crypto.php');
+
function item_post(&$a) {
if((! local_user()) && (! remote_user()))
@@ -330,6 +332,15 @@ function item_post(&$a) {
}
}
+ // embedded bookmark in post? convert to regular url and set bookmark flag
+
+ $bookmark = 0;
+ if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",$body,$match)) {
+ $bookmark = 1;
+ $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body);
+ }
+
+
/**
* Fold multi-line [code] sequences
*/
@@ -351,7 +362,7 @@ function item_post(&$a) {
* and we are replying, and there isn't one already
*/
- if(($parent_contact) && ($parent_contact['network'] === 'stat')
+ if(($parent_contact) && ($parent_contact['network'] === NETWORK_OSTATUS)
&& ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
$body = '@' . $parent_contact['nick'] . ' ' . $body;
$tags[] = '@' . $parent_contact['nick'];
@@ -402,7 +413,8 @@ function item_post(&$a) {
);
}
else {
- $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
+ dbesc($name),
dbesc($name),
intval($profile_uid)
);
@@ -506,6 +518,7 @@ function item_post(&$a) {
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enable;
$datarray['attach'] = $attachments;
+ $datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
/**
@@ -548,8 +561,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`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
- 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', %d, %d, '%s' )",
+ `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` )
+ 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', %d, %d, '%s', %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -582,7 +595,8 @@ function item_post(&$a) {
dbesc($datarray['deny_gid']),
intval($datarray['private']),
intval($datarray['pubmail']),
- dbesc($datarray['attach'])
+ dbesc($datarray['attach']),
+ intval($datarray['bookmark'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@@ -674,6 +688,27 @@ function item_post(&$a) {
pop_lang();
}
+
+ // We won't be able to sign Diaspora comments for authenticated visitors - we don't have their private key
+
+ if($self) {
+ require_once('include/bb2diaspora.php');
+ $signed_body = html_entity_decode(bb2diaspora($datarray['body']));
+ $myaddr = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
+ if($datarray['verb'] === ACTIVITY_LIKE)
+ $signed_text = $datarray['guid'] . ';' . 'Post' . ';' . $parent_item['guid'] . ';' . 'true' . ';' . $myaddr;
+ else
+ $signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $myaddr;
+
+ $authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha'));
+
+ q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
+ intval($post_id),
+ dbesc($signed_text),
+ dbesc(base64_encode($authorsig)),
+ dbesc($myaddr)
+ );
+ }
}
else {
$parent = $post_id;
@@ -799,6 +834,12 @@ function item_post(&$a) {
}
}
+
+
+
+
+
+
logger('post_complete');
// figure out how to return, depending on from whence we came
diff --git a/mod/localtime.php b/mod/localtime.php
new file mode 100644
index 000000000..f5ecf3a96
--- /dev/null
+++ b/mod/localtime.php
@@ -0,0 +1,44 @@
+<?php
+
+require_once('include/datetime.php');
+
+
+function localtime_post(&$a) {
+
+ $t = $_REQUEST['time'];
+ if(! $t)
+ $t = 'now';
+
+ $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
+
+ if($_POST['timezone'])
+ $a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format);
+
+}
+
+function localtime_content(&$a) {
+ $t = $_REQUEST['time'];
+ if(! $t)
+ $t = 'now';
+
+ $o .= '<h3>' . t('Time Conversion') . '</h3>';
+
+ $o .= '<p>' . t('Friendika provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
+
+
+ if(x($a->data,'mod-localtime'))
+ $o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
+
+ $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
+
+ $o .= '<form action ="' . $a->get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';
+
+ $o .= '<p>' . t('Please select your timezone:') . '</p>';
+
+ $o .= select_timezone();
+
+ $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
+
+ return $o;
+
+} \ No newline at end of file
diff --git a/mod/network.php b/mod/network.php
index cf4c994f0..3c8125303 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -14,10 +14,31 @@ function network_init(&$a) {
$a->page['aside'] = '';
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
- $srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '');
+ $srchurl = '/network'
+ . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
+ . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
+ . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '');
+ if(x($_GET,'save')) {
+ $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ if(! count($r)) {
+ q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
+ }
+ if(x($_GET,'remove')) {
+ q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
- $a->page['aside'] .= search($search,'netsearch-box',$srchurl);
+ $a->page['aside'] .= search($search,'netsearch-box',$srchurl,true);
$a->page['aside'] .= '<div id="network-new-link">';
@@ -49,8 +70,34 @@ function network_init(&$a) {
$a->page['aside'] .= '</div>';
$a->page['aside'] .= group_side('network','network',true,$group_id);
+
+ $a->page['aside'] .= saved_searches();
+
}
+function saved_searches() {
+
+ $o = '';
+
+ $r = q("select `term` from `search` WHERE `uid` = %d",
+ intval(local_user())
+ );
+
+ if(count($r)) {
+ $o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n";
+ $o .= '<div id="saved-search-list"><ul id="saved-search-ul">' . "\r\n";
+ foreach($r as $rr) {
+ $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ }
+ $o .= '</ul></div>' . "\r\n";
+ }
+
+ return $o;
+
+}
+
+
+
function network_content(&$a, $update = 0) {
@@ -70,6 +117,7 @@ function network_content(&$a, $update = 0) {
$cid = ((x($_GET['cid'])) ? intval($_GET['cid']) : 0);
$star = ((x($_GET['star'])) ? intval($_GET['star']) : 0);
+ $bmark = ((x($_GET['bmark'])) ? intval($_GET['bmark']) : 0);
if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true;
@@ -130,6 +178,7 @@ function network_content(&$a, $update = 0) {
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
+ . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
@@ -151,6 +200,9 @@ function network_content(&$a, $update = 0) {
$star_sql = (($star) ? " AND `starred` = 1 " : '');
+ if($bmark)
+ $star_sql .= " AND `bookmark` = 1 ";
+
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $star_sql ) ";
if($group) {
@@ -188,7 +240,7 @@ function network_content(&$a, $update = 0) {
if(count($r)) {
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $star_sql AND `contact-id` IN ( " . intval($cid) . " )) ";
$o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o;
- if($r[0]['network'] !== NETWORK_MAIL && $r[0]['network'] !== NETWORK_DFRN && $r[0]['network'] !== NETWORK_FACEBOOK && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
+ if($r[0]['network'] !== NETWORK_MAIL && $r[0]['network'] !== NETWORK_DFRN && $r[0]['network'] !== NETWORK_FACEBOOK && $r[0]['network'] !== NETWORK_DIASPORA && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice( t('Private messages to this person are at risk of public disclosure.') . EOL);
}
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 9bb0bc464..79c336ddc 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -13,7 +13,7 @@ function parse_url_content(&$a) {
$text = null;
- $template = "<br /><a href=\"%s\" >%s</a>%s<br />";
+ $template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
$arr = array('url' => $url, 'text' => '');
@@ -119,6 +119,12 @@ function parse_url_content(&$a) {
$text = '<br /><br /><blockquote>' . $text . '</blockquote><br />';
}
- echo sprintf($template,$url,($title) ? $title : $url,$text);
+ $title = str_replace("\n",'',$title);
+
+ $result = sprintf($template,$url,($title) ? $title : $url,$text);
+
+ logger('parse_url: returns: ' . $result);
+
+ echo $result;
killme();
}
diff --git a/mod/photos.php b/mod/photos.php
index cb13b7603..b74ca85d7 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -414,7 +414,8 @@ function photos_post(&$a) {
);
}
else {
- $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
+ dbesc($name),
dbesc($name),
intval($page_owner_uid)
);
diff --git a/mod/ping.php b/mod/ping.php
index 8a3d284af..38a32744d 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -159,8 +159,26 @@ function ping_init(&$a) {
}
- echo " </notif>
- </result>
+ echo " </notif>";
+
+ echo " <sysmsgs>";
+ if(x($_SESSION,'sysmsg')){
+ foreach ($_SESSION['sysmsg'] as $m){
+ echo "<notice>".($m)."</notice>";
+ }
+ $_SESSION['sysmsg']=array();
+ unset($_SESSION['sysmsg']);
+ }
+ if(x($_SESSION,'sysmsg_info')){
+ foreach ($_SESSION['sysmsg_info'] as $m){
+ echo "<info>".($m)."</info>";
+ }
+ $_SESSION['sysmsg_info']=array();
+ unset($_SESSION['sysmsg_info']);
+ }
+
+ echo " </sysmsgs>";
+ echo"</result>
";
killme();