echo htmlspecialchars($group['mail']); ?> <br /> <?php } ?> </div> </div> <?php } ?> </div> <?php if ($is_admin) { ?> <p> <a href="<?php echo Config::URL_ROOT . Routes::getPage('group_add'); ?> "><img src="<?php echo Config::URL_STATIC; ?> images/icons/add.png" alt="" class="icon" /> <?php echo __('GROUP_ADD'); ?> </a> </p> <?php }
echo __('GROUP_EDIT_FORM_MEMBER_ADMIN'); ?> </label> </li> <?php } ?> </ul> <label for="group_edit_add_member"><?php echo __('GROUP_EDIT_FORM_ADD_MEMBER'); ?> </label> <input type="text" name="" id="group_edit_add_member" value="" /> <input type="hidden" name="" id="group_edit_add_member_url" value="<?php echo Config::URL_ROOT . Routes::getPage('autocompletion_student_name'); ?> " /> </div> <br /> <input type="submit" value="<?php echo __('GROUP_EDIT_FORM_SUBMIT'); ?> " /> </div> </form> </div>
echo Config::URL_ROOT . Routes::getPage('admin', array("nav" => "admins")); ?> " method="post" id="form_admins"> <input type="hidden" name="type" value="students" id="type" /> <label for="admin_edit_add_admin"><?php echo __('GROUP_EDIT_FORM_ADD_MEMBER'); ?> </label> <input type="text" size="25" style="margin: 5px;" name="admin_edit_add_admin" id="admin_edit_add_admin" value="" class="autocomplete" autocomplete="off"/> <span id="error-com" class="error hidden" ><?php echo __('ISEPOR_ERROR_AUTOCOMPLETE'); ?> </span> <span id="error-nan" class="error hidden" ><?php echo __('ISEPOR_ERROR_NOT_EXIST'); ?> </span> <input type="hidden" name="url" id="admin_edit_add_admin_url" value="<?php echo Config::URL_ROOT . Routes::getPage('autocomplete_isepor'); ?> " /> <input class="valid" type="hidden" name="valid-students" id="valid" value="" /> <br/><input type="submit" value="<?php echo __('ADMIN_ENVOYER'); ?> "/> </form> <br/><br/>
</div> <?php } ?> </div> <div id="showlistpodcast" class="hidden"> <?php for ($i = 0; $i < count($annee4); $i++) { $bloc = ""; $bloc2 = ""; $bloc3 = ""; for ($a = 0; $a <= count($mediaannee4['' . $annee4[$i] . '']); $a++) { if (isset($mediaannee4['' . $annee4[$i] . ''][$a])) { $id = $mediaannee4['' . $annee4[$i] . ''][$a]; if (isset($mediamessage4[$id]) && isset($categorie[$id])) { $route = Config::URL_ROOT . Routes::getPage('post', array('id' => $id)); $title = str_split($mediamessage4[$id], 35); $category = $categorie[$id]; if (isset($title[1]) && $title[1] != "") { $etc = "..."; } else { $etc = ""; } $spanline = round(count($mediaannee4['' . $annee4[$i] . '']) / 3); $icon = "<img src='" . Config::URL_STATIC . "images/icons/attachment_podcast.png' alt='' class='icon' /> "; if ($id != 0) { if ($a <= $spanline) { $bloc .= $icon . "<a href='" . $route . "' title=\"" . $mediamessage4[$id] . "\">" . $title[0] . $etc . "</a><br/>"; } elseif ($a <= 2 * $spanline) { $bloc2 .= $icon . "<a href='" . $route . "' title=\"" . $mediamessage4[$id] . "\">" . $title[0] . $etc . "</a><br/>"; } else {
/** * Add a post */ public function iframe_add() { $this->setView('iframe_add.php'); @set_time_limit(0); $uploaded_files = array(); try { if (!isset(User_Model::$auth_data)) { throw new Exception(__('POST_ADD_ERROR_SESSION_EXPIRED')); } $is_student = isset(User_Model::$auth_data['student_number']); // Message $message = isset($_POST['message']) ? trim($_POST['message']) : ''; if ($message == '' || $message == __('PUBLISH_DEFAULT_MESSAGE')) { throw new Exception(__('POST_ADD_ERROR_NO_MESSAGE')); } $message = preg_replace('#\\n{2,}#', "\n\n", $message); // Category if (!isset($_POST['category']) || !ctype_digit($_POST['category'])) { throw new Exception(__('POST_ADD_ERROR_NO_CATEGORY')); } $category = (int) $_POST['category']; // Official post (in a group) $official = isset($_POST['official']); // Group $group = isset($_POST['group']) && ctype_digit($_POST['group']) ? (int) $_POST['group'] : 0; if ($group == 0) { $group = null; $official = false; } else { $groups_auth = Group_Model::getAuth(); if (isset($groups_auth[$group])) { if ($official && !$groups_auth[$group]['admin']) { throw new Exception(__('POST_ADD_ERROR_OFFICIAL')); } } else { throw new Exception(__('POST_ADD_ERROR_GROUP_NOT_FOUND')); } } // Private message $private = isset($_POST['private']); if ($private && !$is_student) { throw new Exception(__('POST_ADD_ERROR_PRIVATE')); } $attachments = array(); // Photos if (isset($_FILES['attachment_photo']) && is_array($_FILES['attachment_photo']['name'])) { foreach ($_FILES['attachment_photo']['size'] as $size) { if ($size > Config::UPLOAD_MAX_SIZE_PHOTO) { throw new Exception(__('POST_ADD_ERROR_PHOTO_SIZE', array('size' => File::humanReadableSize(Config::UPLOAD_MAX_SIZE_PHOTO)))); } } if ($filepaths = File::upload('attachment_photo')) { foreach ($filepaths as $filepath) { $uploaded_files[] = $filepath; } foreach ($filepaths as $i => $filepath) { $name = isset($_FILES['attachment_photo']['name'][$i]) ? $_FILES['attachment_photo']['name'][$i] : ''; try { $img = new Image(); $img->load($filepath); $type = $img->getType(); if ($type == IMAGETYPE_JPEG) { $ext = 'jpg'; } else { if ($type == IMAGETYPE_GIF) { $ext = 'gif'; } else { if ($type == IMAGETYPE_PNG) { $ext = 'png'; } else { throw new Exception(); } } } if ($img->getWidth() > 800) { $img->setWidth(800, true); } $img->save($filepath); // Thumb $thumbpath = $filepath . '.thumb'; $img->thumb(Config::$THUMBS_SIZES[0], Config::$THUMBS_SIZES[1]); $img->setType(IMAGETYPE_JPEG); $img->save($thumbpath); unset($img); $attachments[] = array($filepath, $name, $thumbpath); $uploaded_files[] = $thumbpath; } catch (Exception $e) { throw new Exception(__('POST_ADD_ERROR_PHOTO_FORMAT')); } } } } // Vidéos /* @uses PHPVideoToolkit : http://code.google.com/p/phpvideotoolkit/ * @requires ffmpeg, php5-ffmpeg */ if (isset($_FILES['attachment_video']) && is_array($_FILES['attachment_video']['name'])) { foreach ($_FILES['attachment_video']['size'] as $size) { if ($size > Config::UPLOAD_MAX_SIZE_VIDEO) { throw new Exception(__('POST_ADD_ERROR_VIDEO_SIZE', array('size' => File::humanReadableSize(Config::UPLOAD_MAX_SIZE_VIDEO)))); } } if ($filepaths = File::upload('attachment_video')) { foreach ($filepaths as $filepath) { $uploaded_files[] = $filepath; } foreach ($filepaths as $i => $filepath) { $name = isset($_FILES['attachment_video']['name'][$i]) ? $_FILES['attachment_video']['name'][$i] : ''; try { $video = new ffmpeg_movie($filepath, false); if (!$video->hasVideo()) { throw new Exception('No video stream found in the file'); } if (!$video->hasAudio()) { throw new Exception('No audio stream found in the file'); } } catch (Exception $e) { throw new Exception(__('POST_ADD_ERROR_VIDEO_FORMAT')); } // Video conversion try { $video_current_width = $video->getFrameWidth(); $video_width = min($video_current_width, Config::VIDEO_MAX_WIDTH); if ($video_width % 2 == 1) { // Even number required $video_width--; } $video_height = $video_width * $video->getFrameHeight() / $video_current_width; if ($video_height % 2 == 1) { // Even number required $video_height--; } // Extract thumb $video_thumb = $video->getFrame(round($video->getFrameCount() * 0.2)); unset($video); $video_thumb = $video_thumb->toGDImage(); $thumbpath = DATA_DIR . Config::DIR_DATA_TMP . File::getName($filepath) . '.thumb'; imagejpeg($video_thumb, $thumbpath, 95); unset($video_thumb); $img = new Image(); $img->load($thumbpath); $img->setWidth($video_width, true); $img->setType(IMAGETYPE_JPEG); $img->save($thumbpath); $uploaded_files[] = $thumbpath; unset($img); // Convert to FLV if (!preg_match('#\\.flv$#i', $filepath)) { $toolkit = new PHPVideoToolkit(); $toolkit->on_error_die = true; // Will throw exception on error $toolkit->setInputFile($filepath); $toolkit->setVideoOutputDimensions($video_width, $video_height); $toolkit->setFormatToFLV(Config::VIDEO_SAMPLING_RATE, Config::VIDEO_AUDIO_BIT_RATE); $toolkit->setOutput(DATA_DIR . Config::DIR_DATA_TMP, File::getName($filepath) . '.flv', PHPVideoToolkit::OVERWRITE_EXISTING); $toolkit->execute(false, false); // Multipass: false, Log: false File::delete($filepath); $filepath = $toolkit->getLastOutput(); $filepath = $filepath[0]; unset($toolkit); } $attachments[] = array($filepath, $name, $thumbpath); $uploaded_files[] = $filepath; } catch (Exception $e) { throw new Exception(__('POST_ADD_ERROR_VIDEO_CONVERT') . $e->getMessage()); } } } } // Audios if (isset($_FILES['attachment_audio']) && is_array($_FILES['attachment_audio']['name'])) { foreach ($_FILES['attachment_audio']['size'] as $size) { if ($size > Config::UPLOAD_MAX_SIZE_AUDIO) { throw new Exception(__('POST_ADD_ERROR_AUDIO_SIZE', array('size' => File::humanReadableSize(Config::UPLOAD_MAX_SIZE_AUDIO)))); } } if ($filepaths = File::upload('attachment_audio')) { foreach ($filepaths as $filepath) { $uploaded_files[] = $filepath; } foreach ($filepaths as $i => $filepath) { if (!preg_match('#\\.mp3$#', $filepath)) { throw new Exception(__('POST_ADD_ERROR_AUDIO_FORMAT')); } $name = isset($_FILES['attachment_audio']['name'][$i]) ? $_FILES['attachment_audio']['name'][$i] : ''; $attachments[] = array($filepath, $name); } } } // Files if (isset($_FILES['attachment_file']) && is_array($_FILES['attachment_file']['name'])) { foreach ($_FILES['attachment_file']['size'] as $size) { if ($size > Config::UPLOAD_MAX_SIZE_FILE) { throw new Exception(__('POST_ADD_ERROR_FILE_SIZE', array('size' => File::humanReadableSize(Config::UPLOAD_MAX_SIZE_FILE)))); } } if ($filepaths = File::upload('attachment_file')) { foreach ($filepaths as $filepath) { $uploaded_files[] = $filepath; } foreach ($filepaths as $i => $filepath) { if (!preg_match('#\\.[a-z0-9]{2,4}$#i', $filepath)) { throw new Exception(__('POST_ADD_ERROR_FILE_FORMAT')); } if (preg_match('#\\.(jpg|png|gif|mp3|flv)$#i', $filepath)) { throw new Exception(__('POST_ADD_ERROR_FILE_FORMAT2')); } $name = isset($_FILES['attachment_file']['name'][$i]) ? $_FILES['attachment_file']['name'][$i] : ''; $attachments[] = array($filepath, $name); } } } // Event if (isset($_POST['event_title']) && isset($_POST['event_start']) && isset($_POST['event_end'])) { // Title $event_title = trim($_POST['event_title']); if ($event_title == '') { throw new Exception(__('POST_ADD_ERROR_EVENT_NO_TITLE')); } // Dates if (!($event_start = strptime($_POST['event_start'], __('PUBLISH_EVENT_DATE_FORMAT')))) { throw new Exception(__('POST_ADD_ERROR_EVENT_DATE')); } if (!($event_end = strptime($_POST['event_end'], __('PUBLISH_EVENT_DATE_FORMAT')))) { throw new Exception(__('POST_ADD_ERROR_EVENT_DATE')); } $event_start = mktime($event_start['tm_hour'], $event_start['tm_min'], 0, $event_start['tm_mon'] + 1, $event_start['tm_mday'], $event_start['tm_year'] + 1900); $event_end = mktime($event_end['tm_hour'], $event_end['tm_min'], 0, $event_end['tm_mon'] + 1, $event_end['tm_mday'], $event_end['tm_year'] + 1900); if ($event_start > $event_end) { throw new Exception(__('POST_ADD_ERROR_EVENT_DATE_ORDER')); } $event = array($event_title, $event_start, $event_end); } else { $event = null; } // Survey if (isset($_POST['survey_question']) && isset($_POST['survey_end']) && isset($_POST['survey_answer']) && is_array($_POST['survey_answer'])) { // Question $survey_question = trim($_POST['survey_question']); if ($survey_question == '') { throw new Exception(__('POST_ADD_ERROR_SURVEY_NO_QUESTION')); } // Date if (!($survey_end = strptime($_POST['survey_end'], __('PUBLISH_EVENT_DATE_FORMAT')))) { throw new Exception(__('POST_ADD_ERROR_SURVEY_DATE')); } $survey_end = mktime($survey_end['tm_hour'], $survey_end['tm_min'], 0, $survey_end['tm_mon'] + 1, $survey_end['tm_mday'], $survey_end['tm_year'] + 1900); // Multiple answers $survey_multiple = isset($_POST['survey_multiple']); // Answers $survey_answers = array(); foreach ($_POST['survey_answer'] as $survey_answer) { $survey_answer = trim($survey_answer); if ($survey_answer != '') { $survey_answers[] = $survey_answer; } } if (count($survey_answers) < 2) { throw new Exception(__('POST_ADD_ERROR_SURVEY_ANSWERS')); } $survey = array($survey_question, $survey_end, $survey_multiple, $survey_answers); } else { $survey = null; } // Creation of the post $id = $this->model->addPost((int) User_Model::$auth_data['id'], $message, $category, $group, $official, $private); // Attach files foreach ($attachments as $attachment) { $this->model->attachFile($id, $attachment[0], $attachment[1], isset($attachment[2]) ? $attachment[2] : null); } // Event if (isset($event)) { $this->model->attachEvent($id, $event[0], $event[1], $event[2]); } // Survey if (isset($survey)) { $this->model->attachSurvey($id, $survey[0], $survey[1], $survey[2], $survey[3]); } $this->addJSCode(' parent.location = "' . Config::URL_ROOT . Routes::getPage('home') . '"; '); } catch (Exception $e) { // Delete all uploading files in tmp foreach ($uploaded_files as $uploaded_file) { File::delete($uploaded_file); } $this->addJSCode(' with(parent){ Post.errorForm(' . json_encode($e->getMessage()) . '); } '); } }
<?php if ($empty_post) { ?> <div id="isepor"> <h1><?php echo __('ISEPOR_TITLE'); ?> </h1> <p style="width: 500px; margin-bottom: 20px;"> <?php echo __('ISEPOR_TEXT'); ?> </p> <form method="post" action="<?php echo Config::URL_ROOT . Routes::getPage('isep_or_2'); ?> " id="form-isepor-final" > <?php foreach ($questions as $question) { ?> <div id="question-<?php echo $question['id']; ?> "> <h2><?php echo htmlspecialchars($question['questions']); ?> :</h2> <p style="margin: 5px;" itemid="<?php echo $question['id'];
} } ?> </table> <br /> <a href="<?php echo Config::URL_ROOT . Routes::getPage('ical_official', isset($calendar_group) ? array('group' => $calendar_group) : null); ?> "><img src="<?php echo Config::URL_STATIC; ?> images/icons/event.png" alt="" class="icon" /> <?php echo __('CALENDAR_ICAL_OFFICIAL'); ?> </a><br /> <?php if ($is_student) { ?> <a href="<?php echo Config::URL_ROOT . Routes::getPage('ical_non_official', isset($calendar_group) ? array('group' => $calendar_group) : null); ?> "><img src="<?php echo Config::URL_STATIC; ?> images/icons/event.png" alt="" class="icon" /> <?php echo __('CALENDAR_ICAL_NON_OFFICIAL'); ?> </a> <?php }
<div class="students-promo" > <h2><?php echo __('STUDENTS_PROMO') . ' ' . $year; ?> </h2> <?php if (!isset($students[$year])) { $students[$year] = array(); } foreach ($students[$year] as $student) { ?> <a id="<?php echo $student['student_number']; ?> " href="<?php echo Config::URL_ROOT . Routes::getPage('student', array('username' => $student['username'])); ?> " onmouseover="Student.showThumb(this,'<?php echo $student['avatar_url']; ?> ','<?php echo $student['student_number']; ?> ','<?php echo $student['promo']; ?> ')" onmouseout="Student.hiddeThumb();"> <?php echo htmlspecialchars($student['firstname'] . ' ' . $student['lastname']); ?> </a><br />
<?php $data = array(); $data[] = array('value' => '<img src="' . Config::URL_STATIC . 'images/icons/search.png" alt="" class="icon" /> ' . $query, 'url' => Config::URL_ROOT . Routes::getPage('search') . '?q=' . urlencode($query)); foreach ($results as &$result) { switch ($result['_type']) { case 'student': $data[] = array('value' => '<img src="' . Config::URL_STATIC . 'images/icons/user.png" alt="" class="icon" /> ' . htmlspecialchars($result['_source']['firstname'] . ' ' . $result['_source']['lastname']), 'url' => Config::URL_ROOT . Routes::getPage('student', array('username' => $result['_id']))); break; case 'group': $data[] = array('value' => '<img src="' . Config::URL_STATIC . 'images/icons/group.png" alt="" class="icon" /> ' . htmlspecialchars($result['_source']['name']), 'url' => Config::URL_ROOT . Routes::getPage('group', array('group' => $result['_source']['url_name']))); break; case 'post': $data[] = array('value' => '<img src="' . Config::URL_STATIC . 'images/icons/post.png" alt="" class="icon" /> ' . htmlspecialchars(Text::summary($result['_source']['message'], 140, '...', $query)), 'url' => Config::URL_ROOT . Routes::getPage('post', array('id' => $result['_id']))); break; } } echo json_encode($data);
<h1><?php echo __('ADMIN_RECONFIRM') . " " . $user; ?> </h1> <form action="<?php echo Config::URL_ROOT . Routes::getPage('admin', array("nav" => $url)); ?> " method="post" id="form_admins"> <label><?php echo __('SIGNIN_PASSWORD'); ?> </label><input type="password" name="reconfpassword"/> </form>
public function addAttachment($param) { $this->setView('iframe_add.php'); $is_logged = isset(User_Model::$auth_data); $is_admin = $is_logged && User_Model::$auth_data['admin'] == '1'; @set_time_limit(0); $uploaded_files = array(); $attachments = array(); try { if ($is_admin && isset($param['id']) && isset($_FILES['attachment_photo']) && is_array($_FILES['attachment_photo']['name'])) { foreach ($_FILES['attachment_photo']['size'] as $size) { if ($size > Config::UPLOAD_MAX_SIZE_PHOTO) { throw new Exception(__('POST_ADD_ERROR_PHOTO_SIZE', array('size' => File::humanReadableSize(Config::UPLOAD_MAX_SIZE_PHOTO)))); } } if ($filepaths = File::upload('attachment_photo')) { foreach ($filepaths as $filepath) { $uploaded_files[] = $filepath; } foreach ($filepaths as $i => $filepath) { $name = isset($_FILES['attachment_photo']['name'][$i]) ? $_FILES['attachment_photo']['name'][$i] : ''; try { $img = new Image(); $img->load($filepath); $type = $img->getType(); if ($type == IMAGETYPE_JPEG) { $ext = 'jpg'; } else { if ($type == IMAGETYPE_GIF) { $ext = 'gif'; } else { if ($type == IMAGETYPE_PNG) { $ext = 'png'; } else { throw new Exception(); } } } if ($img->getWidth() > 800) { $img->setWidth(800, true); } $img->save($filepath); // Thumb $thumbpath = $filepath . '.thumb'; $img->thumb(Config::$THUMBS_SIZES[0], Config::$THUMBS_SIZES[1]); $img->setType(IMAGETYPE_JPEG); $img->save($thumbpath); unset($img); $attachments[] = array($filepath, $name, $thumbpath); $uploaded_files[] = $thumbpath; } catch (Exception $e) { throw new Exception(__('POST_ADD_ERROR_PHOTO_FORMAT')); } } } // Attach files foreach ($attachments as $attachment) { $this->model->attachFile($param['id'], $attachment[0], $attachment[1], isset($attachment[2]) ? $attachment[2] : null); } $this->addJSCode(' parent.location = "' . Config::URL_ROOT . Routes::getPage('post', array('id' => $param['id'])) . '"; '); } Post_Model::clearCache(); } catch (Exception $e) { // Delete all uploading files in tmp foreach ($uploaded_files as $uploaded_file) { File::delete($uploaded_file); } $this->addJSCode(' with(parent){ Post.errorForm(' . json_encode($e->getMessage()) . '); } '); } }
public function isepdorPage($param) { $this->setView('isepdor.php'); $questions = $this->model->getquestions(); for ($i = 0; $i < count($questions); $i++) { $type = explode(',', $questions[$i]["type"]); $tab = array("students", "associations", "employees", "events"); $result = array_intersect($type, $tab); if (in_array("students", $result)) { $questions[$i]["students"] = 1; } else { $questions[$i]["students"] = 0; } if (in_array("events", $result)) { $questions[$i]["events"] = 1; } else { $questions[$i]["events"] = 0; } if (in_array("associations", $result)) { $questions[$i]["associations"] = 1; } else { $questions[$i]["associations"] = 0; } if (in_array("employees", $result)) { $questions[$i]["employees"] = 1; } else { $questions[$i]["employees"] = 0; } if ($questions[$i]["extra"] == null) { $questions[$i]["extra"] = " "; } } $events = $this->model->getevents(); for ($i = 0; $i < count($events); $i++) { if ($events[$i]['extra'] == "soiree") { $events[$i]['extra'] = 1; } else { $events[$i]['extra'] = 0; } } $myFile = DATA_DIR . Config::DIR_DATA_STORAGE . Config::DIR_DATA_ADMIN . "/diplome.json"; $file = fopen($myFile, 'r'); $positions = fread($file, filesize($myFile)); fclose($file); $this->addJSCode(' Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxcore.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxdata.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxbuttons.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxscrollbar.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxmenu.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.edit.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.selection.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.sort.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.filter.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.columnsresize.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxlistbox.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxdropdownlist.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxcheckbox.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxcombobox.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxgrid.pager.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxdragdrop.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxcalendar.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxtooltip.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxdatetimeinput.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jquery.global.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jquery.glob.fr-FR.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/jqx/jqxtabs.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/crop/jquery.Jcrop.min.js","js"); Admin.loadjscssfile("' . Config::URL_STATIC . 'js/crop/jquery.color.js","js"); jQuery(document).ready(function () { diplomeData=new Array(); Admin.loadTab(); Admin.loadCrop(); Admin.loadCatGrid(' . json_encode($questions) . '); Admin.loadEventGrid(' . json_encode($events) . '); Admin.loadEmployGrid(' . json_encode($this->model->getemployees()) . '); Admin.loadDate(' . json_encode($this->model->getDate()) . '); jQuery(".jcrop-holder").ready(function () { Admin.loadDiplome(' . $positions . '); }); jQuery("#adminIsepdorTab").removeClass("hidden"); }); '); /* Code qui met à jour le questionnaire pour les ISEP D'or * */ if (isset($_POST['categories'])) { $id = array(); $post = json_decode($_POST['categories'], true); for ($i = 0; $i < count($post); $i++) { if (is_numeric($post[$i]['id'])) { array_push($id, $post[$i]['id']); } } $toDelete = $this->model->checkIsepdorQuestions($id); if (count($toDelete) > 0) { for ($i = 0; $i < count($toDelete); $i++) { $this->model->deleteQuestions($toDelete[$i]); } } for ($i = 0; $i < count($post); $i++) { if ($post[$i]['extra'] == "") { $post[$i]['extra'] = NULL; } if ($post[$i]['id'] != "") { $this->model->updateisepdor($post[$i]['type'], $post[$i]['extra'], $post[$i]['questions'], $post[$i]['id'], $post[$i]['position']); } elseif ($post[$i]['id'] == "") { $this->model->insertisepdor($post[$i]['type'], $post[$i]['extra'], $post[$i]['questions'], $post[$i]['position']); } } } /*Code qui met à jour la table isepdor_employees * */ if (isset($_POST['employees'])) { $id = array(); $post = json_decode($_POST['employees'], true); for ($i = 0; $i < count($post); $i++) { if (is_numeric($post[$i]['id'])) { array_push($id, $post[$i]['id']); } } $toDelete = $this->model->checkIsepdorEmployees($id); if (count($toDelete) > 0) { for ($i = 0; $i < count($toDelete); $i++) { $this->model->deleteEmployees($toDelete[$i]); } } for ($i = 0; $i < count($post); $i++) { $username = $this->makeusername($post[$i]['lastname'], $post[$i]['firstname']); if ($post[$i]['id'] != "") { $this->model->updateEmployees($post[$i]['lastname'], $post[$i]['firstname'], $post[$i]['id'], $username); } elseif ($post[$i]['id'] == "") { $this->model->insertemployees($post[$i]['lastname'], $post[$i]['firstname'], $username); } } } /*Code qui met à jour la table isepdor_event * */ if (isset($_POST['events'])) { $id = array(); $post = json_decode($_POST['events'], true); for ($i = 0; $i < count($post); $i++) { if (is_numeric($post[$i]['id'])) { array_push($id, $post[$i]['id']); } } $toDelete = $this->model->checkIsepdorEvents($id); if (count($toDelete) > 0) { for ($i = 0; $i < count($toDelete); $i++) { $this->model->deleteEvents($toDelete[$i]); } } for ($i = 0; $i < count($post); $i++) { if ($post[$i]['extra'] == 1) { $post[$i]['extra'] = "soiree"; } else { $post[$i]['extra'] = NULL; } if ($post[$i]['id'] != "") { $this->model->updateEvent($post[$i]['name'], $post[$i]['id'], $post[$i]['extra']); } elseif ($post[$i]['id'] == "") { $this->model->insertEvent($post[$i]['name'], $post[$i]['extra']); } } } /*Code qui met à jour les date de vote des isep d'or * */ if (isset($_POST['dates'])) { $post = json_decode($_POST['dates'], true); $this->model->insertDate($post[0][0], $post[0][1], $post[1][0], $post[1][1], $post[2][0], $post[2][1]); } /* * Change l'image diplome */ if (isset($_FILES['diplome']) && !is_array($_FILES['diplome']['name'])) { if ($_FILES['diplome']['size'] > Config::UPLOAD_MAX_SIZE_PHOTO) { throw new FormException('size'); } if ($avatarpath = File::upload('diplome')) { $uploaded_files[] = $avatarpath; try { $img = new Image(); $img->load($avatarpath); $type = $img->getType(); if ($type == IMAGETYPE_JPEG) { $ext = 'jpg'; } else { if ($type == IMAGETYPE_GIF) { $ext = 'gif'; } else { if ($type == IMAGETYPE_PNG) { $ext = 'png'; } else { throw new Exception(); } } } if ($img->getHeight() != 794 || $img->getWidth() != 1122) { throw new FormException('width'); } $img->setType($type); $img->save($avatarpath); unset($img); if (isset($avatarpath) && File::exists($avatarpath)) { $avatar_path = DATA_DIR . Config::DIR_DATA_STORAGE . Config::DIR_DATA_ADMIN . "diplomeIsepDOr9652.png"; $avatar_dir = File::getPath($avatar_path) . "/diplomeIsepDOr9652.png"; File::rename($avatarpath, $avatar_dir); } } catch (FormException $e) { $this->set('form_error', $e->getError()); } foreach ($uploaded_files as $uploaded_file) { File::delete($uploaded_file); } } Post_Model::clearCache(); } /* * Enregistre les coordonnées */ if (isset($_POST['diplomeData'])) { $post = $_POST['diplomeData']; $file = fopen($myFile, 'w'); fwrite($file, $post); fclose($file); } /* * Envoie les diplomes */ if (isset($_GET['getDiplome'])) { $template = DATA_DIR . Config::DIR_DATA_STORAGE . Config::DIR_DATA_ADMIN . "diplomeIsepDOr9652.png"; $font = DATA_DIR . Config::DIR_DATA_STORAGE . Config::DIR_DATA_ADMIN . "font2354.ttf"; $files = array(); $positions = json_decode($positions, true); //récupere les coordonnées précédament demandées for ($i = 0; $i < count($positions); $i++) { $coord[$positions[$i]['index']] = $positions[$i]; } $questions = IsepOr_Model::fetchQuestions(); foreach ($questions as $value) { if (strpos($value['type'], ',')) { $data = array(); foreach (explode(',', $value['type']) as $type) { $data = IsepOr_Controller::__array_rePad($data, IsepOr_Model::fetchFinals($value['id'], $type, 2)); } $finalList[$value['id']] = array_slice(IsepOr_Controller::__array_orderby($data, 'cmpt', SORT_DESC), 0, 3); } else { $finalList[$value['id']] = IsepOr_Model::fetchFinals($value['id'], $value['type'], 2); } } for ($i = 0; $i < count($questions); $i++) { for ($j = 0; $j < count($finalList[$questions[$i]['id']]); $j++) { File::copy($template, DATA_DIR . Config::DIR_DATA_TMP . "diplome" . $i . $j . ".png"); array_push($files, DATA_DIR . Config::DIR_DATA_TMP . "diplome" . $i . $j . ".png"); $im = ImageCreateFromPng(DATA_DIR . Config::DIR_DATA_TMP . "diplome" . $i . $j . ".png"); // Path Images $color = ImageColorAllocate($im, 0, 0, 0); // Text Color $champs[0] = $questions[$i]['questions']; $champs[1] = $finalList[$questions[$i]['id']][$j]["name"]; $champs[2] = ""; if (!is_numeric($finalList[$questions[$i]['id']][$j]["valid"])) { $champs[2] = $this->model->getBirthDay($finalList[$questions[$i]['id']][$j]["valid"]); } for ($a = 0; $a < 3; $a++) { $pxX = round($coord[$a]['x1']); // X $pxY = round($coord[$a]['y2']); // Y ImagettfText($im, round($coord[$a]['h']), 0, $pxX, $pxY, $color, $font, $champs[$a]); } imagePng($im, DATA_DIR . Config::DIR_DATA_TMP . "diplome" . $i . $j . ".png", 9); ImageDestroy($im); if ($finalList[$questions[$i]['id']][$j]['cmpt'] != $finalList[$questions[$i]['id']][$j + 1]['cmpt']) { break; } } } if (self::create_zip($files, DATA_DIR . Config::DIR_DATA_TMP . "diplomesIsepDor.zip", true)) { foreach ($files as $file) { File::delete($file); } header($_SERVER["SERVER_PROTOCOL"] . " 200 OK"); header("Cache-Control: public"); // needed for i.e. header("Content-Type: application/zip"); header("Content-Transfer-Encoding: Binary"); header("Content-Length:" . filesize(DATA_DIR . Config::DIR_DATA_TMP . "diplomesIsepDor.zip")); header("Content-Disposition: attachment; filename=diplomesIsepDor.zip"); readfile(DATA_DIR . Config::DIR_DATA_TMP . "diplomesIsepDor.zip"); File::delete(DATA_DIR . Config::DIR_DATA_TMP . "diplomesIsepDor.zip"); die; } foreach ($files as $file) { File::delete($file); } } /*Code qui export les résultats des isep d'or * */ if (isset($_GET['export'])) { $db = $this->model->getResult(); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: filename=' . 'Résultats_Isepdor' . '.xls'); header('Pragma: no-cache'); header('Expires: 0'); print '<table border=1 > <!-- impression des titres de colonnes --> <TR> <TD bgcolor="#3366CC">Tour</TD> <TD bgcolor="#3366CC">Nom du votant</TD> <TD bgcolor="#3366CC">Catégorie</TD> <TD bgcolor="#3366CC">Réponse(student)</TD> <TD bgcolor="#3366CC">Réponse(admin)</TD> <TD bgcolor="#3366CC">Réponse(assoce)</TD> <TD bgcolor="#3366CC">Réponse(event)</TD> </TR> '; foreach ($db as $champs) { print '<TR>'; print '<TD>' . $champs['round'] . '</TD>'; print '<TD>' . $champs['username'] . '</TD>'; print '<TD>' . utf8_decode($champs['questions']) . '</TD>'; print '<TD>' . $champs['student_username'] . '</TD>'; print '<TD>' . utf8_decode($champs['admin']) . '</TD>'; print '<TD>' . utf8_decode($champs['assoce']) . '</TD>'; print '<TD>' . utf8_decode($champs['name']) . '</TD>'; print '</TR>'; } print '</table>'; exit; } /* * Ajout de la police */ if (isset($_FILES['font']) && $_FILES['font']['name'] != null) { if ($_FILES['font']['size'] > Config::UPLOAD_MAX_SIZE_FILE) { throw new Exception(__('POST_ADD_ERROR_FILE_SIZE', array('size' => File::humanReadableSize(Config::UPLOAD_MAX_SIZE_FILE)))); } if ($filepaths = File::upload('font')) { if (!preg_match('#\\.ttf$#i', $filepaths)) { throw new Exception(__('POST_ADD_ERROR_FILE_FORMAT')); } $avatar_path = DATA_DIR . Config::DIR_DATA_STORAGE . Config::DIR_DATA_ADMIN . "font2354.ttf"; $avatar_dir = File::getPath($avatar_path) . "/font2354.ttf"; File::rename($filepaths, $avatar_dir); } else { throw new Exception(__('ADMIN_UPLOAD_ERROR')); } } /*Code qui met supprime les champs de la table résultat des isep d'or * */ if (isset($_GET['delete_result'])) { $this->model->deleteresult(); header("Location: " . Config::URL_ROOT . Routes::getPage('admin', array("nav" => "isepdor"))); } }
</li> <li><?php echo __('ADMIN_ISEPDOR_LASTNAME'); ?> </li> <li><?php echo __('ADMIN_ISEPDOR_BORN'); ?> </li> </ul> <div id="diplomeCat"> </div> <div id="diplomeName"> </div> <div id="diplomeBirth"> </div> </div> <a id="saveDiplome" style="cursor:pointer;margin-right:10px,right:5px" > <img alt="" style="position:relative;top:3px;"src="<?php echo Config::URL_STATIC . "images/icons/post.png"; ?> "/> <?php echo __('USER_EDIT_FORM_SUBMIT'); ?> </a><br/> </div> </div> </div> <input id="pageUrl" type="hidden" value="<?php echo Config::URL_ROOT . Routes::getPage('admin', array("nav" => "isepdor")); ?> " />
echo Config::URL_ROOT . Routes::getPage('group', array('group' => $group['url_name'])); ?> "<?php if (!isset($current_category)) { echo ' class="active"'; } ?> ><?php echo __('POST_CATEGORIES_ALL'); ?> </a></li> <?php foreach ($categories as $category) { ?> <li><a href="<?php echo Config::URL_ROOT . Routes::getPage('group_posts_category', array('group' => $group['url_name'], 'category' => $category['url_name'])); ?> "<?php if ($category['url_name'] == $current_category) { echo ' class="active"'; } ?> ><?php echo $category['name']; ?> </a></li> <?php } ?> </ul> <br /><br />
echo Config::URL_ROOT . Routes::getPage('student', array('username' => $student['username'])); ?> "<?php if (!isset($current_category)) { echo ' class="active"'; } ?> ><?php echo __('POST_CATEGORIES_ALL'); ?> </a></li> <?php foreach ($categories as $category) { ?> <li><a href="<?php echo Config::URL_ROOT . Routes::getPage('user_posts_category', array('username' => $student['username'], 'category' => $category['url_name'])); ?> "<?php if ($category['url_name'] == $current_category) { echo ' class="active"'; } ?> ><?php echo $category['name']; ?> </a></li> <?php } ?> </ul> </div>
<div id="post-comment-<?php echo $id; ?> " class="post-comment<?php echo ' post-comment-attachment' . (isset($attachment_id) ? $attachment_id : '0'); ?> "> <a href="<?php echo $user_url; ?> " class="avatar"><img src="<?php echo $avatar_url; ?> " alt="" /></a> <a href="<?php echo Config::URL_ROOT . Routes::getPage('post_comment_delete', array('id' => $id)); ?> " class="post-comment-delete">x</a> <div class="post-comment-message"> <a href="<?php echo $user_url; ?> " class="post-comment-username"><?php echo htmlspecialchars($firstname . ' ' . $lastname); ?> </a> <?php echo Text::inHTML($message); ?> <div class="post-comment-info"> <?php
<div id="signin-block"> <h1><?php echo __('SIGNIN_TITLE'); ?> </h1> <form action="<?php echo Config::URL_ROOT . Routes::getPage('signin', array('redirect' => isset($signin_redirect) ? $signin_redirect : $_SERVER['REQUEST_URI'])); ?> " method="post"> <p id="signin-block-username"> <label for="signin-username"><?php echo __('SIGNIN_USERNAME'); ?> </label> <input type="text" name="username" id="signin-username" value="" /> </p> <p id="signin-block-password"> <label for="signin-password"><?php echo __('SIGNIN_PASSWORD'); ?> </label> <input type="password" name="password" id="signin-password" value="" /> </p> <p id="signin-block-submit"> <input type="submit" value="<?php echo __('SIGNIN_SUBMIT'); ?> " /> </p>
</form> </nav> </header> <div id="main"> <?php $this->__renderContent(); ?> </div> <footer> <a href="<?php echo Config::URL_ROOT . Routes::getPage('group', array('group' => 'iseplive')); ?> ">Association ISEPLive</a> + <a href="<?php echo Config::URL_ROOT . Routes::getPage('group', array('group' => 'bde-buzz-it')); ?> ">BDE Buzz-it</a> :: Site développé par <a href="http://godefroy.me">Godefroy</a> et <a href="http://github.com/Godefroy/iseplive">libéré sur Github</a> </footer> </div> <?php foreach ($jsFiles as $jsFile) { ?> <script type="text/javascript" src="<?php echo $jsFile; ?> "></script> <?php }
?> " id="search-ajax-url" /> </form> </nav> </header> <div id="main"> <?php $this->__renderContent(); ?> </div> <footer> <a href="<?php echo Config::URL_ROOT . Routes::getPage('group', array('group' => 'iseplive')); ?> ">Association ISEPLive</a> </a> :: Site développé par <a href="http://godefroy.me">Godefroy</a> et <a href="https://github.com/Iseplive/Site.git">libéré sur Github</a> </footer> </div> <?php foreach ($jsFiles as $jsFile) { ?> <script type="text/javascript" src="<?php echo $jsFile; ?> "></script> <?php }
echo Config::URL_ROOT . Routes::getPage('posts'); ?> "<?php if (!isset($current_category)) { echo ' class="active"'; } ?> ><?php echo __('POST_CATEGORIES_ALL'); ?> </a></li> <?php foreach ($categories as $category) { ?> <li><a href="<?php echo Config::URL_ROOT . Routes::getPage('posts_category', array('category' => $category['url_name'])); ?> "<?php if ($category['url_name'] == $current_category) { echo ' class="active"'; } ?> ><?php echo $category['name']; ?> </a></li> <?php } ?> </ul> <br /><br />
<div id="publish-error" class="hidden"></div> <form id="publish-form" action="<?php echo Config::URL_ROOT . Routes::getPage('post_add'); ?> " method="post" enctype="multipart/form-data" target="publish_iframe" onsubmit="return Post.submitForm();"> <div id="publish-left-side"> <?php if ($is_student) { ?> <span class="avatar"><img src="<?php echo $avatar_url; ?> " alt="<?php echo $firstname . ' ' . $lastname; ?> " /></span> <?php } else { echo __('PUBLISH_TITLE'); } ?> </div> <div id="publish-right-side"> <textarea name="message" id="publish-message" class="publish-message-default"><?php echo __('PUBLISH_DEFAULT_MESSAGE'); ?> </textarea>
echo __('POST_LIKE_PLURAL_CONJ'); ?> </span></a> <?php } ?> </div> </div> </div> <?php } // Dans le cas ou il est Etudiant, alors on affiche le champs de reponse. if ($is_student) { ?> <form action="<?php echo Config::URL_ROOT . Routes::getPage('post_comment', array('id' => $post['id'])); ?> " method="post" class="post-comment-write"> <span class="avatar hidden"><img src="<?php echo $avatar_url; ?> " alt="<?php echo $firstname . ' ' . $lastname; ?> " /></span> <div class="post-comment-write-message hidden"> <textarea name="comment" rows="1" cols="50"></textarea> <input type="submit" value="<?php echo __('POST_COMMENT_SUBMIT'); ?> " />
<div id="signin-block"> <h1><?php echo __('SIGNIN_TITLE'); ?> </h1> <form action="<?php echo Config::URL_ROOT . Routes::getPage('signin', array('redirect' => isset($signin_redirect) ? $signin_redirect : "")); ?> " method="post"> <p id="signin-block-username"> <label for="signin-username"><?php echo __('SIGNIN_USERNAME'); ?> </label> <input type="text" name="username" id="signin-username" value="" /> </p> <p id="signin-block-password"> <label for="signin-password"><?php echo __('SIGNIN_PASSWORD'); ?> </label> <input type="password" name="password" id="signin-password" value="" /> </p> <p id="signin-block-submit"> <input type="submit" value="<?php echo __('SIGNIN_SUBMIT'); ?> " /> </p> </form>