/**
  * Store a new ad code
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request)
 {
     if ($page = $this->ensure('admin')) {
         return $page;
     }
     foreach ($request->all() as $field => $value) {
         if ($field[0] == '_') {
             continue;
         }
         setting_set($field, $value);
         setting_forget(str_replace('code', 'image', $field));
     }
     return redirect()->back();
 }
Пример #2
0
    }
    $tool_content .= action_bar(array(
                         array('title' => $langBack,
                               'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=showBlog",
                               'icon' => 'fa-reply',
                               'level' => 'primary-label',
                               'show' => isset($action) and $action != "showBlog" and $action != "showPost" and $action != "savePost" and $action != "delPost")
    ));
    if ($action == "settings") {
        
        if (isset($_POST['submitSettings'])) {
            setting_set(SETTING_BLOG_STUDENT_POST, $_POST['1_radio'], $course_id);
            setting_set(SETTING_BLOG_COMMENT_ENABLE, $_POST['2_radio'], $course_id);
            setting_set(SETTING_BLOG_RATING_ENABLE, $_POST['3_radio'], $course_id);
		    if (isset($_POST['4_radio'])) {
                setting_set(SETTING_BLOG_SHARING_ENABLE, $_POST['4_radio'], $course_id);
		    }
            Session::Messages($langRegDone, 'alert-success');
            redirect_to_home_page('modules/blog/index.php?course='.$course_code);
        }
        
        if (isset($message) && $message) {
        	$tool_content .= $message . "<br/>";
        	unset($message);
        }
        
        
        
        if (setting_get(SETTING_BLOG_STUDENT_POST, $course_id) == 1) {
            $checkTeach = "";
            $checkStud = "checked ";
Пример #3
0
            if (isset($_POST['s_radio'])) {
                setting_set(SETTING_COURSE_SHARING_ENABLE, $_POST['s_radio'], $course_id);
            }

            if (isset($_POST['r_radio'])) {
                setting_set(SETTING_COURSE_RATING_ENABLE, $_POST['r_radio'], $course_id);
            }
            if (isset($_POST['ran_radio'])) {
                setting_set(SETTING_COURSE_ANONYMOUS_RATING_ENABLE, $_POST['ran_radio'], $course_id);
            }
            if (isset($_POST['c_radio'])) {
                setting_set(SETTING_COURSE_COMMENT_ENABLE, $_POST['c_radio'], $course_id);
            }
            if (isset($_POST['ar_radio'])) {
                setting_set(SETTING_COURSE_ABUSE_REPORT_ENABLE, $_POST['ar_radio'], $course_id);
            }
            
            if ($noWeeklyMessage) {
                Session::Messages($langCourseWeeklyFormatNotice);
            } else {
                Session::Messages($langModifDone,'alert-success');
            }
            
            redirect_to_home_page("modules/course_info/index.php?course=$course_code");
        }
    }
} else {
    warnCourseInvalidDepartment();

    $action_bar_array0 = array(
Пример #4
0
     submit_link();
     $message = isset($_POST['id']) ? $langLinkMod : $langLinkAdded;
     Session::Messages($message, 'alert-success');
     redirect_to_home_page("modules/link/index.php");
 }
 if (isset($_POST['submitCategory'])) {
     if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error();
     submit_category();
     $messsage = isset($_POST['id']) ? $langCategoryModded : $langCategoryAdded;
     Session::Messages($messsage, 'alert-success');
     redirect_to_home_page("modules/link/index.php");
 }
 if (isset($_POST['submitSettings'])) {
     if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error();
     if (isset($_POST['settings_radio'])) {
         setting_set(SETTING_COURSE_SOCIAL_BOOKMARKS_ENABLE, intval($_POST['settings_radio']));
         Session::Messages($langLinkSettingsSucc, 'alert-success');
     }
     redirect_to_home_page("modules/link/index.php?course=$course_code");
 }
 switch ($action) {
     case 'deletelink':
         delete_link($id);
         Session::Messages($langLinkDeleted, 'alert-success');
         redirect_to_home_page("modules/link/index.php");
         break;
     case 'deletecategory':
         delete_category($id);
         Session::Messages($langCategoryDeleted, 'alert-success');
         redirect_to_home_page("modules/link/index.php");
         break;
Пример #5
0
            $last_post_id = $result->last_post_id;
            Database::get()->query("UPDATE `forum` SET `num_topics` = `num_topics`+1, `num_posts` = `num_posts`+?d, `last_post_id` = ?d\n                    WHERE id = ?d", $num_replies + 1, $last_post_id, $new_forum);
            $result = Database::get()->querySingle("SELECT `last_post_id`, MAX(`topic_time`) FROM `forum_topic` WHERE `forum_id`=?d", $current_forum_id);
            if ($result) {
                $last_post_id = $result->last_post_id;
            } else {
                $last_post_id = 0;
            }
            Database::get()->query("UPDATE `forum` SET `num_topics` = `num_topics`-1, `num_posts` = `num_posts`-?d, `last_post_id` = ?d\n                    WHERE id = ?d", $num_replies + 1, $last_post_id, $current_forum_id);
        }
        //if user selected the current forum do nothing
        $tool_content .= "<div class='alert alert-success'>{$langTopicDataChanged}</div>\n                         <p>&laquo; <a href='viewforum.php?course={$course_code}&amp;forum={$new_forum}'>{$langBack}</a></p>";
    }
} elseif (isset($_GET['settings'])) {
    if (isset($_POST['submitSettings'])) {
        setting_set(SETTING_FORUM_RATING_ENABLE, $_POST['r_radio'], $course_id);
        $message = "<div class='alert alert-success'>{$langRegDone}</div>";
    }
    if (isset($message) && $message) {
        $tool_content .= $message . "<br/>";
        unset($message);
    }
    if (setting_get(SETTING_FORUM_RATING_ENABLE, $course_id) == 1) {
        $checkDis = "";
        $checkEn = "checked ";
    } else {
        $checkDis = "checked ";
        $checkEn = "";
    }
    $tool_content .= "<div class='form-wrapper'>\n        <form class='form-horizontal' role='form' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;settings=yes' method='post'>\n        <fieldset>\n        <div class='form-group'>\n            <div class='col-sm-10'>\n                <div class='radio'>\n                    <label><input type='radio' value='1' name='r_radio' {$checkEn}/>{$langRatingEn}</label>\n                </div>\n                <div class='radio'>\n                    <label><input type='radio' value='0' name='r_radio' {$checkDis}/>{$langRatingDis}</label>\n                </div>\n            </div>\n        </div>\n        <div class='form-group'>\n            <div class='col-sm-11 col-sm-offset-1'>\n                <input class='btn btn-primary' type='submit' name='submitSettings' value='{$langSubmit}'>\n            </div>\n        </div>\n        </fieldset>\n        </form>\n        </div>";
} else {
Пример #6
0
            if ($noWeeklyMessage) {
                $tool_content .= "<div class='alert alert-warning'>{$langCourseWeeklyFormatNotice}</div>";
            }
            $tool_content .= "<p>&laquo; <a href='" . $_SERVER['SCRIPT_NAME'] . "?course={$course_code}'>{$langBack}</a></p>\n                            <p>&laquo; <a href='{$urlServer}courses/{$course_code}/index.php'>{$langBackCourse}</a></p>";
        }
        if (isset($_POST['s_radio'])) {
            setting_set(SETTING_COURSE_SHARING_ENABLE, $_POST['s_radio'], $course_id);
        }
        if (isset($_POST['r_radio'])) {
            setting_set(SETTING_COURSE_RATING_ENABLE, $_POST['r_radio'], $course_id);
        }
        if (isset($_POST['ran_radio'])) {
            setting_set(SETTING_COURSE_ANONYMOUS_RATING_ENABLE, $_POST['ran_radio'], $course_id);
        }
        if (isset($_POST['c_radio'])) {
            setting_set(SETTING_COURSE_COMMENT_ENABLE, $_POST['c_radio'], $course_id);
        }
    }
} else {
    $tool_content .= "\n\t<div id='operations_container'>" . action_bar(array(array('title' => $langBackupCourse, 'url' => "archive_course.php?course={$course_code}", 'icon' => 'fa-archive', 'level' => 'primary-label'), array('title' => $langCloneCourse, 'url' => "clone_course.php?course={$course_code}", 'icon' => 'fa-archive'), array('title' => $langRefreshCourse, 'url' => "refresh_course.php?course={$course_code}", 'icon' => 'fa-refresh'), array('title' => $langCourseMetadata, 'url' => "../course_metadata/index.php?course={$course_code}", 'icon' => 'fa-file-text', 'show' => get_config('course_metadata')), array('title' => $langDelCourse, 'url' => "delete_course.php?course={$course_code}", 'icon' => 'fa-times', 'button-class' => 'btn-danger'), array('title' => $langCourseMetadataControlPanel, 'url' => "../course_metadata/control.php?course={$course_code}", 'icon' => 'fa-list', 'show' => get_config('opencourses_enable') && $is_opencourses_reviewer))) . "</div>";
    $c = Database::get()->querySingle("SELECT title, keywords, visible, public_code, prof_names, lang,\n                \t       course_license, password, id, view_type, start_date, finish_date\n                      FROM course WHERE code = ?s", $course_code);
    $title = $c->title;
    $visible = $c->visible;
    $visibleChecked = array(COURSE_CLOSED => '', COURSE_REGISTRATION => '', COURSE_OPEN => '', COURSE_INACTIVE => '');
    $visibleChecked[$visible] = " checked='checked'";
    $public_code = q($c->public_code);
    $titulary = q($c->prof_names);
    $languageCourse = $c->lang;
    $course_keywords = q($c->keywords);
    $password = q($c->password);
    $course_license = $c->course_license;