/**
  * @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);
 }
예제 #2
0
   /**
    * @param COMPONENT $obj
    * @access private
    */
   protected function _draw_box($obj)
   {
       $this->_display_start_minimal_commands_block($obj);
       ?>
 <h3>
   <?php 
       echo $this->app->get_icon_with_text($obj->icon_url, Twenty_px, $obj->title_as_link());
       ?>
 </h3>
 <?php 
       $menu = $this->context->make_menu();
       $entry_types = $this->app->entry_type_infos();
       $url = new URL($obj->home_page());
       foreach ($entry_types as $type_info) {
           $panel_name = strtolower($type_info->plural_title);
           $url->replace_argument('panel', $panel_name);
           $menu->append($type_info->plural_title, $url->as_html());
       }
       $url->replace_argument('panel', 'comments');
       $menu->append('Comments', $url->as_html());
       $menu->display();
       $this->_display_finish_minimal_commands_block();
   }
 /**
  * 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);
 }
예제 #4
0
    /**
     * @param USER $obj
     * @access private
     */
    protected function _draw_box($obj)
    {
        $this->_display_start_minimal_commands_block($obj);
        if ($obj->icon_url) {
            $this->context->start_icon_container($obj->icon_url, Thirty_two_px);
        }
        ?>
    <h3>
      <?php 
        echo $this->obj_link($obj);
        ?>
    </h3>
    <?php 
        if ($obj->icon_url) {
            $this->context->finish_icon_container();
        }
        ?>
    <p><?php 
        echo $obj->real_name();
        ?>
</p>
    <p>Registered on
      <?php 
        $c = $obj->time_created;
        $f = $c->formatter();
        $f->type = Date_time_format_short_date;
        echo $c->format($f);
        ?>
    </p>
    <?php 
        $menu = $this->context->make_menu();
        $entry_types = $this->app->entry_type_infos();
        $url = new URL($obj->home_page());
        foreach ($entry_types as $type_info) {
            $url->replace_argument('panel', $type_info->id);
            $menu->append($type_info->plural_title, $url->as_text());
        }
        $url->replace_argument('panel', 'comments');
        $menu->append('Comments', $url->as_text());
        $menu->display();
        ?>
    <div class="text-flow">
      <?php 
        $this->_echo_text_summary($obj);
        ?>
    </div>
    <?php 
        $this->_display_finish_minimal_commands_block();
    }
