Example #1
0
 function _buildQuery()
 {
     $db =& JFactory::getDBO();
     $query = ' SELECT c.id, c.title, c.ordering as ordering, c.published, c.description, c.image, c.inkb, c.insupport, c.intest, c.access, c.translation FROM #__fst_prod as c ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( title ) LIKE ' . $db->Quote('%' . FSTJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'c.ordering') {
         $order = ' ORDER BY c.ordering ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', c.ordering';
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'published = ' . $this->lists['ispublished'];
     }
     if (FSTAdminHelper::Is16()) {
         FSTAdminHelper::LA_GetFilterState();
         /*if (FSTAdminHelper::$filter_lang)	
         		$where[] = "language = '" . FSTJ3Helper::getEscaped($db, FSTAdminHelper::$filter_lang) . "'";*/
         if (FSTAdminHelper::$filter_access) {
             $where[] = "access = '" . FSTJ3Helper::getEscaped($db, FSTAdminHelper::$filter_access) . "'";
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Example #2
0
 function display($tpl = null)
 {
     $prod =& $this->get('Data');
     $isNew = $prod->id < 1;
     $text = $isNew ? JText::_("NEW") : JText::_("EDIT");
     JToolBarHelper::title(JText::_("PRODUCT") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fst_prods');
     if (FST_Helper::Is16()) {
         JToolBarHelper::custom('translate', 'translate', 'translate', 'Translate', false);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('prod', $prod);
     $path = JPATH_SITE . DS . 'images' . DS . 'fst' . DS . 'products';
     if (!file_exists($path)) {
         mkdir($path, 0777, true);
     }
     $files = JFolder::files($path, '(.png$|.jpg$|.jpeg$|.gif$)');
     $sections[] = JHTML::_('select.option', '', JText::_("NO_IMAGE"), 'id', 'title');
     foreach ($files as $file) {
         $sections[] = JHTML::_('select.option', $file, $file, 'id', 'title');
     }
     $lists['images'] = JHTML::_('select.genericlist', $sections, 'image', 'class="inputbox" size="1" ', 'id', 'title', $prod->image);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Example #3
0
 function display($tpl = null)
 {
     $task = JRequest::getVar('task');
     if ($task == "removecomment") {
         return $this->DoPublishComment(2);
     }
     if ($task == "approvecomment") {
         return $this->DoPublishComment(1);
     }
     JToolBarHelper::title(JText::_("MODERATION"), 'fst_moderate');
     JToolBarHelper::deleteList();
     JToolBarHelper::editList();
     JToolBarHelper::addNew();
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('lists', $this->get('Lists'));
     $this->assignRef('data', $this->get('Data'));
     $this->assignRef('pagination', $this->get('Pagination'));
     /*$query = 'SELECT id, title FROM #__fst_prod ORDER BY title';
     
     		$db	= & JFactory::getDBO();
     		$categories[] = JHTML::_('select.option', '0', JText::_("SELECT_PRODUCT"), 'id', 'title');
     		$db->setQuery($query);
     		$categories = array_merge($categories, $db->loadObjectList());
     
     		$this->lists['prods'] = JHTML::_('select.genericlist',  $categories, 'prod_id', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'id', 'title', $this->lists['prod_id']);*/
     $this->ident_to_name = array();
     //
     $this->ident_to_name[5] = "test";
     $this->comment_objs = array();
     $comment_itemids = array();
     $this->ident = JRequest::getVar('ident', '');
     $sections = array();
     $sections[] = JHTML::_('select.option', '0', "-- " . JText::_("ALL_SECTIONS") . " --", 'id', 'title');
     foreach ($this->ident_to_name as $ident => $name) {
         $this->comment_objs[$ident] = new FST_Comments($name);
         $sections[] = JHTML::_('select.option', $ident, $this->comment_objs[$ident]->handler->descriptions, 'id', 'title');
     }
     $this->lists['sections'] = JHTML::_('select.genericlist', $sections, 'ident', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'id', 'title', $this->ident);
     $categories = array();
     $categories[] = JHTML::_('select.option', '-1', "-- " . JText::_("MOD_STATUS") . " --", 'id', 'title');
     $categories[] = JHTML::_('select.option', '0', JText::_("AWAITING_MODERATION"), 'id', 'title');
     $categories[] = JHTML::_('select.option', '1', JText::_("ACCEPTED"), 'id', 'title');
     $categories[] = JHTML::_('select.option', '2', JText::_("DECLINED"), 'id', 'title');
     $this->lists['published'] = JHTML::_('select.genericlist', $categories, 'ispublished', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'id', 'title', $this->lists['ispublished']);
     foreach ($this->data as &$data) {
         $ident = $data->ident;
         $comment_itemids[$ident][$data->itemid] = $data->itemid;
     }
     $db =& JFactory::getDBO();
     foreach ($this->comment_objs as $ident => &$obj) {
         if (array_key_exists($ident, $comment_itemids)) {
             $idlist = $comment_itemids[$ident];
             $obj->handler->GetItemData($idlist);
         }
     }
     parent::display($tpl);
 }
Example #4
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_("EMAIL_TEMPLATE_MANAGER"), 'fst_emails');
     //JToolBarHelper::deleteList();
     JToolBarHelper::editList();
     //JToolBarHelper::addNew();
     JToolBarHelper::cancel('cancellist');
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('data', $this->get('Data'));
     parent::display($tpl);
 }
Example #5
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_("USERS"), 'fst_users');
     JToolBarHelper::deleteList();
     JToolBarHelper::editList();
     JToolBarHelper::addNew();
     JToolBarHelper::cancel('cancellist');
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('lists', $this->get('Lists'));
     $this->assignRef('data', $this->get('Data'));
     $this->assignRef('pagination', $this->get('Pagination'));
     parent::display($tpl);
 }
Example #6
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $faq =& $this->get('Data');
     $isNew = $faq->id < 1;
     $text = JText::_("EDIT");
     JToolBarHelper::title(JText::_("EMAIL_TEMPLATE") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fst_emails');
     JToolBarHelper::save();
     JToolBarHelper::cancel('cancel', 'Close');
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('email', $faq);
     parent::display($tpl);
 }
Example #7
0
 function SaveAPI()
 {
     $username = JRequest::getVar('username');
     $apikey = JRequest::getVar('apikey');
     $db =& JFactory::getDBO();
     $qry = "REPLACE INTO #__fst_settings (setting, value) VALUES ('fsj_username','" . FSTJ3Helper::getEscaped($db, $username) . "')";
     $db->setQuery($qry);
     $db->Query();
     $qry = "REPLACE INTO #__fst_settings (setting, value) VALUES ('fsj_apikey','" . FSTJ3Helper::getEscaped($db, $apikey) . "')";
     $db->setQuery($qry);
     $db->Query();
     // update url links
     if (FSTAdminHelper::Is16()) {
         $updater = new FSTUpdater();
         $updater->SortAPIKey($username, $apikey);
     }
     $mainframe = JFactory::getApplication();
     $link = FSTRoute::x('index.php?option=com_fst&view=backup', false);
     $mainframe->redirect($link);
 }
Example #8
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_("PRODUCTS"), 'fst_prods');
     JToolBarHelper::deleteList();
     JToolBarHelper::editList();
     JToolBarHelper::addNew();
     JToolBarHelper::divider();
     JToolBarHelper::custom('import', 'copy', 'copy', 'IMPORT_FROM_VIRTUEMART', false);
     JToolBarHelper::cancel('cancellist');
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('lists', $this->get('Lists'));
     $this->assignRef('data', $this->get('Data'));
     $this->assignRef('pagination', $this->get('Pagination'));
     $categories = array();
     $categories[] = JHTML::_('select.option', '-1', JText::_("IS_PUBLISHED"), 'id', 'title');
     $categories[] = JHTML::_('select.option', '1', JText::_("PUBLISHED"), 'id', 'title');
     $categories[] = JHTML::_('select.option', '0', JText::_("UNPUBLISHED"), 'id', 'title');
     $this->lists['published'] = JHTML::_('select.genericlist', $categories, 'ispublished', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'id', 'title', $this->lists['ispublished']);
     $what = JRequest::getVar('what');
     if ($what == "togglefield") {
         return $this->toggleField();
     }
     parent::display($tpl);
 }
