/**
  * Makes a local URL.
  *
  * Assumes that you want an OO page.
  */
 public static function make_local_url($page_class, $get_variables = NULL)
 {
     $url = new HTMLTags_URL();
     #if (isset($get_variables)) {
     #	$url->set_file('/');
     #
     #	$url->set_get_variable('oo-page');
     #	$url->set_get_variable('page-class', $page_class);
     #
     #	foreach ($get_variables as $k => $v) {
     #		$url->set_get_variable($k, $v);
     #	}
     #} else {
     #	$url->set_file("/$page_class");
     #}
     $url->set_file('/');
     $url->set_get_variable('oo-page');
     $url->set_get_variable('page-class', $page_class);
     if (isset($get_variables)) {
         foreach ($get_variables as $k => $v) {
             $url->set_get_variable($k, $v);
         }
     }
     return $url;
 }
 /**
  * DEPRECATED!
  *
  * Use PublicHTML_URLHelper::get_pm_page_url(...) instead!
  */
 public static function get_url($section, $module, $page, $type)
 {
     $url = new HTMLTags_URL();
     $url->set_file('/');
     $url->set_get_variable('section', $section);
     if (isset($module)) {
         $url->set_get_variable('module', $module);
     }
     $url->set_get_variable('page', $page);
     $url->set_get_variable('type', $type);
     return $url;
 }
 public function get_admin_page_html_table_tr()
 {
     $page_row = $this->get_element();
     $admin_pages_html_table_tr = new HTMLTags_TR();
     $name_td = new HTMLTags_TD();
     $name_td->append_str_to_content($page_row->get_name());
     $admin_pages_html_table_tr->append_tag_to_content($name_td);
     $author_td = new HTMLTags_TD();
     $author_td->append_str_to_content($page_row->get_author());
     $admin_pages_html_table_tr->append_tag_to_content($author_td);
     $title_td = new HTMLTags_TD();
     #$title_td->append_str_to_content($page_row->get_title());
     $title_td->append_tag_to_content($this->get_title_a());
     $admin_pages_html_table_tr->append_tag_to_content($title_td);
     /*
      * The actions
      */
     $confirmation_url_base = new HTMLTags_URL();
     $confirmation_url_base->set_file('/');
     $confirmation_url_base->set_get_variable('section', 'haddock');
     $confirmation_url_base->set_get_variable('module', 'admin');
     $confirmation_url_base->set_get_variable('page', 'admin-includer');
     $confirmation_url_base->set_get_variable('type', 'html');
     $confirmation_url_base->set_get_variable('admin-section', 'haddock');
     $confirmation_url_base->set_get_variable('admin-module', 'database');
     /*
      * Edit the page's details.
      */
     $edit_td = new HTMLTags_TD();
     $edit_url = clone $confirmation_url_base;
     $edit_url->set_get_variable('admin-page', 'edit-page');
     $edit_url->set_get_variable('page_id', $page_row->get_id());
     $edit_a = new HTMLTags_A('Edit');
     $edit_a->set_href($edit_url);
     $edit_td->append_tag_to_content($edit_a);
     $admin_pages_html_table_tr->append_tag_to_content($edit_td);
     /*
      * Delete the page.
      */
     $delete_td = new HTMLTags_TD();
     $delete_url = clone $confirmation_url_base;
     $delete_url->set_get_variable('admin-page', 'delete-page');
     $delete_url->set_get_variable('page_id', $page_row->get_id());
     $delete_a = new HTMLTags_A('Delete');
     $delete_a->set_href($delete_url);
     $delete_td->append_tag_to_content($delete_a);
     $admin_pages_html_table_tr->append_tag_to_content($delete_td);
     return $admin_pages_html_table_tr;
 }
 public function get_current_url()
 {
     $current_url = new HTMLTags_URL();
     if ($_SERVER['HTTPS']) {
         $current_url->set_scheme('https');
     } else {
         $current_url->set_scheme('http');
     }
     if (preg_match('/([-\\w.]+):(\\d+)/', $_SERVER['HTTP_HOST'], $matches)) {
         $current_url->set_domain($matches[1]);
         $current_url->set_port($matches[2]);
     } else {
         $current_url->set_domain($_SERVER['HTTP_HOST']);
     }
     $file = $_SERVER['REQUEST_URI'];
     if (preg_match('/(.*)\\?/', $file, $matches)) {
         $file = $matches[1];
     }
     $current_url->set_file($file);
     foreach (array_keys($_GET) as $get_var_key) {
         $current_url->set_get_variable($get_var_key, $_GET[$get_var_key]);
     }
     return $current_url;
 }
예제 #5
0
        $page_manager->set_return_to_url($return_to_url);
        /*
         * Delete any session variables that were set during
         * any attempts to fill in the form.
         */
        $exception_on_not_set = FALSE;
        $svm->delete('create-new-account: email', $exception_on_not_set);
        $svm->delete('create-new-account: confirm_email', $exception_on_not_set);
    } catch (InputValidation_InvalidInputException $e) {
        #print_r($e);
        #exit;
        /*
         * If there's been an input error,
         * go back to the form.
         */
        $form_location->set_get_variable('error_message', $e->getMessage());
        $page_manager->set_return_to_url($form_location);
    }
    #exit;
}
/*
 * If the user wants to wipe the slate.
 */
