57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?php
|
||
if ($_SESSION['dostup']!=='a' && $_SESSION['dostup']!=='e')header( 'Location: /403/' );
|
||
//$mod = new main($smarty, $settings, $db);
|
||
|
||
/* Вынести в отдельную функцию */
|
||
|
||
//берем опции
|
||
unset( $a );
|
||
//unset($xml);
|
||
//$a['mod'] = MOD;
|
||
//$xml = $db -> get_val ( 'settings', $a, 'xml' );
|
||
/*if (!$xml){
|
||
$db->free_sql('INSERT INTO `settings` (`mod`, `xml`)VALUES ("' . MOD . '", "<opt></opt>");');
|
||
$xml = $db -> get_val( 'settings', $a, 'xml' );
|
||
}*/
|
||
//Читаем настройки модуля
|
||
//$parce -> make_massiv ( $xml );
|
||
//unset($arr);
|
||
//$arr = $parce -> res;
|
||
//foreach ( $arr as $key => $value ) $ms[$key] = $value;
|
||
//$smarty->assign('ms', $ms);
|
||
|
||
|
||
|
||
|
||
|
||
@mkdir (MYDIR . '/img/slider', 0700);
|
||
if (ID)$db -> del_id ( 'pages', ID );
|
||
if (@$_POST['ok']){
|
||
require MYDIR . '/api/php/genpass.php';
|
||
$src = $_FILES['img']['tmp_name'];
|
||
$f1 = generate_password(30);
|
||
$f2 = generate_password(30);
|
||
$img = MYDIR . '/img/slider/' . $f1 . '.jpg';
|
||
$img2 = MYDIR . '/img/slider/' . $f2 . '.jpg';
|
||
if ( preg_match( '/[.](jpg)|(jpeg)|(JPG)|(JPEG)$/', $_FILES['img']['name'] ) ) {
|
||
/*$target588_457 = MYDIR . '/img/slider/' . $f1 . '_588_457.jpg';//Куда загружаем:
|
||
copy ($src, $target588_457);
|
||
include( MYDIR . '/api/php/img2.php' );
|
||
rimg($target, 588, 457, $target588_457, 80);*/
|
||
copy( $src, $img );
|
||
$size = getimagesize ( $img );
|
||
if ( $size[0] > 795 ) exec ( 'convert ' . $img . ' -resize 795x529 -quality 100 ' . $img );
|
||
$_POST['img']=$f1;
|
||
$massiv['json']=json_encode($_POST, JSON_UNESCAPED_UNICODE);
|
||
$massiv['public']=1;
|
||
$massiv['user_id']=$_SESSION['user_id'];
|
||
$massiv['tip']="slider";
|
||
$db -> add ( 'pages', $massiv );
|
||
}
|
||
}
|
||
unset($a);
|
||
$a['tip']='slider';
|
||
$db -> get_massiv ( 'pages', $a ); //исполняем функцию с параметрами
|
||
$sliders = $db->result; //получаем результат
|
||
$smarty->assign('sliders', $sliders);
|
||
?>
|