function annotate() { require_once 'externals.php'; $filename = $_SESSION['filename']; $tempdir = get_directory(); chdir($tempdir); $file = fopen("{$tempdir}/{$filename}", "w"); fwrite($file, $_SESSION['plfile']); fclose($file); $annotations = $_POST['annotations']; $annotations = '[' . $annotations . '].'; if (isset($_POST['filters'])) { $filters = $_POST['filters']; } else { $filters = $_SESSION['filters']; } $output = modify_annotations("{$tempdir}/{$filename}", "{$tempdir}/{$filename}.ann", $annotations, $filters); if ($output[0] != 0) { $_SESSION['editerror'] = $output[2]; delDir($tempdir); if (isset($_POST['textedit'])) { redirect('edit_filters.php'); } else { redirect('upload_annfile.php'); } } $_SESSION['editerror'] = ''; $_SESSION['annfile'] = file_get_contents("{$tempdir}/{$filename}.ann"); $_SESSION['filters'] = $filters; delDir($tempdir); }
{ $_SESSION[$name] = isset($_POST[$name]) ? 'on' : 'off'; return $_SESSION[$name]; } // have to do it this way since there's no difference between a disabled // checkbox and an uncheck one. This way all options don't revert to off // when you disable watch mode. if (get_opt_and_save('watch') == 'on') { $watch_opts = array('enabled' => true, 'builtins' => get_opt_and_save('watch_builtins'), 'connectives' => get_opt_and_save('watch_connectives'), 'infunfold' => get_opt_and_save('watch_infunfold'), 'infmemo' => get_opt_and_save('watch_infmemo'), 'backprop' => get_opt_and_save('watch_backprop')); } else { $watch_opts = array('enabled' => false); } $_SESSION['logging'] = $logging = $_POST['logging']; $_SESSION['goal'] = $goal = $_POST['goal']; $spec = isset($_POST['submit']) && $_POST['submit'] == 'Create GX' ? 2 : 1; $tempdir = get_directory(); $file = fopen("{$tempdir}/{$filename}", "w"); fwrite($file, $_SESSION['plfile']); fclose($file); $file = fopen("{$tempdir}/{$filename}.ann", "w"); fwrite($file, $annfile); fclose($file); chronometer(); if ($spec == 1) { $retarray = specialise($filename, $goal, $tempdir, $watch_opts, $logging, $safe); } else { $retarray = create_gx($filename, $tempdir, $watch_opts, $logging); } $time = chronometer(); if ($retarray[0] == 0) { // No error
function get_directory($dir, $level = 0) { $ignore = array( 'cgi-bin', '.', '..' ); $dh = @opendir($dir); while( false !== ( $file = readdir($dh))){ if( !in_array( $file, $ignore ) ){ if(is_dir("$dir/$file")) { echo "\n$file\n"; get_directory("$dir/$file", ($level+1)); } else { //echo "$spaces $file\n"; process_file("$dir/$file"); } } } closedir( $dh ); if(is_dir_empty($dir) && $dir != "D:/wamp/www/tmp_dir") { //print "\n-= Removing $dir =-\n"; rmdir($dir); } }
function get_full_path_to($file) { return "http://" . $_SERVER['HTTP_HOST'] . get_directory($_SERVER['REQUEST_URI']) . '/' . $file; }
function execfs_cd($nick, $path) { global $fs; global $false; if (substr($path, 0, 1) != PATH_DELIM) { $directory =& get_current_directory($nick); if ($directory == $false) { execfs_privmsg("error: invalid current path for {$nick}"); return; } $dirpath = get_path($directory); if ($dirpath != PATH_DELIM) { $path = $dirpath . PATH_DELIM . $path; } else { $path = PATH_DELIM . $path; } term_echo("*** execfs_cd: path={$path}"); } if (substr($path, strlen($path) - 1) == PATH_DELIM) { $path = substr($path, 0, strlen($path) - 1); } $directory =& get_directory($path); if ($directory == $false) { execfs_privmsg("error: path not found"); return; } $fs["paths"][$nick] = get_path($directory); unset($directory); $fs["modified"] = True; execfs_privmsg("current path for {$nick} changed to \"" . $fs["paths"][$nick] . "\""); }
/** * script_directory() * Return script directory url. * @return string */ function script_directory() { return get_directory('script'); }
public function do_restore() { $storage = "./tmp_dir/"; get_directory("./dcm_STOR/"); }