if (isset($_GET['cancel'])) {
    /*
     * Delete any session variables that were set during
     * any attempts to fill in the form.
     */
    $exception_on_not_set = FALSE;
    $svm->delete('create-new-account: email', $exception_on_not_set);
    $svm->delete('create-new-account: confirm_email', $exception_on_not_set);
<?php

/**
 * Give the customer a chance to create a new account.
 *
 * @copyright Clear Line Web Design, 2007-09-21
 */
$existing_customer_log_in_div = new HTMLTags_Div();
$existing_customer_log_in_div->set_attribute_str('id', 'existing_customer_log_in_div');
$existing_customer_log_in_p_text = <<<TXT
If you already have a password, please log in here:
TXT;
$existing_customer_log_in_div->append_tag_to_content(new HTMLTags_P($existing_customer_log_in_p_text));
$existing_customer_log_in_link = new HTMLTags_A('Existing Customer Log In');
$existing_customer_log_in_link->set_attribute_str('class', 'cool_button');
$existing_customer_log_in_link->set_attribute_str('id', 'existing_customer_log_in_button');
$existing_customer_log_in_location = new HTMLTags_URL();
$existing_customer_log_in_location->set_file('/');
$existing_customer_log_in_location->set_get_variable('section', 'plug-ins');
$existing_customer_log_in_location->set_get_variable('module', 'shop');
$existing_customer_log_in_location->set_get_variable('page', 'log-in');
$existing_customer_log_in_location->set_get_variable('type', 'html');
if (isset($_GET['return_to'])) {
    $existing_customer_log_in_location->set_get_variable('return_to', $_GET['return_to']);
}
$existing_customer_log_in_link->set_href($existing_customer_log_in_location);
$existing_customer_log_in_div->append_tag_to_content($existing_customer_log_in_link);
echo $existing_customer_log_in_div->get_as_string();
<?php

/**
 * Give the customer a chance to create a new account.
 *
 * @copyright Clear Line Web Design, 2007-09-21
 */
$create_new_customer_div = new HTMLTags_Div();
$create_new_customer_div->set_attribute_str('id', 'create_new_customer_div');
$create_new_customer_link = new HTMLTags_A('Create New Account');
$create_new_customer_link->set_attribute_str('class', 'cool_button');
$create_new_customer_link->set_attribute_str('id', 'create_new_customer_button');
$create_new_customer_location = new HTMLTags_URL();
$create_new_customer_location->set_file('/');
$create_new_customer_location->set_get_variable('section', 'plug-ins');
$create_new_customer_location->set_get_variable('module', 'shop');
#$create_new_customer_location->set_get_variable('page', 'customer-details');
$create_new_customer_location->set_get_variable('page', 'create-new-account');
$create_new_customer_location->set_get_variable('type', 'html');
if (isset($_GET['return_to'])) {
    $create_new_customer_location->set_get_variable('return_to', $_GET['return_to']);
}
$create_new_customer_link->set_href($create_new_customer_location);
$create_new_customer_div->append_tag_to_content($create_new_customer_link);
echo $create_new_customer_div->get_as_string();
 public function get_delete_row_a()
 {
     $order = $this->get_element();
     $delete_row_link = new HTMLTags_A('Delete');
     $delete_row_link->set_attribute_str('class', 'cool_button');
     $delete_row_location = new HTMLTags_URL();
     $delete_row_location->set_file('/');
     $delete_row_location->set_get_variable('page', 'shopping-basket');
     $delete_row_location->set_get_variable('type', 'redirect-script');
     $delete_row_location->set_get_variable('delete_order_id', $order->get_id());
     $delete_row_link->set_href($delete_row_location);
     return $delete_row_link;
 }
 public function get_log_out_url()
 {
     $log_out_url = new HTMLTags_URL();
     $log_out_url->set_file('/');
     $log_out_url->set_get_variable('section', 'haddock');
     $log_out_url->set_get_variable('module', 'admin');
     $log_out_url->set_get_variable('page', 'log-out');
     $log_out_url->set_get_variable('type', 'redirect-script');
     return $log_out_url;
 }
<?php

/**
 * The p the link to the page for all the products.
 * 
 * @copyright Clear Line Web Design, 2007-07-26
 */
$all_products_link = new HTMLTags_A('See All Products');
$all_products_location = new HTMLTags_URL();
$all_products_location->set_file('/');
$all_products_location->set_get_variable('section', 'plug-ins');
$all_products_location->set_get_variable('module', 'shop');
$all_products_location->set_get_variable('page', 'products');
$all_products_location->set_get_variable('type', 'html');
$all_products_link->set_href($all_products_location);
$all_products_link_p = new HTMLTags_P();
$all_products_link_p->append_tag_to_content($all_products_link);
echo $all_products_link_p->get_as_string();
    public function get_full_product_div_in_public()
    {
        $full_product_div = new HTMLTags_Div();
        $product = $this->get_element();
        $design_photograph = $product->get_design_photograph();
        $design_photograph_renderer = $design_photograph->get_renderer();
        $database = $product->get_database();
        $shopping_baskets_table = $database->get_table('hpi_shop_shopping_baskets');
        $hlisting_div = new HTMLTags_Div();
        $hlisting_div->set_attribute_str('id', 'single-product');
        $hlisting_div->set_attribute_str('class', 'hlisting offer-sale full-item');
        $hlisting_summary_div = new HTMLTags_Div();
        $hlisting_summary_div->set_attribute_str('class', 'summary');
        $hlisting_summary_div->append_str_to_content($product->get_name());
        $hlisting_div->append_tag_to_content($hlisting_summary_div);
        $hlisting_description_div = new HTMLTags_Div();
        $hlisting_description_div->set_attribute_str('class', 'description');
        $hlisting_images_div = new HTMLTags_Div();
        $hlisting_images_div->set_attribute_str('class', 'images');
        if (isset($_GET['thumbnail_photograph_id'])) {
            $photographs_table = $database->get_table('hpi_shop_photographs');
            $main_photograph = $photographs_table->get_row_by_id($_GET['thumbnail_photograph_id']);
        } else {
            $main_photograph = $product->get_main_photograph();
        }
        $main_photograph_renderer = $main_photograph->get_renderer();
        $main_img = $main_photograph_renderer->get_full_size_img();
        $hlisting_images_div->append_tag_to_content($main_img);
        $thumbnail_div = $this->get_extras_thumbnail_div($main_photograph);
        $hlisting_images_div->append_tag_to_content($thumbnail_div);
        $design_img = $design_photograph_renderer->get_full_size_img();
        $hlisting_images_div->append_tag_to_content($design_img);
        $hlisting_description_div->append_tag_to_content($hlisting_images_div);
        //                $hlisting_description_p = new HTMLTags_P($product->get_description());
        //                $hlisting_description_div->append_tag_to_content($hlisting_description_p);
        $hlisting_description_div->append_str_to_content($product->get_description());
        $hlisting_div->append_tag_to_content($hlisting_description_div);
        $product_details_ul = $this->get_product_details_ul();
        $product_details_div = new HTMLTags_Div();
        $product_details_div->set_attribute_str('class', 'details');
        $product_details_div->append_tag_to_content($product_details_ul);
        // CHECK TO SEE IF PRODUCT IS IN SHOPPING BASKET
        $shopping_basket_already_exists = $shopping_baskets_table->check_for_product_in_current_session($product->get_id(), session_id());
        if ($shopping_basket_already_exists) {
            $conditions['product_id'] = $product->get_id();
            $conditions['session_id'] = "'" . session_id() . "'";
            $conditions['deleted'] = 'no';
            $conditions['moved_to_orders'] = 'no';
            $shopping_basket_row = $shopping_baskets_table->get_rows_where($conditions);
            //print_r($shopping_basket_row);
            $previous_quantity = $shopping_basket_row[0]->get_quantity();
            $previous_purchase_p = new HTMLTags_P();
            $previous_purchase_p->set_attribute_str('class', 'previous-purchase');
            $previous_purchase_text = <<<TXT
You already have&nbsp;
TXT;
            $previous_purchase_text .= $shopping_basket_row[0]->get_quantity();
            $previous_purchase_text .= <<<TXT
&nbsp;of these in your Shopping Basket.
TXT;
            $previous_purchase_p->append_str_to_content($previous_purchase_text);
            $product_details_div->append_tag_to_content($previous_purchase_p);
        } else {
        }
        if ($product->is_active() && !$product->is_out_of_stock()) {
            //Link to ADD TO BASKET
            $add_to_basket_link = $this->get_add_to_shopping_basket_link();
            $add_to_basket_link_p = new HTMLTags_P();
            $add_to_basket_link_p->set_attribute_str('class', 'options');
            $add_to_basket_link_p->append_tag_to_content($add_to_basket_link);
            $product_details_div->append_tag_to_content($add_to_basket_link_p);
        } else {
            if ($product->is_out_of_stock()) {
                $other_products_link = new HTMLTags_A();
                $other_products_link->append_str_to_content('See other products');
                $other_products_location = new HTMLTags_URL();
                $other_products_location->set_file('/');
                $other_products_location->set_get_variable('section', 'plug-ins');
                $other_products_location->set_get_variable('module', 'shop');
                $other_products_location->set_get_variable('page', 'products');
                $other_products_location->set_get_variable('type', 'html');
                $other_products_link->set_href($other_products_location);
                $other_products_available_p = new HTMLTags_P();
                $other_products_available_p->append_tag_to_content($other_products_link);
                $product_details_div->append_tag_to_content($other_products_available_p);
            } else {
                $customer_regions_table = $database->get_table('hpi_shop_customer_regions');
                $customer_region = $customer_regions_table->get_row_by_id($_SESSION['customer_region_id']);
                $product_not_available_p = new HTMLTags_P();
                $product_not_available_p->append_str_to_content('This product is not available in&nbsp;');
                $product_not_available_p->append_str_to_content($customer_region->get_name_with_the());
                $product_not_available_p->append_str_to_content('.');
                $product_details_div->append_tag_to_content($product_not_available_p);
                $product_category = $product->get_product_category();
                if ($product_category->is_active()) {
                    $other_products_in_category_link = new HTMLTags_A();
                    $other_products_in_category_link->append_str_to_content('See other&nbsp;' . $product_category->get_name() . '&nbsp;available in&nbsp;' . $customer_region->get_name_with_the());
                    $other_products_in_category_location = new HTMLTags_URL();
                    $other_products_in_category_location->set_file('/');
                    $other_products_in_category_location->set_get_variable('section', 'plug-ins');
                    $other_products_in_category_location->set_get_variable('module', 'shop');
                    $other_products_in_category_location->set_get_variable('page', 'product-category');
                    $other_products_in_category_location->set_get_variable('type', 'html');
                    $other_products_in_category_location->set_get_variable('product_category_id', $product_category->get_id());
                    $other_products_in_category_link->set_href($other_products_in_category_location);
                    $other_products_available_p = new HTMLTags_P();
                    $other_products_available_p->append_tag_to_content($other_products_in_category_link);
                    $product_details_div->append_tag_to_content($other_products_available_p);
                } else {
                    $all_products_in_region_link = new HTMLTags_A();
                    $all_products_in_region_link->append_str_to_content('See other products available in&nbsp;' . $customer_region->get_name_with_the());
                    $all_products_in_region_location = new HTMLTags_URL();
                    $all_products_in_region_location->set_file('/');
                    $all_products_in_region_location->set_get_variable('section', 'plug-ins');
                    $all_products_in_region_location->set_get_variable('module', 'shop');
                    $all_products_in_region_location->set_get_variable('page', 'products');
                    $all_products_in_region_location->set_get_variable('type', 'html');
                    $all_products_in_region_location->set_get_variable('page', 'products');
                    $all_products_in_region_location->set_get_variable('customer_region_session', $customer_region->get_id());
                    $all_products_in_region_link->set_href($all_products_in_region_location);
                    $other_products_available_p = new HTMLTags_P();
                    $other_products_available_p->append_tag_to_content($all_products_in_region_link);
                    $product_details_div->append_tag_to_content($other_products_available_p);
                }
            }
        }
        $hlisting_div->append_tag_to_content($product_details_div);
        $full_product_div->append_tag_to_content($hlisting_div);
        return $full_product_div;
    }
    public function get_changed_confirmation_div()
    {
        $customer_region = $this->get_element();
        $confirmation_div = new HTMLTags_Div();
        $confirmation_text = <<<TXT
You have changed your region to&nbsp;
TXT;
        $confirmation_text .= $customer_region->get_name_with_the();
        $confirmation_text .= <<<TXT
.
TXT;
        $confirmation_text_p = new HTMLTags_P($confirmation_text);
        $confirmation_div->append_tag_to_content($confirmation_text_p);
        $all_products_link = new HTMLTags_A('View Products Available in&nbsp;' . $customer_region->get_name_with_the());
        //            $all_products_link->set_attribute_str('class', 'all_products');
        $all_products_location = new HTMLTags_URL();
        $all_products_location->set_file('/');
        $all_products_location->set_get_variable('section', 'plug-ins');
        $all_products_location->set_get_variable('module', 'shop');
        $all_products_location->set_get_variable('page', 'products');
        $all_products_location->set_get_variable('type', 'html');
        $all_products_location->set_get_variable('customer_region_session', $customer_region->get_id());
        $all_products_link->set_href($all_products_location);
        $confirmation_div->append_tag_to_content($all_products_link);
        return $confirmation_div;
    }
            $enter_r_pw_a->set_href($enter_r_pw_url);
            $enter_r_pw_p->append_tag_to_content($enter_r_pw_a);
            $enter_r_pw_p->append_str_to_content(' to try again.');
            $content_div->append_tag_to_content($enter_r_pw_p);
        } else {
            /*
             * A link to sign out.
             */
            #print_r($_SESSION);
            $root_pw_status_p = new HTMLTags_P();
            $root_pw_status_p->append_str_to_content('The root password has been entered.');
            $content_div->append_tag_to_content($root_pw_status_p);
            $sign_out_p = new HTMLTags_P();
            $sign_out_p->append_str_to_content('Click ');
            $sign_out_a = new HTMLTags_A('here');
            $sign_out_url = new HTMLTags_URL();
            $sign_out_url->set_file('/admin/redirect-script.php');
            $sign_out_url->set_get_variable('module', 'database');
            $sign_out_url->set_get_variable('page', 'sign-in-as-root');
            $sign_out_url->set_get_variable('sign_out');
            $sign_out_a->set_href($sign_out_url);
            $sign_out_p->append_tag_to_content($sign_out_a);
            $sign_out_p->append_str_to_content(' to sign out.');
            $content_div->append_tag_to_content($sign_out_p);
        }
    }
}
/*
 * -----------------------------------------------------------------------------
 */
