* Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ $require_current_course = true; $require_course_admin = true; require_once '../../include/baseTheme.php'; require_once 'include/lib/fileManageLib.inc.php'; require_once 'archive_functions.php'; $toolName = $langCourseInfo; $pageName = $langArchiveCourse; $navigation[] = array('url' => "index.php?course=$course_code", 'name' => $langCourseInfo); if (!isset($_GET['token']) || !validate_csrf_token($_GET['token'])) csrf_token_error(); doArchive($course_id, $course_code); $tool_content .= " <div class='alert alert-info'> <ol> <li>$langBUCourseDataOfMainBase $course_code</li> <li>$langBackupOfDataBase $course_code</li> </ol> </div> <div class='alert alert-success'>$langBackupSuccesfull</div>" . action_bar(array( array('title' => $langDownloadIt, 'url' => $urlAppend . "courses/archive/$course_code/$course_code-" . date('Ymd') . ".zip", 'icon' => 'fa-download',
} if ($handle === null || empty($handle)) { $form = new HTML_QuickForm2('karma_edit', 'post'); $form->removeAttribute('name'); include_once 'pear-database-user.php'; $list = user::listAll(true); $users = array(); foreach ($list as $user) { $users[$user['handle']] = $user['handle'] . ' (' . $user['name'] . ')'; } $form->addElement('select', 'handle')->setLabel('Handle: ')->loadOptions($users); $form->addElement('submit', 'submit')->setLabel('Submit Changes'); print $form; } else { if (!empty($_GET['action'])) { if (!validate_csrf_token($csrf_token_name)) { report_error('Invalid token.'); response_footer(); exit; } include_once 'pear-database-note.php'; switch ($_GET['action']) { case "remove": $res = $karma->remove($handle, $_GET['level']); if ($res) { echo "Successfully <b>removed</b> karma "" . htmlspecialchars($_GET['level']) . ""<br /><br />"; note::add($handle, 'removed ' . $_GET['level'] . ' karma', $auth_user->handle); } break; case "grant": $res = $karma->grant($handle, $_POST['level']);
echo '<table class="form-holder" style="margin-bottom: 2em;" cellspacing="1">'; echo '<caption class="form-caption">Confirm</caption>'; echo '<tr><td class="form-input">'; echo 'Are you sure that you want to delete the package?' . "</td></tr>\n"; echo '<tr><td class="form-input">'; report_error('Deleting the package will remove all package information' . ' and all releases!', 'warnings', 'WARNING:'); echo "</td></tr>\n"; echo '<td class="form-input">'; echo '<input type="submit" value="yes" name="confirm" />'; echo ' '; echo '<input type="submit" value="no" name="confirm" />'; echo "</td></tr>\n"; echo "</table>"; echo '<input type="hidden" value="' . create_csrf_token($csrf_token_name) . '" name="' . $csrf_token_name . '" />'; echo "</form>"; } elseif ($_POST['confirm'] == 'yes' && validate_csrf_token($csrf_token_name)) { // XXX: Implement backup functionality // make_backup($id); $tables = array('releases' => 'package', 'maintains' => 'package', 'deps' => 'package', 'files' => 'package', 'packages' => 'id'); echo "<pre>\n"; $file_rm = 0; $query = 'SELECT p.name, r.version FROM packages p, releases r WHERE p.id = r.package AND r.package = ?'; $row = $dbh->getAll($query, array($id)); foreach ($row as $value) { $file = sprintf("%s/%s-%s.tgz", PEAR_TARBALL_DIR, $value[0], $value[1]); if (@unlink($file)) { echo "Deleting release archive \"" . $file . "\"\n"; $file_rm++; } else { echo "<font color=\"#ff0000\">Unable to delete file " . $file . "</font>\n";
| obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Martin Jansen <*****@*****.**> | +----------------------------------------------------------------------+ $Id$ */ redirect_to_https(); @session_start(); $csrf_token_name = 'pear_csrf_token_' . basename(__FILE__, '.php'); auth_require('pear.admin'); response_header('PEAR Administration :: Package Approval'); echo "<h1>Package Approval</h1>\n"; // Approve package identified by its id if (!empty($_GET['approve']) || !empty($_GET['reject'])) { if (!validate_csrf_token($csrf_token_name, 'GET')) { report_error('Invalid token.'); response_footer(); exit; } if (!empty($_GET['approve'])) { $query = "UPDATE packages SET approved = 1 WHERE approved = 0 AND id = " . (int) $_GET['approve']; $id = $_GET['approve']; $action = "approved"; } elseif (!empty($_GET['reject'])) { $query = "DELETE FROM packages WHERE approved = 0 AND id = " . (int) $_GET['reject']; $id = $_GET['reject']; $action = "rejected"; } $res = $dbh->query($query); if (!PEAR::isError($res) && $dbh->affectedRows() > 0) {
/** * @brief display attendance users * @global type $tool_content * @global type $course_id * @global type $course_code * @global type $actID * @global type $langName * @global type $langSurname * @global type $langRegistrationDateShort * @global type $langAttendanceAbsences * @global type $langAm * @global type $langAttendanceEdit * @global type $langAttendanceBooking * @global type $langID * @param type $attendance_id */ function register_user_presences($attendance_id, $actID) { global $tool_content, $course_id, $course_code, $langAttendanceAutoBook, $langName, $langSurname, $langRegistrationDateShort, $langAttendanceAbsences, $langAm, $langAttendanceBooking, $langID, $langAttendanceEdit, $langCancel; $result = Database::get()->querySingle("SELECT * FROM attendance_activities WHERE id = ?d", $actID); $act_type = $result->auto; // type of activity $tool_content .= "<div class='alert alert-info'>" . $result->title . "</div>"; //record booking if(isset($_POST['bookUsersToAct'])) { if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error(); //get all the active users $activeUsers = Database::get()->queryArray("SELECT uid as userID FROM attendance_users WHERE attendance_id = ?d", $attendance_id); if ($activeUsers){ foreach ($activeUsers as $result) { $userInp = intval(@$_POST[$result->userID]); //get the record from the teacher (input name is the user id) // //check if there is record for the user for this activity $checkForBook = Database::get()->querySingle("SELECT COUNT(id) as count, id FROM attendance_book WHERE attendance_activity_id = ?d AND uid = ?d", $actID, $result->userID); if($checkForBook->count) { //update Database::get()->query("UPDATE attendance_book SET attend = ?d WHERE id = ?d ", $userInp, $checkForBook->id); } else { //insert Database::get()->query("INSERT INTO attendance_book SET uid = ?d, attendance_activity_id = ?d, attend = ?d, comments = ?s", $result->userID, $actID, $userInp, ''); } } Session::Messages($langAttendanceEdit,"alert-success"); redirect_to_home_page("modules/attendance/index.php"); } } //display users $resultUsers = Database::get()->queryArray("SELECT attendance_users.id AS recID, attendance_users.uid AS userID, user.surname AS surname, user.givenname AS name, user.am AS am, course_user.reg_date AS reg_date FROM attendance_users, user, course_user WHERE attendance_id = ?d AND attendance_users.uid = user.id AND `user`.id = `course_user`.`user_id` AND `course_user`.`course_id` = ?d ", $attendance_id, $course_id); if ($resultUsers) { //table to display the users $tool_content .= "<div class='form-wrapper'> <form class='form-horizontal' id='user_attendances_form' method='post' action='$_SERVER[SCRIPT_NAME]?course=$course_code&attendance_id=$attendance_id&ins=" . getIndirectReference($actID) . "'> <table id='users_table{$course_id}' class='table-default custom_list_order'> <thead> <tr> <th class='text-center' width='5%'>$langID</th> <th class='text-left'>$langName $langSurname</th> <th>$langAm</th> <th class='text-center'>$langRegistrationDateShort</th> <th class='text-center'>$langAttendanceAbsences</th> </tr> </thead> <tbody>"; $cnt = 0; foreach ($resultUsers as $resultUser) { $cnt++; $tool_content .= "<tr> <td class='text-center'>$cnt</td> <td> " . display_user($resultUser->userID). "</td> <td>$resultUser->am</td> <td class='text-center'>" . nice_format($resultUser->reg_date, true, true) . "</td> <td class='text-center'><input type='checkbox' value='1' name='userspresence[$resultUser->userID]'"; //check if the user has attendace for this activity already OR if it should be automatically inserted here $q = Database::get()->querySingle("SELECT attend FROM attendance_book WHERE attendance_activity_id = ?d AND uid = ?d", $actID, $resultUser->userID); if(isset($q->attend) && $q->attend == 1) { $tool_content .= " checked"; } $tool_content .= "><input type='hidden' value='" . getIndirectReference($actID) . "' name='actID'></td>"; $tool_content .= "</tr>"; } $tool_content .= "</tbody></table>"; $tool_content .= "<div class='form-group'>"; $tool_content .= "<div class='col-xs-12'>" . form_buttons(array( array( 'text' => $langAttendanceBooking, 'name' => 'bookUsersToAct', 'value'=> $langAttendanceBooking ))). "<a href='index.php?course=$course_code&attendance_id=" . $attendance_id . "' class='btn btn-default'>$langCancel</a>"; // if ($act_type == 1) { // $tool_content .= form_buttons(array( // array( // 'text' => $langAttendanceAutoBook, // 'name' => 'updateUsersToAct', // 'value'=> $langAttendanceAutoBook // ))); // } $tool_content .= "</div></div>"; $tool_content .= generate_csrf_token_form_field() ."</form></div>"; $tool_content .= "</tbody></table>"; } }