예제 #1
0
파일: main.module.php 프로젝트: rigidus/ea
 function save()
 {
     settings::set('feedback', 'feedback_email', params::get('feedback_email'));
     settings::set('feedback', 'feedback_subject', params::get('feedback_subject'));
     settings::save('feedback');
     headers::self();
 }
 public function __construct()
 {
     /*if (!template_session::is_admin() and !template_session::is_editor())
     		{
     			if (get('ajax'))
     			{
     				exit(RUDE_AJAX_ACCESS_VIOLATION);
     			}
     
     			return false;
     		}*/
     switch (get('task')) {
         case 'save':
             $status = settings::save(get('popup_id'), get('popup'), get('rector_id'), get('rector'));
             template_session::set_use_popup(get('popup'));
             break;
         default:
             $status = false;
             break;
     }
     if (get('ajax')) {
         if ($status) {
             exit(RUDE_AJAX_OK);
         } else {
             exit(RUDE_AJAX_ERROR);
         }
     }
     return true;
 }
예제 #3
0
 function save()
 {
     settings::set('pages', 'global_page_keywords', params::get('global_page_keywords'));
     settings::set('pages', 'global_page_description', params::get('global_page_description'));
     settings::set('pages', 'global_page_keywords_check', params::isCheck('global_page_keywords_check'));
     settings::set('pages', 'global_page_description_check', params::isCheck('global_page_description_check'));
     settings::set('pages', 'redactor', params::isCheck('redactor'));
     settings::set('pages', 'jip', params::isCheck('jip'));
     settings::set('pages', 'global_page_title', params::get('global_page_title'));
     settings::save('pages');
     headers::self();
 }
예제 #4
0
 * as-is and without warranty under the MIT License. 
 * See [root]/license.md for more information. This information must remain intact.
 */
