public function perform_action() { $input = FWS_Props::get()->input(); $user = FWS_Props::get()->user(); $folderstr = $input->get_var('folders', 'post', FWS_Input::STRING); $exclstr = $input->get_var('exclude', 'post', FWS_Input::STRING); $files = array(); $folders = FWS_Array_Utils::advanced_explode("\n", $folderstr); $excl = FWS_Array_Utils::advanced_explode("\n", $exclstr); FWS_Array_Utils::trim($excl); // determine files to scan foreach ($folders as $folder) { $folder = trim($folder); if (is_file($folder)) { $files[] = $folder; } else { foreach (FWS_FileUtils::get_list($folder, true, true) as $item) { if (!$this->is_excluded($item, $excl)) { $files[] = $item; } } } } // clear position, just to be sure $storage = new FWS_Progress_Storage_Session('ptypescan_'); $storage->clear(); // store in session $user->set_session_data('typescan_files', $files); // store in project $project = FWS_Props::get()->project(); $project->set_type_folders($folderstr); $project->set_type_exclude($exclstr); PC_DAO::get_projects()->update($project); // clear previous data in the db PC_DAO::get_classes()->delete_by_project($project->get_id()); PC_DAO::get_functions()->delete_by_project($project->get_id()); PC_DAO::get_constants()->delete_by_project($project->get_id()); PC_DAO::get_classfields()->delete_by_project($project->get_id()); PC_DAO::get_errors()->delete_by_type(PC_Obj_Error::get_types_of(PC_Obj_Error::R_TYPESCANNER), $project->get_id()); $this->set_redirect(true, PC_URL::get_submod_url(0, 'cliscan')); $this->set_show_status_page(false); $this->set_action_performed(true); return ''; }
public function perform_action() { $user = FWS_Props::get()->user(); $files = array(); foreach (FWS_FileUtils::get_list('phpman', false, false) as $file) { if (preg_match('/\\.html$/', $file)) { $files[] = 'phpman/' . $file; } } // store in session $user->set_session_data('phpref_files', $files); $user->set_session_data('phpref_aliases', array()); $user->set_session_data('phpref_versions', array()); // clear position, just to be sure $storage = new FWS_Progress_Storage_Session('pphprefscan_'); $storage->clear(); // clear previous data in the db PC_DAO::get_functions()->delete_by_project(PC_Project::PHPREF_ID); PC_DAO::get_classes()->delete_by_project(PC_Project::PHPREF_ID); $this->set_redirect(true, PC_URL::get_submod_url(0, 'cliscan')); $this->set_show_status_page(false); $this->set_action_performed(true); return ''; }
/** * Protected constructor because its a bit ugly (without method-overloading) * * @param string $str the file or string * @param bool $is_file whether $str is a file */ protected function __construct($str, $is_file) { if ($is_file) { $this->file = $str; $str = FWS_FileUtils::read($str); } $this->tokens = token_get_all($str); $this->tokCount = count($this->tokens); for ($i = 0; $i < $this->tokCount; $i++) { if (!is_array($this->tokens[$i])) { $this->tokens[$i] = array(ord($this->tokens[$i]), $this->tokens[$i]); } } $this->pos = -1; $this->line = 1; self::$T_DOC_COMMENT = defined('T_DOC_COMMENT') ? constant('T_DOC_COMMENT') : 10000; }
<?php define('FWS_PATH', '/var/www/scriptsolution/FrameWorkSolution/'); include FWS_PATH . 'init.php'; $license = <<<EOF /** * \$Id\$ * Copyright (C) 2008 - 2014 Nils Asmussen * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ EOF; foreach (FWS_FileUtils::get_list('.', true, true) as $item) { if (preg_match('/^[a-z0-9_\\.]+?\\.(c|cpp|cc|h|s)$/', basename($item))) { $s = implode('', file($item)); $s = preg_replace('/^\\/\\*\\*.+?\\*\\//s', $license, $s); FWS_FileUtils::write($item, $s); } }
/** * Highlights the given file * * @param string $file the file * @param int $line optional the line to mark * @return string the highlighted source */ public static function highlight_file($file, $line = 0) { if (is_file($file)) { $source = FWS_FileUtils::read($file); } else { $source = ''; } return self::highlight_string($source, 1, $line); }