Пример #1
0
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

****************************************************************************/
$page_name = read_array_index($_GET, 'page_name');
$file_name = url_to_file_name($page_name);
define('Start_of_template', 'webcore/pages');
define('End_of_template', '.php');
function draw_source($source_text)
{
    echo "<div class=\"log-box\">{$source_text}</div>\n";
}
$Page->title->subject = 'View source';
$Page->template_options->title = 'Source';
$Page->template_options->icon = '{icons}buttons/source';
$Page->location->add_root_link();
$Page->location->append('View source');
$Page->add_style_sheet($Env->logger_style_sheet);
$Page->start_display();
?>
 /**
  * Load supported file type information.
  * @access private
  * @abstract
  */
 protected function _load()
 {
     $file_name = $this->context->config_file_name('file_types.ini');
     if ($file_name) {
         $config = parse_ini_file($file_name, true);
         $this->_extensions = read_array_index($config, 'extensions');
         $this->_mime_types = read_array_index($config, 'mime_types');
         $general = read_array_index($config, 'general');
         $this->_default_icon_url = read_array_index($general, 'default');
     }
 }
Пример #3
0
 /**
  * Add an attribute using an array value.
  * The value in the array associated with the 'name' key is used here.
  * @param string $name
  * @param array $values
  */
 public function add_array_attribute($name, $array, $default_value = '')
 {
     $this->add_attribute($name, read_array_index($array, $name, $default_value));
 }
Пример #4
0
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

