コード例 #1
0
ファイル: Smiles.php プロジェクト: noikiy/PD
 public static function editeSmile($id, $data)
 {
     $db = JO_Db::getDefaultAdapter();
     $info = self::getSmile($id);
     if (!$info) {
         return;
     }
     $update = array('name' => $data['name'], 'visible' => $data['visible'], 'code' => $data['code']);
     if (isset($data['deletePhoto'])) {
         $update['photo'] = '';
         if ($info && $info['photo']) {
             @unlink(BASE_PATH . '/uploads/' . $info['photo']);
         }
     }
     $image = JO_Request::getInstance()->getFile('photo');
     if (!file_exists(BASE_PATH . '/uploads/smiles/')) {
         mkdir(BASE_PATH . '/uploads/smiles/', 0777, true);
     }
     $upload_folder = realpath(BASE_PATH . '/uploads/smiles/');
     $upload_folder .= '/';
     $upload = new JO_Upload();
     $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
     $new_name = md5(time() . serialize($image));
     if ($upload->upload($new_name)) {
         $info1 = $upload->getFileInfo();
         if ($info1) {
             $update['photo'] = '/smiles/' . $info1['name'];
             if ($info && $info['photo']) {
                 @unlink(BASE_PATH . '/uploads/' . $info['photo']);
             }
         }
     }
     $db->update('smiles', $update, array('id = ?' => (int) $id));
     return $id;
 }
コード例 #2
0
ファイル: Socials.php プロジェクト: noikiy/PD
 public static function editeSocials($id, $data)
 {
     $db = JO_Db::getDefaultAdapter();
     $upload_folder = realpath(BASE_PATH . '/uploads/socials/') . '/';
     $info = self::getSocial($data['id']);
     $updates = array('name' => $data['name'], 'link' => $data['link'], 'visible' => $data['visible']);
     $image = JO_Request::getInstance()->getFile('photo');
     if (!empty($image['tmp_name'])) {
         if ($info && file_exists($upload_folder . $info['photo'])) {
             @unlink($upload_folder . $info['photo']);
         }
         $upload = new JO_Upload();
         $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
         $new_name = md5(time() . serialize($image));
         if ($upload->upload($new_name)) {
             $info = $upload->getFileInfo();
             if ($info) {
                 $updates['photo'] = $info['name'];
             }
         }
     } elseif ($data['deletePhoto']) {
         if (file_exists($upload_folder . $info['photo'])) {
             @unlink($upload_folder . $info['photo']);
         }
         $updates['photo'] = '';
     }
     $db->update('socials', $updates);
 }
コード例 #3
0
ファイル: Attributes.php プロジェクト: noikiy/PD
    public static function editeAttribute($id, $data)
    {
        $db = JO_Db::getDefaultAdapter();
        $table = JO_Request::getInstance()->getRequest('sub_of') ? 'attributes' : 'attributes_categories';
        if ($table == 'attributes') {
            $insert = array('name' => $data['name'], 'visible' => $data['visible'], 'search' => $data['search']);
        } else {
            $insert = array('name' => $data['name'], 'type' => $data['type'], 'categories' => $data['categories'] ? ',' . implode(',', $data['categories']) . ',' : '', 'visible' => $data['visible'], 'search' => $data['search']);
        }
        $info = self::getAttribute($id);
        if ($table == 'attributes_categories' && $info['search'] != $data['search']) {
            $qs = 'UPDATE attributes 
					SET search = \'' . ($data['search'] ? 'true' : 'false') . '\' 
					WHERE category_id = \'' . (int) $info['id'] . '\'';
            $db->query($qs);
        }
        if (isset($data['deletePhoto'])) {
            $insert['photo'] = '';
            if ($info && $info['photo']) {
                @unlink(BASE_PATH . '/uploads/attributes/' . $info['photo']);
            }
        }
        $image = JO_Request::getInstance()->getFile('photo');
        if ($image) {
            $upload_folder = realpath(BASE_PATH . '/uploads/attributes/');
            $upload_folder .= '/';
            $upload = new JO_Upload();
            $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
            $new_name = md5(time() . serialize($image));
            if ($upload->upload($new_name)) {
                $info1 = $upload->getFileInfo();
                if ($info1) {
                    $insert['photo'] = $info1['name'];
                    if ($info && $info['photo']) {
                        @unlink(BASE_PATH . '/uploads/attributes/' . $info['photo']);
                    }
                }
            }
        }
        $db->update($table, $insert, array('id = ?' => (int) $id));
        return $id;
    }
