| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
// import dependencies. |
| 10 |
cssJSToolbox::import('framework:mvc:controller-ajax.inc.php'); |
| 11 |
|
| 12 |
/** |
| 13 |
* |
| 14 |
*/ |
| 15 |
class CJTInstallerController extends CJTAjaxController { |
| 16 |
|
| 17 |
/** |
| 18 |
* put your comment there... |
| 19 |
* |
| 20 |
* @var mixed |
| 21 |
*/ |
| 22 |
protected $controllerInfo = array('model' => 'installer'); |
| 23 |
|
| 24 |
/** |
| 25 |
* put your comment there... |
| 26 |
* |
| 27 |
*/ |
| 28 |
public function __construct() { |
| 29 |
parent::__construct(); |
| 30 |
// Register actions! |
| 31 |
$this->registryAction('install'); |
| 32 |
$this->registryAction('dismissNotice'); |
| 33 |
$this->registryAction('dismissWarningNotice'); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* put your comment there... |
| 38 |
* |
| 39 |
*/ |
| 40 |
public function dismissNoticeAction() { |
| 41 |
$this->model->dismissNotice(true); |
| 42 |
$this->response = true; |
| 43 |
} |
| 44 |
|
| 45 |
public function dismissWarningNoticeAction() { |
| 46 |
$this->model->dismissWarningNotice(true); |
| 47 |
$this->response = true; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* put your comment there... |
| 52 |
* |
| 53 |
*/ |
| 54 |
protected function installAction() |
| 55 |
{ |
| 56 |
|
| 57 |
// Installa requested operation. |
| 58 |
$input['operation'] = $_REQUEST['operation']; |
| 59 |
|
| 60 |
// Allow extension to process thier owen operations |
| 61 |
$processed = apply_filters( |
| 62 |
CJTPluggableHelper::FILTER_INSTALLER_INSTALL_OPERATION, |
| 63 |
false, |
| 64 |
$input['operation'] |
| 65 |
); |
| 66 |
|
| 67 |
if ($processed) |
| 68 |
{ |
| 69 |
$this->response = $processed; |
| 70 |
|
| 71 |
return; |
| 72 |
} |
| 73 |
|
| 74 |
// Process installer operation |
| 75 |
try |
| 76 |
{ |
| 77 |
|
| 78 |
$model =& $this->model; |
| 79 |
|
| 80 |
$this->response = $model->setInput($input)->install(); |
| 81 |
} |
| 82 |
catch (Exception $exception) |
| 83 |
{ |
| 84 |
|
| 85 |
header('HTTP/1.1 501'); |
| 86 |
|
| 87 |
$this->response = $exception->getMessage(); |
| 88 |
|
| 89 |
echo $this->response; |
| 90 |
|
| 91 |
die(); |
| 92 |
} |
| 93 |
|
| 94 |
} |
| 95 |
|
| 96 |
} // End class. |
| 97 |
|