Ejemplo n.º 1
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fst_prod ' . '  WHERE id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->title = null;
         $this->_data->description = null;
         $this->_data->ordering = 0;
         $this->_data->image = null;
         $this->_data->extratext = null;
         $this->_data->inkb = 1;
         $this->_data->insupport = 1;
         $this->_data->intest = 1;
         $this->_data->published = 1;
         $this->published = 1;
         $this->_data->access = 1;
         $this->_data->translation = "";
     }
     return $this->_data;
 }
Ejemplo n.º 2
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fst_comments ' . '  WHERE id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->ident = 5;
         //
         $this->_data->itemid = 0;
         $this->_data->body = null;
         $this->_data->email = null;
         $this->_data->name = null;
         $this->_data->website = null;
         $this->_data->published = 1;
         $current_date = new JDate();
         if (FSTJ3Helper::IsJ3()) {
             $mySQL_conform_date = $current_date->toSql();
         } else {
             $mySQL_conform_date = $current_date->toMySQL();
         }
         $this->_data->created = $mySQL_conform_date;
     }
     return $this->_data;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 function _buildQuery()
 {
     $db =& JFactory::getDBO();
     $query = ' SELECT t.id as id,t.body as body, t.email as email, t.name as name, t.website as website, t.published as published, ';
     $query .= ' t.created as added, ident, itemid FROM #__fst_comments as t';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( t.name ) LIKE ' . $db->Quote('%' . FSTJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ' OR ' . 'LOWER( t.body ) LIKE ' . $db->Quote('%' . FSTJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     $order = "";
     if ($this->lists['order'] == 'added') {
         $order = ' ORDER BY added ' . FSTJ3Helper::getEscaped($db, $this->lists['order_Dir']);
     } else {
         if ($this->lists['order']) {
             $order = ' ORDER BY ' . FSTJ3Helper::getEscaped($db, $this->lists['order']) . ' ' . FSTJ3Helper::getEscaped($db, $this->lists['order_Dir']) . '';
         }
     }
     if ($this->lists['prod_id'] > 0) {
         $where[] = 'p.id = ' . FSTJ3Helper::getEscaped($db, $this->lists['prod_id']);
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 't.published = ' . FSTJ3Helper::getEscaped($db, $this->lists['ispublished']);
     }
     $ident = JRequest::getVar('ident', '');
     if ($ident > 0) {
         $where[] = 'ident = ' . FSTJ3Helper::getEscaped($db, $ident);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Ejemplo n.º 5
0
 function &getData()
 {
     if (empty($this->_data)) {
         if (FST_Helper::Is16()) {
             $query = ' SELECT u.*, ' . 'CONCAT(m.username," (",m.name,")") as name ' . ' FROM #__fst_user as u ' . ' LEFT JOIN #__users as m ON u.user_id = m.id ' . '  WHERE u.id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id);
         } else {
             $query = ' SELECT u.*, ' . 'CONCAT(m.username," (",m.name,")") as name, ' . 'g.name as groupname ' . ' FROM #__fst_user as u ' . ' LEFT JOIN #__users as m ON u.user_id = m.id ' . ' LEFT JOIN #__core_acl_aro_groups as g ON u.group_id = g.id ' . '  WHERE u.id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id);
         }
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->mod_kb = 0;
         $this->_data->mod_test = 0;
         $this->_data->support = 0;
         $this->_data->user_id = 0;
         $this->_data->group_id = 0;
         $this->_data->seeownonly = 0;
         $this->_data->autoassignexc = 0;
         $this->_data->allprods = 1;
         $this->_data->alldepts = 1;
         $this->_data->allcats = 1;
         $this->_data->artperm = 0;
         $this->_data->groups = 0;
         $this->_data->allprods_a = 1;
         $this->_data->alldepts_a = 1;
         $this->_data->allcats_a = 1;
         $this->_data->assignperms = 0;
         $this->_data->reports = 0;
         $this->name = "";
     }
     return $this->_data;
 }
Ejemplo n.º 6
0
 function &getProduct()
 {
     $db = JFactory::getDBO();
     $prodid = JRequest::getVar('prodid', 0, '', 'int');
     $query = "SELECT * FROM #__fst_prod WHERE id = '" . FSTJ3Helper::getEscaped($db, $prodid) . "'";
     $db->setQuery($query);
     $rows = $db->loadAssoc();
     return $rows;
 }
Ejemplo n.º 7
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fst_emails ' . '  WHERE id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     return $this->_data;
 }
Ejemplo n.º 8
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     if (FST_Helper::Is16()) {
         JHtml::_('behavior.framework');
     }
     $mainframe = JFactory::getApplication();
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.fst_modal');
     $user = JFactory::getUser();
     $userid = $user->id;
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fst_user WHERE user_id = '" . FSTJ3Helper::getEscaped($db, $userid) . "'";
     $db->setQuery($query);
     $this->_permissions = $db->loadAssoc();
     $this->params =& FST_Settings::GetViewSettingsObj('test');
     $this->test_show_prod_mode = $this->params->get('test_show_prod_mode', 'accordian');
     $this->test_always_prod_select = $this->params->get('test_always_prod_select', '0');
     $layout = JRequest::getVar('layout', '');
     $this->prodid = JRequest::getVar('prodid');
     if ($this->prodid == "") {
         $this->prodid = -1;
     }
     $this->products = $this->get('Products');
     //print_p($this->products);
     if (count($this->products) == 0) {
         $this->prodid = 0;
     }
     $this->comments = new FST_Comments("test", $this->prodid);
     if ($this->prodid == -1) {
         $this->comments->opt_show_posted_message_only = 1;
     }
     $onlyprodid = JRequest::getVar('onlyprodid', 'x');
     if ($onlyprodid != 'x') {
         $this->comments->itemid = (int) $onlyprodid;
         $this->comments->show_item_select = false;
     }
     echo "Hide Add : " . $this->params->get('hide_add', 0) . "<br>";
     if ($this->params->get('hide_add', 0)) {
         $this->comments->can_add = 0;
     }
     if ($layout == "create") {
         $this->setupCommentsCreate();
     }
     if ($this->comments->Process()) {
         return;
     }
     if ($layout == "create") {
         return $this->displayCreate();
     }
     if ($this->prodid != -1) {
         return $this->displaySingleProduct();
     }
     return $this->displayAllProducts();
 }
