/**
  * Creates fake root for manufacturer tree, and ads category list fileds for each manufacturer item
  *
  * @param string $sLinkTarget  Name of class, responsible for category rendering
  * @param string $sActCat      Active category
  * @param string $sShopHomeUrl base shop url ($myConfig->getShopHomeURL())
  */
 public function buildManufacturerTree($sLinkTarget, $sActCat, $sShopHomeUrl)
 {
     //Load manufacturer list
     $this->loadManufacturerList();
     //Create fake manufacturer root category
     $this->_oRoot = oxNew("oxManufacturer");
     $this->_oRoot->load("root");
     //category fields
     $this->_addCategoryFields($this->_oRoot);
     $this->_aPath[] = $this->_oRoot;
     foreach ($this as $sVndId => $oManufacturer) {
         // storing active manufacturer object
         if ((string) $sVndId === $sActCat) {
             $this->setClickManufacturer($oManufacturer);
         }
         $this->_addCategoryFields($oManufacturer);
         if ($sActCat == $oManufacturer->oxmanufacturers__oxid->value) {
             $this->_aPath[] = $oManufacturer;
         }
     }
     $this->_seoSetManufacturerData();
 }
Example #2
0
 /**
  * Creates fake root for vendor tree, and ads category list fileds for each vendor item
  *
  * @param string $sLinkTarget  Name of class, responsible for category rendering
  * @param string $sActCat      Active category
  * @param string $sShopHomeUrl base shop url ($myConfig->getShopHomeUrl())
  */
 public function buildVendorTree($sLinkTarget, $sActCat, $sShopHomeUrl)
 {
     $sActCat = str_replace('v_', '', $sActCat);
     //Load vendor list
     $this->loadVendorList();
     //Create fake vendor root category
     $this->_oRoot = oxNew("oxVendor");
     $this->_oRoot->load('root');
     //category fields
     $this->_addCategoryFields($this->_oRoot);
     $this->_aPath[] = $this->_oRoot;
     foreach ($this as $sVndId => $oVendor) {
         // storing active vendor object
         if ($sVndId == $sActCat) {
             $this->setClickVendor($oVendor);
         }
         $this->_addCategoryFields($oVendor);
         if ($sActCat == $oVendor->oxvendor__oxid->value) {
             $this->_aPath[] = $oVendor;
         }
     }
     $this->_seoSetVendorData();
 }
