function traverse($node) { draw($node); foreach ($node->children as $child) { traverse($child); } }
function delete_ngi() { checkUserIsAdmin(); if ($_POST) { submit(); } else { draw(); } }
/** * Controller for an edit user_dn request * @global array $_POST only set if the browser has POSTed data * @return null */ function edit_dn() { //The following line will be needed if this controller is ever used for non administrators: //checkPortalIsNotReadOnlyOrUserIsAdmin($user); if ($_POST) { // If we receive a POST request it's to edit a user dn submit(); } else { // If there is no post data, draw the edit DN page draw(); } }
function create_document($topic_dists, $theta, $length) { $doc = array_fill_keys(range(0, 24), 0); while ($length-- > 0) { $topic = draw($theta); $word = draw($topic_dists[$topic]); $doc[$word] += 1; } return array_map(function ($start) use($doc) { return array_slice($doc, $start, 5); }, range(0, 24, 5)); }
/** * Controller for an edit site property request * @global array $_POST only set if the browser has POSTed data * @return null */ function edit_property() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); //Check the portal is not in read only mode, returns exception if it is and user is not an admin checkPortalIsNotReadOnlyOrUserIsAdmin($user); if ($_POST) { submit($user); } else { draw($user); } }
/** * Controller for an add service type request * @global array $_POST only set if the browser has POSTed data * @return null */ function add_type() { //The following line will be needed if this controller is ever used for non administrators: //checkPortalIsNotReadOnlyOrUserIsAdmin($user); if ($_POST) { // If we receive a POST request it's to add a service type submit(); } else { // If there is no post data, draw the add service type form draw(); } }
/** * Controller for a retrieve account request. * @global array $_POST only set if the browser has POSTed data * @return null */ function retrieve() { //Check the portal is not in read only mode, returns exception if it is checkPortalIsNotReadOnly(); if ($_POST) { // If we receive a POST request it's to update a user submit(); } else { // If there is no post data, draw the edit user form draw(); } }
/** * Controller for an edit service request * @global array $_POST only set if the browser has POSTed data * @return null */ function edit_service() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); //Check the portal is not in read only mode, returns exception if it is and user is not an admin checkPortalIsNotReadOnlyOrUserIsAdmin($user); if ($_POST) { // If we receive a POST request it's for a new site submit($user); } else { // If there is no post data, draw the edit site form draw($user); } }
function delete() { if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); //get the site $site = \Factory::getSiteService()->getSite($_REQUEST['id']); if ($_POST or sizeof($site->getServices()) == 0) { submit($site, $user); } else { draw($site); } }
/** * Controller for a new_property request * @global array $_POST only set if the browser has POSTed data * @return null */ function add_service_group_property() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); //Check the portal is not in read only mode, returns exception if it is and user is not an admin checkPortalIsNotReadOnlyOrUserIsAdmin($user); //Check user has modification rights for this entity if ($_POST) { // If we receive a POST request it's for a new property submit($user); } else { // If there is no post data, draw the New property form draw($user); } }
function delete() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); //get the site if (isset($_REQUEST['propertyid']) || !is_numeric($_REQUEST['propertyid'])) { $property = \Factory::getServiceGroupService()->getProperty($_REQUEST['propertyid']); $serviceGroup = \Factory::getServiceGroupService()->getServiceGroup($_REQUEST['id']); } else { throw new \Exception("A service group must be specified"); } if ($_POST) { submit($property, $user, $serviceGroup); } else { draw($property, $serviceGroup, $user); } }
/** * Controller for a request to add NGIs to a project * @global array $_POST only set if the browser has POSTed data * @return null */ function add_ngis_to_project() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); //Check the portal is not in read only mode, returns exception if it is and user is not an admin checkPortalIsNotReadOnlyOrUserIsAdmin($user); ////Check the user has permission to see the page, will throw exception //if correct permissions are lacking checkUserIsAdmin(); if ($_POST) { // If we receive a POST request it's to add ngis submit(); } else { // If there is no post data, draw the add NGI page draw(); } }
function delete() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); if (!isset($_REQUEST['propertyid']) || !is_numeric($_REQUEST['propertyid'])) { throw new Exception("A propertyid must be specified"); } if (!isset($_REQUEST['serviceid']) || !is_numeric($_REQUEST['serviceid'])) { throw new Exception("A service id must be specified"); } //get the service and property $property = \Factory::getServiceService()->getProperty($_REQUEST['propertyid']); $service = \Factory::getServiceService()->getService($_REQUEST['serviceid']); if ($_POST) { submit($property, $service, $user); } else { draw($property, $service, $user); } }
function delete_endpoint() { $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); if (!isset($_REQUEST['endpointid']) || !is_numeric($_REQUEST['endpointid'])) { throw new Exception("An endpointid must be specified"); } if (!isset($_REQUEST['serviceid']) || !is_numeric($_REQUEST['serviceid'])) { throw new Exception("A service id must be specified"); } //get the service and endpoint $endpoint = \Factory::getServiceService()->getEndpoint($_REQUEST['endpointid']); $service = \Factory::getServiceService()->getService($_REQUEST['serviceid']); if ($_POST) { submit($endpoint, $service, $user); } else { draw($endpoint, $service, $user); } }
function drawInterface($dbname, $out, $struct, $databases) { echo "<html><head><title>sGrep</title></head><body>"; echo "<style>a:link, a:hover, a:active, a:visited{color:black;text-decoration: none;}</style>"; echo "<div class='bar'>"; echo "<span><b>Databases</b>: </span>"; foreach ($databases as $database) { echo " <span><a href='?dbname={$database}' style='color:blue;'>{$database}</a></span> | "; } echo "</div>"; echo "<h1>Graf</h1>"; echo "<div class='draw' >"; draw($out); echo "</div>"; echo "<div class='structure' >"; echo "<h1>Short structure</h1>"; echo "<table class='short_structure' >"; foreach ($struct as $tablename => $column) { echo "<tr id='table_structure_short_" . $tablename . "' colspan='2' style='background-color:red;'><td><b>" . $tablename . "</b><span style='color:grey'>(" . count($column) . ")</span></td></tr>"; foreach ($column as $columnname => $columnvalues) { echo "<tr colspan='2'><td><a href='#table_structure_column_" . $tablename . "_" . $columnname . "'>" . $columnname . "</a></td></tr>"; } } echo "</table>"; echo "<h1>Long structure</h1>"; echo "<table class='long_structure' >"; foreach ($struct as $tablename => $column) { echo "<tr colspan='2' style='background-color:red;'><td><b>" . $tablename . "</b></td></tr>"; foreach ($column as $columnname => $columnvalues) { echo "<tr id='table_structure_column_" . $tablename . "_" . $columnname . "' colspan='2'><td style='background-color:green;'><b><i>" . $columnname . "</i></b></td></tr>"; foreach ($columnvalues as $columnvaluename => $columnvalue) { echo "<tr>"; echo "<td>" . $columnvaluename . "</td>"; echo "<td>" . $columnvalue . "</td>"; echo "</tr>"; } } } echo "</table>"; echo "</div>"; echo "</body></html>"; }
function travel(&$out, $n = 0, $i = 0, $j = 0, $depth = 1) { // $is_inner = ($depth == 0) ? 0 : 2; // -> draw($out, $i, $j, $i, $j + ($n - 1)); $j += $n - 1; // down draw($out, $i, $j, $i + ($n - 1), $j); $i += $n - 1; // <- draw($out, $i, $j, $i, $j - ($n - 1)); $j -= $n - 1; // up draw($out, $i, $j, $i - ($n - 3), $j); $i -= $n - 3; $j += 1; draw($out, $i, $j, $i, $j); // if ($depth == 2) return; if ($n - 4 < 0) { return; } $depth++; travel($out, $n - 4, $i, $j + 1, $depth++); }
function create_restored_course(&$tool_content, $restoreThis, $course_code, $course_lang, $course_title, $course_desc, $course_vis, $course_prof) { global $webDir, $urlServer, $urlAppend, $langEnter, $langBack, $currentCourseCode; require_once 'modules/create_course/functions.php'; require_once 'modules/course_info/restorehelper.class.php'; require_once 'include/lib/fileManageLib.inc.php'; $new_course_code = null; $new_course_id = null; Database::get()->transaction(function() use (&$new_course_code, &$new_course_id, $restoreThis, $course_code, $course_lang, $course_title, $course_desc, $course_vis, $course_prof, $webDir, &$tool_content, $urlServer, $urlAppend) { $departments = array(); if (isset($_POST['department'])) { foreach ($_POST['department'] as $did) { $departments[] = intval($did); } } else { $minDep = Database::get()->querySingle("SELECT MIN(id) AS min FROM hierarchy"); if ($minDep) { $departments[0] = $minDep->min; } } $r = $restoreThis . '/html'; list($new_course_code, $new_course_id) = create_course($course_code, $course_lang, $course_title, $course_desc, $departments, $course_vis, $course_prof); if (!$new_course_code) { $tool_content = "<div class='alert alert-warning'>" . $GLOBALS['langError'] . "</div>"; draw($tool_content, 3); exit; } if (!file_exists($restoreThis)) { redirect_to_home_page('modules/course_info/restore_course.php'); } $config_data = unserialize(file_get_contents($restoreThis . '/config_vars')); // If old $urlAppend didn't end in /, add it if (substr($config_data['urlAppend'], -1) !== '/') { $config_data['urlAppend'] .= '/'; } $eclass_version = (isset($config_data['version'])) ? $config_data['version'] : null; $backupData = null; if (file_exists($restoreThis . '/backup.php')) { $backupData = parse_backup_php($restoreThis . '/backup.php'); $eclass_version = $backupData['eclass_version']; } $restoreHelper = new RestoreHelper($eclass_version); $course_file = $restoreThis . '/' . $restoreHelper->getFile('course'); if (file_exists($course_file)) { $course_dataArr = unserialize(file_get_contents($course_file)); $course_data = $course_dataArr[0]; // update course query $upd_course_sql = "UPDATE course SET keywords = ?s, doc_quota = ?f, video_quota = ?f, " . " group_quota = ?f, dropbox_quota = ?f, glossary_expand = ?d "; $upd_course_args = array( $course_data[$restoreHelper->getField('course', 'keywords')], floatval($course_data['doc_quota']), floatval($course_data['video_quota']), floatval($course_data['group_quota']), floatval($course_data['dropbox_quota']), intval($course_data[$restoreHelper->getField('course', 'glossary_expand')]) ); if (isset($course_data['home_layout']) and isset($course_data['course_image'])) { $upd_course_sql .= ', home_layout = ?d, course_image = ?s '; $upd_course_args[] = $course_data['home_layout']; $upd_course_args[] = $course_data['course_image']; } // Set keywords to '' if NULL if (!isset($upd_course_args[0])) { $upd_course_args[0] = ''; } // handle course weekly if exists if (isset($course_data['view_type']) && isset($course_data['start_date']) && isset($course_data['finish_date'])) { $upd_course_sql .= " , view_type = ?s, start_date = ?t, finish_date = ?t "; array_push($upd_course_args, $course_data['view_type'], $course_data['start_date'], $course_data['finish_date'] ); } $upd_course_sql .= " WHERE id = ?d "; array_push($upd_course_args, intval($new_course_id)); Database::get()->query($upd_course_sql, $upd_course_args); } $userid_map = array(); $user_file = $restoreThis . '/user'; if (file_exists($user_file)) { $cours_user = unserialize(file_get_contents($restoreThis . '/' . $restoreHelper->getFile('course_user'))); $userid_map = restore_users(unserialize(file_get_contents($user_file)), $cours_user, $departments, $restoreHelper); register_users($new_course_id, $userid_map, $cours_user, $restoreHelper); } $userid_map[0] = 0; $userid_map[-1] = -1; $coursedir = "${webDir}/courses/$new_course_code"; $videodir = "${webDir}/video/$new_course_code"; move_dir($r, $coursedir); if (is_dir($restoreThis . '/video_files')) { move_dir($restoreThis . '/video_files', $videodir); } course_index($new_course_code); $tool_content .= "<div class='alert alert-info'>" . $GLOBALS['langCopyFiles'] . " $coursedir</div>"; require_once 'upgrade/functions.php'; load_global_messages(); $url_prefix_map = array( $config_data['urlServer'] . 'modules/ebook/show.php/' . $course_data['code'] => $urlServer . 'modules/ebook/show.php/' . $new_course_code, $config_data['urlAppend'] . 'modules/ebook/show.php/' . $course_data['code'] => $urlAppend . 'modules/ebook/show.php/' . $new_course_code, $config_data['urlServer'] . 'modules/document/file.php/' . $course_data['code'] => $urlServer . 'modules/document/file.php/' . $new_course_code, $config_data['urlAppend'] . 'modules/document/file.php/' . $course_data['code'] => $urlAppend . 'modules/document/file.php/' . $new_course_code, $config_data['urlServer'] . 'courses/' . $course_data['code'] => $urlServer . 'courses/' . $new_course_code, $config_data['urlAppend'] . 'courses/' . $course_data['code'] => $urlAppend . 'courses/' . $new_course_code, $course_data['code'] => $new_course_code); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_3X) { restore_table($restoreThis, 'course_module', array('set' => array('course_id' => $new_course_id), 'delete' => array('id')), $url_prefix_map, $backupData, $restoreHelper); } else if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X) { create_modules($new_course_id); foreach (get_tabledata_from_parsed('accueil', $backupData, $restoreHelper) as $accueil) { Database::get()->query('UPDATE course_module SET visible = ?d WHERE course_id = ?d AND module_id = ?d', $accueil['visible'], $new_course_id, $accueil['id']); } } restore_table($restoreThis, 'announcement', array('set' => array('course_id' => $new_course_id), 'delete' => array('id', 'preview')), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'group_properties', array('set' => array('course_id' => $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); $group_map = restore_table($restoreThis, 'group', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'group_members', array('map' => array('group_id' => $group_map, 'user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Forums Restore $forum_category_map = restore_table($restoreThis, 'forum_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $forum_category_map[0] = 0; $forum_map = restore_table($restoreThis, 'forum', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id', 'map' => array('cat_id' => $forum_category_map)), $url_prefix_map, $backupData, $restoreHelper); $forum_map[0] = 0; $forum_topic_map = restore_table($restoreThis, 'forum_topic', array('return_mapping' => 'id', 'map' => array('forum_id' => $forum_map, 'poster_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); $forum_topic_map[0] = 0; $forum_post_options = array('return_mapping' => 'id', 'map' => array('topic_id' => $forum_topic_map, 'poster_id' => $userid_map)); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X) { $forum_post_options['set'] = array('post_text' => ''); } $forum_post_map = restore_table($restoreThis, 'forum_post', $forum_post_options, $url_prefix_map, $backupData, $restoreHelper); $forum_post_map[0] = 0; restore_table($restoreThis, 'forum_notify', array('set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map, 'cat_id' => $forum_category_map, 'forum_id' => $forum_map, 'topic_id' => $forum_topic_map), 'delete' => array('id')), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'forum_user_stats', array('set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X && isset($backupData) && is_array($backupData) && isset($backupData['query']) && is_array($backupData['query'])) { $postsText = get_tabledata_from_parsed('posts_text', $backupData, $restoreHelper); foreach ($postsText as $ptData) { if (array_key_exists($ptData['post_id'], $forum_post_map)) { Database::get()->query("UPDATE forum_post SET post_text = ?s WHERE id = ?d", $ptData['post_text'], intval($forum_post_map[$ptData['post_id']])); } } } $forumLastPosts = Database::get()->queryArray("SELECT DISTINCT last_post_id FROM forum WHERE course_id = ?d ", intval($new_course_id)); if (is_array($forumLastPosts) && count($forumLastPosts) > 0) { foreach ($forumLastPosts as $lastPost) { if (isset($forum_post_map[$lastPost->last_post_id])) { Database::get()->query("UPDATE forum SET last_post_id = ?d WHERE course_id = ?d AND last_post_id = ?d", intval($forum_post_map[$lastPost->last_post_id]), intval($new_course_id), intval($lastPost->last_post_id)); } } } $topicLastPosts = Database::get()->queryArray("SELECT DISTINCT last_post_id FROM forum_topic WHERE forum_id IN (SELECT id FROM forum WHERE course_id = ?d)", intval($new_course_id)); if (is_array($topicLastPosts) && count($topicLastPosts) > 0) { foreach ($topicLastPosts as $lastPost) { if (isset($forum_post_map[$lastPost->last_post_id])) { Database::get()->query("UPDATE forum_topic SET last_post_id = ?d WHERE last_post_id = ?d", intval($forum_post_map[$lastPost->last_post_id]), intval($lastPost->last_post_id)); } } } $parentPosts = Database::get()->queryArray("SELECT DISTINCT parent_post_id FROM forum_post WHERE topic_id IN (SELECT id FROM forum_topic WHERE forum_id IN (SELECT id FROM forum WHERE course_id = ?d))", intval($new_course_id)); if (is_array($parentPosts) && count($parentPosts) > 0) { foreach ($parentPosts as $parentPost) { if (isset($forum_post_map[$parentPost->parent_post_id])) { Database::get()->query("UPDATE forum_post SET parent_post_id = ?d WHERE parent_post_id = ?d", intval($forum_post_map[$parentPost->parent_post_id]), intval($parentPost->parent_post_id)); } } } // Forums Restore End // Glossary Restore $glossary_category_map = restore_table($restoreThis, 'glossary_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $glossary_category_map[0] = 0; restore_table($restoreThis, 'glossary', array('set' => array('course_id' => $new_course_id), 'delete' => array('id'), 'map' => array('category_id' => $glossary_category_map)), $url_prefix_map, $backupData, $restoreHelper); // Glossary Restore End $link_category_map = restore_table($restoreThis, 'link_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $link_category_map[0] = 0; $link_category_map[-1] = -1; $link_category_map[-2] = -2; $link_map = restore_table($restoreThis, 'link', array('set' => array('course_id' => $new_course_id), 'map' => array('category' => $link_category_map, 'user_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_map = restore_table($restoreThis, 'ebook', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); foreach ($ebook_map as $old_id => $new_id) { // new and old id might overlap as the map contains multiple values! rename("$coursedir/ebook/$old_id", "$coursedir/ebook/__during_restore__$new_id"); } foreach ($ebook_map as $old_id => $new_id) { // better to use an intermediary rename step rename("$coursedir/ebook/__during_restore__$new_id", "$coursedir/ebook/$new_id"); } $document_map = restore_table($restoreThis, 'document', array('set' => array('course_id' => $new_course_id), 'map_function' => 'document_map_function', 'map_function_data' => array(1 => $group_map, 2 => $ebook_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_section_map = restore_table($restoreThis, 'ebook_section', array('map' => array('ebook_id' => $ebook_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_subsection_map = restore_table($restoreThis, 'ebook_subsection', array('map' => array('section_id' => $ebook_section_map, 'file_id' => $document_map), 'delete' => array('file'), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); // Video $videocat_map = restore_table($restoreThis, 'video_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $videocat_map[''] = ''; $videocat_map[0] = 0; $video_map = restore_table($restoreThis, 'video', array( 'map' => array('category' => $videocat_map), 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $videolink_map = restore_table($restoreThis, 'videolink', array( 'map' => array('category' => $videocat_map), 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); // Dropbox $dropbox_map = restore_table($restoreThis, 'dropbox_msg', array('set' => array('course_id' => $new_course_id), 'map' => array('author_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'dropbox_attachment', array('map' => array('msg_id' => $dropbox_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'dropbox_index', array('map' => array('msg_id' => $dropbox_map, 'recipient_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Learning Path $lp_learnPath_map = restore_table($restoreThis, 'lp_learnPath', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'learnPath_id'), $url_prefix_map, $backupData, $restoreHelper); $lp_module_map = restore_table($restoreThis, 'lp_module', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'module_id'), $url_prefix_map, $backupData, $restoreHelper); $lp_asset_map = restore_table($restoreThis, 'lp_asset', array('map' => array('module_id' => $lp_module_map), 'return_mapping' => 'asset_id'), $url_prefix_map, $backupData, $restoreHelper); // update lp_module startAsset_id with new asset_id from map foreach ($lp_asset_map as $key => $value) { Database::get()->query("UPDATE lp_module SET `startAsset_id` = ?d " . "WHERE `course_id` = ?d " . "AND `startAsset_id` = ?d", intval($value), intval($new_course_id), intval($key)); } $lp_rel_learnPath_module_map = restore_table($restoreThis, 'lp_rel_learnPath_module', array('map' => array('learnPath_id' => $lp_learnPath_map, 'module_id' => $lp_module_map), 'return_mapping' => 'learnPath_module_id'), $url_prefix_map, $backupData, $restoreHelper); // update parent foreach ($lp_rel_learnPath_module_map as $key => $value) { Database::get()->query("UPDATE lp_rel_learnPath_module SET `parent` = ?d " . "WHERE `learnPath_id` IN (SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d) " . "AND `parent` = ?d", intval($value), intval($new_course_id), intval($key)); } restore_table($restoreThis, 'lp_user_module_progress', array('delete' => array('user_module_progress_id'), 'map' => array('user_id' => $userid_map, 'learnPath_module_id' => $lp_rel_learnPath_module_map, 'learnPath_id' => $lp_learnPath_map)), $url_prefix_map, $backupData, $restoreHelper); foreach ($lp_learnPath_map as $old_id => $new_id) { // new and old id might overlap as the map contains multiple values! $old_dir = "$coursedir/scormPackages/path_$old_id"; if (file_exists($old_dir) && is_dir($old_dir)) { rename($old_dir, "$coursedir/scormPackages/__during_restore__$new_id"); } } foreach ($lp_learnPath_map as $old_id => $new_id) { // better to use an intermediary rename step $tempLPDir = "$coursedir/scormPackages/__during_restore__$new_id"; if (file_exists($tempLPDir) && is_dir($tempLPDir)) { rename($tempLPDir, "$coursedir/scormPackages/path_$new_id"); } } // Wiki $wiki_map = restore_table($restoreThis, 'wiki_properties', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'wiki_acls', array('map' => array('wiki_id' => $wiki_map)), $url_prefix_map, $backupData, $restoreHelper); $wiki_pages_map = restore_table($restoreThis, 'wiki_pages', array('map' => array('wiki_id' => $wiki_map, 'owner_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'wiki_pages_content', array('delete' => array('id'), 'map' => array('pid' => $wiki_pages_map, 'editor_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Blog if (file_exists("$restoreThis/blog_post")) { $blog_map = restore_table($restoreThis, 'blog_post', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); } // Comments if (file_exists("$restoreThis/comments")) { $comment_map = restore_table($restoreThis, 'comments', array('delete' => array('id'), 'map' => array('user_id' => $userid_map), 'map_function' => 'comments_map_function', 'map_function_data' => array($blog_map, $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); } //Abuse Report if (file_exists("$restoreThis/abuse_report")) { restore_table($restoreThis, 'abuse_report', array('delete' => array('id'), 'set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map), 'map_function' => 'abuse_report_map_function', 'map_function_data' => array($forum_post_map, $comment_map, $link_map)), $url_prefix_map, $backupData, $restoreHelper); } // Rating if (file_exists("$restoreThis/rating")) { restore_table($restoreThis, 'rating', array('delete' => array('rate_id'), 'map' => array('user_id' => $userid_map), 'map_function' => 'ratings_map_function', 'map_function_data' => array($blog_map, $forum_post_map, $link_map, $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } if (file_exists("$restoreThis/rating_cache")) { restore_table($restoreThis, 'rating_cache', array('delete' => array('rate_cache_id'), 'map_function' => 'ratings_map_function', 'map_function_data' => array($blog_map, $forum_post_map, $link_map, $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } // Course_settings if (file_exists("$restoreThis/course_settings")) { restore_table($restoreThis, 'course_settings', array('set' => array('course_id' => $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } // Polls $poll_map = restore_table($restoreThis, 'poll', array('set' => array('course_id' => $new_course_id), 'map' => array('creator_id' => $userid_map), 'return_mapping' => 'pid', 'delete' => array('type')), $url_prefix_map, $backupData, $restoreHelper); $poll_question_map = restore_table($restoreThis, 'poll_question', array('map' => array('pid' => $poll_map), 'return_mapping' => 'pqid'), $url_prefix_map, $backupData, $restoreHelper); $poll_answer_map = restore_table($restoreThis, 'poll_question_answer', array('map' => array('pqid' => $poll_question_map), 'return_mapping' => 'pqaid'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'poll_answer_record', array('delete' => array('arid'), 'map' => array('pid' => $poll_map, 'qid' => $poll_question_map, 'aid' => $poll_answer_map, 'user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Assignments if (!isset($group_map[0])) { $group_map[0] = 0; } $assignments_map = restore_table($restoreThis, 'assignment', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $assignments_map[0] = 0; restore_table($restoreThis, 'assignment_submit', array('delete' => array('id'), 'map' => array('uid' => $userid_map, 'assignment_id' => $assignments_map, 'group_id' => $group_map)), $url_prefix_map, $backupData, $restoreHelper); // Agenda $agenda_map = restore_table($restoreThis, 'agenda', array( 'return_mapping' => 'id', 'set' => array('course_id' => $new_course_id) ), $url_prefix_map, $backupData, $restoreHelper); $agenda_map[0] = 0; // Exercises $exercise_map = restore_table($restoreThis, 'exercise', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $exercise_map[0] = 0; restore_table($restoreThis, 'exercise_user_record', array( 'delete' => array('eurid'), 'map' => array('eid' => $exercise_map, 'uid' => $userid_map) ), $url_prefix_map, $backupData, $restoreHelper); $question_category_map = restore_table($restoreThis, 'exercise_question_cats', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'question_cat_id' ), $url_prefix_map, $backupData, $restoreHelper); $question_category_map[0] = 0; $question_map = restore_table($restoreThis, 'exercise_question', array( 'set' => array('course_id' => $new_course_id), 'init' => array('category' => 0), 'map' => array('category' => $question_category_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_answer', array( 'delete' => array('id'), 'map' => array('question_id' => $question_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_answer_record', array( 'delete' => array('answer_record_id'), 'map' => array('question_id' => $question_map, 'eurid' => $userid_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_with_questions', array( 'map' => array('question_id' => $question_map, 'exercise_id' => $exercise_map) ), $url_prefix_map, $backupData, $restoreHelper); $sql = "SELECT asset.asset_id, asset.path FROM `lp_module` AS module, `lp_asset` AS asset WHERE module.startAsset_id = asset.asset_id AND course_id = ?d AND contentType = 'EXERCISE' AND path <> '' AND path IS NOT NULL"; $rows = Database::get()->queryArray($sql, intval($new_course_id)); if (is_array($rows) && count($rows) > 0) { foreach ($rows as $row) { Database::get()->query("UPDATE `lp_asset` SET path = ?s WHERE asset_id = ?d", $exercise_map[$row->path], intval($row->asset_id)); } } // Attendance $attendance_map = restore_table($restoreThis, 'attendance', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $attendance_activities_map = restore_table($restoreThis, 'attendance_activities', array( 'map' => array('attendance_id' => $attendance_map), 'map_function' => 'attendance_gradebook_activities_map_function', 'map_function_data' => array($assignments_map, $exercise_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'attendance_book', array( 'map' => array( 'attendance_activity_id' => $attendance_activities_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'attendance_users', array( 'map' => array( 'attendance_id' => $attendance_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Gradebook $gradebook_map = restore_table($restoreThis, 'gradebook', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $gradebook_activities_map = restore_table($restoreThis, 'gradebook_activities', array( 'map' => array('gradebook_id' => $gradebook_map), 'map_function' => 'attendance_gradebook_activities_map_function', 'map_function_data' => array($assignments_map, $exercise_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'gradebook_book', array( 'map' => array( 'gradebook_activity_id' => $gradebook_activities_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'gradebook_users', array( 'map' => array( 'gradebook_id' => $gradebook_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Notes restore_table($restoreThis, 'note', array( 'set' => array('reference_obj_course' => $new_course_id), 'map' => array('user_id' => $userid_map), 'map_function' => 'notes_map_function', 'map_function_data' => array($new_course_id, $agenda_map, $document_map, $link_map, $video_map, $videolink_map, $assignments_map, $exercise_map, $ebook_map, $lp_learnPath_map), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Units $unit_map = restore_table($restoreThis, 'course_units', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'unit_resources', array('delete' => array('id'), 'map' => array('unit_id' => $unit_map), 'map_function' => 'unit_map_function', 'map_function_data' => array($document_map, $link_category_map, $link_map, $ebook_map, $ebook_section_map, $ebook_subsection_map, $video_map, $videolink_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map) ), $url_prefix_map, $backupData, $restoreHelper); // Weekly $weekly_map = restore_table($restoreThis, 'course_weekly_view', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'course_weekly_view_activities', array( 'delete' => array('id'), 'map' => array('course_weekly_view_id' => $weekly_map), 'map_function' => 'unit_map_function', 'map_function_data' => array($document_map, $link_category_map, $link_map, $ebook_map, $ebook_section_map, $ebook_subsection_map, $video_map, $videolink_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'course_description', array( 'set' => array('course_id' => $new_course_id), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); removeDir($restoreThis); // index course after restoring require_once 'modules/search/indexer.class.php'; Indexer::queueAsync(Indexer::REQUEST_REMOVEALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id); Indexer::queueAsync(Indexer::REQUEST_STOREALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id); }); // check/cleanup video files after restore transaction if ($new_course_code != null && $new_course_id != null) { $videodir = $webDir . "/video/" . $new_course_code; $videos = scandir($videodir); foreach ($videos as $videofile) { if (is_dir($videofile)) { continue; } $vlike = '/' . $videofile; if (!isWhitelistAllowed($videofile)) { unlink($videodir . "/" . $videofile); Database::get()->query("DELETE FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike); continue; } $vcnt = Database::get()->querySingle("SELECT count(id) AS count FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike)->count; if ($vcnt <= 0) { unlink($videodir . "/" . $videofile); } } $backUrl = $urlAppend . (isset($currentCourseCode)? "courses/$currentCourseCode/": 'modules/admin/'); $tool_content .= action_bar(array( array('title' => $langEnter, 'url' => $urlAppend . "courses/$new_course_code/", 'icon' => 'fa-arrow-right', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langBack, 'url' => $backUrl, 'icon' => 'fa-reply', 'level' => 'primary-label')), false); } }
<?php require_once dirname(__FILE__) . "/resources/globals.php"; require_once dirname(__FILE__) . "/resources/common_functions.php"; require_once dirname(__FILE__) . "/pages/install/install.php"; draw(); function draw() { global $o_project_installer; global $global_path_to_jquery; $block_style = "display:inline-block; border:1px solid black; padding:1em; background-color:rgba(0,0,0,0.05);"; echo "<!DOCTYPE html>\n\t<head><title>Banwebplus help!</title>\n\t<script src='{$global_path_to_jquery}'></script></head>\n\n\t<body><div style='width:800px; margin:0 auto;'>\n\n"; draw_jquery($block_style); draw_help_code($block_style); $b_all_green = draw_status_code($block_style); draw_link_to_login($block_style, $b_all_green); echo "\n\n</div></body>"; } function draw_jquery($block_style) { global $global_path_to_jquery; if ($global_path_to_jquery === "") { echo "<div style='{$block_style}'>\n\t\t\t<div style='display:inline-block; color:red; font-size:2em; font-weight:bold;'>\n\t\t\t\tALERT!!!\n\t\t\t</div><br />\n\t\t\tThis page will not work very will until jquery has been set up.<br />\n\t\t\tTo use jquery, create a file in\n\t\t\t<div style='display:inline-block; font-family:monospace;'>\n\t\t\t\t/some/path/banwebplus/server_config.ini\n\t\t\t</div>\n\t\t\twith the following line:<br />\n\t\t\t<div style='display:inline-block; font-family:monospace;'>\n\t\t\t\tglobal_path_to_jquery = \"/jquery/js/jquery-1.9.0.js\"\n\t\t\t</div>\n\t\t</div><br /><br />\n\n"; } } function draw_help_code($block_style) { echo "\n\t\t<script type='text/javascript'>\n\t\t// from http://stackoverflow.com/questions/3024745/cross-browser-bookmark-add-to-favorites-javascript\n\t\tfunction bookmark() {\n\t\t\tif (window.sidebar) { // Mozilla Firefox Bookmark\n\t\t\t\twindow.sidebar.addPanel(location.href,document.title,'');\n\t\t\t} else if(window.external && window.external.AddFavorite) { // IE Favorite\n\t\t\t\twindow.external.AddFavorite(location.href,document.title);\n\t\t\t} else if(window.opera && window.print) { // Opera Hotlist\n\t\t\t\tthis.title=document.title;\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\talert('Bookmark could not be added automatically.');\n\t\t\t}\n\t\t}\n\t\t</script>\n\n"; echo "<div style='{$block_style}'>\n\t\t\t<div style='font-size:2.0em'>HELP!</div>\n\t\t\t<b>Why am I here?</b><br />\n\t\t\tEither you\n\t\t\t<a href='#' onclick='bookmark();'>bookmarked</a>\n\t\t\tthis page or you were redirected here because some of the necessary components\n\t\t\tto run this page are not properly installed.\n\t\t</div><br /><br />\n\n"; } function draw_status_code($block_style)
function annaZug() { global $kegelArray; global $punkte; nextFrame(); logFrame("\n--- Annas Zug ---"); logFrame("- Wurf -"); $besteWurfLinie = array(); $besteWurfLinie["m"] = 0; $besteWurfLinie["a"] = 0; $besteWurfLinie["getroffen"] = 0; logFrame("Ermittle beste Wurf-Linie"); for ($p1 = 0; $p1 < sizeof($kegelArray); $p1++) { if ($kegelArray[$p1]["status"]) { if (anzahlKegelAufDemSpielfeld() !== 1) { for ($p2 = 0; $p2 < sizeof($kegelArray); $p2++) { if ($kegelArray[$p2]["status"] && $p1 != $p2) { //Koordinaten übersichtlicher $p1X = $kegelArray[$p1]["x"]; $p1Y = $kegelArray[$p1]["y"]; $p2X = $kegelArray[$p2]["x"]; $p2Y = $kegelArray[$p2]["y"]; //m errechnen $dX = $p1X - $p2X; $dY = $p1Y - $p2Y; if ($dX == 0) { $dX = 1; } //Division durch Null verhindern $m = $dY / $dX; //a errechnen $a = $p1Y - $m * $p1X; $getroffen = wurf($m, $a, false); logFrame("Es könnten " . $getroffen . " Kegel getroffen werden."); if ($getroffen > $besteWurfLinie["getroffen"]) { $besteWurfLinie["m"] = $m; $besteWurfLinie["a"] = $a; $besteWurfLinie["getroffen"] = $getroffen; } } } } else { $besteWurfLinie["m"] = 0; $besteWurfLinie["a"] = $kegelArray[$p1]["y"]; } } } logFrame("Beste wurf-Linie ermittelt: y = " . $besteWurfLinie["m"] . " * x + " . $besteWurfLinie["a"]); draw($besteWurfLinie["m"], $besteWurfLinie["a"], true); //Besten wurf zeichnen $anzahlUmgeworfen = wurf($besteWurfLinie["m"], $besteWurfLinie["a"], true); //Besten Wurf ausführen logFrame("Insgesmat " . $anzahlUmgeworfen . " Kegel umgeworfen."); $punkte[sizeof($punkte) - 1]["anna"] += $anzahlUmgeworfen; savePoints(); //Punktestand speichern //Entscheidung: Runde fortsetzen? $temp = punkteInsgesamt(); if ($temp["randy"] + anzahlKegelAufDemSpielfeld() * 0.5 <= $temp["anna"]) { logFrame("\n---- Anna hat sich für die Fortsetzung der Runde entschieden. ----"); return true; } else { logFrame("\n---- Anna beendet die aktuelle Runde. ----"); return false; } }
</div> </div>"; } $tool_content .= " <div class='form-group'> <div class='col-sm-10 col-sm-offset-2'> <input class='btn btn-primary' type='submit' name='submit' value='$langModify'> <a class='btn btn-default' href='auth.php'>$langCancel</a> </div> </div> </fieldset> </form> </div>"; } draw($tool_content, 3); /** * @brief display form for completing info about authentication via eclass * @global type $langAuthTitle * @global type $langInstructionsAuth * @param type $auth_title * @param type $auth_instructions * @return string */ function eclass_auth_form($auth_title, $auth_instructions) { global $langAuthTitle, $langInstructionsAuth; $content = "<div class='form-group'> <label for='auth_title' class='col-sm-2 control-label'>$langAuthTitle:</label>
} else { $tool_content .= "<div class='alert alert-info'>{$langStudentCannotRegister}</div>"; } // teacher registration if ($eclass_prof_reg or $alt_auth_prof_reg) { // allow teacher registration $tool_content .= "<table class='table table-striped table-bordered table-hover'>"; $tool_content .= "<tr><th>{$langOfTeacher}</th></tr>"; if ($eclass_prof_reg) { $tool_content .= "<tr><td><a href='formuser.php?p=1'>{$langUserAccountInfo1}</a></td></tr>"; } if (count($auth) > 1 and $alt_auth_prof_reg) { $tool_content .= "<tr><td>{$langUserAccountInfo1} {$langWith}:"; foreach ($auth as $k => $v) { if ($v != 1) { // bypass the eclass auth method $tool_content .= "<br /><a href='altnewuser.php?p=1&auth=" . $v . "'>" . get_auth_info($v) . "</a>"; } } $tool_content .= "</td></tr>"; } $tool_content .= "</table>"; } else { $tool_content .= "<div class='alert alert-info'>{$langTeacherCannotRegister}</div>"; } } else { // disable registration $tool_content .= "<div class='alert alert-info'>{$langCannotRegister}</div>"; } draw($tool_content, 0);
$bad_words .= $words[$cur_word++] . ' '; } parser_message('blazon', 'Not understood - ' . $bad_words); } parser_message('Disclaimer:', 'Provided for education and information only. The use of heraldic devices is restricted in many countries, independently of copyright. The granting of a Coat of Arms is solely the right of the appropriate Heraldic Authority for your nationality and country of residence.'); if ($parser_messages->hasChildNodes()) { $node->appendChild($parser_messages); } $dom->appendChild($node); // Read in the drawing code $dir = opendir($format); while (($file = readdir($dir)) != false) { if (substr($file, -4) == '.inc') { require $format . '/' . $file; } } $output = draw(); // Output content header if ($asFile) { header("Content-type: application/force-download"); header('Content-Disposition: inline; filename="shield.svg"'); header("Content-Transfer-Encoding: text"); header('Content-Disposition: attachment; filename="shield.svg"'); header('Content-Type: image/svg+xml'); } elseif ($asText) { header("Content-Transfer-Encoding: text"); header('Content-Type: text/plain'); } else { header('Content-Type: text/xml; charset=utf-8'); } echo $output;
<h1>$langWelcomeWizard</h1> <div class='panel panel-info text-left'> <div class='panel-heading'>$langThisWizard</div> <div class='panel-body'> <ul> <li>$langWizardHelp1</li> <li>$langWizardHelp2</li> <li>$langWizardHelp3</li> </ul> </div> </div> <form class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]'> <fieldset> <div class='form-group'> <label for='lang' class='col-sm-2 control-label'>$langChooseLang:</label> <div class='col-sm-10'>" . selection($langLanguages, 'lang', $lang, 'class="form-control" onChange=\"document.langform.submit();\"') . "</div> </div> <div class='form-group'> <div class='col-sm-offset-2 col-sm-10 text-left'> <input type='submit' class='btn btn-primary' name='install1' value='$langNextStep »'> <input type='hidden' name='welcomeScreen' value='true'> </div> </div> <fieldset> </form> </div> </div>"; draw($tool_content, array('no-menu' => true)); }
$i++; } $tool_content .= "</div> <div> <span class='tag'>$langProfileMemberSince : </span><span class='tag-value'>$userdata->registered_at</span> </div> </div> </div>"; //render custom profile fields content $tool_content .= render_profile_fields_content(array('user_id' => $id)); $tool_content .= "</div> </div> </div> </div>"; } draw($tool_content, 1); /** * check access to user profiles * @global type $status * @param type $level * @return boolean */ function allow_access($level) { if ($level == ACCESS_USERS) { return true; } elseif ($level == ACCESS_PROFS and $_SESSION['status'] == USER_TEACHER) { return true; } else {
} } $tool_content .= "</tr>"; } } $tool_content .= "</table>\n </div>\n </div>\n </div>"; if ($can_upload && !$is_in_tinymce) { $tool_content .= "<br><div class='text-right'>{$langMaxFileSize} " . ini_get('upload_max_filesize') . "</div>"; } } if (defined('SAVED_COURSE_CODE')) { $course_code = SAVED_COURSE_CODE; $course_id = SAVED_COURSE_ID; } add_units_navigation(TRUE); draw($tool_content, $menuTypeID, null, $head_content); function select_proper_filters($requestDocsFilter) { $filter = ''; $compatiblePlugin = true; switch ($requestDocsFilter) { case 'image': $ors = ''; foreach (MultimediaHelper::getSupportedImages() as $imgfmt) { $ors .= " OR format LIKE '{$imgfmt}'"; } $filter = "AND (format LIKE '.dir' {$ors})"; break; case 'eclmedia': $ors = ''; foreach (MultimediaHelper::getSupportedMedia() as $mediafmt) {
<table class="admin_table"> <tr> <th class="text-left">Id</th> <th>Account state</th> <th>Username</th> <th>Fullname</th> <th>Facebook</th> <th>Email</th> <th>Sign up date</th> <th>Ip address</th> <th>Action</th> </tr> <?php foreach ($result['users'] as $key => $value) { draw($value); } ?> </table> <?php } else { if (strlen($query) < 3) { ?> <div class="info"> Enter in the search box username, full name or email. Minimum of 3 characters. </div> <?php } else { ?>
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', 'button-class' => 'btn-success', 'level' => 'primary-label'), array('title' => $langBack, 'url' => "index.php?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label')), false); draw($tool_content, 2);
/** * Validate a given uploaded zip archive contents against the whitelist and error if necessary. * * @param array $listContent - The list contents of the zip arhive, preferably by directly wiring PclZip::listContent(). * @param integer $menuTypeID - The menu type to display in case of error. */ function validateUploadedZipFile($listContent, $menuTypeID = 2) { global $tool_content, $head_content, $langBack, $langUploadedZipFileNotAllowed; if (!is_array($listContent)) { return false; } foreach ($listContent as $key => $entry) { if ($entry['folder'] == 1) { continue; } $filename = basename($entry['filename']); if (!isWhitelistAllowed($filename)) { $tool_content .= "<div class='alert alert-danger'>{$langUploadedZipFileNotAllowed}<br><a href='javascript:history.go(-1)'>{$langBack}</a></div><br>"; draw($tool_content, $menuTypeID, null, $head_content); exit; } } }
$link_text = $entry['title']; } if ($entry['copyrighted']) { $link_text .= " <img src='../document/img/copyrighted.png' />"; } $tool_content .= "\n <tr{$style}>"; $tool_content .= "\n <td><input type='radio' name='selectedDocument' value='" . $entry['path'] . "'/></td>"; $tool_content .= "\n <td width='1%' valign='top' align='center' style='padding-top: 7px;'>" . icon($image, '') . "</td>"; $tool_content .= "\n <td><div align='left'>{$link_text}"; if (!empty($entry['comment'])) { $tool_content .= "<br /><span class='commentDoc'>" . nl2br(htmlspecialchars($entry['comment'])) . "</span>\n"; } $tool_content .= "</div></td>\n"; $tool_content .= "<td><div align='center'>{$size}</div></td><td><div align='center'>{$date}</div></td></tr>"; } $tool_content .= "\n <tr class='nobrd'>"; $tool_content .= "\n <td colspan='2'></td>"; $tool_content .= "\n <td colspan='3' class='right'><input class='btn btn-primary' type='submit' value='" . $langImport . "'></td>"; $tool_content .= "\n </tr>"; } $tool_content .= "\n </tbody>"; $tool_content .= "\n </table>"; $tool_content .= "\n </fieldset>"; $tool_content .= "\n</form>"; $tool_content .= "\n</div>"; $tool_content .= "<p class='right smaller'>{$langNote}:<br/>{$langScormIntroTextForDummies}</p>"; } // else if method == 'post' chdir($pwd); draw($tool_content, 2, null, $head_content);
<?php if ($user->data['user_id'] == ANONYMOUS) { error_box("Erreur", "Vous devez être connecté pour accèder à cette page.", "index.php"); exit; } $tpl = new raintpl(); if (!empty($user->data['partner']) && !empty($user->data['tokken'])) { $tpl->assign("link", "https://steamcommunity.com/tradeoffer/new/?partner=" . $user->data['partner'] . "&token=" . $user->data['tokken'] . ""); } draw($tpl->draw("page_trade", $return_string = true), "Mise à jour");