function create_faculty_file() { $fac_file = get_file(); // Get the html file if (empty($fac_file)) { return false; } preg_match('/<tbody(.+)tbody>/sm', $fac_file, $table); // Get the table $rows = preg_split('/<tr/', $table[0]); // Get each row array_shift($rows); // Get rid of the first element $fp = fopen(FACULTY_FILE, 'w'); // Open the file for writing if (empty($fp)) { return false; } if (@flock($fp, LOCK_EX)) { // Prevent multiple creations foreach ($rows as $row) { // Iterate through the rows $cols = preg_split('/<td/', $row); // Split up the columns $name = filter_name($cols[1]); // Get the name $area = filter_area($cols[2]); // Get the area of research $mail = filter_email($cols[3]); // Get the email fwrite($fp, "{$mail},{$name},{$area}\n"); // Write the output to the file } flock($fp, LOCK_UN); } else { fclose($fp); // Couldn't get lock return false; } fclose($fp); // Close the file return true; }
$hash = trim(gpc('hash', 'G', '')); $md5_sign = md5($uid . $folder_id . $plugin_type . $settings[phpdisk_url]); if ($md5_sign != $hash) { exit('[PHPDisk] Error Params!'); } $action = $action ? $action : 'doupload'; switch ($action) { default: $upload_url = urr("plugin_upload", "uid={$uid}&folder_id={$folder_id}&plugin_type={$plugin_type}&hash={$hash}"); if ($task == 'doupload') { $file = $_FILES['upload_file']; $sign = gpc('sign', 'P', ''); if (!is_utf8()) { $file['name'] = convert_str('utf-8', 'gbk', $file['name']); } $file['name'] = filter_name($file['name']); $file_extension = $db->escape(get_extension($file['name'])); $esp = strlen($file_extension) + 1; if ($file_extension) { $file_name = $db->escape(substr($file['name'], 0, strlen($file['name']) - $esp)); } else { $file_name = $db->escape($file['name']); } /*$file_name = str_replace(' ','_',$file_name); $username = $db->result_first("select username from {$tpf}users where userid='$uid'"); $tmp_username = is_utf8() ? convert_str('utf-8','gbk',$username) : $username;*/ $file_real_path = PHPDISK_ROOT . $settings['file_path'] . '/'; $file_store_path = date('Y/m/d/'); //$file_store_path_store = is_utf8() ? convert_str('utf-8','gbk',$file_store_path) : $file_store_path; make_dir($file_real_path . $file_store_path);
function one_mail($subject, $body, $to) { //returns true=ok, false=notok $config = $GLOBALS['config']; $from = filter_email($config['mail_username']); $subject = filter_name($subject); $to = filter_email($to); if (isset($config['mail_smtp']) && $config['mail_smtp']) { require_once "Mail.php"; $host = $config['mail_smtp_host']; $port = $config['mail_smtp_port']; $username = $config['mail_username']; $password = $config['mail_password']; $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject, 'Content-Type' => 'text/html'); $smtp = Mail::factory('smtp', array('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { return false; } else { return true; } } else { $headers = "From: {$from}\r\n"; $headers .= "To: {$to}\r\n"; $headers .= "Content-type: text/html\r\n"; return mail($to, $subject, $body, $headers); } }
/** * Function used by public events and admin events index to output the HTML for both the filter * controls and current filter status (Showing Events That Include:) box. */ function events_output_filter_controls($module_type = "") { global $db, $ENTRADA_ACL, $ENTRADA_USER, $translate; /** * Determine whether or not this is being called from the admin section. */ if ($module_type == "admin") { $module_type = "/admin"; } else { $module_type = ""; } /** * Retrieve this from the language file for this template. */ $filter_controls = $translate->_("events_filter_controls"); ?> <table id="filterList" style="clear: both; width: 100%" cellspacing="0" cellpadding="0" border="0" summary="Event Filters"> <tr> <td style="width: 53%; vertical-align: top"> <form action="<?php echo ENTRADA_RELATIVE . $module_type; ?> /events" method="get" id="filter_edit" name="filter_edit" style="position: relative;" class="form-horizontal"> <input type="hidden" name="action" value="filter_edit" /> <input type="hidden" id="filter_edit_type" name="filter_type" value="" /> <input type="hidden" id="multifilter" name="filter" value="" /> <div class="control-group"> <label for="filter_select" class="control-label" style="width:100px;font-weight:bold;text-align:left;vertical-align: middle">Apply Filter:</label> <div class="controls" style="margin-left:100px"> <select id="filter_select" onchange="showMultiSelect();"> <option>Select Filter</option> <?php if ($filter_controls) { foreach ($filter_controls as $value => $control) { echo "<option value=\"" . $value . "\">" . $control["label"] . "</option>"; } } ?> </select> </div> </div> <span id="filter_options_loading" style="display:none; vertical-align: middle"><img src="<?php echo ENTRADA_RELATIVE; ?> /images/indicator.gif" width="16" height="16" alt="Please Wait" title="" style="vertical-align: middle" /> Loading ... </span> <span id="options_container"></span> </form> <script type="text/javascript"> var multiselect = []; var id; function showMultiSelect() { $$('select_multiple_container').invoke('hide'); id = $F('filter_select'); if (multiselect[id]) { multiselect[id].container.show(); } else { new Ajax.Request('<?php echo ENTRADA_URL . "/api/events_filters.api.php"; ?> ', { parameters: {options_for: id}, method: "GET", onLoading: function() { $('filter_options_loading').show(); }, onSuccess: function(response) { $('options_container').insert(response.responseText); if ($(id+'_options')) { $('filter_edit_type').value = id; $(id+'_options').addClassName('multiselect-processed'); multiselect[id] = new Control.SelectMultiple('multifilter',id+'_options',{ checkboxSelector: 'table.select_multiple_table tr td input[type=checkbox]', nameSelector: 'table.select_multiple_table tr td.select_multiple_name label', filter: id+'_select_filter', resize: id+'_scroll', afterCheck: function(element) { var tr = $(element.parentNode.parentNode); tr.removeClassName('selected'); if (element.checked) { tr.addClassName('selected'); } } }); $(id+'_cancel').observe('click',function(event){ this.container.hide(); $('filter_select').options.selectedIndex = 0; $('filter_select').show(); return false; }.bindAsEventListener(multiselect[id])); $(id+'_close').observe('click',function(event){ this.container.hide(); $('filter_edit').submit(); return false; }.bindAsEventListener(multiselect[id])); multiselect[id].container.show(); } }, onError: function(response) { alert("There was an error retrieving the events filter requested. Please try again.") }, onComplete: function() { $('filter_options_loading').hide(); } }); } return false; } function setDateValue(field, date) { timestamp = getMSFromDate(date); if (field.value != timestamp) { window.location = '<?php echo ENTRADA_URL . $module_type . "/events?" . ($_SERVER["QUERY_STRING"] != "" ? replace_query(array("dstamp" => false)) . "&" : ""); ?> dstamp='+timestamp; } return; } </script> </td> <td style="width: 47%; vertical-align: top"> <?php if (is_array($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]) && count($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"])) { echo "<div summary=\"Selected Filter List\" id=\"filter-list\" class=\"inner-content-box\">\n"; echo " <div class=\"inner-content-box-head\">\n"; echo " Showing Events That Include:\n"; echo " </div>\n"; echo " <div class=\"clearfix inner-content-box-body\">\n"; echo " <div id=\"filter-list-resize-handle\">"; echo "\t\t <div id=\"filter-list-resize\">\n"; foreach ($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"] as $filter_type => $filter_contents) { if (is_array($filter_contents)) { echo $filter_name = filter_name($filter_type); echo "\t <div>\n"; foreach ($filter_contents as $filter_key => $filter_value) { echo "\t <div id=\"" . $filter_type . "_" . $filter_key . "\">"; echo "\t\t <a href=\"" . ENTRADA_URL . $module_type . "/events?action=filter_remove&filter=" . $filter_type . "_" . $filter_key . "\" title=\"Remove this filter\">"; switch ($filter_type) { case "teacher": case "student": echo get_account_data("fullname", $filter_value); break; case "course": echo fetch_course_title($filter_value); break; case "group": echo fetch_group_title($filter_value); break; case "eventtype": echo fetch_eventtype_title($filter_value); break; case "term": echo fetch_term_title($filter_value); break; case "cp": case "co": echo fetch_objective_title($filter_value); break; case "topic": echo fetch_event_topic_title($filter_value); break; case "department": echo fetch_department_title($filter_value); break; default: echo strtoupper($filter_value); break; } echo " </a>"; echo " </div>\n"; } echo " </div>\n"; } } echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo "</div>\n"; echo "<script type=\"text/javascript\">"; echo "\tnew ElementResizer(\$('filter-list-resize'), {handleElement: \$('filter-list-resize-handle'), min: 40});"; echo "</script>"; } ?> </td> </tr> </table> <?php }
function create_down_url($file) { global $settings, $timestamp; $pp = $file['file_store_path'] . $file['file_real_name'] . get_real_ext($file['file_extension']); $fs = $file['file_size']; $hash = strtoupper(md5($file['file_id'] . '_' . $file['file_size'] . '_' . $file['file_store_path'] . $file['file_real_name'])); $tmp_ext = $file['file_extension'] ? '.' . $file['file_extension'] : ""; $p_filename = filter_name($file['file_name'] . $tmp_ext); $expire_time = $settings[dl_expire_time] ? $settings[dl_expire_time] + $timestamp : 0; return urr("dl", pd_encode("file_name={$p_filename}&file_id={$file['file_id']}&fs={$fs}&pp={$pp}&hash={$hash}&expire_time={$expire_time}")); }
parse_str(pd_decode($str)); if ($expire_time && $expire_time < $timestamp) { header("Content-Type: text/html; charset=utf-8"); $src_url = $settings[phpdisk_url] . "viewfile.php?file_id={$file_id}"; echo '<p>请登录原地址重新获取: <a href="' . $src_url . '" target="_blank">' . $src_url . '<a></p>'; echo '<p style="color:#ff0000">温馨提示:此文件链接已失效,请勿非法盗链。</p>'; exit; } $pp = $pp . get_real_ext(get_extension($pp)); if (!file_exists(PHPDISK_ROOT . FILE_PATH . '/' . $pp)) { header("Content-Type: text/html; charset=utf-8"); echo '<p style="padding:10px; font-size:12px;">文件ID: ' . $file_id . '<br>'; echo '[' . $file_name . '] 文件不存在,请联系网站管理员处理。<br><br>'; echo '联系方式:' . $settings[contact_us] . '</p>'; } else { $file_name = filter_name(str_replace("+", "%20", $file_name)); ob_end_clean(); $ua = $_SERVER["HTTP_USER_AGENT"]; if (preg_match("/MSIE/i", $ua)) { header('Content-disposition: attachment;filename="' . iconv('utf-8', 'gbk', $file_name) . '"'); } else { header('Content-disposition: attachment;filename="' . $file_name . '"'); } header('Content-type: application/octet-stream'); if ($settings[open_xsendfile] == 2) { header('X-Accel-Redirect: /' . FILE_PATH . '/' . $pp); } elseif ($settings[open_xsendfile] == 1) { header('X-sendfile: ./' . FILE_PATH . '/' . $pp); } else { header('Content-Encoding: none'); header('Content-Transfer-Encoding: binary');