コード例 #1
0
ファイル: register.php プロジェクト: kmklr72/lmms.io
function try_add_user($login, $pass, $pass2, $realname, $session, $is_admin, $antispam)
{
    $return_val = false;
    // Help prevent robot registrations
    if (!check_antispam($antispam)) {
        display_error("Invalid security code");
    } else {
        if ($session != md5(session_id() . $_SERVER['REMOTE_ADDR'])) {
            display_error("Invalid session.");
        } else {
            if ($pass != $pass2) {
                display_warning("Password mismatch");
            } else {
                if ($realname == '' || $pass == '' || $pass2 == '' || $login == '') {
                    display_warning("Please fill out all fields");
                } else {
                    if (get_user_id($login) > 0) {
                        display_error("The user <strong>{$login}</strong> already exists.");
                    } else {
                        add_user($login, $realname, $pass, $is_admin);
                        $return_val = display_success("<strong>{$login}</strong> has been successfully created");
                    }
                }
            }
        }
    }
    return $return_val;
}
コード例 #2
0
ファイル: index.php プロジェクト: soi/int_repair
function parse_messages()
{
    if (isset($_GET['success']) && $_GET['success']) {
        display_success($_GET['success'], true);
    }
    if (isset($_GET['errors']) && $_GET['errors']) {
        display_errors(explode($_GET['errors']));
    }
}
コード例 #3
0
ファイル: index.php プロジェクト: soi/int_repair
function parse_messages()
{
    if (isset($_SESSION['success'])) {
        display_success($_SESSION['success'], true);
        unset($_SESSION['success']);
    }
    if (isset($_SESSION['errors'])) {
        display_errors($_SESSION['errors']);
        unset($_SESSION['errors']);
    }
}
コード例 #4
0
ファイル: user_settings.php プロジェクト: kmklr72/lmms.io
function apply_settings($password, $password2, $realname)
{
    global $LSP_URL;
    if ($password != $password2) {
        display_error('Password mismatch');
        return false;
    } else {
        change_user(SESSION(), $realname, $password);
        display_success('Account settings have been updated', array('<a href="">User Settings</a>', 'Success'), $LSP_URL . "?account=settings");
        return true;
    }
}
コード例 #5
0
ファイル: tb_stores.php プロジェクト: rosyid33/demo_project
if (isset($_GET['delete'])) {
    $id = $_GET['delete'];
    //sementara delete data tanpa cek ke table lain karna ini cek ke tabel transaksi
    //CEK DATA IN other table BEFORE DELETE
    //	$cek_exist = count_data(TB_PREF."items", 'id', "id_brand='".$id."'");
    //	if ($cek_exist[0]>0) {
    //            display_error("Data ini masih digunakan... "
    //                    . "| <a href='?".$parameter_key."kd_tabel=tb_stores' />Close</a>");
    //	}
    //        else{
    $table = TB_PREF . "stores";
    $field_key = "id";
    $field_val = "'" . $id . "'";
    $query = delete_record($table, $field_key, $field_val);
    if ($query) {
        display_success("Data berhasil dihapus " . "| <a href='?" . $parameter_key . "kd_tabel=tb_stores' />Close</a>");
    } else {
        display_error("Gagal menghapus data <br>" . "(" . mysql_error() . ") | <a href='?" . $parameter_key . "kd_tabel=tb_stores' />Close</a>");
    }
    //	}
}
//-------------------------------FORM-----------------------------------------
start_form();
//form input
if (isset($_POST['AddNew'])) {
    start_table("class='form'");
    text_field('Store Name: ', 'store_name', $val_selected['store_name'], true);
    text_area('Description: ', 'description', $val_selected['description']);
    text_field('Address: ', 'address', $val_selected['address'], false);
    text_field('Contact: ', 'contact', $val_selected['contact'], false);
    text_with_list_users("Person: ", "person_id", $val_selected['person_id'], false, true, "-", "level='" . USER_STORE . "'");
コード例 #6
0
         }
         if ($ERROR) {
             $STEP = 1;
         }
         break;
     case 1:
     default:
         continue;
         break;
 }
 if ((int) $evaluation_record["max_submittable"] === 0 || $completed_attempts < $evaluation_record["max_submittable"]) {
     // Display Content
     switch ($STEP) {
         case 2:
             if ($SUCCESS) {
                 $content["evaluation_attempt"] = display_success();
             }
             break;
         case 1:
         default:
             if ($evaluation_record["evaluation_finish"] < time() && $evaluation_record["min_submittable"] > $completed_attempts) {
                 $NOTICE++;
                 $NOTICESTR[] = "This evaluation has not been completed and was marked as to be completed by " . date(DEFAULT_DATE_FORMAT, $evaluation_record["evaluation_finish"]) . ". Please complete this evaluation now to continue using " . APPLICATION_NAME . ".";
             }
             if (isset($evaluation_record["evaluation_description"]) && $evaluation_record["evaluation_description"]) {
                 $content["evaluation_attempt"] .= "<div class=\"display-generic\">" . $evaluation_record["evaluation_description"] . "</div>";
             }
             /**
              * Check to see if they currently have any evaluation attempts underway, if they do then
              * restart their session, otherwise start them a new session.
              */
コード例 #7
0
                                $PROCESSED["grade_id"] = $grades[$proxy_id]["grade_id"];
                                $db->AutoExecute("assessment_grades", $PROCESSED, "UPDATE", "`grade_id`=" . $db->qstr($PROCESSED["grade_id"]));
                            } else {
                                $db->AutoExecute("assessment_grades", $PROCESSED, "INSERT");
                            }
                        }
                        unset($PROCESSED);
                    }
                }
                if (!$ERROR) {
                    add_success("Successfully imported results from the attached quiz questions into <strong>" . $assessment_name . "</strong>.");
                }
            } else {
                add_error("No students have been found in the cohort assigned to this assessment [<strong>" . $assessment_name . "</strong>].");
            }
        } else {
            add_error("No quizzes were found to be associated with this assessment [<strong>" . $assessment_name . "</strong>].");
        }
    } else {
        add_error("The assessment " . $assessment_name . " does not have a quiz attached, results can not be imported.");
    }
    if ($ERROR) {
        add_error("You will now be redirected to the <strong>Grade Assessment</strong> page for <strong>" . $assessment_name . "</strong>. This will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue now.");
        echo display_error();
    }
    if ($SUCCESS) {
        add_success("You will now be redirected to the <strong>Grade Assessment</strong> page for <strong>" . $assessment_name . "</strong>. This will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue now.");
        echo display_success();
    }
    $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
}
コード例 #8
0
ファイル: complete_functions.php プロジェクト: soi/paul
/**
 * Checks a registration request for invalid inputs
 *
 * @access public
 * @return true
 */
