56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
|
<?php
|
|||
|
if ($_SESSION['dostup']!=='a' && $_SESSION['dostup']!=='e')header( 'Location: /403/' );
|
|||
|
|
|||
|
/* Вынести в отдельную функцию */
|
|||
|
|
|||
|
//берем опции
|
|||
|
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 ( 'slider', ID );
|
|||
|
if (@$_POST['ok']){
|
|||
|
require MYDIR . '/api/php/genpass.php';
|
|||
|
$src = $_FILES['img']['tmp_name'];
|
|||
|
$f1 = generate_password(10);
|
|||
|
$f2 = generate_password(10);
|
|||
|
$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;
|
|||
|
$db -> add ( 'slider', $_POST );
|
|||
|
}
|
|||
|
}
|
|||
|
$db -> get_massiv ( 'slider' ); //исполняем функцию с параметрами
|
|||
|
$sliders = $db->result; //получаем результат
|
|||
|
$smarty->assign('sliders', $sliders);
|
|||
|
?>
|