Beispiel #1
0
 public function uploadImages()
 {
     $objLibImage = kernel::single('image_data_image');
     $file = $this->__getFile(input::file());
     $imageType = input::get('type', false);
     $imageFrom = input::get('from', false);
     foreach ((array) $file as $key => $fileObject) {
         try {
             $imageData = $objLibImage->store($fileObject, $imageFrom, $imageType);
             $imageSetParams = app::get('image')->getConf('image.set');
             $allsize = app::get('image')->getConf('image.default.set');
             foreach ($allsize as $s => $value) {
                 if (!isset($allsize[$s])) {
                     break;
                 }
                 $w = $imageSetParams[$s]['width'];
                 $h = $imageSetParams[$s]['height'];
                 $wh = $allsize[$s]['height'];
                 $wd = $allsize[$s]['width'];
                 $sizes[$s]['width'] = $w ? $w : $wd;
                 $sizes[$s]['height'] = $h ? $h : $wh;
             }
             $objLibImage->rebuild($imageData['ident'], $sizes);
         } catch (Exception $e) {
             $msg = $e->getMessage();
             $result = array('error' => true, 'message' => $msg);
             return response::json($result);
         }
         $imageSrc[$key]['url'] = $imageData['url'];
         $imageSrc[$key]['image_id'] = $imageData['url'];
     }
     $result = array('success' => true, 'data' => $imageSrc);
     return json_encode($result);
 }
Beispiel #2
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $file = input::file('avatar');
     $dest = public_path() . '/images/';
     $name = str_random(6) . '_' . $file->getClientOriginalName();
     $file->move($dest, $name);
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'avatar' => $name, 'password' => bcrypt($data['password'])]);
 }
 public function post(NameRequest $request)
 {
     $name = new Name();
     $name->name = input::get('name');
     $name->email = input::get('email');
     $name->image = input::file('image')->getClientOriginalName();
     $name->created_at = date("y-m-d h:i:s");
     $name->save();
     return Redirect::to('name');
     if (Input::hasFile('image')) {
         $file = Input::file('image');
         $file->move(storage_path() . '/uploads', $file->getClientOriginalName());
     } else {
         return Redirect::to('name');
     }
 }
