-
Notifications
You must be signed in to change notification settings - Fork 1
/
file.php
executable file
·132 lines (110 loc) · 3.17 KB
/
file.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* Contao Open Source CMS
*
* Copyright (C) 2005-2012 Leo Feyer
*
* @package cloud-api
* @author David Molineus <http://www.netzmacht.de>
* @license GNU/LGPL
* @copyright Copyright 2012 David Molineus netzmacht creative
*
**/
namespace Netzmacht\Cloud\Api;
use Ajax;
use Backend;
use BackendTemplate;
use Environment;
use Input;
use DC_Table;
/**
* Initialize the system
*/
define('TL_MODE', 'BE');
//require_once '../../initialize.php';
require_once '/var/www/dev/system/initialize.php';
/**
* Class FilePicker
*
* Back end page picker.
* @copyright Leo Feyer 2005-2012
* @author Leo Feyer <http://contao.org>
* @package Core
*/
class FilePicker extends Backend
{
/**
* Current Ajax object
* @var object
*/
protected $objAjax;
/**
* Initialize the controller
*
* 1. Import the user
* 2. Call the parent constructor
* 3. Authenticate the user
* 4. Load the language files
* DO NOT CHANGE THIS ORDER!
*/
public function __construct()
{
$this->import('BackendUser', 'User');
parent::__construct();
$this->User->authenticate();
$this->loadLanguageFile('default');
}
/**
* Run the controller and parse the template
*/
public function run()
{
$this->Template = new BackendTemplate('be_picker');
$this->Template->main = '';
// Ajax request
if ($_POST && Environment::get('isAjaxRequest'))
{
$this->objAjax = new Ajax(Input::post('action'));
$this->objAjax->executePreActions();
}
$strTable = Input::get('table');
$strField = Input::get('field');
// Define the current ID
define('CURRENT_ID', (Input::get('table') ? $this->Session->get('CURRENT_ID') : Input::get('id')));
$this->loadDataContainer($strTable);
$objDca = new DC_Table($strTable);
// AJAX request
if ($_POST && Environment::get('isAjaxRequest'))
{
$this->objAjax->executePostActions($objDca);
}
$objFileTree = new $GLOBALS['BE_FFL']['cloudFileSelector'](array(
'strId' => $strField,
'strTable' => $strTable,
'strField' => $strField,
'strName' => $strField,
'varValue' => explode(',', Input::get('value'))
), $objDca);
$this->Template->main = $objFileTree->generate();
$this->Template->theme = $this->getTheme();
$this->Template->base = Environment::get('base');
$this->Template->language = $GLOBALS['TL_LANGUAGE'];
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
$this->Template->headline = $GLOBALS['TL_LANG']['MSC']['cloudapi_headline'];
$this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
$this->Template->options = $this->createPageList();
$this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
$this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
$this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
$this->Template->search = $GLOBALS['TL_LANG']['MSC']['search'];
$this->Template->action = ampersand(Environment::get('request'));
$this->Template->value = $this->Session->get('file_selector_search');
$GLOBALS['TL_CONFIG']['debugMode'] = false;
$this->Template->output();
}
}
/**
* Instantiate the controller
*/
$objFilePicker = new FilePicker();
$objFilePicker->run();