echo $content_div;
<?php

/**
 * The default form for adding an email address to the mailing list.
 *
 * @copyright Clear Line Web Design, 2007-07-20
 */
//<form
$form_email_adding = new HTMLTags_Form();
/*
 * Form altered by RFI 2007-07-13
 */
$form_action = new HTMLTags_URL();
$form_action->set_file('/');
$form_action->set_get_variable('section', 'plug-ins');
$form_action->set_get_variable('module', 'mailing-list');
$form_action->set_get_variable('page', 'mailing-list');
$form_action->set_get_variable('type', 'redirect-script');
$form_action->set_get_variable('add_person');
$form_action->set_get_variable('return_to', urlencode('/?section=project-specific&page=mailing-list'));
#echo 'action="' . $form_action->get_as_string() . "\"\n";
$form_email_adding->set_action($form_action);
$form_email_adding->set_attribute_str('method', 'POST');
//    method="POST"
//>
$ul_inputs = new HTMLTags_UL();
$li_name = new HTMLTags_LI();
//        <label for="name">Name:</label>
$label_name = new HTMLTags_Label('Name: ');
$label_name->set_attribute_str('for', 'name');
$li_name->append_tag_to_content($label_name);
 public function get_url_for_page_in_module_in_section($page, $module, $section)
 {
     $page_element = $this->get_page_element_in_module_in_section($page, $module, $section);
     if ($page_element->hasAttribute('url')) {
         $url = new HTMLTags_URL($page_element->getAttribute('url'));
     } else {
         $url = new HTMLTags_URL();
         $url->set_file('/');
         $url->set_get_variable('section', 'haddock');
         $url->set_get_variable('module', 'admin');
         $url->set_get_variable('page', 'admin-includer');
         $url->set_get_variable('type', 'html');
         if ($page_element->hasAttribute('special_page') && $page_element->getAttribute('special_page') == 'db-table-xml') {
             $url->set_get_variable('admin-section', 'haddock');
             $url->set_get_variable('admin-module', 'database');
             $url->set_get_variable('admin-page', 'table-xml');
             $url->set_get_variable('db-section', $section);
             $url->set_get_variable('db-module', $module);
             $url->set_get_variable('db-xml-file', $page);
         } else {
             $url->set_get_variable('admin-section', $section);
             $url->set_get_variable('admin-module', $module);
             $url->set_get_variable('admin-page', $page);
         }
     }
     return $url;
 }
 */
