function fsDirRead($path, $full = true, $keyformat = null, $post = '/') { if (file_exists($path)) { $temp = scandir($path); foreach ($temp as $file) { if (!in_array(strtolower($file), array('.', '..', '.ds_store'))) { if ($keyformat == lc_filename) { $key = strtolower(filename($file)); } else { if ($keyformat == lc_basename) { $key = strtolower($file); } else { if ($keyformat == uc_filename) { $key = strtolower(filename($file)); } else { if ($keyformat == uc_basename) { $key = strtoupper($file); } else { if ($keyformat == filename) { $key = filename($file); } else { if ($keyformat == basename) { $key = $file; } else { if ($keyformat == position_in_array) { $key = count($output) - 1; } else { if ($keyformat == path) { $key = $path; } else { if ($keyformat == full_path) { $key = $path . $file; } } } } } } } } } if (!$full) { $output[$key] = $file . $post; } else { $output[$key] = $path . '/' . $file . $post; } } } return $output; } }
function render($template, $template_vars = array()) { $template_file = filename($template); if (file_exists($template_file)) { if (!empty($template_vars) and is_array($template_vars)) { extract($template_vars); } ob_start(); require $template_file; $buffer = ob_get_contents(); ob_end_clean(); return $buffer; } else { trigger_error("Eh-oh! Required template {$template} ({$template_file}) not found", E_USER_ERROR); } return false; }
function create_model($opts) { $filename = filename($opts[0]); $text = <<<MODEL <?php class {$filename} extends Model { const TABLE = "{$opts['0']}"; } MODEL; $fh = fopen(APP_ROOT . '/app/models/' . $filename . '.class.php', 'w'); fwrite($fh, $text); fclose($fh); create_migration($opts); }
function iframe_accept_images($val) { $root_patt = prepare_pattern(config_get('http-document-root')); $val = preg_replace("'(<img[\\/\\!]*?[^<>]*?)(ilo-full-src\\s*=\\s*\"?[\\w\\:\\+\\-\\/\\%\\\$\\#\\.\\,]*\"?)([^<>]*?>)'si", '\\1\\3', $val); $val = preg_replace("'(<img[\\/\\!]*?[^<>]*?)(src\\s*=\\s*\"?{$root_patt}([\\w\\+\\-\\:\\/\\%\\\$\\#\\.\\,]*)\"?)([^<>]*?>)'si", '\\1src="\\3"\\4', $val); $images = iframe_get_images($val); $files = iframe_get_files($val); $f = combine_arrays($images, $files); for ($i = 0, $n = count($f); $i < $n; $i++) { $storage = manage_storage_by_dir(dirname($f[$i])); if ($storage) { $storage->AcceptFile(filename($f[$i])); } } $val = preg_replace("'(<img[\\/\\!]*?[^<>]*?)(src\\s*=\\s*\"?\\/([\\w\\+\\-\\:\\/\\%\$\\#\\.\\,]*)\"?)([^<>]*?>)'si", '\\1src="${document-root}/\\3"\\4', $val); return $val; }
/** * Maintenance Mode */ function MaintenanceMode($mode = MAINTENANCE) { # $mode either equals true or false if ($mode) { # if we are in maintenance, require all pages to go to the maintenance page if (filename($_SERVER['SCRIPT_FILENAME']) != 'maintenance.php') { # Replace the location to the loacation of your maintenance page header("Location: " . BASE_URL . "maintenance.php"); exit; } } else { # if we are not in maintenance, don't allow link to maintenance page if (filename($_SERVER['SCRIPT_FILENAME']) == 'maintenance.php') { # Replace the location to the loacation to your home page header("Location: BASE_URL"); exit; } } }
function func_cp($params) { if (isset($params[2])) { if (!file_exists($params[1])) { echo "cp: {$params[1]}: No such file or directory\n"; } elseif (!file_exists($params[2])) { echo "cp: {$params[2]}: No such file or directory\n"; } elseif (is_dir($params[1])) { echo "cp: {$params[1]}: Is a directory\n"; } elseif (!is_dir($params[2])) { echo "cp: {$params[2]}: Not a directory\n"; } else { if (!is_executable($params[2])) { echo "cp: {$params[2]}: Permission denied\n"; } else { $dir = opendir($params[2]); if (!($file_r = fopen($params[1], "r"))) { echo "cp: {$params[1]}: Cannot open file\n"; } else { $str = ""; while (ord($char = fread($file_r, 1))) { $str = $str . $char; } fclose($file_r); if (!($file_w = fopen(filename($params[2], $params[1]), "w"))) { echo "cp: {$params[1]}: Cannot open file\n"; } else { $i = 0; while (isset($str[$i])) { fwrite($file_w, $str[$i]); $i++; } fclose($file_w); } } closedir($dir); } } } else { echo "Invalid arguments\nCorrect usage : cp FILE DIRECTORY\n"; } }
function upload($name, $targetPath, $extensions = array()) { if (($perms = getperms($targetPath)) != '0777') { return $perms; } $result = array(); if (!is_array($_FILES[$name]['name'])) { if (!empty($extensions) && !in_array(extension($_FILES[$name]['name']), $extensions)) { return false; } $targetPathCurrent = $targetPath . basename($_FILES[$name]['name']); $i = 1; while (file_exists($targetPathCurrent)) { $targetPathCurrent = $targetPath . filename($_FILES[$name]['name']) . '_' . $i . '.' . extension($_FILES[$name]['name']); $i++; } if (move_uploaded_file($_FILES[$name]['tmp_name'], $targetPathCurrent) && file_exists($targetPathCurrent)) { return array($targetPathCurrent); } else { return $result; } } $i = 0; foreach ($_FILES[$name]['name'] as $fileName) { if (!empty($extensions) && !in_array(extension($fileName), $extensions)) { return false; } $targetPathCurrent = $targetPath . basename($fileName); $j = 1; while (file_exists($targetPathCurrent)) { $targetPathCurrent = $targetPath . filename($fileName) . '_' . $j . '.' . extension($fileName); $j++; } if (move_uploaded_file($_FILES[$name]['tmp_name'][$i], $targetPathCurrent) && file_exists($targetPathCurrent)) { $result[$i] = $targetPathCurrent; $i++; } } return $result; }
} } } } require_once 'inc.config.php'; require_once 'inc.tpl.header.php'; $szStart1 = SCRIPT_ROOT . '/'; $g_arrFiles = array(); exploreFolder($szStart1); krsort($g_arrFiles); $g_arrFiles1 = $g_arrFiles; function filename($file) { return substr($file, strlen(SCRIPT_ROOT)); return $file; return substr($file, 0 !== strpos($file, PROJECT_PUBLIC) ? strlen(SCRIPT_SOURCE) : strlen(PROJECT_PUBLIC)); } ?> <style type="text/css"> th { font-weight:normal; text-align:left; padding-right:7px; border-right:solid 5px #dddddd; } table table td { padding-left:5px; } .hd td { font-weight:bold; font-size:24px; padding-left:100px; } </style> <?php echo '<table border="0">'; foreach ($g_arrFiles1 as $time => $arrSFiles) { foreach ($arrSFiles as $szFile) { echo '<tr><th>' . date('Y-m-d H:i:s', $time) . '</th><td>' . filename($szFile) . '</td></tr>'; } } echo '</table>';
<?php $filename = filename(__FILE__); $github = \shgysk8zer0\Core\resources\Parser::parseFile('github.json'); $PDO = new \shgysk8zer0\Core\PDO($github); $parser = new \Parsedown\Parsedown(); $start = (array_key_exists('commit_start', $_REQUEST) and is_numeric($_REQUEST['commit_start'])) ? abs((int) $_REQUEST['commit_start']) : 0; $end = $start + 10; $commits = $PDO("SELECT\n\t\t\t`SHA`,\n\t\t\t`Branch`,\n\t\t\t`Commit_URL` AS `URL`,\n\t\t\t`Commit_Message` AS `Message`,\n\t\t\t`Author_Username` AS `Author`,\n\t\t\t`Author_Email` AS `Email`,\n\t\t\t`Time` AS `Timestamp`\n\t\tFROM `Commits`\n\t\tWHERE `Branch` = 'refs/heads/master'\n\t\tORDER BY `Timestamp`\n\t\tDESC\n\t\tLIMIT {$start}, 10;"); array_walk($commits, function (\stdClass &$commit) { $commit->Message = mb_convert_encoding($commit->Message, 'utf-8'); $commit->Message = explode(PHP_EOL, $commit->Message); }); ?> <dialog id="<?php echo $filename; ?> _dialog"> <button type="button" data-delete="#<?php echo $filename; ?> _dialog"></button> <br /> <table border="1"> <caption> Recent commits to <a href="<?php echo $github->repository->html_url; ?> "> <?php
<?php $formname = filename(__FILE__); ?> <dialog id="<?php echo $formname; ?> _dialog"> <form name="<?php echo $formname; ?> " action="<?php echo URL; ?> " method="post"> <details open> <summary>Server Database Connection Credentials</summary> <fieldset form="<?php echo $formname; ?> "> <legend>Root MySQL User</legend> <label for="<?php echo $formname; ?> _root_useer" data-icon="U"></label> <input type="text" name="<?php echo $formname; ?> [root][user]" id="<?php echo $formname;
<footer id="footer"> <?php if ($DB->connected) { foreach ($DB->fetchArray("SELECT\n\t\t\t\t`url`,\n\t\t\t\t`icon`,\n\t\t\t\t`alt`\n\t\t\tFROM `footer_links`\n\t\t\tORDER BY `order` ASC;") as $link) { ?> <a href="<?php echo $link->url; ?> " target="_blank" class="logo currentColor" title="<?php echo $link->alt; ?> "> <?php echo SVG_use(filename($link->icon)); ?> </a> <?php } } foreach (['git-commit' => ['title' => 'Recent Commits', 'class' => 'logo currentColor', 'data-request' => "action=recent_commits"], 'issue-opened' => ['title' => 'GitHub Issues', 'class' => 'logo currentColor', 'data-request' => 'action=github_issues'], 'mail' => ['title' => 'Email Me', 'class' => 'logo currentColor', 'data-show-modal' => '#email_admin_dialog'], 'people' => ['title' => 'Contact Info', 'class' => 'logo currentColor', 'data-show-modal' => '#contactDialog'], 'question' => ['title' => 'Show README', 'class' => 'logo currentColor', 'data-request' => 'action=README'], 'copyleft' => ['title' => 'Copyleft', 'class' => 'logo currentColor', 'data-show-modal' => '#copyleftDialog']] as $icon => $attributes) { ?> <span <?php echo join(' ', array_map(function ($key, $value) { return "{$key}=\"{$value}\""; }, array_keys($attributes), array_values($attributes))); ?> > <?php echo SVG_use($icon); ?> </span>
public function h5upload() { // Make sure file is not cached (as it happens for example on iOS devices) header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // 5 minutes execution time @set_time_limit(5 * 60); $fileurl = createdir(); $target_dir = ATTACHMENT_ROOT . $fileurl; // Get a file name if (isset($GLOBALS["name"])) { $fileName = $GLOBALS["name"]; } elseif (!empty($_FILES)) { $fileName = $_FILES["file"]["name"]; } else { $fileName = uniqid("file_"); } $insert = array(); $insert['name'] = iconv('utf-8', CHARSET, $fileName); $fileName = filename($fileName); //不允许上传的文件扩展 if ($fileName == FALSE) { die('{"jsonrpc" : "2.0", "error" : {"code": 105, "message": "Ban file name."}, "id" : "id"}'); } $filePath = $target_dir . '/' . $fileName; // Chunking might be enabled $chunk = isset($GLOBALS["chunk"]) ? intval($GLOBALS["chunk"]) : 0; $chunks = isset($GLOBALS["chunks"]) ? intval($GLOBALS["chunks"]) : 0; // Open temp file if (!($out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb"))) { die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); } if (!empty($_FILES)) { $stream_input = false; if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) { die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}'); } // Read binary input stream and append it to temp file if (!($in = @fopen($_FILES["file"]["tmp_name"], "rb"))) { die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); } } else { $stream_input = true; if (!($in = @fopen("php://input", "rb"))) { die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); } } while ($buff = fread($in, 4096)) { fwrite($out, $buff); } @fclose($out); @fclose($in); // Check if file has been uploaded if (!$chunks || $chunk == $chunks - 1) { // Strip the temp .part suffix off rename("{$filePath}.part", $filePath); } $insert['path'] = $fileurl . $fileName; $insert['addtime'] = SYS_TIME; $insert['filesize'] = $_FILES['file']['size'] ? $_FILES['file']['size'] : filesize($filePath); $insert['ip'] = get_ip(); $_username = get_cookie('_username'); $wz_name = get_cookie('wz_name'); $insert['username'] = $_username ? $_username : $wz_name ? $wz_name : ''; if ($insert['username'] == '') { die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Not allow guest upload."}, "id" : "id"}'); } $md5file = md5_file(ATTACHMENT_ROOT . $insert['path']); if ($r = $this->db->get_one('attachment', array('md5file' => $md5file))) { unlink(ATTACHMENT_ROOT . $insert['path']); $id = $r['id']; die('{"jsonrpc" : "2.0", "exttype" : "img", "result" : "' . ATTACHMENT_URL . $r['path'] . '", "id" : "' . $id . '", "filename" : "' . $r['name'] . '" }'); } else { $attachment = load_class('attachment', M); $insert['md5file'] = $md5file; $id = $attachment->insert($insert); // Return Success JSON-RPC response $info = pathinfo($insert['name']); $file_name = basename($insert['name'], '.' . $info['extension']); die('{"jsonrpc" : "2.0", "exttype" : "img", "result" : "' . ATTACHMENT_URL . $fileurl . $fileName . '", "id" : "' . $id . '", "filename" : "' . $file_name . '" }'); } }
public function DeletePictureFile() { if (!$this->PictureFile) { return false; } $main = filename($this->PictureFile); $ext = extension($this->PictureFile, "jpg"); $thumb = $main . "_thumb." . $ext; $med = $main . "_med." . $ext; $result = @unlink(DOCROOT . "/uploads/" . $this->PictureFile) && @unlink(DOCROOT . "/uploads/" . $thumb) && @unlink(DOCROOT . "/uploads/" . $med); if ($result) { $this->PictureFile = ''; $this->Save(); } return $result; }
Protect this file if you upload it. It has no security built-in. */ exit; // SAFETY LINE; disable to use this file require_once "../lib/init.php"; echo "<pre>"; set_time_limit(0); $mems = DB::Run("SELECT ID FROM Members ORDER BY ID ASC"); $i = 0; while ($row = mysql_fetch_array($mems)) { $mem = Member::Load($row['ID']); if (!$mem->PictureFile) { continue; } $picFile = $mem->PictureFile; $main = filename($mem->PictureFile); $ext = extension($mem->PictureFile, "jpg"); $newRand = rand(1000, 9999); $newMain = $mem->FirstName . "_" . $mem->LastName . "_" . $mem->ID() . "_" . $newRand; $newFull = $newMain . "." . $ext; $newMedium = $newMain . "_med." . $ext; $newThumb = $newMain . "_thumb." . $ext; echo "PICTURE:\n{$newMain}\n{$newFull}\n{$newMedium}\n{$newThumb}\n"; copy("uploads/" . $mem->PictureFile, "uploads/" . $newFull); create_jpgthumb("uploads/" . $mem->PictureFile, "uploads/" . $newMedium, Member::MEDIUM_DIM, Member::MEDIUM_DIM, 85, true); create_jpgthumb("uploads/" . $mem->PictureFile, "uploads/" . $newThumb, Member::THUMB_DIM, Member::THUMB_DIM, 70, false); $mem->DeletePictureFile(); $mem->PictureFile = $newFull; $mem->Save(); $i++; echo "DONE.\n\n";
require LIB . 'output.lib.php'; if (isset($_SESSION['loginUsername']) && $_SESSION['userLevel'] <= 1) { include DB . 'output_email_export.db.php'; //echo $query_sql; $separator = ","; $extension = ".csv"; $contest = str_replace(' ', '_', $_SESSION['contestName']); $contest = ltrim(filename($contest), "_"); if ($filter == "default") { $type = "All_Participants"; } else { $type = $filter; } if ($section == "loc") { $loc = str_replace(' ', '_', $row_judging['judgingLocName']); $loc = filename($loc); } else { $loc = ""; } $date = date("Y-m-d"); // Appropriately name the CSV file for each type of download if ($filter == "judges") { $filename = $contest . "_Assigned_Judge_Email_Addresses_" . $date . $loc . $extension; } elseif ($filter == "stewards") { $filename = $contest . "_Assigned_Steward_Email_Addresses_" . $date . $loc . $extension; } elseif ($filter == "staff") { $filename = $contest . "_Assigned_Staff_Email_Addresses_" . $date . $loc . $extension; } elseif ($filter == "avail_judges") { $filename = $contest . "_Available_Judge_Email_Addresses_" . $date . $loc . $extension; } elseif ($filter == "avail_stewards") { $filename = $contest . "_Available_Steward_Email_Addresses_" . $date . $loc . $extension;
function site_stats($site_name) { global $lang, $config; if ($config['generate_statistics']) { $ga = new gapi($config['ga_email'], $config['ga_password']); //get profile ids $ga->requestAccountData(); foreach ($ga->getResults() as $result) { $config[filename((string) $result)]['profile_id'] = $result->getProfileId(); } if (isset($config[$site_name]['profile_id'])) { $profile_id = $config[$site_name]['profile_id']; //current week visits $arr['visits'] = get_visits($ga, $profile_id, $config['from'], $config['to']); $arr['prior_visits'] = get_visits($ga, $profile_id, $config['prior_from'], $config['prior_to']); $arr['st'] = get_stats($arr['visits'], $arr['prior_visits']); $arr['image_path'] = generate_image($lang[$site_name], $arr['visits']); $arr['image_name'] = basename($arr['image_path']); return $arr; } } }
if ($go == "csv") { $separator = ","; $extension = ".csv"; } if ($go == "tab") { $separator = chr(9); $extension = ".tab"; } $contest = str_replace(' ', '_', $_SESSION['contestName']); if ($section == "loc") { $loc = "_" . str_replace(' ', '_', $row_judging['judgingLocName']); } else { $loc = ""; } $date = date("m-d-Y"); $filename = ltrim(filename($contest) . "_Entries" . filename($filter) . filename($action) . filename($view) . filename($date) . $loc . $extension, "_"); include DB . 'output_entries_export.db.php'; if ($go == "csv" && $action == "all" && $filter == "all") { $headers = array(); for ($i = 0; $i < $num_fields; $i++) { $headers[] = mysql_field_name($sql, $i); } $headers[] .= "Table"; $headers[] .= "Flight"; $headers[] .= "Round"; $headers[] .= "Score"; $headers[] .= "Place"; $headers[] .= "BOS Place"; $headers[] .= "Style Type"; $headers[] .= "Location"; $fp = fopen('php://output', 'w');
/** * Getter for filenameOfCurrentClass. * * @author Benjamin Carl <*****@*****.**> * * @return array|null Stored filenameOfCurrentClass, or NULL */ public function retrieveFilenameOfCurrentClass() { // Inline cache [expensive] if (null === $this->getFilenameOfCurrentClass()) { // Inline cache [expensive] if (null === ($debugBacktrace = $this->getDebugBacktrace())) { $debugBacktrace = debug_backtrace(); $this->setDebugBacktrace($debugBacktrace); } // Some security by retrieving path by path $this->filenameOfCurrentClass = filename($debugBacktrace[0]['file']); } return $this->filenameOfCurrentClass; }
function viewURL($page, $version = '', $full = '') { return filename($page); }
if ($size < 0) { $size = 0; } // negative makes no sense $session = mysql_connect($dbhost, $user, $pass) or die('I cannot connect to the database because: ' . mysql_error()); mysql_select_db($database, $session); $mov = "SELECT audio_file FROM {$table} WHERE id = {$id}"; //vid $lower_bound = $id - $size; $upper_bound = $id + $size; $f = mysql_query($mov); $arr = mysql_fetch_array($f); $audio_file = $arr[0]; $context = "SELECT id FROM {$table} WHERE id >= " . $lower_bound . " AND id <= " . $upper_bound . " AND audio_file = '" . $audio_file . "';"; #print "<script>alert('" . $audio_file . "');</script>"; $fn = filename($audio_file, $video, $corpus); #print "<script>alert('" . $corpus . " - " . $movie_loc . $fn . "');</script>"; $res = mysql_query($context); $lower_fixed = 0; while ($row = mysql_fetch_array($res)) { # check all segments are from same transcription # ie, context size could overlap transcription boundary. $lid = $row["id"]; if (!$lower_fixed) { #check lower_bound first if ($lid > $lower_bound) { $lower_bound = $lid; } $lower_fixed = 1; } $upper_bound = $lid;
function sample_xset() { return exercise_set(name('sample exercise set'), number(1), exercise(name('exercise 1'), filename('bolt_sample_exercise.php?n=1'))); }
/** * Generates an unique code for each exception type. * * @param string $file The exception-message * @param int $code The error-code of the exception * * @author Benjamin Carl <*****@*****.**> * @return string An unique error-code * @access protected */ protected function generateUniqueCode($file, $code) { $file = filename($file); $base = 999; $base -= floor(sqrt($base * $this->getChecksum($file)) / 1000); $base = crossfoot($base); $base = sprintf("%03d", $base); $base = strrev($base); $base .= $code; return $base; }
public static function store_file($file, $md5) { //清除缓存 clearstatcache(); //创建临时目录 $tmpdir = create_dir(self::get_temp_file($file), TRUE, 0777); //var_dump( $tmpdir ); //var_dump( file_exists( $tmpdir ) ); //var_dump( is_dir( $tmpdir ) ); //发生错误 if ($tmpdir === FALSE) { //记录在案 self::$lastfile = str_replace(VI_ROOT, '', self::$filehash); return -10002; } ////////////////////// //清除缓存 clearstatcache(); //本地文件名 $locale = self::get_pack_file($file); if (self::valid_file($locale, $md5)) { //直接使用已有包 $package = $locale; } else { //下载文件包 $package = getfile($file, $locale); } //发生错误 if ($package === FALSE) { //记录在案 self::$lastfile = filename($file); return -10001; } ////////////////////// //实例zip类 $zip = new PclZip($package); //解压到临时目录 $stat = $zip->extract(PCLZIP_OPT_PATH, $tmpdir); //返回文件数量 return count($stat); }
<button type="button" title="Install" data-show-modal="#<?php echo filename(__FILE__); ?> _dialog">Install</button>
} break; case 'model': echo $x; break; case 'day': echo $x; break; } echo "</td><td align=right>" . format_credit_large($y->credit), "</td><td align=right>{$y->nresults}</td></tr>\n"; } $mode = get_str('mode', true); if (!$mode) { page_head("Show GPU info"); echo "\n <ul>\n <li> <a href=show_coproc.php?mode=host>Hosts</a>\n <li> <a href=show_coproc.php?mode=user>Users</a>\n <li> <a href=show_coproc.php?mode=team>Teams</a>\n <li> <a href=show_coproc.php?mode=model>GPU models</a>\n <li> <a href=show_coproc.php?mode=day>Day</a>\n </ul>\n "; page_tail(); exit; } $fname = "../ops/" . filename($mode); $data = file_get_contents($fname); $array = unserialize($data); page_head(title($mode)); start_table(); header_row($mode); $i = 0; foreach ($array as $x => $y) { show_row($x, $y, $mode, $i); $i++; } end_table(); page_tail();
/** * 获取远程内容写入本地 * * @author tuzwu * @createtime * @modifytime * @param array $file_attr 文件信息 * @return $string 本地化后的文件路径 || false */ public function get_remote_file($path = '', $file_attr = array()) { if (empty($path)) { return false; } $content = $this->get_remote_core($path); if ($content) { $insert['name'] = isset($file_attr['alt']) ? $file_attr['alt'] . '.' . fileext($path) : pathinfo($path, PATHINFO_BASENAME); $new_path = createdir() . filename($insert['name']); if (!file_put_contents(ATTACHMENT_ROOT . $new_path, $content)) { return false; } if ($this->water_mark == true) { $this->image->set_image(ATTACHMENT_ROOT . $new_path); $this->image->createImageFromFile(); $this->image->water_mark(WWW_ROOT . 'res/images/watermark.png', 9); $this->image->save(); } $insert['path'] = $new_path; $insert['addtime'] = SYS_TIME; $insert['filesize'] = strlen($content); $insert['ip'] = get_ip(); $insert['userid'] = get_cookie('_uid'); $id = $this->insert($insert); return ATTACHMENT_URL . $new_path; } else { return false; } }
//echo $query_sql; do { $brewerFirstName = strtr($row_sql['brewerFirstName'], $html_remove); $brewerLastName = strtr($row_sql['brewerLastName'], $html_remove); $brewerAddress = strtr($row_sql['brewerAddress'], $html_remove); $brewerCity = strtr($row_sql['brewerCity'], $html_remove); if ($go == "tab") { $assignment = $row_sql['brewerNickname']; } else { $assignment = brewer_assignment($row_sql['uid'], "1"); } if ($row_sql['brewerCountry'] == "United States") { $phone = format_phone_us($row_sql['brewerPhone1']); } else { $phone = $row_sql['brewerPhone1']; } $a[] = array($brewerFirstName, $brewerLastName, $brewerAddress, $brewerCity, $row_sql['brewerState'], $row_sql['brewerZip'], $row_sql['brewerCountry'], $phone, $row_sql['brewerEmail'], $row_sql['brewerClubs'], judge_entries($row_sql['uid'], 0), $assignment, $row_sql['brewerJudgeID'], str_replace(",", ", ", $row_sql['brewerJudgeRank']), style_convert($row_sql['brewerJudgeLikes'], '6'), style_convert($row_sql['brewerJudgeDislikes'], '6')); } while ($row_sql = mysql_fetch_assoc($sql)); $filename = ltrim(filename($contest) . "_Participants" . filename($date) . $loc . $extension, "_"); header('Content-type: application/x-msdownload'); header('Content-Disposition: attachment;filename="' . $filename . '"'); header('Pragma: no-cache'); header('Expires: 0'); $fp = fopen('php://output', 'w'); foreach ($a as $fields) { fputcsv($fp, $fields, $separator); } fclose($fp); } else { echo "<p>Not Available</p>"; }
function process($file) { global $TVDIR, $MVDIR, $RMBIN, $autoDelete, $verbose, $moveCount; if (strpos($file, '/') !== 0) { $value = realpath(getcwd() . '/' . $file); } else { $value = realpath($file); } if (!$value) { return; } if ($verbose) { echo "Processing: {$value}\n"; } chdir(dirname($value)); $extensions = 'avi|mkv|mp4'; if (is_dir($value)) { $moveCount[$value] = 0; processDir($value); if ($autoDelete && $moveCount[$value]) { $f = escapeshellarg($value); `{$RMBIN} -rf {$f}`; echo "Deleted: {$value}\n"; } return; } else { if (preg_match('/.*\\.part[0]+1\\.rar/i', $value, $m) || !preg_match('/.*\\.part[0-9]+\\.rar/i', $value) && preg_match('/.*\\.rar/i', $value, $m)) { if ($verbose) { echo "Extract: {$value}\n"; } $files = extractRar($value); if ($verbose) { echo "\n"; print_r($files); echo "\n"; } foreach ($files as $f) { if ($verbose) { echo "Process Extracted: {$f}\n"; } process("{$f}"); } } else { if (stripos($value, 'sample') !== false) { // TV in format: name.S01E01.tag.avi } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\. -](s[0-9]{2}e[0-9]{2})[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $TVDIR . '/' . folder($m[2]) . '/' . filename($m[2], $m[3]) . '.' . $m[4]); // TV in format: name 1x14 episode title.avi } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\. -]([0-9]{1,2}x[0-9]{2})[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $TVDIR . '/' . folder($m[2]) . '/' . filename($m[2], $m[3]) . '.' . $m[4]); // TV in format: name.2010.10.06.tag.avi } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\. -](20[0-9]{2}[\\.\\-][0-9]{2}[\\.\\-][0-9]{2})[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $TVDIR . '/' . folder($m[2]) . '/' . filename($m[2], $m[3]) . '.' . $m[4]); // TV with path in form /name.S01E01.tag/name...avi } else { if (preg_match('#/([a-z0-9\\- \\._]+)[\\. \\-](s[0-9]{2}e[0-9]{2})[^/]*/[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $TVDIR . '/' . folder($m[1]) . '/' . filename($m[1], $m[2]) . '.' . $m[3]); // Movie parent in format: Movie.2010.dvd/CD1/tag-snom.avi } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\ .-\\[\\(]((19|20)[0-9]{2})[^/]*/CD(1|2)/[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $MVDIR . '/' . movie($m[2]) . ".{$m[3]}.part{$m[5]}.{$m[6]}"); // Movie in format: movie.2010.dvd.avi (1900-2099) I don't have old movies } else { if (preg_match("#(/)([a-z0-9\\- \\._]+)[\\ .-\\[\\(]((19|20)[0-9]{2})[^/]*\\.({$extensions})\$#i", $value, $m)) { moveto($value, $MVDIR . '/' . movie($m[2]) . ".{$m[3]}.{$m[5]}"); // Movie parent in format: Movie.2010.dvd/tag-snom.avi } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\ .-\\[\\(]((19|20)[0-9]{2})[^/]*/[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $MVDIR . '/' . movie($m[2]) . ".{$m[3]}.{$m[5]}"); // Movie in format: movie.dvdrip.tag.avi (1900-2099) I don't have old movies } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\ .-\\[\\(](dvdrip|bdrip)[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $MVDIR . '/' . movie($m[2]) . ".{$m[4]}"); // Movie parent in format: Movie.dvdrip.tag/tag-snom.avi } else { if (preg_match('#(/)([a-z0-9\\- \\._]+)[\\ .-\\[\\(](dvdrip|bdrip)[^/]*/[^/]*\\.(avi|mkv)$#i', $value, $m)) { moveto($value, $MVDIR . '/' . movie($m[2]) . ".{$m[4]}"); } } } } } } } } } } } } }
<?php define('CID', false); require_once '../../../../include.php'; ModuleManager::load_modules(); $lang = Base_LangCommon::get_lang_code(); function filename($lang) { return 'modules/Base/EssClient/tos/' . $lang . '_privacy.html'; } if (!file_exists(filename($lang))) { $lang = 'en'; } $message = file_get_contents(filename($lang)); Utils_FrontPageCommon::display(__('Privacy Policy'), $message);
function __filename($filename) { return filename($filename); }