Ejemplo n.º 1
0
 function ValidateCaptcha()
 {
     $usecaptcha = FST_Settings::get('captcha_type');
     if ($usecaptcha == "") {
         return true;
     }
     if ($usecaptcha == "fsj") {
         if ($_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'])) {
             //unset($_SESSION['security_code']);
             return true;
         }
         return false;
     }
     if ($usecaptcha == "recaptcha") {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_fst' . DS . 'helper' . DS . 'recaptcha.php';
         global $fst_publickey, $fst_privatekey;
         if (array_key_exists("recaptcha_challenge_field", $_POST)) {
             $resp = fst_recaptcha_check_answer($fst_privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         } else {
             $resp = null;
         }
         if ($resp && $resp->is_valid) {
             return true;
         } else {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 function ParserPopulateTicket(&$parser, $row)
 {
     $parser->Clear();
     if ($row) {
         $parser->SetVar('ref', $row['reference']);
         $parser->SetVar('subject', "<a href='" . FSTRoute::_('index.php?option=com_fst&view=admin&layout=support&ticketid=' . $row['id']) . "'>" . $row['title'] . "</a>");
         $parser->SetVar("status", "<span style='color:" . $row['color'] . ";'>" . $row['status'] . "</span>");
         if ($row['user_id'] == 0) {
             $name = $row['unregname'] . " (" . JText::_("UNREG") . ")";
         } else {
             $name = $row['name'];
         }
         $parser->SetVar("name", $name);
         $parser->SetVar("lastactivity", FST_Helper::Date($row['lastupdate'], FST_DATETIME_SHORT));
         $parser->SetVar("opened", FST_Helper::Date($row['opened'], FST_DATETIME_SHORT));
         $parser->SetVar("closed", FST_Helper::Date($row['closed'], FST_DATETIME_SHORT));
         $parser->SetVar("department", $row['department']);
         $parser->SetVar("category", $row['category']);
         $parser->SetVar("product", $row['product']);
         $parser->SetVar("priority", "<span style='color:" . $row['pricolor'] . ";'>" . $row['priority'] . "</span>");
         $groups = implode(", ", $row['groups']);
         $parser->SetVar('groups', $groups);
         $parser->SetVar('deletebutton', 'deletebutton');
         $parser->SetVar('archivebutton', 'archivebutton');
         if (array_key_exists("custom", $row)) {
             $allcustom = array();
             if (count($row['custom']) > 0) {
                 foreach ($row['custom'] as $id => $value) {
                     if (array_key_exists($id, $this->customfields)) {
                         $field = $this->customfields[$id];
                         if ($field['type'] == "plugin") {
                             $aparams = FSTCF::GetValues($field);
                             if (array_key_exists("plugin", $aparams) && array_key_exists("plugindata", $aparams)) {
                                 $plugin = FSTCF::get_plugin($aparams['plugin']);
                                 $value = $plugin->Display($value, $aparams['plugindata'], array('ticketid' => $row['id'], 'userid' => $row['user_id'], 'ticket' => $row), $field['id']);
                             }
                         }
                         $text = "<span class='fst_support_fieldname'>" . $this->customfields[$id]['description'] . "</span>";
                         if ($this->customfields[$id]['type'] == "checkbox") {
                             if ($value == "on") {
                                 $text .= ": " . JText::_("Yes");
                             } else {
                                 $text .= ": " . JText::_("No");
                             }
                         } else {
                             $text .= ": " . $value;
                         }
                         $parser->SetVar("custom" . $id, $text);
                         $allcustom[] = $text;
                     }
                 }
             }
             //echo "All custom : " . implode(", ",$allcustom) . "<br>";
             $parser->SetVar("custom", implode(", ", $allcustom));
         }
         if ($row['assigned'] == '') {
             $parser->SetVar('handlername', JText::_("UNASSIGNED"));
         } else {
             $parser->SetVar('handlername', $row['assigned']);
         }
         $parser->SetVar('username', $row['username']);
         $parser->SetVar('email', $row['useremail']);
         $parser->SetVar('handlerusername', $row['handlerusername']);
         $parser->SetVar('handleremail', $row['handleremail']);
         $icons = "";
         if (FST_Settings::get('support_show_msg_counts')) {
             $icons .= "<span>";
             $icons .= "<span style='font-weight:normal;top:-2px;position:relative;padding-right:2px;'>" . $row['msgcount']['total'] . "</span><span style='font-weight:normal;top:-2px;position:relative;padding-right:2px;'>x</span><img src='" . JURI::root(true) . "/components/com_fst/assets/images/messages.png'>";
             $icons .= "</span>";
         }
         $cotime = $this->db_time - strtotime($row['checked_out_time']);
         if ($cotime < FST_Settings::get('support_lock_time') && $row['checked_out'] != $this->userid && $row['checked_out'] > 0) {
             $html = "<div class='fst_user_tt'>" . $row['co_user']->name . " (" . $row['co_user']->email . ")</div>";
             $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fst/assets/images/lock.png' title=\"" . JText::_('TICKET_LOCKED') . "::" . $html . "\">";
         } else {
             $icons .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/blank_16.png'>";
         }
         if (!FST_Settings::get('support_hide_tags')) {
             if (isset($row['tags'])) {
                 $html = "";
                 foreach ($row['tags'] as $tag) {
                     $html .= "<div class='fst_tag_tt'>" . $tag['tag'] . "</div>";
                 }
                 $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fst/assets/images/tag.png' title=\"" . JText::_('TICKET_TAGS') . "::" . $html . "\">";
             } else {
                 $icons .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/blank_16.png'>";
             }
         }
         if (isset($row['attach'])) {
             $html = "<table class='fst_attach_tt'>";
             foreach ($row['attach'] as $attach) {
                 $html .= "<tr style='border:0px;'><td nowrap style='border:0px;'>" . $attach['filename'] . "&nbsp;</td><td nowrap style='border:0px;'>&nbsp;" . FST_Helper::display_filesize($attach['size']) . "</td></tr>";
             }
             $html .= "<table>";
             $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fst/assets/images/attach.png' title=\"" . JText::_('TICKET_ATTACHMENTS') . "::" . $html . "\">";
         } else {
             $icons .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/blank_16.png'>";
         }
         $parser->SetVar('icons', $icons);
         $delete = "<a href='" . FSTRoute::x('index.php?option=com_fst&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&delete=' . $row['id']) . "'>";
         $delete .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/delete_ticket.png'>";
         $delete .= JText::_("DELETE") . "</a>";
         $archive = "<a href='" . FSTRoute::x('index.php?option=com_fst&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&archive=' . $row['id']) . "'>";
         $archive .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/archive_ticket.png'>";
         $archive .= JText::_("ARCHIVE") . "</a>";
         $parser->SetVar('archivebutton', $archive);
         $parser->SetVar('deletebutton', $delete);
         // TODO: trhl
         /*id='ticket_<?php echo $ticket['id'];?>'
         		onmouseover="$('ticket_<?php echo $ticket['id'];?>').style.background = '<?php echo FST_Settings::get('css_hl'); ?>';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '<?php echo FST_Settings::get('css_hl'); ?>';"
         		onmouseout="$('ticket_<?php echo $ticket['id'];?>').style.background = '';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '';"*/
         $this->_permissions = FST_Ticket_Helper::getAdminPermissions();
         $type = "unassigned";
         if ($row['admin_id'] == $this->_permissions['id']) {
             $type = "mine";
         } else {
             if ($row['admin_id'] > 0) {
                 $type = "other";
             }
         }
         $style = "";
         if (array_key_exists($row['ticket_pri_id'], $this->priorities)) {
             $pri = $this->priorities[$row['ticket_pri_id']];
             if ($pri['backcolor']) {
                 $style .= "background-color: {$pri['backcolor']};";
             }
         }
         $handler_highlight = "ticket_type_{$type}";
         $parser->SetVar('handler_highlight', $handler_highlight);
         $trhl = " class='ticket_{$row['id']} ' onmouseover='highlightticket({$row['id']})' onmouseout='unhighlightticket({$row['id']})' ";
         if (FST_Settings::get('support_entire_row')) {
             $style .= "cursor: pointer;";
             $trhl .= " onclick='window.location=\"" . FSTRoute::x('&limitstart=&ticketid=' . $row['id']) . "\"' ";
         }
         $trhl .= " style='{$style}' ";
         $parser->SetVar('trhl', $trhl);
     }
     $parser->SetVar("showassigned", $this->showassigned);
     $parser->SetVar("hidehandler", FST_Settings::get('support_hide_handler'));
     $parser->SetVar("candelete", FST_Settings::get('support_delete'));
     $parser->SetVar("view", $this->ticket_view);
 }
Ejemplo n.º 3
0
?>

		</td>	
	</tr>
</table>

<script>
jQuery(document).ready(function () {
	jQuery('#frame_version').attr('src',"http://freestyle-joomla.com/latestversion-fst?ver=<?php 
echo FSTAdminHelper::GetVersion();
?>
");
	jQuery('#frame_version').load(function() 
    {
        jQuery('#please_wait').remove();
    });

	jQuery('.fst_main_item').mouseenter(function () {
		jQuery(this).css('background-color', '<?php 
echo FST_Settings::get('css_hl');
?>
');
	});
	jQuery('.fst_main_item').mouseleave(function () {
		jQuery(this).css('background-color' ,'transparent');
	});

	jQuery('#frame_announce').attr('src',"http://freestyle-joomla.com/support/announcements?tmpl=component");
	jQuery('#frame_help').attr('src',"http://freestyle-joomla.com/comhelp/fst-main-help");
});
</script>
Ejemplo n.º 4
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     if (JRequest::getVar('task') == "cancellist") {
         $mainframe = JFactory::getApplication();
         $link = FSTRoute::x('index.php?option=com_fst&view=fsts', false);
         $mainframe->redirect($link);
         return;
     }
     $what = JRequest::getString('what', '');
     $this->tab = JRequest::getVar('tab');
     $settings = FST_Settings::GetAllSettings();
     $db =& JFactory::getDBO();
     if ($what == "testref") {
         return $this->TestRef();
     } else {
         if ($what == "save") {
             $large = FST_Settings::GetLargeList();
             $templates = FST_Settings::GetTemplateList();
             $intpltable = FST_Settings::StoreInTemplateTable();
             // save support custom setting
             $head = JRequest::getVar('support_list_head', '', 'post', 'string', JREQUEST_ALLOWRAW);
             $row = JRequest::getVar('support_list_row', '', 'post', 'string', JREQUEST_ALLOWRAW);
             $qry = "REPLACE INTO #__fst_templates (template, tpltype, value) VALUES ('custom', 1, '" . FSTJ3Helper::getEscaped($db, $head) . "')";
             $db->setQuery($qry);
             $db->Query();
             $qry = "REPLACE INTO #__fst_templates (template, tpltype, value) VALUES ('custom', 0, '" . FSTJ3Helper::getEscaped($db, $row) . "')";
             $db->setQuery($qry);
             $db->Query();
             unset($_POST['support_list_head']);
             unset($_POST['support_list_row']);
             // save templates
             $intpltable = FST_Settings::StoreInTemplateTable();
             foreach ($intpltable as $template) {
                 $value = JRequest::getVar($template, '', 'post', 'string', JREQUEST_ALLOWRAW);
                 $qry = "REPLACE INTO #__fst_templates (template, tpltype, value) VALUES ('" . FSTJ3Helper::getEscaped($db, $template) . "', 2, '" . FSTJ3Helper::getEscaped($db, $value) . "')";
                 $db->setQuery($qry);
                 $db->Query();
             }
             // large settings
             foreach ($large as $setting) {
                 if (!array_key_exists($setting, $templates)) {
                     continue;
                 }
                 $value = JRequest::getVar($setting, '', 'post', 'string', JREQUEST_ALLOWRAW);
                 $qry = "REPLACE INTO #__fst_settings_big (setting, value) VALUES ('";
                 $qry .= FSTJ3Helper::getEscaped($db, $setting) . "','";
                 $qry .= FSTJ3Helper::getEscaped($db, $value) . "')";
                 //echo $qry."<br>";
                 $db->setQuery($qry);
                 $db->Query();
                 $qry = "DELETE FROM #__fst_settings WHERE setting = '" . FSTJ3Helper::getEscaped($db, $setting) . "'";
                 //echo $qry."<br>";
                 $db->setQuery($qry);
                 $db->Query();
                 unset($_POST[$setting]);
             }
             $data = JRequest::get('POST', JREQUEST_ALLOWRAW);
             foreach ($data as $setting => $value) {
                 if (array_key_exists($setting, $settings)) {
                     $settings[$setting] = $value;
                 }
             }
             foreach ($settings as $setting => $value) {
                 if (!array_key_exists($setting, $data)) {
                     $settings[$setting] = 0;
                     $value = 0;
                 }
                 if (!array_key_exists($setting, $templates)) {
                     continue;
                 }
                 if (array_key_exists($setting, $large)) {
                     continue;
                 }
                 $qry = "REPLACE INTO #__fst_settings (setting, value) VALUES ('";
                 $qry .= FSTJ3Helper::getEscaped($db, $setting) . "','";
                 $qry .= FSTJ3Helper::getEscaped($db, $value) . "')";
                 $db->setQuery($qry);
                 $db->Query();
                 //echo $qry."<br>";
             }
             //exit;
             $link = 'index.php?option=com_fst&view=templates#' . $this->tab;
             if (JRequest::getVar('task') == "save") {
                 $link = 'index.php?option=com_fst';
             }
             $mainframe = JFactory::getApplication();
             $mainframe->redirect($link, JText::_("Settings_Saved"));
             exit;
         } else {
             if ($what == "customtemplate") {
                 $this->CustomTemplate();
                 exit;
             } else {
                 // load other templates
                 $intpltable = FST_Settings::StoreInTemplateTable();
                 $tpls = array();
                 foreach ($intpltable as $template) {
                     $settings[$template] = '';
                     $settings[$template . '_default'] = '';
                     $tpls[] = FSTJ3Helper::getEscaped($db, $template);
                 }
                 $tpllist = "'" . implode("', '", $tpls) . "'";
                 $qry = "SELECT * FROM #__fst_templates WHERE template IN ({$tpllist})";
                 $db->setQuery($qry);
                 $rows = $db->loadAssocList();
                 if (count($rows) > 0) {
                     foreach ($rows as $row) {
                         if ($row['tpltype'] == 2) {
                             $settings[$row['template']] = $row['value'];
                         } else {
                             if ($row['tpltype'] == 3) {
                                 $settings[$row['template'] . '_default'] = $row['value'];
                             }
                         }
                     }
                 }
                 // load ticket template stuff
                 $qry = "SELECT * FROM #__fst_templates WHERE template = 'custom'";
                 $db->setQuery($qry);
                 $rows = $db->loadAssocList();
                 if (count($rows) > 0) {
                     foreach ($rows as $row) {
                         if ($row['tpltype'] == 1) {
                             $settings['support_list_head'] = $row['value'];
                         } else {
                             if ($row['tpltype'] == 0) {
                                 $settings['support_list_row'] = $row['value'];
                             }
                         }
                     }
                 } else {
                     $settings['support_list_head'] = '';
                     $settings['support_list_row'] = '';
                 }
                 $qry = "SELECT * FROM #__fst_templates WHERE tpltype = 2";
                 $db->setQuery($qry);
                 $rows = $db->loadAssocList();
                 if (count($rows) > 0) {
                     foreach ($rows as $row) {
                         $settings[$row['template']] = $row['value'];
                     }
                 }
                 $document = JFactory::getDocument();
                 $document->addStyleSheet(JURI::root() . 'administrator/components/com_fst/assets/css/js_color_picker_v2.css');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/color_functions.js');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/js_color_picker_v2.js');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/codemirror/codemirror.js');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/codemirror/modes/css/css.js');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/codemirror/modes/javascript/javascript.js');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/codemirror/modes/xml/xml.js');
                 $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/codemirror/modes/htmlmixed/htmlmixed.js');
                 $document->addStyleSheet(JURI::root() . 'administrator/components/com_fst/assets/css/codemirror/codemirror.css');
                 $this->assignRef('settings', $settings);
                 JToolBarHelper::title(JText::_("FREESTYLE_TESTIMONIALS") . ' - ' . JText::_("TEMPLATES"), 'fst_templates');
                 JToolBarHelper::apply();
                 JToolBarHelper::save();
                 JToolBarHelper::cancel('cancellist');
                 FSTAdminHelper::DoSubToolbar();
                 parent::display($tpl);
             }
         }
     }
 }
Ejemplo n.º 5
0
 static function GetInstalledVersion()
 {
     return FST_Settings::get('version');
 }
Ejemplo n.º 6
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     $what = JRequest::getString('what', '');
     $this->tab = JRequest::getVar('tab');
     if (JRequest::getVar('task') == "cancellist") {
         $mainframe = JFactory::getApplication();
         $link = FSTRoute::x('index.php?option=com_fst&view=fsts', false);
         $mainframe->redirect($link);
         return;
     }
     $settings = FST_Settings::GetAllSettings();
     $db =& JFactory::getDBO();
     if ($what == "testref") {
         return $this->TestRef();
     } else {
         if ($what == "testdates") {
             return $this->testdates();
         } else {
             if ($what == "save") {
                 //
                 $large = FST_Settings::GetLargeList();
                 $templates = FST_Settings::GetTemplateList();
                 // save any large settings that arent in the templates list
                 foreach ($large as $setting) {
                     // skip any setting that is in the templates list
                     if (array_key_exists($setting, $templates)) {
                         continue;
                     }
                     //
                     $value = JRequest::getVar($setting, '', 'post', 'string', JREQUEST_ALLOWRAW);
                     $qry = "REPLACE INTO #__fst_settings_big (setting, value) VALUES ('";
                     $qry .= FSTJ3Helper::getEscaped($db, $setting) . "','";
                     $qry .= FSTJ3Helper::getEscaped($db, $value) . "')";
                     $db->setQuery($qry);
                     $db->Query();
                     $qry = "DELETE FROM #__fst_settings WHERE setting = '" . FSTJ3Helper::getEscaped($db, $setting) . "'";
                     $db->setQuery($qry);
                     $db->Query();
                     unset($_POST[$setting]);
                 }
                 $data = JRequest::get('POST', JREQUEST_ALLOWRAW);
                 foreach ($data as $setting => $value) {
                     if (array_key_exists($setting, $settings)) {
                         $settings[$setting] = $value;
                     }
                 }
                 foreach ($settings as $setting => $value) {
                     if (!array_key_exists($setting, $data)) {
                         $settings[$setting] = 0;
                         $value = 0;
                     }
                     // skip any setting that is in the templates list
                     if (array_key_exists($setting, $templates)) {
                         continue;
                     }
                     if (array_key_exists($setting, $large)) {
                         continue;
                     }
                     $qry = "REPLACE INTO #__fst_settings (setting, value) VALUES ('";
                     $qry .= FSTJ3Helper::getEscaped($db, $setting) . "','";
                     $qry .= FSTJ3Helper::getEscaped($db, $value) . "')";
                     $db->setQuery($qry);
                     $db->Query();
                     //echo $qry."<br>";
                 }
                 $link = 'index.php?option=com_fst&view=settings#' . $this->tab;
                 if (JRequest::getVar('task') == "save") {
                     $link = 'index.php?option=com_fst';
                 }
                 //exit;
                 $mainframe = JFactory::getApplication();
                 $mainframe->redirect($link, JText::_("Settings_Saved"));
                 exit;
             } else {
                 if ($what == "customtemplate") {
                     $this->CustomTemplate();
                     exit;
                 } else {
                     $qry = "SELECT * FROM #__fst_templates WHERE template = 'custom'";
                     $db->setQuery($qry);
                     $rows = $db->loadAssocList();
                     if (count($rows) > 0) {
                         foreach ($rows as $row) {
                             if ($row['tpltype']) {
                                 $settings['support_list_head'] = $row['value'];
                             } else {
                                 $settings['support_list_row'] = $row['value'];
                             }
                         }
                     } else {
                         $settings['support_list_head'] = '';
                         $settings['support_list_row'] = '';
                     }
                     //
                     $document = JFactory::getDocument();
                     $document->addStyleSheet(JURI::root() . 'administrator/components/com_fst/assets/css/js_color_picker_v2.css');
                     $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/color_functions.js');
                     $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/js_color_picker_v2.js');
                     $this->assignRef('settings', $settings);
                     JToolBarHelper::title(JText::_("FREESTYLE_TESTIMONIALS") . ' - ' . JText::_("SETTINGS"), 'fst_settings');
                     JToolBarHelper::apply();
                     JToolBarHelper::save();
                     JToolBarHelper::cancel('cancellist');
                     FSTAdminHelper::DoSubToolbar();
                     parent::display($tpl);
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
    require_once JPATH_SITE . DS . 'components' . DS . 'com_fst' . DS . 'helper' . DS . 'comments.php';
    $css = JRoute::_("index.php?option=com_fst&view=css&layout=default");
    $document = JFactory::getDocument();
    $document->addStyleSheet($css);
    FST_Helper::IncludeJQuery();
    $document->addScript(JURI::base() . 'components/com_fst/assets/js/jquery.autoscroll.js');
    $db = JFactory::getDBO();
    JHTML::_('behavior.modal', 'a.fst_modal');
    //JHTML::_('behavior.mootools');
    $prodid = $params->get('prodid');
    $dispcount = $params->get('dispcount');
    $listtype = $params->get('listtype');
    $maxlength = $params->get('maxlength');
    $showmore = $params->get('show_more');
    $showadd = $params->get('show_add');
    $maxheight = $params->get('maxheight');
    $comments = new FST_Comments("test", $prodid);
    $comments->template = "comments_testmod";
    if (FST_Settings::get('comments_testmod_use_custom')) {
        $comments->template_type = 2;
    }
    if ($listtype == 0) {
        $comments->opt_order = 2;
    }
    $comments->opt_no_mod = 1;
    $comments->opt_no_edit = 1;
    $comments->opt_show_add = 0;
    $comments->opt_max_length = $maxlength;
    $comments->opt_disable_pages = 1;
    require JModuleHelper::getLayoutPath('mod_fst_test');
}
Ejemplo n.º 8
0
<?php

/**
 * @package Freestyle Joomla
 * @author Freestyle Joomla
 * @copyright (C) 2013 Freestyle Joomla
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die;
?>
<div style="clear:both;"></div>
<?php 
if (!FST_Settings::get('hide_powered')) {
    ?>
<div align="center" style="text-align:center;padding-top:20px;">
<a href="http://www.freestyle-joomla.com/">
Powered by Freestyle Testimonials
<br>
		<img style="padding-top:2px;" border="0" src="<?php 
    echo JURI::root(true);
    ?>
/components/com_fst/assets/images/logo_small.png"><br>
	</a>
</div>
<?php 
}
Ejemplo n.º 9
0
 function __construct($parent)
 {
     $this->comments = $parent;
     $this->comments->use_comments = 1;
     $this->comments->showheader = 0;
     $this->comments->show_item_select = 1;
     $this->comments->use_email = FST_Settings::get('test_use_email');
     //FSJ_Settings::GetComponentSetting( fsj_get_com(), 'comments_email', 1 );
     $this->comments->use_website = FST_Settings::get('test_use_website');
     //FSJ_Settings::GetComponentSetting( fsj_get_com(), 'comments_website', 1 );
     //$this->comments->opt_display = 0;
     $this->comments->add_a_comment = JText::_('ADD_A_TESTIMONIAL');
     $this->comments->post_comment = JText::_('POST_TESTIMONIAL');
     $this->email_title = "A Testimonial";
     $this->email_article_type = JText::_('PRODUCT');
     $this->description = JText::_('TESTIMONIALS');
     $this->descriptions = JText::_('TESTIMONIALS');
     $this->long_desc = JText::_('TESTIMONIALS');
     $this->article_link = "index.php?option=com_fst&view=test&prodid={id}";
     if (FST_Settings::get('test_allow_no_product')) {
         $this->item_select_default = JText::_('GENERAL_TESTIMONIAL');
     } else {
         $this->item_select_default = JText::_('SELECT_PRODUCT');
         $this->item_select_must_have = 1;
     }
     if (FST_Settings::get('test_who_can_add') == "anyone") {
         $this->comments->can_add = 1;
     } else {
         if (FST_Settings::get('test_who_can_add') == "moderators") {
             if ($this->comments->_permissions['mod_kb'] == 0) {
                 $this->comments->can_add = 0;
             }
         } else {
             if (FST_Settings::get('test_who_can_add') == "registered") {
                 if ($this->comments->_permissions['userid'] == 0) {
                     $this->comments->can_add = 0;
                 }
             } else {
                 // who can add is an ACL, so need to do the acl test
                 //echo "Testimonials ACL : " . FST_Settings::get('test_who_can_add') . "<br>";
                 $user = JFactory::getUser();
                 $authed = $user->getAuthorisedViewLevels();
                 if (!in_array(FST_Settings::get('test_who_can_add'), $authed)) {
                     $this->comments->can_add = 0;
                 } else {
                     $this->comments->can_add = 1;
                 }
             }
         }
     }
     // set up moderation
     $commod = FST_Settings::get('test_moderate');
     $this->comments->moderate = 0;
     //print_p($this->comments->_permissions);
     if ($commod == "all") {
         $this->comments->moderate = 1;
     } elseif ($commod == "guests") {
         if ($this->comments->_permissions['userid'] == 0) {
             $this->comments->moderate = 1;
         }
     } elseif ($commod == "registered") {
         if ($this->comments->_permissions['mod_kb'] == 0) {
             $this->comments->moderate = 1;
         }
     }
     $this->comments->dest_email = FST_Settings::get('test_email_on_submit');
     $this->table = "#__fst_prod";
     $this->has_published = 1;
     $this->field_title = "title";
     $this->field_id = "id";
 }
Ejemplo n.º 10
0
 function &getTicketSearch()
 {
     FST_Ticket_Helper::getAdminPermissions();
     $mainframe = JFactory::getApplication();
     $limit = $mainframe->getUserStateFromRequest('global.list.limit_ticket', 'limit', FST_Helper::getUserSetting('per_page'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $db = JFactory::getDBO();
     if (empty($this->_tickets)) {
         $query = "SELECT t.*, s.title as status, s.color, u.name, au.name as assigned, u.email as useremail, u.username as username, au.email as handleremail, au.username as handlerusername, ";
         $query .= " dept.title as department, cat.title as category, prod.title as product, pri.title as priority, pri.color as pricolor, ";
         $query .= " grp.groupname as groupname, grp.id as group_id ";
         $query .= " , pri.translation as ptl, dept.translation as dtr, s.translation as str, cat.translation as ctr, prod.translation as prtr";
         $query .= " FROM #__fst_ticket_ticket as t ";
         $query .= " LEFT JOIN #__fst_ticket_status as s ON t.ticket_status_id = s.id ";
         $query .= " LEFT JOIN #__users as u ON t.user_id = u.id ";
         $query .= " LEFT JOIN #__fst_user as a ON t.admin_id = a.id ";
         $query .= " LEFT JOIN #__users as au ON a.user_id = au.id ";
         $query .= " LEFT JOIN #__fst_ticket_dept as dept ON t.ticket_dept_id = dept.id ";
         $query .= " LEFT JOIN #__fst_ticket_cat as cat ON t.ticket_cat_id = cat.id ";
         $query .= " LEFT JOIN #__fst_prod as prod ON t.prod_id = prod.id ";
         $query .= " LEFT JOIN #__fst_ticket_pri as pri ON t.ticket_pri_id = pri.id ";
         $query .= " LEFT JOIN (SELECT group_id, user_id FROM #__fst_ticket_group_members GROUP BY user_id) as mem ON t.user_id = mem.user_id ";
         $query .= " LEFT JOIN #__fst_ticket_group as grp ON grp.id = mem.group_id ";
         $searchtype = JRequest::getVar('searchtype', 'basic');
         $ticketids = array();
         $ticketids[0] = 0;
         $ticketid_matchall = 0;
         $tags = JRequest::getVar('tags', '');
         $tags = trim($tags, ';');
         if ($tags) {
             $tags_ = explode(";", $tags);
             $tags = array();
             foreach ($tags_ as $tag) {
                 if ($tag) {
                     $tags[$tag] = $tag;
                 }
             }
             if (count($tags) > 0) {
                 foreach ($tags as $tag) {
                     $ticketid_matchall++;
                     $qry = "SELECT ticket_id FROM #__fst_ticket_tags WHERE tag = '" . FSTJ3Helper::getEscaped($db, $tag) . "'";
                     $db->setQuery($qry);
                     //echo $qry."<br>";
                     $rows = $db->loadAssocList("ticket_id");
                     foreach ($rows as $row) {
                         $ticketid = $row['ticket_id'];
                         if (array_key_exists($ticketid, $ticketids)) {
                             $ticketids[$ticketid]++;
                         } else {
                             $ticketids[$ticketid] = 1;
                         }
                     }
                 }
             }
         }
         if ($searchtype == "basic") {
             $search = JRequest::getVar('search', '');
             $wherebits = array();
             // store tag match ids in separate array, as we want to AND them, not OR
             $tagids = $ticketids;
             $ticketids = array();
             $ticketids[0] = 0;
             if ($search != "") {
                 $wherebits[] = " t.title LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' ";
                 $wherebits[] = " t.reference = '" . FSTJ3Helper::getEscaped($db, $search) . "' ";
                 // search custom fields that are set to be searched
                 $fields = FSTCF::GetAllCustomFields(true);
                 /*echo "<pre>";
                 		print_r($fields);
                 		echo "</pre>";*/
                 foreach ($fields as $field) {
                     if (!$field['basicsearch']) {
                         continue;
                     }
                     $ticketid_matchall++;
                     $fieldid = $field['id'];
                     $qry = "SELECT ticket_id FROM #__fst_ticket_field WHERE field_id = '" . FSTJ3Helper::getEscaped($db, $fieldid) . "' AND value LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%'";
                     $db->setQuery($qry);
                     //echo $qry."<br>";
                     $moreids = $db->loadAssoclist();
                     //print_r($moreids);
                     foreach ($moreids as $row) {
                         if (array_key_exists($row['ticket_id'], $ticketids)) {
                             $ticketids[$row['ticket_id']]++;
                         } else {
                             $ticketids[$row['ticket_id']] = 1;
                         }
                     }
                 }
                 // basic search optional fields
                 if (FST_Settings::get('support_basic_name')) {
                     $wherebits[] = " u.name LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' ";
                     $wherebits[] = " unregname LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' ";
                 }
                 if (FST_Settings::get('support_basic_username')) {
                     $wherebits[] = " u.username LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' ";
                 }
                 if (FST_Settings::get('support_basic_email')) {
                     $wherebits[] = " u.email LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' ";
                     $wherebits[] = " t.email LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' ";
                 }
                 if (FST_Settings::get('support_basic_messages')) {
                     $ticketid_matchall++;
                     $fieldid = $field['id'];
                     $qry = "SELECT ticket_ticket_id as ticket_id FROM #__fst_ticket_messages WHERE subject LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%' OR body LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%'";
                     $db->setQuery($qry);
                     //echo $qry."<br>";
                     $moreids = $db->loadAssoclist();
                     //print_r($moreids);
                     foreach ($moreids as $row) {
                         if (array_key_exists($row['ticket_id'], $ticketids)) {
                             $ticketids[$row['ticket_id']]++;
                         } else {
                             $ticketids[$row['ticket_id']] = 1;
                         }
                     }
                 }
             }
             if (count($ticketids) > 1) {
                 $tids = array();
                 foreach ($ticketids as $id => $rec) {
                     $tids[] = $id;
                 }
                 $ticketids = $tids;
                 unset($tids);
             }
             if (count($ticketids) > 1) {
                 $wherebits[] = "t.id IN (" . implode(",", $ticketids) . ")";
             }
             if (count($wherebits) == 0) {
                 $wherebits[] = "1";
             }
             $query .= " WHERE (" . implode(" OR ", $wherebits) . ")";
             // add ticket tag ids
             if (count($tagids) > 1) {
                 $tids = array();
                 foreach ($tagids as $id => $rec) {
                     $tids[] = $id;
                 }
                 $tagids = $tids;
                 unset($tids);
                 $query .= " AND t.id IN (" . implode(",", $tagids) . ")";
             }
             //echo $query . "<br>";
         } else {
             if ($searchtype == "advanced") {
                 $search = JRequest::getVar('search', '');
                 $wherebits = array();
                 $subject = JRequest::getVar('subject', '');
                 if ($subject) {
                     $wherebits[] = " t.title LIKE '%" . FSTJ3Helper::getEscaped($db, $subject) . "%' ";
                 }
                 $reference = JRequest::getVar('reference', '');
                 if ($reference) {
                     $wherebits[] = " t.reference = '" . FSTJ3Helper::getEscaped($db, $reference) . "' ";
                 }
                 $username = JRequest::getVar('username', '');
                 if ($username) {
                     $wherebits[] = " u.username LIKE '%" . FSTJ3Helper::getEscaped($db, $username) . "%' ";
                 }
                 $useremail = JRequest::getVar('useremail', '');
                 if ($useremail) {
                     $wherebits[] = " ( u.email LIKE '%" . FSTJ3Helper::getEscaped($db, $useremail) . "%' OR t.email LIKE '%" . FSTJ3Helper::getEscaped($db, $useremail) . "%' ) ";
                 }
                 $userfullname = JRequest::getVar('userfullname', '');
                 if ($userfullname) {
                     $wherebits[] = " ( u.name LIKE '%" . FSTJ3Helper::getEscaped($db, $userfullname) . "%' OR unregname LIKE '%" . FSTJ3Helper::getEscaped($db, $userfullname) . "%' ) ";
                 }
                 $content = JRequest::getVar('content', '');
                 if ($content) {
                     $q = " t.id IN ";
                     $q .= "( SELECT ticket_ticket_id FROM #__fst_ticket_messages WHERE body LIKE '%" . FSTJ3Helper::getEscaped($db, $content) . "%' )";
                     $wherebits[] = $q;
                 }
                 $handler = JRequest::getVar('handler', '');
                 if ($handler) {
                     if ($handler == -1 || $handler == -2) {
                         // need to find my handler id
                         $user = JFactory::getUser();
                         $qry = "SELECT * FROM #__fst_user WHERE user_id = '" . FSTJ3Helper::getEscaped($db, $user->id) . "'";
                         $db->setQuery($qry);
                         $fstuser = $db->loadObject();
                         if ($handler == -1) {
                             $wherebits[] = " t.admin_id = '" . FSTJ3Helper::getEscaped($db, $fstuser->id) . "' ";
                         } else {
                             $wherebits[] = " t.admin_id != '" . FSTJ3Helper::getEscaped($db, $fstuser->id) . "' ";
                             $wherebits[] = " t.admin_id != 0 ";
                         }
                     } else {
                         if ($handler == -3) {
                             $wherebits[] = " t.admin_id = 0";
                         } else {
                             $wherebits[] = " t.admin_id = '" . FSTJ3Helper::getEscaped($db, $handler) . "' ";
                         }
                     }
                 }
                 $status = JRequest::getVar('status', '');
                 if ($status) {
                     $wherebits[] = " t.ticket_status_id = '" . FSTJ3Helper::getEscaped($db, $status) . "' ";
                 }
                 $product = JRequest::getVar('product', '');
                 if ($product) {
                     $wherebits[] = " t.prod_id = '" . FSTJ3Helper::getEscaped($db, $product) . "' ";
                 }
                 $department = JRequest::getVar('department', '');
                 if ($department) {
                     $wherebits[] = " t.ticket_dept_id = '" . FSTJ3Helper::getEscaped($db, $department) . "' ";
                 }
                 $cat = JRequest::getVar('cat', '');
                 if ($cat) {
                     $wherebits[] = " t.ticket_cat_id = '" . FSTJ3Helper::getEscaped($db, $cat) . "' ";
                 }
                 $pri = JRequest::getVar('priority', '');
                 if ($pri) {
                     $wherebits[] = " t.ticket_pri_id = '" . FSTJ3Helper::getEscaped($db, $pri) . "' ";
                 }
                 $group = JRequest::getVar('group', '');
                 if ($group > 0) {
                     $wherebits[] = " t.user_id IN (SELECT user_id FROM #__fst_ticket_group_members WHERE group_id = '" . FSTJ3Helper::getEscaped($db, $group) . "' GROUP BY user_id)";
                 }
                 $date_from = $this->DateValidate(JRequest::getVar('date_from', ''));
                 $date_to = $this->DateValidate(JRequest::getVar('date_to', ''));
                 /*if ($date_from && $date_to)
                 		{
                 			// got both date, need a ticket with 
                 		} else*/
                 if ($date_from) {
                     $wherebits[] = " t.lastupdate > DATE_SUB('" . FSTJ3Helper::getEscaped($db, $date_from) . "',INTERVAL 1 DAY) ";
                 }
                 /*else*/
                 if ($date_to) {
                     $wherebits[] = " t.opened < DATE_ADD('" . FSTJ3Helper::getEscaped($db, $date_to) . "',INTERVAL 1 DAY) ";
                 }
                 // search custom fields that are set to be searched
                 $fields = FSTCF::GetAllCustomFields(true);
                 /*echo "<pre>";
                 		print_r($fields);
                 		echo "</pre>";*/
                 foreach ($fields as $field) {
                     if (!$field['advancedsearch']) {
                         continue;
                     }
                     $search = JRequest::getVar('custom_' . $field['id'], "");
                     //echo "Field : {$field['id']} = $search<br>";
                     if ($search != "") {
                         $ticketid_matchall++;
                         $fieldid = $field['id'];
                         if ($field['type'] == "checkbox") {
                             if ($search == "1") {
                                 $qry = "SELECT ticket_id FROM #__fst_ticket_field WHERE field_id = '" . FSTJ3Helper::getEscaped($db, $fieldid) . "' AND value = 'on'";
                             } else {
                                 $qry = "SELECT ticket_id FROM #__fst_ticket_field WHERE field_id = '" . FSTJ3Helper::getEscaped($db, $fieldid) . "' AND value = ''";
                             }
                         } elseif ($field['type'] == "radio" || $field['type'] == "combo") {
                             $qry = "SELECT ticket_id FROM #__fst_ticket_field WHERE field_id = '" . FSTJ3Helper::getEscaped($db, $fieldid) . "' AND value = '" . FSTJ3Helper::getEscaped($db, $search) . "'";
                         } else {
                             $qry = "SELECT ticket_id FROM #__fst_ticket_field WHERE field_id = '" . FSTJ3Helper::getEscaped($db, $fieldid) . "' AND value LIKE '%" . FSTJ3Helper::getEscaped($db, $search) . "%'";
                         }
                         $db->setQuery($qry);
                         //echo $qry."<br>";
                         $moreids = $db->loadAssoclist();
                         //print_r($moreids);
                         foreach ($moreids as $row) {
                             if (array_key_exists($row['ticket_id'], $ticketids)) {
                                 $ticketids[$row['ticket_id']]++;
                             } else {
                                 $ticketids[$row['ticket_id']] = 1;
                             }
                         }
                     }
                 }
                 if ($ticketid_matchall > 0) {
                     unset($ticketids[0]);
                     $tids = array();
                     if (count($ticketids) > 0) {
                         foreach ($ticketids as $id => $rec) {
                             if ($id == 0) {
                                 continue;
                             }
                             if ($rec == $ticketid_matchall) {
                                 $tids[] = $id;
                             }
                         }
                         $ticketids = $tids;
                         unset($tids);
                     }
                     if (count($ticketids) > 0) {
                         $wherebits[] = "t.id IN (" . implode(",", $ticketids) . ")";
                     } else {
                         $wherebits[] = "0";
                     }
                 }
                 if (count($wherebits) == 0) {
                     $wherebits[] = "1";
                 }
                 $query .= " WHERE " . implode(" AND ", $wherebits);
             } else {
                 $query .= " WHERE 1 ";
             }
         }
         $query .= FST_Ticket_Helper::$_perm_where;
         $order = array();
         if (FST_Helper::getUserSetting("group_products")) {
             $order[] = "prod.ordering";
         }
         if (FST_Helper::getUserSetting("group_departments")) {
             $order[] = "dept.title";
         }
         if (FST_Helper::getUserSetting("group_cats")) {
             $order[] = "cat.title";
         }
         if (FST_Helper::getUserSetting("group_pri")) {
             $order[] = "pri.ordering DESC";
         }
         if (FST_Helper::getUserSetting("group_group")) {
             $order[] = "case when grp.groupname is null then 1 else 0 end";
             $order[] = "grp.groupname";
         }
         $order[] = "lastupdate DESC";
         $query .= " ORDER BY " . implode(", ", $order);
         //echo "<br>$query<br>";
         $db->setQuery($query);
         $db->query();
         $this->_ticketcount = $db->getNumRows();
         $db->setQuery($query, $limitstart, $limit);
         $this->_tickets = $db->loadAssocList('id');
     }
     /*echo "<pre>";
     		print_r($result['tickets']);
     		echo "</pre>";*/
     $result['pagination'] = new JPaginationJs($this->_ticketcount, $limitstart, $limit);
     $result['count'] =& $this->_ticketcount;
     $result['tickets'] =& $this->_tickets;
     return $result;
 }
Ejemplo n.º 11
0
 static function &ParseTemplate($template, &$ticket, $subject, $body, $ishtml)
 {
     $handler = FST_EMail::GetHandler($ticket['admin_id']);
     $custrec = FST_EMail::GetUser($ticket['user_id']);
     $subject = trim(str_ireplace("re:", "", $subject));
     $vars[] = FST_EMail::BuildVar('subject', $subject);
     /*if ($ishtml)
     		{
     			$body = str_replace("\n","<br />\n",$body);	
     		}*/
     $body = FST_Helper::ParseBBCode($body);
     $vars[] = FST_EMail::BuildVar('body', $body);
     $vars[] = FST_EMail::BuildVar('reference', $ticket['reference']);
     $vars[] = FST_EMail::BuildVar('password', $ticket['password']);
     if ($ticket['user_id'] == 0) {
         $vars[] = FST_EMail::BuildVar('user_name', $ticket['unregname']);
         $vars[] = FST_EMail::BuildVar('user_username', JText::_("UNREGISTERED"));
         $vars[] = FST_EMail::BuildVar('user_email', $ticket['email']);
     } else {
         $vars[] = FST_EMail::BuildVar('user_name', $custrec['name']);
         $vars[] = FST_EMail::BuildVar('user_username', $custrec['username']);
         $vars[] = FST_EMail::BuildVar('user_email', $custrec['email']);
     }
     $vars[] = FST_EMail::BuildVar('handler_name', $handler['name']);
     $vars[] = FST_EMail::BuildVar('handler_username', $handler['username']);
     $vars[] = FST_EMail::BuildVar('handler_email', $handler['email']);
     $vars[] = FST_EMail::BuildVar('ticket_id', $ticket['id']);
     $vars[] = FST_EMail::BuildVar('status', FST_EMail::GetStatus($ticket['ticket_status_id']));
     $vars[] = FST_EMail::BuildVar('priority', FST_EMail::GetPriority($ticket['ticket_pri_id']));
     $vars[] = FST_EMail::BuildVar('category', FST_EMail::GetCategory($ticket['ticket_cat_id']));
     $vars[] = FST_EMail::BuildVar('department', FST_EMail::GetDepartment($ticket['ticket_dept_id']));
     $vars[] = FST_EMail::BuildVar('product', FST_EMail::GetProduct($ticket['prod_id']));
     if (strpos($template['body'], "{messagehistory}") > 0) {
         //echo "Get message history<br>";
         $messages = FST_EMail::GetMessageHist($ticket['id']);
         // need to load in the messagerow template and parse it
         $text = FST_EMail::ParseMessageRows($messages, $ishtml);
         $vars[] = FST_EMail::BuildVar('messagehistory', $text);
         //print_p($messages);
     }
     $uri = JURI::getInstance();
     $baseUrl = $uri->toString(array('scheme', 'host', 'port'));
     $vars[] = FST_EMail::BuildVar('ticket_link', $baseUrl . FSTRoute::_('index.php?option=com_fst&view=ticket&ticketid=' . $ticket['id'], false));
     $vars[] = FST_EMail::BuildVar('admin_link', $baseUrl . FSTRoute::_('index.php?option=com_fst&view=admin&layout=support&ticketid=' . $ticket['id'], false));
     $config = JFactory::getConfig();
     if (FSTJ3Helper::IsJ3()) {
         $sitename = $config->get('sitename');
     } else {
         $sitename = $config->getValue('sitename');
     }
     if (FST_Settings::get('support_email_site_name') != "") {
         $sitename = FST_Settings::get('support_email_site_name');
     }
     $vars[] = FST_EMail::BuildVar('websitetitle', $sitename);
     // need to add the tickets custom fields to the output here
     $fields = FSTCF::GetAllCustomFields(true);
     $values = FSTCF::GetTicketValues($ticket['id'], $ticket);
     foreach ($fields as $fid => &$field) {
         $name = "custom_" . $fid;
         $value = "";
         if (array_key_exists($fid, $values)) {
             $value = $values[$fid]['value'];
         }
         //echo "$name -> $value<br>";
         $fieldvalues = array();
         $fieldvalues[0]['field_id'] = $fid;
         $fieldvalues[0]['value'] = $value;
         // only do area output processing if we are in html mode
         if ($field['type'] != "area" || $ishtml) {
             $value = FSTCF::FieldOutput($field, $fieldvalues, '');
         }
         $vars[] = FST_EMail::BuildVar($name, $value);
     }
     $email['subject'] = FST_EMail::ParseText($template['subject'], $vars);
     $email['body'] = FST_EMail::ParseText($template['body'], $vars);
     //print_p($vars);
     //print_p($email);
     if ($template['ishtml']) {
         //$email['subject'] = str_replace("\n","<br />\n",$email['subject']);
         $email['body'] = FST_EMail::MaxLineLength($email['body']);
     } else {
         // strip bbcode out of subject or parse it to html depending on template type
         $email['body'] = str_replace("<br />", "\n", $email['body']);
         $email['body'] = html_entity_decode($email['body']);
         $email['body'] = preg_replace_callback("/(&#[0-9]+;)/", array($this, "email_decode_utf8"), $email['body']);
         $email['body'] = strip_tags($email['body']);
     }
     return $email;
 }
Ejemplo n.º 12
0
 function __construct($identifier, $itemid = -1, &$itemlist = null)
 {
     $this->uid = mt_rand(1000, 9999);
     if (JRequest::getVar('uid') > 0) {
         $this->uid = JRequest::getVar('uid');
     }
     /*$this->use_comments = FST_Settings::get('announce_comments_allow');
     		if (!$this->use_comments)
     			return;*/
     $this->identifier = $identifier;
     $this->_permissions = FST_Ticket_Helper::getAdminPermissions();
     $this->use_email = FST_Settings::get('commnents_use_email');
     //FSJ_Settings::GetComponentSetting( fsj_get_com(), 'comments_email', 1 );
     $this->use_website = FST_Settings::get('commnents_use_website');
     //FSJ_Settings::GetComponentSetting( fsj_get_com(), 'comments_website', 1 );
     $this->tmplpath = JPATH_SITE . DS . 'components' . DS . 'com_fst' . DS . 'tmpl' . DS . 'comments';
     $this->dest_email = FST_Settings::get('email_on_comment');
     $this->itemid = $itemid;
     $this->itemlist = $itemlist;
     $this->post = array();
     $this->post['name'] = $this->GetName();
     $this->post['email'] = '';
     $this->post['website'] = '';
     $this->post['body'] = '';
     $this->post['created'] = 'now';
     $this->post['ident'] = $identifier;
     $this->post['itemid'] = $itemid;
     $this->errors = array();
     $this->errors['name'] = '';
     $this->errors['email'] = '';
     $this->errors['website'] = '';
     $this->errors['body'] = '';
     $this->errors['captcha'] = '';
     $this->errors['itemid'] = '';
     // text templates
     $this->add_a_comment = JText::_("ADD_A_COMMENT");
     $this->post_comment = JText::_("POST_COMMENT");
     $this->comments_hide_add = FST_Settings::get('comments_hide_add');
     if (FST_Settings::get('comments_who_can_add') == "registered") {
         if ($this->_permissions['userid'] == 0) {
             $this->can_add = 0;
         }
     }
     $captcha = new FST_Captcha();
     $this->captcha = $captcha->GetCaptcha();
     // set up moderation
     $commod = FST_Settings::get('comments_moderate');
     $this->moderate = 0;
     if ($commod == "all") {
         $this->moderate = 1;
     } elseif ($commod == "guests") {
         if ($this->_permissions['userid'] == 0) {
             $this->moderate = 1;
         }
     } elseif ($commod == "registered") {
         if ($this->_permissions['mod_kb'] == 0) {
             $this->moderate = 1;
         }
     }
     // determine template and if its custom or not
     $this->IncludeTemplates();
     $this->template = "comments_general";
     $this->template_type = 3;
     if (FST_Settings::get('comments_general_use_custom')) {
         $this->template_type = 2;
     }
     if ($this->handler) {
         $this->template = "comments_" . $this->handler->GetName();
         $this->template_type = 3;
         if (FST_Settings::get('comments_' . $this->handler->GetName() . '_use_custom')) {
             $this->template_type = 2;
         }
     }
     //print_p($this);
     //exit;
 }
Ejemplo n.º 13
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     $what = JRequest::getString('what', '');
     $this->tab = JRequest::getVar('tab');
     if (JRequest::getVar('task') == "cancellist") {
         $mainframe = JFactory::getApplication();
         $link = FSTRoute::x('index.php?option=com_fst&view=fsts', false);
         $mainframe->redirect($link);
         return;
     }
     $settings = FST_Settings::GetAllViewSettings();
     // CHANGE
     $db =& JFactory::getDBO();
     if ($what == "save") {
         $data = JRequest::get('POST', JREQUEST_ALLOWRAW);
         foreach ($data as $setting => $value) {
             if (array_key_exists($setting, $settings)) {
                 $settings[$setting] = $value;
             }
         }
         foreach ($settings as $setting => $value) {
             if (!array_key_exists($setting, $data)) {
                 $settings[$setting] = 0;
                 $value = 0;
             }
             // skip any setting that is in the templates list
             if (array_key_exists($setting, $templates)) {
                 continue;
             }
             if (array_key_exists($setting, $large)) {
                 continue;
             }
             $qry = "REPLACE INTO #__fst_settings_view (setting, value) VALUES ('";
             $qry .= FSTJ3Helper::getEscaped($db, $setting) . "','";
             $qry .= FSTJ3Helper::getEscaped($db, $value) . "')";
             $db->setQuery($qry);
             $db->Query();
             //echo $qry."<br>";
         }
         $link = 'index.php?option=com_fst&view=settingsview#' . $this->tab;
         if (JRequest::getVar('task') == "save") {
             $link = 'index.php?option=com_fst';
         }
         //exit;
         $mainframe = JFactory::getApplication();
         $mainframe->redirect($link, JText::_("View_Settings_Saved"));
         exit;
     } else {
         $document = JFactory::getDocument();
         $document->addStyleSheet(JURI::root() . 'administrator/components/com_fst/assets/css/js_color_picker_v2.css');
         $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/color_functions.js');
         $document->addScript(JURI::root() . 'administrator/components/com_fst/assets/js/js_color_picker_v2.js');
         $this->assignRef('settings', $settings);
         JToolBarHelper::title(JText::_("FREESTYLE_TESTIMONIALS") . ' - ' . JText::_("VIEW_SETTINGS"), 'fst_viewsettings');
         JToolBarHelper::apply();
         JToolBarHelper::save();
         JToolBarHelper::cancel('cancellist');
         FSTAdminHelper::DoSubToolbar();
         parent::display($tpl);
     }
 }
