work
This commit is contained in:
parent
3c0d87dbce
commit
b2977ef8dd
@ -38,6 +38,12 @@ class img {
|
|||||||
return move_uploaded_file($contents, self::$imgfolders[$cat][0].$id);
|
return move_uploaded_file($contents, self::$imgfolders[$cat][0].$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function delete($cat, $id) {
|
||||||
|
if (!array_key_exists($cat, self::$imgfolders)) {
|
||||||
|
throw new \SYSTEM\LOG\ERROR("No matching Cat '" . $cat . "' found.");}
|
||||||
|
return unlink(self::$imgfolders[$cat][0].$id);
|
||||||
|
}
|
||||||
|
|
||||||
private static function getFolder($folder, $mask) {
|
private static function getFolder($folder, $mask) {
|
||||||
$files = array();
|
$files = array();
|
||||||
foreach (glob($folder . $mask) as $file) {
|
foreach (glob($folder . $mask) as $file) {
|
||||||
|
|||||||
@ -2,11 +2,22 @@
|
|||||||
namespace SYSTEM\SAI;
|
namespace SYSTEM\SAI;
|
||||||
|
|
||||||
class saimod_sys_img extends \SYSTEM\SAI\SaiModule {
|
class saimod_sys_img extends \SYSTEM\SAI\SaiModule {
|
||||||
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_delete($cat,$id){
|
||||||
|
if(!\SYSTEM\IMG\img::delete($cat, $id)){
|
||||||
|
throw new \SYSTEM\LOG\ERROR("delete problem");}
|
||||||
|
|
||||||
|
return \SYSTEM\LOG\JsonResult::ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_rename($cat,$id,$newid){
|
||||||
|
return \SYSTEM\LOG\JsonResult::ok();
|
||||||
|
}
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_upload($cat){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_action_upload($cat){
|
||||||
if(!\SYSTEM\IMG\img::put($cat, basename($_FILES['datei']['name']) , $_FILES['datei']['tmp_name'])){
|
if(!\SYSTEM\IMG\img::put($cat, basename($_FILES['datei']['name']) , $_FILES['datei']['tmp_name'])){
|
||||||
throw new \SYSTEM\LOG\ERROR("upload problem");}
|
throw new \SYSTEM\LOG\ERROR("upload problem");}
|
||||||
|
|
||||||
throw new \SYSTEM\LOG\ERROR("upload finished sucessful");
|
return \SYSTEM\LOG\JsonResult::ok();
|
||||||
}
|
}
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_img(){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_img(){
|
||||||
//tt
|
//tt
|
||||||
@ -18,12 +29,12 @@ class saimod_sys_img extends \SYSTEM\SAI\SaiModule {
|
|||||||
$result .= '<form action="'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL).'sai_mod=.SYSTEM.SAI.saimod_sys_img&action=upload&cat='.$name.'" method="post" enctype="multipart/form-data">';
|
$result .= '<form action="'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL).'sai_mod=.SYSTEM.SAI.saimod_sys_img&action=upload&cat='.$name.'" method="post" enctype="multipart/form-data">';
|
||||||
$result .= '<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
|
$result .= '<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
|
||||||
<input type="file" name="datei"><br>
|
<input type="file" name="datei"><br>
|
||||||
<input type="submit" class="btn" value="Hochladen">';
|
<input type="submit" class="btn" value="Add">';
|
||||||
$result .= "</form>";
|
$result .= "</form>";
|
||||||
|
|
||||||
foreach($cat as $img){
|
foreach($cat as $img){
|
||||||
//$result .= '<img src="api.php?call=img&cat='.$name.'&id='.$img.'" alt="" />';
|
//$result .= '<img src="api.php?call=img&cat='.$name.'&id='.$img.'" alt="" />';
|
||||||
$result .= '<li><a href="api.php?call=img&cat='.$name.'&id='.$img.'">'.$img.'</a></li>';
|
$result .= '<input type="button" class="btn-danger imgdelbtn" style="margin: 1px;" value="Delete" cat="'.$name.'" id="'.$img.'"><input type="submit" class="btn-warning imgrnbtn" style="margin: 1px; margin-right: 3px;" value="Rename" cat="'.$name.'" id="'.$img.'"><a href="api.php?call=img&cat='.$name.'&id='.$img.'">'.$img.'</a><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@ -34,5 +45,6 @@ class saimod_sys_img extends \SYSTEM\SAI\SaiModule {
|
|||||||
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
|
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_flag_css(){}
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_flag_css(){}
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_flag_js(){}
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_img_flag_js(){return \SYSTEM\LOG\JsonResult::toString(
|
||||||
|
array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_img/sai_sys_img.js')));}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user