function complete_upload_match_media()
{
    if (valid_request(array(isset($_GET['match_id']), isset($_FILES['match_media']), isset($_POST['description'])))) {
        require CLASS_PATH . 'class.upload.php';
        global $db;
        global $smarty;
        if (strlen($_POST['description']) < 2 || strlen($_POST['description']) > 20) {
            display_errors(751);
            return true;
        }
        $upload = new Upload($_FILES['match_media']);
        if ($upload->uploaded) {
            //getting the internal file name out of the current time
            $name = microtime();
            $name = substr($name, 2, 8) . substr($name, 11);
            $upload->file_new_name_body = $name;
            $upload->allowed = array('application/zip', 'image/*');
            $upload->process(MATCH_MEDIA_PATH);
            if ($upload->processed) {
                $sql = "add_match_media(" . $_GET['match_id'] . ",\n                                            " . $_SESSION['user_id'] . ",\n                                            '" . $_POST['description'] . "',\n                                            '" . $upload->file_dst_name . "', \n                                            " . filesize($upload->file_dst_pathname) . ")";
                $db->run($sql);
                if ($db->error_result) {
                    display_errors(750);
                } else {
                    display_success("upload_match_media");
                    $smarty->assign('content', $smarty->fetch("succes.tpl"));
                }
            } else {
                display_errors(750);
            }
            $upload->clean();
        } else {
            display_errors(750);
            return true;
        }
    }
    return true;
}
コード例 #9
0
ファイル: add.inc.php プロジェクト: nadeemshafique/entrada-1x
 $student_id = clean_input($_GET["id"], "numeric");
 $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/observerships?section=add", "title" => "Add Observership");
 switch ($STEP) {
     case 2:
         $observership_array = $_POST;
         $observership_array["student_id"] = $student_id;
         /*
          * Admins adding observerships are approved automatically. 
          */
         $OBSERVERSHIP = Observership::fromArray($observership_array, "add", $student_id);
         if (!$OBSERVERSHIP->isValid()) {
             add_error("<strong>Invalid data entered</strong>. Please confirm everything and try again.");
         } else {
             if ($OBSERVERSHIP->create()) {
                 $url = ENTRADA_URL . "/admin/users/manage/students?section=observerships&id=" . $student_id;
                 echo display_success("Successfully created Observership. You will be redirected to your Observership index in <strong>5 seconds</strong> or <a href=\"" . $url . "\">click here</a> to go there now.");
                 $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
                 return;
             } else {
                 add_error("<strong>Error occurred creating Observership</strong>. Please confirm everything and try again.");
             }
         }
         break;
     case 1:
     default:
         $OBSERVERSHIP = new Observership();
         break;
 }
 define('ADMIN_OBSERVERSHIP_FORM', true);
 $ACTION = "Create";
 require_once 'form.inc.php';
