Exemple #1
0
////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
rcms_loadAdminLib('file-uploads');
$gallery = new gallery();
// Uploading
if (!empty($_FILES['upload'])) {
    $result = '';
    if (fupload_array($_FILES['upload'], GALLERY_UPLOAD_DIR, $gallery->img_preg)) {
        $new_names = $gallery->scanForNewImages();
        foreach ($_FILES['upload']['name'] as $key => $name) {
            $keywords = (!empty($_POST['gkeywords']) ? $_POST['gkeywords'] : '') . (!empty($_POST['keywords'][$key]) ? (!empty($_POST['gkeywords']) ? ';' : '') . $_POST['keywords'][$key] : '');
            if (!empty($keywords)) {
                $gallery->setKeywords(@$new_names[$name], $keywords);
            }
            if (!empty($_POST['title'][$key])) {
                $gallery->setDataValue(@$new_names[$name], 'title', $_POST['title'][$key]);
                $result .= '<br/>' . __('Filename') . ': ' . @$new_names[$name] . ' ' . __('Title') . ': ' . $_POST['title'][$key];
            } elseif (!empty($_POST['gtitle'])) {
                if (!empty($_POST['gadd'])) {
                    $skey = (int) $_POST['gstart'] + $key;
                    $snum = str_pad($skey, $_POST['gdigits'], '0', STR_PAD_LEFT);
                } else {
                    $snum = '';
                }
                $title = $_POST['gtitle'] . $snum;
                $gallery->setDataValue(@$new_names[$name], 'title', $title);
                $result .= '<br/>' . __('Filename') . ': ' . @$new_names[$name] . ' ' . __('Title') . ': ' . $title;
            }