Example #9
0
echo JText::_('TMPLHELP_WARN1');
?>
					</span>
				</td>
				<td valign="top" width="450" id="comments_testmod_row">
					<textarea name='comments_testmod' id="comments_testmod" rows="12" cols="80" style="float:none;"><?php 
echo $this->settings['comments_testmod'];
?>
</textarea><br>
					<textarea id="comments_testmod_default" rows="12" cols="80" style="display:none;"><?php 
echo $this->settings['comments_testmod_default'];
?>
</textarea><br>
				</td>
				<td><div class="fst_help"><?php 
echo FSTAdminHelper::IncludeHelp("comment.htm");
?>
</div></td>
			</tr>
		</table>
	</fieldset>
</div>


<?php 
//
?>

<div id="tab_visual" style="display:none;">

Example #10
0
						<option value="moderators" <?php 
if ($this->settings['test_who_can_add'] == "moderators") {
    echo " SELECTED";
}
?>
 ><?php 
echo JText::_('MODERATORS_ONLY');
?>
</option>
						
						<!-- add access levels here too -->
						<?php 
if (FST_Helper::Is16()) {
    ?>
							<?php 
    FSTAdminHelper::LoadAccessLevels();
    $options = FSTAdminHelper::$access_levels;
    foreach ($options as $option) {
        ?>
								<option value="<?php 
        echo $option->value;
        ?>
" <?php 
        if ($this->settings['test_who_can_add'] == $option->value) {
            echo " SELECTED";
        }
        ?>
>ACL: <?php 
        echo $option->text;
        ?>
</option>
Example #11
0
        require_once $path;
    } else {
        $controller = '';
    }
}
if (!function_exists("print_p")) {
    function print_p($var)
    {
        echo "<pre>";
        print_r($var);
        echo "</pre>";
    }
}
// do version check
$ver_inst = FSTAdminHelper::GetInstalledVersion();
$ver_files = FSTAdminHelper::GetVersion();
if (FST_Helper::Is16()) {
    if (!JFactory::getUser()->authorise('core.manage', 'com_fst')) {
        return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
    }
}
// if bad version display warning message
if ($ver_files != $ver_inst) {
    $task = JRequest::getVar('task');
    $view = JRequest::getVar('view');
    if ($task != "update" || $view != "backup") {
        JError::raiseWarning(100, JText::sprintf('INCORRECT_VERSION', FSTRoute::x('index.php?option=com_fst&view=backup&task=update')));
    }
    if ($view != "" && $view != "backup") {
        JRequest::setVar('view', '');
    }
Example #12
0
?>
:
				</label>
			</td>
			<td>
				<input class="text_area" type="text" name="title" id="title" size="32" maxlength="250" value="<?php 
echo JViewLegacy::escape($this->prod->title);
?>
" />
			</td>
			<td>
				<div id="trprev_title"></div>
			</td>
		</tr>
		<?php 
FSTAdminHelper::LA_Form($this->prod, true);
?>
		<tr>
			<td width="135" align="right" class="key">
				<label for="image">
					<?php 
echo JText::_("IMAGE");
?>
:
				</label>
			</td>
			<td>
				<?php 
echo $this->lists['images'];
?>
				<?php 
Example #13
0
function IncludeHelp($tmpl)
{
    if ($tmpl == "comment") {
        return FSTAdminHelper::IncludeHelp('email_comment.html');
    } elseif ($tmpl == "messagerow") {
        return FSTAdminHelper::IncludeHelp('email_messagerow.html');
    } else {
        return FSTAdminHelper::IncludeHelp('email_support.html');
    }
}
Example #14
0
 function display($tpl = null)
 {
     if (JRequest::getString('task') == "prods") {
         return $this->displayProds();
     }
     if (JRequest::getString('task') == "prodsa") {
         return $this->displayProdsA();
     }
     //
     $user =& $this->get('Data');
     $isNew = $user->id < 1;
     $db =& JFactory::getDBO();
     $text = $isNew ? JText::_("NEW") : JText::_("EDIT");
     JToolBarHelper::title(JText::_("USER") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fst_users');
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSTAdminHelper::DoSubToolbar();
     if ($isNew) {
         $users =& $this->get("Users");
         $this->assignRef('users', JHTML::_('select.genericlist', $users, 'user_id', 'class="inputbox" size="1" ', 'id', 'name'));
         $groups =& $this->get("Groups");
         $this->assignRef('groups', JHTML::_('select.genericlist', $groups, 'group_id', 'class="inputbox" size="1" ', 'id', 'name'));
         $this->assignRef('type', JHTML::_('select.booleanlist', 'type', array('class' => "inputbox", 'size' => "1", 'onclick' => "DoAllTypeChange();"), 0, 'Group', 'User'));
         if (count($users) == 0) {
             $this->assign('showtypes', 0);
             $this->assign('showusers', 0);
             $this->assign('showgroups', 1);
         } else {
             if (count($groups) == 0) {
                 $this->assign('showtypes', 0);
                 $this->assign('showusers', 1);
                 $this->assign('showgroups', 0);
             } else {
                 $this->assign('showtypes', 1);
                 $this->assign('showusers', 1);
                 $this->assign('showgroups', 0);
             }
         }
     } else {
         $input = "<input type='hidden' name='user_id' id='user_id' value='" . $user->user_id . "' />";
         $this->assign('users', $input . $user->name);
         $this->assign('showtypes', 0);
         if ($user->user_id > 0) {
             $this->assign('showusers', 1);
             $this->assign('showgroups', 0);
         } else {
             $this->assign('showusers', 0);
             $this->assign('showgroups', 1);
         }
         //$input = "<input type='hidden' name='group_id' id='group_id' value='" . $user->group_id . "' />";
         //$this->assign('groups',$input.$user->groupname);
         $this->groups = "";
     }
     $artperms = array();
     $artperms[] = JHTML::_('select.option', '0', JText::_("ART_NONE"), 'id', 'title');
     $artperms[] = JHTML::_('select.option', '1', JText::_("AUTHOR"), 'id', 'title');
     $artperms[] = JHTML::_('select.option', '2', JText::_("EDITOR"), 'id', 'title');
     $artperms[] = JHTML::_('select.option', '3', JText::_("PUBLISHER"), 'id', 'title');
     $this->assign('artperms', JHTML::_('select.genericlist', $artperms, 'artperm', 'class="inputbox" size="1"', 'id', 'title', $user->artperm));
     //
     $this->assignRef('user', $user);
     parent::display($tpl);
 }
Example #15
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('FREESTYLE_TESTIMONIALS'), 'fst.png');
     FSTAdminHelper::DoSubToolbar();
     parent::display($tpl);
 }