Ejemplo n.º 9
0
 function GetSelect(&$handler, $ident, $itemid)
 {
     $db =& JFactory::getDBO();
     $qry = "SELECT " . FSTJ3Helper::getEscaped($db, $handler->field_title) . ", " . FSTJ3Helper::getEscaped($db, $handler->field_id) . " FROM " . FSTJ3Helper::getEscaped($db, $handler->table) . " ORDER BY " . FSTJ3Helper::getEscaped($db, $handler->field_title);
     $db->setQuery($qry);
     $items = $db->loadObjectList();
     if ($ident == 5) {
         $newitems[] = JHTML::_('select.option', '0', JText::_("GENERAL_TESTIMONIALS"), $handler->field_id, $handler->field_title);
         $items = array_merge($newitems, $items);
     }
     return JHTML::_('select.genericlist', $items, 'itemid', 'class="inputbox" size="1"', $handler->field_id, $handler->field_title, $itemid);
 }
Ejemplo n.º 10
0
 function GetItemData($itemids = null)
 {
     $db = JFactory::getDBO();
     $qry = "SELECT {$this->field_id}, {$this->field_title} FROM {$this->table} WHERE {$this->field_id}";
     if ($itemids) {
         $ids = array();
         foreach ($itemids as $id) {
             $ids[] = FSTJ3Helper::getEscaped($db, $id);
         }
         $qry .= " IN (" . implode(", ", $ids) . ")";
     }
     $db->setQuery($qry);
     $this->itemdata = $db->loadAssocList($this->field_id);
 }