Ejemplo n.º 14
0
 function displayAllProducts()
 {
     $this->products = $this->get('Products');
     if (!is_array($this->products)) {
         $this->products = array();
     }
     FST_Helper::Tr($this->products);
     $this->showresult = 1;
     $mainframe = JFactory::getApplication();
     $pathway =& $mainframe->getPathway();
     if (FST_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'test'))) {
         $pathway->addItem(JText::_('TESTIMONIALS'), FSTRoute::x('index.php?option=com_fst&view=test'));
     }
     if (FST_Settings::get('test_allow_no_product')) {
         $noproduct = array();
         $noproduct['id'] = 0;
         $noproduct['title'] = JText::_('GENERAL_TESTIMONIALS');
         $noproduct['description'] = '';
         $noproduct['image'] = '/components/com_fst/assets/images/generaltests.png';
         $this->products = array_merge(array($noproduct), $this->products);
     }
     if ($this->test_show_prod_mode != "list") {
         $idlist = array();
         if (count($this->products) > 0) {
             foreach ($this->products as &$prod) {
                 $prod['comments'] = array();
                 $idlist[] = $prod['id'];
             }
         }
         // not in normal list mode, get comments for each product
         $this->comments->itemid = $idlist;
         $this->comments->GetComments();
         foreach ($this->comments->_data as &$data) {
             if ($data['itemid'] > 0) {
                 $this->products[$data['itemid']]['comments'][] =& $data;
             }
         }
     }
     parent::display();
 }
