| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- Lib::loadClass('RouteBase');
- Lib::loadClass('UI');
- class Route_Config extends RouteBase {
- public function handleAuth() {
- if (!User::logged()) throw new HttpException('Unauthorized', 401);
- }
- public function defaultAction() {
- UI::gora();
- UI::startContainer();
- echo UI::h('h1', null, "Config");
- echo '...';
- // echo UI::h('div', [], [
- // UI::h('a', ['style'=>"display:block", 'href'=>$this->getLink('reinstall')], "Config.reinstall"),
- // UI::h('a', ['style'=>"display:block", 'href'=>Router::getRoute('Biall_ProduktToDolar')->getLink('reinstall')], "Biall_ProduktToDolar.reinstall"),
- // ]);
- UI::endContainer();
- UI::dol();
- }
- public function reinstallAction() {
- UI::gora();
- echo UI::h('a', ['style'=>"margin:8px 20px", 'class'=>"btn btn-xs btn-default", 'href'=>$this->getLink()], "wróć");
- $this->reinstall();
- UI::alert('info', 'OK');
- UI::dol();
- }
- public function runAction() {
- $msgId = V::get('_msgId', 0, $_REQUEST, 'int');
- if ($msgId > 0) {
- $this->runByMessageId($msgId);
- }
- $jsonData = new stdClass();
- $jsonData->type = 'success';
- $jsonData->msg = 'Gotowe';
- echo json_encode($jsonData);
- exit;
- }
- public function reinstall() {
- $sqlList = array();
- //$sqlList['RemoveTable'] = "DROP TABLE IF EXISTS `CRM_CONFIG`";
- $sqlList['InstallTable'] = "
- CREATE TABLE IF NOT EXISTS `CRM_CONFIG` (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `CONF_KEY` varchar(64) NOT NULL,
- `CONF_VAL` text NOT NULL,
- PRIMARY KEY (`ID`),
- UNIQUE KEY `CONF_KEY` (`CONF_KEY`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- ";
- foreach ($sqlList as $sqlName => $sql) {
- DB::getPDO()->execSql($sql);
- }
- }
- }
|