Example #1
0
function check_post($qreq = null)
{
    $pv = post_value();
    if ($qreq) {
        return isset($qreq->post) && $qreq->post == $pv;
    } else {
        return isset($_GET["post"]) && $_GET["post"] == $pv || isset($_POST["post"]) && $_POST["post"] == $pv;
    }
}
 function uultra_handle_errors()
 {
     global $xoouserultra;
     //require_once(ABSPATH . 'wp-includes/pluggable.php');
     if (get_option('users_can_register') == '1') {
         foreach ($this->usermeta as $key => $value) {
             /* Validate username */
             if ($key == 'user_login') {
                 if (esc_attr($value) == '') {
                     $this->errors[] = __('<strong>ERROR:</strong> Please enter a username.', 'xoousers');
                 } elseif (username_exists($value)) {
                     $this->errors[] = __('<strong>ERROR:</strong> This username is already registered. Please choose another one.', 'xoousers');
                 }
             }
             /* Validate email */
             if ($key == 'user_email') {
                 if (esc_attr($value) == '') {
                     $this->errors[] = __('<strong>ERROR:</strong> Please type your e-mail address.', 'xoousers');
                 } elseif (!is_email($value)) {
                     $this->errors[] = __('<strong>ERROR:</strong> The email address isn\'t correct.', 'xoousers');
                 } elseif ($value != $_POST['user_email_2']) {
                     $this->errors[] = __('<strong>ERROR:</strong> The emails are different.', 'xoousers');
                 } elseif (email_exists($value)) {
                     $this->errors[] = __('<strong>ERROR:</strong> This email is already registered, please choose another one.', 'xoousers');
                 }
             }
         }
         //check if auto-password
         $auto_password = $xoouserultra->get_option("set_password");
         if ($auto_password == '' || $auto_password == 1) {
             /* Validate passowrd */
             if ($_POST["user_pass"] == "") {
                 $this->errors[] = __('<strong>ERROR:</strong> Please type your password.', 'xoousers');
             }
             if ($_POST["user_pass"] != $_POST["user_pass_confirm"]) {
                 $this->errors[] = __('<strong>ERROR:</strong> The passwords must be identical', 'xoousers');
             }
             //password strenght
             $this->uultra_check_pass_strenght($_POST["user_pass"]);
         }
         if (!is_in_post('no_captcha', 'yes')) {
             if (!$xoouserultra->captchamodule->validate_captcha(post_value('captcha_plugin'))) {
                 $this->errors[] = __('<strong>ERROR:</strong> Please complete Captcha Test first.', 'xoousers');
             }
         }
     } else {
         $this->errors[] = __('<strong>ERROR:</strong> Registration is disabled for this site.', 'xoousers');
     }
 }
 public function upme_reset_module_settings()
 {
     global $upme_admin;
     if (is_post() && is_in_post('current_tab')) {
         if (isset($upme_admin->default_module_settings[post_value('current_tab')])) {
             $current_options = get_option('upme_options');
             foreach ($upme_admin->default_module_settings[post_value('current_tab')] as $key => $value) {
                 $current_options[$key] = $value;
             }
             update_option('upme_options', $current_options);
             echo json_encode(array('status' => 'success'));
             exit;
         }
     }
 }
 function handle()
 {
     global $upme_captcha_loader;
     require_once ABSPATH . 'wp-includes/pluggable.php';
     if (get_option('users_can_register') == '1') {
         foreach ($this->usermeta as $key => $value) {
             /* Validate username */
             if ($key == 'user_login') {
                 /* UPME Action for validating username before creating new user */
                 do_action('upme_validate_username', $value);
                 // End Action
                 if (esc_attr($value) == '') {
                     $this->errors[] = __('Please enter a username.', 'upme');
                 } elseif (username_exists($value)) {
                     $this->errors[] = __('This username is already registered. Please choose another one.', 'upme');
                 }
             }
             /* Validate email */
             if ($key == 'user_email') {
                 if (esc_attr($value) == '') {
                     $this->errors[] = __('Please type your e-mail address.', 'upme');
                 } elseif (!is_email($value)) {
                     $this->errors[] = __('The email address isn\'t correct.', 'upme');
                 } elseif (email_exists($value)) {
                     $this->errors[] = __('This email is already registered, please choose another one.', 'upme');
                 }
             }
             /* UPME filter for adding restrictions before custom field type saving */
             $registration_custom_field_type_restrictions_params = array('meta' => $key, 'value' => $value);
             $this->errors = apply_filters('upme_registration_custom_field_type_restrictions', $this->errors, $registration_custom_field_type_restrictions_params);
             /* END filter */
         }
         if (!is_in_post('no_captcha', 'yes')) {
             if (!$upme_captcha_loader->validate_captcha(post_value('captcha_plugin'))) {
                 $this->errors[] = __('Please complete Captcha Test first.', 'upme');
             }
         }
     } else {
         $this->errors[] = __('Registration is disabled for this site.', 'upme');
     }
 }
 function handle()
 {
     global $upme_captcha_loader;
     // Verify whether login form name is modified
     if (isset($_POST['upme-hidden-login-form-name'])) {
         $upme_secret_key = get_option('upme_secret_key');
         $login_form_name = $_POST['upme-hidden-login-form-name'];
         $login_form_name_hash = $_POST['upme-hidden-login-form-name-hash'];
         if ($login_form_name_hash != hash('sha256', $login_form_name . $upme_secret_key)) {
             // Invailid form name was defined by manually editing
             $this->errors[] = __('Invalid login form.', 'upme');
             return;
         }
         $this->login_form_name = $login_form_name;
     }
     require_once ABSPATH . 'wp-includes/pluggable.php';
     foreach ($this->usermeta as $key => $value) {
         if ($key == 'user_login') {
             if (sanitize_user($value) == '') {
                 $this->errors[] = __('The username field is empty.', 'upme');
             }
         }
         if ($key == 'user_pass') {
             if (esc_attr($value) == '') {
                 $this->errors[] = __('The password field is empty.', 'upme');
             }
         }
     }
     /* UPME action for adding restrictions before login */
     $before_login_validation_params = array();
     do_action('upme_before_login_restrictions', $this->usermeta, $before_login_validation_params);
     /* END action */
     // Check approval status and activation status before login
     if (isset($_POST['user_login']) && '' != $_POST['user_login']) {
         // Check whether email or username is used for login
         $user_email_check = email_exists($_POST['user_login']);
         if ($user_email_check) {
             $user_data = new stdClass();
             $user_data->ID = $user_email_check;
         } else {
             $user_data = get_user_by('login', $_POST['user_login']);
             if (!$user_data) {
                 $user_data = new stdClass();
                 $user_data->ID = '';
             }
         }
         if ('INACTIVE' == get_user_meta($user_data->ID, 'upme_approval_status', true)) {
             $this->errors[] = $this->upme_settings['html_profile_approval_pending_msg'];
         } else {
             if ('INACTIVE' == get_user_meta($user_data->ID, 'upme_activation_status', true)) {
                 $this->errors[] = __('Please confirm your email to activate your account.', 'upme');
             }
         }
     }
     // Check captcha first
     if (!is_in_post('no_captcha', 'yes')) {
         if (!$upme_captcha_loader->validate_captcha(post_value('captcha_plugin'))) {
             $this->errors[] = __('Please complete Captcha Test first.', 'upme');
         }
     }
     /* attempt to signon */
     if (!is_array($this->errors)) {
         $creds = array();
         // Adding support for login by email
         if (is_email($_POST['user_login'])) {
             $user = get_user_by('email', $_POST['user_login']);
             if ($user) {
                 if (isset($user->data->user_login)) {
                     $creds['user_login'] = $user->data->user_login;
                 } else {
                     $creds['user_login'] = '';
                 }
             } else {
                 $creds['user_login'] = sanitize_user($_POST['user_login'], TRUE);
             }
         } else {
             $creds['user_login'] = sanitize_user($_POST['user_login'], TRUE);
         }
         $creds['user_password'] = $_POST['login_user_pass'];
         $creds['remember'] = $_POST['rememberme'];
         $secure_cookie = false;
         if (is_ssl()) {
             $secure_cookie = true;
         }
         /* UPME Action validating before login */
         do_action('upme_validate_login', $creds);
         // End Action
         if (!$this->errors) {
             $user = wp_signon($creds, $secure_cookie);
             if (is_wp_error($user)) {
                 if ($user->get_error_code() == 'invalid_username') {
                     $this->errors[] = __('Invalid Username or Email', 'upme');
                 }
                 if ($user->get_error_code() == 'incorrect_password') {
                     $this->errors[] = __('Incorrect Username or Password', 'upme');
                 }
                 if ($user->get_error_code() == 'empty_password') {
                     $this->errors[] = __('Please enter a password.', 'upme');
                 }
                 /* UPME action for adding actions after unsuccessfull login */
                 $login_failed_params = array();
                 do_action('upme_login_failed', $this->usermeta, $user, $login_failed_params);
                 /* END action */
             } else {
                 do_action('wp_login');
                 /* UPME action for adding actions after successfull login */
                 $login_sucess_params = array();
                 do_action('upme_login_sucess', $this->usermeta, $user, $login_sucess_params);
                 /* END action */
             }
         }
     }
 }
 private function validate_recaptcha()
 {
     global $upme;
     $this->load_recaptcha_class();
     // Getting the Private Key to validate reCaptcha
     $private_key = '';
     $private_key = $upme->get_option('recaptcha_private_key');
     if ($private_key != '') {
         if (is_in_post('recaptcha_response_field')) {
             $resp = recaptcha_check_answer($private_key, $_SERVER["REMOTE_ADDR"], post_value("recaptcha_challenge_field"), post_value("recaptcha_response_field"));
             // Captcha is Valid
             if ($resp->is_valid) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return true;
         }
     } else {
         // Private key is not set in admin
         return true;
     }
 }