Ejemplo n.º 15
0
<?php

/**
 * @package Freestyle Joomla
 * @author Freestyle Joomla
 * @copyright (C) 2013 Freestyle Joomla
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die;
/**
 * The reCAPTCHA server URL's
 */
define("fst_RECAPTCHA_API_SERVER", "http://api.recaptcha.net");
define("fst_RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net");
define("fst_RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net");
// Captcha stuff
global $fst_publickey, $fst_privatekey;
$fst_publickey = FST_Settings::get('recaptcha_public');
$fst_privatekey = FST_Settings::get('recaptcha_private');
if (!$fst_publickey) {
    $fst_publickey = "6LcQbAcAAAAAAHuqZjftCSvv67KiptVfDztrZDIL";
}
if (!$fst_privatekey) {
    $fst_privatekey = "6LcQbAcAAAAAAMBL5-rp10P3UQ31kpRYLhUFTsqK ";
}
if (!function_exists("fst__recaptcha_qsencode")) {
    require_once JPATH_SITE . DS . 'components' . DS . 'com_fst' . DS . 'helper' . DS . 'recaptcha_api.php';
}
Ejemplo n.º 16
0
 static function AddSCEditor()
 {
     if (!FST_Helper::$sceditor) {
         if (FST_Settings::Get('support_sceditor')) {
             $document = JFactory::getDocument();
             $document->addScript(JURI::root() . 'components/com_fst/assets/js/sceditor/jquery.sceditor.bbcode.js');
             $document->addScript(JURI::root() . 'components/com_fst/assets/js/sceditor/include.sceditor.js');
             $document->addScriptDeclaration("var sceditor_emoticons_root = '" . JURI::root(true) . "/components/com_fst/assets/';");
             $document->addScriptDeclaration("var sceditor_style_root = '" . JURI::root(true) . "/components/com_fst/assets/js/sceditor/';");
             $document->addStyleSheet(JURI::root() . 'components/com_fst/assets/js/sceditor/themes/default.css');
         }
         FST_Helper::$sceditor = true;
     }
 }