Example #16
0
    static function LA_Form($item, $nolangs = false)
    {
        if (FSTAdminHelper::Is16()) {
            ?>
			<tr>
				<td width="135" align="right" class="key">
					<label for="title">
						<?php 
            echo JText::_("JFIELD_ACCESS_LABEL");
            ?>
:
					</label>
				</td>
				<td>
					<?php 
            echo FSTAdminHelper::GetAccessForm($item->access);
            ?>
				</td>
			</tr>
			
			<?php 
            if (!$nolangs) {
                ?>

				<tr>
					<td width="135" align="right" class="key">
						<label for="title">
							<?php 
                echo JText::_("JFIELD_LANGUAGE_LABEL");
                ?>
:
						</label>
					</td>
					<td>
						<?php 
                echo FSTAdminHelper::GetLanguagesForm($item->language);
                ?>
					</td>
				</tr>
				
			<?php 
            }
        }
    }
Example #17
0
 function UpdateVersion($path)
 {
     $version = FSTAdminHelper::GetVersion($path);
     $db = JFactory::getDBO();
     $qry = "REPLACE INTO #__fst_settings (setting, value) VALUES ('version', '{$version}')";
     $db->SetQuery($qry);
     $db->Query();
     //echo $qry."<br>";
     $log = "Updating version to {$version}\n";
     return $log;
 }
Example #18
0
    ?>
<iframe id="frame_help" height="600" width="100%" frameborder="0" border="0"></iframe>
<?php 
    echo $pane->endPanel();
    echo $pane->endPane();
}
?>

		</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');
Example #19
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);
     }
 }
Example #20
0
<td align="center">
				<a href="javascript:void(0);" class="jgrid btn btn-micro" onclick="return listItemTask('cb<?php 
    echo $i;
    ?>
','<?php 
    echo $row->published ? 'unpublish' : 'publish';
    ?>
')">
					<?php 
    echo $published;
    ?>
				</a>
			</td>
<!--  -->
			<?php 
    FSTAdminHelper::LA_Row($row, true);
    ?>
			<td class="order">
			<?php 
    if ($ordering) {
        ?>
				<span><?php 
        echo $this->pagination->orderUpIcon($i);
        ?>
</span>
				<span><?php 
        echo $this->pagination->orderDownIcon($i, $n);
        ?>
</span>
			<?php 
    }
Example #21
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);
             }
         }
     }
 }
Example #22
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);
                 }
             }
         }
     }
 }