error_reporting(0);
require_once '../../common.php';
require_once 'class.settings.php';
checkSession();
switch ($_GET['action']) {
    case 'open':
        $settings = new settings();
        echo $settings->open();
        break;
    case 'save':
        $settings = new settings();
        if (isset($_POST['content'])) {
            echo $settings->save($_POST['content']);
        } else {
            echo '{"status":"error","message":"Missing Parameters!"}';
        }
        break;
    case 'load':
        $settings = new settings();
        echo $settings->load();
        break;
    case 'saveCommands':
        if (isset($_POST['commands'])) {
            $result = file_put_contents("default.commands.json", $_POST['commands']);
            if ($result === false) {
                echo '{"status":"error","message":"Failed to save default commands!"}';
            } else {
                echo '{"status":"success","message":"Commands saved."}';
예제 #5
0
 public function proceed()
 {
     if (Input::get('nextStep') == "1") {
         $this->data['currStep'] = "1";
         $this->data['nextStep'] = "2";
         try {
             DB::connection()->getDatabaseName();
         } catch (Exception $e) {
             $this->data['dbError'] = $e->getMessage();
             $this->data['nextStep'] = "1";
         }
         $testData = uniqid();
         @file_put_contents("uploads/assignments/test", $testData);
         @file_put_contents("uploads/books/test", $testData);
         @file_put_contents("uploads/cache/test", $testData);
         @file_put_contents("uploads/media/test", $testData);
         @file_put_contents("uploads/profile/test", $testData);
         @file_put_contents("uploads/studyMaterial/test", $testData);
         @file_put_contents("uploads/assignmentsAnswers/test", $testData);
         @file_put_contents("app/storage/cache/test", $testData);
         @file_put_contents("app/storage/logs/test", $testData);
         @file_put_contents("app/storage/meta/test", $testData);
         @file_put_contents("app/storage/sessions/test", $testData);
         @file_put_contents("app/storage/views/test", $testData);
         if (@file_get_contents("uploads/assignments/test") != $testData) {
             $this->data['perrors'][] = "uploads/assignments";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/assignments";
         }
         if (@file_get_contents("uploads/books/test") != $testData) {
             $this->data['perrors'][] = "uploads/books";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/books";
         }
         if (@file_get_contents("uploads/cache/test") != $testData) {
             $this->data['perrors'][] = "uploads/cache";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/cache";
         }
         if (@file_get_contents("uploads/media/test") != $testData) {
             $this->data['perrors'][] = "uploads/media";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/media";
         }
         if (@file_get_contents("uploads/profile/test") != $testData) {
             $this->data['perrors'][] = "uploads/profile";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/profile";
         }
         if (@file_get_contents("uploads/studyMaterial/test") != $testData) {
             $this->data['perrors'][] = "uploads/studyMaterial";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/studyMaterial";
         }
         if (@file_get_contents("uploads/assignmentsAnswers/test") != $testData) {
             $this->data['perrors'][] = "uploads/assignmentsAnswers";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "uploads/assignmentsAnswers";
         }
         if (@file_get_contents("app/storage/cache/test") != $testData) {
             $this->data['perrors'][] = "app/storage/cache";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "app/storage/cache";
         }
         if (@file_get_contents("app/storage/logs/test") != $testData) {
             $this->data['perrors'][] = "app/storage/logs";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "app/storage/logs";
         }
         if (@file_get_contents("app/storage/meta/test") != $testData) {
             $this->data['perrors'][] = "app/storage/meta";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "app/storage/meta";
         }
         if (@file_get_contents("app/storage/sessions/test") != $testData) {
             $this->data['perrors'][] = "app/storage/sessions";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "app/storage/sessions";
         }
         if (@file_get_contents("app/storage/views/test") != $testData) {
             $this->data['perrors'][] = "app/storage/views";
             $this->data['nextStep'] = "1";
         } else {
             $this->data['success'][] = "app/storage/views";
         }
     }
     if (Input::get('nextStep') == "2") {
         $this->data['currStep'] = "2";
         $this->data['nextStep'] = "3";
     }
     if (Input::get('nextStep') == "3") {
         $this->data['currStep'] = "3";
         $this->data['nextStep'] = "4";
         if (Input::get('fullName') == "" || Input::get('username') == "" || Input::get('email') == "" || Input::get('password') == "" || Input::get('siteTitle') == "" || Input::get('systemEmail') == "") {
             $this->data['installErrors'][] = "Please fill in all required fields";
             $this->data['currStep'] = "2";
             $this->data['nextStep'] = "3";
         }
         if (Input::get('password') != Input::get('repassword')) {
             $this->data['installErrors'][] = "Password & repassword isn't identical";
             $this->data['currStep'] = "2";
             $this->data['nextStep'] = "3";
         }
         if (!filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL) and Input::get('email') != "") {
             $this->data['installErrors'][] = "invalid e-mail address";
             $this->data['currStep'] = "2";
             $this->data['nextStep'] = "3";
         }
         if (Input::get('cpc') == "") {
             $this->data['installErrors'][] = "Purchase code is missing";
             $this->data['currStep'] = "2";
             $this->data['nextStep'] = "3";
         }
         if (Input::get('yearTitle') == "") {
             $this->data['installErrors'][] = "You must type default academic year";
             $this->data['currStep'] = "2";
             $this->data['nextStep'] = "3";
         }
         if (!isset($this->data['installErrors'])) {
             file_put_contents('app/storage/meta/lc', Input::get('cpc'));
             if ($this->sbApi() == "err") {
                 @unlink('app/storage/meta/lc');
                 $this->data['installErrors'][] = "Purchase code is missing";
                 $this->data['currStep'] = "2";
                 $this->data['nextStep'] = "3";
             }
         }
         if (!isset($this->data['installErrors'])) {
             $check = Schema::hasTable('users');
             if (!$check) {
                 DB::unprepared(file_get_contents('app/storage/dbsql'));
             }
             $User = new User();
             $User->username = Input::get('username');
             $User->email = Input::get('email');
             $User->fullName = Input::get('fullName');
             $User->password = Hash::make(Input::get('password'));
             $User->role = "admin";
             $User->save();
             $settings = settings::where('fieldName', 'siteTitle')->first();
             $settings->fieldValue = Input::get('siteTitle');
             $settings->save();
             $settings = settings::where('fieldName', 'systemEmail')->first();
             $settings->fieldValue = Input::get('systemEmail');
             $settings->save();
             $settings = new settings();
             $settings->fieldName = 'finishInstall';
             $settings->fieldValue = '1';
             $settings->save();
             $academicYear = new academicYear();
             $academicYear->yearTitle = Input::get('yearTitle');
             $academicYear->isDefault = "1";
             $academicYear->save();
         }
     }
     return View::make('install', $this->data);
 }