Ejemplo n.º 11
0
 function DoPublishComment($published)
 {
     $commentid = JRequest::getVar('commentid', 0, '', 'int');
     if (!$commentid) {
         return;
     }
     $db = JFactory::getDBO();
     $qry = "UPDATE #__fst_comments SET published = {$published} WHERE id = '" . FSTJ3Helper::getEscaped($db, $commentid) . "'";
     $db->SetQuery($qry);
     $db->Query();
     echo $qry;
     exit;
     return true;
 }
Ejemplo n.º 12
0
 function Load($template, $tpltype)
 {
     //echo "Loading $template => $tpltype<br>";
     if ($this->loadedtmpl == $template && $this->loadedtype == $tpltype) {
         return;
     }
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fst_templates WHERE template = '" . FSTJ3Helper::getEscaped($db, $template) . "' AND tpltype = " . FSTJ3Helper::getEscaped($db, $tpltype);
     $db->SetQuery($query);
     $tmpl = $db->LoadObject();
     $this->template = $tmpl->value;
     $this->ProcessLanguage();
     $this->loadedtmpl = $template;
     $this->loadedtype = $tpltype;
 }
Ejemplo n.º 13
0
 function _buildQuery()
 {
     $db =& JFactory::getDBO();
     $query = ' SELECT u.*, CONCAT(m.username," (",m.name,")") as name FROM #__fst_user as u LEFT JOIN #__users as m ON u.user_id = m.id';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( name ) LIKE ' . $db->Quote('%' . FSTJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order']) {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'];
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where;
     return $query;
 }
Ejemplo n.º 14
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);
 }
Ejemplo n.º 15
0
 function toggleField()
 {
     $id = JRequest::getVar('id');
     $field = JRequest::getVar('field');
     $val = JRequest::getVar('val');
     if ($field == "") {
         return;
     }
     if ($id < 1) {
         return;
     }
     if ($field != "inkb" && $field != "insupport" && $field != "intest") {
         return;
     }
     $db = JFactory::getDBO();
     $qry = "UPDATE #__fst_prod SET " . FSTJ3Helper::getEscaped($db, $field) . " = " . FSTJ3Helper::getEscaped($db, $val) . " WHERE id = " . FSTJ3Helper::getEscaped($db, $id);
     $db->setQuery($qry);
     $db->Query();
     echo FST_GetYesNoText($val);
     exit;
 }
