function &getData()
 {
     //$app	= JFactory::getApplication();
     $paramsC = JComponentHelper::getParams('com_phocaguestbook');
     $enable_captcha = $paramsC->get('enable_captcha', 1);
     $captchaId = PhocaguestbookHelperFront::getCaptchaId($enable_captcha);
     switch ((int) $captchaId) {
         case 3:
             $this->_image_data = PhocaguestbookHelperCaptchaTTF::createImageData();
             break;
         case 2:
             $this->_image_data = PhocaguestbookHelperCaptchaMath::createImageData();
             break;
         case 1:
         default:
             $this->_image_data = PhocaguestbookHelperCaptcha::createImageData();
             break;
     }
     return $this->_image_data;
 }
 function display($tpl = null)
 {
     PhocaGuestbookHelperFront::checkSpecificId(0);
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->tmpl = array();
     $pathway = $app->getPathway();
     $document = JFactory::getDocument();
     $uri = JFactory::getURI();
     $user = JFactory::getUser();
     JHTML::stylesheet('components/com_phocaguestbook/assets/phocaguestbook.css');
     $this->tmpl['administrator'] = 0;
     $canAdmin = PhocaguestbookHelperFront::canAdmin();
     if ($canAdmin) {
         $this->tmpl['administrator'] = 1;
     }
     //PARAMS
     $this->tmpl['captcha_method'] = $params->get('captcha_method', 1);
     $this->tmpl['enable_editor'] = $params->get('enable_editor', 1);
     $this->tmpl['table_width'] = $params->get('table_width', 400);
     $this->tmpl['editor_width'] = $params->get('editor_width', 400);
     $this->tmpl['editor_height'] = $params->get('editor_height', 200);
     $this->tmpl['display_form'] = $params->get('display_form', 1);
     $this->tmpl['date_format'] = $params->get('date_format', 'DATE_FORMAT_LC');
     $this->tmpl['font_color'] = $params->get('font_color', '#000000');
     $this->tmpl['second_font_color'] = $params->get('second_font_color', '#dddddd');
     $this->tmpl['background_color'] = $params->get('background_color', '#C8DFF9');
     $this->tmpl['border_color'] = $params->get('border_color', '#E6E6E6');
     $this->tmpl['display_name_form'] = $params->get('display_name_form', 2);
     $this->tmpl['display_email_form'] = $params->get('display_email_form', 1);
     $this->tmpl['display_title_form'] = $params->get('display_title_form', 2);
     $this->tmpl['display_content_form'] = $params->get('display_content_form', 2);
     $this->tmpl['display_website_form'] = $params->get('display_website_form', 0);
     $this->tmpl['display_name'] = $params->get('display_name', 1);
     $this->tmpl['display_email'] = $params->get('display_email', 1);
     $this->tmpl['display_website'] = $params->get('display_website', 1);
     $this->tmpl['username_or_name'] = $params->get('username_or_name', 0);
     $this->tmpl['predefined_name'] = $params->get('predefined_name', '');
     $this->tmpl['enable_html_purifier'] = $params->get('enable_html_purifier', 1);
     $this->tmpl['display_path_editor'] = $params->get('display_path_editor', 1);
     $this->tmpl['recaptcha_publickey'] = $params->get('recaptcha_publickey', '');
     $this->tmpl['display_posts'] = $params->get('display_posts', 1);
     $this->tmpl['enable_hidden_field'] = $params->get('enable_hidden_field', 0);
     // - - - - - - - - - - -
     // Get data - all items
     $items = $this->get('data');
     $guestbooks = $this->get('guestbook');
     $this->tmpl['date_format'] = PhocaguestbookHelperFront::getDateFormat($this->tmpl['date_format']);
     $document->addCustomTag(PhocaguestbookHelperFront::setCaptchaReloadJS());
     if ($this->tmpl['enable_editor'] == 1) {
         $document->addCustomTag(PhocaguestbookHelperFront::setTinyMCEJS());
         $document->addCustomTag(PhocaguestbookHelperFront::displaySimpleTinyMCEJS($this->tmpl['display_path_editor']));
     }
     // - - - - - - - - - - -
     // Fill the form in case, you get data from post (e.g. user send data, but with no valid captcha
     // We send him back to the form but without lossing data
     $post = JRequest::get('post');
     $post['content'] = JRequest::getVar('pgbcontent', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     $id = JRequest::getVar('id', '', 'get', 'string');
     $post['catid'] = (int) $cid[0];
     if (isset($guestbooks->report) && $guestbooks->report == 1) {
         //This is a report guestbook:
         $this->tmpl['display_posts'] = 0;
         if (!isset($post['title']) || isset($post['title']) && $post['title'] == '') {
             $reportTitle = JRequest::getVar('reporttitle', '', 'get', 'string');
             $post['title'] = htmlspecialchars(strip_tags($reportTitle));
         }
     }
     if ((int) $id < 1) {
         echo '<div id="phocaguestbook"><div class="error">' . JText::_('COM_PHOCAGUESTBOOK_WARNING_GUESTBOOK_NOT_SELECTED') . '</div></div>';
         return true;
     }
     if (isset($post['pgusername'])) {
         // if not there is other code to solve it - see below
         $post['username'] = $post['pgusername'];
     }
     // HTML Purifier - - - - - - - - - -
     if ($this->tmpl['enable_html_purifier'] == 0) {
         $filterTags = '';
         //preg_split( '#[,\s]+#', trim( ) ); // black list method is used
         $filterAttrs = '';
         //preg_split( '#[,\s]+#', trim( ) ); // black list method is used
         $filter = new JFilterInput($filterTags, $filterAttrs, 1, 1, 1);
         $post['content'] = $filter->clean($post['content']);
     } else {
         require_once JPATH_COMPONENT . DS . 'assets' . DS . 'library' . DS . 'HTMLPurifier.standalone.php';
         $configP = HTMLPurifier_Config::createDefault();
         $configP->set('Core.Encoding', 'UTF-8');
         $configP->set('HTML.Doctype', 'XHTML 1.0 Transitional');
         $configP->set('HTML.TidyLevel', 'medium');
         $configP->set('HTML.Allowed', 'strong,em,p[style],span[style],img[src|width|height|alt|title],li,ul,ol,a[href],u,strike,br');
         $purifier = new HTMLPurifier($configP);
         $post['content'] = $purifier->purify($post['content']);
     }
     // - - - - - - - - - -
     // Add username and user e-mail if user is login
     if ($this->tmpl['username_or_name'] == 1) {
         if ($user->name && trim($user->name != '')) {
             $form_username = $user->name;
         } else {
             $form_username = $this->tmpl['predefined_name'];
         }
     } else {
         if ($user->username && trim($user->username != '')) {
             $form_username = $user->username;
         } else {
             $form_username = $this->tmpl['predefined_name'];
         }
     }
     if ($user->email && trim($user->email != '')) {
         $form_email = $user->email;
     } else {
         $form_email = '';
     }
     // - - - - - - - - - - -
     // !!!! Add content to the fields
     // - - - - - - - - - - -
     //Create new object, if user fill not all data, no redirection and he gets the data he added (he doesn't loss it)
     $formdata = new JObject();
     if (isset($post['content'])) {
         $formdata->set('content', $post['content']);
     } else {
         $formdata->set('content', '');
     }
     if (isset($post['username'])) {
         $formdata->set('username', $post['username']);
     } else {
         $formdata->set('username', $form_username);
     }
     if (isset($post['email'])) {
         $formdata->set('email', $post['email']);
     } else {
         $formdata->set('email', $form_email);
     }
     if (isset($post['title'])) {
         $formdata->set('title', $post['title']);
     } else {
         $formdata->set('title', '');
     }
     if (isset($post['website'])) {
         $formdata->set('website', $post['website']);
     } else {
         if ($this->tmpl['display_website_form'] == 2) {
             $formdata->set('website', 'http://');
             //required
         } else {
             $formdata->set('website', '');
             // not required
         }
     }
     if ($this->tmpl['enable_editor'] == 1) {
         $this->tmpl['editor'] = PhocaguestbookHelperFront::displayTextArea('pgbcontent', $formdata->content, (int) $this->tmpl['editor_width'] . 'px', (int) $this->tmpl['editor_height'] . 'px', '60', '80', false);
     } else {
         $this->tmpl['editor'] = '<textarea id="pgbcontent" name="pgbcontent" cols="45" rows="10" style="width: ' . (int) $this->tmpl['editor_width'] . 'px; height:' . (int) $this->tmpl['editor_height'] . 'px;" class="pgbinput" >' . $formdata->content . '</textarea>';
     }
     $pagination =& $this->get('pagination');
     $this->tmpl['fwfa'] = explode(',', trim($params->get('forbidden_word_filter', '')));
     $this->tmpl['fwwfa'] = explode(',', trim($params->get('forbidden_whole_word_filter', '')));
     /*$this->tmpl['formemail'] = 1;
     		if ($params->get( 'display_email_form' ) != '')	{$this->tmpl['formemail'] = $params->get( 'display_email_form' );}
     		
     		//Add requirement V A L U E S
     		$this->tmpl['title'] = 1;
     		if ($params->get( 'require_title' ) != '')		{$this->tmpl['title'] = $params->get( 'require_title' );}
     		
     		/*$this->tmpl['username'] = 1;
     		if ($params->get( 'require_username' ) != '')	{$this->tmpl['username'] = $params->get( 'require_username' );}
     		*/
     /*$this->tmpl['email'] = 0;
     		if ($params->get( 'require_email' ) != '')			{$this->tmpl['email'] = $params->get( 'require_email' );}
     
     		// if we disable email form field and name form field we cannot require these items
     		/*if ($this->tmpl['display_name_form'] == 0) 					{$this->tmpl['username'] = 0;}
     		if ($this->tmpl['formemail'] == 0) 					{$this->tmpl['email'] = 0;}*/
     /*
     $this->tmpl['content'] = 1;
     if ($params->get( 'require_content' ) != '')		{$this->tmpl['content'] = $params->get( 'require_content' );}
     */
     $this->tmpl['registered_users_only'] = $params->get('registered_users_only', 0);
     $this->tmpl['form_position'] = $params->get('form_position', 0);
     $this->tmpl['max_url'] = $params->get('max_url', 5);
     $this->tmpl['enable_captcha'] = $params->get('enable_captcha', 1);
     $this->tmpl['enable_captcha_users'] = $params->get('enable_captcha_users', 0);
     $this->tmpl['captcha_id'] = PhocaguestbookHelperFront::getCaptchaId($this->tmpl['enable_captcha']);
     $this->tmpl['dem'] = PhocaguestbookHelperFront::getInfo();
     // Captcha not for registered
     if ((int) $this->tmpl['enable_captcha_users'] == 1) {
         if ((int) $user->id > 0) {
             $this->tmpl['enable_captcha'] = 0;
         }
     }
     //-----------------------------------------------------------------------------------------------
     // !!!! 1. Server Side Checking controll
     //-----------------------------------------------------------------------------------------------
     //Form Variables --------------------------------------------------------------------------------
     //captcha is wrong,we cannot redirect the page,we display message this way
     //DISPLAY MESSAGES WHICH YOU GET FROM CONTROLL FILE - (CONTROLLERS - phocaguestbook.php)
     $smB = '<small style="color:#fc0000;">';
     $smE = '</small><br />';
     $this->tmpl['errmsg_captcha'] = '';
     $this->tmpl['errmsg_top'] = '';
     if (JRequest::getVar('captcha-msg', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_captcha'] .= '<tr><td>&nbsp;</td><td colspan="3">' . $smB . JText::_('COM_PHOCAGUESTBOOK_WRONG_CAPTCHA') . '</small></td></tr>';
     }
     if (JRequest::getVar('title-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_NO_SUBJECT') . $smE;
     }
     if (JRequest::getVar('title-msg-2', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_BAD_SUBJECT') . $smE;
     }
     if (JRequest::getVar('username-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_NO_USERNAME') . $smE;
     }
     if (JRequest::getVar('username-msg-2', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_BAD_USERNAME') . $smE;
     }
     if (JRequest::getVar('username-msg-3', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_USERNAME_EXISTS') . $smE;
     }
     if (JRequest::getVar('email-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_NO_EMAIL') . $smE;
     }
     if (JRequest::getVar('email-msg-2', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_BAD_EMAIL') . $smE;
     }
     if (JRequest::getVar('email-msg-3', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_EMAIL_EXISTS') . $smE;
     }
     if (JRequest::getVar('website-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_NO_WEBSITE') . $smE;
     }
     if (JRequest::getVar('website-msg-2', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_BAD_WEBSITE') . $smE;
     }
     if (JRequest::getVar('content-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_NO_CONTENT') . $smE;
     }
     if (JRequest::getVar('content-msg-2', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_BAD_CONTENT') . $smE;
     }
     if (JRequest::getVar('ip-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_IP_BAN_NO_ACCESS') . $smE;
     }
     if (JRequest::getVar('reguser-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_REG_USER_ONLY_NO_ACCESS') . $smE;
     }
     if (JRequest::getVar('denyurl-msg-1', 0, 'get', 'int') == 1) {
         $this->tmpl['errmsg_top'] .= $smB . JText::_('COM_PHOCAGUESTBOOK_DENY_URL') . $smE;
     }
     //Form Variables --------------------------------------------------------------------------------
     //-----------------------------------------------------------------------------------------------
     // !!!! 2. Before Server Side Checking controll, don't show form (but there is a server side
     //         checking, it means, if the user hack the form which is not displayed to him
     //         there is a server checking controll too.
     //-----------------------------------------------------------------------------------------------
     //Don't show form, is IP Ban is wrong
     /*	$ip_ban			= trim( $params->get( 'ip_ban', '' ) );
     		$ip_ban_array	= explode( ',', $ip_ban );
     		
     		$i = '192.68.25.23';
     		$this->tmpl['ipa'] 	= 1;//display
     		if (is_array($ip_ban_array)) {
     			foreach ($ip_ban_array as $value) {
     				
     				if ($i == trim($value)) {
     					$this->tmpl['ipa'] = 0;
     					echo "ano";
     					break;// found
     				}
     			}
     		}*/
     $post['ip'] = $_SERVER["REMOTE_ADDR"];
     $ip_ban = trim($params->get('ip_ban'));
     $ip_ban_array = explode(',', $ip_ban);
     $this->tmpl['ipa'] = 1;
     //display
     if (is_array($ip_ban_array)) {
         foreach ($ip_ban_array as $valueIp) {
             //if ($post['ip'] == trim($value)) {
             if ($valueIp != '') {
                 if (strstr($post['ip'], trim($valueIp)) && strpos($post['ip'], trim($valueIp)) == 0) {
                     $this->tmpl['ipa'] = 0;
                     JRequest::setVar('ip-msg-1', 1, 'get', true);
                     break;
                 }
             }
         }
     }
     // Display or not to display the form
     // If user is registered - return 1, if not return 0, if not but the form can be displayed for not registered, return 1
     $this->tmpl['registered_users_only'] = PhocaguestbookHelperFront::isRegisteredUser($this->tmpl['registered_users_only'], $user->id);
     $this->tmpl['show_form'] = 1;
     if ($this->tmpl['ipa'] == 0) {
         $this->tmpl['show_form'] = 0;
         $this->tmpl['ipa_msg'] = '<p>' . JText::_('COM_PHOCAGUESTBOOK_IP_BAN_NO_ACCESS') . '</p>';
     } else {
         $this->tmpl['ipa_msg'] = '';
     }
     if ($this->tmpl['registered_users_only'] == 0) {
         $this->tmpl['show_form'] = 0;
         $this->tmpl['reguser_msg'] = '<p>' . JText::_('COM_PHOCAGUESTBOOK_REG_USER_ONLY_NO_ACCESS') . '</p>';
     } else {
         $this->tmpl['reguser_msg'] = '';
     }
     // Recaptcha
     if ((int) $this->tmpl['captcha_id'] == 4) {
         require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'recaptchalib.php';
         // Session of standard captcha is not used
         $session =& JFactory::getSession();
         $tmpl['session_suffix'] = $params->get('session_suffix');
         $session->set('pgbsess' . $tmpl['session_suffix'], '');
     }
     // Display or hide form
     if ($this->tmpl['show_form'] == 1) {
         if ($this->tmpl['display_form'] == 0) {
             JHTML::_('behavior.framework', true);
             // if user posted a message and get some error warning (captcha, ...) the form should be open
             if ($this->tmpl['errmsg_captcha'] == '' && $this->tmpl['errmsg_top'] == '') {
                 $hide = '.hide()';
                 $open = 0;
             } else {
                 $hide = '';
                 $open = 1;
             }
             $document->addScriptDeclaration(' window.addEvent(\'domready\', function() {' . "\n" . '  var pgVSlide = new Fx.Slide(\'pg-guestbook\')' . $hide . ';' . "\n" . '  var status	= ' . $open . "\n" . '  $(\'pg-open-guestbook\').addEvent(\'click\', function(e){' . "\n" . '   e.stop();' . "\n" . '    if (status == 0) {' . "\n" . '	   pgVSlide.slideIn();' . "\n" . '	   status = 1;' . "\n" . '    } else {' . "\n" . '	   pgVSlide.slideOut();' . "\n" . '	   status = 0;' . "\n" . '    }' . "\n" . '  });' . "\n" . ' });' . "\n");
         }
     }
     // Hidden Field
     $this->tmpl['hidden_field_output'][1] = $this->tmpl['hidden_field_output'][2] = $this->tmpl['hidden_field_output'][3] = $this->tmpl['hidden_field_output'][4] = $this->tmpl['hidden_field_output'][5] = '';
     if ($this->tmpl['enable_hidden_field'] == 1) {
         $session =& JFactory::getSession();
         $session_suffix = $params->get('session_suffix');
         $hiddenSession = 'pgbsesshf' . $session_suffix;
         $fieldPos = PhocaguestbookHelperFront::setHiddenFieldPos($this->tmpl['display_title_form'], $this->tmpl['display_name_form'], $this->tmpl['display_email_form'], $this->tmpl['display_website_form'], $this->tmpl['display_content_form']);
         $session->set($hiddenSession . 'name', PhocaguestbookHelperFront::getRandomString(mt_rand(6, 10)));
         $session->set($hiddenSession . 'id', 'pgb' . $session->get($hiddenSession . 'name'));
         $session->set($hiddenSession . 'class', 'pgb' . PhocaguestbookHelperFront::getRandomString(mt_rand(6, 10)));
         $this->tmpl['hidden_field_output'][$fieldPos] = '<input type="text" name="' . $session->get($hiddenSession . 'name') . '" size="32" maxlength="200" id="' . $session->get($hiddenSession . 'id') . '" class="pgbinput ' . $session->get($hiddenSession . 'class') . '" />';
         $document->addCustomTag('<style type="text/css"> .' . $session->get($hiddenSession . 'class') . ' { ' . "\n\t" . 'display: none;' . "\n" . '}</style>');
     }
     // End hidden field
     //$this->assignRef( 'tmpl' ,			$this->tmpl);
     $this->assignRef('id', $id);
     $this->assignRef('formdata', $formdata);
     //captcha is wrong, add the same values via POST into form as they were
     $this->assignRef('items', $items);
     $this->assignRef('guestbooks', $guestbooks);
     $this->assignRef('params', $params);
     $this->assignRef('pagination', $pagination);
     $this->assign('action', $uri->toString());
     //$this->_prepareDocument();
     parent::display($tpl);
 }
 function unpublish()
 {
     $app = JFactory::getApplication();
     $user =& JFactory::getUser();
     $cid = JRequest::getVar('mid', null, '', 'int');
     $id = JRequest::getVar('id', null, '', 'int');
     $itemid = JRequest::getVar('Itemid', null, '', 'int');
     $limitstart = JRequest::getVar('limitstart', null, '', 'int');
     $model = $this->getModel('guestbook');
     $canAdmin = PhocaguestbookHelperFront::canAdmin();
     if ($canAdmin) {
         if (count($cid) < 1) {
             JError::raiseError(500, JText::_('COM_PHOCAGUESTBOOK_WARNING_SELECT_ITEM_UNPUBLISH'));
         }
         if (!$model->publish($cid, 0)) {
             echo "<script> alert('" . $model->getError(true) . "'); window.history.go(-1); </script>\n";
             $msg = JText::_('COM_PHOCAGUESTBOOK_ERROR_UNPUBLISH_ITEM');
         } else {
             $msg = JText::_('COM_PHOCAGUESTBOOK_SUCCESS_UNPUBLISH_ITEM');
         }
     } else {
         $msg = JText::_('COM_PHOCAGUESTBOOK_NOT_AUTHORIZED_DO_ACTION');
     }
     // Limitstart (if we delete the last item from last pagination, this pagination will be lost, we must change limitstart)
     $countItem = $model->countItem($id);
     if ((int) $countItem[0] == $limitstart) {
         $limitstart = 0;
     }
     // Redirect
     $link = 'index.php?option=com_phocaguestbook&view=guestbook&id=' . $id . '&Itemid=' . $itemid . '&limitstart=' . $limitstart;
     $link = JRoute::_($link, false);
     $this->setRedirect($link, $msg);
 }
 function sendPhocaGuestbookMail($id, $post2, $url, $tmpl)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $sitename = $app->getCfg('sitename');
     //get all super administrator
     $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE id = ' . (int) $id;
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (isset($post2['title']) && $post2['title'] != '') {
         $subject = $sitename . ' (' . JText::_('COM_PHOCAGUESTBOOK_PG_NEW_POST') . '): ' . PhocaguestbookHelperFront::wordDelete($post2['title'], 25, '...');
         $title = $post2['title'];
     } else {
         $subject = $sitename . " (" . JText::_('COM_PHOCAGUESTBOOK_PG_NEW_POST') . ')';
         $title = $post2['title'];
     }
     if (isset($post2['username']) && $post2['username'] != '') {
         $fromname = $post2['username'];
     } else {
         $fromname = $tmpl['predefined_name'];
     }
     if (isset($post2['email']) && $post2['email'] != '') {
         $mailfrom = $post2['email'];
     } else {
         $mailfrom = $rows[0]->email;
     }
     if (isset($post2['content']) && $post2['content'] != '') {
         $content = $post2['content'];
     } else {
         $content = "...";
     }
     $email = $rows[0]->email;
     $post2['content'] = str_replace("</p>", "\n", $post2['content']);
     $post2['content'] = strip_tags($post2['content']);
     $message = JText::_('COM_PHOCAGUESTBOOK_PG_NEW_POST_ADDED') . "\n\n" . JText::_('COM_PHOCAGUESTBOOK_WEBSITE') . ': ' . $sitename . "\n" . JText::_('COM_PHOCAGUESTBOOK_FROM') . ': ' . $fromname . "\n" . JText::_('COM_PHOCAGUESTBOOK_DATE') . ': ' . JHTML::_('date', gmdate('Y-m-d H:i:s'), JText::_('DATE_FORMAT_LC2')) . "\n\n" . JText::_('COM_PHOCAGUESTBOOK_SUBJECT') . ': ' . $title . "\n" . JText::_('COM_PHOCAGUESTBOOK_CONTENT') . ': ' . "\n" . "\n\n" . PhocaguestbookHelperFront::wordDelete($post2['content'], 400, '...') . "\n\n" . "\n\n" . JText::_('COM_PHOCAGUESTBOOK_CLICK_LINK') . "\n" . $url . "\n\n" . JText::_('COM_PHOCAGUESTBOOK_REGARDS') . ", \n" . $sitename . "\n";
     $subject = html_entity_decode($subject, ENT_QUOTES);
     $message = html_entity_decode($message, ENT_QUOTES);
     JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);
     return true;
 }
 public function getCaptchaUrl($id)
 {
     $paramsC = JComponentHelper::getParams('com_phocaguestbook');
     $captcha_url = $paramsC->get('captcha_url', 1);
     $index = 'index.php';
     $app = JFactory::getApplication();
     if ($app->getLanguageFilter()) {
         $lang = JFactory::getLanguage();
         $langCode = $lang->getTag();
         $langSef = PhocaguestbookHelperFront::getLangSef($langCode);
         if ($langSef != '') {
             $index = 'index.php/' . $langSef . '/';
         }
     }
     switch ($captcha_url) {
         case 2:
             // Full Path
             return '<img src="' . JURI::base(false) . '' . $index . '?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int') . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
         case 3:
             // No Itemid Full Path
             return '<img src="' . JURI::base(false) . '' . $index . '?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
         case 4:
             // No language prefix - standard path
             return '<img src="' . JURI::base(true) . '/index.php?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int') . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
         case 5:
             // No language prefix - full path
             return '<img src="' . JURI::base(false) . 'index.php?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int') . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
         case 6:
             // No Itemid Full Path No Language
             return '<img src="' . JURI::base(false) . 'index.php?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
         case 7:
             // No Itemid Relative Path No Language
             return '<img src="' . JURI::base(true) . '/index.php?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
         case 1:
         default:
             // Standard Path
             return '<img src="' . JURI::base(true) . '/' . $index . '?option=com_phocaguestbook&view=guestbooki&id=' . $id . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int') . '&phocasid=' . md5(uniqid(time())) . '" alt="' . JText::_('COM_PHOCAGUESTBOOK_CAPTCHA_IMAGE') . '" id="phocacaptcha" />';
             break;
     }
     return false;
 }
Esempio n. 6
0
        echo '<tr>' . '<td><strong>' . JText::_('COM_PHOCAGUESTBOOK_CONTENT') . PhocaguestbookHelperFront::getRequiredSign((int) $this->tmpl['display_content_form']) . ' </strong></td>' . '<td colspan="3">' . $this->tmpl['editor'] . $this->tmpl['hidden_field_output'][5] . '</td>' . '</tr>';
    }
    if ((int) $this->tmpl['enable_captcha'] > 0 && $this->tmpl['captcha_id'] > 0) {
        // Server side checking CAPTCHA
        echo $this->tmpl['errmsg_captcha'];
        //-- Server side checking CAPTCHA
        // Set fix height because of pane slider
        $imageHeight = 'style="height:105px"';
        echo '<tr>' . '<td width="5"><strong>' . JText::_('COM_PHOCAGUESTBOOK_IMG_VERIFICATION') . PhocaguestbookHelperFront::getRequiredSign(2) . ' </strong></td>';
        if ((int) $this->tmpl['captcha_id'] == 4) {
            echo '<td colspan="2" align="center" valign="middle" ' . $imageHeight . '>';
            echo PhocaGuestbookHelperReCaptcha::recaptcha_get_html($this->tmpl['recaptcha_publickey']);
            echo '</td>';
        } else {
            echo '<td width="5" align="left" valign="middle" ' . $imageHeight . '>';
            echo PhocaguestbookHelperFront::getCaptchaUrl($this->id);
            echo '</td>';
            echo '<td width="5" align="left" valign="middle">' . '<input type="text" id="pgbcaptcha" name="captcha" size="6" maxlength="6" class="pgbinput" /></td>';
            echo '<td align="center" width="50" valign="middle">';
            //Remove because of IE6 - href="javascript:void(0)" onclick="javascript:reloadCaptcha();"
            echo '<a href="javascript:reloadCaptcha();" title="' . JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '" >' . JHTML::_('image', 'components/com_phocaguestbook/assets/images/icon-reload.gif', JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE')) . '</a></td>';
        }
        echo '</tr>';
    }
    echo '<tr>' . '<td>&nbsp;</td>' . '<td colspan="3">' . '<input type="submit" name="save" value="' . JText::_('COM_PHOCAGUESTBOOK_SUBMIT') . '" />' . ' &nbsp;' . '<input type="reset" name="reset" value="' . JText::_('COM_PHOCAGUESTBOOK_RESET') . '" /></td>' . '</tr>' . '</table>';
    echo '<input type="hidden" name="cid" value="' . $this->id . '" />' . "\n" . '<input type="hidden" name="language" value="' . $this->guestbooks->language . '" />' . "\n" . '<input type="hidden" name="option" value="com_phocaguestbook" />' . "\n" . '<input type="hidden" name="view" value="guestbook" />' . "\n" . '<input type="hidden" name="controller" value="phocaguestbook" />' . "\n" . '<input type="hidden" name="task" value="submit" />' . "\n" . '<input type="hidden" name="' . JUtility::getToken() . '" value="1" />' . "\n" . '</form>' . "\n" . '</div><div style="clear:both;">&nbsp;</div>';
    // Display Pane or not
    //	if ($this->tmpl['display_form'] == 0 ) {
    //		echo '</div>';
    //	}
} else {