コード例 #4
0
ファイル: Upload.php プロジェクト: NareshChennuri/pyng
 public function __construct()
 {
     parent::__construct();
     $translate = WM_Translate::getInstance();
     $this->setErrorMessage(1, $translate->translate("The uploaded file is larger than the allowed maximum size for uploading to the server settings."));
     $this->setErrorMessage(2, $translate->translate("The uploaded file is larger than the allowed maximum size for upload in your site."));
     $this->setErrorMessage(3, $translate->translate("File was partially uploaded"));
     $this->setErrorMessage(4, $translate->translate("File was not successfully uploaded"));
     // end  http errors
     $this->setErrorMessage(10, $translate->translate("Please select file to upload"));
     $this->setErrorMessage(11, $translate->translate("Only files with the following extensions are allowed: {ext_string}"));
     $this->setErrorMessage(12, $translate->translate("Sorry, the file name contains illegal characters. Use only alphanumeric characters and underscore without spaces. Correct the file name ends with a point and then the extension."));
     $this->setErrorMessage(13, $translate->translate("The name of the file exceeds maximum length of {max_length_filename} characters."));
     $this->setErrorMessage(14, $translate->translate("Sorry, the directory file upload does not exist!"));
     $this->setErrorMessage(15, $translate->translate("Error uploading files: {the_file}. File already exists!"));
     $this->setErrorMessage(16, $translate->translate("The uploaded file is renamed to {file_copy}."));
 }
コード例 #5
0
ファイル: CollectionsController.php プロジェクト: noikiy/PD
 public function uploadAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', 'You must be logged to view your collections');
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $model_images = new Model_Images();
     if ($request->isPost()) {
         $image = $request->getFile('file_upload');
         $public = $request->getPost('publically_visible');
         $id = Model_Collections::add(array('name' => $request->getPost('name') ? $request->getPost('name') : $this->translate('Bookmark Collection'), 'description' => $request->getPost('description'), 'publically_visible' => $public ? 'true' : 'false'));
         if ($image and $id) {
             $users_path = '/collections/' . date('Y/m') . '/' . $id . '/';
             $upload_folder = realpath(BASE_PATH . '/uploads');
             $upload_folder .= $users_path;
             $upload = new JO_Upload();
             $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
             $new_name = md5(time() . serialize($image));
             if ($upload->upload($new_name)) {
                 $info = $upload->getFileInfo();
                 if ($info) {
                     $file_path = $users_path . $info['name'];
                     Model_Collections::editImage($id, $file_path);
                 } else {
                     JO_Session::set('msg_error', $this->translate('There was an unexpected error with uploading the file'));
                 }
             }
         }
         if ($id && $request->issetPost('item_id')) {
             $itemID = $request->getPost('item_id');
             Model_Collections::bookmark($itemID, $id);
             JO_Session::set('msg_success', 'You have successfully create collection and this item has been added to your collection');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $itemID));
         }
         if ($id) {
             JO_Session::set('msg_success', 'You have successfully create collection.');
         }
         $url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username='******'username')) . '/public/' . ($public ? '1' : '0'));
         $this->redirect($url);
     }
 }