Example #3
0
function upgrade()
{
    $database =& JFactory::getDBO();
    $absolute_path = JPATH_ROOT;
    $config =& JFactory::getConfig();
    $dbprefix = $config->get('dbprefix');
    $row = new stdClass();
    //echo $db;
    $row->message = "";
    $row->database_version = 1;
    if (TableExists($dbprefix . "swmenufree_config")) {
        $query = "SELECT * FROM #__swmenufree_config WHERE id = 1";
        $database->setQuery($query);
        $result = $database->loadObjectList();
        $swmenufree = array();
        $sql = "SELECT id FROM #__modules where module='mod_swmenufree' AND published > -1";
        $database->setQuery($sql);
        $id = $database->loadResult();
        $row =& JTable::getInstance('module');
        // load the row from the db table
        $row->load($id);
        $row->message = "";
        if ($result) {
            $style = $row->params;
            while (list($key, $val) = each($result[0])) {
                $swmenufree[$key] = $val;
                if ($key == 'id') {
                    $val = $row->id;
                    $style .= $key . "=" . $val . "\n";
                } else {
                    if ($key == 'corners') {
                        $style .= $val . "\n";
                    } else {
                        if ($key == 'sub_indicator') {
                            $style .= $val . "\n";
                        } else {
                            if ($key == 'sub_padding') {
                                $padding = explode("px", $val);
                                $style .= "sub_pad_top=" . $padding[0] . "\n";
                                $style .= "sub_pad_right=" . $padding[1] . "\n";
                                $style .= "sub_pad_bottom=" . $padding[2] . "\n";
                                $style .= "sub_pad_left=" . $padding[3] . "\n";
                            } else {
                                if ($key == 'main_padding') {
                                    $padding = explode("px", $val);
                                    $style .= "main_pad_top=" . $padding[0] . "\n";
                                    $style .= "main_pad_right=" . $padding[1] . "\n";
                                    $style .= "main_pad_bottom=" . $padding[2] . "\n";
                                    $style .= "main_pad_left=" . $padding[3] . "\n";
                                } else {
                                    if ($key == 'complete_padding') {
                                        $padding = explode("px", $val);
                                        $style .= "complete_margin_top=" . $padding[0] . "\n";
                                        $style .= "complete_margin_right=" . $padding[1] . "\n";
                                        $style .= "complete_margin_bottom=" . $padding[2] . "\n";
                                        $style .= "complete_margin_left=" . $padding[3] . "\n";
                                    } else {
                                        if ($key == 'top_margin') {
                                            $padding = explode("px", $val);
                                            $style .= "top_margin_top=" . $padding[0] . "\n";
                                            $style .= "top_margin_right=" . $padding[1] . "\n";
                                            $style .= "top_margin_bottom=" . $padding[2] . "\n";
                                            $style .= "top_margin_left=" . $padding[3] . "\n";
                                        } else {
                                            if ($key == 'main_border') {
                                                $border = explode(" ", $val);
                                                $style .= "main_border_width=" . rtrim(trim($border[0]), 'px') . "\n";
                                                $style .= "main_border_style=" . $border[1] . "\n";
                                                $style .= "main_border_color=" . $border[2] . "\n";
                                            } else {
                                                if ($key == 'main_border_over') {
                                                    $border = explode(" ", $val);
                                                    $style .= "main_border_over_width=" . rtrim(trim($border[0]), 'px') . "\n";
                                                    $style .= "main_border_over_style=" . $border[1] . "\n";
                                                    $style .= "main_border_color_over=" . $border[2] . "\n";
                                                } else {
                                                    if ($key == 'sub_border') {
                                                        $border = explode(" ", $val);
                                                        $style .= "sub_border_width=" . rtrim(trim($border[0]), 'px') . "\n";
                                                        $style .= "sub_border_style=" . $border[1] . "\n";
                                                        $style .= "sub_border_color=" . $border[2] . "\n";
                                                    } else {
                                                        if ($key == 'sub_border_over') {
                                                            $border = explode(" ", $val);
                                                            $style .= "sub_border_over_width=" . rtrim(trim($border[0]), 'px') . "\n";
                                                            $style .= "sub_border_over_style=" . $border[1] . "\n";
                                                            $style .= "sub_border_color_over=" . $border[2] . "\n";
                                                        } else {
                                                            $style .= $key . "=" . $val . "\n";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $style .= "top_sub_indicator_top=0\n";
            $style .= "top_sub_indicator_left=0\n";
            $style .= "top_sub_indicator_align=right\n";
            $style .= "sub_sub_indicator_top=0\n";
            $style .= "sub_sub_indicator_left=0\n";
            $style .= "sub_sub_indicator_align=right\n";
            $style .= "tablet_hack=0\n";
            $style .= "complete_background_position=top left\n";
            $style .= "active_background_position=top left\n";
            $style .= "top_background_position=top left\n";
            $style .= "sub_background_position=top left\n";
            $style .= "top_hover_background_position=top left\n";
            $style .= "sub_hover_background_position=top left\n";
            $style .= "complete_background_repeat=repeat\n";
            $style .= "active_background_repeat=repeat\n";
            $style .= "top_background_repeat=repeat\n";
            $style .= "sub_background_repeat=repeat\n";
            $style .= "top_hover_background_repeat=repeat\n";
            $style .= "sub_hover_background_repeat=repeat\n";
            if (TableExists($dbprefix . "swmenufree_styles")) {
                $query = "SELECT * FROM #__swmenufree_styles WHERE id = 1";
                $database->setQuery($query);
                $styles = $database->loadObjectList();
                if (!count($styles)) {
                    $row->message .= "Copying swmenufree_config table to swmenufree_styles<br />";
                    $database->setQuery("INSERT INTO #__swmenufree_styles SET id='1', params='{$style}'");
                    $database->query();
                }
            } else {
                $database->setQuery(" CREATE TABLE IF NOT EXISTS #__swmenufree_styles (\n                      `id` int(11) NOT NULL,\n                      `params` text,\n                       PRIMARY KEY (`id`)\n                     ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n                    ");
                $row->message .= "Creating swmenufree_styles table and copying swmenufree_config table to swmenufree_styles<br />";
                $database->query();
                $database->setQuery("INSERT INTO #__swmenufree_styles SET id='1', params='{$style}'");
                $database->query();
            }
        }
        //echo count($swmenufree);
    } else {
        if (TableExists($dbprefix . "swmenufree_styles")) {
            $query = "SELECT * FROM #__swmenufree_styles WHERE id = 1";
            $database->setQuery($query);
            $styles = $database->loadObjectList();
            if (!count($styles)) {
                $row->message .= "Creating default style<br />";
                $database->setQuery("INSERT INTO `#__swmenufree_styles` (`id`, `params`) VALUES\n(1, 'position=left\norientation=vertical/right\nmain_width=0\nmain_height=0\nsub_width=0\nsub_height=0\nmain_top=0\nmain_left=0\nlevel1_sub_top=0\nlevel1_sub_left=0\nlevel2_sub_top=0\nlevel2_sub_left=0\ncomplete_margin_top=8\ncomplete_margin_right=16\ncomplete_margin_bottom=16\ncomplete_margin_left=16\ntop_margin_top=12\ntop_margin_right=0\ntop_margin_bottom=0\ntop_margin_left=0\nmain_pad_top=11\nmain_pad_right=28\nmain_pad_bottom=11\nmain_pad_left=20\nsub_pad_top=9\nsub_pad_right=29\nsub_pad_bottom=10\nsub_pad_left=15\ncomplete_background_image=\ncomplete_background_repeat=repeat\ncomplete_background_position=left top\nactive_background_image=\nactive_background_repeat=repeat\nactive_background_position=left top\nmain_back_image=\ntop_background_repeat=repeat\ntop_background_position=left top\nmain_back_image_over=\ntop_hover_background_repeat=repeat\ntop_hover_background_position=left top\nsub_back_image=\nsub_background_repeat=repeat\nsub_background_position=left top\nsub_back_image_over=\nsub_hover_background_repeat=repeat\nsub_hover_background_position=left top\ncomplete_background=#4E84CC\nactive_background=#942E8D\nmain_back=#0F3322\nmain_over=#163961\nsub_back=#168C9E\nsub_over=#D1FF54\ntop_sub_indicator=images/swmenufree/arrows/whiteleft-on.gif\ntop_sub_indicator_align=right\ntop_sub_indicator_top=0\ntop_sub_indicator_left=13\nsub_sub_indicator=images/swmenufree/arrows/blackleft-on.gif\nsub_sub_indicator_align=right\nsub_sub_indicator_top=0\nsub_sub_indicator_left=13\nfont_family=Times New Roman, Times, serif\nsub_font_family=Times New Roman, Times, serif\ntop_ttf=\nsub_ttf=\nmain_font_color=#EBEFF5\nmain_font_color_over=#E1EBE4\nsub_font_color=#FEFFF5\nsub_font_color_over=#0A1F14\nactive_font=#F0F09E\nmain_font_size=15\nsub_font_size=15\nfont_weight=normal\nfont_weight_over=normal\nmain_align=left\nsub_align=left\ntop_wrap=nowrap\nsub_wrap=nowrap\ntop_font_extra=\nsub_font_extra=\nmain_border_width=3\nmain_border_over_width=0\nsub_border_width=0\nsub_border_over_width=0\nmain_border_style=solid\nmain_border_over_style=none\nsub_border_style=none\nsub_border_over_style=none\nmain_border_color=#17050E\nmain_border_color_over=#F34AFF\nsub_border_color=#061C1B\nsub_border_color_over=#94FFB4\nc_corner_style=curvycorner\nc_corner_size=23\nctl_corner=1\ncbr_corner=1\nt_corner_style=none\nt_corner_size=12\nttl_corner=1\ntbr_corner=1\ns_corner_style=none\ns_corner_size=12\nstl_corner=1\nstr_corner=1\nsbl_corner=1\nsbr_corner=1\nmenustyle=mygosumenu\nmenutype=mainmenu\nparentid=0\nlevels=0\nactive_menu=1\ncssload=0\nhybrid=0\ntables=0\noverlay_hack=1\npadding_hack=0\nauto_position=1\nflash_hack=0\ndisable_jquery=0\ntablet_hack=0\nextra=fade\nspecialB=321\nspecialA=80\npreview_background=#FFFFFF\ntitle=swMenuFree\nborder_hack=0\noption=com_swmenufree\ntmpl=index\ntask=saveedit\nid=108\ntop_font_face=\nsub_font_face=\npreview=dynamic\nexport2=\ndefaultfolder=swmenufree\n');\n");
                $database->query();
            }
        } else {
            $database->setQuery(" CREATE TABLE IF NOT EXISTS #__swmenufree_styles (\n                      `id` int(11) NOT NULL,\n                      `params` text,\n                       PRIMARY KEY (`id`)\n                     ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n                    ");
            $row->message .= "Creating swmenufree_styles table and default style<br />";
            $database->query();
            $database->setQuery("INSERT INTO `#__swmenufree_styles` (`id`, `params`) VALUES\n(1, 'position=left\norientation=vertical/right\nmain_width=0\nmain_height=0\nsub_width=0\nsub_height=0\nmain_top=0\nmain_left=0\nlevel1_sub_top=0\nlevel1_sub_left=0\nlevel2_sub_top=0\nlevel2_sub_left=0\ncomplete_margin_top=8\ncomplete_margin_right=16\ncomplete_margin_bottom=16\ncomplete_margin_left=16\ntop_margin_top=12\ntop_margin_right=0\ntop_margin_bottom=0\ntop_margin_left=0\nmain_pad_top=11\nmain_pad_right=28\nmain_pad_bottom=11\nmain_pad_left=20\nsub_pad_top=9\nsub_pad_right=29\nsub_pad_bottom=10\nsub_pad_left=15\ncomplete_background_image=\ncomplete_background_repeat=repeat\ncomplete_background_position=left top\nactive_background_image=\nactive_background_repeat=repeat\nactive_background_position=left top\nmain_back_image=\ntop_background_repeat=repeat\ntop_background_position=left top\nmain_back_image_over=\ntop_hover_background_repeat=repeat\ntop_hover_background_position=left top\nsub_back_image=\nsub_background_repeat=repeat\nsub_background_position=left top\nsub_back_image_over=\nsub_hover_background_repeat=repeat\nsub_hover_background_position=left top\ncomplete_background=#4E84CC\nactive_background=#942E8D\nmain_back=#0F3322\nmain_over=#163961\nsub_back=#168C9E\nsub_over=#D1FF54\ntop_sub_indicator=images/swmenufree/arrows/whiteleft-on.gif\ntop_sub_indicator_align=right\ntop_sub_indicator_top=0\ntop_sub_indicator_left=13\nsub_sub_indicator=images/swmenufree/arrows/blackleft-on.gif\nsub_sub_indicator_align=right\nsub_sub_indicator_top=0\nsub_sub_indicator_left=13\nfont_family=Times New Roman, Times, serif\nsub_font_family=Times New Roman, Times, serif\ntop_ttf=\nsub_ttf=\nmain_font_color=#EBEFF5\nmain_font_color_over=#E1EBE4\nsub_font_color=#FEFFF5\nsub_font_color_over=#0A1F14\nactive_font=#F0F09E\nmain_font_size=15\nsub_font_size=15\nfont_weight=normal\nfont_weight_over=normal\nmain_align=left\nsub_align=left\ntop_wrap=nowrap\nsub_wrap=nowrap\ntop_font_extra=\nsub_font_extra=\nmain_border_width=3\nmain_border_over_width=0\nsub_border_width=0\nsub_border_over_width=0\nmain_border_style=solid\nmain_border_over_style=none\nsub_border_style=none\nsub_border_over_style=none\nmain_border_color=#17050E\nmain_border_color_over=#F34AFF\nsub_border_color=#061C1B\nsub_border_color_over=#94FFB4\nc_corner_style=curvycorner\nc_corner_size=23\nctl_corner=1\ncbr_corner=1\nt_corner_style=none\nt_corner_size=12\nttl_corner=1\ntbr_corner=1\ns_corner_style=none\ns_corner_size=12\nstl_corner=1\nstr_corner=1\nsbl_corner=1\nsbr_corner=1\nmenustyle=mygosumenu\nmenutype=mainmenu\nparentid=0\nlevels=0\nactive_menu=1\ncssload=0\nhybrid=0\ntables=0\noverlay_hack=1\npadding_hack=0\nauto_position=1\nflash_hack=0\ndisable_jquery=0\ntablet_hack=0\nextra=fade\nspecialB=321\nspecialA=80\npreview_background=#FFFFFF\ntitle=swMenuFree\nborder_hack=0\noption=com_swmenufree\ntmpl=index\ntask=saveedit\nid=108\ntop_font_face=\nsub_font_face=\npreview=dynamic\nexport2=\ndefaultfolder=swmenufree\n');\n");
            $database->query();
        }
    }
    $database->setQuery("SELECT COUNT(*) FROM `#__extensions` WHERE element LIKE '%com_swmenufree%'");
    $com_entries = $database->loadResult();
    if ($com_entries != 1) {
        $row->message .= _SW_UPDATE_LINKS . "<br />";
        //$database->setQuery("DELETE FROM `#__components` WHERE admin_menu_link like '%com_swmenufree%'");
        //$database->query();
        $database->setQuery("INSERT INTO `#__extensions` VALUES ( '', 'swMenuFree', 'component', 'com_swmenufree', '', 0, 1, 0, 0, '{\"legacy\":true,\"name\":\"swMenuFree\",\"type\":\"component\",\"creationDate\":\"06\\/09\\/2010\",\"author\":\"Sean White\",\"copyright\":\"This Component is Proprietry Software\",\"authorEmail\":\"sean@swmenupro.com\",\"authorUrl\":\"http:\\/\\/www.swmenupro.com\",\"version\":\"7.0\",\"description\":\"Joomla 1.5 DHTML Menu Component\",\"group\":\"\"}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0)");
        $database->query();
        $database->setQuery("DELETE FROM `#__menu` WHERE link='index.php?option=com_swmenufree'");
        $database->query();
    }
    $database->setQuery("SELECT COUNT(*) FROM `#__extensions` WHERE element LIKE '%mod_swmenufree%'");
    $com_entries = $database->loadResult();
    if ($com_entries != 1) {
        $row->message .= _SW_UPDATE_LINKS . "<br />";
        //$database->setQuery("DELETE FROM `#__components` WHERE admin_menu_link like '%com_swmenufree%'");
        //$database->query();
        $database->setQuery("INSERT INTO `#__extensions` VALUES('', 'swMenuFree', 'module', 'mod_swmenufree', '', 0, 1, 0, 0, '{\"legacy\":false,\"name\":\"swMenuFree\",\"type\":\"module\",\"creationDate\":\"26\\/01\\/2012\",\"author\":\"Sean White\",\"copyright\":\"This component is copyright www.swmenupro.com\",\"authorEmail\":\"sean@swmenupro.com\",\"authorUrl\":\"http:\\/\\/www.swmenupro.com\",\"version\":\"7.0\",\"description\":\"Joomla\\/Mambo DHTML Menu Component\",\"group\":\"\"}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0)");
        $database->query();
    }
    $database->setQuery("SELECT COUNT(*) FROM `#__menu` WHERE title LIKE '%swMenuFree%' AND client_id='1'");
    $com_entries = $database->loadResult();
    if ($com_entries != 1) {
        $row->message .= _SW_UPDATE_LINKS . "<br />";
        //$database->setQuery("DELETE FROM `#__components` WHERE admin_menu_link like '%com_swmenufree%'");
        //$database->query();
        $database->setQuery("SELECT extension_id FROM `#__extensions` WHERE element LIKE '%com_swmenufree%'");
        $com_id = $database->loadResult();
        $database->setQuery("INSERT INTO `#__menu` VALUES('', 'main', 'swMenuFree', 'swMenuFree', '', 'swMenuFree', 'index.php?option=com_swmenufree', 'component', 0, 1, 1, " . $com_id . ", 0, 0, '0000-00-00 00:00:00', 0, 1, 'components/com_swmenufree/images/swmenupro_icon.png', 0, '', 283, 284, 0, '', 1);");
        $database->query();
    }
    $row->component_version = get_Version($absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml');
    $row->upgrade_version = $row->component_version;
    $xml = @simplexml_load_file('http://swmenupro.com/swmenufree_updates.xml');
    if ($xml) {
        foreach ($xml->update as $update) {
            switch ((string) $update->targetplatform['version']) {
                // Get attributes as element indices
                case substr(JVERSION, 0, 3):
                    if (floatval($update->version) > floatval($row->component_version)) {
                        $row->message .= "swMenuFree " . $update->version . " is available.  Please visit <a href='http://www.swmenupro.com'>swmenupro.com</a> and download the latest swMenuFree " . $update->version . " file.  Then use the upload feature on this page to upload the file and upgrade this copy of swMenuFree.<br />";
                    }
                    break;
            }
        }
    }
    if (file_exists($absolute_path . '/modules/mod_swmenufree/mod_swmenufree.xml')) {
        $row->module_version = get_Version($absolute_path . '/modules/mod_swmenufree/mod_swmenufree.xml');
        $row->new_module_version = get_Version($absolute_path . '/administrator/components/com_swmenufree/module/mod_swmenufree.xml');
        if ($row->module_version < $row->new_module_version) {
            if (copydirr($absolute_path . "/administrator/components/com_swmenufree/module", $absolute_path . "/modules/mod_swmenufree", false)) {
                //  unlink($absolute_path . '/modules/mod_swmenufree/mod_swmenufree.xml');
                //  rename($absolute_path . "/modules/mod_swmenufree/mod_swmenufree.sw", $absolute_path . "/modules/mod_swmenufree/mod_swmenufree.xml");
                $row->message .= _SW_MODULE_SUCCESS . "<br />";
            } else {
                $row->message .= _SW_MODULE_FAIL . "<br />";
            }
        }
    } else {
        mkdir($absolute_path . "/modules/mod_swmenufree");
        if (copydirr($absolute_path . "/administrator/components/com_swmenufree/module", $absolute_path . "/modules/mod_swmenufree", false)) {
            //rename($absolute_path . "/modules/mod_swmenufree/mod_swmenufree.sw", $absolute_path . "/modules/mod_swmenufree/mod_swmenufree.xml");
            $row->message .= _SW_MODULE_SUCCESS . "<br />";
        } else {
            $row->message .= _SW_MODULE_FAIL . "<br />";
        }
    }
    if (file_exists($absolute_path . '/administrator/components/com_swmenufree/admin.swmenufree.php')) {
        unlink($absolute_path . '/administrator/components/com_swmenufree/admin.swmenufree.php');
    }
    if (!is_dir(JPATH_ROOT . '/images/swmenufree')) {
        if (@mkdir(JPATH_ROOT . '/images/swmenufree')) {
            //echo 'Directory created: '.JPATH_ROOT .DS. 'images'.DS.'swmenufree';
        } else {
            $row->message .= '<b>ERROR:</b>cannot create directory ' . JPATH_ROOT . '/images/swmenufree<br />';
        }
        if (copydirr(JPATH_ROOT . '/modules/mod_swmenufree/images', JPATH_ROOT . '/images/swmenufree', false)) {
            //rename($absolute_path."/modules/mod_swmenufree/mod_swmenufree.sw",$absolute_path."/modules/mod_swmenufree/mod_swmenufree.xml");
            $row->message .= "Successfully Installed swmenufree images<br />";
        } else {
            $row->message .= "Could Not Install swMenuFree Images.<br />\n";
        }
    }
    $row->component_version = get_Version($absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml');
    $row->module_version = get_Version($absolute_path . '/modules/mod_swmenufree/mod_swmenufree.xml');
    $langfile = "english.php";
    if (file_exists($absolute_path . '/administrator/components/com_swmenufree/language/default.ini')) {
        $filename = $absolute_path . '/administrator/components/com_swmenufree/language/default.ini';
        $handle = fopen($filename, "r");
        $langfile = fread($handle, filesize($filename));
        fclose($handle);
    }
    $basedir = $absolute_path . "/administrator/components/com_swmenufree/language/";
    $handle = opendir($basedir);
    $lang = array();
    $lists = array();
    while ($file = readdir($handle)) {
        if ($file == "." || $file == ".." || $file == "default.ini") {
        } else {
            $lang[] = JHTML::_('select.option', $file, $file);
        }
        $lists['langfiles'] = JHTML::_('select.genericlist', $lang, 'language', 'id="language" class="inputbox" size="1" style="width:200px"', 'value', 'text', $langfile);
    }
    closedir($handle);
    HTML_swmenufree::upgradeForm($row, $lists);
    HTML_swmenufree::footer();
}
Example #4
0
 function getQueryData()
 {
     $query = JRequest::getString('ja_query', '', 'get');
     if (!empty($query)) {
         $data = new stdClass();
         $data->id = 0;
         $data->title = '';
         $data->query = base64_decode($query);
     } else {
         $cid = JRequest::getVar('cid', array(0), 'method', 'array');
         $id = $cid[0];
         $data =& JTable::getInstance('Query', 'Table');
         $data->load($id);
         $data->query = base64_decode($data->query);
     }
     return $data;
 }
Example #5
0
 /**
  * Add comment to the stream
  *
  * @param int	$actid acitivity id
  * @param string $comment
  * @return obj
  */
 public function ajaxStreamAddComment($actid, $comment)
 {
     $filter = JFilterInput::getInstance();
     $actid = $filter->clean($actid, 'int');
     $comment = $filter->clean($comment, 'string');
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $objResponse = new JAXResponse();
     $wallModel = CFactory::getModel('wall');
     CFactory::load('libraries', 'wall');
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'friends');
     CFactory::load('helper', 'owner');
     // Pull the activity record and find out the actor
     // only allow comment if the actor is a friend of current user
     $act =& JTable::getInstance('Activity', 'CTable');
     $act->load($actid);
     //who can add comment
     $obj = new stdClass();
     if ($act->groupid > 0) {
         $obj =& JTable::getInstance('Group', 'CTable');
         $obj->load($act->groupid);
     } else {
         if ($act->eventid > 0) {
             $obj =& JTable::getInstance('Event', 'CTable');
             $obj->load($act->eventid);
         }
     }
     if ($my->authorise('community.add', 'activities.comment.' . $act->actor, $obj)) {
         $table =& JTable::getInstance('Wall', 'CTable');
         $table->type = $act->comment_type;
         $table->contentid = $act->comment_id;
         $table->post_by = $my->id;
         $table->comment = $comment;
         $table->store();
         $cache = CFactory::getFastCache();
         $cache->clean(array('activities'));
         $comment = CWall::formatComment($table);
         $objResponse->addScriptCall('joms.miniwall.insert', $actid, $comment);
     } else {
         // Cannot comment on non-friend stream.
         $objResponse->addAlert('Permission denied');
     }
     return $objResponse->sendResponse();
 }