Пример #1
0
 /**
  * Will render the 'Screen Of Death', by using tested and well working PHP functions. This method relies on the fact that, at least
  * the framework abstract classes are working. Non-core developers should not modify anything here as they can get their hands
  * dirty really quick and destroy something without even knowing it;
  *
  * @param S $errFrom Error from where did it came
  * @param S $errString What's the string of the error
  * @param S $errTip Do you have an information to show
  * @param S $debugErrorString Should we show the debugger
  * @param B $errFATAL Is this error FATAL
  * @return S Will return the error screen string, or just void, depends on what kind of error we caught
  * @author Catalin Z. Alexandru <*****@*****.**>
  * @copyright Under the terms of the GNU General Public License v3
  * @version $Id: 08_ERR.php 313 2009-10-09 13:27:52Z catalin.zamfir $
  * @since Version 1.0
  * @access protected
  * @static
  * @final
  */
 protected static function renderScreenOfDeath(S $errFrom, S $errString = NULL, S $errTip = NULL, S $debugErrorString = NULL, B $errFATAL = NULL)
 {
     // Set the execution time, discard the output stream, and set the error status to TRUE;
     self::setExeTime(new S(__FUNCTION__));
     // Add header, if it's a CSS file, on an error!;
     switch (checkIfItsACSSFile() or checkIfItsAJSSFile()) {
         case TRUE:
             // Set the text/HTML, header!;
             self::setHeaderKey(new S('text/html'), new S('Content-type:'));
             break;
     }
     // Se the errorStatus to TRUE;
     self::setErrorStatus();
     $catchedKrumoContent = _NONE;
     // Change behaviour, if this is a FATAL error;
     if ($errFATAL != NULL && $errFATAL->toBoolean() == TRUE) {
         $errString = new S(FATAL_ERROR);
         $errTip = new S(FATAL_ERROR_CHECK_LOG);
         // Clean the output buffer;
         self::$objOutputBuffer = _NONE;
     } else {
         // Clean the output buffer;
         self::discardOutputStream(new B(TRUE));
         // Execute the KRUMO PLUGIN Framework;
         $catchedKrumoContent = self::getKrumoContent();
     }
     // Get the file contents;
     $debugContent = new FileContent(FORM_TP_DIR . _S . 'frm_error_screen.tp');
     // Do an if, for the [%CODE%] part of our template;
     if (GESHI >= 1 && DEBUG >= 1) {
         // Replace [%CODE%], with GeSHi parsed code from our PHP files;
         // Really helpfull when trying to find hidden bugs;
         $debugContent->doToken('[%CODE%]', self::getDebugBacktrace(array_reverse(debug_backtrace())));
         $debugContent->doToken('[%KRUMO%]', $catchedKrumoContent);
     } else {
         // Replace [%CODE%], with _NONE, hiding the output;
         // Well, can't help the developer here!;
         $debugContent->doToken('[%CODE%]', _NONE);
         $debugContent->doToken('[%KRUMO%]', _NONE);
         // Set as  'Hacking attempt';
         $errString = VIEW_FILE_DIRECTLY_DENIED;
         $errTip = VIEW_FILE_DIRECTLY_DENIED_FIX;
         $debugErrorString = HACKING_ATTEMPT_BANG_YOU_DEAD;
     }
     // Start replacing information in the 'frm_error_screen.tp';
     $debugContent->doToken('[%HSIMG%]', DOCUMENT_HOST . IMAGE_DIR . _WS);
     $debugContent->doToken('[%HSJSS%]', DOCUMENT_HOST . JAVASCRIPT_DIR . _WS);
     $debugContent->doToken('[%ERBGR%]', ERBGR);
     $debugContent->doToken('[%ERPIX%]', ERPIX);
     $debugContent->doToken('[%ERPXL%]', ERPXL);
     $debugContent->doToken('[%MEMORY%]', memory_get_usage() / 1024);
     $debugContent->doToken('[%PID%]', getmypid());
     $debugContent->doToken('[%MICROTIME%]', self::getExeTime(new S(__CLASS__), new S(__FUNCTION__)));
     $debugContent->doToken('[%ERROR_FROM%]', $errFrom);
     $debugContent->doToken('[%ERROR_DATE%]', date(DATE_STRING, $_SERVER['REQUEST_TIME']));
     $debugContent->doToken('[%ERROR_EMSG%]', $errString);
     $debugContent->doToken('[%ERROR_ETIP%]', $errTip);
     $debugContent->doToken('[%ERROR_FROM_PHP%]', $debugErrorString);
     // Try to MAIL ... If we got this far, we have MAIL ...
     if (self::checkClassExistence(new S('MAIL'))->toBoolean() == TRUE) {
         // Set some requirements ...
         if ($errString == NULL) {
             $errString = new S();
         }
         if ($errTip == NULL) {
             $errTip = new S();
         }
         // Make'em as new as possible ...
         $objEML = new MAIL();
         $objEML->setFrom(new S(MAIL_FROM));
         $objEML->setStringAttachment(new S($debugContent));
         $objEML->doMAIL(new S(MAIL_FROM), $errString, new S($errTip . _DCSP . URL::rewriteURL() . _DCSP . $_SERVER['HTTP_USER_AGENT'] . _DCSP . $_SERVER['REMOTE_ADDR']));
     }
     // Exit, with an error screen. We could also die, it would mean the same;
     if ($errFATAL != NULL && $errFATAL->toBoolean() == TRUE) {
         // Return the content;
         if (OB_GZIP == TRUE && OB_GZIP_LEVEL > 0 && OB_GZIP_LEVEL <= 9) {
             return gzencode($debugContent, OB_GZIP_LEVEL);
         } else {
             return $debugContent;
         }
     } else {
         // Or die script now;
         if (OB_GZIP == TRUE && OB_GZIP_LEVEL > 0 && OB_GZIP_LEVEL <= 9) {
             exit(gzencode($debugContent, OB_GZIP_LEVEL));
         } else {
             exit($debugContent);
         }
     }
 }
