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

View file

@ -92,7 +92,7 @@ class PConfig {
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']);
$a->config[$uid][$family][$key] = $val;

View file

@ -1906,20 +1906,23 @@ class Diaspora {
$author = unxmlify($data->author);
$recipient = unxmlify($data->recipient);
if (!$author || !$recipient)
if (!$author || !$recipient) {
return false;
}
// the current protocol version doesn't know these fields
// That means that we will assume their existance
if (isset($data->following))
if (isset($data->following)) {
$following = (unxmlify($data->following) == "true");
else
} else {
$following = true;
}
if (isset($data->sharing))
if (isset($data->sharing)) {
$sharing = (unxmlify($data->sharing) == "true");
else
} else {
$sharing = true;
}
$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.
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"]));
if($u) {
if ($u) {
logger("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
$ret = self::send_share($u[0], $contact);
}

View file

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

View file

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

View file

@ -565,7 +565,6 @@ function check_imagik(&$checks) {
}
}
function manual_config(App &$a) {
$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.');

View file

@ -6,12 +6,13 @@ function network_init(App &$a) {
}
$is_a_date_query = false;
if(x($_GET['cid']) && intval($_GET['cid']) != 0)
if (x($_GET['cid']) && intval($_GET['cid']) != 0) {
$cid = $_GET['cid'];
}
if($a->argc > 1) {
for($x = 1; $x < $a->argc; $x ++) {
if(is_a_date_arg($a->argv[$x])) {
if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) {
if (is_a_date_arg($a->argv[$x])) {
$is_a_date_query = true;
break;
}
@ -26,7 +27,7 @@ function network_init(App &$a) {
// 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_nets = network_query_get_sel_net();
$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
$query = explode_querystring($a->query_string);
$inputs = array();
foreach($query['args'] as $arg) {
if(strpos($arg, 'confirm=') === false) {
foreach ($query['args'] as $arg) {
if (strpos($arg, 'confirm=') === false) {
$arg_parts = explode('=', $arg);
$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();
$drop_id = intval($i[0]['id']);
if($i[0]['visible'])
if ($i[0]['visible']) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
}
}
}

View file

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

View file

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