예제 #1
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $tpl = FWS_Props::get()->tpl();
     $input = FWS_Props::get()->input();
     $cookies = FWS_Props::get()->cookies();
     $file = $input->get_var('file', -1, FWS_Input::STRING);
     $name = $input->get_var('name', -1, FWS_Input::STRING);
     $url = PC_URL::get_submod_url();
     $url->set('file', $file);
     $url->set('name', $name);
     $surl = clone $url;
     $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, PC_DAO::get_constants()->get_count_for(0, $file, $name));
     $pagination->populate_tpl($url);
     $start = $pagination->get_start();
     $consts = array();
     $constants = PC_DAO::get_constants()->get_list(array(0), $file, $name, PC_Project::CURRENT_ID, $start, PC_ENTRIES_PER_PAGE);
     foreach ($constants as $const) {
         $url = PC_URL::get_mod_url('file');
         $url->set('path', $const->get_file());
         $url->set('line', $const->get_line());
         $url->set_anchor('l' . $const->get_line());
         $consts[] = array('id' => $const->get_id(), 'name' => $const->get_name(), 'type' => (string) $const->get_type(), 'file' => $const->get_file(), 'line' => $const->get_line(), 'url' => $url->to_url());
     }
     $callurl = PC_URL::get_mod_url('filepart');
     $callurl->set('id', '__ID__');
     $callurl->set('type', 'const');
     $this->request_formular();
     $tpl->add_variables(array('consts' => $consts, 'get_code_url' => $callurl->to_url(), 'file' => $file, 'name' => $name, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('consts_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'consts_search'));
 }
예제 #2
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $tpl = FWS_Props::get()->tpl();
     $input = FWS_Props::get()->input();
     $cookies = FWS_Props::get()->cookies();
     $file = $input->get_var('file', -1, FWS_Input::STRING);
     $class = $input->get_var('class', -1, FWS_Input::STRING);
     $url = PC_URL::get_submod_url();
     $url->set('file', $file);
     $url->set('class', $class);
     $surl = clone $url;
     $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, PC_DAO::get_classes()->get_count_for($class, $file));
     $pagination->populate_tpl($url);
     $start = $pagination->get_start();
     $classes = array();
     foreach (PC_DAO::get_classes()->get_list($start, PC_ENTRIES_PER_PAGE, $class, $file) as $c) {
         $sig = $c->get_signature(true);
         $sig = preg_replace_callback('/#(.+?)#/', function ($match) {
             return "<a href=\"" . PC_URL::get_mod_url('class')->set('name', $match[1])->to_url() . "\">" . $match[1] . "</a>";
         }, $sig);
         $classes[] = array('name' => $sig, 'file' => $c->get_file(), 'line' => $c->get_line(), 'since' => implode(', ', $c->get_version()->get_min()), 'till' => implode(', ', $c->get_version()->get_max()));
     }
     $this->request_formular();
     $tpl->add_variables(array('classes' => $classes, 'file' => $file, 'class' => $class, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('classes_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'classes_search'));
 }
예제 #3
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $tpl = FWS_Props::get()->tpl();
     $input = FWS_Props::get()->input();
     $cookies = FWS_Props::get()->cookies();
     $scope = $input->get_var('scope', -1, FWS_Input::STRING);
     $name = $input->get_var('name', -1, FWS_Input::STRING);
     $url = PC_URL::get_mod_url();
     $url->set('scope', $scope);
     $url->set('name', $name);
     $surl = clone $url;
     $total = PC_DAO::get_vars()->get_count_for($scope, $name);
     $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, $total);
     $pagination->populate_tpl($url);
     $start = $pagination->get_start();
     $vars = array();
     foreach (PC_DAO::get_vars()->get_list($start, PC_ENTRIES_PER_PAGE, $scope, $name) as $var) {
         /* @var $var PC_Obj_Variable */
         $url = PC_URL::get_mod_url('file');
         $url->set('path', $var->get_file());
         $url->set('line', $var->get_line());
         $url->set_anchor('l' . $var->get_line());
         $vscope = $var->get_scope();
         if ($vscope == PC_Obj_Variable::SCOPE_GLOBAL) {
             $vscope = '<i>Global</i>';
         }
         $vars[] = array('id' => $var->get_id(), 'scope' => $vscope, 'name' => '$' . $var->get_name(), 'type' => $var->get_type(), 'file' => $var->get_file(), 'line' => $var->get_line(), 'url' => $url->to_url());
     }
     $callurl = PC_URL::get_mod_url('filepart');
     $callurl->set('id', '__ID__');
     $callurl->set('type', 'var');
     $this->request_formular();
     $tpl->add_variables(array('vars' => $vars, 'get_code_url' => $callurl->to_url(), 'scope' => $scope, 'name' => $name, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('vars_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'vars_search'));
 }
예제 #4
0
 /**
  * @see FWS_Module::init()
  *
  * @param FWS_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $renderer = $doc->use_default_renderer();
     $renderer->add_breadcrumb('PHP-reference scanner', PC_URL::build_mod_url('phpref'));
     // init submodule
     $this->sub->init($doc);
 }
예제 #5
0
 /**
  * @see FWS_Module::init()
  *
  * @param FWS_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $renderer = $doc->use_default_renderer();
     $renderer->add_breadcrumb('Types', PC_URL::build_mod_url());
     // init submodule
     $this->sub->init($doc);
 }
예제 #6
0
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $pid = $input->get_var('id', 'get', FWS_Input::INTEGER);
     if ($pid == null) {
         return '';
     }
     if ($input->isset_var('add', 'post')) {
         $type = $input->correct_var('add_type', 'post', FWS_Input::STRING, array('min', 'max'), 'min');
         $name = $input->get_var('add_name', 'post', FWS_Input::STRING);
         $version = $input->get_var('add_version', 'post', FWS_Input::STRING);
         if ($name == '') {
             return 'Please specify the name of the component';
         }
         if ($version == '') {
             return 'Please specify the version';
         }
         PC_DAO::get_projects()->add_req($pid, $type, $name, $version);
     } else {
         $name = $input->get_var('name', 'post', FWS_Input::STRING);
         $start_day = $input->get_var('start_day', 'post', FWS_Input::INTEGER);
         $start_month = $input->get_var('start_month', 'post', FWS_Input::INTEGER);
         $start_year = $input->get_var('start_year', 'post', FWS_Input::INTEGER);
         $start = mktime(0, 0, 0, $start_month, $start_day, $start_year);
         $projdeps = $input->get_var('projdeps', 'post');
         $report_argret_strictly = $input->isset_var('report_argret_strictly', 'post');
         $edit_type = $input->get_var('edit_type', 'post');
         $edit_name = $input->get_var('edit_name', 'post');
         $edit_version = $input->get_var('edit_version', 'post');
         $proj = PC_DAO::get_projects()->get_by_id($pid);
         if (!$proj) {
             return '';
         }
         if ($name == '') {
             return 'Please specify the project name';
         }
         $proj->set_name($name);
         $proj->set_created($start);
         $proj->set_report_argret_strictly($report_argret_strictly);
         $proj->set_project_deps(is_array($projdeps) ? array_keys($projdeps) : array());
         $req = $proj->get_req();
         foreach ($req as &$r) {
             $r['type'] = $edit_type[$r['id']];
             $r['name'] = $edit_name[$r['id']];
             $r['version'] = $edit_version[$r['id']];
         }
         $proj->set_req($req);
         PC_DAO::get_projects()->update($proj);
     }
     $this->set_success_msg('The version has been added');
     $this->set_redirect(true, PC_URL::get_mod_url('edit_project')->set('id', $pid));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
예제 #7
0
 /**
  * @see FWS_Module::init()
  *
  * @param FWS_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $renderer = $doc->use_default_renderer();
     $renderer->add_breadcrumb('Statement scanner', PC_URL::build_mod_url('stmtscan'));
     // init submodule
     $this->sub->init($doc);
     if (FWS_Props::get()->project() === null) {
         $this->report_error(FWS_Document_Messages::ERROR, 'Please create and select a project first!');
     }
 }
예제 #8
0
 /**
  * @see FWS_Module::init()
  *
  * @param FWS_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $renderer = $doc->use_default_renderer();
     $input = FWS_Props::get()->input();
     $line = $input->get_var('line', 'get', FWS_Input::INTEGER);
     $url = PC_URL::get_mod_url();
     if (isset($_GET['path'])) {
         $url->set('path', $_GET['path']);
     }
     $url->set('line', $line);
     $renderer->add_breadcrumb('View file', $url->to_url());
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $pid = $input->get_var('id', 'get', FWS_Input::INTEGER);
     $vid = $input->get_var('vid', 'get', FWS_Input::INTEGER);
     if ($pid == null || $vid == null) {
         return TDL_GENERAL_ERROR;
     }
     PC_DAO::get_projects()->del_req($vid);
     $this->set_success_msg('The requirement has been deleted');
     $this->set_redirect(true, PC_URL::get_mod_url('edit_project')->set('id', $pid));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
예제 #10
0
 /**
  * Builds an URL to the code for given location.
  *
  * @param PC_Obj_Location $loc the location
  * @return string the URL
  */
 public static function get_code_url($loc)
 {
     $file = $loc->get_file();
     $line = $loc->get_line();
     if ($file) {
         $classes = PC_DAO::get_classes()->get_by_file($file);
         if (count($classes) == 1) {
             $url = PC_URL::get_mod_url('class')->set('name', $classes[0]->get_name());
         } else {
             $url = PC_URL::get_mod_url('file')->set('path', $file);
         }
         $url->set_anchor('l' . $line);
         return $url->to_url();
     }
     return '#';
 }
예제 #11
0
 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 '';
 }
예제 #12
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $input = FWS_Props::get()->input();
     $tpl = FWS_Props::get()->tpl();
     $id = $input->get_var('id', 'get', FWS_Input::INTEGER);
     if ($id === null) {
         $this->report_error();
         return;
     }
     $add_type = $input->correct_var('add_type', 'post', FWS_Input::STRING, array('min', 'max'), 'min');
     $add_name = $input->get_var('add_name', 'post', FWS_Input::STRING);
     $add_version = $input->get_var('add_version', 'post', FWS_Input::STRING);
     $proj = PC_DAO::get_projects()->get_by_id($id);
     if ($proj === null) {
         $this->report_error();
         return;
     }
     $target_url = PC_URL::get_mod_url();
     $target_url->set('id', $id);
     $this->request_formular();
     $req = $proj->get_req();
     if (!is_array($req)) {
         $req = array();
     }
     foreach ($req as &$r) {
         $del_url = clone $target_url;
         $del_url->set('vid', $r['id']);
         $del_url->set('aid', PC_ACTION_DELETE_REQ);
         $r['del_url'] = $del_url->to_url();
     }
     $projects = array();
     foreach (PC_DAO::get_projects()->get_all() as $p) {
         if ($p->get_id() == $proj->get_id()) {
             continue;
         }
         $projects[] = array('id' => $p->get_id(), 'value' => in_array($p->get_id(), $proj->get_project_deps()), 'name' => $p->get_name());
     }
     $tpl->add_variables(array('target_url' => $target_url->to_url(), 'action_type' => PC_ACTION_EDIT_PROJECT, 'def_name' => $proj->get_name(), 'def_start' => $proj->get_created(), 'projects' => $projects, 'report_argret_strictly' => $proj->get_report_argret_strictly(), 'req' => $req, 'add_type' => $add_type, 'add_name' => $add_name, 'add_version' => $add_version, 'types' => array('min' => '&gt;=', 'max' => '&lt;'), 'add_req_url' => $target_url->set('aid', PC_ACTION_ADD_REQ)->to_url()));
 }
예제 #13
0
 /**
  * Builds an URL-instance for the given module.
  *
  * @param string|int $mod the module-name (0 = current, -1 = none)
  * @param string $separator the separator of the params (default is &amp;)
  * @param boolean $force_sid forces the method to append the session-id
  * @return PC_URL the url-instance
  */
 public static function get_mod_url($mod = 0, $separator = '&amp;', $force_sid = false)
 {
     $url = new PC_URL();
     if ($force_sid) {
         $url->set_sid_policy(self::SID_FORCE);
     }
     $url->set_separator($separator);
     if ($mod === 0) {
         $input = FWS_Props::get()->input();
         $action = $input->get_var('module', 'get', FWS_Input::STRING);
         if ($action != null) {
             $url->set('module', $action);
         }
     } else {
         $url->set('module', $mod);
     }
     return $url;
 }
예제 #14
0
 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 '';
 }
예제 #15
0
 private function get_call($call, $types)
 {
     if ($call->get_class() && $call->get_class() == PC_Obj_Class::UNKNOWN) {
         $classname = '<i>UNKNOWN</i>';
     } else {
         $classname = $call->get_class();
     }
     $url = PC_URL::get_mod_url('class');
     $url->set('name', $classname);
     $str = '';
     if ($classname) {
         $str .= '<a href="' . $url->to_url() . '">' . $classname . '</a>';
         $str .= $call->is_static() ? '::' : '->';
     }
     $func = $types->get_method_or_func($call->get_class(), $call->get_function());
     if ($func && $func->get_line()) {
         $str .= '<a href="' . PC_Utils::get_code_url($func) . '">' . $call->get_function() . '</a>(';
     } else {
         $str .= $call->get_function() . '(';
     }
     $str .= implode(', ', $call->get_arguments());
     $str .= ')';
     return $str;
 }
예제 #16
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $tpl = FWS_Props::get()->tpl();
     if (!$this->class) {
         $this->report_error();
         return;
     }
     $curl = PC_URL::get_mod_url();
     $classname = $this->class->get_name();
     // build class-declaration
     $declaration = '';
     if (!$this->class->is_interface()) {
         if ($this->class->is_abstract()) {
             $declaration .= 'abstract ';
         } else {
             if ($this->class->is_final()) {
                 $declaration .= 'final ';
             }
         }
         $declaration .= 'class ';
     } else {
         $declaration .= 'interface ';
     }
     $declaration .= $classname . ' ';
     if (!$this->class->is_interface() && ($cn = $this->class->get_super_class())) {
         $declaration .= 'extends <a href="' . $curl->set('name', $cn)->to_url() . '">' . $cn . '</a> ';
     }
     if (count($this->class->get_interfaces()) > 0) {
         $declaration .= !$this->class->is_interface() ? 'implements ' : 'extends ';
         foreach ($this->class->get_interfaces() as $if) {
             $declaration .= '<a href="' . $curl->set('name', $if)->to_url() . '">' . $if . '</a>, ';
         }
         $declaration = FWS_String::substr($declaration, 0, -1);
     }
     $declaration = FWS_String::substr($declaration, 0, -1) . ';';
     $tpl->add_variables(array('classname' => $classname, 'declaration' => $declaration));
     $classfile = $this->class->get_file();
     // constants
     $consts = array();
     foreach ($this->class->get_constants() as $const) {
         $consts[] = array('name' => $const->get_name(), 'type' => $const->get_type(), 'line' => $const->get_line(), 'url' => $this->get_url($classfile, $const));
     }
     $tpl->add_variable_ref('consts', $consts);
     // fields
     $fields = array();
     $cfields = $this->class->get_fields();
     ksort($cfields);
     foreach ($cfields as $field) {
         $fields[] = array('name' => $field->get_name(), 'type' => (string) $field, 'line' => $field->get_line(), 'url' => $this->get_url($classfile, $field));
     }
     $tpl->add_variable_ref('fields', $fields);
     // methods
     $methods = array();
     $cmethods = $this->class->get_methods();
     ksort($cmethods);
     foreach ($cmethods as $method) {
         $methods[] = array('name' => $method->get_name(), 'type' => $method->__ToString(), 'line' => $method->get_line(), 'url' => $this->get_url($classfile, $method), 'since' => implode(', ', $method->get_version()->get_min()), 'till' => implode(', ', $method->get_version()->get_max()));
     }
     $tpl->add_variable_ref('methods', $methods);
     if ($this->class->get_file() && $this->class->get_line()) {
         $source = PC_Utils::highlight_file($this->class->get_file());
     } else {
         $source = '';
     }
     $tpl->add_variables(array('source' => $source, 'file' => $this->class->get_file(), 'line' => $this->class->get_line(), 'since' => implode(', ', $this->class->get_version()->get_min()), 'till' => implode(', ', $this->class->get_version()->get_max())));
 }
예제 #17
0
 /**
  * Builds the message
  *
  * @param PC_Obj_Error $err the error
  * @return string the message
  */
 private function get_msg($err)
 {
     $msg = $err->get_msg();
     return preg_replace_callback('/#(#?[a-zA-Z0-9_:]+?)#/', function ($match) {
         $func = '';
         if (strstr($match[1], '::')) {
             list($class, $func) = explode('::', $match[1]);
             $func = '::' . $func;
         } else {
             if ($match[1] == PC_Obj_Variable::SCOPE_GLOBAL) {
                 return '<i>Global</i>';
             } else {
                 $class = $match[1];
             }
         }
         $url = PC_URL::get_mod_url('class')->set('name', $class)->to_url();
         return "<a href=\"" . $url . "\">" . $class . "</a>" . $func;
     }, $msg);
 }