예제 #5
0
 /**
  * The URL needed to show this panel.
  * @return string
  * @access private
  */
 public function page_link()
 {
     $pm = $this->_panel_manager;
     $url = new URL($pm->page_link);
     $url->replace_argument('panel', $this->id);
     return $url->as_html();
 }
 /**
  * Render the time frame choices.
  */
 public function display()
 {
     $this->assert(!empty($this->page_link), 'Page name cannot be empty.', 'display', 'TIME_FRAME_SELECTOR');
     $menu = $this->context->make_menu();
     $menu->renderer->separator_class = $this->context->display_options->menu_class;
     $menu->renderer->content_mode = Menu_show_as_buttons;
     $menu->renderer->set_size(Menu_size_compact);
     $menu->renderer->options |= Menu_options_show_as_select;
     $url = new URL($this->page_link);
     $url->replace_argument('time_frame', Time_frame_recent);
     $menu->append('Recent', $url->as_text(), '', $this->period == Time_frame_recent);
     $url->replace_argument('time_frame', Time_frame_all);
     $menu->append('All', $url->as_text(), '', $this->period == Time_frame_all);
     $url->replace_argument('time_frame', Time_frame_today);
     $menu->append('Today', $url->as_text(), '', $this->period == Time_frame_today);
     $url->replace_argument('time_frame', Time_frame_last_week);
     $menu->append('Last Week', $url->as_text(), '', $this->period == Time_frame_last_week);
     $url->replace_argument('time_frame', Time_frame_last_month);
     $menu->append('Last Month', $url->as_text(), '', $this->period == Time_frame_last_month);
     $menu->display();
 }
 /**
  * @param APPLICATION $context
  */
 public function __construct($context)
 {
     parent::__construct($context);
     $show_all = read_var('show_all', 1);
     $cmd = $this->make_command();
     $cmd->id = 'show_releases';
     if ($show_all) {
         $cmd->caption = 'Show Unreleased';
         $cmd->icon = '{icons}indicators/question';
     } else {
         $cmd->caption = 'Show Released';
         $cmd->icon = '{app_icons}buttons/new_release';
     }
     $url = new URL($this->env->url(Url_part_no_host_path));
     $url->replace_argument('show_all', !$show_all);
     $cmd->link = $url->as_text();
     $cmd->executable = true;
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
 }
    public function display()
    {
        ?>
  <p>These are settings for <?php 
        echo $this->_subscriber->title_as_html();
        ?>
.</p>
  <ul>
    <?php 
        if (!$this->_subscriber->enabled()) {
            ?>
      <li>Messages are <span class="field">disabled</span>.</li>
    <?php 
        } else {
            ?>
    <li>Send messages <span class="field"><?php 
            switch ($this->_subscriber->min_hours_to_wait) {
                case Subscriptions_disabled:
                    echo 'immediately';
                    break;
                case 0:
                    echo 'immediately';
                    break;
                case 1:
                    echo 'once an hour';
                    break;
                case 12:
                    echo 'twice per day';
                    break;
                case 24:
                    echo 'once per day';
                    break;
                case 48:
                    echo 'every 2 days';
                    break;
                case 72:
                    echo 'every 3 days';
                    break;
                case 168:
                    echo 'once per week';
                    break;
                case 720:
                    echo 'once per month';
                    break;
                default:
                    echo 'every ' . $this->_subscriber->min_hours_to_wait . ' hours';
            }
            ?>
</span> in <span class="field">
    <?php 
            if ($this->_subscriber->send_as_html) {
                echo 'HTML';
            } else {
                echo 'Plain text';
            }
            ?>
</span> format.</li>
    <li>Send <span class="field"><?php 
            if (!$this->_subscriber->preferred_text_length) {
                echo 'all text';
            } else {
                echo 'a ' . $this->_subscriber->preferred_text_length . ' character excerpt';
            }
            ?>
</span> from each message.</li>
    <li>
    <?php 
            if ($this->_subscriber->max_individual_messages) {
                if ($this->_subscriber->max_items_per_message) {
                    ?>
      If there are more than
      <span class="field"><?php 
                    echo $this->_subscriber->max_individual_messages;
                    ?>
</span>
      messages, send them in groups of
      <span class="field"><?php 
                    echo $this->_subscriber->max_items_per_message;
                    ?>
</span>.
    <?php 
                } else {
                    ?>
      If there are more than
      <span class="field"><?php 
                    echo $this->_subscriber->max_individual_messages;
                    ?>
</span>
      messages, send them <span class="field">in one message</span>.
    <?php 
                }
            } else {
                ?>
      Send each message <span class="field">individually</span>.
    <?php 
            }
            ?>
</li>
    <li><span class="field"><?php 
            if ($this->_subscriber->send_own_changes) {
                echo 'Send';
            } else {
                echo 'Do not send';
            }
            ?>
</span> messages triggered by this subscriber.</li>
    <li><span class="field"><?php 
            if ($this->_subscriber->show_history_item_as_subject) {
                echo 'Include';
            } else {
                echo 'Do not include';
            }
            ?>
</span> history details in message subject.</li>
    <li>
    <?php 
            if ($this->_subscriber->show_history_items) {
                ?>
      <span class="field">Show</span> history details and
      <?php 
                if ($this->_subscriber->group_history_items) {
                    ?>
      <span class="field">group</span> them with their object.
      <?php 
                } else {
                    ?>
          <span class="field">repeat</span> object details for each.
      <?php 
                }
            } else {
                ?>
      <span class="field">Do not show</span> history details.
    <?php 
            }
            ?>
</li>
  </ul>
  <?php 
        }
        $url = new URL($this->env->url(Url_part_no_host_path));
        $url->replace_argument('panel', 'prefs');
        $renderer = $this->context->make_controls_renderer();
        $button = $renderer->button_as_html('Change...', $url->as_text(), '{icons}buttons/edit');
        echo '<table class="basic columns">';
        echo '<tr>';
        echo '<td>Settings</td>';
        echo '<td>' . $button . '</td>';
        echo '</tr>';
        $panels = $this->_panel_manager->ordered_panels(Panel_location);
        foreach ($panels as $panel) {
            if ($this->_is_summarizable($panel)) {
                $url->replace_argument('panel', $panel->id);
                $desc = 'Subscribed to <span class="field">' . $panel->num_objects() . '</span> ' . $panel->raw_title();
                $button = $renderer->button_as_html('Change...', $url->as_text(), '{icons}buttons/edit');
                echo '<tr>';
                echo '<td>' . $desc . '</td>';
                echo '<td>' . $button . '</td>';
                echo '</tr>';
            }
        }
        echo '</table>';
    }