Ejemplo n.º 16
0
 function ImportVMart()
 {
     $log = "";
     // check that the vm products table exists and has products in it
     $tablename = "#__virtuemart_products_en_gb";
     $pid = "virtuemart_product_id";
     $ver = 2;
     if (!$this->TableExists($tablename)) {
         $tablename = "#__vm_product";
         $pid = "product_id";
         $ver = 1;
         if (!$this->TableExists($tablename)) {
             $log = "No VirtueMart installation found\n";
             return $log;
         }
     }
     $db = JFactory::getDBO();
     $qry = "SELECT count(*) FROM {$tablename}";
     $db->setQuery($qry);
     $result = $db->loadResult();
     if ($result == 0) {
         $log = "No VirtueMart products found, aborting\n";
         return $log;
     }
     $qry = "SELECT MAX(ordering)+1 as neworder FROM #__fst_prod";
     $db->setQuery($qry);
     $order = $db->loadResult();
     $qry = "SELECT * FROM {$tablename} WHERE product_parent_id = 0 ORDER BY product_name";
     if ($ver == 2) {
         $qry = "SELECT p.*, m.file_url FROM #__virtuemart_products_en_gb as p \n\n\t\t\t\tLEFT JOIN #__virtuemart_product_medias as i \n\t\t\t\tON p.virtuemart_product_id = i.virtuemart_product_id\n\n\t\t\t\tLEFT JOIN  #__virtuemart_medias as m \n\t\t\t\tON i.virtuemart_media_id = m.virtuemart_media_id\n\n\t\t\t\tLEFT JOIN  #__virtuemart_products as x\n\t\t\t\tON p.virtuemart_product_id = x.virtuemart_product_id\n\t\t\t\t\n\t\t\t\tWHERE product_parent_id = 0 ORDER BY product_name  ";
     }
     $db->setQuery($qry);
     $products = $db->loadObjectList();
     $log .= "Synchroizing " . count($products) . " VirtueMart products\n";
     $pids = array();
     // check for any removed products
     $qry = "SELECT * FROM #__fst_prod WHERE import_id > 0";
     $db->setQuery($qry);
     $existingproducts = $db->loadObjectList('import_id');
     if ($ver == 1) {
         $sourcepath = JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'shop_image' . DS . 'product';
     } else {
         if ($ver == 2) {
             $sourcepath = JPATH_SITE;
         }
     }
     $destbase = JPATH_SITE . DS . 'images' . DS . 'fst' . DS . 'products';
     // get existing file list
     $existingfiles = array();
     if (is_dir($destbase)) {
         if ($dh = opendir($destbase)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file == "." || $file == "..") {
                     continue;
                 }
                 $existingfiles[$file] = $file;
             }
             closedir($dh);
         }
     }
     foreach ($products as $product) {
         // check for existing product
         $existing = null;
         if (array_key_exists($product->{$pid}, $existingproducts)) {
             $existing = $existingproducts[$product->{$pid}];
         }
         // import image
         $pids[$product->{$pid}] = $product->{$pid};
         // check if the image exists or not
         if ($ver == 1) {
             $imagesource = $product->product_full_image;
             $destfile = $imagesource;
         } else {
             if ($ver == 2) {
                 $imagesource = $product->file_url;
                 $fin = pathinfo($imagesource);
                 $destfile = $fin['basename'];
             }
         }
         if ($existing) {
             if ($product->product_name != $existing->title || $product->product_s_desc != $existing->description || $destfile != $existing->image) {
                 $log .= "Product '{$product->product_name}' already exists, updating\n";
                 $qry = "UPDATE #__fst_prod SET title = '" . FSTJ3Helper::getEscaped($db, $product->product_name) . "', description = '" . FSTJ3Helper::getEscaped($db, $product->product_s_desc) . "', image = '" . FSTJ3Helper::getEscaped($db, $destfile) . "' WHERE id = '{$existing->id}'";
                 $db->setQuery($qry);
                 $db->query();
             }
         } else {
             $log .= "Adding product '{$product->product_name}'\n";
             $qry = "INSERT INTO #__fst_prod (import_id, title, description, image, published, ordering, inkb, insupport, intest) VALUES (";
             $qry .= $product->{$pid} . ", ";
             $qry .= "'" . FSTJ3Helper::getEscaped($db, $product->product_name) . "', ";
             $qry .= "'" . FSTJ3Helper::getEscaped($db, $product->product_s_desc) . "', ";
             $qry .= "'" . FSTJ3Helper::getEscaped($db, $destfile) . "', ";
             $qry .= "1, {$order}, 1, 1, 1)";
             $order++;
         }
         $db->setQuery($qry);
         $db->Query();
         // not existing, so make a new resized image for this product
         if ($imagesource && !array_key_exists($destfile, $existingfiles)) {
             $log .= "Copying and resizing image {$imagesource} for product '{$product->product_name}'\n";
             if (!$this->image_resize($sourcepath . DS . $imagesource, $destbase . DS . $destfile, 64, 64, 0)) {
                 copy($sourcepath . DS . $imagesource, $destbase . DS . $destfile);
             }
         }
     }
     foreach ($existingproducts as $product) {
         if (!array_key_exists($product->import_id, $pids)) {
             $log .= "Removing product {$product->title}\n";
             $qry = "DELETE FROM #__fst_prod WHERE id = " . FSTJ3Helper::getEscaped($db, $product->id);
             $db->setQuery($qry);
             $db->Query();
         }
     }
     $log .= "Done\n";
     return $log;
 }
