diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 6 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 31 | ||||
-rw-r--r-- | mod/directory.php | 3 | ||||
-rw-r--r-- | mod/display.php | 30 | ||||
-rw-r--r-- | mod/home.php | 3 | ||||
-rw-r--r-- | mod/message.php | 4 | ||||
-rw-r--r-- | mod/network.php | 40 | ||||
-rw-r--r-- | mod/photo.php | 4 | ||||
-rw-r--r-- | mod/profile.php | 30 | ||||
-rw-r--r-- | mod/profiles.php | 3 | ||||
-rw-r--r-- | mod/settings.php | 1 |
11 files changed, 51 insertions, 104 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index beb1f1ecb..02c75c775 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -4,6 +4,8 @@ require_once('include/Contact.php'); function contacts_init(&$a) { require_once('include/group.php'); + if(! x($a->page,'aside')) + $a->page['aside'] = ''; $a->page['aside'] .= group_side(); if($a->config['register_policy'] != REGISTER_CLOSED) @@ -84,7 +86,11 @@ function contacts_post(&$a) { function contacts_content(&$a) { + $sort_type = 0; + $o = ''; $o .= '<script> $(document).ready(function() { $(\'#nav-contacts-link\').addClass(\'nav-selected\'); });</script>'; + + if(! local_user()) { notice( t('Permission denied.') . EOL); return; diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 84c249a58..8a573c956 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -6,16 +6,11 @@ require_once('include/auth.php'); function dfrn_poll_init(&$a) { - $dfrn_id = ''; - - if(x($_GET,'dfrn_id')) - $dfrn_id = $_GET['dfrn_id']; - if(x($_GET,'type')) - $type = $_GET['type']; - if(x($_GET,'last_update')) - $last_update = $_GET['last_update']; - $dfrn_version = (float) $_GET['dfrn_version'] ; - $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : ''); + $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); + $type = ((x($_GET,'type')) ? $_GET['type'] : ''); + $last_update = ((x($_GET,'last_update')) ? $_GET['last_update'] : ''); + $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : ''); + $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 0); $direction = (-1); @@ -23,7 +18,7 @@ function dfrn_poll_init(&$a) { if(strpos($dfrn_id,':') == 1) { $direction = intval(substr($dfrn_id,0,1)); - $dfrn_id = substr($dfrn_id,2); + $dfrn_id = substr($dfrn_id,2); } if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) { @@ -33,7 +28,7 @@ function dfrn_poll_init(&$a) { killme(); } - if((x($type)) && ($type === 'profile')) { + if((isset($type)) && ($type === 'profile')) { $sql_extra = ''; switch($direction) { @@ -89,7 +84,7 @@ function dfrn_poll_init(&$a) { } - if((x($type)) && ($type === 'profile-check')) { + if((isset($type)) && ($type === 'profile-check')) { switch($direction) { case 1: @@ -119,15 +114,15 @@ function dfrn_poll_init(&$a) { function dfrn_poll_post(&$a) { - $dfrn_id = $_POST['dfrn_id']; - $challenge = $_POST['challenge']; - $url = $_POST['url']; - $dfrn_version = (float) $_POST['dfrn_version']; + $dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : ''); + $challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : ''); + $url = ((x($_POST,'url')) ? $_POST['url'] : ''); + $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 0); $direction = (-1); if(strpos($dfrn_id,':') == 1) { $direction = intval(substr($dfrn_id,0,1)); - $dfrn_id = substr($dfrn_id,2); + $dfrn_id = substr($dfrn_id,2); } diff --git a/mod/directory.php b/mod/directory.php index 01cb1a3ff..703c08ce1 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -4,11 +4,12 @@ function directory_init(&$a) { } function directory_content(&$a) { + $o = ''; $o .= '<script> $(document).ready(function() { $(\'#nav-directory-link\').addClass(\'nav-selected\'); });</script>'; $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : ''); - $tpl .= load_view_file('view/directory_header.tpl'); + $tpl = load_view_file('view/directory_header.tpl'); $globaldir = ''; $gdirpath = dirname(get_config('system','directory_submit_url')); diff --git a/mod/display.php b/mod/display.php index 84176d293..2e35cd6ac 100644 --- a/mod/display.php +++ b/mod/display.php @@ -113,40 +113,18 @@ function display_content(&$a) { if(count($r)) { foreach($r as $item) { - $sparkle = ''; - if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) { - $url = $item['url']; - if(($item['network'] === 'dfrn') && (! $item['self'])) { - $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle"'; - } - if(! is_array($alike[$item['parent'] . '-l'])) - $alike[$item['parent'] . '-l'] = array(); - $alike[$item['parent']] ++; - $alike[$item['parent'] . '-l'][] = '<a href="'. $url . '"' . $sparkle . '>' . $item['name'] . '</a>'; - } - if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) { - $url = $item['url']; - if(($item['network'] === 'dfrn') && (! $item['self'])) { - $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle"'; - } - if(! is_array($dlike[$item['parent'] . '-l'])) - $dlike[$item['parent'] . '-l'] = array(); - $dlike[$item['parent']] ++; - $dlike[$item['parent'] . '-l'][] = '<a href="'. $url . '"' . $sparkle . '>' . $item['name'] . '</a>'; - } + like_puller($a,$item,$alike,'like'); + like_puller($a,$item,$dlike,'dislike'); } - - foreach($r as $item) { $comment = ''; $template = $tpl; $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) + if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) + && ($item['id'] != $item['parent'])) continue; $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) diff --git a/mod/home.php b/mod/home.php index 4406576a3..b04c72896 100644 --- a/mod/home.php +++ b/mod/home.php @@ -13,6 +13,9 @@ function home_init(&$a) { if(! function_exists('home_content')) { function home_content(&$a) { + $o = ''; + if(! (x($a->page,'footer'))) + $a->page['footer'] = ''; $a->page['footer'] .= "<div class=\"powered\" >Powered by <a href=\"http://mistpark.com\" name=\"mistpark\" >mistpark</a></div>"; $o .= '<h1>Welcome' . ((x($a->config,'sitename')) ? " to {$a->config['sitename']}" : "" ) . '</h1>'; if(file_exists('home.html')) diff --git a/mod/message.php b/mod/message.php index b847f31dc..1524bfd36 100644 --- a/mod/message.php +++ b/mod/message.php @@ -86,6 +86,8 @@ function message_post(&$a) { } function message_content(&$a) { + + $o = ''; $o .= '<script> $(document).ready(function() { $(\'#nav-messages-link\').addClass(\'nav-selected\'); });</script>'; if(! local_user()) { @@ -156,7 +158,7 @@ function message_content(&$a) { $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); - $select .= contact_select('messageto','message-to-select', false, 4, true); + $select = contact_select('messageto','message-to-select', false, 4, true); $tpl = load_view_file('view/prv_message.tpl'); $o .= replace_macros($tpl,array( '$header' => t('Send Private Message'), diff --git a/mod/network.php b/mod/network.php index cbd8b6bc3..a6e03440b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -3,6 +3,8 @@ function network_init(&$a) { require_once('include/group.php'); + if(! x($a->page,'aside')) + $a->page['aside'] = ''; $a->page['aside'] .= group_side('network','network'); } @@ -10,7 +12,9 @@ function network_init(&$a) { function network_content(&$a, $update = 0) { if(! local_user()) - return; + return ''; + + $o = ''; require_once("include/bbcode.php"); @@ -140,32 +144,10 @@ function network_content(&$a, $update = 0) { $dlike = array(); if(count($r)) { - foreach($r as $item) { - $sparkle = ''; - - if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) { - $url = $item['url']; - if(($item['network'] === 'dfrn') && (! $item['self'])) { - $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle"'; - } - if(! is_array($alike[$item['parent'] . '-l'])) - $alike[$item['parent'] . '-l'] = array(); - $alike[$item['parent']] ++; - $alike[$item['parent'] . '-l'][] = '<a href="'. $url . '"' . $sparkle . '>' . $item['name'] . '</a>'; - } - if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) { - $url = $item['url']; - if(($item['network'] === 'dfrn') && (! $item['self'])) { - $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle"'; - } - if(! is_array($dlike[$item['parent'] . '-l'])) - $dlike[$item['parent'] . '-l'] = array(); - $dlike[$item['parent']] ++; - $dlike[$item['parent'] . '-l'][] = '<a href="'. $url . '"' . $sparkle . '>' . $item['name'] . '</a>'; - } + foreach($r as $item) { + like_puller($a,$item,$alike,'like'); + like_puller($a,$item,$dlike,'dislike'); } foreach($r as $item) { @@ -177,7 +159,7 @@ function network_content(&$a, $update = 0) { $profile_url = $item['url']; $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) + if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) continue; $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) @@ -274,8 +256,8 @@ function network_content(&$a, $update = 0) { } - $like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); - $dislike = (($dlike[$item['id']]) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); + $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); + $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); $location = (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); $coord = (($item['coord']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); diff --git a/mod/photo.php b/mod/photo.php index 653ca81c2..4e0b85b45 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -16,7 +16,7 @@ function photo_init(&$a) { return; // NOTREACHED } - if(x($type)) { + if(isset($type)) { switch($type) { case 'profile': @@ -37,7 +37,7 @@ function photo_init(&$a) { if(count($r)) { $data = $r[0]['data']; } - if(x($data) === false) { + if(! isset($data)) { $data = file_get_contents(($resolution == 5) ? 'images/default-profile-sm.jpg' : 'images/default-profile.jpg'); diff --git a/mod/profile.php b/mod/profile.php index 3ab77a094..a3148eea3 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -276,31 +276,8 @@ function profile_content(&$a, $update = 0) { if(count($r)) { foreach($r as $item) { - - $sparkle = ''; - - if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) { - $url = $item['url']; - if(($item['network'] === 'dfrn') && (! $item['self'])) { - $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle" '; - } - if(! is_array($alike[$item['parent'] . '-l'])) - $alike[$item['parent'] . '-l'] = array(); - $alike[$item['parent']] ++; - $alike[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['name'] . '</a>'; - } - if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) { - $url = $item['url']; - if(($item['network'] === 'dfrn') && (! $item['self'])) { - $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle" '; - } - if(! is_array($dlike[$item['parent'] . '-l'])) - $dlike[$item['parent'] . '-l'] = array(); - $dlike[$item['parent']] ++; - $dlike[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['name'] . '</a>'; - } + like_puller($a,$item,$alike,'like'); + like_puller($a,$item,$dlike,'dislike'); } foreach($r as $item) { @@ -313,7 +290,8 @@ function profile_content(&$a, $update = 0) { $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) + if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) + && ($item['id'] != $item['parent'])) continue; $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) diff --git a/mod/profiles.php b/mod/profiles.php index ce7e616ea..81678a151 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -157,6 +157,7 @@ function profiles_post(&$a) { function profiles_content(&$a) { + $o = ''; $o .= '<script> $(document).ready(function() { $(\'#nav-profiles-link\').addClass(\'nav-selected\'); });</script>'; if(! local_user()) { notice( t('Permission denied.') . EOL); @@ -266,7 +267,7 @@ function profiles_content(&$a) { } - if(intval($a->argv[1])) { + if(($a->argc > 1 && intval($a->argv[1])) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), intval($_SESSION['uid']) diff --git a/mod/settings.php b/mod/settings.php index 863da44d5..eab4ac52e 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -155,6 +155,7 @@ function settings_post(&$a) { if(! function_exists('settings_content')) { function settings_content(&$a) { + $o = ''; $o .= '<script> $(document).ready(function() { $(\'#nav-settings-link\').addClass(\'nav-selected\'); });</script>'; if(! local_user()) { |