コード例 #10
0
ファイル: users.php プロジェクト: SlayterDev/VoterBoat
 public function get_user_bio()
 {
     // Retrieve Local Parameters
     $user_id = mysql_escape_string($_POST['user_id']);
     $getbio = mysql_query("SELECT bio FROM users WHERE user_id='" . $user_id . "'");
     $results = mysql_fetch_array($getbio);
     $data = array("bio" => $results['bio']);
     display_success($data);
 }
コード例 #11
0
                        }
                    } else {
                        application_log("error", "Attempt to update observership with id [" . $observership_id . "] for proxy id [" . $PROXY_ID . "] where status was invalid or different student_id.");
                        add_error("An error ocurred while trying to update observership status. An administrator has been informed, please try again later.");
                    }
                    unset($observership);
                }
            }
            break;
    }
    switch ($STEP) {
        case 2:
            if ($ERORR) {
                echo display_error();
            } else {
                echo display_success("Successfully updated observerships for " . $user->getFullname(false) . ". You will be redirected to the students observership managment page in 5 seconds. Please <a href=\"" . ENTRADA_URL . "/admin/users/manage/students?section=observerships&id=" . $PROXY_ID . "\">click here</a> if you do not wish to wait.");
                if (count($pending_observerships) > 0) {
                    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/users/manage/students?section=observerships&id=" . $PROXY_ID . "\\'', 5000)";
                } else {
                    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/users/manage?id=" . $PROXY_ID . "\\'', 5000)";
                }
            }
            break;
        case 1:
        default:
            if (clerkship_fetch_schedule($user->getID()) == false || ($ENTRADA_USER->getGroup() == "staff" || $ENTRADA_USER->getGroup() == "medtech")) {
                ?>
<div class="row-fluid">
	<a id="add_observership" href="<?php 
                echo ENTRADA_URL;
                ?>
コード例 #12
0
ファイル: dbo.php プロジェクト: kmklr72/lmms.io
function show_file($file_id, $user, $success = null)
{
    global $LSP_URL, $DATA_DIR;
    $dbh =& get_db();
    $stmt = $dbh->prepare('SELECT licenses.name AS license, size, realname, filename, users.login, ' . 'categories.name AS category, subcategories.name AS subcategory,' . 'insert_date, update_date, description, downloads, files.id FROM files ' . 'INNER JOIN categories ON categories.id=files.category ' . 'INNER JOIN subcategories ON subcategories.id=files.subcategory ' . 'INNER JOIN users ON users.id=files.user_id ' . 'INNER JOIN licenses ON licenses.id=files.license_id ' . 'WHERE files.id=:file_id');
    $stmt->bindParam(':file_id', $file_id);
    $found = false;
    if ($stmt->execute()) {
        while ($object = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $title = array($object['category'], $object['subcategory'], get_file_url($file_id));
            if ($success == null) {
                echo '<div class="col-md-9">';
                create_title($title);
            } else {
                if ($success === true) {
                    display_success("Updated successfully", $title);
                    echo '<div class="col-md-9">';
                } else {
                    if ($success === false) {
                        display_error("Update failed.", $title);
                        echo '<div class="col-md-9">';
                    } else {
                        display_success("{$success}", $title);
                    }
                }
            }
            echo '<table class="table table-striped">';
            show_basic_file_info($object, false);
            // Bump the download button under details block
            $url = htmlentities('download_file.php?file=' . $object['id'] . '&name=' . $object['filename']);
            echo '<tr><td><strong>Name:</strong>&nbsp;' . $object['filename'];
            if (is_image($url)) {
                echo '<br><br><a href="' . $url . '"><img class="thumbnail" src="' . scale_image($DATA_DIR . $file_id, 300, parse_extension($url)) . '" alt=""></a>';
            }
            echo '</td><td class="lsp-file-info">';
            echo '<a href="' . $url . '" id="downloadbtn" class="lsp-dl-btn btn btn-primary">';
            echo '<span class="fa fa-download lsp-download"></span>&nbsp;Download</a>';
            echo '</td></tr>';
            echo '<tr><td colspan="2"><div class="well"><strong>Description:</strong><p>';
            echo $object['description'] != '' ? parse_links(newline_to_br($object['description'], true)) : 'No description available.';
            echo '</p></div></td></tr>';
            echo '<tr><td colspan="2">';
            echo '<nav id="lspnav" class="navbar navbar-default"><ul class="nav navbar-nav">';
            $can_edit = $object['login'] == $user || is_admin(get_user_id($user));
            $can_rate = !SESSION_EMPTY();
            $rate_self = $object['login'] == $user;
            global $LSP_URL;
            create_toolbar_item('Comment', "{$LSP_URL}?comment=add&file={$file_id}", 'fa-comment', $can_rate);
            create_toolbar_item('Edit', "{$LSP_URL}?content=update&file={$file_id}", 'fa-pencil', $can_edit);
            create_toolbar_item('Delete', "{$LSP_URL}?content=delete&file={$file_id}", 'fa-trash', $can_edit);
            $star_url = $LSP_URL . '?' . file_show_query_string() . '&rate=';
            create_toolbar_item(get_stars($file_id, $star_url, $rate_self ? false : $can_rate), '', null, $can_rate, $rate_self);
            echo '</ul></nav>';
            echo '<strong>Comments:</strong>';
            echo '</td></tr>';
            get_comments($file_id);
            echo '</table></div>';
            $found = true;
            break;
        }
    }
    if (!$found) {
        display_error('Invalid file: "' . sanitize($file_id) . '"');
    }
    $stmt = null;
    $dbh = null;
}
コード例 #13
0
ファイル: complete_functions.php プロジェクト: soi/int_repair
function complete_edit_user_rights()
{
    if (valid_request(array(isset($_GET['user_id'])))) {
        global $db;
        global $smarty;
        if (!isset($_POST['admin'])) {
            $admin_perm = 0;
        } else {
            $admin_perm = 1;
        }
        if (!isset($_POST['managment'])) {
            $managment_perm = 0;
        } else {
            $managment_perm = 1;
        }
        if (!isset($_POST['tech'])) {
            $tech_perm = 0;
        } else {
            $tech_perm = 1;
        }
        $sql = "edit_user_rights(" . $_GET['user_id'] . ",\n                                     " . $admin_perm . ",\n                                     " . $tech_perm . ",\n                                     " . $managment_perm . ")";
        $db->run($sql);
        if ($db->error_result) {
            display_errors(1);
        } else {
            display_success("edit_user_rights");
        }
    }
    return true;
}
コード例 #14
0
ファイル: elections.php プロジェクト: SlayterDev/VoterBoat
 public function vote_candidate()
 {
     // get parameters
     $election_id = mysql_escape_string($this->_parameters['election_id']);
     $user_id = mysql_escape_string($this->_parameters['user_id']);
     $candidate_id = mysql_escape_string($this->_parameters['candidate_id']);
     $checkIfVoted = mysql_query("SELECT * FROM votes WHERE election_id='" . $election_id . "' AND user_id='" . $user_id . "'");
     if (mysql_num_rows($checkIfVoted) > 0) {
         display_error(204);
     }
     // cast vote
     $castVote = mysql_query("INSERT INTO votes (election_id, candidate_id, user_id) VALUES ('" . $election_id . "', '" . $candidate_id . "', '" . $user_id . "')");
     display_success();
 }
コード例 #15
0
ファイル: tb_items.php プロジェクト: rosyid33/demo_project
        }
    }
}
//-------------------------------UPDATE ACTION-----------------------------------------
if (isset($_POST['submit_update'])) {
    //CEK EXISTING DATA IN TABLE
    $cek_exist = count_data(TB_PREF . "items", 'item_name', "item_name='" . $_POST['item_name'] . "'");
    if ($cek_exist[0] > 1) {
        display_error("Data pembaruhan sudah ada " . "| <a href='?" . $parameter_key . "kd_tabel=tb_items' />Close</a>");
    } else {
        $table = TB_PREF . "items";
        $value = "item_code='" . $_POST['item_code'] . "', " . " item_name='" . $_POST['item_name'] . "', " . " id_brand='" . $_POST['id_brand'] . "', " . " unit_price='" . $_POST['unit_price'] . "', " . " discount='" . $_POST['discount'] . "', " . " weight='" . $_POST['weight'] . "', " . " description='" . $_POST['description'] . "' ";
        $where = " WHERE id='" . $_POST['id'] . "'";
        $query = update_record($table, $value, $where);
        if ($query) {
            display_success("Data berhasil diperbaruhi " . "| <a href='?" . $parameter_key . "kd_tabel=tb_items' />Close</a>");
        } else {
            display_error("Gagal memperbaruhi data <br>" . "(" . mysql_error() . ") | <a href='?" . $parameter_key . "kd_tabel=tb_items' />Close</a>");
        }
    }
}
//-------------------------------ISSET UPDATE/DELETE-----------------------------------------
if (isset($_GET['update'])) {
    $id = $_GET['update'];
    $val_selected = display_table_all_column(TB_PREF . 'items', "id='{$id}'", true, false, '', '');
    $_POST['AddNew'] = 'update';
}
//DELETE ACTION
/*sementara delete item tidak bisa
if(isset($_GET['delete'])){
	$id = $_GET['delete'];
コード例 #16
0
ファイル: register.php プロジェクト: startrekfinalfrontier/UI
            FROM user
            WHERE user_name = "' . $_POST['user_name'] . '"';
                if (($new_id = $mydb->queryrow($sql)) === false) {
                    die('Database error - Could not determine new user ID');
                }
                $user_id = (int) $new_id['user_id'];
                $sql = 'INSERT INTO user_templates (user_id, user_template)
            VALUES (' . $user_id . ', "' . addslashes($skin_data['skin_html']) . '")';
                if (!$mydb->query($sql)) {
                    die('Database error - Could not insert skin data');
                }
                $activation_key = md5(pow($user_id, 2));
                $activation_link = 'http://www.stfc.it/index.php?a=activate&galaxy=' . $galaxy . '&user_id=' . $user_id . '&key=' . $activation_key;
                $mail_message = $locale['mail_message_congrats'] . ' ' . $_POST['user_name'] . '!' . NL;
                $mail_message .= $locale['mail_message_reg1a'] . ' ' . $galaxyname . ' ' . $locale['mail_message_reg1b'] . NL;
                $mail_message .= $locale['mail_message_reg2'] . NL . $activation_link . "\n\n" . $locale['mail_message_reg3'] . NL;
                $mail_message .= $locale['mail_message_reg4'] . NL . NL . $locale['mail_message_sig_line1'] . NL;
                $mail_message .= $locale['mail_message_sig_line2'] . NL . NL . 'Credits: http://www.stfc.it/index.php?a=imprint';
                send_mail("STFC2 Mailer", $config['admin_email'], $_POST['user_name'], $_REQUEST['user_email'], $locale['mail_subject_reg'], $mail_message);
                // Update NewRegister
                $sql = 'UPDATE config SET new_register = new_register + 1';
                if (!$mydb->query($sql)) {
                    die('Database error - Could not update new_register');
                }
                display_success($galaxyname, $galaxyimg);
                return true;
            }
        }
    }
    display_registration(NULL, '(' . $locale['there_are'] . ' ' . $playercount['num'] . ' ' . $locale['on'] . ' ' . $config['max_player'] . ' ' . $locale['occupied_places'] . ')', $galaxy);
}
コード例 #17
0
ファイル: elections.php プロジェクト: SlayterDev/VoterBoat
 public function vote_candidate()
 {
     // get parameters
     $election_id = mysql_escape_string($this->_parameters['election_id']);
     $user_id = mysql_escape_string($this->_parameters['user_id']);
     $candidate_id = mysql_escape_string($this->_parameters['candidate_id']);
     $checkVotes = mysql_query("SELECT * FROM votes WHERE election_id='" . $election_id . "' AND user_id='" . $user_id . "'");
     $pastVoteInfo = mysql_fetch_array($checkVotes);
     // delete vote
     $checkIfVoted = mysql_query("DELETE FROM votes WHERE election_id='" . $election_id . "' AND user_id='" . $user_id . "'");
     $checkCandidate = mysql_query("SELECT * FROM votes WHERE election_id='" . $election_id . "' AND candidate_id='" . $pastVoteInfo['candidate_id'] . "' AND type='Written'");
     if (mysql_num_rows($checkCandidate) == 0) {
         // delete candidate
         $deleteCandidate = mysql_query("DELETE FROM write_in_candidates WHERE candidate_id='" . $pastVoteInfo['candidate_id'] . "'");
     }
     // cast vote
     $castVote = mysql_query("INSERT INTO votes (election_id, candidate_id, user_id) VALUES ('" . $election_id . "', '" . $candidate_id . "', '" . $user_id . "')");
     display_success();
 }
コード例 #18
0
                <a class="mdl-navigation__link" href="objects.php">Enchères</a>

                <?php 
if (isset($_SESSION['mail'])) {
    echo '<a class="mdl-navigation__link" href="user_objects.php">Mes objets</a>';
}
?>

                <a class="mdl-navigation__link" href="add_object.php">Ajouter un objet</a>
                <?php 
if (!isset($_SESSION['mail'])) {
    echo '<a class="mdl-navigation__link" href="login.php">Se connecter</a>';
} else {
    echo '<a class="mdl-navigation__link" href="action/logout.php">Se déconnecter</a>';
    echo ($_SESSION['_id'] == 1 or $_SESSION['_id'] == 4 or $_SESSION['_id'] == 7) ? '<div class="mdl-navigation__link less_padding"><i class="material-icons" style="vertical-align: middle; !important">verified_user</i></div>' : '<div class="mdl-navigation__link less_padding">|</div>';
    echo '<a class="mdl-navigation__link" href="edit_user.php?id=' . $_SESSION['_id'] . '">' . $_SESSION['prenom'] . ' ' . $_SESSION['nom'] . '</a>';
}
?>
            </nav>
        </div>
    </header>
    <main class="mdl-layout__content">

<?php 
require __DIR__ . '/../lib/class.Database.php';
//Affichage de l'éventuel message d'erreur
if (isset($_GET['error'])) {
    display_error($_GET['error']);
} elseif (isset($_GET['success'])) {
    display_success($_GET['success']);
}
<?php

$success = false;
$errors = array();
$data = array();
$objects = array();
require 'includes/initialize.php';
if (!$session->is_logged_in()) {
    array_push($errors, "Not logged in.");
} else {
    if (isset($_GET['user_id'])) {
        $user = User::find_by_id($_GET['user_id']);
        $circles = Circle::find_by_user_id($session->user_id);
        $og_circle_ids = array();
        foreach ($circles as $circle) {
            array_push($og_circle_ids, $circle->circle_id);
        }
        $user->remove_from_circles($og_circle_ids);
        $user->add_to_circles($_GET['circle_ids']);
        $success = true;
    }
}
display_success($success, $errors, $data, $objects);
コード例 #20
0
/**
 * routine to display standard status messages, Error, Notice, and Success
 * @param bool $fade true if the messages should fade out
 */
