function listLogs($myDir) { $aDirectory = dir($myDir); $index = 0; $cdir = getcwd(); while ($anEntry = $aDirectory->read()) { $path = $cdir . "/" . $myDir . "/" . $anEntry; # if ((is_file($path)) && (preg_match("/.txt/i", $path))) { $c = checkFile($path); if ($c == 1) { $entries[$index] = $anEntry; $index++; } } aDirectory . closedir(); sort($entries); if ($index < 0) { echo "<br>There are no test logs for this build."; return; } for ($i = 0; $i < $index; $i++) { $anEntry = $entries[$i]; $updateLine = 0; $updateLine = checkPlatform($anEntry); if ($updateLine == 0 && preg_match("/\\//", $myDir)) { $linktext = $myDir . "_" . $anEntry; # remove the directory name from the link to the log $dir = substr(strrchr($linktext, "/"), 1); $line = "<td><a href=\"{$myDir}/{$anEntry}\">{$dir}</a></td>"; } else { $line = "<td><a href=\"{$myDir}/{$anEntry}\">{$anEntry}</a></td>"; } echo "<li>{$line}</li>"; } }
function checkFile($url, $name) { if (file_exists($url . $name)) { $name = time() . $name; return checkFile($url, $name); } else { return $name; } }
function transform($src, $trans) { if (!checkFile($src)) { throw new Exception('Source XML file missing.'); } if (!checkFile($trans)) { throw new Exception('XSL transformation file missing.'); } return processXML($src, $trans); }
function iterateList(Iterator $i) { foreach ($i as $entry) { if ($i->hasChildren() && !ignore($entry)) { iterateList($i->getChildren()); } else { if (substr($entry, -4, 4) == '.php') { checkFile($entry); } } } }
function readDirR($path) { $d = opendir($path); while ($f = readdir($d)) { if (!in_array($f, array('.', '..'))) { $file = "{$path}/{$f}"; if (is_dir($file)) { readDirR($file); } else { checkFile($file); } } } }
function listLogs($myDir) { $entries = array(); $aDirectory = dir($myDir); if ($aDirectory === NULL || $aDirectory === FALSE) { return; } $index = 0; $cdir = getcwd(); while ($anEntry = $aDirectory->read()) { $path = $cdir . "/" . $myDir . "/" . $anEntry; # if ((is_file($path)) && (preg_match("/.txt/i", $path))) { $c = checkFile($path); if ($c == 1) { $entries[$index] = $anEntry; $index++; } } $aDirectory->close(); if (count($entries) > 0) { sort($entries); } if ($index < 0) { echo "<p>There are no test logs for this build.</p>\n"; return; } echo "<ul>\n"; for ($i = 0; $i < $index; $i++) { $anEntry = $entries[$i]; $updateLine = 0; $updateLine = checkPlatform($anEntry); if ($updateLine == 0 && preg_match("/\\//", $myDir)) { $linktext = $myDir . "_" . $anEntry; # remove the directory name from the link to the log $dir = substr(strrchr($linktext, "/"), 1); $line = "<a href=\"" . "{$myDir}/{$anEntry}" . "\">" . $dir . "</a> " . fileSizeForDisplay("{$myDir}/{$anEntry}"); } else { $line = "<a href=\"" . "{$myDir}/{$anEntry}" . "\">" . $anEntry . "</a> " . fileSizeForDisplay("{$myDir}/{$anEntry}"); } echo "<li>{$line}</li>\n"; } echo "</ul>\n"; }
function listDir($dir, $level, $arr, $arr_ass) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while ($file = readdir($dh)) { if (is_dir($dir . "/" . $file) && $file != "." && $file != "..") { listDir($dir . "/" . $file, $level, $arr, $arr_ass); } elseif ((string) $file[strlen($file) - 1] == "p" && (string) $file[strlen($file) - 2] == "h" && $file != "ws_finder.php") { $result = checkFile($dir . "/" . $file, $level, $arr, $arr_ass); if ($result != "safe") { echo "<h2>发现威胁</h2>"; echo "<br/>" . "<code>" . $dir . "/" . $file . "可能是" . $result . "<br/></code><hr/>"; } } else { continue; } } } } }
function checkForFiles(&$errors, &$warnings, &$resources, &$uploadsMap) { // global $mediaPath; $valid = 0; foreach ($resources as $row => $res) { $filename = $res->getFilename(); $tmp = checkFile(basename($filename), $uploadsMap); if ($tmp === 2) { $valid = $tmp; if (!array_key_exists($row, $errors)) { $errors[$row] = array(); } if ($filename === '') { array_push($errors[$row], 'In Zeile ' . $row . ': Dateifeld ist leer.'); } else { array_push($errors[$row], 'In Zeile ' . $row . ': Die Datei ' . $filename . ' ist nicht im Uploadsverzeichnis vorhanden.'); } } } return $valid; }
encodeWithLame($config['lame'] . " --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname2}\" \"{$target}\""); checkFile($target); rmFile($tempname2); } else { encodeWithLame($config['lame'] . " --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname1}\" \"{$target}\""); checkFile($target); rmFile($tempname1); } } elseif ($config['audioFormats'][$index]['format'] == 'ogg' && $audioFiles->list[$sourceindex]->format == 'ogg') { $tempname1 = getTempWavName(); decodeWithOgg($config['oggdec'] . " -o \"{$tempname1}\" \"{$source}\""); checkFile($tempname1); if ($config['audioFormats'][$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) { $tempname2 = getTempWavName(); convertWithSox($config['sox'] . " \"{$tempname1}\" -c2 \"{$tempname2}\""); checkFile($tempname2); rmFile($tempname1); encodeWithOgg($config['oggenc'] . " -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} -o \"{$target}\" \"{$tempname2}\""); checkFile($target); rmFile($tempname2); } else { if ($config['audioFormats'][$index]['channels'] == 1 && $audioFiles->list[$sourceindex]->channels == 2) { $addparam = "--downmix"; } encodeWithOgg($config['oggenc'] . " -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} {$addparam} -o \"{$target}\" \"{$tempname1}\""); checkFile($target); rmFile($tempname1); } } $prg->setAudio($target); endPage();
$keyfile = getFile("addFile1"); if (!($usePwdForCK = KphpUI::getString("addUsePwdForCK", $_POST, "") != "") && $pwd1 == "" && $keyfile == null) { $ui->setIfEmpty("addUsePwdForCK", null, "error"); $ui->setIfEmpty("addPwd1", MainUI::HI_NOOTHERKEY, "error"); $ui->setIfEmpty("addFile1", MainUI::HI_ERROR, "error"); } if (!$ui->isSomethingEmpty) { require_once KEEPASSPHP_LOCATION; KeePassPHP::init(KEEPASSPHP_DEBUG); if (!KeePassPHP::exists($dbid) || KeePassPHP::checkPassword($dbid, $mainPwd)) { $keys = $usePwdForCK ? array(array(KeePassPHP::KEY_PWD, $mainPwd)) : array(); if ($pwd1 != '') { $keys[] = array(KeePassPHP::KEY_PWD, $pwd1); } if ($keyfile != null) { if (($keyfile = checkFile("addFile1", $keyfile, $ui)) != null) { $keys[] = array(KeePassPHP::KEY_FILE, $keyfile); } } if (KeePassPHP::checkKeys($kdbxFile, $keys)) { if (KeePassPHP::tryAdd($kdbxFile, $dbid, $mainPwd, $keys)) { $ui->addSuccess = true; } } else { if ($usePwdForCK) { $ui->setIfEmpty("addMainPwd", MainUI::HI_BADPWD, "error"); } if ($pwd1 != "") { $ui->setIfEmpty("addPwd1", MainUI::HI_BADPWD, "error"); } if ($keyfile != null) {
function checkFile($file) { if (!file_exists($file)) { trigger_error("ERROR: A required file to install MorgOS is not found. ({$file})"); } } checkFile('install/license.php'); checkFile('install/check.php'); checkFile('install/config.php'); //checkFile ('install/checkdbconn.php'); checkFile('install/installing.php'); checkFile('install/installingdb.php'); checkFile('install/sql/news.sql'); checkFile('install/sql/pages.sql'); checkFile('install/sql/users.sql'); checkFile('core/language.class.php'); include_once 'core/language.class.php'; $errors = array(); function errorHandlerForInstaller($errNo, $errStr, $errFile = NULL, $errLine = 0, $errContext = NULL) { global $i10nMan; if ($errNo == E_STRICT) { return; } elseif ($errNo != E_USER_NOTICE) { $type = 'PHP'; $error = $errStr; } else { $pos = strpos($errStr, ": "); if ($pos != 0) { $type = substr($errStr, 0, $pos); $error = substr($errStr, $pos + 2);
function hsSpravaUsers($hsUserAction) { global $pwdfname; $chyba = ''; $seznam = ctiHesla($pwdfname); $rs = array(); $rs['action'] = $hsUserAction; $usr = isset($_REQUEST['usr']) ? htmlspecialchars($_REQUEST['usr']) : ''; if ($usr == 'guest') { $rs['data'] = 'Jméno guest nelze použít!'; $rs['action'] = 'error'; return $rs; } switch ($hsUserAction) { case "edit": if ($usr != '' && isset($seznam[$usr])) { $rs['data'] = $seznam[$usr]; } else { $rs['data'] = array('', '', '', '', '', ''); } break; case "save": if (checkFile($pwdfname) === FALSE) { //$rs['data'] = 'The password file is not writable!'; $rs['data'] = 'Nelze zapisovat do souboru hesel!'; $rs['action'] = 'error'; return $rs; } // --- kontrola existence cloveka if ($usr == '') { $rs['data'] = 'Musí být zadáno jméno!'; $rs['action'] = 'error'; return $rs; } if ($_REQUEST['pwd1'] || $usr == 'guest') { if ($_REQUEST['pwd1'] != $_REQUEST['pwd2']) { $rs['data'] = 'Nesouhlasí hesla!'; $rs['action'] = 'error'; return $rs; } $mdkey = md5($usr . trim(htmlspecialchars($_REQUEST['pwd1']))); } else { if ($usr != '' && $seznam[$usr][0]) { $mdkey = $seznam[$usr][2]; } else { $rs['data'] = 'Pro nového uživatele musí být zadáno heslo!'; $rs['action'] = 'error'; return $rs; } } $seznam[$usr] = array(trim(htmlspecialchars($_REQUEST['usr'])), trim(htmlspecialchars($_REQUEST['groups'])), $mdkey, trim(htmlspecialchars($_REQUEST['description'])), trim(htmlspecialchars($_REQUEST['address'])), trim(htmlspecialchars($_REQUEST['email']))); //---zde ulozeni $dataout = ''; $data = array_values($seznam); foreach ($data as $row) { $dataout .= $row[0] . "," . $row[1] . "," . $row[2] . "|" . $row[3] . "|" . $row[4] . "|" . $row[5] . "\n"; } file_put_contents($pwdfname, $dataout); $rs['data'] = vypis($pwdfname); $rs['action'] = ''; break; case "delete": if (checkFile($pwdfname) === FALSE) { //$rs['data'] = 'The password file is not writable!'; $rs['data'] = 'Nelze zapisovat do souboru hesel!'; $rs['action'] = 'error'; return $rs; } // ---smazani zazmamu if ($usr != '' && $seznam[$usr][0]) { if ($usr == $_SESSION['u']) { $rs['data'] = 'Nemůžeš smazat sebe sama !!!'; $rs['action'] = 'error'; return $rs; } $dataout = ''; $data = array_values($seznam); foreach ($data as $row) { if ($row[0] != $usr) { $dataout .= implode(",", $row) . "\n"; } } file_put_contents($pwdfname, $dataout); vypis($pwdfname); } else { $rs['data'] = 'Špatný uživatel!'; $rs['action'] = 'error'; return $rs; } $rs['data'] = vypis($pwdfname); $rs['action'] = ''; break; default: $rs['data'] = $seznam; break; } return $rs; }
$height = $height / $k; } } else { if ($height > $basic_height) { $k = $height / $basic_height; $height = $basic_height; $width = $width / $k; } } $mainLayer->resizeInPixel($width, $height, false); } } else { $data['message'] = "Нет данных"; } } $filename = checkFile($uploadDir, $filename); $mainLayer->save($uploadDir, $filename, $createFolders, $backgroundColor, $imageQuality); $_SESSION[$_POST['type']] = $filename; $data['message'] = "ОК"; $data['url'] = $filename; $data['name'] = $filename; if (isset($_POST)) { foreach ($_POST as $key => $value) { if ($key == "type") { $data['type'] = $value; } } } echo json_encode($data); exit; /*
function checkFile($dir = "", $layer = 0, $check = "") { global $file_list, $file_list_md5; if ($layer == 0) { $file_list = array(); $file_list_md5 = array(); } $the_file = ROOT_PATH . "/cache/checkfile.php"; if (empty($dir)) { $dir = ROOT_PATH; } if (($handle = opendir($dir)) === false) { return false; } $ignore = array(); if (is_file($dir . "/ignore")) { $ignore = file_get_contents($dir . "/ignore"); if (strlen($ignore) == 0) { return; } $ignore = str_replace("\r", "", $ignore); $ignore = explode("\n", $ignore); } if ($check != "") { if (file_exists(ROOT_PATH . "/update/")) { $cs_list = array("GBK", "UTF-8", "BIG5"); $charset = $GLOBALS['setting']['gen']['charset']; global $file_list_md5_ext; if ($layer == 0) { $file_list_md5_ext = array(); foreach ($cs_list as $item) { $item = strtoupper($item); $file_list_md5_ext[$item] = array(); } } } while (false !== ($file = readdir($handle))) { if (trim($file, ".") == "" || $file == "ignore" || array_search($file, $ignore) !== false) { continue; } $the_name = $dir . "/" . $file; if ($the_name == $the_file) { continue; } if (is_dir($the_name)) { checkFile($the_name, $layer + 1, "y"); } else { $file_list[] = str_replace(ROOT_PATH, "", $the_name); $file_list_md5[] = md5_file($the_name); if (isset($cs_list, $file_list_md5_ext)) { foreach ($cs_list as $item) { $item = strtoupper($item); $file_list_md5_ext[$item][] = md5_file_cs($the_name, $item, $charset); } } } } if ($layer == 0) { $content = '<?php $file_list = ' . var_export($file_list, true) . '; $file_list_md5 = ' . var_export($file_list_md5, true) . '; ' . (isset($file_list_md5_ext) ? '$file_list_md5_ext = ' . var_export($file_list_md5_ext, true) : '') . ' ?>'; WriteFile($the_file, $content, "wb"); } $result = true; } else { if ($layer == 0) { if (!is_file($the_file)) { return false; } include $the_file; } $result = array("new" => array(), "mod" => array(), "miss" => array()); while (false !== ($file = readdir($handle))) { if (trim($file, ".") == "" || $file == "ignore" || array_search($file, $ignore) !== false) { continue; } $the_name = $dir . "/" . $file; if ($the_name == $the_file || $the_name == $the_file . ".bak") { continue; } if (is_dir($the_name)) { $result_new = checkFile($the_name, $layer + 1); if ($result_new == null) { continue; } $result['new'] = array_merge($result['new'], $result_new['new']); $result['mod'] = array_merge($result['mod'], $result_new['mod']); $result['miss'] = array_merge($result['miss'], $result_new['miss']); } else { $the_name = str_replace(ROOT_PATH, "", $the_name); if (strpos($the_name, "/config.php") !== false) { continue; } if (strpos($the_name, "/template") === 0 && stripos($the_name, ".php") === false) { continue; } if (strpos($the_name, "/images") === 0 && stripos($the_name, ".php") === false) { continue; } if (strpos($the_name, "/plugin/") === 0) { if (strpos(str_replace("/plugin/", "", $the_name), "/") !== false && strpos($the_name, "/plugin/offical/") !== 0) { continue; } } if (false !== ($key = array_search($the_name, $file_list))) { if (md5_file(ROOT_PATH . $the_name) != $file_list_md5[$key]) { $result['mod'][] = $the_name; } unset($file_list[$key]); } else { $result['new'][] = $the_name; } } } if ($layer == 0) { foreach ($file_list as $the_name) { if (strpos($the_name, "/config.php") !== false) { continue; } if (strpos($the_name, "/template") === 0 && stripos($the_name, ".php") === false) { continue; } if (strpos($the_name, "/images") === 0 && stripos($the_name, ".php") === false) { continue; } if (strpos($the_name, "/plugin/") === 0) { if (strpos(str_replace("/plugin/", "", $the_name), "/") !== false && strpos($the_name, "/plugin/offical/") !== 0) { continue; } } $result['miss'][] = $the_name; } } } closedir($handle); return $result; }
<?php checkFile($clients_file); if (file_exists($clients_file)) { $clients_data = file($clients_file); } if (!isset($clients_data)) { echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>"; exit; } loadUsageData(); //___________________________________________________________________________________________________ $user_shareinfo = false; $lastUsername = ""; foreach ($clients_data as $currentline) { $inceput1 = substr($currentline, 0, 1); $inceput2 = substr($currentline, 1, 2); if (strstr($currentline, "| Shareinfo")) { $user_shareinfo = true; } if ($user_shareinfo == false && $inceput1 == "|" && $inceput2 != " U") { $active_client = explode("|", $currentline); $ac_Username = trim($active_client[1]); $ac_IP = trim($active_client[2]); $ac_Connected = trim($active_client[3]); $ac_Idle = trim($active_client[4]); $ac_ECM = trim($active_client[5]); $ac_EMM = trim($active_client[6]); $ac_Version = trim($active_client[7]); $ac_LastShare = trim($active_client[8]); $ac_EcmTime = "";
function compileLibrary($dirName, $output_dir) { global $abstractions; if (!is_dir($dirName)) { echo "Skipping {$dirName} since not a directory\n"; return; } echo "Building library {$dirName}.php\n"; $fp = fopen($output_dir . DIRECTORY_SEPARATOR . $dirName . '.php', 'w'); /* Write preamble of the namespace */ fwrite($fp, <<<EOT <? namespace {$dirName}{ EOT ); fwrite($fp, <<<'EOT' // need to redefine some functions to make sure we can track namespaces function declareFunction($name, $args, $call){ return declareFunctionGlobal(__NAMESPACE__, $name, $args, $call); } function declareType($name, $tName, $tArgs) { return declareTypeGlobal(__NAMESPACE__, $name, $tName, $tArgs); } ?> EOT ); if (is_dir($dirName . '/' . 'include')) { echo "Scanning includes directory" . PHP_EOL; $files = scandir($dirName . '/' . 'include'); foreach ($files as $id => $f) { $fullName = $dirName . '/include/' . $f; handleInclude($fullName, $dirName, $fp); } } if (is_dir($dirName . '/' . 'libs')) { $soDir = $output_dir . '/' . $dirName; if (!is_dir($soDir)) { mkdir($soDir); } echo "Scanning libs directory" . PHP_EOL; $files = scandir($dirName . '/' . 'libs'); foreach ($files as $id => $f) { $fullName = $dirName . '/libs/' . $f; $ext = pathinfo($fullName, PATHINFO_EXTENSION); // Copy an .so and .a files to the installed libraries if ($ext == 'so' || $ext == 'a') { copy($fullName, $soDir . '/' . $f); } } } foreach ($abstractions as $ab) { $abs = $ab . 's'; // need for dir names echo "\tScanning {$abs}."; if (!is_dir($dirName . '/' . $abs)) { echo "Not found, skipping.\n"; continue; } else { echo "OK\n"; } $files = scandir($dirName . '/' . $abs); // print_r($files); // scan files in each abstraction directory foreach ($files as $id => $f) { $fullName = $dirName . '/' . $abs . '/' . $f; if (!is_file($fullName)) { continue; } // a directory, silently skip $fName = pathinfo($f, PATHINFO_BASENAME); if (pathinfo($f, PATHINFO_EXTENSION) != 'php') { continue; } echo "Processing {$fName}." . PHP_EOL; // Check the result of the syntax checking if (!checkFile($fullName, $dirName)) { continue; } fwrite($fp, <<<EOT <?/*///////////// {$fName} ///////////////*/?> EOT ); fwrite($fp, file_get_contents($fullName)); } } fwrite($fp, <<<EOT <? } // namespace {$dirName} ?> EOT ); fclose($fp); }
function main($i_argc, $a_argv) { $a_opt = getopt("of:p:m:s", array()); $a_trade = array(); if (checkParam($i_argc, $a_argv) === false) { return; } if (checkOpt($a_opt) === false) { return; } if (checkFile($a_opt['f']) === false) { return; } init($a_trade, $a_opt); trade($a_trade, $a_opt); tradeInfo($a_trade, $a_opt); }
break; case 1: $messages[] = 'Directory XOOPS_TRUST_PATH(' . XOOPS_TRUST_PATH . ') is NOT found.'; break; } /*** check table field expand by preload ***/ if (!checkTable()) { $messages[] = 'You must put extras/extra_preload/upgrade22.class.php in ' . XOOPS_ROOT_PATH . '/preload'; } /*** check latest language file ***/ $lang = XCube_Root::getSingleton()->mLanguageManager->mLanguageName; if (!checkLanguage($lang)) { $messages[] = 'You must move the latest language files from extras/extra_languages/' . $lang . '. DON\'T MOVE /install directory !'; } /*** check file existing ***/ $files = checkFile(); foreach ($files as $file) { $messages[] = $file; } /*** check directory existing ***/ $directories = checkDirectory(); foreach ($directories as $dir) { $messages[] = $dir; } /*** check directory permission to write ***/ $permissions = checkPermission(); foreach ($permissions as $perm) { $messages[] = $perm; } /*** check module version, if updated by module admin ***/ $modules = checkVersion();
$height_w = $imageLayer1->getHeight(); $axis_width = $_POST['axis-width']; $axis_height = $_POST['axis-height']; while ($y < $height) { while ($x < $width) { $mainLayer->addLayerOnTop($imageLayer1, $x, $y, "LT"); $x = $x + ($width_w + $axis_width); } $y = $y + ($height_w + $axis_height); //$i=0; $x = $_POST['axis-x']; //$j++; } } $result = 'result_' . $_SESSION['main-image']; $result = checkFile($uploadDir, $result); $mainLayer->save($uploadDir, $result, true, null, 100); } $_SESSION['result'] = $result; $data['name'] = $result; echo json_encode($data); /*header('Content-type: image/jpeg'); header('Content-Disposition: filename="collage.jpg"'); imagejpeg($image, null, 100);*/ /* $file=$url.$name_of_new_file; if (file_exists($file)) { header('X-SendFile: ' . realpath($url)); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($name_of_new_file)); exit;
<?php session_start(); print_r($_FILES); require_once "dbconnection.class.php"; require_once "controller.php"; $_SESSION["newvideo"] = $_FILES['newvideo']; $check = checkFile($_SESSION["newvideo"]); if ($check && !empty($_SESSION["video_name"])) { $DB = DBconnection::getInstance(); move_uploaded_file($_SESSION["newvideo"]["tmp_name"], "videos/" . $_SESSION["video_name"] . ".mp4"); $query = "insert into videos(Name,Description,Path,userID) values (:name, :desc, :path, :userid)"; $q = $DB->db_pdo->prepare($query); try { $DB->db_pdo->beginTransaction(); $result = $q->execute(array(':name' => $_SESSION["video_name"], ':desc' => $_SESSION["video_desc"], ':path' => "videos/" . $_SESSION["video_name"] . ".mp4", ':userid' => $_SESSION['user_id'])); $DB->db_pdo->commit(); echo "Uploaded"; } catch (\PDOException $e) { $DB->db_pdo->rollBack(); echo "Database error:" . $e->getMessage(); die; } } else { echo "Fill Name pls"; }
function isDomainCorrect($domain, $fileUrl) { if (!preg_match("~[a-z0-9_-а-я]+\\.[а-яa-z]+~", $domain) || preg_match("~\\.loc\$~", $domain)) { return false; } return isFieldSet($domain) && checkFile($domain, $fileUrl); }
goodbye("Run the setup command again when the command line tools are installed"); } output("Checking for Macports"); $is_ok_macports = isInstalled("port version", array("Version: 2")); output($is_ok_macports ? "Macports is OK" : "Macports check failed - update or install Macports from macports.org"); // is software available if (!$is_ok_xcode || !$is_ok_macports) { goodbye("Update your software as specified above"); } output("\nChecking paths"); // check if configuration files are available checkFile("_conf/httpd.conf", "Required file is missing from your configuration source"); checkFile("_conf/httpd-vhosts.conf", "Required file is missing from your configuration source"); checkFile("_conf/php.ini", "Required file is missing from your configuration source"); checkFile("_conf/my.cnf", "Required file is missing from your configuration source"); checkFile("_conf/apache.conf", "Required file is missing from your configuration source"); // TODO: create .bash_profile if it does not exist // Has not been tested checkFileOrCreate("~/.bash_profile", "_conf/bash_profile.start"); checkPath("~/Sites"); command("sudo mkdir /srv"); command("sudo ln -s ~/Sites /srv/sites"); checkPath("~/Sites/apache"); // mysql paths checkPath("/opt/local/var/run/mysql56", "sudo"); checkPath("/opt/local/var/db/mysql56", "sudo"); checkPath("/opt/local/etc/mysql56", "sudo"); checkPath("/opt/local/share/mysql56", "sudo"); // continue with setup output("\nInstalling software"); // make sure correct version of Xcode is selected
case "": $option = getOptions(); // General Options break; case 1: echo "Enter CSV File full path with name HERE: "; $file_name = trim(fgets(STDIN)); // Input from user and save it in a variable $file_name = str_replace("\n", '', $file_name); // Remove extra Line Entery checkFile($file_name); // Check whether FIle Exists or Not $option = getOptions(); break; case 2: if (checkFile($file_name)) { echo "Processsing File here \n\n\n"; //------------------- Start Processing File ProcessDataDigging($file_name); } else { } $option = getOptions(); // General Options break; case 3: exit; break; default: $option = getOptions(); // General Options break;
$_SESSION['user_profile'] = entity_str(getPost('user_profile')); if (!isExist($_SESSION['user_profile'])) { $errors[] = 'プロフィールを入力してください'; } else { if (!isOverText($_SESSION['user_profile'], 200)) { $errors[] = '文字数は200文字以内にしてください'; } } // 画像アップロード処理 if (!checkPostMaxSize()) { $errors[] = 'ファイルサイズは100KB以下にしてください'; } if (isset($_FILES['user_profile_photo'])) { for ($i = 0; $i < count($_FILES['user_profile_photo']['name']); $i++) { // アップロードファイルチェック list($result, $ext, $error_msg) = checkFile($i); $errors = array_merge($errors, $error_msg); if ($result) { $name = $_FILES['user_profile_photo']['name'][$i]; $tmp_name = $_FILES['user_profile_photo']['tmp_name'][$i]; // 画像保存先ファイルパス $move_to = $dir_tmp . makeRandStr() . $ext; // アップロードした一時ファイルを指定した場所へ移動します if (!move_uploaded_file($tmp_name, $move_to)) { $errors[] = '画像のアップロードに失敗しました'; if ($i == 0) { $_SESSION['user_profile_photo'] = ''; } else { $_SESSION['user_profile_background'] = ''; } } else {
function uploadNewPhoto($userid) { global $mysqli; if (true != ($check_result = checkFile($mime))) { return $check_result; } if (is_uploaded_file($_FILES['upfile']['tmp_name'])) { $image = $_FILES['upfile']['tmp_name']; $data = $mysqli->real_escape_string(file_get_contents($image)); $query = "INSERT INTO images (imgdata, imgtype, userid) VALUES ('{$data}', '{$mime}', '{$userid}')"; $result = $mysqli->query($query); if (!$result) { printf("Errormessage: %s\n", $mysqli->error); } else { return "[{\"id\": {$mysqli->insert_id} }]"; } } else { return "is_uploaded_file is false. File:" . $_FILES['upfile']['tmp_name'] . $_FILES['upfile']['error'] . "var dump " . var_dump($_FILES); } return "ok"; }
if (!class_exists('ColorCLI')) { return $str; } $severity = $violation['severity']; if ($severity == 'error') { return ColorCLI::red($str); } elseif ($severity == 'warning') { return ColorCLI::yellow($str); } return ColorCLI::cyan($str); } function checkFile($xmlFileName) { $root = realpath(__DIR__ . "/.."); $path = realpath("{$root}/logs/{$xmlFileName}"); if ($path === false || !file_exists($path)) { return "Not found {$xmlFileName}"; } return run($path); } $colorCli = realpath(__DIR__ . '/ColorCLI.php'); if (file_exists($colorCli)) { include_once $colorCli; } define('NORMAL_PRIORITY', 3); $result = array(checkFile("checkstyle.xml")); foreach ($result as $value) { if (is_string($value)) { echo $value, PHP_EOL; } }
command("sudo port install php55-memcached"); } // is software available if (!$is_ok_xcode || !$is_ok_macports || !$is_ok_ffmpeg || !$is_ok_php || !$is_ok_imagick || !$is_ok_memcached) { goodbye("Update your software as specified above"); } // ensure sudo power before continuing enableSuperCow(); output("\nChecking paths"); // check if configuration files are available checkFile("_conf/httpd.conf", "Required file is missing from your configuration source"); checkFile("_conf/my.cnf", "Required file is missing from your configuration source"); checkFile("_conf/httpd-vhosts.conf", "Required file is missing from your configuration source"); checkFile("_conf/php.ini", "Required file is missing from your configuration source"); checkFile("_conf/apache.conf", "Required file is missing from your configuration source"); checkFile("~/.bash_profile", "Required file is missing from home directory"); output("\nCopying configuration"); // copy base configuration copyFile("_conf/httpd.conf", "/opt/local/apache2/conf/httpd.conf", "sudo"); copyFile("_conf/httpd-vhosts.conf", "/opt/local/apache2/conf/extra/httpd-vhosts.conf", "sudo"); // copy apache log rotation conf copyFile("_conf/newsyslog-apache.conf", "/etc/newsyslog.d/apache.conf", "sudo"); // copy php.ini copyFile("_conf/php.ini", "/opt/local/etc/php55/php.ini", "sudo"); // copy my.cnf for MySQL (to override macports settings) copyFile("_conf/my.cnf", "/opt/local/etc/mysql56/my.cnf", "sudo"); // copy php.ini.default for native configuration copyFile("_conf/php_ini_native.ini", "/etc/php.ini", "sudo"); // copy wkhtmltox static executables copyFile("_conf/static_wkhtmltoimage", "/usr/local/bin/static_wkhtmltoimage", "sudo"); copyFile("_conf/static_wkhtmltopdf", "/usr/local/bin/static_wkhtmltopdf", "sudo");
function checkDirectory($path) { global $fsPath, $aIgnore; $fullpath = sprintf('%s/%s', $fsPath, $path); if (!is_dir($fullpath)) { print "Not a directory: {$fullpath}\n"; } if ($path === '/Deleted') { // Deleted files handled separately. return; } if (!empty($path)) { $fod = KTBrowseUtil::folderOrDocument($path); if ($fod === false) { $GLOBALS['aFoldersToRemove'][] = $path; return; } } $dh = @opendir($fullpath); if ($dh === false) { print "Could not open directory: {$fullpath}\n"; } while (($filename = readdir($dh)) !== false) { if (in_array($filename, $aIgnore)) { continue; } $subrelpath = sprintf('%s/%s', $path, $filename); $subfullpath = sprintf('%s/%s', $fsPath, $subrelpath); if (is_dir($subfullpath)) { checkDirectory($subrelpath); } if (is_file($subfullpath)) { checkFile($subrelpath); } } }
} $ecmhit[$hit_caid]["Info"]["ECM"] += $hit_ecm; $ecmhit[$hit_caid]["Info"]["ECMOK"] += $hit_ecmOK; if (!isset($ecmhit["total"]["Info"]["ECM"])) { $ecmhit["total"]["Info"]["ECM"] = 0; } if (!isset($ecmhit["total"]["Info"]["ECMOK"])) { $ecmhit["total"]["Info"]["ECMOK"] = 0; } $ecmhit["total"]["Info"]["ECM"] += $hit_ecm; $ecmhit["total"]["Info"]["ECMOK"] += $hit_ecmOK; } } } unset($servers_data); checkFile($shares_file); $shares_data = file($shares_file); foreach ($shares_data as $currentline) { $inceput1 = substr($currentline, 0, 1); $inceput2 = substr($currentline, 1, 1); if ($inceput1 == "|" && $inceput2 != " ") { $share = explode("|", $currentline); $share_Host = trim($share[1]); $share_Type = trim($share[2]); $share_Caid = trim($share[3]); $share_System = trim($share[4]); $share_ProvidersList = trim($share[5]); if ($share_ProvidersList == "") { $share_ProvidersList = $str_empty; } if ($share_ProvidersList == "0,1,2,3,0") {
$check_info = GetRemoteContent($setting['gen']['update'] . "?m=vertify&v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'], $header); if (!empty($check_info)) { $check_info = json_decode($check_info); $the_file = ROOT_PATH . "/cache/checkfile.php"; if (file_exists($the_file)) { rename($the_file, $the_file . ".bak"); } $file_list = $check_info->file_list; $file_list_md5 = $check_info->file_list_md5; unset($check_info); $content = "<?php\n"; $content .= '$file_list = ' . var_export($file_list, true) . ";\n"; $content .= '$file_list_md5 = ' . var_export($file_list_md5, true) . ";\n"; $content .= "?>"; WriteFile($the_file, $content, "wb"); $result = checkFile(); echo toJson($result, $setting['gen']['charset']); @unlink($the_file); if (file_exists($the_file . ".bak")) { rename($the_file . ".bak", $the_file); } } else { echo "error"; } break; case "u_update": $header['Referer'] = "http://" . $req->GetServer("HTTP_HOST"); $header['ms_sign'] = $setting['web']['sign']; $update_info = GetRemoteContent($setting['gen']['update'] . "?m=u_update&v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'], $header); if (!empty($update_info)) { $update_info = preg_replace("/(^|[\r\n]+)([\\w]{0,6})[\r\n]+/", "", $update_info);