function permissioncheck() { global $root; if (file_exists('step0.lock')) { header('Location: index.php?step=1'); } $dirs = array($root . 'dir_list/' => 0, $root . 'imdb/' => 0, $root . 'cache/' => 0, $root . 'torrents/' => 0, $root . 'uploads/' => 0, $root . 'include/backup/' => 0, $root . 'logs/' => 0, $root . 'install/' => 0, $root . 'install/extra/' => 0, $root . 'include/' => 0); checkdir($dirs); $continue = true; $out = '<fieldset><legend>Directory check</legend>'; foreach ($dirs as $dir => $state) { if (!$state) { $continue = false; } $out .= '<div class="' . ($state ? 'readable' : 'notreadable') . '">' . $dir . '</div>'; } if (!$continue) { $out .= '<div class="info" style="text-align:center">It looks like you need to chmod some directories!<br/>all directories marked in red should be chmoded 0777<br/><input type="button" value="Reload" onclick="window.location.reload()"/></div>'; } $out .= '</fieldset>'; if ($continue) { $out .= '<fieldset><div style="text-align:center"><input type="button" onclick="window.location.href=\'index.php?step=1\'" value="Next step" /></div></fieldset>'; file_put_contents('step0.lock', '1'); } return $out; }
function checkdir($basedir) { if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { if (!is_dir($basedir . "/" . $file)) { echo "filename: {$basedir}/\r\n\r\n{$file} " . checkBOM("{$basedir}/{$file}") . " <br>"; } else { $dirname = $basedir . "/" . $file; checkdir($dirname); } } } closedir($dh); } }
function checkdir($basedir) { if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { if (!is_dir($basedir . '/' . $file)) { $filename = $basedir . '/' . $file; echo 'filename:' . $basedir . '/' . $file . checkBOM($filename) . '<br>'; } else { $dirname = $basedir . '/' . $file; checkdir($dirname); } } } closedir($dh); } }
function checkdir($dir, $filter = '/(\\.php|\\.xml|\\.js)$/') { $checklist = array(); $files = scandir($dir); foreach ($files as $file) { if ($file[0] == '.') { continue; } $path = "{$dir}/{$file}"; if (is_dir($path)) { $checklist += checkdir($path, $filter); } elseif (preg_match($filter, $file)) { $checklist[$path] = 1; } } return $checklist; }
function checkdir($basedir) { if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..' && $file != '.svn') { if (!is_dir($basedir . "/" . $file)) { if (checkBOM("{$basedir}/{$file}") == 1) { echo "filename: {$basedir}/{$file} <font color=red>tồn tại, đã tự động xóa.</font> <br>"; } } else { $dirname = $basedir . "/" . $file; checkdir($dirname); } } } closedir($dh); } }
function checkdir($basedir) { if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { if (!is_dir($basedir . "/" . $file)) { if (checkBOM("{$basedir}/{$file}") == 1) { echo "filename: {$basedir}/{$file}<font color=red>found bom and remove!</font><br>"; } } else { $dirname = $basedir . "/" . $file; checkdir($dirname); } } } closedir($dh); } }
function checkdir($basedir) { if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..' && $file != '.svn') { if (!is_dir($basedir . "/" . $file)) { $res = checkBOM("{$basedir}/{$file}"); if ($res != 'BOM Not Found.') { echo "filename: {$basedir}/{$file} " . $res . " <br>"; } } else { $dirname = $basedir . "/" . $file; checkdir($dirname); } } } closedir($dh); } }
function checkdir($basedir = '', $loop = true) { $basedir = empty($basedir) ? '.' : $basedir; if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { if (!is_dir($basedir . '/' . $file)) { echo '文件: ' . $basedir . '/' . $file . checkBOM($basedir . '/' . $file) . ' <br>'; } else { if (!$loop) { continue; } $dirname = $basedir . '/' . $file; checkdir($dirname); } } } closedir($dh); } }
function permissioncheck() { global $root; if (file_exists('step0.lock')) { header('Location: index.php?step=1'); } $dirs = array($root . 'dir_list/' => 0, $root . 'imdb/' => 0, $root . 'cache/' => 0, $root . 'torrents/' => 0, $root . 'uploads/' => 0, $root . 'include/backup/' => 0, $root . 'sqlerr_logs/' => 0, $root . 'install/' => 0, $root . 'install/extra/' => 0, $root . 'include/' => 0); checkdir($dirs); $continue = true; $out = '<fieldset><legend>Directory check</legend>'; $cmd = 'chmod 0777'; foreach ($dirs as $dir => $state) { if (!$state) { $continue = false; $cmd .= ' ' . $dir; } $out .= '<div class="' . ($state ? 'readable' : 'notreadable') . '">' . $dir . '</div>'; } if (!$continue) { $out .= '<div class="info">It looks like you need to chmod some directories!<br/>all directories marked in red should be chmoded 0777<br/>' . '<label for="show-chmod" class="btn">Show me the CHMOD command</label><input type="checkbox" id="show-chmod">' . '<pre class="chmod-cmd">' . $cmd . '</pre>' . '<input type="button" value="Reload" onclick="window.location.reload()"/>' . '</div>'; } $out .= '</fieldset>'; $out .= '<fieldset><legend>Module check</legend>'; $memcached_loaded = true; if (!extension_loaded('memcached')) { $continue = $memcached_loaded = false; $out .= '<div class="notreadable">memcached</div>'; } else { $out .= '<div class="readable">memcached</div>'; } if ($memcached_loaded) { $out .= '<div class="info">The memcached module for PHP is not installed and is required for u232<br/>' . '<input type="button" value="Reload" onclick="window.location.reload()"/>' . '</div>'; } $out .= '</fieldset>'; if ($continue) { $out .= '<fieldset><div><input type="button" onclick="window.location.href=\'index.php?step=1\'" value="Next step" /></div></fieldset>'; file_put_contents('step0.lock', '1'); } return $out; }
function log_file($msg, $filename) { $msg = date('Y-m-d H:i:s') . $msg; checkdir($filename); file_put_contents($filename, $msg . "\n", FILE_USE_INCLUDE_PATH | FILE_APPEND); }
/** * Deletes an option file **/ function wp_delete_option($option) { $dirchk = checkdir(); if ($dirchk == false) { return false; } elseif (!file_exists(WIPIOPTSPATH . "/{$option}.wp")) { return false; } else { unlink(WIPIOPTSPATH . "/{$option}.wp"); return true; } }
function checkdir($basedir) { static $num = 0; if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { if (!is_dir($basedir . "/" . $file)) { if (file_ext($file) == 'php' && checkBOM("{$basedir}/{$file}", false)) { echo "filename: {$basedir}/{$file} <b style='color:red'>bom found.</b><br/>"; $num++; } } else { $dirname = $basedir . "/" . $file; checkdir($dirname); } } } closedir($dh); } return $num; }
$smarty->assign('dg_ttf', function_exists('imagettftext')); $smarty->assign('gd_image', $pass_img); } else { $smarty->assign('gd_image', $fail_img); } // directories $smarty->assign('dir_writable', is_writeable('../cache')); if (is_writeable('../cache')) { $text = checkdir('../cache/SQL'); $text .= checkdir('../cache/api'); $text .= checkdir('../cache/data'); $text .= checkdir('../cache/mails'); $text .= checkdir('../cache/img'); $text .= checkdir('../cache/img/map'); $text .= checkdir('../cache/store'); $text .= checkdir('../cache/templates_c'); $smarty->assign('dir_text', $text); $smarty->assign('dir_image', $pass_img); } else { $stoppage = true; $smarty->assign('dir_image', $fail_img); } //config file $smarty->assign('conf_exists', file_exists('../kbconfig.php')); if (!file_exists('../kbconfig.php')) { $stoppage = true; $smarty->assign('conf_image', $fail_img); } elseif (is_writeable('../kbconfig.php')) { $smarty->assign('conf_image', $pass_img); } else { $stoppage = true;
function checkdir($dir = '') { global $lang_dir, $fromlang, $tolang; $dir = str_replace('\\','/',$dir); // Replace Backslash with right slash $dir = preg_replace('/\/$/','',$dir); // Remove trailing slash $sourcedir = $lang_dir . '/' . $fromlang; $targetdir = $lang_dir . '/' . $tolang; if($dir) { $sourcedir .= '/' . $dir; $targetdir .= '/' . $dir; } //DEBUG //echo "<pre>"; //echo 'checkdir dir=', $dir, "\n"; //echo "sourcedir=", $sourcedir, "\n"; //echo "targetdir=", $targetdir, "\n"; //echo "</pre>"; $indent = ' '; if(!is_dir($sourcedir)) { error('Source directory <b>' . $sourcedir . '</b> NOT FOUND!'); return; } if(!is_dir($targetdir)) { error('Target directory <b>' . $targetdir . '</b> NOT FOUND!'); return; } //---------------------------------------------------- $d = opendir($sourcedir); while($file = readdir($d)) { if($file == '.' || $file == '..') continue; $sourcefile = $sourcedir . '/' . $file; $targetfile = $targetdir . '/' . $file; //DEBUG //echo "<pre>"; //echo "sourcefile=", $sourcefile, "\n"; //echo "targetfile=", $targetfile, "\n"; //echo "</pre>"; if(is_dir($sourcefile)) { $newdir = ($dir ? $dir . '/' : '') . $file; checkdir($newdir); } else if( substr($file, -4) == '.php') { $error = 0; $left = str_replace($lang_dir,'',$sourcefile); $right = str_replace($lang_dir,'',$targetfile); $source = array(); $target = array(); $class = ''; $right_exists = false; //-------------------------------- unset($lang); unset($extend_lang); include $sourcefile; if (isset($lang)) { $source = $lang; } elseif (isset($extend_lang)) { $source = $extend_lang; } else { $error = 1; $left .= '<br>is NOT LANG file!!!'; } //-------------------------------- if (!is_file($targetfile)) { $error = 1; $right .= '<br>FILE NOT FOUND!!!'; } else { unset($lang); unset($extend_lang); $right_exists = true; include ($targetfile); if (isset($lang)) { $target = $lang; } elseif (isset($extend_lang)) { $target = $extend_lang; } else { $error = 1; $right .= '<br>is NOT LANG file!!!'; } } //-------------------------------- if(count($source) == count($target)) { } else { $error = 1; $source_keys = array_keys($source); $target_keys = array_keys($target); if($right_exists) { foreach (array_diff($source_keys, $target_keys) as $key) { $left .= "<br/>" . $indent . $key; if(is_numeric($key)) { if(gettype($source[$key])=='array') { $left .= "=Array"; } else { $left .= "='" . htmlspecialchars($source[$key]) ."'"; } } } } foreach (array_diff($target_keys, $source_keys) as $key) { $right .= "<br/>" . $indent . $key; if(is_numeric($key)) $right .= "='" . htmlspecialchars($target[$key]) ."'"; } } echo '<tr valign="top"', ($error ? ' style="color:red;"' : ''), ">\n"; echo "<td>", $left, "</td>\n"; echo '<td align="center">', count($source), "</td>\n"; echo '<td align="center">', count($target), "</td>\n"; echo "<td>", $right, "</td>\n"; echo "</tr>\n"; } } }