forked from dbelyaeff/cogear
/
Gear.php
37 lines (33 loc) · 1.11 KB
/
Gear.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Upload gear
*
* @author Dmitriy Belyaev <admin@cogear.ru>
* @copyright Copyright (c) 2011, Dmitriy Belyaev
* @license http://cogear.ru/license.html
* @link http://cogear.ru
* @package Core
* @subpackage
* @version $Id$
*/
class Upload_Gear extends Gear {
protected $name = 'Upload';
protected $description = 'Upload files and images';
protected $settings = array('theme'=>'Theme_Splash');
public function index($action = NULL) {
switch ($action) {
case 'file':
$tpl = new Template('Upload.file');
$tpl->show();
break;
case 'image':
$image = new Upload_Image('file',array('preset'=>'post','path'=>UPLOADS.DS.'posts'.DS.date('Y/m/d')));
if($result = $image->upload()){
exit(HTML::img($result));
}
break;
default:
append('content', HTML::a(Url::gear('upload') . '/file?iframe', t('Upload'), array('rel' => 'modal', 'class' => 'button')));
}
}
}