$table = $xml_db_page_manager->get_table();
$table_renderer = $table->get_renderer();
/*
 * Create the HTML tags objects.
 */
$content_div = new HTMLTags_Div();
$content_div->set_attribute_str('id', 'content');
/*
 * Creating the URL objects.
 */
$current_page_url = new HTMLTags_URL();
$current_page_url->set_file('/');
foreach (array_keys($_GET) as $get_key) {
    if (!in_array($get_key, explode(' ', 'error all_rows_deleted last_added_id last_deleted_id last_edited_id'))) {
        $current_page_url->set_get_variable($get_key, $_GET[$get_key]);
    }
}
$redirect_script_url = clone $current_page_url;
$redirect_script_url->set_get_variable('type', 'redirect-script');
$cancel_href = clone $redirect_script_url;
$cancel_href->set_get_variable('cancel');
/*
 * Show last action messages or errors.
 */
$last_action_box_div = NULL;
if (isset($_GET['last_added_id'])) {
    $last_action_box_div = new HTMLTags_LastActionBoxDiv($xml_db_page_manager->get_last_added_message($table, $_GET['last_added_id']));
}
if (isset($_GET['last_edited_id'])) {
    $last_action_box_div = new HTMLTags_LastActionBoxDiv($xml_db_page_manager->get_last_edited_message($table, $_GET['last_edited_id']));
    }
    $cancel_href = new HTMLTags_URL();
    $cancel_href->set_file('/log-in.html');
    $customer_log_in_form = $customers_table_renderer->get_customer_log_in_form($redirect_script_url, $cancel_href);
    $log_in_to_account_div->append_tag_to_content($customer_log_in_form);
}
$content_div->append_tag_to_content($log_in_to_account_div);
// Create new account (go to customer-details.html)
$create_new_customer_div = new HTMLTags_Div();
$create_new_customer_div->set_attribute_str('id', 'create_new_customer_div');
$create_new_customer_link = new HTMLTags_A('Create New Customer');
$create_new_customer_link->set_attribute_str('class', 'cool_button');
$create_new_customer_link->set_attribute_str('id', 'create_new_customer_button');
$create_new_customer_location = new HTMLTags_URL();
$create_new_customer_location->set_file('/');
$create_new_customer_location->set_get_variable('page', 'customer-details');
if (isset($_GET['return_to'])) {
    $create_new_customer_location->set_get_variable('return_to', $_GET['return_to']);
}
$create_new_customer_link->set_href($create_new_customer_location);
$create_new_customer_div->append_tag_to_content($create_new_customer_link);
$content_div->append_tag_to_content($create_new_customer_div);
// Blurb at bottom
$p_text = <<<TXT
We hope you have a pleasant login experience.
TXT;
$content_div->append_tag_to_content(new HTMLTags_P($p_text));
// Links to all products and checkout
//$shopping_basket_checkout_links_ul =
//        $shopping_baskets_table_renderer->
//        get_shopping_basket_checkout_links_ul();
예제 #18
0
/**
 * Security for the admin pages.
 *
 * @copyright Clear Line Web Design, 2007-08-06
 */
