Esempio n. 1
0
 public function Step8()
 {
     PDOConnect::init();
     // Define the VERSION
     Config::Version();
     Theme::Set('form_action', 'index.php?q=login');
     Theme::Set('about_url', 'index.php?p=index&q=About');
     Theme::Set('source_url', Theme::SourceLink());
     // Message (either from the URL or the session)
     Theme::Set('login_message', sprintf(__("%s was successfully installed. Please log-in with the user details you chose earlier."), Theme::GetConfig('app_name')));
     Theme::Render('login_page');
     // Install files
     Media::installAllModuleFiles();
     // Delete install
     if (!unlink('install.php')) {
         throw new Exception(__("Unable to delete install.php. Please ensure the webserver has permission to unlink this file and retry"));
     }
     exit;
 }
Esempio n. 2
0
                        if (!$displayObject->WakeOnLan($displayId)) {
                            print $display . ':Error=' . $displayObject->GetErrorMessage() . '<br/>\\n';
                        } else {
                            print $display . ':Sent WOL Message. Previous WOL send time: ' . date('Y-m-d H:i:s', $lastWakeOnLan) . '<br/>\\n';
                        }
                    } else {
                        print $display . ':Display already awake. Previous WOL send time: ' . date('Y-m-d H:i:s', $lastWakeOnLan) . '<br/>\\n';
                    }
                } else {
                    print $display . ':Sleeping<br/>\\n';
                }
                print $display . ':N/A<br/>\\n';
            }
            print __('Done.');
        } catch (Exception $e) {
            Debug::LogEntry('error', $e->getMessage());
        }
        flush();
        // Keep tidy
        Media::removeExpiredFiles();
        // Install module files
        if (Kit::GetParam('quick', _REQUEST, _INT) != 1) {
            Media::installAllModuleFiles();
        }
    } else {
        print __("Maintenance key invalid.");
    }
}
// Output HTML Footers
print "\n  </body>\n";
print "</html>";
Esempio n. 3
0
 public function Verify()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $response = new ResponseManager();
     try {
         $dbh = PDOConnect::init();
         $dbh->exec('UPDATE `media` SET valid = 0 WHERE moduleSystemFile = 1');
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     Media::installAllModuleFiles();
     $response->SetFormSubmitResponse(__('Verified'), false);
     $response->Respond();
 }
Esempio n. 4
0
 public function Step3()
 {
     Kit::ClassLoader('install');
     set_time_limit(0);
     $fault = false;
     $fault_string = '';
     foreach ($_POST as $key => $post) {
         // $key should be like 1-2, 1-3 etc
         // Split $key on - character.
         $parts = explode('-', $key);
         if (count($parts) == 2) {
             $step_num = 'Step' . $parts[0];
             include_once 'install/database/' . $parts[0] . '.php';
             $response = $_SESSION[$step_num]->ValidateQuestion($parts[1], $post);
             if (!$response == true) {
                 // The upgrade routine for this step wasn't happy.
                 $fault = true;
                 $fault_string .= $response . "<br />\n";
             }
         }
     }
     if ($fault) {
         throw new Exception($fault_string);
     }
     $doBackup = Kit::GetParam('doBackup', $_POST, _CHECKBOX);
     if ($doBackup == 0) {
         throw new Exception(__('You MUST have a valid database backup to continue. Please take and verify a backup and upgrade again.'));
     }
     $sql_file = '';
     $sql = '';
     $i = 0;
     // Now loop over the entire upgrade. Run the SQLs and PHP interleaved.
     try {
         $dbh = PDOConnect::init();
         //$dbh->beginTransaction();
         for ($i = $_SESSION['upgradeFrom'] + 1; $i <= $_SESSION['upgradeTo']; $i++) {
             if (file_exists('install/database/' . $i . '.sql')) {
                 $delimiter = ';';
                 $sql_file = @file_get_contents('install/database/' . $i . '.sql');
                 $sql_file = Install::remove_remarks($sql_file);
                 $sql_file = Install::split_sql_file($sql_file, $delimiter);
                 foreach ($sql_file as $sql) {
                     $dbh->exec($sql);
                 }
             }
             if (file_exists('install/database/' . $i . '.php')) {
                 $stepName = 'Step' . $i;
                 if (!$_SESSION[$stepName]->Boot()) {
                     throw new Exception(__('Failed with %s', $stepName));
                 }
             }
         }
         //$dbh->commit();
     } catch (Exception $e) {
         //$dbh->rollBack();
         throw new Exception(sprintf(__('An error occurred running the upgrade. Please take a screen shot of this page and seek help. Statement number: %d. Error Message = [%s]. File = [%s]. SQL = [%s].'), $i, $e->getMessage(), $sql_file, $sql));
     }
     // Install files
     Media::installAllModuleFiles();
     // Delete install
     if (!unlink('install.php')) {
         $formFields[] = FormManager::AddMessage(__("Unable to delete install.php. Please ensure the webserver has permission to unlink this file and retry"));
     }
     $formFields[] = FormManager::AddMessage(__('The upgrade was a success!'));
     // Return a rendered form
     Theme::Set('form_fields', $formFields);
     return Theme::RenderReturn('form_render');
 }