/** * @param APPLICATION $context */ public function __construct($context) { parent::__construct($context); $cmd = $this->make_command(); $cmd->id = 'create'; $cmd->caption = 'New user'; $cmd->link = "create_user.php"; $cmd->icon = '{icons}buttons/create'; $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_create); $cmd->importance = Command_importance_high + Command_importance_increment; $this->append($cmd); $link_url = new URL($this->env->url(Url_part_no_host_path)); $link_url->replace_argument('show_anon', ''); $cmd = $this->make_command(); $cmd->id = 'show_registered'; $cmd->caption = 'Show registered users'; $cmd->link = $link_url->as_text(); $cmd->icon = '{icons}buttons/login'; $cmd->executable = read_var('show_anon'); $cmd->importance = Command_importance_high; $this->append($cmd); $link_url->replace_argument('show_anon', 1); $cmd = $this->make_command(); $cmd->id = 'show_anonymous'; $cmd->caption = 'Show anonymous users'; $cmd->link = $link_url->as_text(); $cmd->icon = '{icons}buttons/anonymous'; $cmd->executable = !read_var('show_anon'); $cmd->importance = Command_importance_high; $this->append($cmd); }
/** * Initialize the form's fields with default values and visibilities. */ public function load_with_defaults() { parent::load_with_defaults(); $icon_url = read_var('icon_url'); if ($icon_url) { $this->set_value('icon_url', $icon_url); } }
/** * Initialize the form's fields with default values and visibilities. */ public function load_with_defaults() { parent::load_with_defaults(); $this->set_value('state', Planned); $branch_id = read_var('id'); if (empty($branch_id)) { if (!empty($this->_branches)) { $this->set_value('branch_id', $this->_branches[0]->id); } } else { $this->set_value('branch_id', $branch_id); } }
/** * Initialize the form's fields with default values and visibilities. */ public function load_with_defaults() { parent::load_with_defaults(); $job_id = read_var('job_id'); if (empty($job_id)) { $this->load_from_client('job_id', 0); $job_id = $this->value_for('job_id'); } $job = $this->job_at($job_id); if (isset($job)) { $this->set_value('job_id', $job_id); $this->add_preview($job, 'Attached to job: ' . $job->title_as_html(), !$this->previewing()); } else { $this->set_value('job_id', 0); } }
/** * Initialize the form's fields with default values and visibilities. */ public function load_with_defaults() { parent::load_with_defaults(); $this->set_value('state', Visible); $branch_id = read_var('branch_id', 0); if ($branch_id > 0) { /** @var PROJECT_APPLICATION $project_application */ $project_application = $this->app; $branch = $project_application->branch_at_id($branch_id); if (isset($branch)) { $release = $branch->latest_release(); if (isset($release)) { $this->set_value('parent_release_id', $release->id); } } } }
public function load_from_object($obj) { parent::load_from_object($obj); $this->load_with_defaults(); $this->set_value('send_to', $this->context->mail_options->webmaster_address); $this->set_value('include_browser_info', true); $this->set_value('include_page_data', true); $class_name = read_var('class_name'); $routine_name = read_var('routine_name'); if ($routine_name) { if ($class_name) { $this->set_value('subject', "Exception in method [{$class_name}.{$routine_name}]"); } else { $this->set_value('subject', "Exception in function [{$routine_name}]"); } } else { $this->set_value('subject', 'Exception at global scope'); } }
/** * Modify the query to navigate. * @param QUERY $query * @access private */ protected function _adjust_query($query) { $calendar = read_var('calendar'); $first_day = read_var('first_day'); $last_day = read_var('last_day'); $folder = $this->_entry->parent_folder(); if ($calendar) { $this->page->location->append("Calendar", "view_calendar.php?id={$folder->id}"); } if ($first_day) { $day = $this->app->make_date_time($first_day, Date_time_iso); $url = new URL($this->env->url(Url_part_no_host_path)); $url->replace_argument('id', $folder->id); $url->replace_name_and_extension('view_journals.php'); $this->page->location->append($folder->format_date($day), $url->as_text()); $query->set_days($first_day, $last_day); } $query->set_order('date ASC'); parent::_adjust_query($query); }
/** * Modify the query to navigate. * @param QUERY $query * @access private */ protected function _adjust_query($query) { parent::_adjust_query($query); $journal_id = read_var('journal'); $first_day = read_var('first_day'); $last_day = read_var('last_day'); if ($journal_id) { /** @var ALBUM $folder */ $folder = $this->_entry->parent_folder(); $journal_query = $folder->entry_query(); /** @var JOURNAL $journal */ $journal = $journal_query->object_at_id($journal_id); if (isset($journal)) { $journal->adjust_query($query); } } if (!$journal_id && $first_day) { $query->set_days($first_day, $last_day); } $query->order_by_day('ASC'); }
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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $theme_query = $App->theme_query(); /** @var $theme THEME */ $theme = $theme_query->object_at_id(read_var('id')); if (isset($theme) && $App->login->is_allowed(Privilege_set_global, Privilege_resources)) { $class_name = $App->final_class_name('DELETE_FORM', 'webcore/forms/delete_form.php'); /** @var $form DELETE_FORM */ $form = new $class_name($App); $form->process_existing($theme); if ($form->committed()) { $Env->redirect_local("view_themes.php"); } $Page->location->add_root_link(); $Page->location->append('Themes', 'view_themes.php'); $Page->title->add_object($theme); $Page->title->subject = 'Delete theme'; $Page->location->add_object_link($theme); $Page->location->append($Page->title->subject, '', '{icons}buttons/delete'); $Page->start_display();
public function load_from_request() { $this->upload_max_filesize = text_to_file_size(ini_get('upload_max_filesize')); $this->post_max_size = text_to_file_size(ini_get('post_max_size')); $this->ini_max_file_size = min($this->upload_max_filesize, $this->post_max_size); $this->max_file_size = $this->ini_max_file_size; $this->form_max_file_size = read_var(Form_max_file_size_field_name, 0); if ($this->form_max_file_size && $this->form_max_file_size < $this->max_file_size) { $this->max_file_size = $this->form_max_file_size; } $this->_file_sets = array(); $this->total_files = 0; foreach ($_FILES as $file_set_id => $file_info) { $file_set = new UPLOADED_FILE_SET($this, $file_set_id); if ($file_set->size()) { $this->total_files += $file_set->size(); $this->file_sets[$file_set_id] = $file_set; } } /* In order to smoothly support uploading with form validation, we allow a form to process a previously uploaded file and store its properties in the form. The uploader reads those values and 'pretends' that this is a valid PHP upload file. This way, form validation can occur over multiple submissions but a successfully uploaded file need only be uploaded once. */ $uploads = read_var($this->stored_info_name); if (is_array($uploads)) { for ($idx = sizeof($uploads) - 1; $idx >= 0; $idx--) { $upload = $uploads[$idx]; $file = new UPLOADED_FILE($this, '', 0, '', '', 0); $file_set_id = $file->load_from_text($upload); if (isset($this->file_sets[$file_set_id])) { $file_set = $this->file_sets[$file_set_id]; } else { $file_set = new UPLOADED_FILE_SET($this, $file_set_id); $this->file_sets[$file_set_id] = $file_set; } array_unshift($file_set->files, $file); } } }
} else { $indexed_kinds = $App->entry_kinds(); foreach ($indexed_kinds as $kind) { $kinds[strtolower($kind->title)] = $kind; } $App->impersonate($App->mail_options->publisher_user_name, $App->mail_options->publisher_user_password); $folder_query = $App->login->folder_query(); $folders = $folder_query->indexed_objects(); $App->display_options->show_local_times = false; while ($data = fread($fhandle, 4096)) { if (!xml_parse($xml_parser, $data, feof($fhandle))) { raise(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); $commit = !read_var('testing'); if (isset($errors_occurred)) { log_message("[{$errors_occurred}] errors detected. Objects not imported.", Msg_type_warning, Msg_channel_xml); } else { if ($commit) { $action = 'Imported'; } else { $action = 'Found'; } $count = sizeof($objs); log_message("[{$count}] changes found. Importing...", Msg_type_info, Msg_channel_xml); $index = 0; while ($index < $count) { $obj = $objs[$index]; $folder = $obj->parent_folder(); $creator = $obj->creator();
****************************************************************************/ $id = read_var('id'); $folder_query = $App->login->folder_query(); $folder = $folder_query->folder_for_entry_at_id($id); if (isset($folder)) { $entry_query = $folder->entry_query(); /* Set this global value to optimize the query for accessing the particular type of entry. */ if (isset($entry_type_id)) { $entry_query->set_type($entry_type_id); } $entry = $entry_query->object_at_id($id); } if (isset($entry) && $App->login->is_allowed(Privilege_set_entry, Privilege_view, $entry)) { $App->set_referer(); $App->set_search_text(read_var('search_text')); $entry_info = $entry->type_info(); $location_renderer = $entry->handler_for(Handler_location); $location_renderer->add_to_page_as_link($Page, $entry); $Page->location->append('Plain text', '', '{icons}indicators/text'); $Page->add_style_sheet($Env->logger_style_sheet); $navigator = $entry->handler_for(Handler_navigator); $navigator->set_query($entry_query); $navigator->set_selected($id); $Page->start_display(); ?> <div class="main-box"> <pre class="log-box"> <?php /** @var ENTRY_RENDERER $renderer */ $renderer = $entry->handler_for(Handler_text_renderer);
earthli WebCore 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. earthli WebCore 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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $folder_query = $App->login->folder_query(); $folder = $folder_query->object_at_id(read_var('id')); if (isset($folder) && $App->login->is_allowed(Privilege_set_folder, Privilege_view_history, $folder)) { $Page->title->add_object($folder); $Page->location->add_folder_link($folder); $history_item_query = $folder->history_item_query(); $obj = $folder; include_once 'webcore/pages/view_history.php'; } else { $Page->raise_security_violation('You are not allowed to view this folder\'s history.'); }
/** * Initialize the form's fields with default values and visibilities. */ public function load_with_defaults() { parent::load_with_defaults(); $this->load_from_client('thumbnail_size', 200); $this->load_from_client('overwrite', true); $this->load_from_client('create_thumbnail', true); $this->set_value('type', read_var('type')); }
earthli WebCore 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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $id = read_var('id'); $folder_query = $App->login->folder_query(); $folder = $folder_query->folder_for_comment_at_id($id); if (isset($folder)) { $entry_query = $folder->entry_query(); $entry = $entry_query->object_for_comment_at_id($id); if (isset($entry)) { $com_query = $entry->comment_query(); $comment = $com_query->object_at_id($id); } } if (isset($comment) && $App->login->is_allowed(Privilege_set_comment, Privilege_view_history, $comment)) { $Page->title->add_object($folder); $Page->title->add_object($entry); $Page->title->add_object($comment); $Page->location->add_folder_link($folder);
/**************************************************************************** Copyright (c) 2002-2014 Marco Von Ballmoos This file is part of earthli WebCore. earthli WebCore 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. earthli WebCore 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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $text = read_var('text', '<span class="error">There is no text to preview.</span>'); $Page->start_display(); $munger = $App->html_munger(); echo $munger->transform($text); $Page->finish_display();
/** * Load the initial time frame. * Uses the default if there is no time frame in the page request. * @param string $default * @access private */ public function load_period_from_request($default) { $this->period = read_var('time_frame', $default); }
/** * Return the url for this formatter. * This will check application options to determine whether to render as a fully-qualified URL. * It will also resolve the query arguments. * @return string * @access private */ protected function _page() { /* Add in the currently active panel. */ $old_location = $this->location; $panel_id = read_var('panel'); if ($panel_id) { $this->add_argument('panel', $panel_id); } $Result = $this->context->resolve_file($this->location); $this->location = $old_location; return $Result; }
/** * Read the requested values and return a query string. * For example, if the url of the page is "index.php?b=1&c=2&d=3", then * <code>read_vars (array ('a', 'b', 'c'))</code> returns "b=1&c=2". Use this * function to gather page parameters for easy reposting. * @param string[] $indexes * @return string */ function read_vars($indexes) { $Result = array(); foreach ($indexes as $index) { $value = read_var($index); if ($value) { $Result[] = "{$index}={$value}"; } } return implode('&', $Result); }
/** * @param QUERY $com_query Show comments from this query. * @param ENTRY|COMMENT $obj Entry or comment on whose page to render comments. * @param string $default_mode Default mode for comment display (Can be 'Comment_render_flat' or 'Comment_render_threaded'). */ public function __construct($com_query, $obj, $default_mode = Comment_render_threaded) { parent::__construct($obj->app); $this->_comment_query = $com_query; $this->_obj = $obj; if (is_a($this->_obj, 'COMMENT')) { $this->_comment = $this->_obj; } $this->comment_mode = read_var('comment_mode', $default_mode); }
earthli WebCore 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. earthli WebCore 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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $name = read_var('name'); if ($name) { $user_query = $App->user_query(); $user = $user_query->object_at_name($name); } if (isset($user) && $App->login->is_allowed(Privilege_set_user, Privilege_view, $user)) { $class_name = $App->final_class_name('NEWSFEED_ENGINE', 'webcore/config/newsfeed_engine.php', 'user'); $newsfeed_engine = new $class_name($App); $newsfeed = $newsfeed_engine->make_renderer($user); $newsfeed->display($user->entry_query()); }
/** * @param FORM_RENDERER $renderer * @access private */ protected function _draw_controls($renderer) { $renderer->start(); $user_query = $this->app->user_query(); $group_query = $this->app->group_query(); /** @var GROUP $group */ $group = $group_query->object_at_id($this->value_for('id')); $group_user_query = $group->user_query(); $ids = $group_user_query->indexed_objects(); if (sizeof($ids)) { $user_query->restrict_by_op('usr.id', array_keys($ids), Operator_not_in); } if (read_var('show_anon')) { $user_query->set_kind(Privilege_kind_anonymous); } else { $user_query->set_kind(Privilege_kind_registered); } /** @var USER[] $items */ $items = $user_query->objects(); $renderer->draw_text_line_with_named_object_chooser_row('name', $items); $buttons[] = $renderer->submit_button_as_HTML(); $renderer->draw_buttons_in_row($buttons); $renderer->finish(); }
} } $tinst = read_var('c_type_instance', $vars, ''); $graph_identifier = $host . '/' . $plugin . (strlen($pinst) ? '-' . $pinst : '') . '/' . $type . (strlen($tinst) ? '-' . $tinst : '-*'); $timespan = read_var('timespan', $vars, $config['timespan'][0]['name']); $timespan_ok = false; foreach ($config['timespan'] as &$ts) { if ($ts['name'] == $timespan) { $timespan_ok = true; } } if (!$timespan_ok) { return error400($graph_identifier, "Unknown timespan requested"); } $logscale = (bool) read_var('logarithmic', $vars, false); $tinylegend = (bool) read_var('tinylegend', $vars, false); // Check that at least 1 RRD exists for the specified request $all_tinst = collectd_list_tinsts($host, $plugin, $pinst, $type); if (count($all_tinst) == 0) { return error404($graph_identifier, "No rrd file found for graphing"); } // Now that we are read, do the bulk work load_graph_definitions($logscale, $tinylegend); $pinst = strlen($pinst) == 0 ? null : $pinst; $tinst = strlen($tinst) == 0 ? null : $tinst; $opts = array(); $opts['timespan'] = $timespan; if ($logscale) { $opts['logarithmic'] = 1; } if ($tinylegend) {
earthli WebCore 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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $search_type = read_var('type'); $search = $App->make_search($search_type); $class_name = $App->final_class_name('STORE_SEARCH_FORM', 'webcore/forms/store_search_form.php'); /** @var STORE_SEARCH_FORM $form */ $form = new $class_name($App, $search->fields); $form->process_new($search); if ($form->committed()) { $Env->redirect_local($search->home_page()); } $Page->title->subject = "Create {$search_type} search"; $Page->location->add_root_link(); $Page->location->append('Searches', 'view_searches.php'); $Page->location->append($Page->title->subject, '', '{icons}buttons/create'); $Page->start_display(); ?> <div class="main-box">
/** * Create the set of panels to use. * @access private */ protected function _add_panels() { $this->_add_folder_panels_for($this->_folders); $this->_add_entry_panels_for($this->login->all_entry_query()); $this->_add_comment_panel_for($this->login->all_comment_query()); $class_name = $this->app->final_class_name('GROUP_PANEL'); $group_query = $this->app->group_query(); $panel = new $class_name($this, $group_query); $this->add_panel($panel); $class_name = $this->app->final_class_name('USER_PANEL'); $user_query = $this->app->user_query(); $show_anon = read_var('show_anon'); if ($show_anon) { $user_query->set_kind(Privilege_kind_anonymous); } else { $user_query->set_kind(Privilege_kind_registered); } $panel = new $class_name($this, $user_query); $this->add_panel($panel); $class_name = $this->app->final_class_name('THEME_PANEL'); $theme_query = $this->app->theme_query(); $panel = new $class_name($this, $theme_query); $this->add_panel($panel); $class_name = $this->app->final_class_name('ICON_PANEL'); $icon_query = $this->app->icon_query(); $panel = new $class_name($this, $icon_query); $this->add_panel($panel); }
$Env->redirect_root($last_page); } else { if ($form->submitted()) { $Page->title->subject = 'Login Failed'; } } $Page->location->add_root_link(); $Page->location->append('Access denied', '', '{icons}buttons/security'); $Page->start_display(); ?> <div class="main-box"> <?php if (empty($last_page)) { $last_page = 'unknown location'; } $error_message = read_var('error_message'); if (empty($error_message)) { $error_message = 'You are not allowed to perform that operation.'; } ?> <div class="message-box"> <p class="title"><?php echo $error_message; ?> </p> <div class="description"> <p>Access to <<a href="<?php echo $last_page; ?> "><?php echo $last_page;
/** * Load values from the HTTP request. */ public function load_from_request() { $this->preferred_text_length = read_var('preferred_text_length', $this->preferred_text_length); $this->show_users = read_var('show_users', $this->show_users); $this->show_as_summary = read_var('show_as_summary', $this->show_as_summary); $this->right_margin = read_var('right_margin', $this->right_margin); }
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 earthli WebCore; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information about the earthli WebCore, visit: http://www.earthli.com/software/webcore ****************************************************************************/ $group_query = $App->group_query(); /** @var $group GROUP */ $group = $group_query->object_at_id(read_var('id')); if (isset($group)) { $App->set_referer(); $Page->title->add_object($group); $Page->location->add_root_link(); $Page->location->append('Groups', 'view_groups.php'); $Page->location->add_object_text($group); $Page->start_display(); ?> <div class="top-box"> <div class="button-content"> <?php /** @var $renderer MENU_RENDERER */ $renderer = $group->handler_for(Handler_menu); $renderer->display($group->handler_for(Handler_commands)); ?>
/** * @param FORM_RENDERER $renderer * @param PERMISSIONS_FORMATTER $formatter * @access private * @abstract */ protected function _draw_permission_controls($renderer, $formatter) { $user_query = $this->app->user_query(); /* get the list of user ids that are already mapped in this folder. */ $folder_query = $this->app->login->folder_query(); /** @var FOLDER $folder */ $folder = $folder_query->object_at_id($this->value_for('id')); $security = $folder->security_definition(); $permissions = $security->user_permissions(); $ids = array(); foreach ($permissions as $permission) { $ids[] = $permission->ref_id; } if (sizeof($ids)) { $user_query->restrict_by_op('usr.id', $ids, Operator_not_in); } if (read_var('show_anon')) { $user_query->set_kind(Privilege_kind_anonymous); } else { $user_query->set_kind(Privilege_kind_registered); } /** @var USER[] $users */ $users = $user_query->objects(); $renderer->draw_text_line_with_named_object_chooser_row('title', $users); parent::_draw_permission_controls($renderer, $formatter); }
/** * Load signature from the page request. * Loads the signature on a page that displays an exception that occurred elsewhere. The request url * should have been created with {@link as_query_string()} or in a form that included the values returned * from {@link as_array()}. */ public function load_from_request() { $this->page_name = $this->_decode_value(read_var('page_name')); $this->application_description = $this->_decode_value(read_var('application_description')); $this->class_name = $this->_decode_value(read_var('class_name')); $this->dynamic_class_name = $this->_decode_value(read_var('dynamic_class_name')); $this->routine_name = $this->_decode_value(read_var('routine_name')); $this->message = $this->_decode_value(read_var('error_message')); $this->_add_vars_for(Var_type_post); $this->_add_vars_for(Var_type_get); $this->_add_vars_for(Var_type_cookie); $this->_add_vars_for(Var_type_upload); }