$admin_login_manager = Admin_LoginManager::get_instance();
if (!$admin_login_manager->is_logged_in()) {
    $page_manager = PublicHTML_PageManager::get_instance();
    unset($_SESSION['admin-login-data']);
    #$_SESSION['admin-login-data']['desired-url'] = $page_manager->get_script_uri();
    $script_uri = $page_manager->get_script_uri();
    $desired_uri = new HTMLTags_URL();
    $desired_uri->set_file('/');
    foreach (array_keys($_GET) as $key) {
        $desired_uri->set_get_variable($key, $_GET[$key]);
    }
    $suggv = $script_uri->get_get_variables();
    foreach (array_keys($suggv) as $key) {
        $desired_uri->set_get_variable($key, $suggv[$key]);
    }
    //$_SESSION['admin-login-data']['desired-url'] = '/';
    //
    //$first = TRUE;
    //foreach (array_keys($desired_get_vars) as $key) {
    //    if ($first) {
    //        $first = FALSE;
    //    } else {
    //        $_SESSION['admin-login-data']['desired-url'] = '&';
    //    }
    //
 public function get_comment_adding_form()
 {
     $mysql_user_factory = Database_MySQLUserFactory::get_instance();
     $mysql_user = $mysql_user_factory->get_for_this_project();
     $database = $mysql_user->get_database();
     $comments_table = $database->get_table('hpi_shop_comments');
     $commenters_table = $database->get_table('hpi_shop_commenters');
     $redirect_script_url = new HTMLTags_URL();
     $redirect_script_url->set_file('/admin/redirect-script.php');
     $redirect_script_url->set_get_variable('type', 'redirect-script');
     $redirect_script_url->set_get_variable('module', 'shop');
     $redirect_script_url->set_get_variable('page', 'comments');
     $cancel_location = new HTMLTags_URL();
     $cancel_location->set_file('/admin/shop/comments.html');
     $comment_adding_form = new HTMLTags_SimpleOLForm('comment_adding');
     $comment_adding_action = clone $redirect_script_url;
     $comment_adding_action->set_get_variable('add_comment');
     $comment_adding_form->set_action($comment_adding_action);
     $comment_adding_form->set_legend_text('Add a comment');
     #Added 	Status 	Front Page 	Name 	Comment
     /*
      * The name
      */
     $name_field = $commenters_table->get_field('name');
     $name_field_renderer = $name_field->get_renderer();
     $input_tag = $name_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'name');
     $comment_adding_form->add_input_tag('name', $input_tag);
     /*
      * The email
      */
     $email_field = $commenters_table->get_field('email');
     $email_field_renderer = $email_field->get_renderer();
     $input_tag = $email_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'email');
     $comment_adding_form->add_input_tag('email', $input_tag);
     /*
      * The homepage_title
      */
     $homepage_title_field = $commenters_table->get_field('homepage_title');
     $homepage_title_field_renderer = $homepage_title_field->get_renderer();
     $input_tag = $homepage_title_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'homepage_title');
     $comment_adding_form->add_input_tag('homepage_title', $input_tag);
     /*
      * The url
      */
     $url_field = $commenters_table->get_field('url');
     $url_field_renderer = $url_field->get_renderer();
     $input_tag = $url_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'url');
     $comment_adding_form->add_input_tag('url', $input_tag, 'URL');
     /*
      * The comment
      */
     $comment_field = $comments_table->get_field('comment');
     $comment_field_renderer = $comment_field->get_renderer();
     $input_tag = $comment_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'comment');
     $comment_adding_form->add_input_tag('comment', $input_tag);
     /*
      * The status enum
      */
     $status_field = $comments_table->get_field('status');
     $status_field_renderer = $status_field->get_renderer();
     $input_tag = $status_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'status');
     $comment_adding_form->add_input_tag('status', $input_tag);
     /*
      * The front_page enum
      */
     $front_page_field = $comments_table->get_field('front_page');
     $front_page_field_renderer = $front_page_field->get_renderer();
     $input_tag = $front_page_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'front_page');
     $comment_adding_form->add_input_tag('front_page', $input_tag);
     /*
      * The update button.
      */
     $comment_adding_form->set_submit_text('Add');
     $comment_adding_form->set_cancel_location($cancel_location);
     return $comment_adding_form;
 }
 /**
  * Returns the URL for the redirect script that changes the
  * shopping basket quantities and other actions.
  */
 public static function get_public_redirect_script_url()
 {
     $location = new HTMLTags_URL();
     $location->set_file('/');
     $location->set_get_variable('section', 'plug-ins');
     $location->set_get_variable('module', 'shop');
     $location->set_get_variable('page', 'shopping-basket');
     $location->set_get_variable('type', 'redirect-script');
     return $location;
 }
 /**
  * Takes a URL and adds get variables that will be used to identify
  * the thing that is in questions.
  * 
  * Horrible, use OO!
  * e.g. Have a class that represents a url.
  * Maybe that would be less flexible.
  *
  * This is used in:
  * 
  * 	Database_CRUDAdminPage::get_edit_something_redirect_script_url()
  * 	Database_CRUDAdminPage::get_delete_something_redirect_script_url()
  * 	
  */
 public function add_get_vars_to_identify_current_thing(HTMLTags_URL $url, $somthing)
 {
     $ks = $this->get_key_columns_for_something();
     foreach ($ks as $k) {
         $url->set_get_variable($k, $somthing[$k]);
     }
     return $url;
 }