Ejemplo n.º 17
0
 static function getAdminPermissions()
 {
     if (empty(FST_Ticket_Helper::$_permissions)) {
         $mainframe = JFactory::getApplication();
         global $option;
         $user = JFactory::getUser();
         $userid = $user->id;
         $db = JFactory::getDBO();
         $query = "SELECT * FROM #__fst_user WHERE user_id = '" . FSTJ3Helper::getEscaped($db, $userid) . "'";
         $db->setQuery($query);
         FST_Ticket_Helper::$_permissions = $db->loadAssoc();
         if (!FST_Ticket_Helper::$_permissions) {
             FST_Ticket_Helper::$_permissions['mod_kb'] = 0;
             FST_Ticket_Helper::$_permissions['mod_test'] = 0;
             FST_Ticket_Helper::$_permissions['support'] = 0;
             FST_Ticket_Helper::$_permissions['seeownonly'] = 1;
             FST_Ticket_Helper::$_permissions['autoassignexc'] = 1;
             FST_Ticket_Helper::$_permissions['allprods'] = 1;
             FST_Ticket_Helper::$_permissions['allcats'] = 1;
             FST_Ticket_Helper::$_permissions['alldepts'] = 1;
             FST_Ticket_Helper::$_permissions['artperm'] = 0;
             FST_Ticket_Helper::$_permissions['id'] = 0;
             FST_Ticket_Helper::$_permissions['groups'] = 0;
             FST_Ticket_Helper::$_permissions['reports'] = 0;
             FST_Ticket_Helper::$_permissions['settings'] = '';
         }
         FST_Ticket_Helper::$_permissions['userid'] = $userid;
         FST_Ticket_Helper::$_perm_only = '';
         FST_Ticket_Helper::$_perm_prods = '';
         FST_Ticket_Helper::$_perm_depts = '';
         FST_Ticket_Helper::$_perm_cats = '';
         FST_Ticket_Helper::$_permissions['perm_where'] = '';
         //
         // check for permission overrides for Joomla 1.6
         if (FST_Settings::get('perm_article_joomla') || FST_Settings::get('perm_mod_joomla')) {
             if (FST_Helper::Is16()) {
                 $newart = 0;
                 $newmod = 0;
                 $user = JFactory::getUser();
                 if ($user->authorise('core.edit.own', 'com_fst')) {
                     $newart = 1;
                 }
                 if ($user->authorise('core.edit', 'com_fst')) {
                     $newart = 2;
                     $newmod = 1;
                 }
                 if ($user->authorise('core.edit.state', 'com_fst')) {
                     $newart = 3;
                     $newmod = 1;
                 }
                 if (FST_Settings::get('perm_article_joomla') && $newart > FST_Ticket_Helper::$_permissions['artperm']) {
                     FST_Ticket_Helper::$_permissions['artperm'] = $newart;
                 }
                 if (FST_Settings::get('perm_mod_joomla') && $newmod > FST_Ticket_Helper::$_permissions['mod_kb']) {
                     FST_Ticket_Helper::$_permissions['mod_kb'] = $newmod;
                 }
                 //
             } else {
                 $newart = 0;
                 $newmod = 0;
                 $user = JFactory::getUser();
                 if ($user->authorize('com_fst', 'create', 'content', 'own')) {
                     $newart = 1;
                 }
                 if ($user->authorize('com_fst', 'edit', 'content', 'own')) {
                     $newart = 2;
                     $newmod = 1;
                 }
                 if ($user->authorize('com_fst', 'publish', 'content', 'all')) {
                     $newart = 3;
                     $newmod = 1;
                 }
                 if (FST_Settings::get('perm_article_joomla') && $newart > FST_Ticket_Helper::$_permissions['artperm']) {
                     FST_Ticket_Helper::$_permissions['artperm'] = $newart;
                 }
                 if (FST_Settings::get('perm_mod_joomla') && $newmod > FST_Ticket_Helper::$_permissions['mod_kb']) {
                     FST_Ticket_Helper::$_permissions['mod_kb'] = $newmod;
                 }
             }
         }
     }
     return FST_Ticket_Helper::$_permissions;
 }