Пример #2
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 renderForm(S $objFormToRender, A $objFA = NULL)
 {
     // Make them defaults ...
     if ($objFA == NULL) {
         $objFA = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'contactForm':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array('Status')), new A(array('Ok')));
             // Set some requirements;
             $objPHPEMLRegExpCheck = new S(Authentication::REGEXP_PHP_CHECK_EMAIL);
             // Get some configuration parameters ...
             $objNameFrm = $objFA['form_name'];
             $objSubject = $objFA['field_subject'];
             $objEMAIL = $objFA['field_email'];
             $objMessage = $objFA['field_message'];
             $objSendFrm = $objFA['form_submit_contact'];
             $objErrorE = $objFA['error_must_enter_valid_email'];
             $objErrorM = $objFA['error_must_enter_message'];
             $objErrorI = $objFA['error_entered_email_not_valid'];
             // Do some work;
             if ($this->checkPOST(self::$objContactTableFEMAIL)->toBoolean() == TRUE) {
                 // Check the EMAIL was set;
                 if ($this->getPOST(self::$objContactTableFEMAIL)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objContactTableFEMAIL, $objErrorE);
                 }
             }
             if ($this->checkPOST(self::$objContactTableFMessage)->toBoolean() == TRUE) {
                 // Check the MESSAGE is not empty;
                 if ($this->getPOST(self::$objContactTableFMessage)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objContactTableFMessage, $objErrorM);
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S($objNameFrm))->setSQLAction(new S('update'))->setTableName(self::$objContactTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objContactTableFId)->setExtraUpdateData(self::$objContactTableFReceived, new S((string) $_SERVER['REQUEST_TIME']))->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('contact_submit'))->setValue($objSendFrm)->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objContactTableFSubjectId)->setLabel($objSubject)->setContainerDiv(new B(TRUE));
             // Get the subjects ...
             foreach ($this->getSubjects() as $k => $v) {
                 $this->setInputType(new S('option'))->setName($v[self::$objContactSubjectFId])->setValue($v[self::$objContactSubjectFId])->setLabel($v[self::$objContactSubjectFTitle]);
             }
             // Continue;
             $this->setInputType(new S('text'))->setName(self::$objContactTableFEMAIL)->setLabel($objEMAIL)->setRegExpType(new S('preg'))->setRegExpErrMsg($objErrorI)->setPHPRegExpCheck($objPHPEMLRegExpCheck)->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objContactTableFMessage)->setLabel($objMessage)->setRows(new S('10'))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             // Do some after work;
             if ($this->checkPOST(new S('contact_submit'))->toBoolean() == TRUE) {
                 if ($this->checkFormHasErrors()->toBoolean() == FALSE) {
                     // Set some requirements ...
                     $objMAIL = new MAIL();
                     // Set From: MAIL header;
                     $objMAIL->setFrom($this->getPOST(self::$objContactTableFEMAIL));
                     $objMAIL->doMAIL($this->getConfigKey(new S('contact_message_email')), $this->getSubjectInfoById($this->getPOST(self::$objContactTableFSubjectId), self::$objContactSubjectFTitle), $this->getPOST(self::$objContactTableFMessage));
                 }
                 // Do a redirect, to the ok page ... if everything is OK;
                 if ($this->checkFormHasErrors()->toBoolean() == FALSE) {
                     $this->setHeaderKey($objURLToGoBack, new S('Location'));
                 }
             }
             // Break out ...
             break;
         case 'messageSend':
             // Set the URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do some work;
             if ($this->checkPOST(new S('submit_resend_message'))->toBoolean() == TRUE) {
                 // Set some requirements ...
                 $objTo = $this->getConfigKey(new S('contact_message_email'));
                 $objSubjectId = $this->getMessageInfoById($_GET[ADMIN_ACTION_ID], self::$objContactTableFSubjectId);
                 $objSubject = $this->getSubjectInfoById($objSubjectId, self::$objContactSubjectFTitle);
                 $objFrom = $this->getMessageInfoById($_GET[ADMIN_ACTION_ID], self::$objContactTableFEMAIL);
                 $objMessage = $this->getMessageInfoById($_GET[ADMIN_ACTION_ID], self::$objContactTableFMessage);
                 // Set some requirements ...
                 $objMAIL = new MAIL();
                 // Set From: MAIL header ...
                 $objMAIL->setFrom($objFrom);
                 $objMAIL->doMAIL($objTo, $objSubject, $objMessage);
                 // Do a redirect, and get the user back where he belongs;
                 $this->setHeaderKey($objURLToGoBack, new S('Location'));
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_RESEND_MESSAGE))->setName($objFormToRender)->setInputType(new S('submit'))->setName(new S('submit_resend_message'))->setValue(new S(CONTACT_RESEND_MESSAGE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'messageOperations':
             // Set some predefines;
             $objURLToGoBack = URL::rewriteURL();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_EDIT_COMMENT_AND_STATUS))->setSQLAction(new S('update'))->setTableName(self::$objContactTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objContactTableFId)->setExtraUpdateData(self::$objContactTableFLastEdited, new S((string) $_SERVER['REQUEST_TIME']))->setName($objFormToRender)->setInputType(new S('submit'))->setValue(new S(CONTACT_EDIT_COMMENT_AND_STATUS))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objContactTableFResolved)->setLabel(new S(CONTACT_MESSAGE_RESOLVED))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('yes'))->setValue(new S('Y'))->setLabel(new S(CONTACT_MESSAGE_RESOLVED_YES))->setInputType(new S('option'))->setName(new S('no'))->setValue(new S('N'))->setLabel(new S(CONTACT_MESSAGE_RESOLVED_NO))->setInputType(new S('textarea'))->setName(self::$objContactTableFComment)->setLabel(new S(CONTACT_MESSAGE_COMMENT))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             if ($this->checkPOST(self::$objContactTableFComment)->toBoolean() == TRUE) {
                 // Do a redirect, and get the user back where he belongs;
                 if ($this->checkFormHasErrors()->toBoolean() == FALSE) {
                     $this->setHeaderKey($objURLToGoBack, new S('Location'));
                 }
             }
             break;
         case 'messageErase':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objContactTable)->doToken('%condition', new S('%objContactTableFId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
         case 'subjectCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objContactSubjectFTitle)->toBoolean() == TRUE) {
                 // Check that the subject title is not empty!;
                 if ($this->getPOST(self::$objContactSubjectFTitle)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objContactSubjectFTitle, new S(CONTACT_SUBJECT_CANNOT_BE_EMPTY));
                 }
             }
             // Get AJAX
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_ADD_SUBJECT))->setSQLAction(new S('update'))->setTableName(self::$objContactSubjectTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objContactSubjectFId)->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(CONTACT_ADD_SUBJECT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objContactSubjectFTitle)->setLabel(new S(CONTACT_SUBJECT))->setJSRegExpReplace(new S(self::REGEXP_JS_SUBJECT))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'subjectEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do some work;
             if ($this->checkPOST(self::$objContactSubjectFTitle)->toBoolean() == TRUE) {
                 // Check that the subject title is not empty!;
                 if ($this->getPOST(self::$objContactSubjectFTitle)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objContactSubjectFTitle, new S(CONTACT_SUBJECT_CANNOT_BE_EMPTY));
                 }
             }
             // Get AJAX
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_EDIT_SUBJECT))->setSQLAction(new S('update'))->setTableName(self::$objContactSubjectTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objContactSubjectFId)->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(CONTACT_EDIT_SUBJECT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objContactSubjectFTitle)->setLabel(new S(CONTACT_SUBJECT))->setJSRegExpReplace(new S(self::REGEXP_JS_SUBJECT))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'subjectErase':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             $objSQLCondition = new S('WHERE %objContactTableFSubjectId = "%Id"');
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objContactSubjectTable)->doToken('%condition', new S('%objContactSubjectFId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
         case 'configurationEdit':
             // Set the URL to go back too;
             $objURLToGoBack = new S();
             // Do some work;
             if ($this->checkPOST()->toBoolean() == TRUE) {
                 // The URL to go back too;
                 $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION)), new A(array($this->getPOST(new S('what')))));
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_MANAGE_CONFIG))->setName($objFormToRender)->setRedirect($objURLToGoBack)->setInputType(new S('submit'))->setValue(new S(CONTACT_CONFIG_DO))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(new S('what'))->setLabel(new S(CONTACT_CONFIG_CHOOSE))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('configurationEdit-contact_address'))->setValue(new S('configurationEdit-contact_address'))->setLabel(new S(CONTACT_CONFIG_EMAIL))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('configurationEdit-page_content'))->setValue(new S('configurationEdit-page_content'))->setLabel(new S(CONTACT_CONFIG_PAGE))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('configurationEdit-ok_page_content'))->setValue(new S('configurationEdit-ok_page_content'))->setLabel(new S(CONTACT_CONFIG_SUCCES_PAGE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'configurationEdit-contact_address':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION)));
             // Do form validation;
             if ($this->checkPOST()->toBoolean() == TRUE) {
                 foreach ($this->getPOST() as $k => $v) {
                     $this->setConfigKey(new S($k), $v);
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_MANAGE_CONFIG))->setName($objFormToRender)->setRedirect($objURLToGoBack)->setInputType(new S('submit'))->setValue(new S(CONTACT_MANAGE_CONFIGURATION_UPDATE))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(new S('contact_message_email'))->setLabel(new S(CONTACT_DEFAULT))->setValue($this->getConfigKey(new S('contact_message_email')))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'configurationEdit-page_content':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION)));
             // Do form validation;
             if ($this->checkPOST()->toBoolean() == TRUE) {
                 foreach ($this->getPOST() as $k => $v) {
                     $this->setConfigKey(new S($k), $v);
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_MANAGE_CONFIGURATION_UPDATE))->setName($objFormToRender)->setRedirect($objURLToGoBack)->setInputType(new S('submit'))->setValue(new S(CONTACT_MANAGE_CONFIGURATION_UPDATE))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(new S('contact_page_message_content'))->setLabel(new S(CONTACT_PAGE_CONTENT))->setValue($this->getConfigKey(new S('contact_page_message_content')))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'configurationEdit-ok_page_content':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION)));
             // Do form validation;
             if ($this->checkPOST()->toBoolean() == TRUE) {
                 foreach ($this->getPOST() as $k => $v) {
                     $this->setConfigKey(new S($k), $v);
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(CONTACT_MANAGE_CONFIGURATION_UPDATE))->setName($objFormToRender)->setRedirect($objURLToGoBack)->setInputType(new S('submit'))->setValue(new S(CONTACT_MANAGE_CONFIGURATION_UPDATE))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(new S('contact_page_message_content_ok'))->setLabel(new S(CONTACT_PAGE_CONTENT_OK))->setValue($this->getConfigKey(new S('contact_page_message_content_ok')))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
     }
 }