Example #7
0
                    }
                    if ($linenotes && $aln && isset($linenotes->{$aln})) {
                        echo_linenote_entry_row($file, $aln, $linenotes->{$aln}, true, $lnorder);
                    }
                }
                echo "</tbody></table>\n";
            }
            $Conf->footerScript('jQuery(".diffnoteentry61").autogrow();jQuery(window).on("beforeunload",beforeunload61)');
            echo "<table id=\"diff61linenotetemplate\" style=\"display:none\"><tbody>";
            echo_linenote_entry_row("", "", array($Info->is_grading_commit(), ""), false, null);
            echo "</tbody></table>";
        } else {
            if ($Pset->gitless_grades) {
                echo_grade_cdf_here();
            }
            echo "<div class=\"commitcontainer61\" peteramati_pset=\"", htmlspecialchars($Info->pset->urlkey), "\">";
            ContactView::echo_group("this commit", "No commits yet for this problem set", array());
            echo "</div>\n";
            if ($Pset->gitless_grades) {
                echo_grader();
                echo_all_grades();
            }
        }
    }
}
$Conf->footerScript('window.psetpost61="' . self_href(array("post" => post_value())) . '"');
if (!$Pset->gitless) {
    $Conf->footerScript("checklatest61()", "checklatest61");
}
echo "<div class='clear'></div>\n";
$Conf->footer();
Example #8
0
 private function header_head($title)
 {
     global $Me, $ConfSitePATH, $CurrentList;
     echo "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n<meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n<meta http-equiv=\"Content-Language\" content=\"en\" />\n<meta name=\"google\" content=\"notranslate\" />\n";
     if (strstr($title, "<") !== false) {
         $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title);
     }
     echo $this->opt("fontScript", "");
     echo $this->make_css_link("stylesheets/style.css"), "\n";
     if ($this->opt("mobileStylesheet")) {
         echo '<meta name="viewport" content="width=device-width, initial-scale=1">', "\n";
         echo $this->make_css_link("stylesheets/mobile.css", "screen and (max-width: 768px)"), "\n";
     }
     foreach (mkarray($this->opt("stylesheets", [])) as $css) {
         echo $this->make_css_link($css), "\n";
     }
     // favicon
     $favicon = $this->opt("favicon");
     if ($favicon) {
         if (strpos($favicon, "://") === false && $favicon[0] != "/") {
             if ($this->opt["assetsUrl"] && substr($favicon, 0, 7) === "images/") {
                 $favicon = $this->opt["assetsUrl"] . $favicon;
             } else {
                 $favicon = Navigation::siteurl() . $favicon;
             }
         }
         if (substr($favicon, -4) == ".png") {
             echo "<link rel=\"icon\" type=\"image/png\" href=\"{$favicon}\" />\n";
         } else {
             if (substr($favicon, -4) == ".ico") {
                 echo "<link rel=\"shortcut icon\" href=\"{$favicon}\" />\n";
             } else {
                 if (substr($favicon, -4) == ".gif") {
                     echo "<link rel=\"icon\" type=\"image/gif\" href=\"{$favicon}\" />\n";
                 } else {
                     echo "<link rel=\"icon\" href=\"{$favicon}\" />\n";
                 }
             }
         }
     }
     // jQuery
     if (isset($this->opt["jqueryUrl"])) {
         $jquery = $this->opt["jqueryUrl"];
     } else {
         if ($this->opt("jqueryCdn")) {
             $jquery = "//code.jquery.com/jquery-1.12.3.min.js";
         } else {
             $jquery = "scripts/jquery-1.12.3.min.js";
         }
     }
     Ht::stash_html($this->make_script_file($jquery, true) . "\n");
     Ht::stash_html($this->make_script_file("scripts/jquery.color-2.1.2.min.js", true) . "\n");
     Ht::stash_html($this->make_script_file("scripts/jquery.flot.min.js", true) . "\n");
     //Ht::stash_html($this->make_script_file("scripts/ZeroClipboard.min.js", true) . "\n");
     // Javascript settings to set before script.js
     Ht::stash_script("siteurl=" . json_encode(Navigation::siteurl()) . ";siteurl_suffix=\"" . Navigation::php_suffix() . "\"");
     if (session_id() !== "") {
         Ht::stash_script("siteurl_postvalue=\"" . post_value() . "\"");
     }
     if (@$CurrentList && ($list = SessionList::lookup($CurrentList))) {
         Ht::stash_script("hotcrp_list={num:{$CurrentList},id:\"" . addcslashes($list->listid, "\n\r\\\"/") . "\"}");
     }
     if ($urldefaults = hoturl_defaults()) {
         Ht::stash_script("siteurl_defaults=" . json_encode($urldefaults) . ";");
     }
     Ht::stash_script("assetsurl=" . json_encode($this->opt["assetsUrl"]) . ";");
     $huser = (object) array();
     if ($Me && $Me->email) {
         $huser->email = $Me->email;
     }
     if ($Me && $Me->is_pclike()) {
         $huser->is_pclike = true;
     }
     Ht::stash_script("hotcrp_user="******"ZeroClipboard.setDefaults({moviePath:\"" . Navigation::siteurl() . "cacheable" . Navigation::php_suffix() . "?file=scripts/ZeroClipboard.swf&amp;mtime=" . filemtime("$ConfSitePATH/scripts/ZeroClipboard.swf") . "\"})");
     // script.js
     if (!$this->opt("noDefaultScript")) {
         Ht::stash_html($this->make_script_file("scripts/script.js") . "\n");
     }
     echo Ht::unstash();
     echo "<title>";
     if ($title) {
         echo $title, " - ";
     }
     echo htmlspecialchars($this->short_name), "</title>\n</head>\n";
 }
