Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PKPInstallHandler.inc.php
1 <?php
2 
17 import('classes.install.form.InstallForm');
18 import('classes.install.form.UpgradeForm');
19 import('classes.handler.Handler');
20 
21 class PKPInstallHandler extends Handler {
25  function PKPInstallHandler() {
26  parent::Handler();
27  }
28 
35  function index($args, $request) {
36  // Make sure errors are displayed to the browser during install.
37  @ini_set('display_errors', true);
38 
39  $this->validate($request);
40  $this->setupTemplate($request);
41 
42  if (($setLocale = $request->getUserVar('setLocale')) != null && AppLocale::isLocaleValid($setLocale)) {
43  $request->setCookieVar('currentLocale', $setLocale);
44  }
45 
46  $installForm = new InstallForm($request);
47  $installForm->initData();
48  $installForm->display();
49  }
50 
55  function validate($request) {
56  if (Config::getVar('general', 'installed')) {
57  $request->redirect(null, 'index');
58  }
59  }
60 
66  function install($args, $request) {
67  $this->validate($request);
68  $this->setupTemplate($request);
69 
70  $installForm = new InstallForm($request);
71  $installForm->readInputData();
72 
73  if ($installForm->validate()) {
74  $installForm->execute();
75 
76  } else {
77  $installForm->display();
78  }
79  }
80 
86  function upgrade($args, $request) {
87  $this->validate($request);
88  $this->setupTemplate($request);
89 
90  if (($setLocale = $request->getUserVar('setLocale')) != null && AppLocale::isLocaleValid($setLocale)) {
91  $request->setCookieVar('currentLocale', $setLocale);
92  }
93 
94  $installForm = new UpgradeForm();
95  $installForm->initData();
96  $installForm->display();
97  }
98 
104  function installUpgrade($args, $request) {
105  $this->validate($request);
106  $this->setupTemplate($request);
107 
108  $installForm = new UpgradeForm();
109  $installForm->readInputData();
110 
111  if ($installForm->validate()) {
112  $installForm->execute();
113  } else {
114  $installForm->display();
115  }
116  }
117 
122  function setupTemplate($request) {
123  parent::setupTemplate($request);
124  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_INSTALLER);
125  }
126 }
127 
128 ?>
installUpgrade($args, $request)
index($args, $request)
install($args, $request)
static requireComponents()
upgrade($args, $request)
Form for system installation.
static getVar($section, $key, $default=null)
Definition: Config.inc.php:35
Form for system upgrades.
Handle installation requests.
Base request handler application class.
Definition: Handler.inc.php:20
static isLocaleValid($locale)