function display_status_messages($fade = false)
{
    echo "<div class=\"status_messages\">";
    if (has_error()) {
        if ($fade) {
            fade_element("out", "display-error-box");
        }
        echo display_error();
    }
    if (has_success()) {
        if ($fade) {
            fade_element("out", "display-success-box");
        }
        echo display_success();
    }
    if (has_notice()) {
        if ($fade) {
            fade_element("out", "display-notice-box");
        }
        echo display_notice();
    }
    echo "</div>";
}
コード例 #21
0
             $approved[] = $d;
         } else {
             application_log("error", "An unknown error was encountered while attempting to change the status [" . $status . "] of an event draft [" . $draft_id . "].");
         }
     }
     $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/events/drafts\\'', 5000)";
     if (!empty($approved)) {
         $total_approved = count($approved);
         $successmsg[] = "You have successfully " . $action . "ed " . $total_approved . " draft" . ($total_approved > 1 ? "s" : "") . ".";
         $successmsg[] .= "<div style=\"padding-left: 15px; padding-bottom: 15px; font-family: monospace\">\n";
         foreach ($approved as $draft) {
             $successmsg[] .= html_encode($draft->getName()) . "<br />";
         }
         $successmsg[] .= "</div>\n";
         $successmsg[] .= "You will be automatically redirected to the event index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/events/drafts\">click here</a> if you do not wish to wait.";
         echo display_success(implode("\n", $successmsg));
         application_log("success", "User [" . $ENTRADA_USER->getActiveId() . "] approved draft ids: " . implode(", ", $draft_ids));
     } else {
         add_error("Unable to remove the requested drafts from the system.<br /><br />The system administrator has been informed of this issue and will address it shortly; please try again later.");
         application_log("error", "Failed to remove draft from the remove request. Database said: " . $db->ErrorMsg());
     }
     if ($ERROR) {
         echo display_error();
     }
     break;
 case 1:
 default:
     if ($ERROR) {
         echo display_error();
     } else {
         $total_events = count($draft_ids);
コード例 #22
0
ファイル: comment_file.php プロジェクト: kmklr72/lmms.io
    if (!POST('addcomment', false) || POST_EMPTY('text')) {
        if (POST_EMPTY('text') && POST('addcomment', false)) {
            display_error('Please type a message', array('Comment', get_file_url()));
        } else {
            display_warning('Do not submit offending, pornographic, racist or violent content.', array('Comment', get_file_url()));
        }
        echo '<div class="col-md-9">';
        $form = new form($LSP_URL . '?comment=add&' . file_show_query_string(), 'Comment', 'fa-comment');
        ?>
		<div class="form-group">
		<label for="text">Add comment to "<?php 
        echo get_file_name(GET('file'));
        ?>
"</label>
		<textarea id="comment" name="text" class="form-control"></textarea>
		</div>
		<button type="submit" class="btn btn-primary" name="addcomment" value="Comment"><span class="fa fa-check"></span>&nbsp;Comment</button>&nbsp;
		<a href="<?php 
        echo $LSP_URL . '?action=show&file=' . GET('file');
        ?>
" class="btn btn-warning"></span><span class="fa fa-close"></span>&nbsp;Cancel</a>
		<?php 
        $form->close();
        echo '</div>';
    } else {
        add_visitor_comment(GET('file'), POST('text'), SESSION());
        display_success('Comment posted successfully', array('Comment', get_file_url()), $LSP_URL . '?action=show&file=' . GET('file') . '#footer');
    }
} else {
    display_error('Not logged in', array('Comment', get_file_url()));
}
<?php