예제 #9
0
 /**
  * Return a {@link URL} prepared for the given value.
  * @param string $value
  * @return URL
  * @access private
  */
 protected function _url_for_value($value)
 {
     $set_option_path = $this->context->resolve_file('{' . Folder_name_functions . '}set_option.php');
     $Result = new URL($set_option_path);
     $Result->add_argument('opt_name', $this->name);
     $Result->add_argument('opt_value', $value);
     $Result->add_argument('opt_page_context', $this->context->is_page);
     $last_page = urlencode($this->env->url(Url_part_all));
     if (isset($this->_args)) {
         $url = new URL($last_page);
         foreach ($this->_args as $key => $value) {
             $url->replace_argument($key, $value);
         }
         $last_page = $url->as_text();
     }
     $Result->add_argument('last_page', $last_page);
     return $Result;
 }
 /**
  * Render any parent objects to the title and location.
  * @param PAGE $page
  * @param RENDERABLE $obj
  * @access private
  */
 protected function _add_context($page, $obj)
 {
     parent::_add_context($page, $obj);
     $calendar = read_var('calendar');
     $journal = read_var('journal');
     $first_day = read_var('first_day');
     $folder = $obj->parent_folder();
     if ($calendar) {
         $this->page->location->append('Calendar', "view_calendar.php?id={$folder->id}");
     }
     if ($journal) {
         $journal_query = $folder->entry_query();
         $journal_entry = $journal_query->object_at_id($journal);
         if (isset($journal_entry)) {
             if ($calendar) {
                 $args = 'calendar=1';
             } else {
                 $args = '';
             }
             $this->page->location->add_object_link($journal_entry, $args);
         }
     }
     if (!$journal && $first_day) {
         $day = $this->app->make_date_time($first_day);
         $url = new URL($this->env->url(Url_part_no_host_path));
         $url->replace_argument('id', $folder->id);
         $url->replace_name_and_extension('view_pictures.php');
         $this->page->location->append($folder->format_date($day), $url->as_text());
     }
 }
     if (!isset($user)) {
         $Env->redirect_local("create_subscriber.php?email={$email}");
     } else {
         $subscriber = $user->subscriber();
         $subscriber->store();
     }
 }
 if (!isset($user) || $App->login->is_allowed(Privilege_set_global, Privilege_subscribe, $user)) {
     $Page->title->add_object($subscriber);
     $Page->location->add_root_link();
     if (isset($user)) {
         $Page->location->append('Users', 'view_users.php');
         $Page->location->add_object_link($user);
     } else {
         $url = new URL($Env->url(Url_part_no_host_path));
         $url->replace_argument('panel', 'summary');
         $Page->location->append($email, $url->as_text());
     }
     $Page->location->append($Page->title->subject, '', '{icons}buttons/subscriptions');
     $class_name = $App->final_class_name('SUBSCRIPTION_PANEL_MANAGER', 'webcore/gui/subscription_panel.php');
     /** @var $panel_manager PANEL_MANAGER */
     $panel_manager = new $class_name($subscriber);
     /** @var $selected_panel FORM_PANEL */
     $selected_panel = $panel_manager->selected_panel();
     $selected_panel->check();
     $Page->start_display();
     ?>
 <div class="main-box">
   <div class="columns text-flow">
     <div class="left-sidebar text-flow">
       <h2>
예제 #12
0
 public function make_commands($context)
 {
     $Result = new COMMANDS($context);
     if ($this->enabled && $this->file_name) {
         $url = new URL($this->page->resolve_file($this->file_name, Force_root_on));
         foreach ($this->formats as $format => $format_title) {
             foreach ($this->content_formats as $content => $content_texts) {
                 $content_title = $content_texts[0];
                 $content_description = $content_texts[1];
                 $url->replace_argument('format', $format);
                 $url->replace_argument('content', $content);
                 $cmd = $Result->make_command();
                 $cmd->id = $format . '_' . $content;
                 $cmd->caption = '<b>' . $content_title . '</b> (' . $format_title . ')';
                 if ($format == 'rss') {
                     $cmd->icon = '{icons}indicators/newsfeed_rss';
                 } else {
                     $cmd->icon = '{icons}indicators/newsfeed_atom';
                     $cmd->description = $content_description;
                 }
                 $cmd->link = $url->as_text();
                 $Result->append($cmd);
             }
         }
     }
     return $Result;
 }
예제 #13
0
 protected function _test_url_class()
 {
     $url_text = 'http://earthli.com/pages/page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/';
     $this->_log('original URL', Msg_type_info);
     $url = new URL($url_text);
     $this->_check_equal('http://earthli.com/pages/page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('page.php', $url->name());
     $this->_check_equal('php', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('page', $url->name_without_extension());
     $this->_check_equal('page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('replaced extension', Msg_type_info);
     $url->replace_extension('jpg');
     $this->_check_equal('http://earthli.com/pages/page.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('page.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('page', $url->name_without_extension());
     $this->_check_equal('page.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('appended to name', Msg_type_info);
     $url->append_to_name('_tn');
     $this->_check_equal('http://earthli.com/pages/page_tn.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('page_tn.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('page_tn', $url->name_without_extension());
     $this->_check_equal('page_tn.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('replaced name', Msg_type_info);
     $url->replace_name('picture');
     $this->_check_equal('http://earthli.com/pages/picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('picture', $url->name_without_extension());
     $this->_check_equal('picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('emptied name and extension', Msg_type_info);
     $url->replace_name_and_extension('');
     $this->_check_equal('http://earthli.com/pages/?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $url->replace_name_and_extension('picture.jpg');
     $this->_check_equal('http://earthli.com/pages/picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('picture', $url->name_without_extension());
     $this->_check_equal('picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('replaced name and extension', Msg_type_info);
     $url->replace_name_and_extension('picture_ex.png');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('added argument', Msg_type_info);
     $url->add_argument('arg4', 'new');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('replaced argument', Msg_type_info);
     $url->replace_argument('arg2', 'not_2');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('moved back a folder', Msg_type_info);
     $url->go_back(1);
     $this->_check_equal('http://earthli.com/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('appended folder', Msg_type_info);
     $url->append_folder('pages');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('removed the name', Msg_type_info);
     $url->strip_name();
     $this->_check_equal('http://earthli.com/pages/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_log('appended folders', Msg_type_info);
     $url->append('media/other/');
     $this->_check_equal('http://earthli.com/pages/media/other/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/media/other/', $url->path());
     $this->_check_equal('/pages/media/other/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_log('appended folders (with backticks)', Msg_type_info);
     $url->append('../../images/new/');
     $this->_check_equal('http://earthli.com/pages/images/new/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/', $url->path());
     $this->_check_equal('/pages/images/new/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_log('appended a file name', Msg_type_info);
     $url->append('more/file.png');
     $this->_check_equal('http://earthli.com/pages/images/new/more/file.png', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file.png', $url->name_with_query_string());
     $this->_log('appended a query string', Msg_type_info);
     $url->replace_query_string('arg1=1&arg2=hello world&arg3=<span class="something">');
     $this->_check_equal('http://earthli.com/pages/images/new/more/file.png?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file.png?arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('http://earthli.com/pages/images/new/more/file.png?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('cleared the extension', Msg_type_info);
     $url->replace_extension('');
     $this->_check_equal('http://earthli.com/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('http://earthli.com/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('stripped the domain', Msg_type_info);
     $url->strip_domain();
     $this->_check_equal('/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('', $url->domain());
     $this->_check_equal('/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('set to root', Msg_type_info);
     $url->set_text('/');
     $this->_check_equal('/', $url->as_text());
     $this->_check_equal('', $url->domain());
     $this->_check_equal('/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_check_equal('/', $url->as_text(true));
     $this->_log('set to root with query', Msg_type_info);
     $url->set_text('/?arg1=1&arg2=hello world&arg3=<span class="something">');
     $this->_check_equal('/?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('', $url->domain());
     $this->_check_equal('/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('/?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('set to protocol and domain only', Msg_type_info);
     $url->set_text('http://earthli.org');
     $this->_check_equal('http://earthli.org', $url->as_text());
     $this->_check_equal('earthli.org', $url->domain());
     $this->_check_equal('http://earthli.org/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_check_equal('http://earthli.org', $url->as_text(true));
     $this->_log('stripped the protocol', Msg_type_info);
     $url->strip_protocol();
     $this->_check_equal('earthli.org', $url->as_text());
     $this->_check_equal('earthli.org', $url->domain());
     $this->_check_equal('', $url->path());
     $this->_check_equal('', $url->path_without_domain());
     $this->_check_equal('earthli.org', $url->name());
     $this->_check_equal('org', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('earthli', $url->name_without_extension());
     $this->_check_equal('earthli.org', $url->name_with_query_string());
     $this->_check_equal('earthli.org', $url->as_text(true));
 }
예제 #14
0
if (isset($entry) && $App->login->is_allowed(Privilege_set_entry, Privilege_create, $folder)) {
    $class_name = $App->final_class_name('ENTRY_FORM', 'webcore/forms/object_in_folder_form.php', $entry_type_info->id);
    /** @var ENTRY_FORM $form */
    $form = new $class_name($folder);
    include_once 'webcore/util/options.php';
    $opt_stay_on_page = new STORED_OPTION($App, "stay_on_{$entry_type_info->id}_page");
    $opt_stay_on_page->add_argument('id', $entry->id);
    $form->process_clone($entry);
    if ($form->committed()) {
        if ($form->is_field('quick_save') && $form->value_for('quick_save')) {
            $Env->redirect_local($entry_type_info->edit_page . '?id=' . $entry->id);
        } else {
            if ($opt_stay_on_page->value()) {
                $url = new URL($entry->home_page());
                $url->replace_name_and_extension($Env->url(Url_part_file_name));
                $url->replace_argument('last_id', $entry->id);
                $Env->redirect_local($url->as_text());
            } else {
                $Env->redirect_local($entry->home_page());
            }
        }
    }
    $Page->title->add_object($folder);
    $Page->title->add_object($entry);
    $Page->title->subject = 'Clone ' . $entry_type_info->singular_title;
    $Page->location->add_folder_link($folder);
    $Page->location->add_object_link($entry);
    $Page->location->append($Page->title->subject, '', '{icons}buttons/clone');
    $Page->start_display();
    ?>
<div class="top-box">