From 87ecd8f6585d1d02ecb851c4acbfe6a09c8dd003 Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Sat, 24 Oct 2015 15:04:27 +0200
Subject: [PATCH 01/10] tabs have now an ID
---
mod/contacts.php | 11 ++++++++
mod/network.php | 71 +++++++++++++++++++++++++++---------------------
2 files changed, 51 insertions(+), 31 deletions(-)
diff --git a/mod/contacts.php b/mod/contacts.php
index c562c9822..0ecc5a76d 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -550,6 +550,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
'sel' => '',
'title' => t('Toggle Blocked status'),
+ 'id' => 'toggle-block-tab',
'accesskey' => 'b',
),
array(
@@ -557,6 +558,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
'sel' => '',
'title' => t('Toggle Ignored status'),
+ 'id' => 'toggle-ignore-tab',
'accesskey' => 'i',
),
@@ -565,6 +567,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive',
'sel' => '',
'title' => t('Toggle Archive status'),
+ 'id' => 'toggle-archive-tab',
'accesskey' => 'v',
),
array(
@@ -572,6 +575,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
'sel' => '',
'title' => t('Advanced Contact Settings'),
+ 'id' => 'repair-tab',
'accesskey' => 'r',
)
);
@@ -693,6 +697,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/suggest',
'sel' => '',
'title' => t('Suggest potential friends'),
+ 'id' => 'suggestions-tab',
'accesskey' => 'g',
),
array(
@@ -700,6 +705,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/all',
'sel' => ($all) ? 'active' : '',
'title' => t('Show all contacts'),
+ 'id' => 'showall-tab',
'accesskey' => 'l',
),
array(
@@ -707,6 +713,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts',
'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '',
'title' => t('Only show unblocked contacts'),
+ 'id' => 'showunblocked-tab',
'accesskey' => 'o',
),
@@ -715,6 +722,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/blocked',
'sel' => ($blocked) ? 'active' : '',
'title' => t('Only show blocked contacts'),
+ 'id' => 'showblocked-tab',
'accesskey' => 'b',
),
@@ -723,6 +731,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/ignored',
'sel' => ($ignored) ? 'active' : '',
'title' => t('Only show ignored contacts'),
+ 'id' => 'showignored-tab',
'accesskey' => 'i',
),
@@ -731,6 +740,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/archived',
'sel' => ($archived) ? 'active' : '',
'title' => t('Only show archived contacts'),
+ 'id' => 'showarchived-tab',
'accesskey' => 'y',
),
@@ -739,6 +749,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/hidden',
'sel' => ($hidden) ? 'active' : '',
'title' => t('Only show hidden contacts'),
+ 'id' => 'showhidden-tab',
'accesskey' => 'h',
),
diff --git a/mod/network.php b/mod/network.php
index dfd7c0130..639d868fa 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -119,19 +119,19 @@ function network_init(&$a) {
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
if(x($_GET,'save')) {
- $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
+ $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') ",
+ 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'",
+ q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s'",
intval(local_user()),
dbesc($search)
);
@@ -172,7 +172,7 @@ function saved_searches($search) {
$o = '';
- $r = q("select `id`,`term` from `search` WHERE `uid` = %d",
+ $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d",
intval(local_user())
);
@@ -355,57 +355,63 @@ function network_content(&$a, $update = 0) {
// tabs
$tabs = array(
array(
- 'label' => t('Commented Order'),
- 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
- 'sel'=>$all_active,
- 'title'=> t('Sort by Comment Date'),
+ 'label' => t('Commented Order'),
+ 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
+ 'sel' => $all_active,
+ 'title' => t('Sort by Comment Date'),
+ 'id' => 'commented-order-tab',
'accesskey' => "e",
),
array(
- 'label' => t('Posted Order'),
- 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
- 'sel'=>$postord_active,
- 'title' => t('Sort by Post Date'),
+ 'label' => t('Posted Order'),
+ 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
+ 'sel' => $postord_active,
+ 'title' => t('Sort by Post Date'),
+ 'id' => 'posted-order-tab',
'accesskey' => "t",
),
);
if(feature_enabled(local_user(),'personal_tab')) {
$tabs[] = array(
- 'label' => t('Personal'),
- 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
- 'sel' => $conv_active,
- 'title' => t('Posts that mention or involve you'),
+ 'label' => t('Personal'),
+ 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
+ 'sel' => $conv_active,
+ 'title' => t('Posts that mention or involve you'),
+ 'id' => 'personal-tab',
'accesskey' => "r",
);
}
if(feature_enabled(local_user(),'new_tab')) {
$tabs[] = array(
- 'label' => t('New'),
- 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
- 'sel' => $new_active,
- 'title' => t('Activity Stream - by date'),
+ 'label' => t('New'),
+ 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
+ 'sel' => $new_active,
+ 'title' => t('Activity Stream - by date'),
+ 'id' => 'activitiy-by-date-tab',
'accesskey' => "w",
);
}
if(feature_enabled(local_user(),'link_tab')) {
$tabs[] = array(
- 'label' => t('Shared Links'),
- 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
- 'sel'=>$bookmarked_active,
- 'title'=> t('Interesting Links'),
+ 'label' => t('Shared Links'),
+ 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
+ 'sel' => $bookmarked_active,
+ 'title' => t('Interesting Links'),
+ 'id' => 'shared-links-tab',
'accesskey' => "b",
);
}
if(feature_enabled(local_user(),'star_posts')) {
$tabs[] = array(
- 'label' => t('Starred'),
- 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
- 'sel'=>$starred_active,
- 'title' => t('Favourite Posts'),
+ 'label' => t('Starred'),
+ 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
+ 'sel' => $starred_active,
+ 'title' => t('Favourite Posts'),
+ 'id' => 'starred-posts-tab',
'accesskey' => "m",
);
}
@@ -446,7 +452,7 @@ function network_content(&$a, $update = 0) {
$def_acl = array('allow_cid' => '<' . intval($cid) . '>');
if($nets) {
- $r = q("select id from contact where uid = %d and network = '%s' and self = 0",
+ $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND network = '%s' AND `self` = 0",
intval(local_user()),
dbesc($nets)
);
@@ -475,7 +481,10 @@ function network_content(&$a, $update = 0) {
$content = "";
if ($cid) {
- $contact = q("SELECT `nick` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `forum`", intval($cid), intval(local_user()));
+ $contact = q("SELECT `nick` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `forum`",
+ intval($cid),
+ intval(local_user())
+ );
if ($contact)
$content = "@".$contact[0]["nick"]."+".$cid;
}
@@ -569,7 +578,7 @@ function network_content(&$a, $update = 0) {
);
if(count($r)) {
$sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item`
- WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." and deleted = 0
+ WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." AND `deleted` = 0
ORDER BY `item`.`received` DESC) AS `temp1`
ON $sql_table.$sql_parent = `temp1`.`parent` ";
$sql_extra = "";
From ea2b3b2f762a323ca5a7a820857c4bea51d22637 Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Sat, 24 Oct 2015 15:57:46 +0200
Subject: [PATCH 02/10] move html from crepair.php to template
---
mod/crepair.php | 26 +++++++++++++++-----------
view/templates/crepair.tpl | 11 +++++++++++
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/mod/crepair.php b/mod/crepair.php
index 686be3948..4f0019099 100644
--- a/mod/crepair.php
+++ b/mod/crepair.php
@@ -137,16 +137,10 @@ function crepair_content(&$a) {
$contact = $r[0];
- $msg1 = t('Repair Contact Settings');
+ $warning = t('WARNING: This is highly advanced and if you enter incorrect information your communications with this contact may stop working.');
+ $info = t('Please use your browser \'Back\' button now if you are uncertain what to do on this page.');
- $msg2 = t('WARNING: This is highly advanced and if you enter incorrect information your communications with this contact may stop working.');
- $msg3 = t('Please use your browser \'Back\' button now if you are uncertain what to do on this page.');
-
- $o .= '
' . $msg1 . '
';
-
- $o .= '' . $msg2 . EOL . EOL. $msg3 . '
';
-
- $o .= EOL . '' . t('Return to contact editor') . '' . EOL;
+ $returnaddr = "contacts/$cid";
$allow_remote_self = get_config('system','allow_users_remote_self');
@@ -165,6 +159,11 @@ function crepair_content(&$a) {
$tpl = get_markup_template('crepair.tpl');
$o .= replace_macros($tpl, array(
+ '$title' => t('Repair Contact Settings'),
+ '$warning' => $warning,
+ '$info' => $info,
+ '$returnaddr' => $returnaddr,
+ '$return' => t('Return to contact editor'),
'$update_profile' => update_profile,
'$udprofilenow' => t('Refetch contact data'),
'$label_name' => t('Name'),
@@ -178,7 +177,12 @@ function crepair_content(&$a) {
'$label_photo' => t('New photo from this URL'),
'$label_remote_self' => t('Remote Self'),
'$allow_remote_self' => $allow_remote_self,
- '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options),
+ '$remote_self' => array('remote_self',
+ t('Mirror postings from this contact'),
+ $contact['remote_self'],
+ t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
+ $remote_self_options
+ ),
'$contact_name' => htmlentities($contact['name']),
'$contact_nick' => htmlentities($contact['nick']),
'$contact_id' => $contact['id'],
@@ -189,7 +193,7 @@ function crepair_content(&$a) {
'$poll' => $contact['poll'],
'$contact_attag' => $contact['attag'],
'$lbl_submit' => t('Submit')
- ));
+ ));
return $o;
diff --git a/view/templates/crepair.tpl b/view/templates/crepair.tpl
index 5b3a6281e..91c85303c 100644
--- a/view/templates/crepair.tpl
+++ b/view/templates/crepair.tpl
@@ -1,3 +1,14 @@
+
+{{include file="section_title.tpl"}}
+
+
+
+