$success = false;
$errors = array();
$data = array();
require 'includes/initialize.php';
if (!$session->is_logged_in()) {
    array_push($errors, "Not logged in.");
} else {
    if (!isset($_POST['content_text']) || !isset($_POST['special']) || !isset($_POST['type'])) {
        array_push($errors, "Error 0x01 creating content.");
    } else {
        $content = Content::instantiate($_POST);
        $content->user_id = $session->user_id;
        if ($content->create()) {
            $success = true;
        }
    }
}
display_success($success, $errors, $data);
コード例 #24
0
    //	//CEK DATA IN other table BEFORE DELETE
    //	$cek_exist = count_data(TB_PREF."items", 'id', "id_brand='".$id."'");
    //	if ($cek_exist[0]>0) {
    //            display_error("Data ini masih digunakan... "
    //                    . "| <a href='?".$parameter_key."kd_tabel=tb_maping_item_category' />Close</a>");
    //	}
    //        else{
    //SEMENTARA CEK DATA BEFORE DELETE DITUTUP
    //get id item dari maping category item id sebelum di delete
    $item = find_in_table(TB_PREF . "maping_category_items", "id_item", " WHERE id = '" . $id . "'");
    $table = TB_PREF . "maping_category_items";
    $field_key = "id";
    $field_val = "'" . $id . "'";
    $query = delete_record($table, $field_key, $field_val);
    if ($query) {
        display_success("Data berhasil dihapus " . "| <a href='?" . $parameter_key . "kd_tabel=tb_maping_item_category&item=" . $item['id_item'] . "' />Close</a>");
    } else {
        display_error("Gagal menghapus data <br>" . "(" . mysql_error() . ") | <a href='?" . $parameter_key . "kd_tabel=tb_maping_item_category&item=" . $item['id_item'] . "' />Close</a>");
    }
    //	}
}
//-------------------------------FORM-----------------------------------------
start_form();
//form input
if (isset($_POST['AddNew'])) {
    start_div("class='col-md-6'");
    start_table("class='form'");
    start_div("class='form-group'");
    $str = '';
    //for parameter get
    if (!empty($_POST['id_item'])) {
コード例 #25
0
                                </div>
                                <input type="hidden" id="report_period" value="full" />
                            </div>
                        </div>
                    </div>
                    <div id="evaluation-question-details"></div>
                </div>
            </div>
            <?php 
            break;
        case 2:
            if ($ERROR) {
                echo display_error($ERRORSTR);
            }
            if ($SUCCESS) {
                echo display_success($SUCCESSSTR);
            }
            $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/jquery/jquery.dataTables.min.js\"></script>";
            $HEAD[] = "<script type=\"text/javascript\">\n                jQuery(function(\$) {\n                    jQuery('#evaluations').dataTable(\n                        {\n                            'sPaginationType': 'full_numbers',\n                            'bInfo': false,\n                            'bAutoWidth': false,\n                            'sAjaxSource': '?section=api-list',\n                            'bServerSide': true,\n                            'bProcessing': true,\n                            'aoColumns': [\n                                { 'mDataProp': 'checkbox', 'bSortable': false },\n                                { 'mDataProp': 'evaluation_title' },\n                                { 'mDataProp': 'evaluation_start' },\n                                { 'mDataProp': 'evaluation_finish' },\n                                { 'mDataProp': 'completions' }\n                            ],\n                            'oLanguage': {\n                                'sEmptyTable': 'There are currently no learner evaluations in the system.',\n                                'sZeroRecords': 'No evaluations found to display.'\n                            },\n                            'fnServerData': function ( sSource, aoData, fnCallback ) {\n                                /* Add some extra data to the sender */\n                                aoData.push({ 'name': 'proxy_id', 'value': '" . $PROCESSED["proxy_id"] . "' });\n                                aoData.push({ 'name': 'report_start', 'value': '" . $PROCESSED["report_start"] . "' });\n                                aoData.push({ 'name': 'report_finish', 'value': '" . $PROCESSED["report_finish"] . "' });\n                                var evaluation_ids = \$('#evaluations input:checkbox:checked').map(function(){\n                                    return \$(this).val();\n                                }).get();\n                                if (evaluation_ids != null) {\n                                   for (x = 0; x < evaluation_ids.length; x++) {\n                                      aoData.push({ 'name': 'evaluation_ids[' + x + ']', 'value': evaluation_ids[x] });\n                                   }\n                                }\n                                \$.getJSON( sSource, aoData, function (json) { \n                                    fnCallback(json)\n                                } );\n                            }\n                        }\n                    );\n                });\n            </script>";
            ?>
            <h2>Select one or more Evaluations:</h2>
            <form action="<?php 
            echo html_encode(ENTRADA_URL);
            ?>
/admin/evaluations/reports?section=learner-evaluations&step=3" method="POST" id="evaluation-report-form">
                <input type="hidden" name="proxy_id" value="<?php 
            echo $PROCESSED["proxy_id"];
            ?>
" />
                <input type="hidden" name="report_start" value="<?php 
            echo $PROCESSED["report_start"];
コード例 #26
0
ファイル: delete_file.php プロジェクト: kmklr72/lmms.io
<?php

require_once 'utils.php';
require_once 'dbo.php';
require_once 'xhtml.php';
global $LSP_URL;
if (!SESSION_EMPTY() && (get_user_id(SESSION()) == get_file_owner(GET('file')) || is_admin(get_user_id(SESSION())))) {
    if (GET('confirmation') == "true") {
        if (delete_file(GET('file'))) {
            display_success('File deleted successfully', array('Delete'));
        } else {
            display_error('Sorry, file ' . GET('file') . ' could not be deleted', array('Delete'));
        }
        get_latest();
    } else {
        display_warning('This will delete all comments and ratings.', array('Delete', get_file_url()));
        echo '<div class="col-md-9">';
        $form = new form(null, 'Confirm Delete', 'fa-trash');
        ?>
		<p class="lead">Confirm deletion of <strong><?php 
        echo get_file_name(GET('file'));
        ?>
</strong>?</p>
		<div class="form-group">
		<a class="btn btn-danger" href="<?php 
        echo "{$LSP_URL}?content=delete&confirmation=true&file=" . GET('file');
        ?>
">
		<span class="fa fa-check"></span>&nbsp;Delete</a>
		<a class="btn btn-warning" href="<?php 
        echo "{$LSP_URL}?action=show&file=" . GET('file');
<?php

$success = false;
$errors = array();
require 'includes/initialize.php';
if (!$session->is_logged_in()) {
    array_push($errors, "Not logged in.");
} else {
    if (!isset($_POST['circle_id'])) {
        array_push($errors, "Error 0x01 deleting circle.");
    } else {
        $circle = Circle::find_by_id($_POST['circle_id']);
        if ($session->user_id == $circle->user_id) {
            if ($circle->delete()) {
                $success = true;
            }
        }
    }
}
display_success($success, $errors);
コード例 #28
0
function profile_update_google()
{
    global $db, $GOOGLE_APPS, $ERROR, $ERRORSTR, $SUCCESS, $SUCCESSSTR, $ENTRADA_USER;
    if ((bool) $GOOGLE_APPS["active"]) {
        /**
         * This actually creates a Google Hosted Apps account associated with their profile.
         * Note: The sessions variable ($_SESSION["details"]["google_id"]) is being
         * changed in index.php on line 242 to opt-in, which is merely used in the logic
         * of the first-login page, but only if the user has no google id and hasn't opted out.
         */
        if (isset($_POST["google_account"])) {
            if ((int) trim($_POST["google_account"])) {
                if (google_create_id()) {
                    $SUCCESS++;
                    $SUCCESSSTR[] = "<strong>Your new " . $GOOGLE_APPS["domain"] . "</strong> account has been created!</strong><br /><br />An e-mail will be sent to " . $_SESSION["details"]["email"] . " shortly, containing further instructions regarding account activation.";
                    if (isset($_POST["ajax"]) && $_POST["ajax"] == "1") {
                        // Clear any open buffers and push through only the success message.
                        ob_clear_open_buffers();
                        echo display_success($SUCCESSSTR);
                        exit;
                    }
                } else {
                    if (isset($_POST["ajax"]) && $_POST["ajax"] == "1") {
                        // $ERRORSTR is set by the google_create_id() function.
                        // Clear any open buffers and push through only the error message.
                        ob_clear_open_buffers();
                        echo display_error($ERRORSTR);
                        exit;
                    }
                }
            } else {
                $db->Execute("UPDATE `" . AUTH_DATABASE . "`.`user_data` SET `google_id` = 'opt-out' WHERE `id` = " . $db->qstr($ENTRADA_USER->getID()));
            }
        }
    }
}