"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Froxlor/Settings/Store.php" between
froxlor-0.10.26.tar.gz and froxlor-0.10.27.tar.gz

About: Froxlor is a web-based server management panel. It’s a fork of SysCP and has its main focus on simplicity and usability.

Store.php  (froxlor-0.10.26):Store.php  (froxlor-0.10.27)
skipping to change at line 370 skipping to change at line 370
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, array(
'olduser' => $update_user, 'olduser' => $update_user,
'newuser' => $newfieldvalue 'newuser' => $newfieldvalue
)); ));
} }
} }
} }
return $returnvalue; return $returnvalue;
} }
public static function storeSettingImage($fieldname, $fielddata)
{
if (isset($fielddata['settinggroup'], $fielddata['varname']) && is_array
($fielddata) && $fielddata['settinggroup'] !== '' && $fielddata['varname'] !== '
') {
$save_to = null;
$path = \Froxlor\Froxlor::getInstallDir().'/img/';
// New file?
if (isset($_FILES[$fieldname]) && $_FILES[$fieldname]['tmp_name']) {
// Make sure upload directory exists
if (!is_dir($path) && !mkdir($path, '0775')) {
throw new \Exception("img directory does not exist and canno
t be created");
}
// Make sure we can write to the upload directory
if (!is_writable($path)) {
if (!chmod($path, '0775')) {
throw new \Exception("Cannot write to img directory");
}
}
// Make sure mime-type matches an image
if (!in_array(mime_content_type($_FILES[$fieldname]['tmp_name'])
, ['image/jpeg','image/jpg','image/png','image/gif'])) {
throw new \Exception("Uploaded file not a valid image");
}
// Determine file extension
$spl = explode('.', $_FILES[$fieldname]['name']);
$file_extension = strtolower(array_pop($spl));
unset($spl);
// Move file
if (!move_uploaded_file($_FILES[$fieldname]['tmp_name'], $path.$
fielddata['image_name'].'.'.$file_extension)) {
throw new \Exception("Unable to save image to img folder");
}
$save_to = 'img/'.$fielddata['image_name'].'.'.$file_extension.'
?v='.time();
}
// Delete file?
if ($fielddata['value'] !== "" && array_key_exists($fieldname.'_dele
te', $_POST) && $_POST[$fieldname.'_delete']) {
@unlink(\Froxlor\Froxlor::getInstallDir() . '/' . explode('?', $
fielddata['value'], 2)[0]);
$save_to = '';
}
// Nothing changed
if ($save_to === null) {
return array(
$fielddata['settinggroup'] . '.' . $fielddata['varname'] =>
$fielddata['value']
);
}
if (Settings::Set($fielddata['settinggroup'] . '.' . $fielddata['var
name'], $save_to) === false) {
return false;
}
return array(
$fielddata['settinggroup'] . '.' . $fielddata['varname'] => $sav
e_to
);
}
return false;
}
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 74 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)