<?php

/**
 * Content of the page for refreshing the __autoload
 * function .INC file.
 *
 * @copyright Clear Line Web Design, 2007-05-11
 */
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_Div.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_P.inc.php';
require_once PROJECT_ROOT . '/haddock/haddock-project-organisation/classes/' . 'HaddockProjectOrganisation_ProjectDirectoryFinder.inc.php';
$project_directory_finder = HaddockProjectOrganisation_ProjectDirectoryFinder::get_instance();
$project_directory = $project_directory_finder->get_project_directory_for_this_project();
$project_specific_directory = $project_directory->get_project_specific_directory();
$autoload_inc_file = $project_specific_directory->get_autoload_inc_file();
$content_div = new HTMLTags_Div();
$content_div->set_attribute_str('id', 'content');
$autoload_inc_file = $project_specific_directory->get_autoload_inc_file();
$last_modified_p = new HTMLTags_P();
$last_modified_p->append_str_to_content('The <code>__autoload()</code> .INC file was last modified on ');
$last_modified_p->append_str_to_content(date('r', $autoload_inc_file->mtime()));
$content_div->append_tag_to_content($last_modified_p);
$refresh_a = new HTMLTags_A('Refresh');
$refresh_url = new HTMLTags_URL();
$refresh_url->set_file('/admin/redirect-script.php');
$refresh_url->set_get_variable('module', 'haddock-project-organisation');
$refresh_url->set_get_variable('page', 'autoload-inc-file-creation');
$refresh_url->set_get_variable('refresh');
$refresh_a->set_href($refresh_url);
$content_div->append_tag_to_content($refresh_a);
echo $content_div->get_as_string();
 public function get_script_uri()
 {
     $script_uri = new HTMLTags_URL();
     $script_uri->set_file('/');
     $script_uri->set_get_variable('section', $this->get_section());
     if ($this->get_section() != 'project-specific') {
         $script_uri->set_get_variable('module', $this->get_module());
     }
     $script_uri->set_get_variable('page', $this->get_page());
     $script_uri->set_get_variable('type', $this->get_type());
     return $script_uri;
 }
 public function get_password_reset_script_url()
 {
     $password_reset_script_url = new HTMLTags_URL();
     $password_reset_script_url->set_file('/');
     $password_reset_script_url->set_get_variable('section', 'plug-ins');
     $password_reset_script_url->set_get_variable('module', 'shop');
     $password_reset_script_url->set_get_variable('page', 'reset-password');
     $password_reset_script_url->set_get_variable('type', 'redirect-script');
     $password_reset_script_url->set_get_variable('reset_password');
     return $password_reset_script_url;
 }
             * ask the user if they want to create one now.
             */
            if (!$root_mysql_user->has_user_for_this_project()) {
                $db_user_not_yet_p = new HTMLTags_P();
                $db_user_not_yet_p->set_attribute_str('class', 'error');
                $db_user_not_yet_p->append_str_to_content('The database user for this project does not exist yet!');
                $content_div->append_tag_to_content($db_user_not_yet_p);
                /*
                 * -------------------------------------------------------------
                 */
                $create_db_user_p = new HTMLTags_P();
                $create_db_user_p->append_str_to_content('Click ');
                $create_db_user_a = new HTMLTags_A('here');
                $create_db_user_url = new HTMLTags_URL();
                $create_db_user_url->set_file('/admin/redirect-script.php');
                $create_db_user_url->set_get_variable('module', 'database');
                $create_db_user_url->set_get_variable('page', 'user-management');
                $create_db_user_url->set_get_variable('create_db_user');
                $create_db_user_a->set_href($create_db_user_url);
                $create_db_user_p->append_tag_to_content($create_db_user_a);
                $create_db_user_p->append_str_to_content(' to create it.');
                $content_div->append_tag_to_content($create_db_user_p);
            } else {
                $db_user_already_p = new HTMLTags_P();
                $db_user_already_p->append_str_to_content('The database user for this project exists.');
                $content_div->append_tag_to_content($db_user_already_p);
            }
        }
    }
}
/*
 public function get_admin_people_html_table_tr(HTMLTags_URL $edit_location, HTMLTags_URL $delete_location)
 {
     $person = $this->get_element();
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     $database = $row->get_database();
     /*
      * The data.
      */
     $added_field = $table->get_field('added');
     $added_td = $this->get_data_html_table_td($added_field);
     $html_row->append_tag_to_content($added_td);
     $name_field = $table->get_field('name');
     $name_td = $this->get_data_html_table_td($name_field);
     $html_row->append_tag_to_content($name_td);
     $email_field = $table->get_field('email');
     $email_td = $this->get_data_html_table_td($email_field);
     $html_row->append_tag_to_content($email_td);
     $status_field = $table->get_field('status');
     $status_td = $this->get_data_html_table_td($status_field);
     $html_row->append_tag_to_content($status_td);
     /*
      * The edit td.
      */
     $edit_td = new HTMLTags_TD();
     $edit_link = new HTMLTags_A('Edit');
     $edit_link->set_attribute_str('class', 'cool_button');
     $edit_link->set_attribute_str('id', 'edit_table_button');
     #            $edit_location = new HTMLTags_URL();
     #
     #            $edit_location->set_file('/admin/');
     #
     #            $edit_location->set_get_variable('module', 'mailing-list');
     #            $edit_location->set_get_variable('page', 'mailing-list');
     $edit_location->set_get_variable('edit_id', $row->get_id());
     $edit_link->set_href($edit_location);
     $edit_td->append_tag_to_content($edit_link);
     $html_row->append_tag_to_content($edit_td);
     /*
      * The delete td.
      */
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     $delete_link->set_attribute_str('id', 'delete_table_button');
     #            $delete_location = new HTMLTags_URL();
     #
     #            $delete_location->set_file('/admin/');
     #
     #            $delete_location->set_get_variable('module', 'mailing-list');
     #            $delete_location->set_get_variable('page', 'mailing-list');
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     $html_row->append_tag_to_content($delete_td);
     return $html_row;
 }
    $comment_form_div = new HTMLTags_Div();
    $comment_form_div->set_attribute_str('class', 'comment-form');
    $form_notification_div = new HTMLTags_Div();
    $form_notification_div->set_attribute_str('id', 'form_notification_div');
    if (isset($_GET['last_added_id'])) {
        $form_notification_div->append_tag_to_content(new HTMLTags_P('Thank you for your comment.<br />
						Comments can take up to 24 hours to 
						appear in the guestbook.'));
    }
    if (isset($_GET['form_incomplete'])) {
        $form_notification_div->append_tag_to_content(new HTMLTags_P('Please complete name, email and comment'));
    }
    $comment_form_div->append_tag_to_content($form_notification_div);
    $comment_adding_action_url = new HTMLTags_URL();
    $comment_adding_action_url->set_file('/');
    $comment_adding_action_url->set_get_variable('section', 'plug-ins');
    $comment_adding_action_url->set_get_variable('module', 'shop');
    $comment_adding_action_url->set_get_variable('page', 'product');
    $comment_adding_action_url->set_get_variable('type', 'redirect-script');
    $comment_adding_action_url->set_get_variable('product_id', $_GET['product_id']);
    $cancel_location = new HTMLTags_URL();
    $cancel_location->set_file('/');
    $cancel_location->set_get_variable('section', 'plug-ins');
    $cancel_location->set_get_variable('module', 'shop');
    $cancel_location->set_get_variable('page', 'product');
    $cancel_location->set_get_variable('product_id', $_GET['product_id']);
    $comment_adding_form = new HTMLTags_SimpleOLForm('comment_adding');
    $comment_adding_form->set_attribute_str('class', 'cmxform');
    $comment_adding_form->set_attribute_str('id', 'comment-form');
    $comment_adding_action = $comment_adding_action_url;
    $comment_adding_action->set_get_variable('add_comment');
예제 #28
0
        $shopping_baskets_table->delete_illegal_shopping_baskets_for_current_customer_region();
        $shopping_baskets_table->convert_shopping_baskets_for_current_session_to_new_customer_region();
    }
    if ($log_in_manager->is_logged_in()) {
        $user = $log_in_manager->get_user();
        if ($user->get_customer_region_id() != 0) {
            $user->set_customer_region_id($_SESSION['customer_region_id']);
        }
        $svm = Caching_SessionVarManager::get_instance();
        $svm->set('customer_shipping_details_confirmed', FALSE);
    }
} elseif (isset($_SESSION['customer_region_id'])) {
    //    echo "customer_region_id set in the session variable.\n";
} else {
    //    echo "customer_region_id has not been set by GET or in the session, getting the default from the DB.\n";
    $default_customer_region = $customer_regions_table->get_default_customer_region();
    //    echo '$default_customer_region->get_id()' . ": \n";
    //    echo $default_customer_region->get_id() . "\n";
    $_SESSION['customer_region_id'] = $default_customer_region->get_id();
}
/*
 * Set the return location after successfully adding to the database.
 */