Beispiel #4
0
 public function premoney()
 {
     $saveItem = app::get('sysuser')->model('user');
     $savereco = app::get('sysuser')->model('moneyreco');
     $sa = kernel::single('desktop_user');
     $admName = $sa->get_login_name();
     $postData = input::get();
     if ($postData['changemoney'] == 0) {
         $msg = '充值金额不能为0';
         return $this->splash('error', null, $msg);
     }
     $paminfo = $saveItem->getRow('*', array('user_id' => $postData['user_id']));
     $paminfoold = $paminfo;
     $postData['paytime'] = strtotime($postData['paytime']);
     $postData['create_time'] = time();
     $postData['name'] = $admName;
     if ($postData['changemoney'] > 0) {
         $postData['pay'] = 0;
     } else {
         $postData['pay'] = 1;
     }
     $fileObject = input::file('ensurence');
     if ($fileObject) {
         $storager = kernel::single('base_storager');
         $result = $storager->upload($fileObject);
         $arr = explode("|", $result);
         $postData['ensurence'] = $arr[0];
     }
     try {
         $savereco->save($postData);
         $changes = $postData['changemoney'];
         $cut = $paminfo['hjadvance'] + $changes;
         $paminfo['hjadvance'] = $cut;
         $saveItem->update($paminfo, $paminfoold);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     return view::make('sysuser/admin/user/savesucc.html')->render();
 }
 function postDopackage(Request $request)
 {
     // app name
     $app_name = $request->input('app_name');
     // encrypt info
     $enc_module = $request->input('enc_module');
     $enc_id = $request->input('enc_id');
     // query command || file
     $sql_cmd = $request->input('sql_cmd');
     if (!$_FILES['sql_cmd_upload']['error']) {
         $sql_path = input::file('sql_cmd_upload')->getrealpath();
         if ($sql_content = file_get_contents($sql_path)) {
             $sql_cmd = $sql_content;
         }
     }
     /* CHANGE START */
     // file to include
     $file_library = $request->input('file_library');
     $file_lang = $request->input('file_lang');
     /* CHANGE END */
     // create app name
     $tapp_code = preg_replace('/([s[:punct:]]+)/', ' ', $app_name);
     $app_code = str_replace(' ', '_', trim($tapp_code));
     $module_id = unserialize(base64_decode($enc_id));
     $modules = unserialize(base64_decode($enc_module));
     $c_module_id = implode(',', $module_id);
     $zip_file = "./uploads/zip/{$app_code}.zip";
     $cf_zip = new \ZipHelpers();
     $app_path = app_path();
     $cf_zip->add_data(".mysql", $sql_cmd);
     // App ID Name
     $ain = $module_id;
     $cf_zip->add_data(".ain", base64_encode(serialize($ain)));
     // setting
     $sql = " select * from tb_module where module_id in ( {$c_module_id} )";
     $_modules = \DB::select($sql);
     foreach ($_modules as $n => $_module) {
         $_modules[$n]->module_id = '';
     }
     $setting['tb_module'] = $_modules;
     $cf_zip->add_data(".setting", base64_encode(serialize($setting)));
     unset($_module);
     foreach ($_modules as $n => $_module) {
         $file = $_module->module_name;
         $cf_zip->add_data("app/Http/Controllers/" . ucwords($file) . "Controller.php", file_get_contents($app_path . "/Http/Controllers/" . ucwords($file) . "Controller.php"));
         $cf_zip->add_data("app/Models/" . ucwords($file) . ".php", file_get_contents($app_path . "/Models/" . ucwords($file) . ".php"));
         $cf_zip->get_files_from_folder("../resources/views/{$file}/", "resources/views/{$file}/");
     }
     // CHANGE START
     // push library files
     if (!empty($file_library)) {
         foreach ($file_library as $k => $file) {
             $cf_zip->add_data("app/Library/" . $file, file_get_contents($app_path . "/Library/" . $file));
         }
     }
     // push language files
     if (!empty($file_lang)) {
         $lang_path = scandir(base_path() . '/resources/lang/');
         foreach ($lang_path as $k => $path) {
             if ($path == '.' || $path == '..') {
                 continue;
             }
             if (is_file($app_path . '/' . $path)) {
                 continue;
             }
             foreach ($file_lang as $k => $file) {
                 $cf_zip->add_data('resources/lang/' . $path . '/' . $file, file_get_contents(base_path() . "/resources/lang/" . $path . '/' . $file));
             }
         }
         $this->data['lang_path'] = $lang_path;
     }
     // CHANGE END
     $_zip = $cf_zip->archive($zip_file);
     $cf_zip->clear_data();
     $this->data['download_link'] = link_to("uploads/zip/{$app_name}.zip", "download here", array('target' => '_new'));
     $this->data['module_title'] = "ZIP Packager";
     $this->data['app_name'] = $app_name;
     return Redirect::to('sximo/module')->with('messagetext', ' Module(s) zipped successful ! ')->with('msgstatus', 'success');
 }
    return array('files' => $results);
});
// Jqueryupload by Eunseok
Route::get('jqupload', function () {
    //    $options = array(
    //        'upload_dir' => 'uploads',
    //        'accept_file_types' => '/\.(gif|jpe?g|png)$/i'
    //    );
    //
    //    $upload_handler = new App\Library\UploadHandler($options);
    return view('minimum.minimum');
});
Route::post('jqupload', function () {
    //    $files = Input::file('file');
    //    $file_count = count($files);
    $file = input::file('file');
    $destinationPath = 'uploads';
    $filename = str_random(12);
    $upload_success = Input::file('file')->move($destinationPath, $filename);
    if ($upload_success) {
        return Response::json('success', 200);
    } else {
        return Response::json('error', 400);
    }
    Log::info('ajax 처리 신호 옴');
    Log::warning('Something could be going wrong.');
    Log::error('Something is really going wrong.');
    //    'upload_url' => $this->get_full_url().'/test/',
    //
    //    $options = array(
    //        'upload_dir' => 'test/uploads',