****************************************************************************/
$last_page = read_array_index($_GET, 'last_page');
$id = read_array_index($_GET, 'id');
$status = read_array_index($_GET, 'status');
$branch_id = read_array_index($_GET, 'branch_id');
if ($last_page && $id && $status && $branch_id) {
    $entry_query = $App->login->all_entry_query();
    $entry_query->set_type('job');
    $job = $entry_query->object_at_id($id);
    $action = $job->new_history_item();
    $action->compare_branches = true;
    $branch_infos = $job->stored_branch_infos();
    $main_branch_info = $job->main_branch_info();
    foreach ($branch_infos as $branch_info) {
        if ($branch_info->branch_id == $branch_id) {
            $branch_info->set_status($status);
        }
        if ($main_branch_info->branch_id == $branch_info->branch_id) {
            $job->set_main_branch_info($branch_info);
        }
Пример #5
0
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 Albums; 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 Albums, visit:

http://www.earthli.com/software/webcore/albums

 ****************************************************************************/
require_once 'albums/start.php';
$id = read_var('id');
$last_page = read_array_index($_GET, 'last_page');
if ($id) {
    $query = $App->login->all_entry_query();
    /** @var $obj ENTRY */
    $obj = $query->object_at_id($id);
}
if ($id && $last_page && $obj) {
    /** @var ALBUM $folder */
    $folder = $obj->parent_folder();
    $Page->location->add_folder_link($folder);
    $Page->location->add_object_link($obj);
    $history_item = $folder->new_history_item();
    $folder->main_picture_id = $id;
    $folder->store_if_different($history_item);
    $Env->redirect_root($last_page);
} else {
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

****************************************************************************/
$last_page = read_array_index($_GET, 'last_page');
if ($last_page) {
    $theme_name = read_array_index($_GET, 'main_CSS_file_name', null);
    $theme_font_name = read_array_index($_GET, 'font_name_CSS_file_name', null);
    $theme_font_size = read_array_index($_GET, 'font_size_CSS_file_name', null);
    $theme_dont_apply_to_forms = read_array_index($_GET, 'dont_apply_to_forms', null);
    if (isset($theme_name)) {
        $Page->set_theme_main($theme_name);
    }
    if (isset($theme_font_name)) {
        $Page->set_theme_font_name($theme_font_name);
    }
    if (isset($theme_font_size)) {
        $Page->set_theme_font_size($theme_font_size);
    }
    if (isset($theme_dont_apply_to_forms)) {
        $Page->set_theme_dont_apply_to_forms($theme_dont_apply_to_forms);
    }
    $Env->redirect_root($last_page);
} else {
    $Page->start_display();
Пример #7
0
 /**
  * Read the quote style from a token.
  * @param boolean $value
  * @param MUNGER_TOKEN $token Token that caused the activation.
  * @return string
  * @access private
  */
 protected function _quote_style_from_token($value, $token)
 {
     $Result = '';
     if ($value) {
         $attributes = $token->attributes();
         $Result = read_array_index($attributes, 'quote-style');
         if (!$Result) {
             // Support the legacy attribute form, so that older articles still format as expected
             $Result = read_array_index($attributes, 'quote_style');
             if (!$Result) {
                 $Result = $this->default_quote_style;
             }
         }
     }
     return $Result;
 }
Пример #8
0
 /**
  * @param UPLOADER $uploader Attached to this uploader.
  * @param string $field_name Name of the field for which this set was submitted.
  */
 public function __construct($uploader, $field_name)
 {
     $this->_uploader = $uploader;
     if (isset($_FILES[$field_name])) {
         $file_info = $_FILES[$field_name];
         if (is_array($file_info[Uploaded_file_name])) {
             foreach ($file_info[Uploaded_file_name] as $idx => $name) {
                 if (isset($file_info[Uploaded_file_error][$idx])) {
                     $error = $file_info[Uploaded_file_error][$idx];
                 } else {
                     $error = Uploaded_file_error_none;
                 }
                 $this->_process_file($file_info[Uploaded_file_name][$idx], $file_info[Uploaded_file_size][$idx], $file_info[Uploaded_file_type][$idx], $file_info[Uploaded_file_temp_name][$idx], $error);
             }
         } else {
             $error = read_array_index($file_info, Uploaded_file_error, Uploaded_file_error_none);
             $this->_process_file($file_info[Uploaded_file_name], $file_info[Uploaded_file_size], $file_info[Uploaded_file_type], $file_info[Uploaded_file_temp_name], $error);
         }
     }
 }
Пример #9
0
 /**
  * Read a single value from the EXIF data block.
  * @param string $section EXIF section to read.
  * @param string $name EXIF property to read.
  * @return string
  * @access private
  */
 protected function _read_exif_value($section, $name)
 {
     return read_array_index(read_array_index($this->exif, $section), $name);
 }
Пример #10
0
 /**
  * @access private
  */
 protected function _execute()
 {
     $input_path = $this->env->source_path();
     $input_path->append('wizards/new_application');
     $config = parse_ini_file($input_path->appended_as_text('config.ini'), true);
     $paths = read_array_index($config, 'recurse_paths');
     $exts = read_array_index($config, 'extensions');
     $files = array();
     foreach ($paths as $path) {
         $files = array_merge($files, file_list_for($input_path->appended_as_text($path), $path, true));
     }
     $output_path = $this->env->source_path();
     $output_path->append('wizards/output/' . $this->app_folder);
     foreach ($files as $file_name) {
         $in = $input_path;
         $in->append($file_name);
         $ext = $in->extension();
         $out = $output_path;
         $out->append($this->_apply_templates($file_name));
         if (in_array($ext, $exts)) {
             $this->_log('Read [' . $in->as_text() . ']');
             $text = file_get_contents($in->as_text());
             $text = $this->_apply_templates($text);
             $out->write_text_file($text);
             $this->_log('Wrote [' . $out->as_text() . ']', Msg_type_info);
         } else {
             $out->ensure_path_exists();
             copy($in->as_text(), $out->as_text());
             $this->_log('Copied to [' . $out->as_text() . ']', Msg_type_info);
         }
     }
 }
Пример #11
0
 /**
  * Convert the given token to the output format.
  * @param HTML_MUNGER $munger The transformation context.
  * @param MUNGER_TOKEN $token
  * @return string
  */
 public function transform($munger, $token)
 {
     if ($token->is_start_tag()) {
         $attributes = $token->attributes();
         $this->_level = read_array_index($attributes, 'level');
         if (!is_numeric($this->_level)) {
             $this->_level = $this->default_level;
         }
         $builder = $munger->make_tag_builder("h{$this->_level}");
         $builder->add_array_attribute('class', $attributes);
         $builder->add_array_attribute('style', $attributes);
         return $builder->as_html();
     }
     return "</h{$this->_level}>";
 }
Пример #12
0
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

****************************************************************************/
/* Set these globals before using this template:

       $state: integer
  */
$last_page = read_array_index($_GET, 'last_page');
$id = read_array_index($_GET, 'id');
if ($last_page && $id) {
    $entry_query = $App->login->all_entry_query();
    $entry = $entry_query->object_at_id($id);
}
if (isset($entry)) {
    $entry->set_state($state, true);
    $Env->redirect_root($last_page);
} else {
    $Page->start_display();
    echo "<div class=\"error\">Could not set state.</div>";
    $Page->finish_display();
}
Пример #13
0
 /**
  * Is this node selected in this tree?
  * If so, most trees will render this node differently (perhaps highlighting
  * it and not making it a link).
  * @param object $node
  * @return boolean
  * @access private
  */
 public function selected($node)
 {
     if (isset($this->selected_nodes)) {
         return read_array_index($this->selected_nodes, $this->id($node));
     }
     return false;
 }
Пример #14
0
 /**
  * The actual ip address of the browser.
  * Will resolve the proxy forward, if one is present in the HTTP header.
  * @see domain()
  * @return string
  */
 public function ip_address()
 {
     $forwarded = read_array_index($_SERVER, 'HTTP_X_FORWARDED_FOR');
     $remote_addr = read_array_index($_SERVER, 'REMOTE_ADDR');
     if ($forwarded) {
         return $forwarded;
     } else {
         if ($remote_addr) {
             return $remote_addr;
         }
     }
     return read_array_index($_SERVER, 'REMOTE_HOST');
 }
Пример #15
0
 /**
  * Returns the requested parts of the current URL.
  * @param int $parts Can be any combination of {@link Url_part_host},
  * {@link Url_part_path}, {@link Url_part_name}, {@link Url_part_ext} and
  * {@link Url_part_args}.
  * @return string
  * @throws Exception
  */
 public function url($parts = Url_part_no_args)
 {
     if (!isset($this->_url)) {
         $this->_url = new URL(read_array_index($_SERVER, 'REQUEST_URI'));
         if ($this->_url->name() == '') {
             $this->_url->replace_name_and_extension('index.php');
         }
     }
     $url = clone $this->_url;
     switch ($parts) {
         case Url_part_all:
             return $this->host_name() . $url->as_text();
         case Url_part_path:
             return $url->path();
         case Url_part_file_name:
             return $url->name();
         case Url_part_ext:
             return $url->extension();
         case Url_part_no_host:
             return $url->as_text();
         case Url_part_no_host_args:
             $url->replace_query_string('');
             return $url->as_text();
         case Url_part_no_args:
             $url->replace_query_string('');
             return $this->host_name() . $url->as_text();
         case Url_part_no_host_path:
             return $url->name_with_query_string();
         default:
             throw new Exception('Unsupported combination of parts');
     }
 }
Пример #16
0
/**
 * Retrieves a request variable without triggering a PHP notice.
 * Guaranteed to return a value so that subsequent references will also not trigger PHP notices.
 *
 * If the actual value in the request is the empty string and the default value is not, then use
 * the default value. This makes the assumption that an explicitly empty value is the same as not
 * passing a value at all.
 * @version 3.6.0
 * @since 2.2.1
 * @param integer $index
 * @param string $default_value
 * @return string
 */
function read_var($index, $default_value = '')
{
    $Result = read_array_index($_REQUEST, $index, $default_value);
    if ($default_value !== '' && $Result === '') {
        $Result = $default_value;
    }
    return $Result;
}
 /**
  * Convert the given token to the output format.
  * @param MUNGER $munger The transformation context.
  * @param MUNGER_TOKEN $token
  * @return string
  */
 public function transform($munger, $token)
 {
     if ($token->is_start_tag()) {
         $attrs = $token->attributes();
         $this->_title = read_array_index($attrs, 'title');
         if ($this->_title) {
             $border = str_repeat('-', strlen($this->_title) + 4);
             return "{$border}\n| {$this->_title} |\n{$border}\n\n";
         }
     } else {
         if ($this->_title) {
             return "\n" . str_repeat('-', strlen($this->_title) + 4);
         }
     }
     return '';
 }
Пример #18
0
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

 ****************************************************************************/
$last_page = read_array_index($_GET, 'last_page');
$opt_name = read_array_index($_GET, 'opt_name');
$opt_value = read_array_index($_GET, 'opt_value');
$opt_page_context = read_array_index($_GET, 'opt_page_context');
$opt_duration = read_array_index($_GET, 'opt_duration');
if (isset($App) && !$opt_page_context) {
    $context = $App;
} else {
    $context = $Page;
}
if ($last_page && $opt_name) {
    if (is_numeric($opt_duration)) {
        $context->storage->expire_in_n_days($opt_duration);
    } else {
        $context->storage->expire_in_n_days($context->storage_options->setting_duration);
    }
    $context->storage->set_value($opt_name, $opt_value);
    $Env->redirect_root($last_page);
} else {
    $Page->start_display();
Пример #19
0
 /**
  * Load tests.
  * @access private
  * @abstract
  */
 protected function _load()
 {
     $file_name = $this->context->config_file_name('tests.ini');
     if ($file_name) {
         $config = parse_ini_file($file_name, true);
         $this->_tests = read_array_index($config, 'tests');
     }
 }