Ejemplo n.º 18
0
 function GetViewSettingsObj($view)
 {
     // return a view setting object that can be used in place of the getPageParameters object
     // needs info about what view we are in, and access to the view settings
     FST_Settings::_Get_View_Settings();
     return new FST_View_Settings($view, FST_Settings::$fst_view_settings);
 }
Ejemplo n.º 19
0
 function __construct($total, $limitstart, $limit)
 {
     $this->skinstyle = FST_Settings::get('skin_style');
     parent::__construct($total, $limitstart, $limit);
 }
Ejemplo n.º 20
0
 * @package Freestyle Joomla
 * @author Freestyle Joomla
 * @copyright (C) 2013 Freestyle Joomla
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die;
if ($this->can_add) {
    ?>
<div class="fst_edit_comment"><?php 
    echo JText::_('EDIT_COMMENT');
    ?>
</div>
<script type="text/javascript">
 var RecaptchaOptions = {
    theme : '<?php 
    echo FST_Settings::get('recaptcha_theme');
    ?>
'
 };
</script>

	<form id='editcommentform' action="<?php 
    echo FSTRoute::x('&tmpl=component&task=savecomment');
    ?>
" method="post">
	<input type='hidden' name='comment' value='add' >
	<input type='hidden' name='ident' value='<?php 
    echo $this->ident;
    ?>
' >
	<?php 
Ejemplo n.º 21
0
}
?>
<div id="comments"></div>

<?php 
$testcount = 0;
if (count($this->products) > 0) {
    foreach ($this->products as &$product) {
        ?>
	<?php 
        if (!array_key_exists("id", $product)) {
            continue;
        }
        ?>
	<?php 
        if ($this->comments->GetCountOnly($product['id']) == 0 && FST_Settings::get('test_hide_empty_prod')) {
            continue;
        }
        ?>
	<?php 
        include "components/com_fst/views/test/snippet/_prod.php";
        ?>
	<div class="fst_clear"></div>
<?php 
        if ($this->test_show_prod_mode != "list") {
            ?>
	<div class='fst_test accordion_content_1'>
		<?php 
            $testcount += $this->comments->DisplayCommentsOnly($product['id']);
            ?>
	</div>