Esempio n. 1
0
 function save()
 {
     $namespace = NextendRequest::getCmd('namespace', 'default');
     if (isset($_REQUEST['namespace']) && isset($_REQUEST['settings'])) {
         if ($namespace == 'default') {
             $namespace = 'settings';
         }
         if ($namespace == 'font' && NextendRequest::getInt('sliderid')) {
             $namespace .= NextendRequest::getInt('sliderid');
             self::markChanged(NextendRequest::getInt('sliderid'));
         }
         if ($namespace == 'joomla') {
             $license = empty($_REQUEST['settings']['license']) ? '' : $_REQUEST['settings']['license'];
             $db = NextendDatabase::getInstance();
             $db->setQuery("SELECT b.update_site_id FROM #__extensions AS a LEFT JOIN #__update_sites_extensions AS b ON a.extension_id = b.extension_id WHERE a.element = 'com_smartslider2' ");
             $updates = $db->loadAssocList();
             if (count($updates)) {
                 $id = $updates[0]['update_site_id'];
                 unset($updates[0]);
                 if (count($updates)) {
                     foreach ($updates as $u) {
                         $db->setQuery('DELETE FROM #__update_sites WHERE update_site_id = ' . $u['update_site_id']);
                         $db->query();
                         $db->setQuery('DELETE FROM #__update_sites_extensions WHERE update_site_id = ' . $u['update_site_id']);
                         $db->query();
                     }
                 }
                 $db->setQuery('UPDATE #__update_sites SET location = ' . $db->quote('http://www.nextendweb.com/update2/joomla/update.php?license=' . urlencode($license) . '&fake=extension.xml') . ' WHERE update_site_id = ' . $id);
                 $db->query();
             }
         }
         NextendSmartSliderStorage::set($namespace, json_encode($_REQUEST['settings']));
     }
 }
