Merge branch 'develop' into rewrites/dbm_is_result

This commit is contained in:
Roland Häder 2016-12-22 11:38:24 +01:00
commit 061bcd7d2f
11 changed files with 44 additions and 40 deletions

View file

@ -97,7 +97,7 @@ class Config {
dbesc($family), dbesc($family),
dbesc($key) dbesc($key)
); );
if (dbm::is_result($ret)) { if (count($ret)) {
// manage array value // manage array value
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']); $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$family][$key] = $val; $a->config[$family][$key] = $val;

View file

@ -92,7 +92,7 @@ class PConfig {
dbesc($key) dbesc($key)
); );
if (dbm::is_result($ret)) { if (count($ret)) {
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']); $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$uid][$family][$key] = $val; $a->config[$uid][$family][$key] = $val;

View file

@ -1906,20 +1906,23 @@ class Diaspora {
$author = unxmlify($data->author); $author = unxmlify($data->author);
$recipient = unxmlify($data->recipient); $recipient = unxmlify($data->recipient);
if (!$author || !$recipient) if (!$author || !$recipient) {
return false; return false;
}
// the current protocol version doesn't know these fields // the current protocol version doesn't know these fields
// That means that we will assume their existance // That means that we will assume their existance
if (isset($data->following)) if (isset($data->following)) {
$following = (unxmlify($data->following) == "true"); $following = (unxmlify($data->following) == "true");
else } else {
$following = true; $following = true;
}
if (isset($data->sharing)) if (isset($data->sharing)) {
$sharing = (unxmlify($data->sharing) == "true"); $sharing = (unxmlify($data->sharing) == "true");
else } else {
$sharing = true; $sharing = true;
}
$contact = self::contact_by_handle($importer["uid"],$author); $contact = self::contact_by_handle($importer["uid"],$author);
@ -1937,7 +1940,7 @@ class Diaspora {
// Normally we needn't to do so, but the first message could have been vanished. // Normally we needn't to do so, but the first message could have been vanished.
if (in_array($contact["rel"], array(CONTACT_IS_FRIEND, CONTACT_IS_FOLLOWER))) { if (in_array($contact["rel"], array(CONTACT_IS_FRIEND, CONTACT_IS_FOLLOWER))) {
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($importer["uid"])); $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($importer["uid"]));
if($u) { if ($u) {
logger("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG); logger("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
$ret = self::send_share($u[0], $contact); $ret = self::send_share($u[0], $contact);
} }

View file

@ -30,7 +30,6 @@ function crepair_init(App &$a) {
} }
} }
function crepair_post(App &$a) { function crepair_post(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;

View file

@ -588,7 +588,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc($decrypted_source_url), dbesc($decrypted_source_url),
intval($local_uid) intval($local_uid)
); );
if(! dbm::is_result($ret)) { if(! count($ret)) {
if(strstr($decrypted_source_url,'http:')) if(strstr($decrypted_source_url,'http:'))
$newurl = str_replace('http:','https:',$decrypted_source_url); $newurl = str_replace('http:','https:',$decrypted_source_url);
else else
@ -598,7 +598,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc($newurl), dbesc($newurl),
intval($local_uid) intval($local_uid)
); );
if(! dbm::is_result($ret)) { if(! count($ret)) {
// this is either a bogus confirmation (?) or we deleted the original introduction. // this is either a bogus confirmation (?) or we deleted the original introduction.
$message = t('Contact record was not found for you on our site.'); $message = t('Contact record was not found for you on our site.');
xml_status(3,$message); xml_status(3,$message);

View file

@ -565,7 +565,6 @@ function check_imagik(&$checks) {
} }
} }
function manual_config(App &$a) { function manual_config(App &$a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8'); $data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
$o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');

View file

@ -6,12 +6,13 @@ function network_init(App &$a) {
} }
$is_a_date_query = false; $is_a_date_query = false;
if(x($_GET['cid']) && intval($_GET['cid']) != 0) if (x($_GET['cid']) && intval($_GET['cid']) != 0) {
$cid = $_GET['cid']; $cid = $_GET['cid'];
}
if($a->argc > 1) { if ($a->argc > 1) {
for($x = 1; $x < $a->argc; $x ++) { for ($x = 1; $x < $a->argc; $x ++) {
if(is_a_date_arg($a->argv[$x])) { if (is_a_date_arg($a->argv[$x])) {
$is_a_date_query = true; $is_a_date_query = true;
break; break;
} }
@ -26,7 +27,7 @@ function network_init(App &$a) {
// fetch last used network view and redirect if needed // fetch last used network view and redirect if needed
if(! $is_a_date_query) { if (! $is_a_date_query) {
$sel_tabs = network_query_get_sel_tab($a); $sel_tabs = network_query_get_sel_tab($a);
$sel_nets = network_query_get_sel_net(); $sel_nets = network_query_get_sel_net();
$sel_groups = network_query_get_sel_group($a); $sel_groups = network_query_get_sel_group($a);

View file

@ -16,8 +16,8 @@ function suggest_init(App &$a) {
// so add any arguments as hidden inputs // so add any arguments as hidden inputs
$query = explode_querystring($a->query_string); $query = explode_querystring($a->query_string);
$inputs = array(); $inputs = array();
foreach($query['args'] as $arg) { foreach ($query['args'] as $arg) {
if(strpos($arg, 'confirm=') === false) { if (strpos($arg, 'confirm=') === false) {
$arg_parts = explode('=', $arg); $arg_parts = explode('=', $arg);
$inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
} }

View file

@ -167,8 +167,9 @@ function videos_post(App &$a) {
$url = App::get_baseurl(); $url = App::get_baseurl();
$drop_id = intval($i[0]['id']); $drop_id = intval($i[0]['id']);
if($i[0]['visible']) if ($i[0]['visible']) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id); proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
}
} }
} }

View file

@ -4,7 +4,6 @@
*/ */
function theme_content(App &$a){ function theme_content(App &$a){
if (!local_user()) { if (!local_user()) {
return; return;

View file

@ -3,8 +3,6 @@
* Theme settings * Theme settings
*/ */
function theme_content(App &$a){ function theme_content(App &$a){
if (!local_user()) { if (!local_user()) {
return; return;
@ -35,8 +33,8 @@ function theme_post(App &$a){
function theme_admin(App &$a){ function theme_admin(App &$a){
$align = get_config('quattro', 'align' ); $align = get_config('quattro', 'align' );
$color = get_config('quattro', 'color' ); $color = get_config('quattro', 'color' );
$tfs = get_config("quattro","tfs"); $tfs = get_config("quattro","tfs");
$pfs = get_config("quattro","pfs"); $pfs = get_config("quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs); return quattro_form($a,$align, $color, $tfs, $pfs);
} }
@ -45,31 +43,35 @@ function theme_admin_post(App &$a){
if (isset($_POST['quattro-settings-submit'])){ if (isset($_POST['quattro-settings-submit'])){
set_config('quattro', 'align', $_POST['quattro_align']); set_config('quattro', 'align', $_POST['quattro_align']);
set_config('quattro', 'color', $_POST['quattro_color']); set_config('quattro', 'color', $_POST['quattro_color']);
set_config('quattro', 'tfs', $_POST['quattro_tfs']); set_config('quattro', 'tfs', $_POST['quattro_tfs']);
set_config('quattro', 'pfs', $_POST['quattro_pfs']); set_config('quattro', 'pfs', $_POST['quattro_pfs']);
} }
} }
/// @TODO $a is no longer used here /// @TODO $a is no longer used here
function quattro_form(&$a, $align, $color, $tfs, $pfs){ function quattro_form(App &$a, $align, $color, $tfs, $pfs){
$colors = array( $colors = array(
"dark"=>"Quattro", "dark" => "Quattro",
"lilac"=>"Lilac", "lilac" => "Lilac",
"green"=>"Green" "green" => "Green",
); );
if ($tfs===false) $tfs="20"; if ($tfs === false) {
if ($pfs===false) $pfs="12"; $tfs = "20";
}
if ($pfs === false) {
$pfs = "12";
}
$t = get_markup_template("theme_settings.tpl" ); $t = get_markup_template("theme_settings.tpl" );
$o .= replace_macros($t, array( $o .= replace_macros($t, array(
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => App::get_baseurl(), '$baseurl' => App::get_baseurl(),
'$title' => t("Theme settings"), '$title' => t("Theme settings"),
'$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))), '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
'$color' => array('quattro_color', t('Color scheme'), $color, '', $colors), '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors),
'$pfs' => array('quattro_pfs', t('Posts font size'), $pfs), '$pfs' => array('quattro_pfs', t('Posts font size'), $pfs),
'$tfs' => array('quattro_tfs',t('Textareas font size'), $tfs), '$tfs' => array('quattro_tfs',t('Textareas font size'), $tfs),
)); ));
return $o; return $o;
} }