当前位置: 首页>>代码示例>>PHP>>正文


PHP URL::rewriteURL方法代码示例

本文整理汇总了PHP中URL::rewriteURL方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::rewriteURL方法的具体用法?PHP URL::rewriteURL怎么用?PHP URL::rewriteURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在URL的用法示例。


在下文中一共展示了URL::rewriteURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
  * We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'propertyCreate':
             // Set the URL to go back;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST()->toBoolean() == TRUE) {
                 if ($this->checkPOST(self::$objProductsPropertyTableFKey)->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objProductsPropertyTableFKey, new S(PRODUCTS_PROPERTY_CANNOT_BE_EMPTY));
                 }
                 if ($this->checkPOST(self::$objProductsPropertyTableFVar)->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objProductsPropertyTableFVar, new S(PRODUCTS_VALUE_CANNOT_BE_EMPTY));
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(PRODUCTS_ADD_PROPERTY))->setSQLAction(new S('update'))->setTableName(self::$objProductsPropertyTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objProductsPropertyTableFId)->setExtraUpdateData(self::$objProductsPropertyTableFPId, $_GET[ADMIN_ACTION_ID])->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(PRODUCTS_ADD_PROPERTY))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objProductsPropertyTableFKey)->setLabel(new S(PRODUCTS_PROPERTY))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objProductsPropertyTableFVar)->setLabel(new S(PRODUCTS_VALUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'propertyEdit':
             // Set the URL to go back;
             $objURLToGoBack = URL::rewriteURL(new A(array(PRODUCTS_ACTION_PROPERTY, PRODUCTS_ID_PROPERTY)));
             // Do some work;
             if ($this->checkPOST()->toBoolean() == TRUE) {
                 if ($this->checkPOST(self::$objProductsPropertyTableFKey)->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objProductsPropertyTableFKey, new S(PRODUCTS_PROPERTY_CANNOT_BE_EMPTY));
                 }
                 if ($this->checkPOST(self::$objProductsPropertyTableFVar)->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objProductsPropertyTableFVar, new S(PRODUCTS_VALUE_CANNOT_BE_EMPTY));
                 }
             }
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(PRODUCTS_EDIT_PROPERTY))->setSQLAction(new S('update'))->setTableName(self::$objProductsPropertyTable)->setUpdateId($_GET[PRODUCTS_ID_PROPERTY])->setUpdateField(self::$objProductsPropertyTableFId)->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(PRODUCTS_EDIT_PROPERTY))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objProductsPropertyTableFKey)->setLabel(new S(PRODUCTS_PROPERTY))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objProductsPropertyTableFVar)->setLabel(new S(PRODUCTS_VALUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'propertyErase':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(PRODUCTS_ACTION_PROPERTY, PRODUCTS_ID_PROPERTY)));
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objProductsPropertyTable)->doToken('%condition', new S('%objProductsPropertyTableFId = "%Id"'))->doToken('%Id', $_GET[PRODUCTS_ID_PROPERTY]));
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
         case 'imageCreate':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objProductsIMGTableFTitle)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objProductsIMGTableFTitle)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objProductsIMGTableFTitle, new S(PRODUCTS_IMAGE_TITLE_CANNOT_BE_EMPTY));
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(PRODUCTS_ADD_IMAGE))->setSQLAction(new S('update'))->setTableName(self::$objProductsIMGTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objProductsIMGTableFId)->setUploadDirectory(new S('products/images/' . $_GET[ADMIN_ACTION_ID]))->setUploadImageResize(new A(array(60 => 60, 100 => 100, 128 => 128, 320 => 240, 640 => 480, 800 => 600)))->setExtraUpdateData(self::$objProductsIMGTableFProdId, $_GET[ADMIN_ACTION_ID])->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setInputInfoMessage($this->getHELP($objFormToRender))->setValue(new S(PRODUCTS_ADD_IMAGE))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objProductsIMGTableFTitle)->setLabel(new S(PRODUCTS_IMAGE_TITLE))->setContainerDiv(new B(TRUE))->setInputType(new S('file'))->setName(self::$objProductsIMGTableFURL)->setLabel(new S(PRODUCTS_IMAGE))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objProductsIMGTableFCaption)->setLabel(new S(PRODUCTS_CAPTION))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'imageEdit':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(PRODUCTS_ACTION_IMAGE, PRODUCTS_ID_IMAGE)));
             // Do the form, make it happen;
             if ($this->checkPOST(self::$objProductsIMGTableFTitle)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objProductsIMGTableFTitle)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objProductsIMGTableFTitle, new S(PRODUCTS_IMAGE_TITLE_CANNOT_BE_EMPTY));
                 }
             }
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(PRODUCTS_EDIT_IMAGE))->setSQLAction(new S('update'))->setTableName(self::$objProductsIMGTable)->setUpdateId($_GET[PRODUCTS_ID_IMAGE])->setUpdateField(self::$objProductsIMGTableFId)->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setUploadDirectory(new S('products/images/' . $_GET[ADMIN_ACTION_ID]))->setUploadImageResize(new A(array(60 => 60, 100 => 100, 128 => 128, 320 => 240, 640 => 480, 800 => 600)))->setInputType(new S('submit'))->setValue(new S(PRODUCTS_EDIT_IMAGE))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objProductsIMGTableFTitle)->setLabel(new S(PRODUCTS_IMAGE_TITLE))->setContainerDiv(new B(TRUE))->setInputType(new S('file'))->setName(self::$objProductsIMGTableFURL)->setLabel(new S(PRODUCTS_IMAGE))->setFileController(new B(TRUE))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objProductsIMGTableFCaption)->setLabel(new S(PRODUCTS_CAPTION))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'imageErase':
             // Set the URL to back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(PRODUCTS_ACTION_IMAGE, PRODUCTS_ID_IMAGE)));
             // First, delete existing images;
             $objProductImages = $this->_Q(_QS('doSELECT')->doToken('%what', self::$objProductsIMGTableFURL)->doToken('%table', self::$objProductsIMGTable)->doToken('%condition', new S('WHERE %objProductsIMGTableFId = "%Id"'))->doToken('%Id', $_GET[PRODUCTS_ID_IMAGE]));
             // Knowing the images, delete THEM;
             foreach ($objProductImages as $k => $v) {
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '60_60_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '100_100_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '128_128_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '320_240_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '640_480_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '800_600_' . $v['url']);
             }
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Products.php

示例2: FilePath

<?php

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
# Load the authentication;
$NEWSLETTER = MOD::activateModule(new FilePath('mod/newsletter'), new B(TRUE));
$NEWSLETTER->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SUBPAGE)), new A(array(MANAGE_NEWSLETTER))), new S('Location'));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:19,代码来源:dashboard.php

示例3: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
  * We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'newsletterSearch':
             break;
         case 'newsletterCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objLetterTableFEML)->toBoolean() == TRUE) {
                 if ($this->checkSubscriberAddressIsUnique($this->getPOST(self::$objLetterTableFEML))->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objLetterTableFEML, new S(NEWSLETTER_EMAIL_MUST_BE_UNIQUE));
                 }
                 if ($this->getPOST(self::$objLetterTableFEML)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objLetterTableFEML, new S(NEWSLETTER_FIELD_IS_EMPTY));
                 }
             }
             if ($this->checkPOST(self::$objLetterTableFFirstName)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objLetterTableFFirstName)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objLetterTableFFirstName, new S(NEWSLETTER_FIELD_IS_EMPTY));
                 }
             }
             if ($this->checkPOST(self::$objLetterTableFLastName)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objLetterTableFLastName)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objLetterTableFLastName, new S(NEWSLETTER_FIELD_IS_EMPTY));
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(NEWSLETTER_ADD))->setSQLAction(new S('update'))->setTableName(self::$objLetterTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objLetterTableFId)->setExtraUpdateData(self::$objLetterTableFSubscribed, new S((string) time()))->setExtraUpdateData(self::$objLetterTableFConfirmed, new S('Y'));
             if ($this->checkPOST(self::$objLetterTableFEML)->toBoolean() == TRUE) {
                 $this->setRedirect($objURLToGoBack);
             }
             $this->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('submit'))->setValue(new S(NEWSLETTER_ADD))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFEML)->setLabel(new S(NEWSLETTER_EMAIL))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFFirstName)->setLabel(new S(NEWSLETTER_FIRSTNAME))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFLastName)->setLabel(new S(NEWSLETTER_LASTNAME))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objLetterTableFType)->setLabel(new S(NEWSLETTER_TYPE))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('nw_html'))->setValue(new S('HTML'))->setLabel(new S(NEWSLETTER_HTML))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('nw_txt'))->setValue(new S('PLAIN'))->setLabel(new S(NEWSLETTER_PLAIN))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setLabel(new S(NEWSLETTER_CATEGORY))->setName(self::$objLetterTableFCategoryId)->setContainerDiv(new B(TRUE));
             // Categories ...
             foreach ($this->getCategories() as $k => $v) {
                 $this->setInputType(new S('option'))->setName($v[self::$objMPTT->objIdField])->setValue($v[self::$objMPTT->objIdField])->setLabel(new S(str_repeat('--' . _SP, (int) $v['depth']->toString()) . MPTT::mpttRemoveUnique($v[self::$objMPTT->objNameOfNode])));
             }
             // Continue ...
             $this->setFormEndAndExecute(new B(TRUE));
             break;
         case 'newsletterEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do some work;
             if ($this->checkPOST(self::$objLetterTableFEML)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objLetterTableFEML) != $this->getSubscriberInfoById($_GET[ADMIN_ACTION_ID], self::$objLetterTableFEML)) {
                     if ($this->checkSubscriberAddressIsUnique($this->getPOST(self::$objLetterTableFEML))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objLetterTableFEML, new S(NEWSLETTER_EMAIL_MUST_BE_UNIQUE));
                     }
                 }
                 if ($this->getPOST(self::$objLetterTableFEML)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objLetterTableFEML, new S(NEWSLETTER_FIELD_IS_EMPTY));
                 }
             }
             if ($this->checkPOST(self::$objLetterTableFFirstName)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objLetterTableFFirstName)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objLetterTableFFirstName, new S(NEWSLETTER_FIELD_IS_EMPTY));
                 }
             }
             if ($this->checkPOST(self::$objLetterTableFLastName)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objLetterTableFLastName)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objLetterTableFLastName, new S(NEWSLETTER_FIELD_IS_EMPTY));
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(NEWSLETTER_EDIT))->setSQLAction(new S('update'))->setTableName(self::$objLetterTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objLetterTableFId);
             if ($this->checkPOST(self::$objLetterTableFEML)->toBoolean() == TRUE) {
                 $this->setRedirect($objURLToGoBack);
             }
             $this->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('submit'))->setValue(new S(NEWSLETTER_EDIT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFEML)->setLabel(new S(NEWSLETTER_EMAIL))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFFirstName)->setLabel(new S(NEWSLETTER_FIRSTNAME))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFLastName)->setLabel(new S(NEWSLETTER_LASTNAME))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objLetterTableFType)->setLabel(new S(NEWSLETTER_TYPE))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('nw_html'))->setValue(new S('HTML'))->setLabel(new S(NEWSLETTER_HTML))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('nw_txt'))->setValue(new S('PLAIN'))->setLabel(new S(NEWSLETTER_PLAIN))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setLabel(new S(NEWSLETTER_CATEGORY))->setName(self::$objLetterTableFCategoryId)->setContainerDiv(new B(TRUE));
             // Categories ...
             foreach ($this->getCategories() as $k => $v) {
                 $this->setInputType(new S('option'))->setName($v[self::$objMPTT->objIdField])->setValue($v[self::$objMPTT->objIdField])->setLabel(new S(str_repeat('--' . _SP, (int) $v['depth']->toString()) . MPTT::mpttRemoveUnique($v[self::$objMPTT->objNameOfNode])));
             }
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Newsletter.php

示例4: doCleanURLPath

 /**
  * Will clean the URL path, so that ALL key/var pairs get removed. This method is used to clean the URL to the BASE of the URL,
  * for example when yo want to restrict an URL (like administration) from "saved bookmarks" that won't be the same after the
  * code changes in time. It's a mantainance method that can be used to redirect back to a base URL;
  *
  * @return void Won't return a thing
  * @author Elena Ramona <no_reply@raphpframework.ro>
  * @copyright Under the terms of the GNU General Public License v3
  * @version $Id: 09_URL.php 313 2009-10-09 13:27:52Z catalin.zamfir $
  * @since Version 1.0
  * @access public
  * @static
  * @final
  */
 public static final function doCleanURLPath()
 {
     if ($_GET->doCount()->toInt() != 0) {
         $objFromGET = new A();
         foreach ($_GET as $k => $v) {
             $objFromGET[] = $k;
         }
         # Do the redirect;
         self::setHeaderKey(URL::rewriteURL($objFromGET), new S('Location'));
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:25,代码来源:09_URL.php

示例5: FilePath

<?php

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
# Load the authentication;
$FAQ = MOD::activateModule(new FilePath('mod/lyrics'), new B(TRUE));
$FAQ->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SUBPAGE)), new A(array(MANAGE_LYRICS))), new S('Location'));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:19,代码来源:dashboard.php

示例6: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form. We
  * have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality better;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'faqCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFQuestion)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_CANNOT_BE_EMPTY));
                 }
                 if ($this->checkFaqQuestionIsUnique($this->getPOST(self::$objFaqTableFQuestion))->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_MUST_BE_UNIQUE));
                 }
                 if ($this->checkFaqQuestionIsUnique(URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)))->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_URL_MUST_BE_UNIQUE));
                 }
             }
             if ($this->checkPOST(self::$objFaqTableFAnswer)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFAnswer)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFAnswer, new S(FAQ_ANSWER_CANNOT_BE_EMPTY));
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(FAQ_ADD_FAQ))->setSQLAction(new S('update'))->setTableName(self::$objFaqTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objFaqTableFId);
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objFaqTableFSEO, URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)));
             }
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(FAQ_ADD_FAQ))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objFaqTableFQuestion)->setLabel(new S(FAQ_QUESTION))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objFaqTableFAnswer)->setTinyMCETextarea(new B(TRUE))->setLabel(new S(FAQ_ANSWER))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'faqEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do some work;
             if ($this->checkPOST(self::$objFaqTableFAnswer)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFAnswer)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFAnswer, new S(FAQ_ANSWER_CANNOT_BE_EMPTY));
                 }
             }
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFQuestion)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_CANNOT_BE_EMPTY));
                 }
                 if ($this->getPOST(self::$objFaqTableFQuestion) != $this->getFaqInfoById($_GET[ADMIN_ACTION_ID], self::$objFaqTableFQuestion)) {
                     if ($this->checkFaqQuestionIsUnique($this->getPOST(self::$objFaqTableFQuestion))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_MUST_BE_UNIQUE));
                     }
                     if ($this->checkFaqQuestionIsUnique(URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_URL_MUST_BE_UNIQUE));
                     }
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(FAQ_EDIT_FAQ))->setSQLAction(new S('update'))->setTableName(self::$objFaqTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objFaqTableFId);
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objFaqTableFSEO, URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)));
             }
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setInputInfoMessage($this->getHELP($objFormToRender))->setValue(new S(FAQ_EDIT_FAQ))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objFaqTableFQuestion)->setLabel(new S(FAQ_QUESTION))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objFaqTableFAnswer)->setTinyMCETextarea(new B(TRUE))->setLabel(new S(FAQ_ANSWER))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'faqErase':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objFaqTable)->doToken('%condition', new S('%objFaqTableFId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do a redirect back;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:95,代码来源:00_Faq.php

示例7: FilePath

<?php

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
# Load the authentication;
$STG = MOD::activateModule(new FilePath('mod/settings'), new B(TRUE));
$STG->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SUBPAGE)), new A(array(SETTINGS_MANAGE_SETTINGS))), new S('Location'));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:19,代码来源:dashboard.php

示例8: FilePath

<?php

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
# Load the authentication;
$AUTH = MOD::activateModule(new FilePath('mod/authentication'), new B(TRUE));
$AUTH->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SUBPAGE)), new A(array(AUTHENTICATION_MANAGE_USERS))), new S('Location'));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:19,代码来源:dashboard.php

示例9: tieInWithAuthenticationMechanism

 /**
  * Will bind with the authentication mechanism;
  *
  * This method will take the authentication object as a parameter, as long as that object implements the IFaceAuthentication
  * interface. Thus we allow for different authentication schemes, without too much headache. Also, it will check that the
  * current administration zone exists in the database, because we need a proper mapping scheme;
  *
  * @param IFaceAuthentication $objAuthMech The authentication object, passed as a parameter;
  * @return void Doesn't return a thing. It will probably error if something goes wrong;
  */
 public function tieInWithAuthenticationMechanism(IFaceAuthentication $objAuthMech)
 {
     // Tie the authentication object with me;
     self::$objAuthenticationMech = $objAuthMech;
     // Get the administrative 'Log Out' <a href=";
     self::$objLogOutLink = URL::rewriteURL(new A(array(ADMIN_INTERFACE_ACTION)), new A(array(ADMIN_LOG_OUT)));
     self::$objSwitcherLink = URL::rewriteURL(new A(array(ADMIN_INTERFACE_ACTION)), new A(array(ADMIN_SWITCH_THEME)));
     // Set the proper ZONE;
     if (self::$objAuthenticationMech->checkZoneByName($this->getObjectCLASS())->toBoolean() == FALSE) {
         self::$objAuthenticationMech->doMakeZone($this->getObjectCLASS());
     }
     if (self::$objAuthenticationMech->checkAdministratorIsMappedToZone($this->getObjectCLASS())->toBoolean() == FALSE) {
         self::$objAuthenticationMech->doMapAdministratorToZone($this->getObjectCLASS());
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:25,代码来源:00_Administration.php

示例10: setFormHeaderOnInputStart

 /**
  * Will render the form header;
  *
  * This method will render the form start, meaning all the necesarry <form tags & attributes. Without a proper nesting of
  * tags, information cannot be passed properly by browsers to the PHP enabled server.
  *
  * @return void Doesn't return anything, cause it doesn't have to ...
  */
 private static function setFormHeaderOnInputStart()
 {
     self::convertPOSTToSESSIONString();
     if (self::$objFormStarted->toInt() == 0) {
         if (self::checkPOST()->toBoolean() == TRUE) {
             if (sizeof($_SESSION['POST']) != 0 && sizeof($_FILES) != 0) {
                 self::checkFILEOperationsOnForm();
             }
         }
         // Make an array, for data collection;
         $coreSetAttributes = new A();
         // Remember the fact that we started a <form ...
         self::$objFormStarted->setInt(1);
         // Set the <form .tp file;
         $tp = new FilePath(FORM_TP_DIR . _S . 'frm_input_form_started.tp');
         // Set core attributes;
         self::setCoreAttributes(self::$objFormDataContainer, $tp);
         // Set core <input event attributes;
         self::setCoreInputAttributes(self::$objFormDataContainer, $tp);
         foreach (self::$objFormDataContainer as $k => $v) {
             switch ($k) {
                 case 'action':
                     !empty($v) ? $coreSetAttributes[$k] = $v : ($coreSetAttributes[$k] = URL::rewriteURL());
                     break;
                 case 'fieldset':
                     // Set the form in a <fieldset;
                     self::$objFormInFieldSet->setInt(1);
                     $coreSetAttributes[$k] = $v;
                     break;
                 default:
                     $coreSetAttributes[$k] = $v;
                     break;
             }
         }
         self::tpSet($coreSetAttributes, new S('coreSetAttributes'), $tp, new S('explode'));
         self::tpExe($tp);
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:46,代码来源:13_FRM.php

示例11: FilePath

<?php

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
# Load the authentication;
$PRD = MOD::activateModule(new FilePath('mod/products'), new B(TRUE));
$PRD->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SUBPAGE)), new A(array(MANAGE_PRODUCTS))), new S('Location'));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:19,代码来源:dashboard.php

示例12: FilePath

<?php

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
// Load needed modules ...
if (isset($_GET[ADMIN_SUBPAGE])) {
    MOD::activateModule(new FilePath('mod/audio'), new B(TRUE))->renderBackendPage(new S('manageDashboard'));
} else {
    MOD::activateModule(new FilePath('mod/audio'), new B(TRUE))->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SUBPAGE)), new A(array(AUDIO_MANAGE_AUDIO))), new S('Location'));
}
开发者ID:ajbm6,项目名称:raphpframework,代码行数:22,代码来源:dashboard.php

示例13: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form. We
  * have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality better;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'widgetSearch':
             // Do the form, make it happen ...
             $this->setMethod(new S('POST'))->setName($objFormToRender);
             // Do some work ...
             if ($this->checkPOST(new S('search_lyrics'))->toBoolean() == TRUE) {
                 // Get the title, and check it's name ...
                 if ($this->getPOST(new S('lyrics_search_keyword'))->toLength()->toInt() == 0) {
                     // Well, sadly, we have an issue ...
                     $this->setErrorOnInput(new S('lyrics_search_keyword'), new S('Nu ai completat cautarea!'));
                 } else {
                     // Go ...
                     $this->setHeaderKey($objURLToGoBack = URL::staticURL(new A(array(FRONTEND_SECTION_URL, LYRICS_SEARCH_URL)), new A(array(FRONTEND_LYRICS_URL, $this->getPOST(new S('lyrics_search_keyword'))->entityDecode(ENT_QUOTES)->stripSlashes()))), new S('Location'));
                 }
             }
             // Continue ...
             $this->setInputType(new S('text'))->setName(new S('lyrics_search_keyword'));
             // If it's set ... add the VALUE ...
             if (isset($_GET[LYRICS_SEARCH_URL])) {
                 $this->setValue($_GET[LYRICS_SEARCH_URL]);
             }
             // Continue ...
             $this->setLabel(new S('Cuvant'))->setContainerDiv(new B(TRUE))->setInputType(new S('submit'))->setName(new S('search_lyrics'))->setValue(new S('Cauta'))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'lyricCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             $objErrorHappen = new B(FALSE);
             // Do some work;
             if ($this->checkPOST(self::$objLyricsTableFTitle)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFTitle)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFTitle, new S(LYRICS_TITLE_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             if ($this->checkPOST(self::$objLyricsTableFArtist)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFArtist)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFArtist, new S(LYRICS_ARTIST_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             if ($this->checkPOST(self::$objLyricsTableFAlbum)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFAlbum)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFAlbum, new S(LYRICS_ALBUM_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(LYRICS_ADD_LYRIC))->setSQLAction(new S('update'))->setTableName(self::$objLyricsTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objLyricsTableFId)->setExtraUpdateData(self::$objLyricsTableFDateAdded, new S((string) $_SERVER['REQUEST_TIME']));
             if ($this->checkPOST(self::$objLyricsTableFTitle)->toBoolean() == TRUE && $objErrorHappen->toBoolean() == FALSE) {
                 $this->setExtraUpdateData(self::$objLyricsTableFSEO, URL::getURLFromString(new S($this->getPOST(self::$objLyricsTableFTitle) . _U . $this->getPOST(self::$objLyricsTableFArtist) . _U . $this->getPOST(self::$objLyricsTableFAlbum) . _U . $_SERVER['REQUEST_TIME'])));
             }
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setInputInfoMessage($this->getHELP($objFormToRender))->setValue(new S(LYRICS_ADD_LYRIC))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLyricsTableFTitle)->setLabel(new S(LYRICS_TITLE))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLyricsTableFArtist)->setLabel(new S(LYRICS_ARTIST))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLyricsTableFAlbum)->setLabel(new S(LYRICS_ALBUM))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objLyricsTableFLyrics)->setLabel(new S(LYRICS_LYRIC))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'lyricEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             $objErrorHappen = new B(FALSE);
             // Do some work;
             if ($this->checkPOST(self::$objLyricsTableFTitle)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFTitle)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFTitle, new S(LYRICS_TITLE_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             if ($this->checkPOST(self::$objLyricsTableFArtist)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFArtist)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFArtist, new S(LYRICS_ARTIST_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Lyrics.php

示例14: doURLRoutingAndCLEANUp

 /**
  * Will do necessary URL routing and clean-up;
  *
  * While most of the times we will relly on static URLs, generated by our URL mechanism, most of the times we will need to be
  * able to modify the URL or redirect an user to a proper URL, if he has gone haywire. This method does just that, manages
  * the URL of the current requested page;
  */
 public function doURLRoutingAndCLEANUp()
 {
     // Redirect to HOME, if nothing set;
     if ($_GET->doCount()->toInt() == 0) {
         // Set the header key and go home my man ...
         TPL::setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
         TPL::setHeaderKey(URL::rewriteURL(new A(array(FRONTEND_SECTION_URL)), new A(array(FRONTEND_HOME))), new S('Location'));
     }
     // -- Fix the double www. and non-www;
     if (strpos(URL::rewriteURL(), '://www.') !== FALSE) {
         // Moved me permanently ...
         $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
         $this->setHeaderKey(URL::rewriteURL()->doToken('://www.', '://'), new S('Location'));
     }
     // -- Fix the OLD to NEW moving of REWRITE_ENGINE;
     if (strpos($_SERVER['REQUEST_URI'], 'index.php/') !== FALSE && REWRITE_ENGINE == TRUE) {
         // Moved me permanently ...
         $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
         $this->setHeaderKey(URL::rewriteURL()->doToken('index.php/', _NONE), new S('Location'));
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:28,代码来源:00_Frontend.php

示例15: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
  * We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFA = NULL)
 {
     // Make them defaults ...
     if ($objFA == NULL) {
         $objFA = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'contactForm':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array('Status')), new A(array('Ok')));
             // Set some requirements;
             $objPHPEMLRegExpCheck = new S(Authentication::REGEXP_PHP_CHECK_EMAIL);
             // Get some configuration parameters ...
             $objNameFrm = $objFA['form_name'];
             $objSubject = $objFA['field_subject'];
             $objEMAIL = $objFA['field_email'];
             $objMessage = $objFA['field_message'];
             $objSendFrm = $objFA['form_submit_contact'];
             $objErrorE = $objFA['error_must_enter_valid_email'];
             $objErrorM = $objFA['error_must_enter_message'];
             $objErrorI = $objFA['error_entered_email_not_valid'];
             // Do some work;
             if ($this->checkPOST(self::$objContactTableFEMAIL)->toBoolean() == TRUE) {
                 // Check the EMAIL was set;
                 if ($this->getPOST(self::$objContactTableFEMAIL)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objContactTableFEMAIL, $objErrorE);
                 }
             }
             if ($this->checkPOST(self::$objContactTableFMessage)->toBoolean() == TRUE) {
                 // Check the MESSAGE is not empty;
                 if ($this->getPOST(self::$objContactTableFMessage)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objContactTableFMessage, $objErrorM);
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S($objNameFrm))->setSQLAction(new S('update'))->setTableName(self::$objContactTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objContactTableFId)->setExtraUpdateData(self::$objContactTableFReceived, new S((string) $_SERVER['REQUEST_TIME']))->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('contact_submit'))->setValue($objSendFrm)->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objContactTableFSubjectId)->setLabel($objSubject)->setContainerDiv(new B(TRUE));
             // Get the subjects ...
             foreach ($this->getSubjects() as $k => $v) {
                 $this->setInputType(new S('option'))->setName($v[self::$objContactSubjectFId])->setValue($v[self::$objContactSubjectFId])->setLabel($v[self::$objContactSubjectFTitle]);
             }
             // Continue;
             $this->setInputType(new S('text'))->setName(self::$objContactTableFEMAIL)->setLabel($objEMAIL)->setRegExpType(new S('preg'))->setRegExpErrMsg($objErrorI)->setPHPRegExpCheck($objPHPEMLRegExpCheck)->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objContactTableFMessage)->setLabel($objMessage)->setRows(new S('10'))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             // Do some after work;
             if ($this->checkPOST(new S('contact_submit'))->toBoolean() == TRUE) {
                 if ($this->checkFormHasErrors()->toBoolean() == FALSE) {
                     // Set some requirements ...
                     $objMAIL = new MAIL();
                     // Set From: MAIL header;
                     $objMAIL->setFrom($this->getPOST(self::$objContactTableFEMAIL));
                     $objMAIL->doMAIL($this->getConfigKey(new S('contact_message_email')), $this->getSubjectInfoById($this->getPOST(self::$objContactTableFSubjectId), self::$objContactSubjectFTitle), $this->getPOST(self::$objContactTableFMessage));
                 }
                 // Do a redirect, to the ok page ... if everything is OK;
                 if ($this->checkFormHasErrors()->toBoolean() == FALSE) {
                     $this->setHeaderKey($objURLToGoBack, new S('Location'));
                 }
             }
             // Break out ...
             break;
         case 'messageSend':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do some work;
             if ($this->checkPOST(new S('submit_resend_message'))->toBoolean() == TRUE) {
                 // Set some requirements ...
                 $objTo = $this->getConfigKey(new S('contact_message_email'));
                 $objSubjectId = $this->getMessageInfoById($_GET[ADMIN_ACTION_ID], self::$objContactTableFSubjectId);
                 $objSubject = $this->getSubjectInfoById($objSubjectId, self::$objContactSubjectFTitle);
                 $objFrom = $this->getMessageInfoById($_GET[ADMIN_ACTION_ID], self::$objContactTableFEMAIL);
                 $objMessage = $this->getMessageInfoById($_GET[ADMIN_ACTION_ID], self::$objContactTableFMessage);
                 // Set some requirements ...
                 $objMAIL = new MAIL();
                 // Set From: MAIL header ...
                 $objMAIL->setFrom($objFrom);
                 $objMAIL->doMAIL($objTo, $objSubject, $objMessage);
                 // Do a redirect, and get the user back where he belongs;
                 $this->setHeaderKey($objURLToGoBack, new S('Location'));
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_RESEND_MESSAGE))->setName($objFormToRender)->setInputType(new S('submit'))->setName(new S('submit_resend_message'))->setValue(new S(CONTACT_RESEND_MESSAGE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Contact.php


注:本文中的URL::rewriteURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。