Ejemplo n.º 17
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.º 18
0
 function SortAPIKey($username = "", $apikey = "")
 {
     $db = JFactory::getDBO();
     $log = "";
     if ($username == "") {
         $qry = "SELECT * FROM #__fst_settings WHERE setting = 'fsj_username'";
         $db->setQuery($qry);
         $row = $db->loadObject();
         if ($row) {
             $username = $row->value;
         }
         $qry = "SELECT * FROM #__fst_settings WHERE setting = 'fsj_apikey'";
         $db->setQuery($qry);
         $row = $db->loadObject();
         if ($row) {
             $apikey = $row->value;
         }
     }
     if ($apikey == "" || $username == "") {
         $log = "No API key set\n";
         return $log;
     }
     // find current component id
     $qry = "SELECT * FROM #__extensions WHERE element = 'com_fst'";
     $db->setQuery($qry);
     $comp = $db->loadObject();
     if ($comp) {
         // delete from update sites where component is me
         $qry = "SELECT * FROM #__update_sites_extensions WHERE extension_id = {$comp->extension_id}";
         $db->setQuery($qry);
         $sites = $db->loadObjectList();
         foreach ($sites as $site) {
             $siteid = $site->update_site_id;
             $qry = "DELETE FROM #__update_sites WHERE update_site_id = {$siteid}";
             $db->setQuery($qry);
             $db->Query($qry);
         }
         $qry = "DELETE FROM #__update_sites_extensions WHERE extension_id = {$comp->extension_id}";
         $db->setQuery($qry);
         $db->Query($qry);
         // insert new record in to site
         $qry = "INSERT INTO #__update_sites (name, type, location, enabled) VALUES ('Freestyle Testimonials Updates', 'collection', 'http://www.freestyle-joomla.com/update/list.php?username="******"&apikey=" . FSTJ3Helper::getEscaped($db, $apikey) . "', 1)";
         $db->setQuery($qry);
         $db->Query();
         $site_id = $db->insertid();
         $qry = "INSERT INTO #__update_sites_extensions (update_site_id, extension_id) VALUES ({$site_id}, {$comp->extension_id})";
         $db->setQuery($qry);
         $db->Query();
         $log .= "Updater link appended with api information\n";
     } else {
         $log .= "Unable to find component\n";
     }
     return $log;
 }
Ejemplo n.º 19
0
 function CustomTemplate()
 {
     $template = JRequest::getVar('name');
     $db =& JFactory::getDBO();
     $qry = "SELECT * FROM #__fst_templates WHERE template = '" . FSTJ3Helper::getEscaped($db, $template) . "'";
     $db->setQuery($qry);
     $rows = $db->loadAssocList();
     $output = array();
     foreach ($rows as $row) {
         if ($row['tpltype']) {
             $output['head'] = $row['value'];
         } else {
             $output['row'] = $row['value'];
         }
     }
     echo json_encode($output);
     exit;
 }
Ejemplo n.º 20
0
 static function Get_Template($tmpl)
 {
     $db = JFactory::getDBO();
     $qry = "SELECT body, subject, ishtml FROM #__fst_emails WHERE tmpl = '" . FSTJ3Helper::getEscaped($db, $tmpl) . "'";
     $db->setQuery($qry);
     return $db->loadAssoc();
 }
Ejemplo n.º 21
0
 static function &Comm_GetCustomFields($ident)
 {
     $db = JFactory::getDBO();
     // get a list of all available fields
     if ($ident != -1) {
         $qry = "SELECT * FROM #__fst_field as f WHERE f.published = 1 AND (f.ident = 999 OR f.ident = '" . FSTJ3Helper::getEscaped($db, $ident) . "') ";
     } else {
         $qry = "SELECT * FROM #__fst_field as f WHERE f.published = 1 ";
     }
     $qry .= " ORDER BY f.ordering";
     $db->setQuery($qry);
     $rows = $db->loadAssocList("id");
     $indexes = array();
     if (count($rows) > 0) {
         foreach ($rows as $index => &$row) {
             $indexes[] = FSTJ3Helper::getEscaped($db, $index);
         }
     }
     $indexlist = implode(",", $indexes);
     if (count($indexes) == 0) {
         $indexlist = "0";
     }
     $qry = "SELECT * FROM #__fst_field_values WHERE field_id IN ({$indexlist})";
     $db->setQuery($qry);
     $values = $db->loadAssocList();
     if (count($values) > 0) {
         foreach ($values as &$value) {
             $field_id = $value['field_id'];
             $rows[$field_id]['values'][] = $value['value'];
         }
     }
     return $rows;
 }