コード例 #6
0
ファイル: UsersController.php プロジェクト: noikiy/PD
 public function editAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to change your profile'));
         $redir = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
         if ($request->getRequest('tool') == 'change_avatar') {
             die(json_encode(array('logout' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'))));
         } else {
             $this->redirect($redir);
         }
     }
     $this->getLayout()->meta_title = $this->translate('Edit settings');
     $this->getLayout()->meta_description = $this->translate('Edit settings');
     if (JO_Session::get('msg_success')) {
         $this->view->msg_success = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     } elseif (JO_Session::get('msg_error')) {
         $this->view->error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     $tool = $request->getRequest('tool');
     $username = JO_Session::get('username');
     $this->view->user = Model_Users::getByUserName($username);
     $this->view->author_header = Helper_Author::authorHeader($this->view->user);
     $this->view->settings_box = Helper_Author::getSettingsBox($tool);
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Profile'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'name' => $this->translate('Settings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit')));
     switch ($tool) {
         case 'change_avatar':
             $image = $request->getFile('file');
             if ($image) {
                 $users_path = '/users/' . JO_Date::getInstance(JO_Session::get('register_datetime'), 'yy/mm') . '/' . JO_Session::get('user_id') . '/';
                 $upload_folder = realpath(BASE_PATH . '/uploads');
                 $upload_folder .= $users_path;
                 $upload = new JO_Upload();
                 $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
                 $new_name = md5(time() . serialize($image));
                 if ($upload->upload($new_name)) {
                     $info = $upload->getFileInfo();
                     if ($info) {
                         $file_path = $users_path . $info['name'];
                         $model_images = new Model_Images();
                         if (JO_Session::get('avatar')) {
                             $model_images->deleteImages(JO_Session::get('avatar'), true);
                         }
                         $thumb = $model_images->resize($file_path, JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
                         Model_Users::editAvatar(JO_Session::get('user_id'), $file_path);
                         die('{ "avatar": "' . $thumb . '", "msg_success": "' . $this->translate('You have successfully changed your avatar') . '"}');
                     } else {
                         die('{ "msg_error": "' . $this->translate('There was an unexpected error with uploading the file') . '"}');
                     }
                 } else {
                     die('{ "msg_error": "' . $this->translate('The file must be valid image') . '" }');
                 }
             }
             break;
         case 'change_password':
             if ($request->isPost()) {
                 $s = Model_Users::editPassword(JO_Session::get('user_id'), array('password' => $request->getPost('password'), 'new_password' => $request->getPost('new_password'), 'new_password_confirm' => $request->getPost('new_password_confirm')));
                 if ($s === true) {
                     $this->session->set('msg_success', $this->translate('You have successfully updated your password'));
                 } else {
                     $this->session->set('msg_error', $s);
                 }
                 $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=edit&tool=change_password'));
             }
             $this->view->formtitle = $this->translate('Change your password');
             $this->view->crumbs[] = array('name' => $this->view->formtitle);
             $this->view->author_form = $this->view->renderByModule('single_user/change_password', 'users', 'themes');
             break;
         case 'exclusive_author':
             if ($request->isPost()) {
                 $exclusive_author = $request->getPost('exclusive_author');
                 Model_Users::editExclusive(JO_Session::get('user_id'), $exclusive_author);
                 if ($exclusive_author == 'true') {
                     JO_Session::set('msg_success', $this->translate('You have successfully changed to exclusive author'));
                 } else {
                     JO_Session::set('msg_success', $this->translate('You have successfully changed to non exclusive author'));
                 }
                 $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=edit&tool=exclusive_author'));
             }
             if ($this->view->user['exclusive_author'] == 'true') {
                 $this->view->formtitle = $this->translate('Exclusive Author');
                 $this->view->button = $this->translate('Unsubscribe me as exclusive author');
             } else {
                 $this->view->formtitle = $this->translate('Non-Exclusive Author');
                 $this->view->button = $this->translate('Subscribe me as exclusive author');
             }
             $this->view->top_text = $this->translate('Agreeing to keep your portfolio of items for sale exclusive to the Marketplaces entitles you to a higher percentage of each sale - from 40% to 70%. You can still sell other items elsewhere (on other marketplaces, your own site) however any items you place on an Marketplace must be exclusively sold there.');
             $this->view->bottom_text = $this->translate('You can opt-out of the exclusivity program by clicking the button below. You will be given a 30 day grace period wherein the agreement is still observed after which your payments will return to normal and you may commence selling your items elsewhere.');
             $this->view->crumbs[] = array('name' => $this->view->formtitle);
             $this->view->author_form = $this->view->renderByModule('single_user/exclusive_author', 'users', 'themes');
             break;
         case 'sale_license':
             if ($request->isPost()) {
                 if ($request->getPost('license')) {
                     Model_Users::editLicense(JO_Session::get('user_id'), $request->getPost('license'));
                     JO_Session::set('msg_success', $this->translate('You have successfully changed the license types'));
                 } else {
                     JO_Session::set('msg_error', $this->translate('You have to choose your license'));
                 }
                 $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=edit&tool=sale_license'));
             }
             $this->view->formtitle = $this->translate('Sale License');
             $this->view->crumbs[] = array('name' => $this->view->formtitle);
             $this->view->license = unserialize($this->view->user['license']);
             $this->view->author_form = $this->view->renderByModule('single_user/sale_license', 'users', 'themes');
             break;
         case 'social':
             if ($request->issetParam('sn')) {
                 $sn = (int) $request->getParam('sn');
                 unset($this->view->user['social'][$sn - 1]);
                 $this->view->user['social'] = array_values($this->view->user['social']);
                 Model_Users::editSocial(JO_Session::get('user_id'), $this->view->user['social']);
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit&tool=social'));
             }
             if ($request->isPost()) {
                 $socials = array();
                 $errors = array();
                 $social_links = $request->getPost('social_link');
                 $social_names = $request->getPost('social_name');
                 $cnt = count($social_links) < count($social_names) ? count($social_names) : count($social_links);
                 for ($i = 0; $i < $cnt; $i++) {
                     $social_names[$i] = trim($social_names[$i]);
                     $social_links[$i] = trim($social_links[$i]);
                     if (empty($social_names[$i]) && empty($social_links[$i])) {
                         break;
                     }
                     if (empty($social_names[$i])) {
                         $errors[$i]['social_name'] = $this->translate('You must fill the name of the social media');
                     }
                     if (empty($social_links[$i])) {
                         $errors[$i]['social_link'] = $this->translate('You must fill valid link for your profile');
                     }
                     $socials[] = array('name' => $social_names[$i], 'href' => $social_links[$i]);
                 }
                 if (empty($errors)) {
                     Model_Users::editSocial(JO_Session::get('user_id'), $socials);
                     JO_Session::set('msg_success', $this->translate('You have successfully changed your social media profiles'));
                 } else {
                     JO_Session::set('msg_error', $errors);
                     $this->session->set('data', $socials);
                 }
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit&tool=social'));
             }
             if ($this->session->issetKey('data')) {
                 $social = $this->session->get('data');
                 $this->session->clear('data');
                 if (count($social) > count($this->view->user['social'])) {
                     $last = end($social);
                     $this->view->new_user = $last['name'];
                     $this->view->new_href = $last['href'];
                 }
             }
             $this->view->formtitle = $this->translate('Social Media profiles');
             $this->view->crumbs[] = array('name' => $this->view->formtitle);
             $this->view->author_form = $this->view->renderByModule('single_user/social', 'users', 'themes');
             break;
         default:
             if ($request->isPost()) {
                 $firstname = trim($request->getPost('firstname'));
                 $lastname = trim($request->getPost('lastname'));
                 $email = trim($request->getPost('email'));
                 if (empty($firstname)) {
                     $error['firstname'] = $this->translate('You must fill your firstname');
                 }
                 if (empty($lastname)) {
                     $error['lastname'] = $this->translate('You must fill your lastname');
                 }
                 if (empty($email)) {
                     $error['email'] = $this->translate('You must fill your email');
                 } elseif (!Model_Users::ValidMail($email)) {
                     $this->view->error['email'] = $this->translate('You must fill valid email');
                 }
                 if ($request->getPost('facebook') == 1) {
                     if ($this->view->user['fb_id'] == 0) {
                         $facebook = new WM_Facebook_Api(array('appId' => JO_Registry::forceGet('facebook_appid'), 'secret' => JO_Registry::forceGet('facebook_secret')));
                         $fbData = $facebook->api('/me');
                         $request->setParams('fb_id', $fbData['id']);
                     } else {
                         $request->setParams('fb_id', $this->view->user['fb_id']);
                     }
                 } else {
                     $request->setParams('fb_id', 0);
                 }
                 if (!count($error)) {
                     Model_Users::editPersonal($this->view->user['user_id'], $request->getParams());
                     JO_Session::set('msg_success', $this->translate('Your personal data has been successfully saved'));
                 } else {
                     JO_Session::set('msg_error', $error);
                 }
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'));
             }
             $this->view->formtitle = $this->translate('Avatar and Personal Information');
             $this->view->crumbs[] = array('name' => $this->view->formtitle);
             $model_images = new Helper_Images();
             if ($this->view->user['avatar']) {
                 $thumb = $model_images->resize($this->view->user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
             } else {
                 $this->view->user['avatar'] = 'data/themes/images/noavatar.png';
             }
             $this->view->upl_form_action = WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit&tool=change_avatar');
             $this->view->countries = Model_Countries::getCountries();
             $this->view->author_form = $this->view->renderByModule('single_user/avatar', 'users', 'themes');
     }
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
コード例 #7
0
ファイル: PagesController.php プロジェクト: noikiy/amatteur
 public function uploadImagesAction()
 {
     if (!WM_Users::allow('create', $this->getRequest()->getController())) {
         $this->forward('error', 'noPermission');
     }
     $gallery_id = (int) $this->getRequest()->getRequest('id');
     $page_info = Model_Pages::getPage($gallery_id);
     $image = $this->getRequest()->getFile('Filedata');
     if (!$image && $this->view->error) {
         $this->view->error = $this->translate('Invalid file');
     }
     if ($page_info) {
         $gallery_path = '/gallery/' . date("Y/m/", strtotime($page_info['date_added']));
     } else {
         $gallery_path = '/temp/gallery/';
     }
     $upload_folder = realpath(BASE_PATH . '/uploads');
     $upload_folder .= $gallery_path;
     $upload = new JO_Upload();
     $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
     $new_name = md5(time() . serialize($image));
     if ($upload->upload($new_name)) {
         $info = $upload->getFileInfo();
         if ($info) {
             $file_path = $gallery_path . $info['name'];
             $data = array('gallery_id' => $gallery_id, 'image' => $file_path, 'controller' => 'pages');
             if ($page_info) {
                 $insert_id = Model_Gallery::createImage($data);
                 if ($insert_id) {
                     $model_images = new Helper_Images();
                     $this->view->id = $insert_id;
                     $this->view->thumb = $model_images->resize($file_path, 100, 100);
                     $this->view->image = $this->getRequest()->getBaseUrl() . 'uploads' . $file_path;
                 } else {
                     $this->view->error = $this->translate('There was an error record. Try Again ');
                     @unlink($upload_folder . $info['name']);
                 }
             } else {
                 $temporary_images = JO_Session::get('temporary_images');
                 if (!is_array($temporary_images)) {
                     $temporary_images = array();
                 }
                 $temporary_images[] = $data;
                 JO_Session::set('temporary_images', $temporary_images);
                 $model_images = new Helper_Images();
                 $this->view->id = count($temporary_images) - 1;
                 $model_images = new Helper_Images();
                 $this->view->thumb = $model_images->resize($file_path, 100, 100);
                 $this->view->image = $this->getRequest()->getBaseUrl() . 'uploads' . $file_path;
             }
         } else {
             $this->view->error = $this->translate('An unknown error');
         }
     } else {
         $this->view->error = $upload->getError();
     }
     $response = $this->getResponse();
     $response->addHeader('Cache-Control: no-cache, must-revalidate');
     $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     $response->addHeader('Content-type: application/json');
     echo $this->renderScript('json');
 }
コード例 #8
0
ファイル: UploadController.php プロジェクト: noikiy/PD
 public function douploadAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to upload an item'));
         die(json_encode(array('logout' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'))));
     }
     $file = $request->getFile('file');
     $result = array();
     if (!$file) {
         $result['msg_error'] = $this->translate('Invalid upload');
         die(json_encode($result));
     }
     $upload_folder = realpath(BASE_PATH . '/uploads');
     $upload_folder .= '/temporary/' . JO_Date::getInstance(JO_Session::get('register_datetime'), 'yy/mm', true) . '/';
     $upload = new JO_Upload();
     $types = array();
     $fileTypes = JO_Registry::get('upload_theme');
     if ($fileTypes) {
         foreach ($fileTypes as $type) {
             $tp = explode(',', $type);
             foreach ($tp as $t) {
                 $types[] = '.' . $t;
             }
         }
     }
     $allow_images = array();
     if (isset($fileTypes['images'])) {
         $ew = explode(',', $fileTypes['images']);
         foreach ($ew as $ar) {
             $allow_images[] = '.' . strtolower($ar);
         }
     }
     $upload->setFile($file)->setExtension($types)->setUploadDir($upload_folder);
     $new_name = md5(time() . serialize($file));
     if ($upload->upload($new_name)) {
         $file_extension = $upload->get_extension($file['name']);
         $info = $upload->getFileInfo();
         if ($file_extension == '.zip') {
             if ($info) {
                 $zip = new ZipArchive();
                 $fileArr = array();
                 $res = $zip->open($upload_folder . $upload->getNewFileName());
                 if ($res === true) {
                     for ($i = 0; $i < $zip->numFiles; $i++) {
                         $zip_file = $zip->statIndex($i);
                         if (in_array($upload->get_extension($zip_file['name']), $allow_images)) {
                             if (stripos($zip_file['name'], '_MACOSX') !== false) {
                                 continue;
                             }
                             $ext = $upload->get_extension($zip_file['name']);
                             $name = basename($zip_file['name'], $ext);
                             $fileArr[] = array('zip_filename' => $info['name'], 'zip_name' => $file['name'], 'filename' => md5($name) . $ext, 'name' => $name . $ext, 'size' => number_format($zip_file['size'], 2), 'uploaded' => time());
                         }
                     }
                     $zip->close();
                     if (!empty($fileArr)) {
                         if (JO_Session::get('uploaded_files')) {
                             $array = JO_Session::get('uploaded_files');
                         } else {
                             $array = array();
                         }
                         $array[] = $fileArr;
                         JO_Session::set('uploaded_files', $array);
                     } else {
                         $fileArr[] = array('zip_filename' => $info['name'], 'zip_name' => $file['name'], 'filename' => '', 'name' => '', 'size' => '', 'uploaded' => time());
                     }
                     if (JO_Session::get('uploaded_arhives')) {
                         $array = JO_Session::get('uploaded_arhives');
                     } else {
                         $array = array();
                     }
                     $array[] = array(array('filename' => $info['name'], 'name' => $file['name']));
                     JO_Session::set('uploaded_arhives', $array);
                 } else {
                     $result['msg_error'] = $this->translate('Theme preview should be ' . implode(', ', $allow_archives) . ' file');
                 }
             } else {
                 $result['msg_error'] = $this->translate('Invalid upload');
             }
         } else {
             if ($info) {
                 $fileArr[] = array('zip_filename' => '', 'zip_name' => '', 'filename' => $info['name'], 'name' => $file['name'], 'size' => number_format($info['size'] / 1024 / 1024, 2), 'uploaded' => time());
                 if (JO_Session::get('uploaded_files')) {
                     $array = JO_Session::get('uploaded_files');
                 } else {
                     $array = array();
                 }
                 $array[] = $fileArr;
                 JO_Session::set('uploaded_files', $array);
             } else {
                 $result['msg_error'] = $this->translate('Invalid upload');
             }
         }
     }
     if (is_array($fileArr)) {
         $result['msg_success'] = $this->translate('File was uploaded successful');
         $result['file'] = $fileArr;
         die(json_encode($result));
     } else {
         $result['msg_error'] = $this->translate('Invalid upload');
         die(json_encode($result));
     }
 }