Пример #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 AUTHENTICATION_YAHOO_BB_AUTH:
             require_once DOCUMENT_ROOT . _S . PLUGIN_DIR . _S . 'yahoo/ybrowserauth.class.php';
             $authObj = new YBBauthREST(APPID, SECRET);
             $objA = PARSE_URL($_SERVER['REQUEST_URI']);
             if (isset($objA['query'])) {
                 $objAuthURL = new S();
                 $objUserYML = new B(TRUE);
                 parse_str($objA['query'], $objQ);
                 $authObj->token = $objQ['token'];
                 $objPath = 'http://address.yahooapis.com/api/ws/v1/searchContacts?format=xml';
                 $xmlstr = $authObj->makeAuthWSgetCall($objPath);
                 $xml = new SimpleXMLElement($xmlstr);
                 $i = 0;
                 $objARM = new A();
                 foreach ($xml->contact as $contact) {
                     $objARM[$i] = new S((string) $contact->yahooid);
                     if ($objARM[$i]->toLength()->toInt() != 0) {
                         $objARM[$i] = $objARM[$i];
                         $i++;
                     }
                 }
                 $objEML = new MAIL();
                 $objEML->setFrom(new S('24up! <*****@*****.**>'));
                 foreach ($objARM as $k => $v) {
                     $objEML->doMAIL(new S($v . '@yahoo.com'), new S(FRONTEND_YAHOO_MAIL_SUBJECT), $this->getHELP(new S('widgetYahooInviteEMAIL')));
                 }
             } else {
                 $objAuthURL = new S($authObj->getAuthURL('yahoo_auth_invite', true));
                 $objUserYML = new B(FALSE);
             }
             // Set the template file ...
             $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-yahoo-invite.tp');
             TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
             TPL::tpSet($objUserYML, new S('objUserYML'), $tpF);
             TPL::tpSet($objAuthURL, new S('objAuthURL'), $tpF);
             TPL::tpSet($this->TXT, new S('TXT'), $tpF);
             TPL::tpSet($this->ATH, new S('ATH'), $tpF);
             TPL::tpSet($this->AUD, new S('AUD'), $tpF);
             TPL::tpExe($tpF);
             // TEMP fix;
             return TRUE;
             break;
     }
 }