Ejemplo n.º 22
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.º 23
0
 function getAnnouncement()
 {
     // get a list of announcements, including pagination and filter
     $id = JRequest::getVar('id', 0);
     $db = JFactory::getDBO();
     $qry = "SELECT a.*, u.name, u.username FROM #__fst_announce as a LEFT JOIN #__users as u ON a.author = u.id ";
     $qry .= "WHERE a.id = '" . FSTJ3Helper::getEscaped($db, $id) . "'";
     $db->setQuery($qry);
     return $db->loadObject();
 }
Ejemplo n.º 24
0
 function displayCatsA()
 {
     $user_id = JRequest::getInt('user_id', 0);
     $db =& JFactory::getDBO();
     $query = "SELECT * FROM #__fst_user_cat_a as u LEFT JOIN #__fst_ticket_cat as p ON u.ticket_cat_id = p.id WHERE u.user_id = '" . FSTJ3Helper::getEscaped($db, $user_id) . "'";
     $db->setQuery($query);
     $catogries = $db->loadObjectList();
     $query = "SELECT * FROM #__fst_user WHERE id = '" . FSTJ3Helper::getEscaped($db, $user_id) . "'";
     $db->setQuery($query);
     $userpermissions = $db->loadObject();
     $jid = $userpermissions->user_id;
     $query = "SELECT * FROM #__users WHERE id = '" . FSTJ3Helper::getEscaped($db, $jid) . "'";
     $db->setQuery($query);
     $joomlauser = $db->loadObject();
     $this->assignRef('userpermissions', $userpermissions);
     $this->assignRef('joomlauser', $joomlauser);
     $this->assignRef('catogries', $catogries);
     parent::display();
 }
Ejemplo n.º 25
0
 function GetModerateComments()
 {
     if (!$this->use_comments) {
         return;
     }
     $db = JFactory::getDBO();
     $qry = "SELECT * FROM " . $this->table . " WHERE ";
     $where = array();
     $order = array();
     $this->ident = JRequest::getVar('ident', 0);
     $this->published = JRequest::getVar('published', 0);
     if ($this->ident > 0) {
         $where[] = "ident='" . FSTJ3Helper::getEscaped($db, $this->ident) . "'";
     }
     $where[] = "published='" . FSTJ3Helper::getEscaped($db, $this->published) . "'";
     $qry .= implode(" AND ", $where);
     $qry .= " ORDER BY ident, itemid, created DESC";
     $db->setQuery($qry);
     $this->_data =& $db->loadAssocList();
     $this->PopulateCustomFields();
     // sort data into a tree
     $newdata = array();
     $itemids = array();
     foreach ($this->_data as $item) {
         $newdata[$item['ident']][$item['itemid']][] = $item;
         $itemids[$item['ident']][$item['itemid']] = $item['itemid'];
     }
     foreach ($itemids as $ident => $items) {
         $this->handlers[$ident]->GetItemData($items);
     }
     $this->_data = $newdata;
     //print_p($this->customfields);
 }
Ejemplo n.º 26
0
 function GetItemData($itemids = null)
 {
     $db = JFactory::getDBO();
     $qry = "SELECT {$this->field_id}, {$this->field_title}, translation FROM {$this->table} WHERE intest = 1 AND published = 1";
     if ($itemids) {
         $ids = array();
         foreach ($itemids as $id) {
             $ids[] = FSTJ3Helper::getEscaped($db, $id);
         }
         $qry .= " AND {$this->field_id} IN (" . implode(", ", $ids) . ")";
     }
     $db->setQuery($qry);
     $this->itemdata = $db->loadAssocList($this->field_id);
     FST_Helper::Tr($this->itemdata);
 }