function templates_page_setup() { global $PAGE; global $CFG; if (!empty($PAGE->setupdone)) { return false; // don't run twice } $PAGE->setupdone = true; // leave your mark // // Populate $PAGE with links for non-module core code // if (isadmin()) { $PAGE->menu_top[] = array('name' => 'admin', 'html' => "<li><a href=\"" . $CFG->wwwroot . "mod/admin/\">" . __gettext("Administration") . "</a></li>"); } if (logged_on) { $PAGE->menu_top[] = array('name' => 'userdetails', 'html' => "<li><a href=\"" . $CFG->wwwroot . "_userdetails/\">" . __gettext("Account settings") . "</a></li>"); $PAGE->menu_top[] = array('name' => 'logoff', 'html' => "<li><a href=\"" . $CFG->wwwroot . "login/logout.php\">" . __gettext("Log off") . "</a></li>"); } // // Give a chance to all registered modules // if ($allmods = get_list_of_plugins('mod')) { foreach ($allmods as $mod) { $mod_pagesetup = $mod . '_pagesetup'; if (function_exists($mod_pagesetup)) { $mod_pagesetup(); } } } }
function get_content() { global $USER; $isteacher = get_record('role_assignments', 'userid', $USER->id, 'roleid', '3'); // Is the $USER assigned as Teacher, anywhere in the system? $iscoursecreator = get_record('role_assignments', 'userid', $USER->id, 'roleid', '2'); // Is the $USER assigned as Course Creator, anywhere in the system? if ($this->content !== NULL) { return $this->content; } //echo "debug teacher=";print_r($isteacher); if (!isadmin($USER->id)) { if (empty($isteacher) and empty($iscoursecreator)) { return; } } if (!empty($this->instance->pinned) or $this->instance->pagetype === 'course-view') { // fancy html allowed only on course page and in pinned blocks for security reasons $filteropt = new stdClass(); $filteropt->noclean = true; } else { $filteropt = null; } $this->content = new stdClass(); $this->content->text = isset($this->config->text) ? format_text($this->config->text, FORMAT_HTML, $filteropt) : ''; $this->content->footer = ''; unset($filteropt); // memory footprint return $this->content; }
/** * @param object $resource * @uses CFG, USER */ function get_text_for_indexing_pdf(&$resource) { global $CFG, $USER; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } // adds moodle root switch if none was defined if (!isset($CFG->block_search_usemoodleroot)) { set_config('block_search_usemoodleroot', 1); } $moodleroot = $CFG->block_search_usemoodleroot ? "{$CFG->dirroot}/" : ''; // just call pdftotext over stdout and capture the output if (!empty($CFG->block_search_pdf_to_text_cmd)) { preg_match("/^\\S+/", $CFG->block_search_pdf_to_text_cmd, $matches); if (!file_exists("{$moodleroot}{$matches[0]}")) { mtrace('Error with pdf to text converter command : executable not found at ' . $moodleroot . $matches[0]); } else { $file = escapeshellarg($CFG->dataroot . '/' . $resource->course . '/' . $resource->reference); $command = trim($CFG->block_search_pdf_to_text_cmd); $text_converter_cmd = "{$moodleroot}{$command} {$file} -"; $result = shell_exec($text_converter_cmd); if ($result) { return $result; } else { mtrace('Error with pdf to text converter command : execution failed for ' . $text_converter_cmd . '. Check for execution permission on pdf converter executable.'); return ''; } } } else { mtrace('Error with pdf to text converter command : command not set up. Execute once search block configuration.'); return ''; } }
/** * MS Word extractor * @param object $resource * @uses CFG, USER */ function get_text_for_indexing_doc(&$resource) { global $CFG, $USER; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } $moodleroot = @$CFG->block_search_usemoodleroot ? "{$CFG->dirroot}/" : ''; // just call pdftotext over stdout and capture the output if (!empty($CFG->block_search_word_to_text_cmd)) { if (!file_exists("{$moodleroot}{$CFG->block_search_word_to_text_cmd}")) { mtrace('Error with MSWord to text converter command : exectuable not found.'); } else { $file = escapeshellarg($CFG->dataroot . '/' . $resource->course . '/' . $resource->reference); $command = trim($CFG->block_search_word_to_text_cmd); $text_converter_cmd = "{$moodleroot}{$command} {$file}"; if ($CFG->block_search_word_to_text_env) { putenv($CFG->block_search_word_to_text_env); } mtrace("Executing : {$text_converter_cmd}"); $result = shell_exec($text_converter_cmd); if ($result) { return mb_convert_encoding($result, 'UTF8', 'auto'); } else { mtrace('Error with MSWord to text converter command : execution failed. '); return ''; } } } else { mtrace('Error with MSWord to text converter command : command not set up. Execute once search block configuration.'); return ''; } }
/** * Global Search Engine for Moodle * add-on 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr] * 2007/08/02 * * this is a format handler for getting text out of a proprietary binary format * so it can be indexed by Lucene search engine */ function get_text_for_indexing_pdf(&$resource) { global $CFG, $USER; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } // just call pdftotext over stdout and capture the output if (!empty($CFG->block_search_pdf_to_text_cmd)) { preg_match("/^\\S+/", $CFG->block_search_pdf_to_text_cmd, $matches); if (!file_exists("{$CFG->dirroot}/{$matches[0]}")) { mtrace('Error with pdf to text converter command : exectuable not found.'); } else { $file = $CFG->dataroot . '/' . $resource->course . '/' . $resource->reference; $text_converter_cmd = "{$CFG->dirroot}/{$CFG->block_search_pdf_to_text_cmd} {$file} -"; $result = shell_exec($text_converter_cmd); if ($result) { return $result; } else { mtrace('Error with pdf to text converter command : execution failed.'); return ''; } } } else { mtrace('Error with pdf to text converter command : command not set up. Execute once search block configuration.'); return ''; } }
public function _initialize() { $this->base(); if (isset($_GET['gid']) && intval($_GET['gid']) > 0) { $this->gid = intval($_GET['gid']); } elseif (isset($_POST['gid']) && intval($_POST['gid']) > 0) { $this->gid = intval($_POST['gid']); } else { $this->error('gid 错误'); } $groupinfo = D('Group')->where('id=' . $this->gid . " AND is_del=0")->find(); if (!$groupinfo) { $this->error('该群组不存在,或者被删除'); } //判读权限 成员权限 if ($groupinfo['brower_level'] == 1 && !isJoinGroup($this->uid, $this->gid)) { $this->error('只有成员可见'); } elseif ($groupinfo['brower_level'] == 0 && !$this->mid) { $this->error('登陆会员可见'); } $this->groupinfo = $groupinfo; $this->assign('groupinfo', $groupinfo); $this->assign('gid', $this->gid); //记录访问时间 D('Member')->where('gid=' . $this->gid . " AND uid={$this->mid}")->setField('mtime', time()); //判读是否是管理员 $this->isadmin = isadmin($this->mid, $this->gid); $this->assign('isadmin', $this->isadmin); $this->setTitle($this->groupinfo['name'] . '群-'); }
/** * Validate the data in passed in the configuration page * * @param $config - the information from the form mod.html * @return nothing , but returns an error if the configuration is wrong */ function liveclassroom_process_options(&$config) { global $CFG, $USER; /******* we do the following verfication before submitting the configuration -The parameters sent can not be empty -The url of the server can not finish with a / -The url must start with http:// -The api account has to valid ********/ $config->servername = trim($config->servername); $config->adminusername = trim($config->adminusername); $config->adminpassword = trim($config->adminpassword); if (!isadmin($USER->id)) { wimba_add_log(WIMBA_ERROR, WC, get_string('wrongconfigurationURLunavailable', 'liveclassroom')); error(get_string('errormustbeadmin', 'liveclassroom')); } if (empty($config->servername)) { wimba_add_log(WIMBA_ERROR, WC, get_string('wrongconfigurationURLunavailable', 'liveclassroom')); error(get_string('wrongconfigurationURLunavailable', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } else { if (empty($config->adminusername)) { wimba_add_log(WIMBA_ERROR, WC, get_string('emptyAdminUsername', 'liveclassroom')); error(get_string('emptyAdminUsername', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } else { if (empty($config->adminpassword)) { wimba_add_log(WIMBA_ERROR, WC, get_string('emptyAdminPassword', 'liveclassroom')); error(get_string('emptyAdminPassword', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } } } $length = strlen($config->servername); if ($config->servername[$length - 1] == '/') { wimba_add_log(WIMBA_ERROR, WC, get_String('trailingSlash', 'liveclassroom')); error(get_String('trailingSlash', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } if (!preg_match('/^http:\\/\\//', $config->servername)) { wimba_add_log(WIMBA_ERROR, WC, get_String('trailingHttp', 'liveclassroom')); error(get_String('trailingHttp', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } $prefixUtil = new PrefixUtil(); $prefix = $prefixUtil->getPrefix($config->adminusername); $api = new LCApi($config->servername, $config->adminusername, $config->adminpassword, $prefix); if (!$api->lcapi_authenticate()) { wimba_add_log(WIMBA_ERROR, WC, get_string('wrongadminpass', 'liveclassroom')); error(get_string('wrongadminpass', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } $domxml = false; $php_extension = get_loaded_extensions(); for ($i = 0; $i < count($php_extension); $i++) { if ($php_extension[$i] == "libxml" || $php_extension[$i] == "domxml") { $domxml = true; } } if ($domxml === false) { wimba_add_log(WIMBA_ERROR, WC, get_string('domxml', 'liveclassroom')); error(get_string('domxml', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } return; }
function makeAutoreplyList($selfurl) { global $uid, $special_codes_notice, $br, $guiPlus, $guiMinus, $editText, $addText, $delText; $content .= "\n <h2>List/Manage/Delete SMS autoreplies</h2>\n <p>\n <a href=\"{$selfurl}&op=add\">[ Add ]</a>\n <a href=\"{$selfurl}&op=export\">[ Export ]</a>\n <a href=\"{$selfurl}&op=import\">[ Import ]</a>\n <a href=\"{$selfurl}&op=test\">[ Test ]</a>\n <a href=\"{$selfurl}&op=help\">[ Help ]</a>\n <hr><p>\n "; $content .= genDelForm("delAutoreply", "{$selfurl}&op=delAutoreply"); $content .= genDelForm("delScenario", "{$selfurl}&op=delScenario"); $autoreplies = DB_DataObject::factory('playsms_featAutoreply'); if (!isadmin()) { $autoreplies->uid = $uid; } $autoreplies->orderBy("autoreply_code"); $autoreplies->find(); while ($autoreplies->fetch()) { $owner = uid2username($autoreplies->uid); $autoreplyInfo = generateScenarios($selfurl, $autoreplies->autoreply_id, false); $showhideLink = "<a href=\"javascript:;\" onClick=\"javascript: toggleShow('{$autoreplies->autoreply_code}', this, '{$guiPlus}', '{$guiMinus}');\" title=\"Show/Hide\">{$guiPlus}</a>"; $editLink = "<a href=\"{$selfurl}&op=edit&id={$autoreplies->autoreply_id}\" title=\"Edit\">{$editText}</a>"; $deleteMsg = "Are you sure you want to delete SMS autoreply `{$autoreplies->autoreply_code}`? Note that this will delete all autoreply scenarios under this autoreply."; $deleteLink = "<a href=\"javascript: delAutoreply({$autoreplies->autoreply_id}, '{$deleteMsg}');\" title=\"Delete\">{$delText}</a>"; $content .= "{$showhideLink} \n {$editLink} \n {$deleteLink} \n <b>{$autoreplies->autoreply_code} </b>" . "<span id='{$autoreplies->autoreply_code}' style='display: none;'>" . "<span><b>User:</b> {$owner}<br><hr/></span>" . "<span style='position:relative; left:30px;'>{$autoreplyInfo}</span>" . "<span><hr/></span>" . "</span> \n<br/>"; $content .= "<br/>\n\n"; } echo $content; echo "<hr><p/><b>Special codes:</b> {$br}{$special_codes_notice}"; }
public function _initialize() { $this->group = D('Group'); parent::_initialize(); //$this->assign('current','member'); if (!isadmin($this->mid, $this->gid)) { $this->error('你没有权限进行管理'); } }
/** * @param object $resource * @uses CFG, USER */ function get_text_for_indexing_ppt(&$resource) { global $CFG, $USER; $indextext = null; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } $text = implode('', file("{$CFG->dataroot}/{$resource->course}/{$resource->reference}")); $remains = $text; $fragments = array(); while (preg_match('/\\x00\\x9F\\x0F\\x04.{9}(......)(.*)/s', $remains, $matches)) { $unpacked = unpack("ncode/Llength", $matches[1]); $sequencecode = $unpacked['code']; $length = $unpacked['length']; // print "length : ".$length." ; segment type : ".sprintf("%x", $sequencecode)."<br/>"; $followup = $matches[2]; // local system encoding sequence if ($sequencecode == 0xa80f) { $aFragment = substr($followup, 0, $length); $remains = substr($followup, $length); $fragments[] = $aFragment; } elseif ($sequencecode == 0xa00f) { $aFragment = substr($followup, 0, $length); // $aFragment = mb_convert_encoding($aFragment, 'UTF-16', 'UTF-8'); $aFragment = preg_replace('/\\xA0\\x00\\x19\\x20/s', "'", $aFragment); // some quotes $aFragment = preg_replace('/\\x00/s', "", $aFragment); $remains = substr($followup, $length); $fragments[] = $aFragment; } else { $remains = $followup; } } $indextext = implode(' ', $fragments); $indextext = preg_replace('/\\x19\\x20/', "'", $indextext); // some quotes $indextext = preg_replace('/\\x09/', '', $indextext); // some extra chars $indextext = preg_replace('/\\x0D/', "\n", $indextext); // some quotes $indextext = preg_replace('/\\x0A/', "\n", $indextext); // some quotes $indextextprint = implode('<hr/>', $fragments); // debug code // $logppt = fopen("C:/php5/logs/pptlog", "w"); // fwrite($logppt, $indextext); // fclose($logppt); if (!empty($CFG->block_search_limit_index_body)) { $indextext = shorten($text, $CFG->block_search_limit_index_body); } $indextext = mb_convert_encoding($indextext, 'UTF8', 'auto'); return $indextext; }
function __construct() { if (!islogged()) { redirect('login'); } if (!isadmin()) { redirect('/'); } $this->adminmodel = new adminmodel(); $this->mailerdecorator = new mailerdecorator(); }
function getperm() { if (!islogged()) { echo "¬logged"; } else { if (isadmin()) { echo "&admin"; } else { echo "&logged"; } } }
function can_get_list($user) { if (isadmin()) { return TRUE; } foreach ($user as $u) { if (can_get_listrule($u)) { continue; } else { return FALSE; } } return TRUE; }
/** * Global Search Engine for Moodle * add-on 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr] * 2007/08/02 * * this is a format handler for getting text out of a proprietary binary format * so it can be indexed by Lucene search engine */ function get_text_for_indexing_txt(&$resource) { global $CFG, $USER; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } // just try to get text empirically from ppt binary flow $text = implode('', file("{$CFG->dataroot}/{$resource->course}/{$resource->reference}")); if (!empty($CFG->block_search_limit_index_body)) { $text = shorten($text, $CFG->block_search_limit_index_body); } return $text; }
function makeList($uid, $selfurl, $offset = 0, $numShow = 75) { $db = DB_DataObject::factory('playsms_tblUserInbox'); if (!$offset) { $offset = 0; } $db->limit($offset, $numShow); $db->orderBy("in_id DESC"); $pagetitle = "Inbox"; if (isadmin() && !$uid) { $pagetitle .= " (All)"; } else { $db->in_uid = $uid; } $db->in_hidden = '0'; if ($offset) { $newOffset = $offset - $numShow; $prevUrl = "{$selfurl}&offset={$newOffset}"; } else { $prevUrl = "#"; } $note = "<p>Note: This inbox shows messages not processed by any of the features (e.g., AutoReply, Poll, etc)</p>"; $newOffset = $offset + $numShow; $nextUrl = "{$selfurl}&offset={$newOffset}"; $exportUrl = "{$selfurl}&op=export"; $linksPrevNext = "<a href='{$prevUrl}'>[ Prev] </a>\n \t\t \t\t <a href='{$nextUrl}'>[ Next ]</a>\n <a href='{$exportUrl}'>[ Export ]</a>"; // create hidden form with the // id to delete, this way it will // get POSTed // $delForm = generateActionSubmitter("del", "{$selfurl}&op=del", "id"); $content = "{$delForm}\n\t\t <h2>{$pagetitle}</h2>\n\t\t <p/>\n\t\t\t{$linksPrevNext}\n\t\t <p/>{$note}\n\t\t <table width=100% cellpadding=1 cellspacing=1 border=1>\n\t\t <tr>\n\t\t <td align=center class=box_title width=4>*</td>\n\t\t <td align=center class=box_title width=20%>Time</td>\n\t\t <td align=center class=box_title width=20%>Sender</td>\n\t\t <td align=center class=box_title width=60%>Message</td>\n\t\t <td align=center class=box_title>Action</td>\n\t\t </tr>\n\t\t"; $db->find(); while ($db->fetch()) { $in_id = $db->in_id; $in_sender = $db->in_sender; $p_desc = pnum2pdesc($in_sender); $current_sender = $in_sender; if ($p_desc) { $current_sender = "{$in_sender}<br>({$p_desc})"; } $in_msg = nl2br($db->in_msg); $in_datetime = $db->in_datetime; $deleteCode = "javascript: del({$db->in_id}, " . "'Are you sure you want to delete this SMS ?');"; $actionCode = "<a href=\"{$deleteCode}\">[Delete]</a>"; $content .= "\n\t\t\t<tr>\n\t\t\t\t<td valign=top class=box_text align=left width=4>{$db->in_id}</td>\n\t\t\t\t<td valign=top class=box_text align=center width=20%>{$in_datetime}</td>\n\t\t\t\t<td valign=top class=box_text align=center width=20%>{$current_sender}</td>\n\t\t\t\t<td valign=top class=box_text align=left width=60%>{$in_msg}</td>\n\t\t\t\t<td valign=top class=box_text align=left nowrap>{$actionCode}</td>\n\t\t\t</tr>\n\t\t "; } $content .= "</table>"; return $content; }
/** * Global Search Engine for Moodle * add-on 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr] * 2007/08/02 * * this is a format handler for getting text out of a proprietary binary format * so it can be indexed by Lucene search engine */ function get_text_for_indexing_xml(&$resource) { global $CFG, $USER; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } // just get text $text = implode('', file("{$CFG->dataroot}/{$resource->course}/({$resource->reference})")); // filter out all xml tags $text = preg_replace("/<[^>]*>/", ' ', $text); if (!empty($CFG->block_search_limit_index_body)) { $text = shorten($text, $CFG->block_search_limit_index_body); } return $text; }
function exportAllData($inbox) { global $uid; $delim = ','; $db = DB_DataObject::factory($inbox ? 'playsms_tblUserInbox' : 'playsms_tblSMSOutgoing'); if (isadmin() && !$uid) { } else { if ($inbox) { $db->in_uid = $uid; } else { $db->uid = $uid; } } if ($inbox) { $db->in_hidden = '0'; $orderBy = "in_id DESC"; $filename = "inbox-export.csv"; } else { $db->flag_deleted = '0'; $filename = "outbox-export.csv"; $orderBy = "smslog_id DESC"; } // send the file contents to the browser // so that it'll prompt the user to save it header('Content-type: text/csv'); header("Content-Disposition: attachment; filename=\"{$filename}\""); $line = "id,date,phone number"; if (!$inbox) { $line .= ",status"; } $line .= ",message\n"; echo $line; $db->orderBy($orderBy); $db->find(); while ($db->fetch()) { if ($inbox) { $msg = prepLongFieldForCsv($db->in_msg); $line = $db->in_id . $delim . $db->in_datetime . $delim . $db->in_sender . $delim . "\"{$msg}\"" . "\n"; } else { $msg = prepLongFieldforCsv($db->p_msg); $line = $db->smslog_id . $delim . $db->p_datetime . $delim . $db->p_dst . $delim . getStatusName($db->p_status) . $delim . "\"{$msg}\"" . "\n"; } echo $line; } }
function get_content() { global $CFG, $COURSE; $daysnb = $CFG->block_graph_stats_daysnb; if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); $this->content->footer = ''; if (empty($this->instance)) { $this->content->text = ''; return $this->content; } $this->content->text = '<center><font size=1>' . get_string('graphtitle', 'block_graph_stats', $daysnb) . '</center>'; if (isadmin() or isteacher($COURSE->id)) { $name = 'popup'; $title = get_string('connectedtoday', 'block_graph_stats'); $url = '/blocks/' . $this->name() . '/details.php'; $options = 'menubar=0,location=0,scrollbars,resizable,width=400,height=500'; $fullscreen = 0; $linkname = '<img src="' . $CFG->wwwroot . '/blocks/' . $this->name() . '/graph.php?course_id=' . $COURSE->id . '" alt="' . get_string('graphtitle', 'block_graph_stats', $daysnb) . '" />'; $this->content->text .= '<center><a target="' . $name . '" title="' . $title . '" href="' . $CFG->wwwroot . $url . '" ' . "onclick=\"return openpopup('{$url}', '{$name}', '{$options}', {$fullscreen});\">{$linkname}</a></center>"; } else { $this->content->text .= '<center><img src="' . $CFG->wwwroot . '/blocks/' . $this->name() . '/graph.php?course_id=' . $COURSE->id . '" alt="' . get_string('graphtitle', 'block_graph_stats', $daysnb) . '" /></center>'; } // Check if we are in a course or on the first page if ($COURSE->id > 1) { // In a course $connections = count_records_select('log', 'time > ' . mktime(0, 0, 0, date("m"), date("d"), date("Y")) . ' AND action = "view" AND course = ' . $COURSE->id . ' ', 'COUNT(DISTINCT(userid))'); $this->content->text .= '<center><font size=1>' . get_string('connectedtoday', 'block_graph_stats') . $connections . '</font></center>'; } else { // On the first page $connections = count_records_select('log', 'time > ' . mktime(0, 0, 0, date("m"), date("d"), date("Y")) . ' AND action = "login"', 'COUNT(userid)'); $this->content->text .= '<center><font size=1>' . get_string('connectedtoday', 'block_graph_stats') . $connections . '</font></center>'; // Show details $users = count_records('user', 'deleted', 0, 'confirmed', 1); $courses = count_records('course', 'visible', 1); $this->content->text .= '<hr />'; $this->content->text .= get_string('membersnb', 'block_graph_stats') . $users . '<br />'; $this->content->text .= get_string('coursesnb', 'block_graph_stats') . $courses . '<br />'; } return $this->content; }
public function index($message = null) { $users = new useriterator($this->usermodel->get_users()); $data['title'] = lang('title.accounts'); view::load_view('default/standard/header', $data); view::load_view('default/standard/menu'); if (!isadmin()) { $this->profile(); } else { if ($users) { $data['users'] = $users; $data['bool'] = array('/public/img/icn_alert_error.png', '/public/img/icn_alert_success.png'); view::load_view('default/accounts/userslist', $data); } else { view::load_view('default/index/welcome'); } } view::load_view('default/standard/footer'); }
/** * @param object $resource * @uses CFG, USER */ function get_text_for_indexing_htm(&$resource) { global $CFG, $USER; // SECURITY : do not allow non admin execute anything on system !! if (!isadmin($USER->id)) { return; } // just get text $text = implode('', file("{$CFG->dataroot}/{$resource->course}/{$resource->reference}")); // extract keywords and other interesting meta information and put it back as real content for indexing if (preg_match('/(.*)<meta ([^>]*)>(.*)/is', $text, $matches)) { $prefix = $matches[1]; $meta_attributes = $matches[2]; $suffix = $matches[3]; if (preg_match('/name="(keywords|description)"/i', $meta_attributes)) { preg_match('/content="([^"]+)"/i', $meta_attributes, $matches); $text = $prefix . ' ' . $matches[1] . ' ' . $suffix; } } // brutally filters all html tags $text = preg_replace("/<[^>]*>/", '', $text); $text = preg_replace("/<!--[^>]*-->/", '', $text); $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8'); $text = mb_convert_encoding($text, 'UTF-8', 'AUTO'); /* * debug code for tracing input echo "<hr/>"; $FILE = fopen("filetrace.log", 'w'); fwrite($FILE, $text); fclose($FILE); echo "<hr/>"; */ if (!empty($CFG->block_search_limit_index_body)) { $text = shorten($text, $CFG->block_search_limit_index_body); } return $text; }
// if already using roles system if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { if (moodle_needs_upgrading()) { redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php'); } } else { if (!empty($CFG->mymoodleredirect)) { // Redirect logged-in users to My Moodle overview if required if (isloggedin() && $USER->username != 'guest') { redirect($CFG->wwwroot . '/my/index.php'); } } } } else { // if upgrading from 1.6 or below if (isadmin() && moodle_needs_upgrading()) { redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php'); } } if (get_moodle_cookie() == '') { set_moodle_cookie('nobody'); // To help search for cookies on login page } if (!empty($USER->id)) { add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID); } if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages();
<?php if (!defined('_SECURE_')) { die('Intruder alert'); } if (!isadmin()) { forcenoaccess(); } $slid = $_REQUEST['slid']; switch ($op) { case "all_outgoing": if (!$page) { $page = 1; } if (!$nav) { $nav = 1; } $line_per_page = 50; $max_nav = 15; $db_query = "SELECT count(*) as count FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE flag_deleted='0'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $num_rows = $db_row['count']; $pages = ceil($num_rows / $line_per_page); $nav_pages = themes_navbar($pages, $nav, $max_nav, "index.php?app=menu&inc=all_outgoing&op=all_outgoing", $page); $limit = ($page - 1) * $line_per_page; $content = "\n\t <h2>" . _('All outgoing SMS') . "</h2>\n\t <p>{$nav_pages}</p>\n\t <form name=\"fm_outgoing\" action=\"index.php?app=menu&inc=all_outgoing&op=act_del\" method=post onSubmit=\"return SureConfirm()\">\n\t <table width=100% cellpadding=1 cellspacing=2 border=0 class=\"sortable\">\n <thead>\n\t <tr>\n\t <th align=center width=4>*</th>\n\t <th align=center width=10%>" . _('User') . "</th>\n\t <th align=center width=20%>" . _('Time') . "</th>\n\t <th align=center width=10%>" . _('Gateway') . "</th>\n\t <th align=center width=10%>" . _('Receiver') . "</th>\n\t <th align=center width=40%>" . _('Message') . "</th>\n\t <th align=center width=10%>" . _('Status') . "</th>\n\t <th align=center width=4>" . _('Group') . "</th>\n\t <th align=center width=4 class=\"sorttable_nosort\">" . _('Action') . "</th>\n\t <th width=4 class=\"sorttable_nosort\"><input type=checkbox onclick=CheckUncheckAll(document.fm_outgoing)></td>\n\t </tr>\n </thead>\n <tbody>\n\t"; $db_query = "SELECT * FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE flag_deleted='0' ORDER BY smslog_id DESC LIMIT {$limit},{$line_per_page}"; $db_result = dba_query($db_query); $i = $num_rows - $line_per_page * ($page - 1) + 1; $j = 0;
<?php require_once '../hibbity/dbinfo.php'; if (!isadmin($_COOKIE['user_id'])) { header("Location: " . BASE_URL . "/post/list"); exit; } /*$tag_to_delete = 'naruto'; $id = 94; echo "Removing all data for files tagged " . $tag_to_delete . "<br />"; $sql = "SELECT i.hash, t.image_id FROM `image_tags` t LEFT OUTER JOIN `images` i ON t.image_id = i.id WHERE `tag_id` = " . $id; $get = mysql_query($sql); while($run = mysql_fetch_assoc($get)) { $ab = substr($run['hash'], 0, 2); $thumb_name = SITE_DIR . "/thumbs/" . $ab . "/" . $run['hash']; $image_name = SITE_DIR . "/images/" . $ab . "/" . $run['hash']; unlink($thumb_name); echo "Removed thumb for " . $run['image_id'] . "<br />"; unlink($image_name); echo "Removed image for " . $run['image_id'] . "<br />"; $delsql = "DELETE FROM `images` WHERE `id` = " . $run['image_id'] . " LIMIT 1"; mysql_query($delsql); echo "Removed db entry for " . $run['image_id'] . "<br />"; $delsql = "DELETE FROM `image_tags` WHERE `image_id` =" . $run['image_id']; mysql_query($delsql); echo "Removed tags for " . $run['image_id'] . "<br />"; $delsql = "DELETE FROM `image_groups` WHERE `image_id` =" . $run['image_id']; mysql_query($delsql);
mkdir($stat_dir, 0710, true); } $d = dir($log_dir); $output[] = '<blockquote>'; while (false !== ($f = $d->read())) { $file = PHP_OS == 'WINNT' ? 'access.log' : 'access_log'; $log_file = $log_dir . "/{$f}/{$file}"; if (is_file($log_file)) { $output[] = ""; $output[] = "Processing {$s->name}/{$f} ..."; $cmd = "{$webalizer_path} -o {$stat_dir} -n {$s->name} {$log_file}"; $output[] = $cmd; $output[] = array_pop(explode("\n", trim(shell_exec($cmd)))); } else { //var_dump($log_file); } } $output[] = "</blockquote>\n"; $d->close(); } $output = nl2br(join("\n", $output)); break; case 'list': default: $task = 'list'; $sites = isadmin() ? ZVhosts::getVhosts() : ZVhosts::listMyVhosts(); break; } if (!$norender) { include template('site'); }
<?php if (!defined('_SECURE_')) { die('Intruder alert'); } $db_query = "SELECT * FROM " . _DB_PREF_ . "_gatewayTemplate_config"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $template_param['name'] = $db_row['cfg_name']; $template_param['path'] = $db_row['cfg_path']; $template_param['global_sender'] = $db_row['cfg_global_sender']; } //$gateway_number = $template_param['global_sender']; // insert to left menu array if (isadmin()) { $menutab_gateway = $core_config['menu']['main_tab']['gateway']; $arr_menu[$menutab_gateway][] = array("index.php?app=menu&inc=gateway_template&op=manage", _('Manage template')); }
</form> <br/> <div align="center"> <?php print_string('searching', 'search') . ': '; if ($sq->is_valid_index()) { //use cached variable to show up-to-date index size (takes deletions into account) print $CFG->search_index_size; } else { print "0"; } print ' '; print_string('documents', 'search'); print '.'; if (!$sq->is_valid_index() and isadmin()) { print '<p>' . get_string('noindexmessage', 'search') . '<a href="indexersplash.php">' . get_string('createanindex', 'search') . "</a></p>\n"; } ?> </div> <?php print_box_end(); // prints all the results in a box if ($sq->is_valid()) { print_box_start(); search_stopwatch(); $hit_count = $sq->count(); print "<br />"; print $hit_count . ' ' . get_string('resultsreturnedfor', 'search') . " '" . stripslashes($query_string) . "'."; print "<br />"; if ($hit_count > 0) {
if (!empty($formdata->id)) { $id = $formdata->id; } if ($id) { if (!($cm = get_record("course_modules", "id", $id))) { error("Course Module ID was incorrect"); } if (!($course = get_record("course", "id", $cm->course))) { error("Course is misconfigured"); } if (!($feedback = get_record("feedback", "id", $cm->instance))) { error("Course module is incorrect"); } } require_login($course->id); if (!(isteacher($course->id) || isadmin())) { error(get_string('error')); } $filename = "feedback.xls"; //Dem Browser mitteilen, dass jetzt eine Exceldatei zum Downloaden kommt header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); //get the groupid for this module //get the groupid $mygroupid = $SESSION->lstgroupid; // Creating a workbook $workbook = new EasyWorkbook("-"); // Creating the worksheets
function get_feedback_groupid($course, $cm) { $groupmode = groupmode($course, $cm); //get groupid if ($groupmode > 0 && !isadmin()) { return mygroupid($course->id); } else { return false; } }
function ftp_list() { $owner = isadmin() ? '' : getmyname(); $accounts = ZFtp::getFtpAccounts($owner); return json_encode($accounts); }
<input type="hidden" name="post_id" value="<?php echo $post_id; ?> " /> <input type="hidden" name="user_id" value="<?php echo $_COOKIE['user_id']; ?> " /> <input type="submit" name="submit" value="<?php echo $thing; ?> " style="display:inline;" /> <a href="<?php echo BASE_URL; ?> /forum/list">Cancel</a><br /> <?php if (isadmin($_COOKIE['user_id']) && isset($run['id'])) { echo '<span class="small"><a href="' . BASE_URL . '/admin/delete/forum/' . $run['id'] . '">Delete Post</a></span>'; } ?> </span> </div> </form> </div> </div> </div> <?php require_once "footer.php";