43 lines
1.3 KiB
PHP
Executable File
43 lines
1.3 KiB
PHP
Executable File
<?php
|
|
ini_set( 'display_errors', 1 );
|
|
switch(@$_POST['act']) {
|
|
case 'foto_upload':
|
|
@mkdir( 'img/' . $_SERVER['SERVER_NAME'] . '/pages', 0700 );
|
|
@mkdir( 'img/' . $_SERVER['SERVER_NAME'] . '/cat/', 0700 );
|
|
@mkdir( 'img/' . $_SERVER['SERVER_NAME'] . '/cat/' . $_SESSION['id'], 0700 );
|
|
|
|
if ( $_FILES['file']['tmp_name'] ){
|
|
if ( preg_match( '/[.](jpg)|(jpeg)|(JPG)|(JPEG)$/', $_FILES['file']['name'] ) ){
|
|
$img_name = \core::genpassword( 30 );
|
|
$source = $_FILES['file']['tmp_name'];
|
|
$target_original = 'img/' . $_SERVER['SERVER_NAME'] . '/cat/' . $_SESSION['id'] . '/' . $img_name . '.jpg';
|
|
copy( $source, $target_original );
|
|
|
|
\DB::add( "INSERT INTO `img` (`filename`, `content_type`, `content_id`, `site`) VALUES (?, ?, ? ,?)", array(
|
|
$img_name,
|
|
'cat',
|
|
$_SESSION['id'], $_SERVER['SERVER_NAME'] )
|
|
);
|
|
}
|
|
}
|
|
break;
|
|
case 'save-settings':
|
|
|
|
|
|
$json=\json::to_j($_POST);
|
|
|
|
$id=\DB::getValue("SELECT `id` FROM `settings` WHERE `mod`='page_edit' LIMIT 1");
|
|
if ($id)
|
|
\DB::set("UPDATE `settings` SET `json` =? WHERE `mod`='page_edit' LIMIT 1", $json);
|
|
else
|
|
\DB::add("INSERT INTO `settings` (`mod`, `json`) VALUES (?, ?)", array('page_edit', $json));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
}
|
|
?>
|