Esempio n. 2
0
 function getData($number)
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_igallery/defines.php';
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('ignitegallerysourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'con.id, ';
     $query .= 'con.filename, ';
     $query .= 'con.description, ';
     $query .= 'con.alt_text, ';
     $query .= 'con.link, ';
     $query .= 'con.hits, ';
     $query .= 'con.rotation, ';
     $query .= 'con.gallery_id, ';
     $query .= 'cat.name AS cat_title, ';
     $query .= 'cat.alias AS cat_alias ';
     $query .= 'FROM #__igallery_img AS con ';
     $query .= 'LEFT JOIN #__igallery AS cat ON cat.id = con.gallery_id ';
     $where = array();
     if (count($category) > 0 && !in_array('0', $category)) {
         $where[] = 'con.gallery_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('ignitegallerysourcepublished', 1)) {
         $where[] = 'con.published = 1 ';
     }
     if (count($where)) {
         $query .= ' WHERE ' . implode(' AND ', $where);
     }
     $order = NextendParse::parse($this->_data->get('ignitegalleryorder1', 'con.ordering|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('ignitegalleryorder2', 'con.ordering|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     for ($i = 0; $i < count($result); $i++) {
         $fileHashNoExt = JFile::stripExt($result[$i]['filename']);
         $fileHashNoRef = substr($fileHashNoExt, 0, strrpos($fileHashNoExt, '-'));
         $result[$i]['url'] = 'index.php?option=com_igallery&view=category&igid=' . $result[$i]['gallery_id'] . '#!' . $fileHashNoRef;
         $result[$i]['categoryurl'] = 'index.php?option=com_igallery&view=category&igid=' . $result[$i]['gallery_id'];
         $increment = igFileHelper::getIncrementFromFilename($result[$i]['filename']);
         $folderName = igFileHelper::getFolderName($increment);
         $sourceFile = IG_ORIG_PATH . '/' . $folderName . '/' . $result[$i]['filename'];
         $size = getimagesize($sourceFile);
         $fileArray = igFileHelper::originalToResized($result[$i]['filename'], $size[0], $size[1], 100, 0, $result[$i]['rotation'], 0, 0);
         $result[$i]['thumbnail'] = $result[$i]['image'] = IG_IMAGE_HTML_RESIZE . $fileArray['folderName'] . '/' . $fileArray['fullFileName'];
         $result[$i]['title'] = $result[$i]['alt_text'];
         $result[$i]['author_name'] = '';
         $result[$i]['author_url'] = '#';
     }
     return $result;
 }
Esempio n. 3
0
 static function delete($key)
 {
     $db = NextendDatabase::getInstance();
     $sql = '';
     if (self::get($key) !== null) {
         $sql = "DELETE FROM #__nextend_smartslider_storage WHERE " . $db->quoteName('key') . " = " . $db->quote($key);
         $db->setQuery($sql);
         $db->query();
         unset(self::$cache[$key]);
     }
 }
Esempio n. 4
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/template.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/stockroom.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/economic.php';
     require_once JPATH_SITE . '/components/com_redshop/helpers/product.php';
     $Redconfiguration = new Redconfiguration();
     $data = array();
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('redshopproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('redshopproductssourcepublished', 1)) {
         $where[] = ' pr.published = 1 ';
     }
     if ($this->_data->get('redshopproductssourcespecial', 0)) {
         $where[] = ' (pr.product_special =  1) ';
     }
     if ($this->_data->get('redshopproductssourceonsale', 0)) {
         $where[] = ' (pr.product_on_sale =  1) ';
     }
     $o = '';
     $order = NextendParse::parse($this->_data->get('redshopproductsorder1', 'pr.product_name|*|asc'));
     if ($order[0]) {
         $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('redshopproductsorder2', 'pr.product_name|*|asc'));
         if ($order[0]) {
             $o .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query = "SELECT \r\n                        pr.product_id, \r\n                        pr.published, \r\n                        pr_cat.ordering, \r\n                        pr.product_name as name, \r\n                        pr.product_s_desc as short_description, \r\n                        pr.product_desc as description, \r\n                        man.manufacturer_name as man_name,\r\n                        pr.product_full_image as image, \r\n                        pr.product_thumb_image as image_thumbnail, \r\n                        pr.product_price,\r\n                        cat.category_id,\r\n                        cat.category_name, \r\n                        cat.category_short_description , \r\n                        cat.category_description\r\n                    FROM `#__redshop_product` AS pr\r\n                    LEFT JOIN `#__redshop_product_category_xref` AS pr_cat USING (product_id)\r\n                    LEFT JOIN `#__redshop_category` AS cat USING (category_id)\r\n                    LEFT JOIN `#__redshop_manufacturer` AS man USING(manufacturer_id)\r\n                    WHERE pr.product_parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " " . $o . " LIMIT 0, " . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $product = new producthelper();
         $result[$i]['title'] = $result[$i]['name'];
         $result[$i]['price'] = $product->getProductFormattedPrice($product->getProductPrice($result[$i]['product_id']));
         $result[$i]['addtocart'] = $result[$i]['url'] = 'index.php?option=com_redshop&view=product&pid=' . $result[$i]['product_id'] . '&cid=' . $result[$i]['category_id'];
         $result[$i]['addtocart_label'] = 'View product';
         $result[$i]['category_url'] = 'index.php?option=com_redshop&view=category&cid=' . $result[$i]['category_id'] . '&layout=detail';
         $result[$i]['thumbnail'] = $result[$i]['image_thumbnail'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image_thumbnail'];
         $result[$i]['image'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image'];
     }
     return $result;
 }
Esempio n. 5
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     require_once JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php';
     $config = MijoShop::get('opencart')->get('config');
     $currency = MijoShop::get('opencart')->get('currency');
     if (MijoShop::get('base')->isAdmin('joomla')) {
         global $vqmod;
         if (empty($vqmod)) {
             require_once JPATH_MIJOSHOP_OC . '/vqmod/vqmod.php';
             $vqmod = new VQMod();
         }
         require_once $vqmod->modCheck(DIR_SYSTEM . 'library/tax.php');
         MijoShopOpencart::$tax = new Tax(MijoShopOpencart::$registry);
         MijoShopOpencart::$registry->set('tax', MijoShopOpencart::$tax);
     }
     $tax = MijoShop::get('opencart')->get('tax');
     $router = MijoShop::get('router');
     $language_id = intval($this->_data->get('mijoshopproductssourcelanguage'));
     if (!$language_id) {
         $language_id = intval($config->get('config_language_id'));
     }
     $tmpLng = $config->get('config_language_id');
     $config->set('config_language_id', $language_id);
     MijoShopOpencart::$loader->model('catalog/product');
     $p = new ModelCatalogProduct(MijoShopOpencart::$registry);
     $query = 'SELECT ';
     $query .= 'p.product_id ';
     $query .= 'FROM #__mijoshop_product AS p ';
     $query .= 'LEFT JOIN #__mijoshop_product_description AS pc USING(product_id) ';
     $query .= 'LEFT JOIN #__mijoshop_product_to_category AS ptc USING(product_id) ';
     $query .= 'LEFT JOIN #__mijoshop_product_special AS ps USING(product_id) ';
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('mijoshopproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'ptc.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('mijoshopproductssourcepublished', 1)) {
         $where[] = ' p.status = 1 ';
     }
     if ($this->_data->get('mijoshopproductssourcespecial', 0)) {
         $where[] = ' ps.price IS NOT NULL';
         $jnow = JFactory::getDate();
         $now = version_compare(JVERSION, '1.6.0', '<') ? $jnow->toMySQL() : $jnow->toSql();
         $where[] = ' (ps.date_start = "0000-00-00" OR ps.date_start < \'' . $now . '\')';
         $where[] = ' (ps.date_end = "0000-00-00" OR ps.date_end > \'' . $now . '\')';
     }
     if ($this->_data->get('mijoshopproductssourceinstock', 0)) {
         $where[] = ' p.quantity > 0 ';
     }
     $where[] = ' pc.language_id  = ' . $language_id;
     if (count($where) > 0) {
         $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
     }
     $query .= 'GROUP BY p.product_id ';
     $order = NextendParse::parse($this->_data->get('mijoshopproductsorder1', 'pc.name|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('mijoshopproductsorder2', '|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     for ($i = 0; $i < count($result); $i++) {
         $pi = $p->getProduct($result[$i]['product_id']);
         $data[$i] = array();
         $data[$i]['title'] = $data[$i]['name'] = $pi['name'];
         $data[$i]['short_description'] = $pi['description'];
         $data[$i]['model'] = $pi['model'];
         $data[$i]['sku'] = $pi['sku'];
         $data[$i]['quantity'] = $pi['quantity'];
         $data[$i]['manufacturer'] = $pi['manufacturer'];
         $data[$i]['rating'] = $pi['rating'];
         $data[$i]['price'] = $currency->format($tax->calculate($pi['price'], $pi['tax_class_id'], $config->get('config_tax')));
         if ((double) $product_info['special']) {
             $data[$i]['special_price'] = $currency->format($tax->calculate($pi['special'], $pi['tax_class_id'], $config->get('config_tax')));
         } else {
             $data[$i]['special_price'] = '';
         }
         if ($config->get('config_tax')) {
             $data[$i]['price_ex_tax'] = $currency->format((double) $pi['special'] ? $pi['special'] : $pi['price']);
         }
         $data[$i]['thumbnail'] = $data[$i]['image'] = NextendFilesystem::pathToAbsoluteURL(DIR_IMAGE) . $pi['image'];
         $data[$i]['addtocart'] = $data[$i]['url'] = $router->route('index.php?option=com_mijoshop&route=product/product&product_id=' . $pi['product_id']);
         $data[$i]['addtocart_label'] = 'View product';
         $data[$i]['category_name'] = 'Not available';
         $data[$i]['category_url'] = '#';
     }
     $config->set('config_language_id', $tmpLng);
     return $data;
 }
Esempio n. 6
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('phocagallerysourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'con.id, ';
     $query .= 'con.title, ';
     $query .= 'con.alias, ';
     $query .= 'con.filename, ';
     $query .= 'con.description, ';
     $query .= 'con.hits, ';
     $query .= 'con.catid, ';
     $query .= 'cat.title AS cat_title, ';
     $query .= 'cat.description AS cat_description, ';
     $query .= 'cat.alias AS cat_alias ';
     $query .= 'FROM #__phocagallery AS con ';
     $query .= 'LEFT JOIN #__phocagallery_categories AS cat ON cat.id = con.catid ';
     $where = array();
     if (count($category) > 0 && !in_array('0', $category)) {
         $where[] = 'con.catid IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('phocagallerysourcepublished', 1)) {
         $where[] = 'con.published = 1 ';
         $where[] = 'con.approved = 1 ';
     }
     if ($this->_data->get('phocagallerysourcefeatured', 0)) {
         $where[] = 'con.featured = 1 ';
     }
     $language = $this->_data->get('phocagallerysourcelanguage', '*');
     if ($language) {
         $where[] = 'con.language = ' . $db->quote($language) . ' ';
     }
     if (count($where)) {
         $query .= ' WHERE ' . implode(' AND ', $where);
     }
     $order = NextendParse::parse($this->_data->get('phocagalleryorder1', 'con.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('phocagalleryorder2', 'con.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $result[$i]['url'] = 'index.php?option=com_phocagallery&view=detail&catid=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias'] . '&id=' . $result[$i]['id'] . ':' . $result[$i]['alias'];
         $result[$i]['url_label'] = 'View image';
         $result[$i]['categoryurl'] = 'index.php?option=com_phocagallery&view=category&id=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias'];
         $result[$i]['thumbnail'] = $result[$i]['image'] = $uri . "images/phocagallery/" . $result[$i]['filename'];
         if (!$result[$i]['description']) {
             $result[$i]['description'] = '';
         }
         $result[$i]['author_name'] = '';
         $result[$i]['author_url'] = '#';
     }
     return $result;
 }
Esempio n. 7
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_SITE . "/components/com_jshopping/lib/factory.php";
     $jshopConfig = JSFactory::getConfig();
     $lang = JSFactory::getLang();
     $session = JFactory::getSession();
     $data = array();
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('joomshoppingproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('joomshoppingproductssourcepublished', 1)) {
         $where[] = ' pr.product_publish = 1 ';
     }
     if ($this->_data->get('joomshoppingproductssourceinstock', 0)) {
         $where[] = ' (pr.product_quantity > 0 OR pr.unlimited = 1) ';
     }
     if ($labelid = $this->_data->get('joomshoppingproductssourcelabel', 0)) {
         $where[] = ' pr.label_id = "' . $labelid . '" ';
     }
     $o = '';
     $order = NextendParse::parse($this->_data->get('joomshoppingproductsorder1', 'pr.name|*|asc'));
     if ($order[0]) {
         if ($order[0] == 'pr.name') {
             $order[0] = 'pr.`' . $lang->get('name') . '`';
         }
         $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('joomshoppingproductsorder2', 'pr.name|*|asc'));
         if ($order[0]) {
             if ($order[0] == 'pr.name') {
                 $order[0] = 'pr.`' . $lang->get('name') . '`';
             }
             $o .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query = "SELECT \r\n                        pr.product_id, \r\n                        pr.product_publish, \r\n                        pr_cat.product_ordering, \r\n                        pr.`" . $lang->get('name') . "` as name, \r\n                        pr.`" . $lang->get('short_description') . "` as short_description, \r\n                        man.`" . $lang->get('name') . "` as man_name, \r\n                        pr.product_ean as ean, \r\n                        pr.product_quantity as qty, \r\n                        pri.image_name as image, \r\n                        pr.product_price,\r\n                        pr.currency_id, \r\n                        pr.hits, \r\n                        pr.unlimited, \r\n                        pr.product_date_added, \r\n                        pr.label_id, \r\n                        pr.vendor_id, \r\n                        V.f_name as v_f_name, \r\n                        V.l_name as v_l_name,\r\n                        cat.category_image,\r\n                        cat.category_id,\r\n                        cat.`" . $lang->get('name') . "` as category_name, \r\n                        cat.`" . $lang->get('alias') . "` as category_alias, \r\n                        cat.`" . $lang->get('short_description') . "` as category_short_description, \r\n                        cat.`" . $lang->get('description') . "` as category_description\r\n                    FROM `#__jshopping_products` AS pr\r\n                    LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat USING (product_id)\r\n                    LEFT JOIN `#__jshopping_categories` AS cat USING (category_id)\r\n                    LEFT JOIN `#__jshopping_manufacturers` AS man ON pr.product_manufacturer_id=man.manufacturer_id\r\n                    LEFT JOIN `#__jshopping_vendors` as V on pr.vendor_id=V.id\r\n                    LEFT JOIN `#__jshopping_products_images` as pri on pr.product_id=pri.product_id\r\n                    WHERE pr.parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " GROUP BY pr.product_id " . $o . " LIMIT 0, " . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     for ($i = 0; $i < count($result); $i++) {
         $product = JTable::getInstance('product', 'jshop');
         $product->load($result[$i]['product_id']);
         $attr = JRequest::getVar("attr");
         $back_value = $session->get('product_back_value');
         if (!isset($back_value['pid'])) {
             $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
         }
         if ($back_value['pid'] != $product_id) {
             $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
         }
         if (!is_array($back_value['attr'])) {
             $back_value['attr'] = array();
         }
         if (count($back_value['attr']) == 0 && is_array($attr)) {
             $back_value['attr'] = $attr;
         }
         $attributesDatas = $product->getAttributesDatas($back_value['attr']);
         $product->setAttributeActive($attributesDatas['attributeActive']);
         getDisplayPriceForProduct($product->product_price);
         $product->getExtendsData();
         $result[$i]['title'] = $result[$i]['name'];
         $result[$i]['price'] = formatprice($product->getPriceCalculate());
         $op = $product->getOldPrice();
         $result[$i]['product_old_price'] = $op > 0 ? formatprice($op) : '';
         $result[$i]['url'] = SEFLink('index.php?option=com_jshopping&controller=product&task=view&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']);
         $result[$i]['category_url'] = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $result[$i]['category_id']);
         $result[$i]['addtocart'] = $result[$i]['add_to_cart_url'] = SEFLink('index.php?option=com_jshopping&controller=cart&task=add&quantity=1&to=cart&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']);
         $result[$i]['addtocart_label'] = 'Add to cart';
         $result[$i]['image_full'] = $jshopConfig->image_product_live_path . '/full_' . $result[$i]['image'];
         $result[$i]['thumbnail'] = $result[$i]['image_thumb'] = $jshopConfig->image_product_live_path . '/thumb_' . $result[$i]['image'];
         $result[$i]['image'] = $jshopConfig->image_product_live_path . '/' . $result[$i]['image'];
     }
     return $result;
 }
