diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 12 | ||||
-rw-r--r-- | mod/install.php | 62 | ||||
-rw-r--r-- | mod/match.php | 56 | ||||
-rw-r--r-- | mod/message.php | 3 | ||||
-rw-r--r-- | mod/network.php | 7 | ||||
-rw-r--r-- | mod/photos.php | 2 | ||||
-rw-r--r-- | mod/profile.php | 12 | ||||
-rw-r--r-- | mod/settings.php | 6 |
8 files changed, 128 insertions, 32 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index 029330b7a..aee6548fe 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -9,7 +9,10 @@ function contacts_init(&$a) { $a->page['aside'] .= group_side(); if($a->config['register_policy'] != REGISTER_CLOSED) - $a->page['aside'] .= '<div class="side-invite-link-wrapper" id="side-invite-link-wrapper" ><a href="invite" class="side-invite-link" id="side-invite-link">' . t("Invite Friends") . '</a></div>'; + $a->page['aside'] .= '<div class="side-link" id="side-invite-link" ><a href="invite" >' . t("Invite Friends") . '</a></div>'; + + if(strlen(get_config('system','directory_submit_url'))) + $a->page['aside'] .= '<div class="side-link" id="side-match-link"><a href="match" >' . t('Find People With Shared Interests') . '</a></div>'; $tpl = load_view_file('view/follow.tpl'); $a->page['aside'] .= replace_macros($tpl,array( @@ -18,6 +21,8 @@ function contacts_init(&$a) { '$follow' => t('Follow') )); + + } function contacts_post(&$a) { @@ -244,6 +249,9 @@ function contacts_content(&$a) { $sparkle = ''; } + $insecure = '<div id="profile-edit-insecure"><p><img src="images/unlock_icon.gif" alt="' . t('Privacy Unavailable') . '" /> ' + . t('Private communications are not available for this contact.') . '</p></div>'; + $last_update = (($r[0]['last-update'] == '0000-00-00 00:00:00') ? t('Never') : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')); @@ -266,7 +274,7 @@ function contacts_content(&$a) { '$contact_id' => $r[0]['id'], '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ), '$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ), - '$insecure' => (($r[0]['network'] === 'stat') ? load_view_file('view/insecure_net.tpl') : ''), + '$insecure' => (($r[0]['network'] !== 'dfrn') ? $insecure : ''), '$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>' : ''), diff --git a/mod/install.php b/mod/install.php index dc91f848e..5c508e4f2 100644 --- a/mod/install.php +++ b/mod/install.php @@ -14,17 +14,20 @@ function install_post(&$a) { $phpath = notags(trim($_POST['phpath'])); require_once("dba.php"); - + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); if(mysqli_connect_errno()) { + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, '', true); if(! mysqli_connect_errno()) { $r = q("CREATE DATABASE '%s'", dbesc($dbdata) ); - if($r) + if($r) { + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); + } } if(mysqli_connect_errno()) { notice( t('Could not create/connect to database.') . EOL); @@ -50,36 +53,47 @@ function install_post(&$a) { } $errors = load_database($db); - if(! $errors) { - // Our sessions normally are stored in the database. But as we have only managed - // to get it bootstrapped milliseconds ago, we have to apply a bit of trickery so - // that you'll see the following important notice (which is stored in the session). - - session_write_close(); - - require_once('session.php'); - session_start(); - session_regenerate_id(); - $_SESSION['sysmsg'] = ''; + if($errors) + $a->data['db_failed'] = true; + else + $a->data['db_installed'] = true; - notice( t('Database import succeeded.') . EOL - . t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL - . t('Please see the file "INSTALL.txt".') . EOL ); - goaway($a->get_baseurl() . '/register' ); - } - else { - $db = null; // start fresh - notice( t('Database import failed.') . EOL - . t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL - . t('Please see the file "INSTALL.txt".') . EOL ); - } + return; } function install_content(&$a) { + global $db; $o = ''; + + if(x($a->data,'db_installed')) { + $o .= '<h2>' . t('Proceed with Installation') . '</h2>'; + $o .= '<p style="font-size: 130%;">'; + $o .= t('Your Friendika site database has been installed.') . EOL; + $o .= t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL ; + $o .= t('Please see the file "INSTALL.txt".') . EOL ; + $o .= '<br />'; + $o .= '<a href="' . $a->get_baseurl() . '/register' . '">' . t('Proceed to registration') . '</a>' ; + $o .= '</p>'; + return $o; + } + + if(x($a->data,'db_failed')) { + $o .= t('Database import failed.') . EOL; + $o .= t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL; + $o .= t('Please see the file "INSTALL.txt".') . EOL ; + return $o; + } + + if($db && $db->connected) { + $r = q("SELECT COUNT(*) as `total` FROM `user`"); + if($r && count($r) && $r[0]['total']) { + notice( t('Permission denied.') . EOL); + return ''; + } + } notice( t('Welcome to Friendika.') . EOL); diff --git a/mod/match.php b/mod/match.php new file mode 100644 index 000000000..7228529d7 --- /dev/null +++ b/mod/match.php @@ -0,0 +1,56 @@ +<?php + + +function match_content(&$a) { + + $o = ''; + if(! local_user()) + return; + + $o .= '<h2>' . t('Profile Match') . '</h2>'; + + $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", + intval(local_user()) + ); + if(! count($r)) + return; + if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) { + notice('No keywords to match. Please add keywords to your default profile.'); + return; + + } + + $params = array(); + $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']); + if($tags) { + $params['s'] = $tags; + if($a->pager['page'] != 1) + $params['p'] = $a->pager['page']; + + $x = post_url('http://dir.friendika.com/msearch', $params); + + $j = json_decode($x); + + if($j->total) { + $a->set_pager_total($j->total); + $a->set_pager_itemspage($j->items_page); + } + + if(count($j->results)) { + foreach($j->results as $jj) { + $o .= '<div class="profile-match-wrapper"><div class="profile-match-photo">'; + $o .= '<a href="' . $jj->url . '">' . '<img src="' . $jj->photo . '" alt="' . $jj->name . '" /></a></div>'; + $o .= '<div class="profile-match-break"></div>'; + $o .= '<div class="profile-match-name"><a href="' . $jj->url . '">' . $jj->name . '</a></div>'; + $o .= '<div class="profile-match-end"></div></div>'; + } + } + else { + notice( t('No matches') . EOL); + } + + } + + $o .= paginate($a); + return $o; +}
\ No newline at end of file diff --git a/mod/message.php b/mod/message.php index 4821a45d2..9d30abd66 100644 --- a/mod/message.php +++ b/mod/message.php @@ -168,7 +168,8 @@ function message_content(&$a) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), - '$nickname' => $a->user['nickname'] + '$nickname' => $a->user['nickname'], + '$linkurl' => t('Please enter a link URL:') )); $select = contact_select('messageto','message-to-select', false, 4, true); diff --git a/mod/network.php b/mod/network.php index 81c85f0ff..97bc0713d 100644 --- a/mod/network.php +++ b/mod/network.php @@ -65,7 +65,12 @@ function network_content(&$a, $update = 0) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$geotag' => $geotag, - '$nickname' => $a->user['nickname'] + '$nickname' => $a->user['nickname'], + '$linkurl' => t('Please enter a link URL:'), + '$utubeurl' => t('Please enter a YouTube link:'), + '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), + '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$whereareu' => t('Where are you right now?') )); diff --git a/mod/photos.php b/mod/photos.php index 8298d0d3f..061542c75 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1074,7 +1074,7 @@ function photos_content(&$a) { $tpl = load_view_file('view/photo_item.tpl'); $return_url = $a->cmd; - $like_tpl = load_view_file('view/lik_noshare.tpl'); + $like_tpl = load_view_file('view/like_noshare.tpl'); $likebuttons = ''; diff --git a/mod/profile.php b/mod/profile.php index 1053e4a1e..4b5f92a1f 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -98,7 +98,10 @@ function profile_content(&$a, $update = 0) { $o .= replace_macros($tpl,array( '$url' => $a->get_baseurl() . '/' . $a->cmd, - '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'] + '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'], + '$status' => t('Status'), + '$profile' => t('Profile'), + '$photos' => t('Photos') )); @@ -130,7 +133,12 @@ function profile_content(&$a, $update = 0) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$geotag' => $geotag, - '$nickname' => $a->profile['nickname'] + '$nickname' => $a->profile['nickname'], + '$linkurl' => t('Please enter a link URL:'), + '$utubeurl' => t('Please enter a YouTube link:'), + '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), + '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$whereareu' => t('Where are you right now?') )); require_once('include/acl_selectors.php'); diff --git a/mod/settings.php b/mod/settings.php index 85029b3d7..6a2733d7c 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -70,6 +70,7 @@ function settings_post(&$a) { $net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0); $old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0); $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); + $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! $notify = 0; @@ -140,7 +141,7 @@ function settings_post(&$a) { $openidserver = ''; } - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s' WHERE `uid` = %d LIMIT 1", + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($openid), @@ -157,6 +158,7 @@ function settings_post(&$a) { intval($maxreq), intval($expire), dbesc($openidserver), + intval($blockwall), intval(local_user()) ); if($r) @@ -241,6 +243,7 @@ function settings_content(&$a) { $openid = $a->user['openid']; $maxreq = $a->user['maxreq']; $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); + $blockwall = $a->user['blockwall']; if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); @@ -362,6 +365,7 @@ function settings_content(&$a) { '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''), '$maxreq' => $maxreq, '$expire' => $expire, + '$blockw_checked' => (($blockwall) ? '' : ' checked="checked" ' ), '$theme' => $theme_selector, '$pagetype' => $pagetype )); |