$return_to_url = new HTMLTags_URL();
if (isset($_GET['desired_location'])) {
    $return_to_url->parse_url(urldecode($_GET['desired_location']));
    $return_to_url->set_get_variable('customer_region_session', $_SESSION['customer_region_id']);
} else {
    $return_to_url->set_file('/');
}
$page_manager->set_return_to_url($return_to_url);
 protected function get_admin_url()
 {
     $admin_url = new HTMLTags_URL();
     $admin_url->set_file('/');
     $admin_url->set_get_variable('section', 'haddock');
     $admin_url->set_get_variable('module', 'admin');
     $admin_url->set_get_variable('page', 'admin-includer');
     $admin_url->set_get_variable('admin-section', 'haddock');
     $admin_url->set_get_variable('admin-module', 'database');
     $admin_url->set_get_variable('admin-page', 'table');
     $table = $this->get_element();
     $admin_url->set_get_variable('table', $table->get_name());
     return $admin_url;
 }
 /**
  * A table to display the web_videos in public, with pages
  */
 public function get_paged_public_all_people_div($page)
 {
     $people_table = $this->get_element();
     $all_people_div = new HTMLTags_Div();
     ####################################################################
     #
     # Display some of the data in the web_videos table.
     #
     ####################################################################
     if ($people_table->count_all_rows() >= 11) {
         /*
          * DIV for limits and previous and nexts.
          */
         $limit_previous_next_div = new HTMLTags_Div();
         $limit_previous_next_div->set_attribute_str('class', 'table_pages_div');
         /*
          * To allow the user to set the number of extras to show at a time.
          */
         $limit_action = new HTMLTags_URL();
         $limit_action->set_file('/');
         $limit_form = new Database_LimitForm($limit_action, LIMIT, '10 20 50');
         $limit_form->add_hidden_input('page', $page);
         $limit_form->add_hidden_input('order_by', ORDER_BY);
         $limit_form->add_hidden_input('direction', DIRECTION);
         $limit_form->add_hidden_input('offset', OFFSET);
         $limit_previous_next_div->append_tag_to_content($limit_form);
         /*
          * Go the previous or next list of extras.
          */
         $previous_next_url = new HTMLTags_URL();
         $previous_next_url->set_file('/');
         $previous_next_url->set_get_variable('page', $page);
         $previous_next_url->set_get_variable('order_by', ORDER_BY);
         $previous_next_url->set_get_variable('direction', DIRECTION);
         #print_r($previous_next_url);
         $row_count = $people_table->count_people();
         #echo "\$row_count: $row_count\n";
         $previous_next_ul = new Database_PreviousNextUL($previous_next_url, OFFSET, LIMIT, $row_count);
         $limit_previous_next_div->append_tag_to_content($previous_next_ul);
         $all_people_div->append_tag_to_content($limit_previous_next_div);
     }
     # ------------------------------------------------------------------
     /**
      * The table.
      */
     $rows_html_table = new HTMLTags_Table();
     $rows_html_table->set_attribute_str('class', 'table_pages');
     $conditions['status'] = 'accepted';
     $rows = $people_table->get_rows_where($conditions, ORDER_BY, DIRECTION, OFFSET, LIMIT);
     #$rows = $people_table->get_all_rows(ORDER_BY, DIRECTION, OFFSET, LIMIT);
     foreach ($rows as $row) {
         $row_renderer = $row->get_renderer();
         $data_tr = $row_renderer->get_public_people_tr();
         $rows_html_table->append_tag_to_content($data_tr);
     }
     # ------------------------------------------------------------------
     $all_people_div->append_tag_to_content($rows_html_table);
     if ($people_table->count_all_rows() >= 11) {
         $all_people_div->append_tag_to_content($limit_previous_next_div);
     }
     return $all_people_div;
 }