Esempio n. 8
0
 function delete($id)
 {
     $db = NextendDatabase::getInstance();
     $db->setQuery('DELETE FROM #__nextend_smartslider_layouts WHERE id=' . $db->quote($id));
     $db->query();
 }
Esempio n. 9
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('sourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'con.id, ';
     $query .= 'con.title, ';
     $query .= 'con.alias, ';
     $query .= 'con.introtext, ';
     $query .= 'con.fulltext, ';
     $query .= 'con.catid, ';
     $query .= 'cat.title AS cat_title, ';
     $query .= 'cat.alias AS cat_alias, ';
     $query .= 'con.created_by, ';
     $query .= 'usr.name AS created_by_alias, ';
     $query .= 'con.images ';
     $query .= 'FROM #__content AS con ';
     $query .= 'LEFT JOIN #__users AS usr ON usr.id = con.created_by ';
     $query .= 'LEFT JOIN #__categories AS cat ON cat.id = con.catid ';
     $query .= 'WHERE con.catid IN (' . implode(',', $category) . ') ';
     $sourceuserid = intval($this->_data->get('sourceuserid', ''));
     if ($sourceuserid) {
         $query .= 'AND con.created_by = ' . $sourceuserid . ' ';
     }
     if ($this->_data->get('sourcepublished', 1)) {
         $query .= 'AND con.state = 1 ';
         $jnow = JFactory::getDate();
         $now = version_compare(JVERSION, '1.6.0', '<') ? $jnow->toMySQL() : $jnow->toSql();
         $query .= "AND (con.publish_up = '0000-00-00 00:00:00' OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down > '" . $now . "') ";
     }
     if ($this->_data->get('sourcefeatured', 0)) {
         $query .= 'AND con.featured = 1 ';
     }
     $language = $this->_data->get('sourcelanguage', '*');
     if ($language) {
         $query .= 'AND con.language = ' . $db->quote($language) . ' ';
     }
     $order = NextendParse::parse($this->_data->get('order1', 'con.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('order2', 'con.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('content');
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $article = new stdClass();
         $article->text = $result[$i]['introtext'];
         $_p = array();
         $dispatcher->trigger('onContentPrepare', array('com_smartslider2', &$article, &$_p, 0));
         if (!empty($article->text)) {
             $result[$i]['introtext'] = $article->text;
         }
         $result[$i]['description'] = $result[$i]['introtext'];
         $article->text = $result[$i]['fulltext'];
         $_p = array();
         $dispatcher->trigger('onContentPrepare', array('com_smartslider2', &$article, &$_p, 0));
         if (!empty($article->text)) {
             $result[$i]['fulltext'] = $article->text;
         }
         $result[$i]['url'] = ContentHelperRoute::getArticleRoute($result[$i]['id'] . ':' . $result[$i]['alias'], $result[$i]['catid'] . ':' . $result[$i]['cat_alias']);
         $result[$i]['categorylisturl'] = 'index.php?option=com_content&view=category&id=' . $result[$i]['catid'];
         $result[$i]['categoryblogurl'] = 'index.php?option=com_content&view=category&layout=blog&id=' . $result[$i]['catid'];
         $images = (array) json_decode($result[$i]['images'], true);
         $result[$i]['image'] = $result[$i]['thumbnail'] = $result[$i]['intro_image'] = isset($images['image_intro']) ? $uri . $images['image_intro'] : '';
         $result[$i]['fulltext_image'] = isset($images['image_fulltext']) ? $uri . $images['image_fulltext'] : '';
         unset($result[$i]['images']);
         $result[$i]['url_label'] = 'View article';
         $result[$i]['author_name'] = $result[$i]['created_by_alias'];
         $result[$i]['author_url'] = '#';
     }
     return $result;
 }
Esempio n. 10
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $section = array_map('intval', explode('||', $this->_data->get('cobaltrecordssourcesection', '')));
     $category = array_map('intval', explode('||', $this->_data->get('cobaltrecordssourcecategory', '')));
     $type = array_map('intval', explode('||', $this->_data->get('cobaltrecordssourcetype', '')));
     $query = 'SELECT ';
     $query .= 'rec.id ';
     $query .= 'FROM #__js_res_record AS rec ';
     $query .= 'LEFT JOIN #__js_res_record_category AS cat ON cat.record_id = rec.id ';
     $where = array();
     if (!in_array(0, $section) && count($section) > 0) {
         $where[] = 'rec.section_id IN (' . implode(',', $section) . ') ';
     }
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'cat.catid IN (' . implode(',', $category) . ') ';
     }
     if (!in_array(0, $type) && count($type) > 0) {
         $where[] = 'rec.type_id IN (' . implode(',', $type) . ') ';
     }
     $sourceuserid = intval($this->_data->get('cobaltrecordssourceuserid', ''));
     if ($sourceuserid) {
         $where[] = ' rec.user_id = ' . $sourceuserid . ' ';
     }
     if ($this->_data->get('cobaltrecordssourcepublished', 1)) {
         $where[] = ' rec.published = 1 ';
     }
     if ($this->_data->get('cobaltrecordssourcefeatured', 0)) {
         $where[] = ' rec.featured = 1 ';
     }
     $language = $this->_data->get('cobaltrecordssourcelanguage', '*');
     if ($language && $language != '*') {
         $where[] = ' rec.langs = ' . $db->quote($language) . ' ';
     }
     if (count($where) > 0) {
         $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
     }
     $order = NextendParse::parse($this->_data->get('cobaltrecordsorder1', 'rec.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('cobaltrecordsorder2', 'rec.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $ids = $db->loadAssocList();
     require_once JPATH_SITE . '/components/com_cobalt/models/form.php';
     if (version_compare(JVERSION, '2.5.6', 'lt')) {
         jimport('joomla.application.component.model');
     } else {
         jimport('joomla.application.component.modellegacy');
     }
     JLoader::import('record', JPATH_SITE . '/components/com_cobalt/models');
     $model = null;
     if (version_compare(JVERSION, '2.5.6', 'lt')) {
         $model = JModel::getInstance('record', 'CobaltModel');
     } else {
         $model = JModelLegacy::getInstance('record', 'CobaltModel');
     }
     $sectionmodel = null;
     if (version_compare(JVERSION, '2.5.6', 'lt')) {
         $sectionmodel = JModel::getInstance('section', 'CobaltModel');
     } else {
         $sectionmodel = JModelLegacy::getInstance('section', 'CobaltModel');
     }
     $categorymodel = null;
     if (version_compare(JVERSION, '2.5.6', 'lt')) {
         $categorymodel = JModel::getInstance('category', 'CobaltModel');
     } else {
         $categorymodel = JModelLegacy::getInstance('category', 'CobaltModel');
     }
     $data = array();
     foreach ($ids as $id) {
         $r = array();
         $rec = $model->_prepareItem($model->getItem($id['id']));
         $r['id'] = $rec->id;
         $r['title'] = $rec->title;
         $r['url'] = $rec->url;
         $r['hits'] = $rec->hits;
         $r['created_by'] = $rec->user_id;
         $user = JFactory::getUser($r['created_by']);
         $r['created_by_alias'] = $user->get('name');
         $r['section_id'] = $rec->section_id;
         $section = $sectionmodel->getItem($r['section_id']);
         $r['section_title'] = $section->name;
         $r['section_url'] = Url::records($section);
         $r['category_id'] = $rec->category_id;
         $category = $categorymodel->getItem($r['category_id']);
         $r['cat_title'] = $category->title;
         $r['category_url'] = Url::records($section, $category);
         $r['type_id'] = $rec->type_id;
         $r['type_title'] = $rec->type_name;
         if (is_array($rec->fields_by_id) && count($rec->fields_by_id) > 0) {
             foreach ($rec->fields_by_id as $id => $field) {
                 $r['extra' . $id . '_' . preg_replace("/\\W|_/", "", $field->getLabelName())] = $field->result;
             }
         }
         $data[] = $r;
     }
     return $data;
 }
Esempio n. 11
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('sourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'cat.id, ';
     $query .= 'cat.title, ';
     $query .= 'cat.alias, ';
     $query .= 'cat.description, ';
     $query .= 'cat.params, ';
     $query .= 'cat_parent.id AS parent_id, ';
     $query .= 'cat_parent.title AS parent_title ';
     $query .= 'FROM #__categories AS cat ';
     $query .= 'LEFT JOIN #__categories AS cat_parent ON cat_parent.id = cat.parent_id ';
     $query .= 'WHERE cat.parent_id IN (' . implode(',', $category) . ') ';
     if ($this->_data->get('sourcepublished', 1)) {
         $query .= 'AND cat.published = 1 ';
     }
     $language = $this->_data->get('sourcelanguage', '*');
     if ($language) {
         $query .= 'AND cat.language = ' . $db->quote($language) . ' ';
     }
     $order = NextendParse::parse($this->_data->get('joomlacartegoryorder1', 'cat.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('joomlacartegoryorder2', '|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('content');
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $article = new stdClass();
         $article->text = $result[$i]['description'];
         $_p = array();
         $dispatcher->trigger('onContentPrepare', array('com_smartslider2', &$article, &$_p, 0));
         if (!empty($article->text)) {
             $result[$i]['description'] = $article->text;
         }
         $result[$i]['url'] = 'index.php?option=com_content&view=category&id=' . $result[$i]['id'];
         $result[$i]['url_blog'] = 'index.php?option=com_content&view=category&layout=blog&id=' . $result[$i]['id'];
         $params = (array) json_decode($result[$i]['params'], true);
         $result[$i]['image'] = isset($params['image']) ? $uri . $params['image'] : '';
         if ($result[$i]['parent_title'] != 'ROOT') {
             $result[$i]['parent_url'] = 'index.php?option=com_content&view=category&id=' . $result[$i]['parent_id'];
             $result[$i]['parent_url_blog'] = 'index.php?option=com_content&view=category&layout=blog&id=' . $result[$i]['parent_id'];
         } else {
             $result[$i]['parent_title'] = '';
             $result[$i]['parent_url'] = '';
             $result[$i]['parent_url_blog'] = '';
         }
     }
     return $result;
 }
Esempio n. 12
0
 function order($sliderid, $ids)
 {
     if (is_array($ids) && count($ids) > 0) {
         $db = NextendDatabase::getInstance();
         $i = 0;
         foreach ($ids as $id) {
             $id = intval($id);
             if ($id > 0) {
                 $db->update('#__nextend_smartslider_slides', array('ordering' => $i), 'id = ' . $db->quote($id) . ' AND slider = ' . $db->quote($sliderid));
                 $i++;
             }
         }
         self::markChanged($sliderid);
         return $i;
     }
     return false;
 }
Esempio n. 13
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $query = 'SELECT ';
     $query .= 'con.id ';
     $query .= 'FROM #__content AS con ';
     $query .= 'LEFT JOIN #__flexicontent_cats_item_relations AS fcat ON fcat.itemid = con.id ';
     $query .= 'LEFT JOIN #__categories AS cat ON fcat.catid = cat.id ';
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('sourcecategory', '')));
     if (!in_array('0', $category) && !in_array('1', $category)) {
         $where[] = 'fcat.catid IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('sourcepublished', 1)) {
         $where[] = 'con.state = 1 ';
     }
     if ($this->_data->get('sourcefeatured', 0)) {
         $where[] = 'con.featured = 1 ';
     }
     $language = $this->_data->get('sourcelanguage', '*');
     if ($language) {
         $where[] = 'con.language = ' . $db->quote($language) . ' ';
     }
     if (count($where)) {
         $query .= ' WHERE ' . implode(' AND ', $where);
     }
     $query .= 'GROUP BY con.id ';
     $order = NextendParse::parse($this->_data->get('order1', 'con.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('order2', 'con.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $lng = JFactory::getLanguage();
     $adminapp = JFactory::$application;
     $siteapp = JApplicationCms::getInstance('site');
     $siteapp->loadLanguage($lng);
     require_once JPATH_ADMINISTRATOR . DS . 'components/com_flexicontent/defineconstants.php';
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'tables');
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php';
     require_once JPATH_SITE . DS . "components/com_flexicontent/classes/flexicontent.fields.php";
     require_once JPATH_SITE . DS . "components/com_flexicontent/classes/flexicontent.helper.php";
     require_once JPATH_SITE . '/components/com_flexicontent/models/item.php';
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $aid = FLEXI_J16GE ? $user->getAuthorisedViewLevels() : (int) $user->get('aid');
     $itemmodel = FLEXI_J16GE ? new FlexicontentModelItem() : new FlexicontentModelItems();
     for ($i = 0; $i < count($result); $i++) {
         $data[$i] = array();
         JFactory::$application = $siteapp;
         $item = $itemmodel->getItem($result[$i]['id'], $check_view_access = false);
         list($item) = FlexicontentFields::getFields($item, '', $item->parameters, $aid);
         JFactory::$application = $adminapp;
         $data[$i]['link'] = FlexicontentHelperRoute::getItemRoute($item->id, $item->catid);
         foreach ($item->fields as $k => $field) {
             $data[$i][$k] = FlexicontentFields::getFieldDisplay($item, $k, $values = null, $method = 'display');
         }
     }
     JFactory::$application = $adminapp;
     return $data;
 }
