diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 10 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 2 | ||||
-rw-r--r-- | mod/dfrn_request.php | 2 | ||||
-rw-r--r-- | mod/directory.php | 4 | ||||
-rw-r--r-- | mod/message.php | 1 | ||||
-rw-r--r-- | mod/photos.php | 26 | ||||
-rw-r--r-- | mod/profiles.php | 4 | ||||
-rw-r--r-- | mod/share.php | 27 |
8 files changed, 39 insertions, 37 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index f84a988c8..fb4595739 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -479,12 +479,13 @@ function contacts_content(&$a) { - + $searching = false; if($search) { $search_hdr = $search; - $search = dbesc($search.'*'); + $search_txt = dbesc(protect_sprintf(preg_quote($search))); + $searching = true; } - $sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : ""); + $sql_extra .= (($searching) ? " AND `name` REGEXP '$search_txt' " : ""); if($nets) $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets)); @@ -501,7 +502,6 @@ function contacts_content(&$a) { } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ", intval($_SESSION['uid']), intval($a->pager['start']), @@ -568,7 +568,7 @@ function contacts_content(&$a) { '$total' => $total, '$search' => $search_hdr, '$desc' => t('Search your contacts'), - '$finding' => (strlen($search) ? t('Finding: ') . "'" . $search . "'" : ""), + '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""), '$submit' => t('Find'), '$cmd' => $a->cmd, '$contacts' => $contacts, diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 436727a78..f3c145410 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -443,7 +443,7 @@ function dfrn_poll_content(&$a) { $encrypted_id = ''; $id_str = $my_id . '.' . mt_rand(1000,9999); - if($r[0]['duplex'] && strlen($r[0]['pubkey'])) { + if(($r[0]['duplex'] && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) { openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']); openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']); } diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 3c76034c3..cec2d7f8b 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -170,7 +170,7 @@ function dfrn_request_post(&$a) { info( t("Introduction complete.") . EOL); } - $r = q("select id from contact where uid = %d and url = '%s' and `site-pubkey` = '%s limit 1", + $r = q("select id from contact where uid = %d and url = '%s' and `site-pubkey` = '%s' limit 1", intval(local_user()), dbesc($dfrn_url), $parms['key'] // this was already escaped diff --git a/mod/directory.php b/mod/directory.php index 7f3a44ff4..930a575b6 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -73,7 +73,7 @@ function directory_content(&$a) { $order = " ORDER BY `name` ASC "; - $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `contact`.`avatar-date` AS picdate, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `self` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ", + $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ", intval($a->pager['start']), intval($a->pager['itemspage']) ); @@ -116,7 +116,7 @@ function directory_content(&$a) { $entry = replace_macros($tpl,array( '$id' => $rr['id'], '$profile-link' => $profile_link, - '$photo' => $rr[$photo] . '?rev=' . urlencode($rr['picdate']), + '$photo' => $a->get_cached_avatar_image($rr[$photo]), '$alt-text' => $rr['name'], '$name' => $rr['name'], '$details' => $pdesc . $details diff --git a/mod/message.php b/mod/message.php index d5bb3dfe4..519634be5 100644 --- a/mod/message.php +++ b/mod/message.php @@ -407,6 +407,7 @@ function message_content(&$a) { '$parent' => $parent, '$upload' => t('Upload photo'), '$insert' => t('Insert web link'), + '$submit' => t('Submit'), '$wait' => t('Please wait') )); diff --git a/mod/photos.php b/mod/photos.php index a6552994e..d96bc135e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -16,7 +16,7 @@ function photos_init(&$a) { if($a->argc > 1) { $nick = $a->argv[1]; - $r = q("SELECT `user`.*, `contact`.`avatar-date` AS picdate FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 LIMIT 1", + $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", dbesc($nick) ); @@ -36,7 +36,7 @@ function photos_init(&$a) { $o .= '<div class="vcard">'; $o .= '<div class="fn">' . $a->data['user']['username'] . '</div>'; - $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg?rev=' . urlencode($a->data['user']['picdate']) . '" alt="' . $a->data['user']['username'] . '" /></div>'; + $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg') . '" alt="' . $a->data['user']['username'] . '" /></div>'; $o .= '</div>'; if(! intval($a->data['user']['hidewall'])) { @@ -306,7 +306,8 @@ function photos_post(&$a) { $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); - if((x($_POST,'rotate') !== false) && (intval($_POST['rotate']) == 1)) { + if((x($_POST,'rotate') !== false) && + ( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) { logger('rotate'); $r = q("select * from photo where `resource-id` = '%s' and uid = %d and scale = 0 limit 1", @@ -316,7 +317,8 @@ function photos_post(&$a) { if(count($r)) { $ph = new Photo($r[0]['data'], $r[0]['type']); if($ph->is_valid()) { - $ph->rotate(270); + $rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 ); + $ph->rotate($rotate_deg); $width = $ph->getWidth(); $height = $ph->getHeight(); @@ -325,8 +327,8 @@ function photos_post(&$a) { dbesc($ph->imageString()), intval($height), intval($width), - dbesc($resource_id), - intval($page_owner_uid) + dbesc($resource_id), + intval($page_owner_uid) ); if($width > 640 || $height > 640) { @@ -338,8 +340,8 @@ function photos_post(&$a) { dbesc($ph->imageString()), intval($height), intval($width), - dbesc($resource_id), - intval($page_owner_uid) + dbesc($resource_id), + intval($page_owner_uid) ); } @@ -352,8 +354,8 @@ function photos_post(&$a) { dbesc($ph->imageString()), intval($height), intval($width), - dbesc($resource_id), - intval($page_owner_uid) + dbesc($resource_id), + intval($page_owner_uid) ); } } @@ -718,6 +720,7 @@ function photos_post(&$a) { killme(); } + $ph->orient($src); @unlink($src); $width = $ph->getWidth(); @@ -1250,7 +1253,8 @@ function photos_content(&$a) { $edit_tpl = get_markup_template('photo_edit.tpl'); $edit = replace_macros($edit_tpl, array( '$id' => $ph[0]['id'], - '$rotate' => t('Rotate CW'), + '$rotatecw' => t('Rotate CW (right)'), + '$rotateccw' => t('Rotate CCW (left)'), '$album' => template_escape($ph[0]['album']), '$newalbum' => t('New album name'), '$nickname' => $a->data['user']['nickname'], diff --git a/mod/profiles.php b/mod/profiles.php index 7b6e61ad6..a9da5454c 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -635,7 +635,7 @@ function profiles_content(&$a) { } else { - $r = q("SELECT `profile`.*, `contact`.`avatar-date` AS picdate FROM `profile` LEFT JOIN `contact` on `contact`.`uid` = `profile`.`uid` WHERE `profile`.`uid` = %d and contact.self = 1", + $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_user()); if(count($r)) { @@ -652,7 +652,7 @@ function profiles_content(&$a) { foreach($r as $rr) { $o .= replace_macros($tpl, array( - '$photo' => $rr['thumb'] . '?rev=' . urlencode($rr['picdate']), + '$photo' => $a->get_cached_avatar_image($rr['thumb']), '$id' => $rr['id'], '$alt' => t('Profile Image'), '$profile_name' => $rr['profile-name'], diff --git a/mod/share.php b/mod/share.php index 6c6098c83..08c63105e 100644 --- a/mod/share.php +++ b/mod/share.php @@ -8,26 +8,23 @@ function share_init(&$a) { if((! $post_id) || (! local_user())) killme(); - $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", - intval($post_id) + $r = q("SELECT item.*, contact.network FROM `item` + left join contact on `item`.`contact-id` = `contact`.`id` + WHERE `item`.`id` = %d AND `item`.`uid` = %d LIMIT 1", + + intval($post_id), + intval(local_user()) ); - if(! count($r) || $r[0]['private']) + if(! count($r) || ($r[0]['private'] && ($r[0]['network'] != NETWORK_FEED))) killme(); $o = ''; -// if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) { - $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n"; - if($r[0]['title']) - $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n"; - $o .= $r[0]['body'] . "\n"; -// } -// else { -// $o .= '♲ <a href="' . $r[0]['author-link'] . '">' . $r[0]['author-name'] . '</a><br />'; -// if($r[0]['title']) -// $o .= '<strong>' . $r[0]['title'] . '</strong><br />'; -// $o .= $r[0]['body'] . "\n"; -// } + $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n"; + if($r[0]['title']) + $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n"; + $o .= $r[0]['body'] . "\n"; + echo $o; killme(); } |