?>
 >Done</option>
                    <option value="to do"<?php 
if ($this->data['task']['status'] == 'to do') {
    echo 'selected="selected"';
}
?>
 >To Do</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">Date</label>
            <div class="col-sm-10">
                <input type="text" class="datepicker" name="date" value="<?php 
echo post_value('date', $this->data['task']['date']);
?>
">
            </div>
        </div>
        <hr/>
        <div class="form-group">
            <div class="col-sm-10 col-sm-offset-2">
                <a href="<?php 
echo $this->config['site_url'] . '/tasks';
?>
"  class="btn btn-danger pull-left">View tasks</a>
                <input id="submit" name="Save" type="submit" value="Save" class="btn btn-success pull-right"/>
            </div>
        </div>
Example #10
0
 static function echo_repo_group($info, $include_tarball = false)
 {
     global $Conf, $Me, $Now;
     if ($info->pset->gitless) {
         return;
     }
     list($user, $pset, $partner, $repo) = array($info->user, $info->pset, $info->partner, $info->repo);
     $editable = $info->can_set_repo && !$user->is_anonymous;
     $repo_url = $repo ? $repo->friendly_url() : "";
     $title = "repository";
     if (!RepositorySite::is_primary($repo)) {
         $title = $repo->reposite->friendly_siteclass() . " " . $title;
     }
     if ($repo && $repo->url) {
         $title = $user->link_repo($title, $repo->web_url());
     }
     if ($editable) {
         $value = Ht::entry("repo", $repo_url, array("style" => "width:32em")) . " " . Ht::submit("Save");
     } else {
         if ($user->is_anonymous) {
             $value = $repo_url ? "[anonymous]" : "(none)";
         } else {
             $value = htmlspecialchars($repo_url ? $repo_url : "(none)");
         }
     }
     if ($repo_url) {
         $value .= ' <button class="b repoclip hottooltip" data-pa-repo="' . htmlspecialchars($repo->ssh_url()) . '"';
         if ($user->is_anonymous) {
             $value .= ' data-tooltip="[anonymous]"';
         } else {
             $value .= ' data-tooltip="' . htmlspecialchars($repo->ssh_url()) . '"';
         }
         $value .= ' type="button" onclick="false">Copy URL to clipboard</button>';
         Ht::stash_script('$(".repoclip").each(pa_init_repoclip)', "repoclip");
         if ($include_tarball && $info->commit_hash() && ($tarball_url = $info->tarball_url())) {
             $value .= ' <a class="bsm q" href="' . htmlspecialchars($tarball_url) . '">Download tarball for ' . substr($info->commit_hash(), 0, 7) . '</a>';
         }
     }
     // check repo
     $ms = new MessageSet($user);
     if ($repo) {
         $repo->check_working($ms);
         $repo->check_open($ms);
     }
     if ($partner && $info->partner_same()) {
         $prepo = $partner->repo($pset->id);
         if (!$repo && $prepo || $repo && !$prepo || $repo && $prepo && $repo->repoid != $prepo->repoid) {
             if ($prepo && $repo) {
                 $prepo_url = ", " . htmlspecialchars($prepo->friendly_url_like($repo));
             } else {
                 if ($prepo) {
                     $prepo_url = ", " . htmlspecialchars($prepo->friendly_url());
                 } else {
                     $prepo_url = "";
                 }
             }
             $your_partner = "your partner’s";
             if ($Me->isPC) {
                 $your_partner = '<a href="' . hoturl("pset", array("pset" => $pset->urlkey, "u" => $Me->user_linkpart($partner))) . '">' . $your_partner . '</a>';
             }
             $ms->set_error_html("partner", "This repository differs from {$your_partner}{$prepo_url}.");
         }
     }
     if ($repo) {
         $repo->check_ownership($user, $partner, $ms);
     }
     $prefixes = ["", "WARNING: ", "ERROR: "];
     $notes = array_map(function ($m) use($prefixes) {
         return [$m[2] > 0, $prefixes[$m[2]] . $m[1]];
     }, $ms->messages(true));
     if ($repo && $repo->truncated_psetdir($pset)) {
         $notes[] = array(true, "Please create your repository by cloning our repository. Creating your repository from scratch makes it harder for us to grade and harder for you to get pset updates.");
     }
     if (!$repo) {
         $repoclasses = RepositorySite::site_classes($Conf);
         $x = commajoin(array_map(function ($k) {
             return Ht::link($k::global_friendly_siteclass(), $k::global_friendly_siteurl());
         }, $repoclasses), "or");
         if ($editable) {
             $notes[] = array(false, "Enter your {$x} repository URL here.");
         }
     }
     // edit
     if ($editable) {
         echo Ht::form(self_href(array("post" => post_value(), "set_repo" => 1, "pset" => $pset->urlkey))), '<div class="f-contain">';
     }
     self::echo_group($title, $value, $notes);
     if ($editable) {
         echo "</div></form>\n";
     }
     return $repo;
 }
								<input type="text" class="form-control" name="start_time" id="start_time" value="<?php 
