syntax issues (with some php versions?), unchecked intval

This commit is contained in:
friendica 2015-01-01 23:47:14 -08:00
parent 68c612c597
commit c7aa8bf1b4
2 changed files with 31 additions and 7 deletions

View File

@ -2183,3 +2183,19 @@ function get_poller_runtime() {
$t = get_config('system','lastpoll'); $t = get_config('system','lastpoll');
return relative_date($t); return relative_date($t);
} }
function z_get_upload_dir() {
$upload_dir = get_config('system','uploaddir');
if(! $upload_dir)
$upload_dir = ini_get('upload_tmp_dir');
if(! $upload_dir)
$upload_dir = sys_get_temp_dir();
return $upload_dir;
}
function z_get_temp_dir() {
$temp_dir = get_config('system','tempdir');
if(! $temp_dir)
$temp_dir = sys_get_temp_dir();
return $upload_dir;
}

View File

@ -11,7 +11,7 @@ function profiles_init(&$a) {
if((argc() > 2) && (argv(1) === "drop") && intval(argv(2))) { if((argc() > 2) && (argv(1) === "drop") && intval(argv(2))) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1", $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1",
intval($a->argv[2]), intval(argv(2)),
intval(local_user()) intval(local_user())
); );
if(! count($r)) { if(! count($r)) {
@ -159,9 +159,13 @@ function profiles_init(&$a) {
if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) { if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) {
if(feature_enabled(local_user(),'multi_profiles')) if(feature_enabled(local_user(),'multi_profiles'))
$id = $a->argv[1]; $id = $a->argv[1];
else else {
$id = q("select id from profile where uid = %d and is_default = 1",local_user())[0]['id']; $x = q("select id from profile where uid = %d and is_default = 1",
intval(local_user())
);
if($x)
$id = $x[0]['id'];
}
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($id), intval($id),
intval(local_user()) intval(local_user())
@ -564,9 +568,13 @@ function profiles_content(&$a) {
if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) { if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) {
if(feature_enabled(local_user(),'multi_profiles')) if(feature_enabled(local_user(),'multi_profiles'))
$id = $a->argv[1]; $id = $a->argv[1];
else else {
$id = q("select id from profile where uid = %d and is_default = 1",local_user())[0]['id']; $x = q("select id from profile where uid = %d and is_default = 1",
intval(local_user())
);
if($x)
$id = $x[0]['id'];
}
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($id), intval($id),
intval(local_user()) intval(local_user())