Merge branch 'master' of git://github.com/friendika/friendika

This commit is contained in:
root 2011-01-03 09:27:13 +01:00
commit f3005918af
10 changed files with 48 additions and 22 deletions

View file

@ -1481,7 +1481,7 @@ function validate_url(&$url) {
$url = 'http://' . $url; $url = 'http://' . $url;
$h = parse_url($url); $h = parse_url($url);
if(($h) && (checkdnsrr($h['host'], 'ANY'))) { if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) {
return true; return true;
} }
return false; return false;
@ -1496,7 +1496,7 @@ function validate_email($addr) {
return false; return false;
$h = substr($addr,strpos($addr,'@') + 1); $h = substr($addr,strpos($addr,'@') + 1);
if(($h) && (checkdnsrr($h, 'ANY'))) { if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR + DNS_MX))) {
return true; return true;
} }
return false; return false;

View file

@ -127,6 +127,7 @@ else
* further processing. * further processing.
*/ */
if(strlen($a->module)) { if(strlen($a->module)) {
if(file_exists("mod/{$a->module}.php")) { if(file_exists("mod/{$a->module}.php")) {
include("mod/{$a->module}.php"); include("mod/{$a->module}.php");

View file

@ -276,7 +276,7 @@ class LightOpenID
protected function request($url, $method='GET', $params=array()) protected function request($url, $method='GET', $params=array())
{ {
if(function_exists('curl_init') && !ini_get('safe_mode')) { if(function_exists('curl_init') && !ini_get('safe_mode') && (! strlen(ini_get('open_basedir')))) {
return $this->request_curl($url, $method, $params); return $this->request_curl($url, $method, $params);
} }
return $this->request_streams($url, $method, $params); return $this->request_streams($url, $method, $params);

View file

@ -39,14 +39,16 @@ function directory_content(&$a) {
$search = dbesc($search); $search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ");
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
if(count($r)) if(count($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$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 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC 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 BY `name` ASC LIMIT %d , %d ",
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );

View file

@ -56,13 +56,14 @@ function group_post(&$a) {
notice( t('Group name changed.') . EOL ); notice( t('Group name changed.') . EOL );
} }
$members = $_POST['group_members_select']; $members = $_POST['group_members_select'];
array_walk($members,'validate_members'); if(is_array($members))
array_walk($members,'validate_members');
$r = q("DELETE FROM `group_member` WHERE `gid` = %d AND `uid` = %d", $r = q("DELETE FROM `group_member` WHERE `gid` = %d AND `uid` = %d",
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
$result = true; $result = true;
if(count($members)) { if(is_array($members) && count($members)) {
foreach($members as $member) { foreach($members as $member) {
$r = q("INSERT INTO `group_member` ( `uid`, `gid`, `contact-id`) $r = q("INSERT INTO `group_member` ( `uid`, `gid`, `contact-id`)
VALUES ( %d, %d, %d )", VALUES ( %d, %d, %d )",

View file

@ -19,7 +19,7 @@ function install_post(&$a) {
if(mysqli_connect_errno()) { if(mysqli_connect_errno()) {
$db = new dba($dbhost, $dbuser, $dbpass, '', true); $db = new dba($dbhost, $dbuser, $dbpass, '', true);
if(! mysql_connect_errno()) { if(! mysqli_connect_errno()) {
$r = q("CREATE DATABASE '%s'", $r = q("CREATE DATABASE '%s'",
dbesc($dbdata) dbesc($dbdata)
); );

View file

@ -265,13 +265,14 @@ function profiles_content(&$a) {
dbesc($name), dbesc($name),
dbesc($r1[0]['name']), dbesc($r1[0]['name']),
dbesc($r1[0]['photo']), dbesc($r1[0]['photo']),
dbesc($ra[0]['thumb']) dbesc($r1[0]['thumb'])
); );
$r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1", $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc($name) dbesc($name)
); );
notice( t('New profile created.') . EOL); notice( t('New profile created.') . EOL);
if(count($r3) == 1) if(count($r3) == 1)
goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']);

View file

@ -123,7 +123,20 @@ function register_post(&$a) {
$pkey = openssl_pkey_get_details($res); $pkey = openssl_pkey_get_details($res);
$pubkey = $pkey["key"]; $pubkey = $pkey["key"];
/**
*
* Create another keypair for signing/verifying
* salmon protocol messages. We have to use a slightly
* less robust key because this won't be using openssl
* but the phpseclib. Since it is PHP interpreted code
* it is not nearly as efficient, and the larger keys
* will take several minutes each to process.
*
*/
$sres=openssl_pkey_new(array( $sres=openssl_pkey_new(array(
'digest_alg' => 'sha1',
'private_key_bits' => 512,
'encrypt_key' => false )); 'encrypt_key' => false ));
// Get private key // Get private key

View file

@ -117,11 +117,16 @@ function settings_post(&$a) {
// If openid has changed or if there's an openid but no openidserver, try and discover it. // If openid has changed or if there's an openid but no openidserver, try and discover it.
if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) { if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
logger('updating openidserver'); $tmp_str = $openid;
require_once('library/openid.php'); if(strlen($tmp_str) && validate_url($tmp_str)) {
$open_id_obj = new LightOpenID; logger('updating openidserver');
$open_id_obj->identity = $openid; require_once('library/openid.php');
$openidserver = $open_id_obj->discover($open_id_obj->identity); $open_id_obj = new LightOpenID;
$open_id_obj->identity = $openid;
$openidserver = $open_id_obj->discover($open_id_obj->identity);
}
else
$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, `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, `openidserver` = '%s' WHERE `uid` = %d LIMIT 1",
@ -242,13 +247,16 @@ function settings_content(&$a) {
} }
if(get_config('system','publish_all')) {
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
$opt_tpl = load_view_file("view/profile-in-directory.tpl"); }
$profile_in_dir = replace_macros($opt_tpl,array( else {
'$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""), $opt_tpl = load_view_file("view/profile-in-directory.tpl");
'$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "") $profile_in_dir = replace_macros($opt_tpl,array(
)); '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""),
'$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "")
));
}
if(strlen(get_config('system','directory_submit_url'))) { if(strlen(get_config('system','directory_submit_url'))) {
$opt_tpl = load_view_file("view/profile-in-netdir.tpl"); $opt_tpl = load_view_file("view/profile-in-netdir.tpl");

View file

@ -4,7 +4,7 @@
<a href="profiles/$id" class="profile-listing-edit-link"><img class="profile-listing-photo" id="profile-listing-photo-$id" src="$photo" alt="Profile Image" /></a> <a href="profiles/$id" class="profile-listing-edit-link"><img class="profile-listing-photo" id="profile-listing-photo-$id" src="$photo" alt="Profile Image" /></a>
</div> </div>
<div class="profile-listing-photo-end"></div> <div class="profile-listing-photo-end"></div>
<div class="profile-listing-name" id="profile-listing-name-$id">$profile_name</div> <div class="profile-listing-name" id="profile-listing-name-$id"><a href="profiles/$id" class="profile-listing-edit-link" >$profile_name</a></div>
</div> </div>
<div class="profile-listing-end"></div> <div class="profile-listing-end"></div>