post_value('start_time');
?>
">
  							</div>
  							<div class="col-md-3 form-group">
  								<label for="end_date">End Date <span class="req">*</span></label>
								<input type="text" class="form-control datepicker" name="end_date" id="end_date" value="<?php 
post_value('end_date');
?>
">
  							</div>
  							<div class="col-md-3 form-group">
  								<label for="end_time">End Time  <span class="req">*</span></label>
								<input type="text" class="form-control" name="end_time" id="end_time" value="<?php 
post_value('end_time');
?>
">
  							</div>
  						</div>
  						<div class="row">
  							<div class="col-md-3">
  								<input type="submit" class="btn btn-success" value="Submit">
  							</div>
  						</div>
  					</div>
  				</div>
  			</div>
  		</div>
  	</div>
  </div>
Example #12
0
 function check_search_input()
 {
     if (is_post()) {
         if (is_in_post('upme_combined_search') && post_value('upme_combined_search') != '') {
             return true;
         }
         if (is_in_post('upme_search')) {
             foreach ($_POST['upme_search'] as $key => $value) {
                 if (is_array($value) && count($value) > 0) {
                     return true;
                 } else {
                     if ($value != '' && $value != '0') {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
Example #13
0
 static function echo_repo_group($info, $include_tarball = false)
 {
     global $Conf, $Me, $Now;
     if ($info->pset->gitless) {
         return;
     }
     list($user, $pset, $partner, $repo) = array($info->user, $info->pset, $info->partner, $info->repo);
     $editable = $info->can_set_repo && !$user->is_anonymous;
     $repo_url = $user->seascode_repo_base($repo ? $repo->url : "");
     $title = "repository";
     if ($repo_url && strpos($repo_url, ":") === false) {
         $title = $user->repo_link($repo_url, $title);
     }
     if ($editable) {
         $value = Ht::entry("repo", $repo_url, array("style" => "width:32em")) . " " . Ht::submit("Save");
     } else {
         if ($user->is_anonymous) {
             $value = $repo_url ? "[anonymous]" : "(none)";
         } else {
             $value = htmlspecialchars($repo_url ? $repo_url : "(none)");
         }
     }
     if ($repo_url) {
         $value .= ' <button class="b repoclip hottooltip" data-pa-repo="' . htmlspecialchars($repo->url) . '"';
         if ($user->is_anonymous) {
             $value .= ' data-tooltip="[anonymous]"';
         } else {
             $value .= ' data-tooltip="' . htmlspecialchars($repo->url) . '"';
         }
         $value .= ' type="button" onclick="false">Copy URL to clipboard</button>';
         $Conf->footerScript('$(".repoclip").each(pa_init_repoclip)', "repoclip");
         if ($include_tarball && $info->commit_hash() && ($tarball_url = $info->tarball_url())) {
             $value .= ' <a class="bsm q" href="' . htmlspecialchars($tarball_url) . '">Download tarball for ' . substr($info->commit_hash(), 0, 7) . '</a>';
         }
     }
     // check repo
     $notes = array();
     if ($repo && !$repo->working) {
         if ($user->check_seascode_repo($pset, $repo, false)) {
             $Now = time();
             $Conf->qe("update Repository set `working`={$Now} where repoid={$repo->repoid}");
         } else {
             $notes[] = array(true, "ERROR: " . Messages::$main->expand_html("repo_unreadable", $user->repo_messagedefs($repo)));
         }
     }
     if (($open = $info->check_repo_open()) > 0) {
         $notes[] = array(true, "ERROR: " . Messages::$main->expand_html("repo_toopublic", $user->repo_messagedefs($repo)));
     } else {
         if ($open < 0 && $Me->isPC) {
             $notes[] = array(true, "WARNING: " . Messages::$main->expand_html("repo_toopublic_timeout", $user->repo_messagedefs($repo)));
         }
     }
     if ($partner && $info->partner_same) {
         $prepo = $partner->repo($pset->id);
         if (!$repo && $prepo || $repo && !$prepo || $repo && $prepo && $repo->repoid != $prepo->repoid) {
             if ($prepo) {
                 $prepo_url = ", " . htmlspecialchars($user->seascode_repo_base($prepo->url));
             } else {
                 $prepo_url = "";
             }
             $your_partner = "your partner’s";
             if ($Me->isPC) {
                 $your_partner = '<a href="' . hoturl("pset", array("pset" => $pset->urlkey, "u" => $Me->user_linkpart($partner))) . '">' . $your_partner . '</a>';
             }
             $notes[] = array(true, "ERROR: This repository differs from {$your_partner}{$prepo_url}.");
         }
     }
     if ($repo && $repo_url[0] == "~" && $user->seascode_username && !preg_match("_\\A~(?:" . preg_quote($user->seascode_username) . ($partner ? "|" . preg_quote($partner->seascode_username) : "") . ")/_i", $repo_url)) {
         if ($partner) {
             $notes[] = array(true, "ERROR: This repository belongs to neither you nor your partner.");
         } else {
             $notes[] = array(true, "ERROR: This repository does not belong to you.");
         }
     }
     if ($repo && isset($repo->truncated_psetdir) && defval($repo->truncated_psetdir, $pset->id)) {
         $notes[] = array(true, "Please create your repository by cloning our repository. Creating your repository from scratch makes it harder for us to grade and harder for you to get pset updates.");
     }
     if (!$repo) {
         $notes[] = array(false, "Enter your " . Contact::seascode_home("code.seas") . " repository URL here.");
     }
     // edit
     if ($editable) {
         echo Ht::form(self_href(array("post" => post_value(), "set_seascode_repo" => 1, "pset" => $pset->urlkey))), '<div class="f-contain">';
     }
     self::echo_group($title, $value, $notes);
     if ($editable) {
         echo "</div></form>\n";
     }
     return $repo;
 }
Example #14
0
function check_post()
{
    return isset($_REQUEST["post"]) && $_REQUEST["post"] == post_value();
}
 function post_values()
 {
     $x = post_value("case_id") . ",";
     $x .= post_value("summary") . ",";
     $x .= post_value("notes") . ",";
     $x .= "'" . date("Y-n-j") . "',";
     $x .= "'" . date("H:i:s") . "',";
     $x .= "'N',";
     $x .= "'" . date("Y-n-j") . " " . date("H:i:s") . "'";
     return $x;
 }
 /**
  * Enable/ Disable restriction rules for site content
  * 
  * @param   -
  * @return  -
  */
 function upme_enable_site_restriction_rules()
 {
     $rule_id = post_value('rule_id');
     $rule_status = post_value('rule_status');
     $this->restriction_rules = get_option('upme_site_restriction_rules');
     if (!get_option('upme_site_restriction_rules')) {
         update_option('upme_site_restriction_rules', array());
         $this->restriction_rules = array();
     }
     $this->restriction_rules[$rule_id]['site_restriction_rule_status'] = $rule_status;
     $res = update_option('upme_site_restriction_rules', $this->restriction_rules);
     $rules = $this->upme_restriction_rules_list();
     if ($res) {
         echo json_encode(array('status' => 'success', 'rules' => $rules, 'msg' => __('Restriction rule staus updated.', 'upme')));
     } else {
         echo json_encode(array('status' => 'fail', 'rules' => $rules, 'msg' => __('Failed to update restriction rule status.', 'upme')));
     }
     exit;
 }
 private function header_head($title)
 {
     global $Me, $ConfSitePATH, $Opt;
     // load session list and clear its cookie
     $list = SessionList::active();
     SessionList::set_requested(0);
     echo "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"google\" content=\"notranslate\" />\n";
     if (isset($Opt["fontScript"])) {
         echo $Opt["fontScript"];
     }
     echo $this->make_css_link("stylesheets/style.css"), "\n";
     if (get($Opt, "mobileStylesheet")) {
         echo '<meta name="viewport" content="width=device-width, initial-scale=1">', "\n";
         echo $this->make_css_link("stylesheets/mobile.css", "screen and (max-width: 768px)"), "\n";
     }
     if (isset($Opt["stylesheets"])) {
         foreach (mkarray($Opt["stylesheets"]) as $css) {
             echo $this->make_css_link($css), "\n";
         }
     }
     // favicon
     if ($favicon = defval($Opt, "favicon", "images/review24.png")) {
         if (strpos($favicon, "://") === false && $favicon[0] != "/") {
             if (get($Opt, "assetsUrl") && substr($favicon, 0, 7) === "images/") {
                 $favicon = $Opt["assetsUrl"] . $favicon;
             } else {
                 $favicon = Navigation::siteurl() . $favicon;
             }
         }
         if (substr($favicon, -4) == ".png") {
             echo "<link rel=\"icon\" type=\"image/png\" href=\"{$favicon}\" />\n";
         } else {
             if (substr($favicon, -4) == ".ico") {
                 echo "<link rel=\"shortcut icon\" href=\"{$favicon}\" />\n";
             } else {
                 if (substr($favicon, -4) == ".gif") {
                     echo "<link rel=\"icon\" type=\"image/gif\" href=\"{$favicon}\" />\n";
                 } else {
                     echo "<link rel=\"icon\" href=\"{$favicon}\" />\n";
                 }
             }
         }
     }
     // title
     echo "<title>";
     if ($title) {
         $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title);
         $title = preg_replace(",(?: |&nbsp;| )+,", " ", $title);
         $title = str_replace("&#x2215;", "-", $title);
     }
     if ($title) {
         echo $title, " - ";
     }
     echo htmlspecialchars($Opt["shortName"]), "</title>\n</head>\n";
     // jQuery
     $stash = Ht::take_stash();
     if (isset($Opt["jqueryUrl"])) {
         $jquery = $Opt["jqueryUrl"];
     } else {
         if (get($Opt, "jqueryCdn")) {
             $jquery = "//code.jquery.com/jquery-1.12.3.min.js";
         } else {
             $jquery = "scripts/jquery-1.12.3.min.js";
         }
     }
     Ht::stash_html($this->make_script_file($jquery, true) . "\n");
     // Javascript settings to set before script.js
     Ht::stash_script("siteurl=" . json_encode(Navigation::siteurl()) . ";siteurl_suffix=\"" . Navigation::php_suffix() . "\"");
     if (session_id() !== "") {
         Ht::stash_script("siteurl_postvalue=\"" . post_value() . "\"");
     }
     if ($list) {
         Ht::stash_script("hotcrp_list=" . json_encode(["num" => $list->listno, "id" => $list->listid]) . ";");
     }
     if ($urldefaults = hoturl_defaults()) {
         Ht::stash_script("siteurl_defaults=" . json_encode($urldefaults) . ";");
     }
     Ht::stash_script("assetsurl=" . json_encode($Opt["assetsUrl"]) . ";");
     $huser = (object) array();
     if ($Me && $Me->email) {
         $huser->email = $Me->email;
     }
     if ($Me && $Me->is_pclike()) {
         $huser->is_pclike = true;
     }
     if ($Me && $Me->has_database_account()) {
         $huser->cid = $Me->contactId;
     }
     Ht::stash_script("hotcrp_user="******";");
     $pid = get($_REQUEST, "paperId");
     $pid = $pid && ctype_digit($pid) ? (int) $pid : 0;
     if (!$pid && $this->paper) {
         $pid = $this->paper->paperId;
     }
     if ($pid) {
         Ht::stash_script("hotcrp_paperid={$pid}");
     }
     if ($pid && $Me && $Me->is_admin_force()) {
         Ht::stash_script("hotcrp_want_override_conflict=true");
     }
     // script.js
     if (!get($Opt, "noDefaultScript")) {
         Ht::stash_html($this->make_script_file("scripts/script.js") . "\n");
     }
     // other scripts
     if (get($Opt, "scripts")) {
         foreach ($Opt["scripts"] as $file) {
             Ht::stash_html($this->make_script_file($file) . "\n");
         }
     }
     if ($stash) {
         Ht::stash_html($stash);
     }
 }
Example #18
0
                echo "<hr style=\"clear:both\" />\n";
            }
            foreach ($diff as $file => $dinfo) {
                $linenotes = $lnorder->file($file);
                $open = $linenotes || !$dinfo->boring && ($Me != $Info->user || !$Info->can_see_grades || !$Info->is_grading_commit() || !$has_any_linenotes);
                $Info->echo_file_diff($file, $dinfo, $lnorder, $open);
            }
            Ht::stash_script('jQuery(".diffnoteentry61").autogrow();jQuery(window).on("beforeunload",beforeunload61)');
            echo "<table id=\"diff61linenotetemplate\" style=\"display:none\"><tbody>";
            $Info->echo_linenote_entry_prototype();
            echo "</tbody></table>";
        } else {
            if ($Pset->gitless_grades) {
                echo_grade_cdf_here();
            }
            echo "<div class=\"commitcontainer61\" data-pa-pset=\"", htmlspecialchars($Info->pset->urlkey), "\">";
            ContactView::echo_group("this commit", "No commits yet for this problem set", array());
            echo "</div>\n";
            if ($Pset->gitless_grades) {
                echo_grader();
                echo_all_grades();
            }
        }
    }
}
Ht::stash_script('window.psetpost61="' . self_href(array("post" => post_value())) . '"');
if (!$Pset->gitless) {
    Ht::stash_script("checklatest61()", "checklatest61");
}
echo "<div class='clear'></div>\n";
$Conf->footer();
 function upme_reset_settings()
 {
     if (is_post() && is_in_post('current_tab')) {
         if (isset($this->default_settings[post_value('current_tab')])) {
             $current_options = get_option('upme_options');
             foreach ($this->default_settings[post_value('current_tab')] as $key => $value) {
                 $current_options[$key] = $value;
             }
             update_option('upme_options', $current_options);
             echo "success";
             die;
         }
     }
 }
function hoturl_post($page, $options = null)
{
    if (is_array($options)) {
        $options["post"] = post_value();
    } else {
        if ($options) {
            $options .= "&amp;post=" . post_value();
        } else {
            $options = "post=" . post_value();
        }
    }
    return hoturl($page, $options);
}
Example #21
0
 private function header_head($title)
 {
     global $Me, $ConfSiteBase, $ConfSiteSuffix, $ConfSitePATH, $Opt, $CurrentList;
     echo "<!DOCTYPE html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n<meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n<meta http-equiv=\"Content-Language\" content=\"en\" />\n<meta name=\"google\" content=\"notranslate\" />\n";
     if (strstr($title, "<") !== false) {
         $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title);
     }
     if (isset($Opt["fontScript"])) {
         echo $Opt["fontScript"];
     }
     echo $this->make_css_link("stylesheets/style.css"), "\n";
     if (isset($Opt["stylesheets"])) {
         foreach ($Opt["stylesheets"] as $css) {
             echo $this->make_css_link($css), "\n";
         }
     }
     // favicon
     if ($favicon = defval($Opt, "favicon")) {
         if (strpos($favicon, "://") === false && $favicon[0] != "/") {
             if (@$Opt["assetsUrl"] && substr($favicon, 0, 7) === "images/") {
                 $favicon = $Opt["assetsUrl"] . $favicon;
             } else {
                 $favicon = $ConfSiteBase . $favicon;
             }
         }
         if (substr($favicon, -4) == ".png") {
             echo "<link rel=\"icon\" type=\"image/png\" href=\"{$favicon}\" />\n";
         } else {
             if (substr($favicon, -4) == ".ico") {
                 echo "<link rel=\"shortcut icon\" href=\"{$favicon}\" />\n";
             } else {
                 if (substr($favicon, -4) == ".gif") {
                     echo "<link rel=\"icon\" type=\"image/gif\" href=\"{$favicon}\" />\n";
                 } else {
                     echo "<link rel=\"icon\" href=\"{$favicon}\" />\n";
                 }
             }
         }
     }
     // jQuery
     if (isset($Opt["jqueryUrl"])) {
         $jquery = $Opt["jqueryUrl"];
     } else {
         if (@$Opt["jqueryCdn"]) {
             $jquery = "//code.jquery.com/jquery-1.11.3.min.js";
         } else {
             $jquery = "scripts/jquery-1.11.3.min.js";
         }
     }
     $this->scriptStuff = $this->make_script_file($jquery, true) . "\n";
     $this->scriptStuff .= $this->make_script_file("scripts/jquery.color-2.1.2.min.js", true) . "\n";
     $this->scriptStuff .= $this->make_script_file("scripts/jquery.flot.min.js", true) . "\n";
     //$this->scriptStuff .= $this->make_script_file("scripts/ZeroClipboard.min.js", true) . "\n";
     // Javascript settings to set before script.js
     $this->scriptStuff .= "<script>siteurl=\"{$ConfSiteBase}\";siteurl_suffix=\"{$ConfSiteSuffix}\"";
     if (session_id() !== "") {
         $this->scriptStuff .= ";siteurl_postvalue=\"" . post_value() . "\"";
     }
     if (@$CurrentList && ($list = SessionList::lookup($CurrentList))) {
         $this->scriptStuff .= ";hotcrp_list={num:{$CurrentList},id:\"" . addcslashes($list->listid, "\n\r\\\"/") . "\"}";
     }
     if ($urldefaults = hoturl_defaults()) {
         $this->scriptStuff .= ";siteurl_defaults=" . json_encode($urldefaults);
     }
     $huser = (object) array();
     if ($Me && $Me->email) {
         $huser->email = $Me->email;
     }
     if ($Me && $Me->is_pclike()) {
         $huser->is_pclike = true;
     }
     $this->scriptStuff .= ";hotcrp_user="******"paperId"];
     $pid = $pid && ctype_digit($pid) ? (int) $pid : 0;
     if ($pid) {
         $this->scriptStuff .= ";hotcrp_paperid={$pid}";
     }
     if ($pid && $Me && $Me->privChair && ($forceShow = @$_REQUEST["forceShow"]) && $forceShow != "0") {
         $this->scriptStuff .= ";hotcrp_want_override_conflict=true";
     }
     //$this->scriptStuff .= ";ZeroClipboard.setDefaults({moviePath:\"${ConfSiteBase}cacheable$ConfSiteSuffix?file=scripts/ZeroClipboard.swf&amp;mtime=" . filemtime("$ConfSitePATH/scripts/ZeroClipboard.swf") . "\"})";
     $this->scriptStuff .= "</script>\n";
     // script.js
     $this->scriptStuff .= $this->make_script_file("scripts/script.js") . "\n";
     echo $this->scriptStuff;
     $this->scriptStuff = "";
     echo "<title>", $title, " - ", htmlspecialchars($Opt["shortName"]), "</title>\n</head>\n";
 }