bug #85
This commit is contained in:
parent
19ccd658eb
commit
040fc247a0
2
boot.php
2
boot.php
|
@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000);
|
||||||
|
|
||||||
define ( 'FRIENDIKA_VERSION', '2.2.989' );
|
define ( 'FRIENDIKA_VERSION', '2.2.989' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1054 );
|
define ( 'DB_UPDATE_VERSION', 1055 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
|
|
@ -406,6 +406,7 @@ CREATE TABLE IF NOT EXISTS `register` (
|
||||||
`created` DATETIME NOT NULL ,
|
`created` DATETIME NOT NULL ,
|
||||||
`uid` INT(11) UNSIGNED NOT NULL,
|
`uid` INT(11) UNSIGNED NOT NULL,
|
||||||
`password` CHAR(255) NOT NULL,
|
`password` CHAR(255) NOT NULL,
|
||||||
|
`language` CHAR(16) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
|
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,29 @@ function get_language() {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
function push_lang($language) {
|
||||||
|
global $lang, $a;
|
||||||
|
|
||||||
|
$a->langsave = $lang;
|
||||||
|
|
||||||
|
if(isset($a->strings) && count($a->strings)) {
|
||||||
|
$a->stringsave = $a->strings;
|
||||||
|
}
|
||||||
|
$a->strings = array();
|
||||||
|
load_translation_table($language);
|
||||||
|
$lang = $language;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pop_lang() {
|
||||||
|
global $lang, $a;
|
||||||
|
if(isset($a->stringsave))
|
||||||
|
$a->strings = $a->stringsave;
|
||||||
|
else
|
||||||
|
$a->strings = array();
|
||||||
|
|
||||||
|
$lang = $a->langsave;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// load string translation table for alternate language
|
// load string translation table for alternate language
|
||||||
|
|
||||||
|
|
|
@ -632,12 +632,13 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
|
|
||||||
logger('dfrn_confirm: request: info updated');
|
logger('dfrn_confirm: request: info updated');
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
|
$r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
|
||||||
WHERE `contact`.`id` = %d LIMIT 1",
|
WHERE `contact`.`id` = %d LIMIT 1",
|
||||||
intval($dfrn_record)
|
intval($dfrn_record)
|
||||||
);
|
);
|
||||||
if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
|
if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
|
||||||
|
|
||||||
|
push_lang($r[0]['language']);
|
||||||
$tpl = (($new_relation == REL_BUD)
|
$tpl = (($new_relation == REL_BUD)
|
||||||
? get_intltext_template('friend_complete_eml.tpl')
|
? get_intltext_template('friend_complete_eml.tpl')
|
||||||
: get_intltext_template('intro_complete_eml.tpl'));
|
: get_intltext_template('intro_complete_eml.tpl'));
|
||||||
|
@ -661,6 +662,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
if(!$res) {
|
if(!$res) {
|
||||||
// pointless throwing an error here and confusing the person at the other end of the wire.
|
// pointless throwing an error here and confusing the person at the other end of the wire.
|
||||||
}
|
}
|
||||||
|
pop_lang();
|
||||||
}
|
}
|
||||||
xml_status(0); // Success
|
xml_status(0); // Success
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
|
|
@ -185,6 +185,8 @@ function dfrn_notify_post(&$a) {
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
if($importer['notify-flags'] & NOTIFY_MAIL) {
|
if($importer['notify-flags'] & NOTIFY_MAIL) {
|
||||||
|
|
||||||
|
push_lang($importer['language']);
|
||||||
|
|
||||||
// name of the automated email sender
|
// name of the automated email sender
|
||||||
$msg['notificationfromname'] = t('Administrator');
|
$msg['notificationfromname'] = t('Administrator');
|
||||||
// noreply address to send from
|
// noreply address to send from
|
||||||
|
@ -250,6 +252,8 @@ function dfrn_notify_post(&$a) {
|
||||||
$email_html_body_tpl,
|
$email_html_body_tpl,
|
||||||
$email_text_body_tpl
|
$email_text_body_tpl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
pop_lang();
|
||||||
}
|
}
|
||||||
xml_status(0);
|
xml_status(0);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
|
@ -387,6 +391,7 @@ function dfrn_notify_post(&$a) {
|
||||||
proc_run('php',"include/notifier.php","comment-import","$posted_id");
|
proc_run('php',"include/notifier.php","comment-import","$posted_id");
|
||||||
|
|
||||||
if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
||||||
|
push_lang($importer['language']);
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
$from = stripslashes($datarray['author-name']);
|
$from = stripslashes($datarray['author-name']);
|
||||||
|
|
||||||
|
@ -442,7 +447,7 @@ function dfrn_notify_post(&$a) {
|
||||||
$email_html_body_tpl,
|
$email_html_body_tpl,
|
||||||
$email_text_body_tpl
|
$email_text_body_tpl
|
||||||
);
|
);
|
||||||
|
pop_lang();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xml_status(0);
|
xml_status(0);
|
||||||
|
@ -514,6 +519,8 @@ function dfrn_notify_post(&$a) {
|
||||||
foreach($myconv as $conv) {
|
foreach($myconv as $conv) {
|
||||||
if(! link_compare($conv['author-link'],$importer_url))
|
if(! link_compare($conv['author-link'],$importer_url))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
push_lang($importer['language']);
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
$from = stripslashes($datarray['author-name']);
|
$from = stripslashes($datarray['author-name']);
|
||||||
|
|
||||||
|
@ -567,7 +574,7 @@ function dfrn_notify_post(&$a) {
|
||||||
$email_html_body_tpl,
|
$email_html_body_tpl,
|
||||||
$email_text_body_tpl
|
$email_text_body_tpl
|
||||||
);
|
);
|
||||||
|
pop_lang();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,6 +462,7 @@ function item_post(&$a) {
|
||||||
|
|
||||||
// Send a notification email to the conversation owner, unless the owner is me and I wrote this item
|
// Send a notification email to the conversation owner, unless the owner is me and I wrote this item
|
||||||
if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) {
|
if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) {
|
||||||
|
push_lang($user['language']);
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
$from = $author['name'];
|
$from = $author['name'];
|
||||||
|
|
||||||
|
@ -517,6 +518,8 @@ function item_post(&$a) {
|
||||||
$email_html_body_tpl,
|
$email_html_body_tpl,
|
||||||
$email_text_body_tpl
|
$email_text_body_tpl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
pop_lang();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -525,6 +528,7 @@ function item_post(&$a) {
|
||||||
// let me know if somebody did a wall-to-wall post on my profile
|
// let me know if somebody did a wall-to-wall post on my profile
|
||||||
|
|
||||||
if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) {
|
if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) {
|
||||||
|
push_lang($user['language']);
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
$from = $author['name'];
|
$from = $author['name'];
|
||||||
|
|
||||||
|
@ -578,6 +582,7 @@ function item_post(&$a) {
|
||||||
$email_html_body_tpl,
|
$email_html_body_tpl,
|
||||||
$email_text_body_tpl
|
$email_text_body_tpl
|
||||||
);
|
);
|
||||||
|
pop_lang();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
if(! function_exists('register_post')) {
|
if(! function_exists('register_post')) {
|
||||||
function register_post(&$a) {
|
function register_post(&$a) {
|
||||||
|
|
||||||
|
global $lang;
|
||||||
|
|
||||||
$verified = 0;
|
$verified = 0;
|
||||||
$blocked = 1;
|
$blocked = 1;
|
||||||
|
|
||||||
|
@ -350,13 +352,23 @@ function register_post(&$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password` ) VALUES ( '%s', '%s', %d, '%s' ) ",
|
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language` ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($newuid),
|
intval($newuid),
|
||||||
dbesc($new_password)
|
dbesc($new_password),
|
||||||
|
dbesc($lang)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$r = q("SELECT `language` FROM `user` WHERE `email` = '%s' LIMIT 1",
|
||||||
|
dbesc($a->config['admin_email'])
|
||||||
|
);
|
||||||
|
if(count($r))
|
||||||
|
push_lang($r[0]['language']);
|
||||||
|
else
|
||||||
|
push_lang('en');
|
||||||
|
|
||||||
|
|
||||||
$email_tpl = get_intltext_template("register_verify_eml.tpl");
|
$email_tpl = get_intltext_template("register_verify_eml.tpl");
|
||||||
$email_tpl = replace_macros($email_tpl, array(
|
$email_tpl = replace_macros($email_tpl, array(
|
||||||
'$sitename' => $a->config['sitename'],
|
'$sitename' => $a->config['sitename'],
|
||||||
|
@ -373,6 +385,9 @@ function register_post(&$a) {
|
||||||
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
|
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
|
||||||
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
||||||
. 'Content-transfer-encoding: 8bit' );
|
. 'Content-transfer-encoding: 8bit' );
|
||||||
|
|
||||||
|
pop_lang();
|
||||||
|
|
||||||
if($res) {
|
if($res) {
|
||||||
info( t('Your registration is pending approval by the site owner.') . EOL ) ;
|
info( t('Your registration is pending approval by the site owner.') . EOL ) ;
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
function regmod_content(&$a) {
|
function regmod_content(&$a) {
|
||||||
|
|
||||||
|
global $lang;
|
||||||
|
|
||||||
$_SESSION['return_url'] = $a->cmd;
|
$_SESSION['return_url'] = $a->cmd;
|
||||||
|
|
||||||
if(! local_user()) {
|
if(! local_user()) {
|
||||||
|
@ -79,6 +81,8 @@ function regmod_content(&$a) {
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run('php',"include/directory.php","$url");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
push_lang($register[0]['language']);
|
||||||
|
|
||||||
$email_tpl = get_intltext_template("register_open_eml.tpl");
|
$email_tpl = get_intltext_template("register_open_eml.tpl");
|
||||||
$email_tpl = replace_macros($email_tpl, array(
|
$email_tpl = replace_macros($email_tpl, array(
|
||||||
'$sitename' => $a->config['sitename'],
|
'$sitename' => $a->config['sitename'],
|
||||||
|
@ -95,6 +99,8 @@ function regmod_content(&$a) {
|
||||||
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
||||||
. 'Content-transfer-encoding: 8bit' );
|
. 'Content-transfer-encoding: 8bit' );
|
||||||
|
|
||||||
|
pop_lang();
|
||||||
|
|
||||||
if($res) {
|
if($res) {
|
||||||
info( t('Account approved.') . EOL );
|
info( t('Account approved.') . EOL );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -480,3 +480,6 @@ function update_1053() {
|
||||||
q("ALTER TABLE `item` ADD `extid` CHAR( 255 ) NOT NULL AFTER `parent-uri` , ADD INDEX ( `extid` ) ");
|
q("ALTER TABLE `item` ADD `extid` CHAR( 255 ) NOT NULL AFTER `parent-uri` , ADD INDEX ( `extid` ) ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1054() {
|
||||||
|
q("ALTER TABLE `register` ADD `language` CHAR( 16 ) NOT NULL AFTER `password` ");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue