Beispiel #1
0
 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objWidgetToRender The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make an empty array if NULL ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // Do a switch ...
     switch ($objW) {
         case 'widgetList':
             // Set some SEO ... yah baby ...
             TPL::manageTTL($objWA['faq_questions_title']);
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
             TPL::tpSet($this->getFaqs(), new S('objFaqArray'), $tpF);
             TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
             TPL::tpExe($tpF);
             break;
     }
 }
Beispiel #2
0
 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objW The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make an empty array if NULL ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // XML & RSS: Do a switch ...
     switch ($objW) {
         case 'widgetXML':
             // Yo man ... woohoooooo ...
             foreach ($this->getPublishedArticles(new S('ORDER
             BY %objArticleTableFDatePublished DESC')) as $k => $v) {
                 // Set some requirements ...
                 $objDTE = date('Y-m-d', (int) $v[self::$objArticleTableFDatePublished]->toString());
                 $objLOC = URL::staticURL(new A(array(ARTICLES_ARTICLES_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objArticleTableFSEO], FRONTEND_ARTICLE_URL)));
                 // Get the (INNER) CHILD of every young SEO freak ...
                 $objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
                 // Set the XML Sitemap kids ...
                 $objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
                 $objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
                 $objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
                 $objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
             }
             // BK;
             break;
         case 'widgetRSS':
             // Yo man ... woohoooooo ...
             if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
                 // Get'em 30 ...
                 foreach ($this->getPublishedArticles(new S('ORDER BY %objArticleTableFDatePublished
                 DESC LIMIT 0, 30')) as $k => $v) {
                     // Set some requirements ...
                     $objDTE = date(DATE_RFC822, (int) $v[self::$objArticleTableFDatePublished]->toString());
                     $objLOC = URL::staticURL(new A(array(ARTICLES_ARTICLES_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objArticleTableFSEO], FRONTEND_ARTICLE_URL)));
                     $objDSC = $v[self::$objArticleTableFExcerpt]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
                     $objTTL = $v[self::$objArticleTableFTitle];
                     // Get the (INNER) CHILD of every young SEO freak ...
                     $objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
                     // Set the RSS kids ...
                     $objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
                     $objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
                     $objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
                 }
             }
             // BK;
             break;
     }
     // HTML: Do a switch ...
     switch ($objW) {
         case 'widgetCategoryList':
             // Set the template file ...
             if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), new I(180))) {
                 // Get the category to start from ...
                 if (isset($objWA['start_from_category'])) {
                     // Get the category LIST;
                     $objCategoryList = $this->getCategories(NULL, $objWA['start_from_category']);
                 } else {
                     // Get the category LIST;
                     $objCategoryList = $this->getCategories(NULL, NULL);
                 }
                 // Set the template file ...
                 TPL::tpSet($objCategoryList, new S('objCategoryList'), $tpF);
                 TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                 TPL::tpSet($this, new S('ART'), $tpF);
                 TPL::tpExe($tpF);
                 TPL::tpEnd($cId);
             }
             // BK;
             break;
         case 'widgetList':
             // Check some needed requirements ...
             if ($_GET[FRONTEND_SECTION_URL] == FRONTEND_ARTICLE_URL) {
                 // Set some requirements ...
                 $objPag = isset($_GET[ARTICLES_PAGE_URL]) ? $_GET[ARTICLES_PAGE_URL] : new S((string) 1);
                 if (isset($_GET[ARTICLES_ARTICLES_URL])) {
                     // Check that the article exists, before doing anything stupid ...
                     if ($this->checkArticleURLIsUnique($objURL = $_GET[ARTICLES_ARTICLES_URL])->toBoolean() == TRUE) {
                         // Make the proper header, at first ...
                         $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                         // Give me back my free hardcore, Quoth the server, '404' ...
                         $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                     } else {
                         // Update them views ...
                         $this->_Q(_QS('doUPDATE')->doToken('%table', self::$objArticleTable)->doToken('%condition', _S('%objArticleTableFViews = %objArticleTableFViews + 1
                         WHERE %objArticleTableFSEO = "%Id"')->doToken('%Id', $_GET[ARTICLES_ARTICLES_URL])));
                         // Do me SEO, yah baby! ... (add title and category name, cause we need it)
                         TPL::manageTTL($this->getArticleInfoByURL($objURL, self::$objArticleTableFTitle));
                         TPL::manageTTL(MPTT::mpttRemoveUnique($this->getCategoryInfoById($this->getArticleInfoByURL($objURL, self::$objArticleTableFCategoryId), self::$objCategoryTableFName)));
                         // Do me SEO, yah baby! ... (add keywords and description, for something extra)
                         TPL::manageTAG(new S('keywords'), $this->getArticleInfoByURL($objURL, self::$objArticleTableFTags));
                         TPL::manageTAG(new S('description'), $this->getArticleInfoByURL($objURL, self::$objArticleTableFTitle)->appendString(_DCSP)->appendString($this->getArticleInfoByURL($objURL, self::$objArticleTableFExcerpt))->doToken(_QOT, _NONE));
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . '-Item.tp');
                         TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                         TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                         TPL::tpSet($this->STG, new S('STG'), $tpF);
                         TPL::tpSet($objURL, new S('objURL'), $tpF);
                         TPL::tpSet($this, new S('ART'), $tpF);
                         TPL::tpExe($tpF);
                     }
                 } else {
                     if (isset($_GET[ARTICLES_CATEGORY_URL])) {
                         // Check that the category exists, before doing anything stupid ...
                         if ($this->checkCategoryURLIsUnique($objCat = $_GET[ARTICLES_CATEGORY_URL])->toBoolean() == TRUE) {
                             // Make the proper header, at first ...
                             $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                             // Give me back my free hardcore, Quoth the server, '404' ...
                             $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                         } else {
                             // Do me SEO, yah baby! ... (title and pagination to prev. duplicates)
                             TPL::manageTTL(_S(ARTICLES_PAGE_URL)->appendString(_SP)->appendString($objPag));
                             TPL::manageTTL(MPTT::mpttRemoveUnique($this->getCategoryInfoByURL($objCat, self::$objCategoryTableFName)));
                             // Do me SEO, yah baby! ... (add cat. descr)
                             if ($this->getCategoryInfoByURL($objCat, self::$objCategoryTableFDescription)->toLength()->toInt() != 0) {
                                 TPL::manageTAG(new S('description'), $this->getCategoryInfoByURL($objCat, self::$objCategoryTableFDescription)->entityDecode(ENT_QUOTES)->stripTags()->doToken(_QOT, _NONE)->doSubStr(0, META_DESCRIPTION_MAX)->appendString(_SP)->appendString(_DTE));
                             }
                             // Set some requirements ...
                             $objCnt = $this->getPublishedArticleCountForCategoryURL($objCat);
                             $objStk = $this->getStickyArticlesByCategoryURLAndPage($objCat, $objPag);
                             $objArt = $this->getPublishedArticlesByCategoryURLAndPage($objCat, $objPag);
                             $objInC = new B(TRUE);
                         }
                     } else {
                         // Do me SEO, yah baby! ...
                         TPL::manageTTL(_S(FRONTEND_ARTICLE_URL));
                         TPL::manageTTL(_S(ARTICLES_PAGE_URL)->appendString(_SP)->appendString($objPag));
                         // Set some requirements ...
                         $objCnt = $this->getPublishedArticleCount();
                         $objStk = $this->getStickyArticlesByPage($objPag);
                         $objArt = $this->getPublishedArticlesByPage($objPag);
                         $objInC = new B(FALSE);
                         $objCat = new S();
                     }
                     // Set the template file ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                     TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                     TPL::tpSet($objInC, new S('objInC'), $tpF);
                     TPL::tpSet($objCat, new S('objCat'), $tpF);
                     TPL::tpSet($objArt, new S('objArt'), $tpF);
                     TPL::tpSet($objStk, new S('objStk'), $tpF);
                     TPL::tpSet($this, new S('ART'), $tpF);
                     TPL::tpExe($tpF);
                     // Set them paginations ...
                     if ($objCnt->toInt() > (int) self::$objItemsPerPage->toString()) {
                         self::$objFrontend->setPagination($objCnt, new I((int) self::$objItemsPerPage->toString()));
                     }
                 }
             } else {
                 // Do the biggest error on the PLANET ...
                 self::renderScreenOfDeath(new S(__CLASS__), new S(ARTICLES_NEED_PROPER_SECTION), new S(ARTICLES_NEED_PROPER_SECTION_FIX));
             }
             // BK;
             break;
         case 'widgetComments':
             // Check if we have the proper URL enabled ...
             if (isset($_GET[ARTICLES_ARTICLES_URL])) {
                 // Check if the comments are enabled ...
                 if ($this->getArticleInfoByURL($_GET[ARTICLES_ARTICLES_URL], self::$objArticleTableFCanComment) == 'Y') {
                     // Set some requirements ...
                     $objCommentIsOk = new S();
                     $objShowComm = new B(TRUE);
                     $objComments = $this->getApprovedCommentsByArticleURL($_GET[ARTICLES_ARTICLES_URL], new S('ORDER BY %objCommentsTableFDate DESC'));
                     // Check for status ...
                     if (isset($_GET[ARTICLES_STATUS_URL])) {
                         if ($_GET[ARTICLES_STATUS_URL] == ARTICLES_STATUS_OK_URL) {
                             $objCommentIsOk = new S($objWA['comment_has_been_added']);
                         }
                     }
                     // Set some requirements ...
                     $objShowFrm = new B(TRUE);
                     // Check if we're allowed to show the comment form ...
                     if ($this->getConfigKey(new S('article_settings_article_auth_to_comment')) == 'Y') {
                         if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                             $objShowFrm = new B(TRUE);
                         } else {
                             $objShowFrm = new B(FALSE);
                         }
                     }
                     // Set the template file ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                     TPL::tpSet($objCommentIsOk, new S('objCommentIsOk'), $tpF);
                     TPL::tpSet($objComments, new S('objComments'), $tpF);
                     TPL::tpSet($objShowComm, new S('objShowComm'), $tpF);
                     TPL::tpSet($objShowFrm, new S('objShowFrm'), $tpF);
                     TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                     TPL::tpSet($this->STG, new S('STG'), $tpF);
                     TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                     TPL::tpExe($tpF);
                     // Do some work ...
                     if ($objShowFrm->toBoolean() == TRUE) {
                         if ($this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                             if ($this->getPOST(self::$objCommentsTableFComment)->toLength()->toInt() == 0) {
                                 $this->setErrorOnInput(self::$objCommentsTableFComment, new S($objWA['error_no_comment']));
                             }
                         }
                         if ($this->checkPOST(self::$objCommentsTableFName)->toBoolean() == TRUE) {
                             if ($this->getPOST(self::$objCommentsTableFName)->toLength()->toInt() == 0) {
                                 $this->setErrorOnInput(self::$objCommentsTableFName, new S($objWA['error_no_name']));
                             }
                         }
                         if ($this->checkPOST(self::$objCommentsTableFEML)->toBoolean() == TRUE) {
                             if ($this->getPOST(self::$objCommentsTableFEML)->toLength()->toInt() == 0) {
                                 $this->setErrorOnInput(self::$objCommentsTableFEML, new S($objWA['error_no_email']));
                             }
                         }
                         // Make the form ... (ya, outside the box ...);
                         $this->setMethod(new S('POST'))->setFieldset(new S($objWA['comment_add']))->setSQLAction(new S('update'))->setTableName(self::$objCommentsTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objCommentsTableFId)->setRedirect(URL::rewriteURL(new A(array(ARTICLES_STATUS_URL)), new A(array(ARTICLES_STATUS_OK_URL))))->setName(new S('commentForm'))->setExtraUpdateData(self::$objCommentsTableFDate, new S((string) time()))->setExtraUpdateData(self::$objCommentsTableFArticleId, $this->getArticleInfoByURL($_GET[ARTICLES_ARTICLES_URL], self::$objArticleTableFId))->setInputType(new S('submit'))->setValue(new S($objWA['comment_submit']))->setName(new S('submit'))->setContainerDiv(new B(TRUE));
                         // Check if the user is authenticated ...
                         if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                             // Set the RUId;
                             $this->setExtraUpdateData(self::$objCommentsTableFRUId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId));
                         } else {
                             // Set the other infos;
                             $this->setInputType(new S('text'))->setName(self::$objCommentsTableFName)->setLabel(new S($objWA['comment_name']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objCommentsTableFEML)->setLabel(new S($objWA['comment_email']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objCommentsTableFURL)->setLabel(new S($objWA['comment_website']))->setContainerDiv(new B(TRUE));
                         }
                         // Continue ...
                         $this->setInputType(new S('textarea'))->setName(self::$objCommentsTableFComment)->setLabel(new S($objWA['comment_message']))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setRows(new S('10'))->setContainerDiv(new B(TRUE));
                         // Notify ...
                         if ($this->checkFormHasErrors()->toBoolean() == FALSE && $this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                             // Get some needed requirements ..
                             $objURL = $_GET[ARTICLES_ARTICLES_URL];
                             if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                                 // Query the authentication ...
                                 $objUSR = $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFUName);
                             } else {
                                 // Or trust the FORM ...
                                 $objUSR = $this->getPOST(self::$objCommentsTableFName);
                             }
                             // Go and SP ... MAIL me ...
                             $objMAIL = new MAIL();
                             $objMAIL->doMAIL($this->STG->getConfigKey(new S('settings_website_notification_email')), new S(ARTICLES_COMMENT_HAS_BEEN_POSTED), $this->getHELP(new S('widgetCommentsCommentPosted'))->doToken('%u', $objUSR));
                         }
                         // End form and execute ...
                         $this->setFormEndAndExecute(new B(TRUE));
                     }
                 }
             }
             // BK;
             break;
     }
 }
Beispiel #3
0
 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objW The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make an empty array if NULL ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // XML & RSS: Do a switch ...
     switch ($objW) {
         case 'widgetXML':
             // BK;
             break;
         case 'widgetRSS':
             // BK;
             break;
     }
     // HTML: Do a switch ...
     switch ($objW) {
         case 'widgetCategoryList':
             // Set some requirements ...
             if ($objWA == NULL) {
                 $objWA = new A();
             }
             // Get the category to start from ...
             if (isset($objWA['start_from_category'])) {
                 // Get the category LIST;
                 $objCategoryList = $this->getCategories(NULL, $objWA['start_from_category']);
             } else {
                 // Get the category LIST;
                 $objCategoryList = $this->getCategories(NULL, NULL);
             }
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
             TPL::tpSet($objCategoryList, new S('objCategoryList'), $tpF);
             TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
             TPL::tpSet($this, new S('ART'), $tpF);
             TPL::tpExe($tpF);
             break;
         case 'widgetList':
             // Check some needed requirements ...
             if ($_GET[FRONTEND_SECTION_URL] == FRONTEND_PRODUCTS_URL) {
                 // Set some requirements ...
                 $objPag = isset($_GET[PRODUCTS_PAGE_URL]) ? $_GET[PRODUCTS_PAGE_URL] : new S((string) 1);
                 if (isset($_GET[PRODUCTS_ITEM_URL])) {
                     // Check that the article exists, before doing anything stupid ...
                     if ($this->checkProductURLIsUnique($objURL = $_GET[PRODUCTS_ITEM_URL])->toBoolean() == TRUE) {
                         // Make the proper header, at first ...
                         $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                         // Give me back my free hardcore, Quoth the server, '404' ...
                         $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                     } else {
                         // Do me SEO, yah baby! ...
                         TPL::manageTTL($this->getProductInfoByURL($objURL, self::$objProductsTableFName));
                         TPL::manageTAG(new S('description'), $this->getProductInfoByURL($objURL, self::$objProductsTableFDescription)->entityDecode(ENT_QUOTES)->stripTags()->doToken(_QOT, _NONE));
                         // Set some requirements ...
                         $objPathToItem = self::$objMPTT->mpttGetSinglePath($this->getCategoryInfoById($this->getProductInfoByURL($objURL, self::$objProductsTableFCategoryId), self::$objCategoryTableFName));
                         $objItemPpties = $this->getPropertiesByProductURL($objURL);
                         $objItemImages = $this->getImagesByProductURL($objURL);
                         if ($objItemImages->doCount()->toInt() != 0) {
                             $objItemHasImg = new B(TRUE);
                         } else {
                             $objItemHasImg = new B(FALSE);
                         }
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . '-Item.tp');
                         TPL::tpSet($objPathToItem, new S('objPathToItem'), $tpF);
                         TPL::tpSet($objItemPpties, new S('objItemPpties'), $tpF);
                         TPL::tpSet($objItemImages, new S('objItemImages'), $tpF);
                         TPL::tpSet($objItemHasImg, new S('objItemHasImg'), $tpF);
                         TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                         TPL::tpSet($objURL, new S('objURL'), $tpF);
                         TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                         TPL::tpSet($this->STG, new S('STG'), $tpF);
                         TPL::tpSet($this, new S('PRD'), $tpF);
                         TPL::tpExe($tpF);
                     }
                 } else {
                     if (isset($_GET[PRODUCTS_CATEGORY_URL])) {
                         // Check that the category exists, before doing anything stupid ...
                         if ($this->checkCategoryURLIsUnique($objCat = $_GET[PRODUCTS_CATEGORY_URL])->toBoolean() == TRUE) {
                             // Make the proper header, at first ...
                             $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                             // Give me back my free hardcore, Quoth the server, '404' ...
                             $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                         } else {
                             // Do me SEO, yah baby! ...
                             err('Here');
                         }
                     } else {
                         // Do me SEO, yah baby! ...
                         TPL::manageTTL(_S(FRONTEND_PRODUCTS_URL));
                         TPL::manageTTL(_S(PRODUCTS_PAGE_URL)->appendString(_SP)->appendString($objPag));
                         // Set some requirements ...
                         $objCnt = $this->getProductCount();
                         $objArt = $this->getProductsByPage($objPag);
                     }
                     // Set the template file ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                     TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                     TPL::tpSet($objArt, new S('objAr'), $tpF);
                     TPL::tpSet($this, new S('PRD'), $tpF);
                     TPL::tpExe($tpF);
                     // Set them paginations ...
                     if ($objCnt->toInt() > (int) self::$objItemsPerPage->toString()) {
                         self::$objFrontend->setPagination($objCnt, new I((int) self::$objItemsPerPage->toString()));
                     }
                 }
             } else {
                 // Do the biggest error on the PLANET ...
                 self::renderScreenOfDeath(new S(__CLASS__), new S(ARTICLES_NEED_PROPER_SECTION), new S(ARTICLES_NEED_PROPER_SECTION_FIX));
             }
             // BK;
             break;
     }
 }
Beispiel #4
0
 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objWidgetToRender The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make a default ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // Do a switch ...
     switch ($objW) {
         case 'widgetContactForm':
             // Set some requirements ...
             isset($_GET[CONTACT_STATUS_URL]) ? $objBIT = new B(FALSE) : ($objBIT = new B(TRUE));
             isset($_GET[CONTACT_STATUS_URL]) ? $objTXT = $this->getConfigKey(new S('contact_page_message_content_ok')) : ($objTXT = $this->getConfigKey(new S('contact_page_message_content')));
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
             TPL::tpSet($objTXT->entityDecode(ENT_QUOTES), new S('objContactText'), $tpF);
             TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
             TPL::tpSet($objBIT, new S('objShowForm'), $tpF);
             TPL::tpSet($this, new S('CNT'), $tpF);
             TPL::tpExe($tpF);
             // Do me SEO, yah baby! ...
             TPL::manageTTL(new S($objWA['page_title']));
             TPL::manageTAG(new S('description'), $this->getConfigKey(new S('contact_page_message_content'))->entityDecode(ENT_QUOTES)->stripTags()->doSubStr(0, META_DESCRIPTION_MAX)->appendString(_DTE));
             break;
     }
 }
Beispiel #5
0
    /**
     * Will render a requested widget;
     *
     * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
     * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
     * configuration options that control the way the widget functions or showns;
     *
     * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
     * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
     * the developer needs them;
     *
     * @param $objW The widget to render;
     * @return mixed Depends on the widget;
     */
    public function renderWidget(S $objW, A $objWA = NULL)
    {
        // Make an empty array if NULL ...
        if ($objWA == NULL) {
            $objWA = new A();
        }
        // XML & RSS: Do a switch ...
        switch ($objW) {
            case 'widgetXML':
                // Yo man ... woohoooooo ...
                foreach ($this->getApprovedAudioFiles(new S('ORDER
                BY %objAudioTableFUploadedDate DESC')) as $k => $v) {
                    // Set some requirements ...
                    $objDTE = date('Y-m-d', (int) $v[self::$objAudioTableFUploadedDate]->toString());
                    $objLOC = URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objAudioTableFSEO], FRONTEND_AUDIO_URL)));
                    // Get the (INNER) CHILD of every young SEO freak ...
                    $objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
                    // Set the XML Sitemap kids ...
                    $objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
                    $objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
                    $objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
                    $objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
                }
                // BK;
                break;
            case 'widgetRSS':
                // Yo man ... woohoooooo ...
                if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
                    // Get'em 30 ...
                    foreach ($this->getApprovedAudioFiles(new S('ORDER BY %objAudioTableFUploadedDate
                    DESC LIMIT 0, 30')) as $k => $v) {
                        // Set some requirements ...
                        $objDTE = date(DATE_RFC822, (int) $v[self::$objAudioTableFUploadedDate]->toString());
                        $objLOC = URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objAudioTableFSEO], FRONTEND_AUDIO_URL)));
                        $objTTL = $v[self::$objAudioTableFTitle]->appendString(_DCSP)->appendString($v[self::$objAudioTableFArtist])->appendString(_DCSP)->appendString($v[self::$objAudioTableFAlbum]);
                        $objDSC = $v[self::$objAudioTableFDescription]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
                        // Get the (INNER) CHILD of every young SEO freak ...
                        $objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
                        // Set the RSS kids ...
                        $objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
                        $objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
                        $objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
                        $objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
                        $objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
                    }
                }
                // BK;
                break;
        }
        // HTML: Do a switch ...
        switch ($objW) {
            case 'widgetCategoryList':
                // Set some requirements ...
                if (isset($objWA['cache_file'])) {
                    // Take the input;
                    $objCacheFile = $objWA['cache_file'];
                } else {
                    // Do cache me ...
                    $objCacheFile = new B(TRUE);
                }
                if (isset($objWA['cache_time'])) {
                    // Get the cache time from me;
                    $objCacheTime = $objWA['cache_time'];
                } else {
                    // Do a cache for: 6 hours;
                    $objCacheTime = new I(60 * 60 * 6);
                }
                // Set the template file ...
                if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), $objCacheTime, $objCacheFile)) {
                    // Get the category to start from ...
                    if (isset($objWA['start_from_category'])) {
                        // Get the category LIST;
                        $objCategoryList = $this->getCategories(NULL, $objWA['start_from_category']);
                    } else {
                        // Get the category LIST;
                        $objCategoryList = $this->getCategories(NULL, NULL);
                    }
                    // Set the template file ...
                    TPL::tpSet($objCategoryList, new S('objCategoryList'), $tpF);
                    TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                    TPL::tpSet($this, new S('AUD'), $tpF);
                    TPL::tpExe($tpF);
                    TPL::tpEnd($cId);
                }
                // BK;
                break;
            case 'widgetList':
                // Check some needed requirements ...
                if ($_GET[FRONTEND_SECTION_URL] == FRONTEND_AUDIO_URL) {
                    // Set some requirements ...
                    $objPag = isset($_GET[AUDIO_PAGE_URL]) ? $_GET[AUDIO_PAGE_URL] : new S((string) 1);
                    $objPag = new I((int) $objPag->toString());
                    // Fixes for a bugged user ...
                    if ($objPag->toInt() == 0) {
                        // Make the proper header, at first ...
                        $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                        // Give me back my free hardcore, Quoth the server, '404' ...
                        $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                    } else {
                        // Make it a string again ...
                        $objPag = new S((string) $objPag->toInt());
                    }
                    // Get your switches on ...
                    if (isset($_GET[AUDIO_ITEM_URL])) {
                        // Check that the article exists, before doing anything stupid ...
                        if ($this->checkAudioFileURLIsUnique($objURL = $_GET[AUDIO_ITEM_URL])->toBoolean() == TRUE) {
                            // Make the proper header, at first ...
                            $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                            // Give me back my free hardcore, Quoth the server, '404' ...
                            $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                        } else {
                            // Make me SEO ... yah!
                            TPL::manageTTL($objTTL = $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFTitle));
                            TPL::manageTTL($objART = $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFArtist));
                            TPL::manageTTL($objALB = $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFAlbum));
                            // SEO my category, little one ...
                            TPL::manageTTL($objCAT = MPTT::mpttRemoveUnique($this->getCategoryInfoById($this->getAudioFileInfoByURL($objURL, self::$objAudioTableFCategoryId), self::$objCategoryTableFName)));
                            // Get the published date ... we need it;
                            $objPBL = new S(date(self::$objFrontend->STG->getConfigKey(new S('settings_default_date_format')), (int) $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFUploadedDate)->toString()));
                            // Get the keywords ...
                            $objKEY = $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFDescription)->entityDecode(ENT_QUOTES)->stripTags();
                            // Get the description ...
                            $objDSC = $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFDescription)->entityDecode(ENT_QUOTES)->stripTags();
                            // Cut it down to size ...
                            if ($objDSC->toLength()->toInt() > META_DESCRIPTION_MAX) {
                                $objDSC->doSubStr(0, META_DESCRIPTION_MAX)->appendString(_SP)->appendString(_DTE);
                            }
                            if ($objKEY->toLength()->toInt() > META_DESCRIPTION_MAX) {
                                $objKEY->doSubStr(0, META_DESCRIPTION_MAX)->appendString(_SP)->appendString(_DTE);
                            }
                            // Only description if it's bigger ...
                            if ($objDSC->toLength()->toInt() != 0) {
                                $objDSC = $objDSC->prependString($objWA['audio_description'])->prependString(', ');
                            }
                            // Get the description ... but prepend it with the Title, Artist, Album ...
                            $objDSC->prependString($objPBL)->prependString($objWA['audio_uploaded_at'])->prependString(', ')->prependString($objCAT)->prependString($objWA['audio_genre'])->prependString(', ')->prependString($objALB)->prependString($objWA['audio_album'])->prependString(', ')->prependString($objART)->prependString($objWA['audio_artist'])->prependString(', ')->prependString($objTTL)->prependString($objWA['audio_title']);
                            // Add them LYRICS ...
                            if ($this->getAudioFileInfoByURL($objURL, self::$objAudioTableFLyrics)->toLength()->toInt() != 0) {
                                // Yes ...
                                $objHasLrc = new S('Da');
                            } else {
                                // Nop ...
                                $objHasLrc = new S('Nu');
                            }
                            // Add them DESCRIPTIONS ...
                            if ($this->getAudioFileInfoByURL($objURL, self::$objAudioTableFDescription)->toLength()->toInt() != 0) {
                                // Yes ...
                                $objHasDsc = new S('Da');
                            } else {
                                // Nop ...
                                $objHasDsc = new S('Nu');
                            }
                            // Modify the DESCRIPTION ...
                            $objDSC->appendString(', ')->appendString($objWA['audio_lyrics'])->appendString($objHasLrc);
                            $objDSC->appendString(', ')->appendString($objWA['audio_description'])->appendString($objHasDsc);
                            // Add the TAG, as we have description ...
                            TPL::manageTAG(new S('description'), $objDSC->entityEncode(ENT_QUOTES));
                            // Add the TAG, as we have keywords ...
                            if ($objKEY->toLength()->toInt() != 0) {
                                TPL::manageTAG(new S('keywords'), $objKEY->eregReplace('[^a-zA-Z0-9 -]', _NONE)->eregReplace(_SP, ', ')->eregReplace(', ,', ',')->entityEncode(ENT_QUOTES));
                            }
                            // Set some requirements ...
                            $objPathToItem = self::$objMPTT->mpttGetSinglePath($this->getCategoryInfoById($this->getAudioFileInfoByURL($objURL, self::$objAudioTableFCategoryId), self::$objCategoryTableFName));
                            // Update them views ...
                            $this->_Q(_QS('doUPDATE')->doToken('%table', self::$objAudioTable)->doToken('%condition', new S('%objAudioTableFViews = %objAudioTableFViews + 1
							WHERE %objAudioTableFSEO = "%Id"'))->doToken('%Id', $objURL));
                            // Set the template file ...
                            $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . '-Item' . TPL_EXTENSION);
                            TPL::tpSet($objPathToItem, new S('objPathToItem'), $tpF);
                            TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                            TPL::tpSet($objURL, new S('objURL'), $tpF);
                            TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                            TPL::tpSet($this->STG, new S('STG'), $tpF);
                            TPL::tpSet($this, new S('AUD'), $tpF);
                            TPL::tpExe($tpF);
                        }
                    } else {
                        if (isset($_GET[AUDIO_CATEGORY_URL])) {
                            // Check that the category exists, before doing anything stupid ...
                            if ($this->checkCategoryURLIsUnique($objCat = $_GET[AUDIO_CATEGORY_URL])->toBoolean() == TRUE) {
                                // Make the proper header, at first ...
                                $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                                // Give me back my free hardcore, Quoth the server, '404' ...
                                $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                            } else {
                                // Do me SEO, yah baby! ...
                                TPL::manageTTL(MPTT::mpttRemoveUnique($this->getCategoryInfoByURL($objCat, self::$objCategoryTableFName)));
                                // Make a condition to avoid dup. title tags on different pages ...
                                if ((int) $objPag->toString() >= 1 && isset($_GET[AUDIO_PAGE_URL])) {
                                    TPL::manageTTL(_S(AUDIO_PAGE_URL)->appendString(_SP)->appendString($objPag));
                                }
                                // Set some requirements ...
                                $objCnt = $this->getApprovedAudioFileCountForCategoryURL($objCat);
                                $objArt = $this->getApprovedAudioFilesByCategoryURLAndPage($objCat, $objPag);
                            }
                        } else {
                            if (isset($_GET[AUDIO_SEARCH_URL])) {
                                // Get audio by page ...
                                $objCnt = $this->getApprovedAudioFileCountForSearch($_GET[AUDIO_SEARCH_URL]);
                                $objArt = $this->getApprovedAudioFilesByPageAndSearch($objPag, $_GET[AUDIO_SEARCH_URL]);
                            } else {
                                // Do me SEO, yah baby! ...
                                TPL::manageTTL(_S(FRONTEND_AUDIO_URL));
                                // Make a condition to avoid dup. title tags on different pages ...
                                if ((int) $objPag->toString() >= 1 && isset($_GET[AUDIO_PAGE_URL])) {
                                    TPL::manageTTL(_S(AUDIO_PAGE_URL)->appendString(_SP)->appendString($objPag));
                                }
                                // Set some requirements ...
                                $objArt = $this->getApprovedAudioFilesByPage($objPag);
                                $objCnt = $this->getApprovedAudioFileCount();
                            }
                        }
                        // Set the template file ...
                        $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                        TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                        TPL::tpSet($objArt, new S('objAr'), $tpF);
                        TPL::tpExe($tpF);
                        // Set them paginations ...
                        if ($objCnt->toInt() > (int) self::$objItemsPerPage->toString()) {
                            self::$objFrontend->setPagination($objCnt, new I((int) self::$objItemsPerPage->toString()));
                        }
                    }
                } else {
                    // Do the biggest error on the PLANET ...
                    self::renderScreenOfDeath(new S(__CLASS__), new S(AUDIO_NEED_PROPER_SECTION), new S(AUDIO_NEED_PROPER_SECTION_FIX));
                }
                // BK;
                break;
            case 'widgetComments':
                // Check if we have the proper URL enabled ...
                if (isset($_GET[AUDIO_ITEM_URL])) {
                    // Check if the comments are enabled ...
                    if ($this->getAudioFileInfoByURL($objURL = $_GET[AUDIO_ITEM_URL], self::$objAudioTableFCanComment) == 'Y') {
                        // Set some requirements ...
                        $objCommentIsOk = new S();
                        $objComments = $this->getApprovedCommentsByAudioFileURL($_GET[AUDIO_ITEM_URL], new S('ORDER BY %objCommentsTableFDate DESC'));
                        // Check for status ...
                        if (isset($_GET[AUDIO_STATUS_URL])) {
                            if ($_GET[AUDIO_STATUS_URL] == AUDIO_STATUS_OK_URL) {
                                $objCommentIsOk = new S($objWA['comment_has_been_added']);
                            }
                        }
                        // Set the template file ...
                        $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                        TPL::tpSet($objCommentIsOk, new S('objCommentIsOk'), $tpF);
                        TPL::tpSet($objComments, new S('objComments'), $tpF);
                        TPL::tpSet($this->STG, new S('STG'), $tpF);
                        TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                        TPL::tpExe($tpF);
                        // Set some requirements ...
                        $objShowFrm = new B(TRUE);
                        // Check if we're allowed to show the comment form ...
                        if ($this->getConfigKey(new S('audio_settings_audio_auth_to_comment')) == 'Y') {
                            if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                                // To show ... or not ...
                                $objShowFrm = new B(TRUE);
                            } else {
                                // to show ... or not ...
                                $objShowFrm = new B(FALSE);
                            }
                        }
                        // Do some work ...
                        if ($objShowFrm->toBoolean() == TRUE) {
                            if ($this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                                if ($this->getPOST(self::$objCommentsTableFComment)->toLength()->toInt() == 0) {
                                    $this->setErrorOnInput(self::$objCommentsTableFComment, new S($objWA['error_no_comment']));
                                }
                            }
                            if ($this->checkPOST(self::$objCommentsTableFName)->toBoolean() == TRUE) {
                                if ($this->getPOST(self::$objCommentsTableFName)->toLength()->toInt() == 0) {
                                    $this->setErrorOnInput(self::$objCommentsTableFName, new S($objWA['error_no_name']));
                                }
                            }
                            if ($this->checkPOST(self::$objCommentsTableFEML)->toBoolean() == TRUE) {
                                if ($this->getPOST(self::$objCommentsTableFEML)->toLength()->toInt() == 0) {
                                    $this->setErrorOnInput(self::$objCommentsTableFEML, new S($objWA['error_no_email']));
                                }
                            }
                            // Make the form ... (ya, outside the box ...);
                            $this->setMethod(new S('POST'))->setFieldset(new S($objWA['comment_add']))->setSQLAction(new S('update'))->setTableName(self::$objCommentsTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objCommentsTableFId);
                            if ($this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                                $this->setRedirect(URL::rewriteURL(new A(array(AUDIO_STATUS_URL)), new A(array(AUDIO_STATUS_OK_URL))));
                            }
                            $this->setName(new S('commentForm'))->setExtraUpdateData(self::$objCommentsTableFDate, new S((string) time()))->setExtraUpdateData(self::$objCommentsTableFAudioFileId, $this->getAudioFileInfoByURL($_GET[AUDIO_ITEM_URL], self::$objAudioTableFId))->setInputType(new S('submit'))->setValue(new S($objWA['comment_submit']))->setName(new S('submit'))->setContainerDiv(new B(TRUE));
                            // Check if the user is authenticated ...
                            if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                                // Set the RUId;
                                $this->setExtraUpdateData(self::$objCommentsTableFRUId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId));
                            } else {
                                // Set the other infos;
                                $this->setInputType(new S('text'))->setName(self::$objCommentsTableFName)->setLabel(new S($objWA['comment_name']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objCommentsTableFEML)->setLabel(new S($objWA['comment_email']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objCommentsTableFURL)->setLabel(new S($objWA['comment_website']))->setContainerDiv(new B(TRUE));
                            }
                            // Continue ...
                            $this->setInputType(new S('textarea'))->setName(self::$objCommentsTableFComment)->setLabel(new S($objWA['comment_message']))->setRows(new S('10'))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setContainerDiv(new B(TRUE));
                            // Notify ...
                            if ($this->checkFormHasErrors()->toBoolean() == FALSE && $this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                                if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                                    // Query the authentication ...
                                    $objUSR = $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFUName);
                                } else {
                                    // Or trust the FORM ...
                                    $objUSR = $this->getPOST(self::$objCommentsTableFName);
                                }
                                // Go and SP ... MAIL me ...
                                $objMAIL = new MAIL();
                                $objMAIL->doMAIL($this->STG->getConfigKey(new S('settings_website_notification_email')), new S(AUDIO_COMMENT_HAS_BEEN_POSTED), $this->getHELP(new S('widgetCommentsCommentPosted'))->doToken('%t', $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFTitle))->doToken('%a', $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFArtist))->doToken('%b', $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFAlbum))->doToken('%u', $objUSR));
                                // Go deeper and notify them users ...
                                $objCommentsForItem = $this->getCommentsByAudioFileURL($objURL);
                                foreach ($objCommentsForItem as $k => $v) {
                                    $objMAIL = new MAIL();
                                    $objMAIL->doMAIL($this->ATH->getUserInfoById($v[self::$objCommentsTableFRUId], Authentication::$objAuthUsersTableFEML), new S(AUDIO_COMMENT_HAS_BEEN_POSTED), $this->getHELP(new S('widgetCommentsCommentPostedFrontend'))->doToken('%t', $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFTitle))->doToken('%a', $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFArtist))->doToken('%b', $this->getAudioFileInfoByURL($objURL, self::$objAudioTableFAlbum))->doToken('%u', $objUSR)->doToken('%k', URL::rewriteURL()));
                                }
                            }
                            // End form and execute ...
                            $this->setFormEndAndExecute(new B(TRUE));
                        }
                    }
                }
                // BK;
                break;
            case 'widgetUploadForm':
                // Ya, checking the STATUS ...
                if (isset($_GET[AUDIO_STATUS_URL])) {
                    // Get me going my dear one ...
                    $objConfKey = new S('audio_settings_audio_form_page_status_ok');
                    $objShowFrm = new B(FALSE);
                } else {
                    // Get me going my dear one ...
                    $objConfKey = new S('audio_settings_audio_form_page');
                    $objShowFrm = new B(TRUE);
                }
                // If we're NOT authenticated ... bang, you're DEAD ...
                if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == FALSE) {
                    // Get me going my dear one ...
                    $objConfKey = new S('audio_settings_audio_form_not_authenticated');
                    $objShowFrm = new B(FALSE);
                }
                // Set the template file ...
                $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                TPL::tpSet($this->getConfigKey($objConfKey), new S('objContent'), $tpF);
                TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                TPL::tpSet($objShowFrm, new S('objShowForm'), $tpF);
                TPL::tpSet($this, new S('AUD'), $tpF);
                TPL::tpExe($tpF);
                break;
            case 'widgetLastN':
                // Do CACHE ...
                if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), new I(180))) {
                    // Set the template file ...
                    TPL::tpSet($this->getApprovedAudioFiles(_S('ORDER BY %objAudioTableFUploadedDate DESC LIMIT 0, %UpperLimit')->doToken('%UpperLimit', $objWA['audio_n_count'])), new S('objLastN'), $tpF);
                    TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                    TPL::tpSet($this, new S('AUD'), $tpF);
                    TPL::tpExe($tpF);
                    TPL::tpEnd($cId);
                }
                // BK;
                break;
            case 'widgetRandomN':
                // Do CACHE ...
                if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), new I(180))) {
                    // Set the template file ...
                    TPL::tpSet($this->getApprovedAudioFiles(_S('ORDER BY RAND() LIMIT 0, %UpperLimit')->doToken('%UpperLimit', $objWA['audio_n_count'])), new S('objRandomN'), $tpF);
                    TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                    TPL::tpSet($this, new S('AUD'), $tpF);
                    TPL::tpExe($tpF);
                    TPL::tpEnd($cId);
                }
                // BK;
                break;
            case 'widgetRelatedN':
                // Do CACHE ...
                if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), new I(180))) {
                    // Set the template file ...
                    TPL::tpSet($this->getApprovedAudioFiles(_S('AND %objAudioTableFArtist LIKE "%Id" LIMIT 0, %UpperLimit')->doToken('%Id', $this->getAudioFileInfoByURL($objWA['audio_song_item'], self::$objAudioTableFArtist))->doToken('%UpperLimit', $objWA['audio_n_count'])), new S('objRandomN'), $tpF);
                    TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                    TPL::tpSet($this, new S('AUD'), $tpF);
                    TPL::tpExe($tpF);
                    TPL::tpEnd($cId);
                }
                // BK;
                break;
            case 'widgetTopN':
                // Do CACHE ...
                if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), new I(180))) {
                    // Set the template file ...
                    TPL::tpSet($this->getApprovedAudioFiles(_S('ORDER BY %objAudioTableFViews DESC LIMIT 0, %UpperLimit')->doToken('%UpperLimit', $objWA['audio_n_count'])), new S('objRandomN'), $tpF);
                    TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                    TPL::tpSet($this, new S('AUD'), $tpF);
                    TPL::tpExe($tpF);
                    TPL::tpEnd($cId);
                }
                // BK;
                break;
            case 'widgetRandomItem':
                // Do some work ...
                if ($this->checkPOST(new S('search_random_item'))->toBoolean() == TRUE) {
                    // Get me there ... quick ...
                    $this->setHeaderKey(URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($this->getApprovedAudioFiles(_S('ORDER BY RAND() LIMIT 1'))->offsetGet(0)->offsetGet(self::$objAudioTableFSEO), FRONTEND_AUDIO_URL))), new S('Location'));
                }
                // Do the form, make it happen ...
                $this->setMethod(new S('POST'))->setName(new S('audioRandomItem'))->setInputType(new S('submit'))->setName(new S('search_random_item'))->setValue(new S($objWA['audio_random']))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
                break;
        }
    }
Beispiel #6
0
 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objW The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make an empty array if NULL ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // XML & RSS: Do a switch ...
     switch ($objW) {
         case 'widgetXML':
             // Yo man ... woohoooooo ...
             foreach ($this->getTexts(new S('ORDER
             BY %objTextTableFDatePublished DESC')) as $k => $v) {
                 // Set some requirements ...
                 $objSEC = $this->getCategoryInfoById($v[self::$objTextTableFCategoryId], self::$objCategoryTableFSEO);
                 $objDTE = date('Y-m-d', (int) $v[self::$objTextTableFDatePublished]->toString());
                 $objLOC = URL::staticURL(new A(array(TEXTS_TEXTS_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objTextTableFSEO], $objSEC)));
                 // Get the (INNER) CHILD of every young SEO freak ...
                 $objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
                 // Set the XML Sitemap kids ...
                 $objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
                 $objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
                 $objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
                 $objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
             }
             // BK;
             break;
         case 'widgetRSS':
             // Yo man ... woohoooooo ...
             if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
                 // Get'em 30 ...
                 foreach ($this->getTexts(new S('ORDER BY %objTextTableFDatePublished
                 DESC LIMIT 0, 30')) as $k => $v) {
                     // Set some requirements ...
                     $objSEC = $this->getCategoryInfoById($v[self::$objTextTableFCategoryId], self::$objCategoryTableFSEO);
                     $objDTE = date(DATE_RFC822, (int) $v[self::$objTextTableFDatePublished]->toString());
                     $objLOC = URL::staticURL(new A(array(TEXTS_TEXTS_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objTextTableFSEO], $objSEC)));
                     $objDSC = $v[self::$objTextTableFContent]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
                     $objTTL = $v[self::$objTextTableFTitle];
                     // Get the (INNER) CHILD of every young SEO freak ...
                     $objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
                     // Set the RSS kids ...
                     $objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
                     $objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
                     $objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
                 }
             }
             // BK;
             break;
     }
     // HTML: Do a switch ...
     switch ($objW) {
         case 'widgetCategoryList':
             // Set some requirements, if not set ...
             if ($objWA == NULL) {
                 $objWA = new A();
             }
             // Get the category to start from ...
             if (isset($objWA['start_from_category'])) {
                 // Get the category LIST;
                 $objCategoryList = $this->getCategories(NULL, $objWA['start_from_category']);
             } else {
                 // Get the category LIST;
                 $objCategoryList = $this->getCategories(NULL, NULL);
             }
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
             TPL::tpSet($objCategoryList, new S('objCategoryList'), $tpF);
             TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
             TPL::tpSet($this, new S('TXT'), $tpF);
             TPL::tpExe($tpF);
             break;
         case 'widgetList':
             // Do some checking ... before anything ...
             if (isset($_GET[TEXTS_TEXTS_URL])) {
                 // Check or redirect ...
                 if ($this->checkTextExistsByURL($_GET[TEXTS_TEXTS_URL])->toBoolean() == FALSE) {
                     // The text does not exist, than redirect to 404;
                     $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
                     $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                 } else {
                     // Get the TEXT ...
                     $objTextCNT = $this->getTextInfoByURL($_GET[TEXTS_TEXTS_URL], self::$objTextTableFContent);
                     $objTextTTL = $this->getTextInfoByURL($_GET[TEXTS_TEXTS_URL], self::$objTextTableFTitle);
                     $objTextKEY = $this->getTextInfoByURL($_GET[TEXTS_TEXTS_URL], self::$objTextTableFTags);
                     $objTextDSC = clone $objTextTTL;
                     // Set the title, keywords, description ...
                     TPL::manageTTL($objTextTTL);
                     TPL::manageTAG(new S('keywords'), $objTextKEY->entityEncode(ENT_QUOTES));
                     TPL::manageTAG(new S('description'), $objTextDSC->entityEncode(ENT_QUOTES));
                     // Set the template file ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . '-Item' . TPL_EXTENSION);
                     TPL::tpSet($objTextTTL, new S('objTextTTL'), $tpF);
                     TPL::tpSet($objTextCNT, new S('objTextCNT'), $tpF);
                     TPL::tpSet($this, new S('TXT'), $tpF);
                     TPL::tpExe($tpF);
                 }
             } else {
                 // Get the CATEGORY ...
                 if ($this->checkCategoryExistsByURL($_GET[FRONTEND_SECTION_URL])->toBoolean() == FALSE) {
                     // The category does not exist, than redirect to 404;
                     $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
                     $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                 } else {
                     // Get something from db ...
                     $objCategoryArray = $this->getTextsByCategoryURL($_GET[FRONTEND_SECTION_URL]);
                     // Check how many texts are defined for it ...
                     switch ($objCategoryArray->doCount()->toInt()) {
                         // If we have only ONE text, defined for a category,
                         // we then recommend moving to that text ...
                         case 1:
                             // MOVED ... permanently ...
                             $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
                             $this->setHeaderKey(URL::rewriteURL(new A(array(TEXTS_TEXTS_URL, FRONTEND_SECTION_URL)), new A(array($objCategoryArray[0][self::$objTextTableFSEO], $_GET[FRONTEND_SECTION_URL]))), new S('Location'));
                             break;
                             // In case we don't have any text defined,
                             // we recommend showing a default message.
                         // In case we don't have any text defined,
                         // we recommend showing a default message.
                         case 0:
                             break;
                             // And finally, if we have more than one, then
                             // we recommend showing a LIST, by default reversed ...
                         // And finally, if we have more than one, then
                         // we recommend showing a LIST, by default reversed ...
                         default:
                             // Set the title, keywords, description ...
                             TPL::manageTTL($objCategoryNME = $this->getCategoryInfoByURL($objCategoryURL = $_GET[FRONTEND_SECTION_URL], self::$objCategoryTableFName));
                             TPL::manageTAG(new S('description'), $objCategoryNME);
                             // Set the template file ...
                             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                             TPL::tpSet($objCategoryArray->arrayReverse(), new S('objCategoryArray'), $tpF);
                             TPL::tpSet($objCategoryURL, new S('objCategory'), $tpF);
                             TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                             TPL::tpSet($this, new S('TXT'), $tpF);
                             TPL::tpExe($tpF);
                             break;
                     }
                 }
             }
             // Break out ...
             break;
         case 'widgetComments':
             // Check if we have the proper URL enabled ...
             if (isset($_GET[TEXTS_TEXTS_URL])) {
                 // Check if the comments are enabled ...
                 if ($this->getTextInfoByURL($objURL = $_GET[TEXTS_TEXTS_URL], self::$objTextTableFCanComment) == 'Y') {
                     // Set some requirements ...
                     $objCommentIsOk = new S();
                     $objComments = $this->getApprovedCommentsByTextURL($_GET[TEXTS_TEXTS_URL], new S('ORDER BY %objCommentsTableFDate DESC'));
                     // Check for status ...
                     if (isset($_GET[TEXTS_STATUS_URL])) {
                         if ($_GET[TEXTS_STATUS_URL] == TEXTS_STATUS_OK_URL) {
                             $objCommentIsOk = new S($objWA['comment_has_been_added']);
                         }
                     }
                     // Set the template file ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                     TPL::tpSet($objCommentIsOk, new S('objCommentIsOk'), $tpF);
                     TPL::tpSet($objComments, new S('objComments'), $tpF);
                     TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                     TPL::tpSet($this->STG, new S('STG'), $tpF);
                     TPL::tpExe($tpF);
                     // Set some requirements ...
                     $objShowFrm = new B(TRUE);
                     // Check if we're allowed to show the comment form ...
                     if ($this->getConfigKey(new S('texts_settings_authenticated_to_comment')) == 'Y') {
                         if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                             $objShowFrm = new B(TRUE);
                         } else {
                             $objShowFrm = new B(FALSE);
                         }
                     }
                     // Do some work ...
                     if ($objShowFrm->toBoolean() == TRUE) {
                         if ($this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                             if ($this->getPOST(self::$objCommentsTableFComment)->toLength()->toInt() == 0) {
                                 $this->setErrorOnInput(self::$objCommentsTableFComment, new S($objWA['error_no_comment']));
                             }
                         }
                         if ($this->checkPOST(self::$objCommentsTableFName)->toBoolean() == TRUE) {
                             if ($this->getPOST(self::$objCommentsTableFName)->toLength()->toInt() == 0) {
                                 $this->setErrorOnInput(self::$objCommentsTableFName, new S($objWA['error_no_name']));
                             }
                         }
                         if ($this->checkPOST(self::$objCommentsTableFEML)->toBoolean() == TRUE) {
                             if ($this->getPOST(self::$objCommentsTableFEML)->toLength()->toInt() == 0) {
                                 $this->setErrorOnInput(self::$objCommentsTableFEML, new S($objWA['error_no_email']));
                             }
                         }
                         // Make the form ... (ya, outside the box ...);
                         $this->setMethod(new S('POST'))->setFieldset(new S($objWA['comment_add']))->setSQLAction(new S('update'))->setTableName(self::$objCommentsTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objCommentsTableFId);
                         if ($this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                             $this->setRedirect(URL::rewriteURL(new A(array(TEXTS_STATUS_URL)), new A(array(TEXTS_STATUS_OK_URL))));
                         }
                         $this->setName(new S('commentForm'))->setExtraUpdateData(self::$objCommentsTableFDate, new S((string) time()))->setExtraUpdateData(self::$objCommentsTableFTextId, $this->getTextInfoByURL($_GET[TEXTS_TEXTS_URL], self::$objTextTableFId))->setInputType(new S('submit'))->setValue(new S($objWA['comment_submit']))->setName(new S('submit'))->setContainerDiv(new B(TRUE));
                         // Check if the user is authenticated ...
                         if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                             // Set the RUId;
                             $this->setExtraUpdateData(self::$objCommentsTableFRUId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId));
                         } else {
                             // Set the other infos;
                             $this->setInputType(new S('text'))->setName(self::$objCommentsTableFName)->setLabel(new S($objWA['comment_name']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objCommentsTableFEML)->setLabel(new S($objWA['comment_email']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objCommentsTableFURL)->setLabel(new S($objWA['comment_website']))->setContainerDiv(new B(TRUE));
                         }
                         // Continue ...
                         $this->setInputType(new S('textarea'))->setName(self::$objCommentsTableFComment)->setLabel(new S($objWA['comment_message']))->setRows(new S('10'))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setContainerDiv(new B(TRUE));
                         // Notify ...
                         if ($this->checkFormHasErrors()->toBoolean() == FALSE && $this->checkPOST(self::$objCommentsTableFComment)->toBoolean() == TRUE) {
                             if ($this->ATH->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
                                 // Query the authentication ...
                                 $objUSR = $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFUName);
                             } else {
                                 // Or trust the FORM ...
                                 $objUSR = $this->getPOST(self::$objCommentsTableFName);
                             }
                             // Go and SP ... MAIL me ...
                             $objMAIL = new MAIL();
                             $objMAIL->doMAIL($this->STG->getConfigKey(new S('settings_website_notification_email')), new S(TEXTS_COMMENT_HAS_BEEN_POSTED), $this->getHELP(new S('widgetCommentsEMLNotifyAdmin'))->doToken('%u', $objUSR));
                             // Go deeper and notify them users ...
                             $objCommentsForItem = $this->getCommentsByTextURL($objURL);
                             foreach ($objCommentsForItem as $k => $v) {
                                 $objMAIL = new MAIL();
                                 $objMAIL->doMAIL($this->ATH->getUserInfoById($v[Texts::$objCommentsTableFRUId], Authentication::$objAuthUsersTableFEML), new S(TEXTS_COMMENT_HAS_BEEN_POSTED), $this->getHELP(new S('widgetCommentsEMLNotifyUsers'))->doToken('%u', $objUSR)->doToken('%k', URL::rewriteURL()));
                             }
                         }
                         // End form and execute ...
                         $this->setFormEndAndExecute(new B(TRUE));
                     }
                 }
             }
             // Break out ...
             break;
     }
 }
 /**
  * Will tie in ALL registered administrator interfaces in the framework;
  *
  * This method will do a scan of all modules defined in the framework, and WILL do a CALL to each bonding method of those
  * respective methods; For the Authentication and Administration module, proper code is implemented, because of the strict
  * bonding between these two modules;
  * @return void Will not return a thing, but probably error if something goes wrong;
  */
 private function tieALLRegisteredAdminInterfaces()
 {
     // Set some predefined defaults, just to be sure we have something;
     TPL::manageTTL(self::$objHeaderText);
     TPL::switchTTL();
     // Add the current page, or subpage to the <title> ...
     TPL::manageTTL(isset($_GET[ADMIN_PAGE]) ? $_GET[ADMIN_PAGE] : new S());
     TPL::manageTTL(isset($_GET[ADMIN_SUBPAGE]) ? $_GET[ADMIN_SUBPAGE] : new S());
     // Do a for-each on ALL registered modules within' the framework;
     $objRegisteredModules = $this->getRegisteredModules();
     foreach ($objRegisteredModules as $k => $v) {
         // IGNORE: Administration, because it's manually tied;
         if ($this->getPathToModule()->toRelativePath() == $v['dir']->toString()) {
             $this->tieInWithAdministration($this);
             continue;
         }
         // IGNORE: Authentication, because it's manually tied;
         if ($this->getObjectCLASS(self::$objAuthenticationMech) == $v['obj']) {
             if (self::$objAuthenticationMech->checkCurrentUserZoneACL($this->getObjectCLASS(self::$objAuthenticationMech))->toBoolean() == TRUE) {
                 self::$objAuthenticationMech->tieInWithAdministration($this);
             }
             continue;
         } else {
             // Make the object, and store it;
             $objMod = $this->activateModule(new FilePath($v['dir']), new B(TRUE));
             $objMod->tieInWithAuthentication(self::$objAuthenticationMech);
             if (self::$objAuthenticationMech->checkCurrentUserZoneACL($this->getObjectCLASS($objMod))->toBoolean() == TRUE) {
                 // Do the tie;
                 $objMod->tieInWithAdministration($this);
             }
         }
     }
     // Set some predefines;
     if (self::$objMenuArray == NULL) {
         self::$objMenuArray = new A();
     }
     if (self::$objSubMArray == NULL) {
         self::$objSubMArray = new A();
     }
     // Set the script end;
     self::setExeTime(new S('administration_end'));
     // After we know all the details, execute the viewer whit these parameters;
     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'administration.tp');
     TPL::tpSet(new F(self::getExeTime(new S('administration_start'), new S('administration_end'))), new S('objExeTime'), $tpF);
     TPL::tpSet(self::$objSwitcherLink, new S('objSwitcherLink'), $tpF);
     TPL::tpSet(self::$objHeaderText, new S('objHeaderText'), $tpF);
     TPL::tpSet(self::$objFooterText, new S('objFooterText'), $tpF);
     TPL::tpSet(self::$objMenuArray, new S('objMenuArray'), $tpF);
     TPL::tpSet(self::$objSubMArray, new S('objSubMArray'), $tpF);
     TPL::tpSet(self::$objLogOutLink, new S('objLogOutLink'), $tpF);
     TPL::tpExe($tpF);
 }
Beispiel #8
0
 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objWidgetToRender The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make an empty array if NULL ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // XML & RSS: Do a switch ...
     switch ($objW) {
         case 'widgetXML':
             // Yo man ... woohoooooo ...
             foreach ($this->getLyrics(_S('ORDER
             BY %objLyricsTableFDateAdded DESC LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', ((int) $objWA['objId']->toString() - 1) * 25000)->doToken('%UpperLimit', 25000)) as $k => $v) {
                 // Set some requirements ...
                 $objDTE = date('Y-m-d', (int) $v[self::$objLyricsTableFDateAdded]->toString());
                 $objLOC = URL::staticURL(new A(array(LYRICS_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objLyricsTableFSEO], FRONTEND_LYRICS_URL)));
                 // Get the (INNER) CHILD of every young SEO freak ...
                 $objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
                 // Set the XML Sitemap kids ...
                 $objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
                 $objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
                 $objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
                 $objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
             }
             // BK;
             break;
         case 'widgetRSS':
             // Yo man ... woohoooooo ...
             if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
                 // Get'em 30 ...
                 foreach ($this->getApprovedAudioFiles(new S('ORDER BY %objAudioTableFUploadedDate
                 DESC LIMIT 0, 30')) as $k => $v) {
                     // Set some requirements ...
                     $objDTE = date(DATE_RFC822, (int) $v[self::$objAudioTableFUploadedDate]->toString());
                     $objLOC = URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objAudioTableFSEO], FRONTEND_AUDIO_URL)));
                     $objTTL = $v[self::$objAudioTableFTitle]->appendString(_DCSP)->appendString($v[self::$objAudioTableFArtist])->appendString(_DCSP)->appendString($v[self::$objAudioTableFAlbum]);
                     $objDSC = $v[self::$objAudioTableFDescription]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
                     // Get the (INNER) CHILD of every young SEO freak ...
                     $objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
                     // Set the RSS kids ...
                     $objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
                     $objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
                     $objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
                 }
             }
             // BK;
             break;
     }
     // Do a switch ...
     switch ($objW) {
         case 'widgetList':
             // Check some needed requirements ...
             if ($_GET[FRONTEND_SECTION_URL] == FRONTEND_LYRICS_URL) {
                 // Set some requirements ...
                 $objPag = isset($_GET[LYRICS_PAGE_URL]) ? $_GET[LYRICS_PAGE_URL] : new S((string) 1);
                 $objPag = new I((int) $objPag->toString());
                 // Fixes for a bugged user ...
                 if ($objPag->toInt() == 0) {
                     // Make the proper header, at first ...
                     $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                     // Give me back my free hardcore, Quoth the server, '404' ...
                     $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                 } else {
                     // Make it a string again ...
                     $objPag = new S((string) $objPag->toInt());
                 }
                 // Get your switches on ...
                 if (isset($_GET[LYRICS_ITEM_URL])) {
                     // Check that the article exists, before doing anything stupid ...
                     if ($this->checkLyricURLIsUnique($objURL = $_GET[LYRICS_ITEM_URL])->toBoolean() == TRUE) {
                         // Make the proper header, at first ...
                         $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                         // Give me back my free hardcore, Quoth the server, '404' ...
                         $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                     } else {
                         // Make me SEO ... yah!
                         TPL::manageTTL($objTTL = $this->getLyricInfoByURL($objURL, self::$objLyricsTableFTitle));
                         TPL::manageTTL($objART = $this->getLyricInfoByURL($objURL, self::$objLyricsTableFArtist));
                         TPL::manageTTL($objALB = $this->getLyricInfoByURL($objURL, self::$objLyricsTableFAlbum));
                         TPL::manageTAG(new S('description'), new S('Titlu: ' . $objTTL . ', Artist: ' . $objART . ', Album: ' . $objALB . ', Lyrics: ' . $this->getLyricInfoByURL($objURL, self::$objLyricsTableFLyrics)->entityDecode(ENT_QUOTES)->doToken('<br />', _SP)->stripTags()->doSubStr(0, 128)));
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . '-Item' . TPL_EXTENSION);
                         TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                         TPL::tpSet($objURL, new S('objURL'), $tpF);
                         TPL::tpSet($this->ATH, new S('ATH'), $tpF);
                         TPL::tpSet($this->STG, new S('STG'), $tpF);
                         TPL::tpSet($this, new S('LRQ'), $tpF);
                         TPL::tpExe($tpF);
                     }
                 } else {
                     if (isset($_GET[LYRICS_SEARCH_URL])) {
                         // Get audio by page ...
                         $objCnt = $this->getLyricCountForSearch($_GET[LYRICS_SEARCH_URL]);
                         $objArt = $this->getLyricsByPageAndSearch($objPag, $_GET[LYRICS_SEARCH_URL]);
                     } else {
                         // Do me SEO, yah baby! ...
                         TPL::manageTTL(_S(FRONTEND_LYRICS_URL));
                         // Make a condition to avoid dup. title tags on different pages ...
                         if ((int) $objPag->toString() >= 1 && isset($_GET[LYRICS_PAGE_URL])) {
                             TPL::manageTTL(_S(LYRICS_PAGE_URL)->appendString(_SP)->appendString($objPag));
                         }
                         // Set some requirements ...
                         $objArt = $this->getLyricsByPage($objPag);
                         $objCnt = $this->getLyricCount();
                     }
                     // Set the template file ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
                     TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                     TPL::tpSet($objArt, new S('objAr'), $tpF);
                     TPL::tpSet($this, new S('LRQ'), $tpF);
                     TPL::tpExe($tpF);
                     // Set them paginations ...
                     if ($objCnt->toInt() > (int) self::$objItemsPerPage->toString()) {
                         self::$objFrontend->setPagination($objCnt, new I((int) self::$objItemsPerPage->toString()));
                     }
                 }
             } else {
                 // Do the biggest error on the PLANET ...
                 self::renderScreenOfDeath(new S(__CLASS__), new S(LYRICS_NEED_PROPER_SECTION), new S(LYRICS_NEED_PROPER_SECTION_FIX));
             }
             // BK;
             break;
         case 'widgetTopN':
             if ($objWA['type'] == 1) {
                 $objArt = $this->_Q(_QS('doSELECT')->doToken('%what', new S('%objLyricsTableFArtist, COUNT(%objLyricsTableFTitle) as count'))->doToken('%table', self::$objLyricsTable)->doToken('%condition', new S('GROUP BY %objLyricsTableFArtist ORDER BY count DESC LIMIT 0, 30')));
             } else {
                 $objArt = $this->_Q(_QS('doSELECT')->doToken('%what', new S('%objLyricsTableFAlbum, COUNT(%objLyricsTableFTitle) as count'))->doToken('%table', self::$objLyricsTable)->doToken('%condition', new S('GROUP BY %objLyricsTableFAlbum ORDER BY count DESC LIMIT 0, 30')));
             }
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION);
             TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
             TPL::tpSet($objArt, new S('objAr'), $tpF);
             TPL::tpSet($this, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case 'widgetSearch':
             $this->renderForm(new S('widgetSearch'));
             break;
     }
 }
Beispiel #9
0
 /**
  * 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 renderFrontendPage(S $objPageToRender, S $objTypeSwitcher)
 {
     // Do a switch on the rendered page ...
     switch ($objTypeSwitcher) {
         // Authentication ... and stuff;
         case FRONTEND_AUTHENTICATION_URL:
             // Check the mighty authenticate ...
             if (isset($_GET[AUTHENTICATION_ACTION_URL])) {
                 // Do a switch ...
                 switch ($_GET[AUTHENTICATION_ACTION_URL]) {
                     case AUTHENTICATION_REGISTER_URL:
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-register.tp');
                         break;
                     case AUTHENTICATION_ACTIVATE_URL:
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-activate.tp');
                         break;
                     case AUTHENTICATION_PROFILE_URL:
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-profile.tp');
                         break;
                     case AUTHENTICATION_LOGOUT_URL:
                         // Log me OUT my wuv ...
                         $this->ATH->doLogOut();
                         // Get me HOME ... I'm LOST here ...
                         $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_SECTION_URL)), new A(array(FRONTEND_HOME))), new S('Location'));
                         break;
                     case AUTHENTICATION_YAHOO_BB_AUTH:
                         return $this->renderWidget(new S(AUTHENTICATION_YAHOO_BB_AUTH));
                         break;
                 }
             } else {
                 // Set the template file ...
                 $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users.tp');
             }
             // Go my baby ... GO ...
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case FRONTEND_ARTICLE_URL:
             // Go my baby ... GO ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'news.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case FRONTEND_CONTACT_URL:
             // Go my baby ... GO ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'contact.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case FRONTEND_FAQ_URL:
             // Go my baby ... GO ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'faq.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case FRONTEND_LYRICS_URL:
             // Go my baby ... GO ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'lyrics.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case FRONTEND_AUDIO_URL:
             if (isset($_GET[AUDIO_ACTION_URL])) {
                 // Do a switch ...
                 switch ($_GET[AUDIO_ACTION_URL]) {
                     case AUDIO_UPLOAD_URL:
                         // Set the template file ...
                         $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'audio-upload.tp');
                         break;
                 }
             } else {
                 // Set the template file ...
                 $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'audio.tp');
             }
             // Go my baby ... GO ...
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
         case FRONTEND_PRODUCTS_URL:
             // Go my baby ... GO ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'products.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->PRD, new S('PRD'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
             // TXTs ... them defaults;
         // TXTs ... them defaults;
         case FRONTEND_SECTION_URL:
             // Do a switch ...
             switch ($_GET[FRONTEND_SECTION_URL]) {
                 case FRONTEND_HOME:
                     // Damn, you're good ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'home.tp');
                     break;
                 default:
                     // Get'em tiger ...
                     $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'content.tp');
                     break;
             }
             // Go my baby ... GO ...
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
             TPL::tpExe($tpF);
             break;
             ######################## THIS WILL NEVER - EVER - EVER - EVER - EVER - EVER CHANGE ########################
             // RSS Feeds ...
         ######################## THIS WILL NEVER - EVER - EVER - EVER - EVER - EVER CHANGE ########################
         // RSS Feeds ...
         case FRONTEND_RSS_XML:
             // Get the object ...
             $objRSS = TPL::getSitemapRSSOrXML(new S('RSS'));
             $objDTE = date(DATE_RFC822, $_SERVER['REQUEST_TIME']);
             $objTTL = $this->STG->getConfigKey(new S('settings_website_default_title'));
             $objXML = $objRSS->addCHILD(self::RSS_CHANNEL);
             $objXML->addCHILD(self::RSS_LINK, DOCUMENT_HOST);
             $objXML->addCHILD(self::RSS_PUBLISHED_DATE, $objDTE);
             $objXML->addCHILD(self::RSS_TITLE, $objTTL);
             $objXML->addCHILD(self::RSS_DESCRIPTION, $objTTL);
             // Go through ALL and XML my booty ... passed by reference ... yah baby!
             $this->AUD->renderWidget(new S('widgetRSS'), new A(array('objXML' => $objXML)));
             $this->ART->renderWidget(new S('widgetRSS'), new A(array('objXML' => $objXML)));
             $this->TXT->renderWidget(new S('widgetRSS'), new A(array('objXML' => $objXML)));
             $this->PRD->renderWidget(new S('widgetRSS'), new A(array('objXML' => $objXML)));
             // Do them XML ...
             TPL::outputXMLString(new S($objRSS->asXML()));
             break;
             // XML Sitemap ...
         // XML Sitemap ...
         case FRONTEND_STE_MAP:
             // Get the object ...
             $objXML = TPL::getSitemapRSSOrXML(new S('MAP'));
             if (isset($_GET['Type'])) {
                 switch ($_GET['Type']) {
                     case 'Lyrics':
                         $this->LRQ->renderWidget(new S('widgetXML'), new A(array('objXML' => $objXML, 'objId' => $_GET['Id'])));
                         break;
                 }
             } else {
                 // Go through ALL and XML my booty ... passed by reference ... yah baby!
                 $this->AUD->renderWidget(new S('widgetXML'), new A(array('objXML' => $objXML)));
                 $this->ART->renderWidget(new S('widgetXML'), new A(array('objXML' => $objXML)));
                 $this->TXT->renderWidget(new S('widgetXML'), new A(array('objXML' => $objXML)));
                 $this->PRD->renderWidget(new S('widgetXML'), new A(array('objXML' => $objXML)));
             }
             // Do them XML ...
             TPL::outputXMLString(new S($objXML->asXML()));
             break;
             // Errors ... (404, etc)
         // Errors ... (404, etc)
         case FRONTEND_ERROR_URL:
             // Check the code is defined ... or 404 if not ...
             if ($this->STG->checkErrorPageCodeIsUnique($this->objCOD = $_GET[FRONTEND_ERROR_URL])->toBoolean() == TRUE) {
                 $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
             }
             // Set some requirements ...
             $this->objCDE = $this->STG->getErrorPageByCode($this->objCOD, Settings::$objSettingsErrTableFCode);
             $this->objTTL = $this->STG->getErrorPageByCode($this->objCOD, Settings::$objSettingsErrTableFTitle);
             $this->objCNT = $this->STG->getErrorPageByCode($this->objCOD, Settings::$objSettingsErrTableFContent);
             // Set the title ...
             TPL::manageTTL($this->objCDE);
             TPL::manageTTL($this->objTTL);
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'error.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             // Set'em vars ...
             TPL::tpSet($this->objCNT, new S('objCNT'), $tpF);
             TPL::tpSet($this->objTTL, new S('objTTL'), $tpF);
             TPL::tpSet($this->objCDE, new S('objCDE'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->STG, new S('STG'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ART, new S('ART'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpSet($this->CNT, new S('CNT'), $tpF);
             TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
             TPL::tpExe($tpF);
             break;
     }
 }