Esempio n. 14
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php';
     VmConfig::loadConfig();
     $language = $this->_data->get('virtuemartproductssourcelanguage', 'en_gb');
     if (!$language) {
         $language = VMLANG;
     }
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('virtuemartproductssourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'prod.virtuemart_product_id AS id, ';
     $query .= 'prod.product_sku AS sku, ';
     $query .= 'prod_ext.product_name AS name, ';
     $query .= 'prod_ext.product_s_desc AS short_description, ';
     $query .= 'prod_ext.product_desc AS description, ';
     $query .= 'prod_ext.slug AS slug, ';
     $query .= 'cat.virtuemart_category_id AS category_id, ';
     $query .= 'cat.category_name, ';
     $query .= 'cat.category_description, ';
     $query .= 'cat.slug AS category_slug, ';
     $query .= 'man.virtuemart_manufacturer_id AS manufacturer_id, ';
     $query .= 'man.mf_name AS manufacturer_name, ';
     $query .= 'man.mf_email AS manufacturer_email, ';
     $query .= 'man.mf_desc AS manufacturer_description, ';
     $query .= 'man.mf_url AS manufacturer_url, ';
     $query .= 'man.slug AS manufacturer_slug, ';
     $query .= 'med.file_url AS image, ';
     $query .= 'med.file_url_thumb AS thumbnail, ';
     $query .= 'prod.hits ';
     $query .= 'FROM #__virtuemart_products AS prod ';
     $query .= 'LEFT JOIN #__virtuemart_products_' . $language . ' AS prod_ext ON prod.virtuemart_product_id = prod_ext.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_product_categories AS cat_x ON cat_x.virtuemart_product_id = prod.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_categories_' . $language . ' AS cat ON cat_x.virtuemart_category_id = cat.virtuemart_category_id ';
     $query .= 'LEFT JOIN #__virtuemart_product_manufacturers AS man_x ON man_x.virtuemart_product_id = prod.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_manufacturers_' . $language . ' AS man ON man_x.virtuemart_manufacturer_id = man.virtuemart_manufacturer_id ';
     $query .= 'LEFT JOIN #__virtuemart_product_medias AS med_x ON med_x.virtuemart_product_id = prod.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_medias AS med ON med_x.virtuemart_media_id = med.virtuemart_media_id ';
     $where = array();
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'cat_x.virtuemart_category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('virtuemartproductssourcepublished', 1)) {
         $where[] = ' prod.published = 1 ';
     }
     if ($this->_data->get('virtuemartproductssourcespecial', 0)) {
         $where[] = ' prod.product_special = 1 ';
     }
     if ($this->_data->get('virtuemartproductssourceinstock', 0)) {
         $where[] = ' prod.product_in_stock > 0 ';
     }
     $where[] = ' med.file_is_downloadable = 0 ';
     $where[] = ' med.file_is_forSale = 0 ';
     if (count($where) > 0) {
         $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
     }
     $order = NextendParse::parse($this->_data->get('virtuemartproductsorder1', 'prod_ext.product_name|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('virtuemartproductsorder2', 'prod_ext.product_name|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'product.php';
     $currency = CurrencyDisplay::getInstance();
     for ($i = 0; $i < count($result); $i++) {
         $result[$i]['title'] = $result[$i]['name'];
         $productModel = new VirtueMartModelProduct();
         $p = $productModel->getProduct($result[$i]['id'], TRUE, TRUE, TRUE, 1, false);
         $result[$i]['price'] = $result[$i]['cost_price'] = $currency->createPriceDiv('costPrice', '', $p->prices, true);
         $result[$i]['base_price'] = $currency->createPriceDiv('basePrice', '', $p->prices, true);
         $result[$i]['base_price_variant'] = $currency->createPriceDiv('basePriceVariant', '', $p->prices, true);
         $result[$i]['base_price_with_tax'] = $currency->createPriceDiv('basePriceWithTax', '', $p->prices, true);
         $result[$i]['discounted_price_without_tax'] = $currency->createPriceDiv('discountedPriceWithoutTax', '', $p->prices, true);
         $result[$i]['price_before_tax'] = $currency->createPriceDiv('priceBeforeTax', '', $p->prices, true);
         $result[$i]['sales_price'] = $currency->createPriceDiv('salesPrice', '', $p->prices, true);
         $result[$i]['tax_amount'] = $currency->createPriceDiv('taxAmount', '', $p->prices, true);
         $result[$i]['sales_price_with_discount'] = $currency->createPriceDiv('salesPriceWithDiscount', '', $p->prices, true);
         $result[$i]['sales_price_temp'] = $currency->createPriceDiv('salesPriceTemp', '', $p->prices, true);
         $result[$i]['unit_price'] = $currency->createPriceDiv('unitPrice', '', $p->prices, true);
         $result[$i]['price_without_tax'] = $currency->createPriceDiv('priceWithoutTax', '', $p->prices, true);
         $result[$i]['discount_amount'] = $currency->createPriceDiv('discountAmount', '', $p->prices, true);
         $result[$i]['variant_modification'] = $currency->createPriceDiv('variantModification', '', $p->prices, true);
         $result[$i]['addtocart'] = $result[$i]['url'] = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $result[$i]['id'] . '&virtuemart_category_id=' . $result[$i]['category_id'];
         $result[$i]['addtocart_label'] = 'View product';
         $result[$i]['category_url'] = 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $result[$i]['category_id'];
         $result[$i]['image'] = JURI::root(false) . '/' . $result[$i]['image'];
         $result[$i]['thumbnail'] = JURI::root(false) . '/' . $result[$i]['thumbnail'];
     }
     return $result;
 }
Esempio n. 15
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('easyblogcategories', '')));
     $query = 'SELECT con.*, con.intro as "main_content_of_post", con.content as "rest_of_the_post", usr.nickname as "blogger", usr.avatar as "blogger_avatar_picture", cat.title as cat_title ';
     /* id 	created_by 	title 	description 	alias 	avatar 	parent_id 	private 	created 	status 	published 	ordering 	level 	lft 	rgt 	default */
     $query .= 'FROM #__easyblog_post con ';
     $query .= 'LEFT JOIN #__easyblog_users usr ON usr.id = con.created_by ';
     $query .= 'LEFT JOIN #__easyblog_category cat ON cat.id = con.category_id ';
     $query .= 'WHERE con.category_id IN (' . implode(',', $category) . ') ';
     if ($this->_data->get('easyblogpublished', 1)) {
         $jnow = JFactory::getDate();
         $now = version_compare(JVERSION, '1.6.0', '<') ? $jnow->toMySQL() : $jnow->toSql();
         $query .= "AND con.published = 1 AND (con.publish_up = '0000-00-00 00:00:00' OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down > '" . $now . "') ";
     }
     if ($this->_data->get('easyblogfrontpage', 1)) {
         $query .= "AND con.frontpage = " . $this->_data->get('easyblogfrontpage', 1) . " ";
     }
     $sourceuserid = intval($this->_data->get('easybloguserid', ''));
     if ($sourceuserid) {
         $query .= 'AND con.created_by = ' . $sourceuserid . ' ';
     }
     $order = NextendParse::parse($this->_data->get('easyblogorder1', 'con.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('easyblogorder2', 'con.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     for ($i = 0; $i < count($result); $i++) {
         $result[$i]['url'] = 'index.php?option=com_easyblog&view=entry&id=' . $result[$i]['id'];
         $result[$i]['categoryurl'] = 'index.php?option=com_easyblog&view=categories&id=' . $result[$i]['category_id'];
         $result[$i]['blogger_avatar_picture'] = $result[$i]['blogger_avatar_picture'] == "default_blogger.png" ? "components/com_easyblog/assets/images/" . $result[$i]['blogger_avatar_picture'] : "images/easyblog/avatar/" . $result[$i]['blogger_avatar_picture'];
         $img = json_decode($result[$i]["image"], true);
         if (is_array($img)) {
             if (isset($img["url"])) {
                 $result[$i]['blog_image'] = $img["url"];
             } else {
                 $result[$i]['blog_image'] = "";
             }
             if (isset($img["icon"]) && isset($img["icon"]["url"])) {
                 $result[$i]['blog_image_icon'] = $img["icon"]["url"];
             } else {
                 $result[$i]['blog_image_icon'] = "";
             }
             if (isset($img["thumbnail"]) && isset($img["thumbnail"]["url"])) {
                 $result[$i]['blog_image_thumbnail'] = $img["thumbnail"]["url"];
             } else {
                 $result[$i]['blog_image_thumbnail'] = $result[$i]['blog_image'];
             }
             $result[$i]['image'] = $result[$i]['blog_image'];
             $result[$i]['thumbnail'] = $result[$i]['blog_image_thumbnail'];
         }
         $result[$i]['description'] = $result[$i]['main_content_of_post'];
         $result[$i]['url_label'] = 'View post';
         $result[$i]['author_name'] = $result[$i]['blogger'];
         $result[$i]['author_url'] = '#';
     }
     return $result;
 }
Esempio n. 16
0
 function changeDynamicLayout($sliderid)
 {
     $slider = $this->getSlider($sliderid);
     $sliderParams = new NextendData();
     $sliderParams->loadJSON($slider['params']);
     $sliders = array();
     NextendPlugin::callPlugin('nextendslidergeneratorlayouts', 'onNextendSliderGeneratorSlider', array(&$sliders, $sliderParams->get('size', null)));
     $sliderpreset = NextendRequest::getVar('sliderpreset', '');
     if (isset($sliders[$sliderpreset])) {
         $slider = $sliders[$sliderpreset]['slider'] + $slider;
         $db = NextendDatabase::getInstance();
         $db->update('#__nextend_smartslider_sliders', array('type' => $slider['type'], 'params' => $slider['params']), 'id = ' . $db->quote($sliderid));
         self::markChanged($sliderid);
     }
     $generatorParams = new NextendData();
     $generatorParams->loadJSON($slider['generator']);
     $group = array();
     $list = array();
     NextendPlugin::callPlugin('nextendslidergenerator', 'onNextendSliderGeneratorList', array(&$group, &$list));
     $source = $generatorParams->get('source');
     $sourcetype = null;
     foreach ($list as $ls) {
         foreach ($ls as $k => $l) {
             if ($k == $source) {
                 $sourcetype = $l;
                 break;
             }
         }
         if ($sourcetype) {
             break;
         }
     }
     $slide = array();
     NextendPlugin::callPlugin('nextendslidergeneratorlayouts', 'onNextendSliderGeneratorLayouts', array($sourcetype[5], &$slide));
     $layout = NextendRequest::getVar('layout', '');
     if (isset($slide[$layout])) {
         if (isset($slide[$layout]['slider'])) {
             $generatorParams->loadArray($slide[$layout]['slider']);
         }
         $this->saveGenerator($sliderid, $generatorParams->toArray(), $slide[$layout]['slide'], false);
     }
     return $sliderid;
 }
Esempio n. 17
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('k2itemssourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'con.id, ';
     $query .= 'con.title, ';
     $query .= 'con.alias, ';
     $query .= 'con.introtext, ';
     $query .= 'con.fulltext, ';
     $query .= 'con.catid, ';
     $query .= 'cat.name AS cat_title, ';
     $query .= 'cat.alias AS cat_alias, ';
     $query .= 'con.created_by, ';
     $query .= 'usr.name AS created_by_alias, ';
     $query .= 'con.hits, ';
     $query .= 'con.image_caption, ';
     $query .= 'con.image_credits, ';
     $query .= 'con.extra_fields ';
     $query .= 'FROM #__k2_items AS con ';
     $query .= 'LEFT JOIN #__users AS usr ON usr.id = con.created_by ';
     $query .= 'LEFT JOIN #__k2_categories AS cat ON cat.id = con.catid ';
     $query .= 'WHERE con.catid IN (' . implode(',', $category) . ') ';
     $sourceuserid = intval($this->_data->get('k2itemssourceuserid', ''));
     if ($sourceuserid) {
         $query .= 'AND con.created_by = ' . $sourceuserid . ' ';
     }
     if ($this->_data->get('k2itemssourcepublished', 1)) {
         $jnow = JFactory::getDate();
         $now = version_compare(JVERSION, '1.6.0', '<') ? $jnow->toMySQL() : $jnow->toSql();
         $query .= "AND con.published = 1 AND (con.publish_up = '0000-00-00 00:00:00' OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down > '" . $now . "') ";
     }
     $query .= 'AND con.trash = 0 ';
     if ($this->_data->get('k2itemssourcefeatured', 0)) {
         $query .= 'AND con.featured = 1 ';
     }
     $language = $this->_data->get('k2itemssourcelanguage', '*');
     if ($language) {
         $query .= 'AND con.language = ' . $db->quote($language) . ' ';
     }
     $order = NextendParse::parse($this->_data->get('k2itemsorder1', 'con.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('k2itemsorder2', 'con.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $this->loadExtraFields();
     require_once JPATH_SITE . '/components/com_k2/helpers/utilities.php';
     require_once JPATH_SITE . '/components/com_k2/models/item.php';
     $k2item = new K2ModelItem();
     for ($i = 0; $i < count($result); $i++) {
         $result[$i]['url'] = 'index.php?option=com_k2&view=item&id=' . $result[$i]['id'] . ':' . $result[$i]['alias'];
         $result[$i]['categoryurl'] = 'index.php?option=com_k2&view=itemlist&task=category&id=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias'];
         $result[$i]['thumbnail'] = $result[$i]['image'] = "media/k2/items/cache/" . md5("Image" . $result[$i]['id']) . "_XL.jpg";
         if (!NextendFilesystem::fileexists(JPATH_SITE . '/' . $result[$i]['image'])) {
             $result[$i]['thumbnail'] = $result[$i]['image'] = '';
         }
         $result[$i]['description'] = $result[$i]['introtext'];
         $result[$i]['url_label'] = 'View article';
         $result[$i]['author_name'] = $result[$i]['created_by_alias'];
         $result[$i]['author_url'] = '#';
         $item = (object) $result[$i];
         $extras = $k2item->getItemExtraFields($result[$i]['extra_fields'], $item);
         if (is_array($extras) && count($extras) > 0) {
             foreach ($extras as $field) {
                 $result[$i]['extra' . $field->id . '_' . preg_replace("/\\W|_/", "", $this->extraFields[$field->id]['group_name'] . '_' . $this->extraFields[$field->id]['name'])] = $field->value;
             }
         }
     }
     return $result;
 }