<?php
include '../../../root.php';  //файл с корневой папкой, если сайт не в корне домена
$sg_root=trim($sg_root);
$root = rtrim($_SERVER['DOCUMENT_ROOT'],'/'); // don't touch this configuration
if (isset($_GET['papka'])) $getpapka = trim($_GET['papka']);
else {$getpapka ='';}
if (!isset($_GET['type']) || $_GET['type']=='') $_GET['type']=0;

//**********************
//Path configuration
//**********************
// In this configuration the folder tree is
// root
//   |- tinymce
//   |    |- source <- upload folder
//   |    |- js
//   |    |   |- tinymce
//   |    |   |    |- plugins
//   |    |   |    |-   |- filemanager
//   |    |   |    |-   |-      |- thumbs <- folder of thumbs [must have the write permission]
$MaxSizeUpload=100; //Mb
$base_url=""; //url base of site if you want only relative url leave empty
$upload_dir = '/sg_cm/upload/'; // path from base_url to upload base dir
if ($getpapka=="images") $upload_dir = '/images/'; // path from base_url to upload base dir WSX5 images;
elseif ($getpapka=="files") $upload_dir = '/files/'; // path from base_url to upload base dir WSX5 files;
elseif ($getpapka=="gallery") $upload_dir = '/gallery/'; // path from base_url to upload base dir WSX5 gallery;
elseif ($getpapka=="videos") $upload_dir = '/videos/'; // path from base_url to upload base dir WSX5 videos;
elseif ($getpapka=="backup") $upload_dir = '/sg_cm/backup/'; // path from base_url to upload base dir WSX5 videos;
elseif ($getpapka=='content') $upload_dir = '/sg_cm/content/'; 
elseif ($getpapka==2) $upload_dir = '/sg_cm/upload/gs_foto/'; 
elseif ($getpapka!='') {$getpapka=''; $_GET['fldr']='';}
$current_path = '../../../..'.$upload_dir; // relative path from filemanager folder to upload files folder
if ($sg_root!="") $sg_root="/".trim($sg_root,'/');
$upload_dir=$sg_root.$upload_dir; 

//********************** 
//Image config
//**********************
//set max width pixel or the max height pixel for all images
//If you set dimension limit, automatically the images that exceed this limit are convert to limit, instead
//if the images are lower the dimension is maintained
//if you don't have limit set both to 0
$image_max_width=0;
$image_max_height=0;

//Automatic resizing //
//If you set true $image_resizing the script convert all images uploaded in image_width x image_height resolution
//If you set width or height to 0 the script calcolate automatically the other size
$image_resizing=false;
$image_width=600;
$image_height=300;

//******************
//Permits config
//******************
$delete_file=true;
$create_folder=true;
$delete_folder=true;
$upload_files=true;
//if ($gatpapka==1) $upload_files=false;
if ($getpapka==2) $delete_file=false;

//**********************
//Allowed extensions
//**********************
$ext_img = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'JPG', 'JPEG', 'BMP', 'GIF', 'PNG' ); //Images
$ext_file = array('doc', 'docx', 'pdf', 'xls', 'xlsx', 'txt', 'csv','html','psd','sql','log','fla','xml','ade','adp','ppt','pptx','js','css'); //Files
$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg','wma'); //Videos
$ext_music = array('mp3', 'm4a', 'ac3', 'aiff', 'mid'); //Music
$ext_misc = array('zip', 'rar','gzip', 'ZIP', 'RAR','GZIP'); //Archives
$ext_txtt = array('txt', 'html', 'htm', 'css'); //TXT блоки

$ext=array_merge($ext_img, $ext_file, $ext_misc, $ext_video,$ext_music); //allowed extensions
if ($_GET['type']==1) $ext=$ext_img;
if ($_GET['type']==3) $ext=array_merge($ext_video,$ext_music);
if ($getpapka=='content') $ext=$ext_txtt;
if ($getpapka==2) $ext=$ext_img;
?>
