/** * @see FWS_Module::run() */ public function run() { $user = FWS_Props::get()->user(); $tpl = FWS_Props::get()->tpl(); $jobs = array(); $files = $user->get_session_data('phpref_files'); for ($i = 0; $i < count($files); $i += PC_PHPREF_PAGES_PER_CYCLE) { $args = array(); for ($j = 0, $count = min(count($files) - $i, PC_PHPREF_PAGES_PER_CYCLE); $j < $count; $j++) { $args[] = escapeshellarg($files[$i + $j]); } $jobs[] = PC_PHP_EXEC . ' cli.php phpref ' . implode(' ', $args); } $user->delete_session_data('phpref_files'); $user->set_session_data('job_commands', $jobs); $user->set_session_data('job_finalizer', PC_PHP_EXEC . ' cli.php phpreffin'); // init shared data $mutex = new FWS_MutexFile(PC_CLI_MUTEX_FILE); $mutex->aquire(); $data = new PC_JobData(); $data->set_misc(array('versions' => array(), 'aliases' => array())); $mutex->write(serialize($data)); $mutex->close(); $tpl->add_variables(array('file_count' => count($files), 'files_per_job' => PC_PHPREF_PAGES_PER_CYCLE, 'check_interval' => PC_JOB_CTRL_POLL_INTERVAL / 1000)); }
/** * @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')); }
/** * Puts all variables to the template inc_pagination.htm so that it can be included. * * @param TDL_URL $url the URL-instance */ public function populate_tpl($url) { $tpl = FWS_Props::get()->tpl(); if (!$url instanceof TDL_URL) { FWS_Helper::def_error('instance', 'url', 'TDL_URL', $url); } if ($this->get_page_count() > 1) { $param = $this->get_page_param(); $page = $this->get_page(); $numbers = $this->get_page_numbers(); $tnumbers = array(); foreach ($numbers as $n) { $number = $n; $link = ''; if (FWS_Helper::is_integer($n)) { $url->set($param, $n); $link = $url->to_url(); } else { $link = ''; } $tnumbers[] = array('number' => $number, 'link' => $link); } $start_item = $this->get_start() + 1; $end_item = $start_item + $this->get_per_page() - 1; $end_item = $end_item > $this->get_num() ? $this->get_num() : $end_item; $tpl->set_template('inc_pagination.htm'); $tpl->add_variable_ref('numbers', $tnumbers); $tpl->add_variables(array('page' => $page, 'total_pages' => $this->get_page_count(), 'start_item' => $start_item, 'end_item' => $end_item, 'total_items' => $this->get_num(), 'prev_url' => $url->set($param, $page - 1)->to_url(), 'next_url' => $url->set($param, $page + 1)->to_url(), 'first_url' => $url->set($param, 1)->to_url(), 'last_url' => $url->set($param, $this->get_page_count())->to_url())); $tpl->restore_template(); } }
/** * @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); $function = $input->get_var('function', -1, FWS_Input::STRING); $url = PC_URL::get_mod_url(); $url->set('file', $file); $url->set('class', $class); $url->set('function', $function); $surl = clone $url; $typecon = new PC_Engine_TypeContainer(new PC_Engine_Options()); $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, PC_DAO::get_calls()->get_count_for($file, $class, $function)); $pagination->populate_tpl($url); $start = $pagination->get_start(); $calls = array(); foreach (PC_DAO::get_calls()->get_list($start, PC_ENTRIES_PER_PAGE, $file, $class, $function) as $call) { /* @var $call PC_Obj_Call */ $url = PC_URL::get_mod_url('file'); $url->set('path', $call->get_file()); $url->set('line', $call->get_line()); $url->set_anchor('l' . $call->get_line()); $func = $typecon->get_method_or_func($call->get_class(), $call->get_function()); $calls[] = array('id' => $call->get_id(), 'call' => $this->get_call($call, $typecon), 'file' => $call->get_file(), 'line' => $call->get_line(), 'url' => $url->to_url(), 'since' => $func ? implode(', ', $func->get_version()->get_min()) : '', 'till' => $func ? implode(', ', $func->get_version()->get_max()) : ''); } $callurl = PC_URL::get_mod_url('filepart'); $callurl->set('id', '__ID__'); $callurl->set('type', 'call'); $this->request_formular(); $tpl->add_variables(array('calls' => $calls, 'get_code_url' => $callurl->to_url(), 'file' => $file, 'class' => $class, 'function' => $function, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('calls_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'calls_search')); }
/** * @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')); }
/** * @see FWS_Module::run() */ public function run() { $input = FWS_Props::get()->input(); $functions = FWS_Props::get()->functions(); $id_str = $input->get_var('ids', 'get', FWS_Input::STRING); $loc = $input->get_var('loc', 'get', FWS_Input::STRING); if (!$id_str || !$loc) { $this->report_error(); return; } $ids = FWS_Array_Utils::advanced_explode(',', $id_str); if (FWS_Array_Utils::is_numeric($ids)) { switch ($loc) { case 'view_projects': $table = TDL_TB_PROJECTS; $field = 'project_name'; $yes_url = TDL_URL::get_mod_url('view_projects'); $yes_url->set(TDL_URL_AT, TDL_ACTION_DELETE_PROJECTS); $yes_url->set(TDL_URL_IDS, implode(',', $ids)); $yes_url = $yes_url->to_url(); break; case 'view_entries': $table = TDL_TB_ENTRIES; $field = 'entry_title'; $yes_url = TDL_URL::get_mod_url(-1); $yes_url->set(TDL_URL_AT, TDL_ACTION_DELETE_ENTRIES); $yes_url->set(TDL_URL_IDS, implode(',', $ids)); $yes_url = $yes_url->to_url(); break; } $no_url = 'javascript:FWS_hideElement(\\\'delete_message_box\\\');'; $functions->add_entry_delete_message($ids, $table, $field, $yes_url, $no_url); } }
public function perform_action() { $input = FWS_Props::get()->input(); $locale = FWS_Props::get()->locale(); $project_name = $input->get_var('project_name', 'post', FWS_Input::STRING); $project_name_short = $input->get_var('project_name_short', '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); $project = new TDL_Objects_Project(TDL_TB_PROJECTS); $project->set_project_name($project_name); $project->set_project_name_short($project_name_short); $project->set_project_start($start); if (!$project->check('create')) { return $project->errors(); } $project->create(); $id = $project->get_id(); $edit_url = TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $id); $this->set_success_msg($locale->_('The project has been added')); $this->set_redirect(true, $edit_url); $this->add_link($locale->_('Edit the project'), $edit_url); $this->set_action_performed(true); return ''; }
/** * Sets the property-accessor for the properties * * @param FWS_PropAccessor $accessor the accessor */ public static function set_accessor($accessor) { if (!$accessor instanceof FWS_PropAccessor) { FWS_Helper::def_error('instance', 'accessor', 'FWS_PropAccessor', $accessor); } self::$accessor = $accessor; }
/** * @see FWS_Module::run() */ public function run() { $tpl = FWS_Props::get()->tpl(); $project = FWS_Props::get()->project(); $this->request_formular(); $tpl->add_variables(array('action_id' => PC_ACTION_START_STMNTSCAN, 'folders' => $project !== null ? $project->get_stmt_folders() : '', 'exclude' => $project !== null ? $project->get_stmt_exclude() : '')); }
/** * @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')); }
public function get_action_id() { $input = FWS_Props::get()->input(); $action_type = $input->get_var('action_type', 'post', FWS_Input::INTEGER); if ($action_type === null) { $action_type = $input->get_predef(TDL_URL_AT, 'get'); } return $action_type; }
public function perform_action() { $input = FWS_Props::get()->input(); $db = FWS_Props::get()->db(); $functions = FWS_Props::get()->functions(); $locale = FWS_Props::get()->locale(); $title = $input->get_var('entry_title', 'post', FWS_Input::STRING); $description = $input->get_var('entry_description', 'post', FWS_Input::STRING); $entry_info_link = $input->get_var('entry_info_link', 'post', FWS_Input::STRING); $category = $input->get_var('category', 'post', FWS_Input::INTEGER); $start_version = $input->get_var('start_version', 'post', FWS_Input::STRING); $fixed_version = $input->get_var('fixed_version', 'post', FWS_Input::STRING); $status = $input->correct_var('status', 'post', FWS_Input::STRING, array('open', 'running', 'fixed', 'not_tested', 'not_reproducable', 'need_info'), 'open'); $type = $input->correct_var('type', 'post', FWS_Input::STRING, array('bug', 'feature', 'improvement', 'test'), 'bug'); $priority = $input->correct_var('priority', 'post', FWS_Input::STRING, array('current', 'next', 'anytime'), 'anytime'); @(list($start_project_id, $start_version_id) = explode(',', $start_version)); $time = time(); // create entry $entry = new TDL_Objects_Entry(TDL_TB_ENTRIES); $entry->set_project_id($start_project_id); $entry->set_entry_title($title); $entry->set_entry_description($description); $entry->set_entry_category($category); $entry->set_entry_start_date($time); $entry->set_entry_start_version($start_version_id); $entry->set_entry_changed_date($time); $entry->set_entry_status($status); $entry->set_entry_info_link($entry_info_link); $entry->set_entry_type($type); $entry->set_entry_priority($priority); // determine fixed-inputs $fixed_version_id = 0; if ($fixed_version == 0 || $status != 'fixed') { $entry->set_entry_fixed_date(0); $entry->set_entry_fixed_version(0); } else { @(list(, $fixed_version_id) = explode(',', $fixed_version)); $entry->set_entry_fixed_date($time); $entry->set_entry_fixed_version($fixed_version_id); } // check for errors if (!$entry->check('create')) { return $entry->errors(); } // create the object $entry->create(); // update config $db->update(TDL_TB_CONFIG, ' WHERE is_selected = 1', array('last_start_version' => $start_version_id, 'last_fixed_version' => $fixed_version_id, 'last_category' => $category, 'last_type' => $type, 'last_priority' => $priority, 'last_status' => $status)); $url = new TDL_URL(); $this->add_link($locale->_('Back'), $url->set(TDL_URL_ACTION, 'view_entries')); $this->set_success_msg('Der Eintrag wurde erfolgreich erstellt!'); $this->set_redirect(true, TDL_URL::get_entry_url()); $this->set_action_performed(true); return ''; }
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 ''; }
/** * @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!'); } }
/** * Constructor * * @param string $module your module-name * @param array $subs the sub-module names that are possible * @param string $default the default sub-module */ public function __construct($module, $subs = array(), $default = 'default') { $input = FWS_Props::get()->input(); if (count($subs) == 0) { FWS_Helper::error('Please provide the possible submodules of this module!'); } $sub = $input->correct_var('sub', 'get', FWS_Input::STRING, $subs, $default); // include the sub-module and create it include_once FWS_Path::server_app() . 'module/' . $module . '/sub_' . $sub . '.php'; $classname = 'PC_SubModule_' . $module . '_' . $sub; $this->sub = new $classname(); }
/** * @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); $msg = $input->get_var('msg', -1, FWS_Input::STRING); $types = $input->get_var('types', -1); if (!FWS_Array_Utils::is_numeric($types)) { $types = array(); } $url = PC_URL::get_mod_url(); $url->set('file', $file); $url->set('msg', $msg); if (count($types)) { $url->set('types', $types); } $surl = clone $url; $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, PC_DAO::get_errors()->get_count_with($file, $msg, $types)); $pagination->populate_tpl($url); $start = $pagination->get_start(); $errs = array(); $errors = PC_DAO::get_errors()->get_list(PC_Project::CURRENT_ID, $start, PC_ENTRIES_PER_PAGE, $file, $msg, $types); foreach ($errors as $err) { /* @var $err PC_Obj_Error */ $url = PC_URL::get_mod_url('file'); $url->set('path', $err->get_loc()->get_file()); $url->set('line', $err->get_loc()->get_line()); $url->set_anchor('l' . $err->get_loc()->get_line()); $errs[] = array('id' => $err->get_id(), 'type' => PC_Obj_Error::get_type_name($err->get_type()), 'message' => $this->get_msg($err), 'file' => $err->get_loc()->get_file(), 'line' => $err->get_loc()->get_line(), 'fileurl' => $url->to_url(), 'typeurl' => PC_URL::get_mod_url()->set('types', array($err->get_type()))->to_url()); } $this->request_formular(); $typecbs = array(); $row = -1; $i = 0; $error_types = PC_Obj_Error::get_types(); asort($error_types); foreach ($error_types as $type => $name) { if ($i % 4 == 0) { $typecbs[++$row] = array(); } $typecbs[$row][] = array('name' => 'types[' . $type . ']', 'selected' => count($types) == 0 || in_array($type, $types), 'value' => $type, 'text' => $name); $i++; } for ($i = $i % 4; $i < 4; $i++) { $typecbs[$row][] = array('name' => ''); } $callurl = PC_URL::get_mod_url('filepart'); $callurl->set('id', '__ID__'); $callurl->set('type', 'error'); $tpl->add_variables(array('errors' => $errs, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('error_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'error_search', 'file' => $file, 'msg' => $msg, 'typecbs' => $typecbs, 'get_code_url' => $callurl->to_url())); }
public function perform_action() { $input = FWS_Props::get()->input(); $pid = $input->get_var('project', 'post', FWS_Input::INTEGER); if ($pid < 0) { return 'Invalid project-id'; } PC_DAO::get_projects()->set_current($pid); $this->set_action_performed(true); $this->set_show_status_page(false); $this->set_redirect(false); return ''; }
/** * @see FWS_Module::run() */ public function run() { $input = FWS_Props::get()->input(); $db = FWS_Props::get()->db(); $versions = FWS_Props::get()->versions(); $functions = FWS_Props::get()->functions(); $user = FWS_Props::get()->user(); $tpl = FWS_Props::get()->tpl(); $id = $input->get_predef(TDL_URL_ID, 'get'); if ($id == null) { $this->report_error(); return; } $data = $db->get_row('SELECT e.*,c.category_name FROM ' . TDL_TB_ENTRIES . ' e LEFT JOIN ' . TDL_TB_CATEGORIES . ' c ON entry_category = c.id WHERE e.id = ' . $id); if ($data['id'] == '') { $this->report_error(); return; } $start_version = $versions->get_element($data['entry_start_version']); $fixed_date = '-'; $fixed_version = '-'; if ($data['entry_fixed_date'] > 0) { $fixed_date = FWS_Date::get_date($data['entry_fixed_date']); if ($data['entry_fixed_version'] > 0) { $version = $versions->get_element($data['entry_fixed_version']); } else { $version = $versions->get_element($data['entry_start_version']); } $fixed_version = $version['version_name']; } if ($data['entry_info_link'] != '') { $info_link = '<a class="tl_main" target="_blank" href="' . $data['entry_info_link'] . '">'; $info_link .= $data['entry_info_link'] . '</a>'; } else { $info_link = '-'; } if ($data['entry_description'] != '') { $desc = nl2br($data['entry_description']); } else { $desc = '-'; } $type_text = $functions->get_type_text($data['entry_type']); $type = '<img src="' . $user->get_theme_item_path('images/type/' . $data['entry_type'] . '.gif') . '" align="top"'; $type .= ' alt="' . $type_text . '" title="' . $type_text . '" /> ' . $type_text; $prio_text = $functions->get_priority_text($data['entry_priority']); $prio = '<img src="' . $user->get_theme_item_path('images/priority/' . $data['entry_priority'] . '.png') . '" align="top"'; $prio .= ' alt="' . $prio_text . '" title="' . $prio_text . '" /> ' . $prio_text; $tpl->add_variables(array('project_name' => $start_version['project_name'], 'category_name' => $data['category_name'], 'priority' => $prio, 'id' => $data['id'], 'type' => $type, 'status' => $functions->get_status_text($data['entry_status']), 'status_class' => 'tl_status_' . $data['entry_status'], 'title' => $data['entry_title'], 'start_date' => FWS_Date::get_date($data['entry_start_date']), 'start_version' => $start_version['version_name'], 'fixed_date' => $fixed_date, 'fixed_version' => $fixed_version, 'changed_date' => FWS_Date::get_date($data['entry_changed_date']), 'description' => $desc, 'info_link' => $info_link)); }
/** * Helper to get the project-id to use for the database * * @param int $pid the project-id you have * @return int the real project-id to use */ public static function get_project_id($pid) { $project = FWS_Props::get()->project(); if ($pid == PC_Project::PHPREF_ID) { return $pid; } if ($pid == PC_Project::CURRENT_ID) { if ($project === null) { return PC_Project::PHPREF_ID; } return $project->get_id(); } return $pid; }
/** * @see FWS_Module::run() */ public function run() { $db = FWS_Props::get()->db(); $tpl = FWS_Props::get()->tpl(); $num = $db->get_row_count(TDL_TB_PROJECTS, 'id', ''); $tpl->add_variables(array('num' => $num)); $projects = array(); $i = 0; foreach ($db->get_rows('SELECT * FROM ' . TDL_TB_PROJECTS . ' ORDER BY id DESC') as $data) { $projects[] = array('title' => $data['project_name'], 'shortcut' => $data['project_name_short'], 'start' => FWS_Date::get_date($data['project_start'], false), 'index' => $i++, 'id' => $data['id']); } $tpl->add_variable_ref('projects', $projects); $tpl->add_variables(array('index' => $i)); }
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 ''; }
public function run($args) { $project = FWS_Props::get()->project(); $options = new PC_Engine_Options(); $options->add_project($project->get_id()); foreach ($project->get_project_deps() as $pid) { $options->add_project($pid); } $types = new PC_Engine_TypeContainer($options); $storage = new PC_Engine_TypeStorage_DB(); $env = new PC_Engine_Env($options, $types, $storage); $types->prefetch(); $fin = new PC_Engine_TypeFinalizer($env); $fin->finalize(); }
/** * @see FWS_Module::run() */ public function run() { $input = FWS_Props::get()->input(); $doc = FWS_Props::get()->doc(); $id = $input->get_var('id', 'get', FWS_Input::INTEGER); $type = $input->correct_var('type', 'get', FWS_Input::STRING, array('call', 'var', 'func', 'const', 'error'), 'call'); if ($id === null) { $this->report_error(); return; } $loc = null; switch ($type) { case 'call': $loc = PC_DAO::get_calls()->get_by_id($id); break; case 'var': $loc = PC_DAO::get_vars()->get_by_id($id); break; case 'func': $loc = PC_DAO::get_functions()->get_by_id($id); break; case 'const': $loc = PC_DAO::get_constants()->get_by_id($id); break; case 'error': $loc = PC_DAO::get_errors()->get_by_id($id); if ($loc === null) { $this->report_error(); return; } $loc = $loc->get_loc(); break; } if (!is_file($loc->get_file())) { $this->report_error(); return; } $lines = explode("\n", file_get_contents($loc->get_file())); $start_line = max(1, $loc->get_line() - 4); $end_line = min(count($lines), $loc->get_line() + 2); $code = ''; for ($i = $start_line; $i <= $end_line; $i++) { $code .= $lines[$i - 1] . "\n"; } $code = PC_Utils::highlight_string($code, $start_line, $loc->get_line(), false); $renderer = $doc->use_raw_renderer(); $renderer->set_content($code); }
public function run($args) { $project = FWS_Props::get()->project(); $options = new PC_Engine_Options(); $options->set_report_unused(true); $options->set_report_argret_strictly($project->get_report_argret_strictly()); $options->add_project($project->get_id()); foreach ($project->get_project_deps() as $pid) { $options->add_project($pid); } foreach ($project->get_req() as $r) { if ($r['type'] == 'min') { $options->add_min_req($r['name'], $r['version']); } else { $options->add_max_req($r['name'], $r['version']); } } $env = new PC_Engine_Env($options); $ascanner = new PC_Engine_StmtScannerFrontend($env); $msgs = array(); foreach ($args as $file) { try { $ascanner->scan_file($file); } catch (PC_Engine_Exception $e) { $msgs[] = $e->__toString(); } } if (count($env->get_types()->get_calls())) { PC_DAO::get_calls()->create_bulk($env->get_types()->get_calls()); } foreach ($env->get_errors()->get() as $err) { PC_DAO::get_errors()->create($err); } foreach ($ascanner->get_vars() as $vars) { foreach ($vars as $var) { PC_DAO::get_vars()->create($var); } } // write messages to shared data $mutex = new FWS_MutexFile(PC_CLI_MUTEX_FILE); $mutex->aquire(); $data = unserialize($mutex->read()); /* @var $data PC_JobData */ $data->add_errors($msgs); $mutex->write(serialize($data)); $mutex->close(); }
/** * @see FWS_Module::run() */ public function run() { $user = FWS_Props::get()->user(); $jobm = new FWS_Job_Manager(); $jobm->set_parallel_count(PC_PARALLEL_JOB_COUNT); $jobm->set_poll_interval(PC_JOB_CTRL_POLL_INTERVAL); $jobm->add_listener($this); foreach ($user->get_session_data('job_commands', array()) as $cmd) { $jobm->add_job(new FWS_Job_Data($cmd)); } if (($fin = $user->get_session_data('job_finalizer', '')) != '') { $jobm->set_finalizer(new FWS_Job_Data($fin)); } $jobm->start(); $user->delete_session_data('job_commands'); $user->delete_session_data('job_finalizer'); }
/** * @see FWS_Module::run() */ public function run() { $tpl = FWS_Props::get()->tpl(); $input = FWS_Props::get()->input(); $line = $input->get_var('line', 'get', FWS_Input::INTEGER); if (!isset($_GET['path'])) { $this->report_error(); return; } $path = urldecode($_GET['path']); if (PC_DAO::get_classes()->get_count_for_file($path) == 0 && PC_DAO::get_calls()->get_count_for($path) == 0) { $this->report_error(); return; } $source = PC_Utils::highlight_file($path, $line); $tpl->add_variables(array('source' => $source)); }
public function perform_action() { $input = FWS_Props::get()->input(); $db = FWS_Props::get()->db(); $cats = FWS_Props::get()->cats(); $versions = FWS_Props::get()->versions(); $locale = FWS_Props::get()->locale(); $pid = $input->get_predef(TDL_URL_ID, 'get'); if ($pid == null) { return TDL_GENERAL_ERROR; } $project_name = $input->get_var('project_name', 'post', FWS_Input::STRING); $project_name_short = $input->get_var('project_name_short', '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); $project = new TDL_Objects_Project(TDL_TB_PROJECTS); $project->set_id($pid); $project->set_project_name($project_name); $project->set_project_name_short($project_name_short); $project->set_project_start($start); if (!$project->check('update')) { return $project->errors(); } $project->update(); $nversions = $input->get_var('version', 'post'); if (is_array($nversions)) { foreach ($nversions as $id => $version_name) { $db->execute('UPDATE ' . TDL_TB_VERSIONS . " SET version_name = '" . $version_name . "' WHERE id = " . $id); $versions->set_element_field($id, 'version_name', $version_name); } } $categories = $input->get_var('category', 'post'); if (is_array($categories)) { foreach ($categories as $id => $category_name) { $db->execute('UPDATE ' . TDL_TB_CATEGORIES . " SET category_name = '" . $category_name . "' WHERE id = " . $id); $cats->set_element_field($id, 'category_name', $category_name); } } $this->set_success_msg($locale->_('The project has been edited successfully')); $this->set_redirect(true, TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $pid)); $this->set_show_status_page(false); $this->set_action_performed(true); return ''; }
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() { $input = FWS_Props::get()->input(); $db = FWS_Props::get()->db(); $cats = FWS_Props::get()->cats(); $locale = FWS_Props::get()->locale(); $id = $input->get_predef(TDL_URL_SID, 'get'); if ($id == null) { return TDL_GENERAL_ERROR; } $db->execute('DELETE FROM ' . TDL_TB_CATEGORIES . ' WHERE id = ' . $id); $db->execute('UPDATE ' . TDL_TB_ENTRIES . ' SET entry_category = 0 WHERE entry_category = ' . $id); $cats->remove_element($id); $pid = $input->get_predef(TDL_URL_ID, 'get'); $this->set_success_msg($locale->_('The category has been deleted')); $this->set_redirect(true, TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $pid)); $this->set_show_status_page(false); $this->set_action_performed(true); return ''; }
/** * @see FWS_Module::run() */ public function run() { $doc = FWS_Props::get()->doc(); $renderer = $doc->use_raw_renderer(); // read from file $mutex = new FWS_MutexFile(PC_CLI_MUTEX_FILE); $mutex->aquire(); $data = unserialize($mutex->read()); $mutex->close(); /* @var $data PC_JobData */ $res = $data->get_done() . ';'; if (count($data->get_errors())) { $res .= '<div style="text-align: left; padding-left: 3em;"><ul>'; foreach ($data->get_errors() as $err) { $res .= '<li>' . $err . '</li>'; } $res .= '</ul></div>'; } $renderer->set_content($res); }