function saveItemPrices($d, $commissionType) { $db = $this->getDbo(); $params = new JRegistry(); //load old params, so params for other commission types does not get overwritten $params->loadINI($this->loadPricingObject()->params, null, true); $params->set($commissionType . '.default_price', JArrayHelper::getValue($d, 'default_price')); $params->set($commissionType . '.price_powerseller', JArrayHelper::getValue($d, 'price_powerseller')); $params->set($commissionType . '.price_verified', JArrayHelper::getValue($d, 'price_verified')); $params->set($commissionType . '.category_pricing_enabled', JArrayHelper::getValue($d, 'category_pricing_enabled')); $email_text = base64_encode(JArrayHelper::getValue($d, 'email_text')); $params->set($commissionType . '.email_text', $email_text); $p = $params->toString('INI'); $db->setQuery("update `#__" . APP_PREFIX . "_pricing`\r\n set `params`='{$p}'\r\n where `itemname`='{$this->name}'"); $db->query(); $db->setQuery("delete from `#__" . APP_PREFIX . "_pricing_categories` where `itemname`='" . $commissionType . '.' . $this->name . "'"); $db->query(); $category_pricing = JArrayHelper::getValue($d, 'category_pricing', array(), 'array'); foreach ($category_pricing as $k => $v) { if (!empty($v) || $v === '0') { $db->setQuery("insert into `#__" . APP_PREFIX . "_pricing_categories` (`category`,`price`,`itemname`) values ('{$k}','{$v}','" . $commissionType . '.' . $this->name . "')"); $db->query(); } } }
function installMessage() { $db =& JFactory::getDBO(); $lang =& JFactory::getLanguage(); $currentlang = $lang->getTag(); $objectReadxmlDetail = new JSNISReadXmlDetails(); $infoXmlDetail = $objectReadxmlDetail->parserXMLDetails(); $langSupport = $infoXmlDetail['langs']; $registry = new JRegistry(); $newStrings = array(); $path = null; $realLang = null; $queries = array(); if (array_key_exists($currentlang, $langSupport)) { $path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang); $realLang = $currentlang; } else { $filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language'; $foldersLang = $this->getFolder($filepath); foreach ($foldersLang as $value) { if (in_array($value, $langSupport) == true) { $path = JLanguage::getLanguagePath(JPATH_BASE, $value); $realLang = $value; break; } } } $filename = $path . DS . $realLang . '.com_imageshow.ini'; $content = @file_get_contents($filename); if ($content) { $registry->loadINI($content); $newStrings = $registry->toArray(); if (count($newStrings)) { if (count($infoXmlDetail['menu'])) { $queries[] = 'TRUNCATE TABLE `#__imageshow_messages`'; foreach ($infoXmlDetail['menu'] as $value) { $index = 1; while (isset($newStrings['MESSAGE ' . $value . ' ' . $index . ' PRIMARY'])) { $queries[] = 'INSERT INTO `#__imageshow_messages` (`msg_id`,`msg_screen`,`published`,`ordering`) VALUES (NULL, "' . $value . '", 1, ' . $index . ')'; $index++; } } } } if (count($queries)) { foreach ($queries as $query) { $query = trim($query); if ($query != '') { $db->setQuery($query); $db->query(); } } } } return true; }
/** * Parses "plugins.list" files and loads all plugins listed there * * @access public * @return bool true on success , false on failure */ function loadPlugins() { $pluginPath = JWF_BACKEND_PATH . DS . 'plugins' . DS . 'field_handlers' . DS; $registry = new JRegistry(); $registry->loadINI(file_get_contents($pluginPath . 'plugins.list')); $plugins = $registry->toArray(); include_once $pluginPath . 'base.php'; foreach ($plugins as $id => $pluginName) { $this->_loadPlugin($id, $pluginName); } return true; }
function getParams($ini, $path = '') { $xml = $this->_getXML($path); if (!$ini) { return $this->_arrayToObject($xml); } $registry = new JRegistry(); $registry->loadINI($ini); $params = $registry->toArray(); unset($registry); if (!empty($xml)) { $params = array_merge($xml, $params); } return $this->_arrayToObject($params); }
public function save() { $data = self::$registry->toString('INI'); $db =& JFactory::getDBO(); // An interesting discovery: if your component is manually updating its // component parameters before Live Update is called, then calling Live // Update will reset the modified component parameters because // JComponentHelper::getComponent() returns the old, cached version of // them. So, we have to forget the following code and shoot ourselves in // the feet. Dammit!!! /* jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); $component =& JComponentHelper::getComponent(self::$component); $params = new JParameter($component->params); $params->setValue(self::$key, $data); */ if (version_compare(JVERSION, '1.6.0', 'ge')) { $sql = $db->getQuery(true)->select($db->nq('params'))->from($db->nq('#__extensions'))->where($db->nq('type') . ' = ' . $db->q('component'))->where($db->nq('element') . ' = ' . $db->q(self::$component)); } else { $sql = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__components') . ' WHERE ' . $db->nameQuote('option') . ' = ' . $db->Quote(self::$component) . " AND `parent` = 0 AND `menuid` = 0"; } $db->setQuery($sql); $rawparams = $db->loadResult(); $params = new JRegistry(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $params->loadJSON($rawparams); } else { $params->loadINI($rawparams); } $params->setValue(self::$key, $data); if (version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.6 $data = $params->toString('JSON'); $sql = $db->getQuery(true)->update($db->nq('#__extensions'))->set($db->nq('params') . ' = ' . $db->q($data))->where($db->nq('type') . ' = ' . $db->q('component'))->where($db->nq('element') . ' = ' . $db->q(self::$component)); } else { // Joomla! 1.5 $data = $params->toString('INI'); $sql = 'UPDATE `#__components` SET `params` = ' . $db->Quote($data) . ' WHERE ' . "`option` = " . $db->Quote(self::$component) . " AND `parent` = 0 AND `menuid` = 0"; } $db->setQuery($sql); $db->query(); }
function getParams($ini, $path = '') { $xml = $this->_getXML($path); if (!$ini) { return (object) $xml; } if (!is_object($ini)) { $registry = new JRegistry(); $registry->loadINI($ini); $params = $registry->toObject(); } else { $params = $ini; } if (!empty($xml)) { foreach ($xml as $key => $val) { if (!isset($params->{$key}) || $params->{$key} == '') { $params->{$key} = $val; } } } return $params; }
function getForm($formname) { global $mainframe; $database =& JFactory::getDBO(); if (!trim($formname)) { if (JRequest::getVar('chronoformname')) { JRequest::setVar('chronoformname', preg_replace('/[^A-Za-z0-9_]/', '', JRequest::getVar('chronoformname'))); } $formname = JRequest::getVar('chronoformname'); if (!$formname) { $params =& $mainframe->getPageParameters('com_chronocontact'); $formname = preg_replace('/[^A-Za-z0-9_]/', '', $params->get('formname')); } } $query = "SELECT * FROM `#__chrono_contact` WHERE `name` = '" . $formname . "'"; $database->setQuery($query); $cf_rows = $database->loadObjectList(); if (count($cf_rows)) { $this->formrow = $cf_rows[0]; $this->formname = "ChronoContact_" . $this->formrow->name; //load titles $registry = new JRegistry(); $registry->loadINI($cf_rows[0]->titlesall); $titlesvalues = $registry->toObject(); //load params $paramsvalues = new JParameter($this->formrow->paramsall); $this->formparams = $paramsvalues; return true; } else { $emptyForm = new StdClass(); $emptyForm->id = 0; $emptyForm->name = ''; $this->formrow = $emptyForm; $paramsvalues = new JParameter(''); $this->formparams = $paramsvalues; return false; } }
/** * Legacy function, deprecated * * @deprecated As of version 1.5 */ function MenuSelect($name = 'menuselect', $javascript = NULL) { $db =& JFactory::getDBO(); $query = 'SELECT params' . ' FROM #__modules' . ' WHERE module = "mod_mainmenu"'; $db->setQuery($query); $menus = $db->loadObjectList(); $total = count($menus); $menuselect = array(); $usedmenus = array(); for ($i = 0; $i < $total; $i++) { $registry = new JRegistry(); $registry->loadINI($menus[$i]->params); $params = $registry->toObject(); if (!in_array($params->menutype, $usedmenus)) { $menuselect[$i]->value = $params->menutype; $menuselect[$i]->text = $params->menutype; $usedmenus[] = $params->menutype; } } // sort array of objects JArrayHelper::sortObjects($menuselect, 'text', 1); $menus = JHTML::_('select.genericlist', $menuselect, $name, 'class="inputbox" size="10" ' . $javascript, 'value', 'text'); return $menus; }
if (!empty($processform)) { foreach ($processform as $key => $value) { $processform[$key] = RemoveXSS($processform[$key]); } } $GLOBALS['formeConfig'] = buildFormeConfig(); $database =& JFactory::getDBO(); //get fid $fid = JRequest::getVar('fid', '', 'GET', 'string', ''); if (!$fid) { $query = "\r\n SELECT params\r\n FROM #__menu\r\n WHERE id='" . $_GET['Itemid'] . "' AND type='component'"; $database->setQuery($query); $menurow = $database->loadResult(); if ($menurow) { $registry = new JRegistry(); $registry->loadINI($menurow); $configs = $registry->toObject(); $fid = $configs->fid; } } require_once dirname(__FILE__) . '/../../plugins/system/legacy/functions.php'; switch ($func) { case 'thankyou': thankyou($option, $did); break; case 'captcha': genCaptcha(); break; case 'test': test(); break;
/** * Loads a language file and returns the parsed values * * @access private * @param string The name of the file * @return mixed Array of parsed values if successful, boolean False if failed */ function _load($filename) { if ($content = @file_get_contents($filename)) { if ($this->_identifyer === null) { $this->_identifyer = basename($filename, '.ini'); } $registry = new JRegistry(); $registry->loadINI($content); return $registry->toArray(); } return false; }
/** * Refesh all messages * * @return true. */ public function refreshMessage() { $db = JFactory::getDBO(); $lang = JFactory::getLanguage(); $currentlang = $lang->getTag(); $objectReadxmlDetail = JSNISFactory::getObj('classes.jsn_is_readxmldetails'); $objJNSUtils = JSNISFactory::getObj('classes.jsn_is_utils'); $infoXmlDetail = $objectReadxmlDetail->parserXMLDetails(); $langSupport = $infoXmlDetail['langs']; $registry = new JRegistry(); $newStrings = array(); $path = null; $realLang = null; $queries = array(); $pathEn = JLanguage::getLanguagePath(JPATH_BASE, 'en-GB'); if (array_key_exists($currentlang, $langSupport)) { $path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang); $realLang = $currentlang; } else { if (!JFolder::exists($pathEn)) { $filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language'; $foldersLang = $this->getFolder($filepath); foreach ($foldersLang as $value) { if (in_array($value, $langSupport)) { $path = JLanguage::getLanguagePath(JPATH_BASE, $value); $realLang = $value; break; } } } } if (JFolder::exists($pathEn)) { $filename = $pathEn . DS . 'en-GB' . '.com_imageshow.ini'; } else { $filename = $path . DS . $realLang . '.com_imageshow.ini'; } $content = $objJNSUtils->readFileToString($filename); if ($content) { $registry->loadINI($content); $newStrings = $registry->toArray(); if (count($newStrings)) { if (count($infoXmlDetail['menu'])) { $queries[] = 'TRUNCATE TABLE #__jsn_imageshow_messages'; foreach ($infoXmlDetail['menu'] as $value) { $index = 1; while (isset($newStrings['MESSAGE_' . $value . '_' . $index . '_PRIMARY'])) { $queries[] = 'INSERT INTO #__jsn_imageshow_messages (msg_screen, published, ordering) VALUES (\'' . $value . '\', 1, ' . $index . ')'; $index++; } } } } if (count($queries)) { foreach ($queries as $query) { $query = trim($query); if ($query != '') { $db->setQuery($query); $db->query(); } } } } return true; }
// $_SESSION['templateName'], $data[3] ); $dataAll = iland4_layDanhSachBDS($dbConfig, $returnField, $conditionParam, $currentPage, $limit, $ordering, $language); $data = $dataAll[3]; $templatePath = $_GET['template_path']; $templateName = $_GET['template_name']; include $templatePath . DS . $templateName . '.php'; } else { if ($task == 'dsbds') { // load tieu de theo language $lang = 'vi-VN'; $path = JLanguage::getLanguagePath(JPATH_BASE, $lang); $filename = 'vi-VN.mod_danh_sach_BDS.ini'; $filename = $path . DS . $filename; $content = @file_get_contents($filename); $registry = new JRegistry(); $registry->loadINI($content); $titleStrings = $registry->toArray(); //$currentPage = 1; $condition = $_GET['condition']; if (!empty($_GET['page'])) { $currentPage = $_GET['page']; } //if ( ) //$limit = $_GET['limit']; $limit = 1000000000; $price[] = array(); $price['price_min'] = 0; $price['price_max'] = 0; //$price['price_min']=$_GET['price_min']; //$price['price_max']=$_GET['price_max']; $returnField = $_GET['returnField'];
function showModules(&$rows, $option, $pageNav, $lists, $menus) { global $mainframe, $Itemid; $absolute_path = JPATH_ROOT; $live_site = $mainframe->getCfg('live_site'); ?> <script type="text/javascript"> <!-- function moduledelete(title,id){ if (confirm("<?php echo _SW_DELETE_MODULE_NOTICE; ?> " + title +"?")){ form=document.adminForm; num="cb"+id; form.task.value="remove"; form.id.value=id; setTimeout('form.submit()',200) ; } } function newstyle(){ form=document.adminForm; form.task.value="editDhtmlMenu"; if(form.menutype.value==-999){ alert("<?php echo _SW_NO_MENU_NOTICE; ?> "); }else{ //form.menuname.value=title; form.newmenu.value="1"; form.id.value="0"; setTimeout('form.submit()',200) ; } } function doSystemPopup(){ window.open('components/com_swmenupro/menu_systems.php', 'win1', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=780,height=550,directories=no,location=no'); } function doPreviewWindow(id) { form=document.adminForm; form.no_html.value=1; form.id.value=id; form.target="win1"; form.action="index2.php"; form.task.value="preview"; window.open('', 'win1', 'status=no,toolbar=no,scrollbars=auto,titlebar=no,menubar=no,resizable=yes,width=600,height=500,directories=no,location=no'); setTimeout('form.submit()',200) ; setTimeout('form.target="_self"',300); setTimeout('form.action="index.php"',300); setTimeout('form.no_html.value=0',300); setTimeout('form.task.value="showmodules"',300); } --> </script> <link rel="stylesheet" href="components/com_swmenupro/css/swmenupro.css" type="text/css" /> <div class="swmenu_container" > <form action="index.php" method="POST" name="adminForm"> <table align="left" cellpadding="4" cellspacing="4" border="0" width="750"> <tr> <td width="10%"><img src="components/com_swmenupro/images/swmenupro_logo_small.gif" align="left" border="0"/></td> <td valign="bottom"><span class="swmenu_sectionname"><?php echo _SW_MENU_MODULE_MANAGER; ?> </span> </td> <td valign="top" > <ul> <li> <a href="index.php?option=com_swmenupro&task=upgrade" ><?php echo _SW_UPGRADE_LINK; ?> </a> </li> </ul> </td> </tr> </table> <div style="clear:both;"></div> <table align="left" cellpadding="0" cellspacing="0" border="0" width="760" > <tr><td width="520" valign="top"> <table cellpadding="2" cellspacing="0" border="0" width="99%" align="left"> <tr><td colspan="7" class="swmenu_tabheading"># <?php echo _SW_MENU_MODULES; ?> </td> </tr> <?php if (!file_exists($absolute_path . "/modules/mod_swmenupro/mod_swmenupro.php")) { echo "<tr><td><b>" . _SW_NO_MODULE_NOTICE . "</td></tr></b>"; } else { if (!count($rows)) { echo "<tr><td><b>" . _SW_MAKE_MODULE_NOTICE . "</td></tr></b>"; } } $k = 0; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row =& $rows[$i]; $registry = new JRegistry(); $registry->loadINI($row->params); $params = $registry->toObject(); $menutype = @$params->menutype ? $params->menutype : 'mainmenu'; $moduletype = @$params->menustyle ? $params->menustyle : 'mambo standard'; ?> <tr class="swmenu_row<?php echo $k; ?> "> <td width="10"><?php echo $i + $pageNav->limitstart + 1; ?> </td> <td width="10"><input type="checkbox" id="cb<?php echo $i; ?> " name="cid[]" value="<?php echo $row->id; ?> " /></td> <td width="160"><div align="left"> <a href="#edit" onmouseover="this.T_WIDTH=180;return escape('<?php echo sprintf(_SW_MODULE_TIP, $moduletype, $menutype, $row->position, $row->groupname, $row->published ? _SW_YES : _SW_NO); ?> ')" onclick="return listItemTask('cb<?php echo $i; ?> ','editDhtmlMenu')"><?php echo $row->title; ?> </a></div></td> <td align="right"> <?php echo "<a href=\"javascript: void(0);\" class=\"swmenu_button_edit\" onmouseover=\"return escape('" . sprintf(_SW_EDIT_MODULE_TIP, addslashes($row->title)) . "')\" onclick=\"return listItemTask('cb" . $i . "','editDhtmlMenu')\">" . _SW_EDIT_BUTTON . "</a></td><td>\n"; if (file_exists($absolute_path . "/modules/mod_swmenupro/styles/menu" . $row->id . ".css")) { echo "<a href=\"javascript: void(0);\" class=\"swmenu_button_editCSS\" onmouseover=\"this.T_WIDTH=120;return escape('" . sprintf(_SW_EDIT_CSS_TIP, addslashes($row->title)) . "')\" onclick=\"return listItemTask('cb" . $i . "','editCSS')\">" . _SW_EDITCSS_BUTTON . "</a></td><td>"; } else { echo "<a href=\"javascript: void(0);\" class=\"swmenu_button_export\" onmouseover=\"this.T_WIDTH=120;return escape('" . sprintf(_SW_EXPORT_MODULE_TIP, addslashes($row->title)) . "')\" onclick=\"return listItemTask('cb" . $i . "','exportMenu')\">" . _SW_EXPORT_BUTTON . "</a></td><td>"; } // echo "<a href=\"javascript: void(0);\" class=\"swmenu_button_images\" onmouseover=\"return escape('".sprintf (_SW_EDIT_IMAGES_TIP,addslashes($row->title))."')\" onclick=\"return listItemTask('cb".$i."','editImages')\">"._SW_IMAGES_BUTTON."</a></td><td>\n"; echo "<a href=\"javascript: void(0);\" class=\"swmenu_button_preview\" onmouseover=\"return escape('" . sprintf(_SW_PREVIEW_MODULE_TIP, addslashes($row->title)) . "')\" onclick=\"doPreviewWindow('" . $row->id . "')\">" . _SW_PREVIEW_BUTTON . "</a></td><td>\n"; echo "<a href=\"javascript: void(0);\" class=\"swmenu_button_delete\" onmouseover=\"return escape('" . sprintf(_SW_DELETE_MODULE_TIP, addslashes($row->title)) . "')\" onclick=\"moduledelete('" . $row->title . "','" . $row->id . "')\">" . _SW_DELETE_BUTTON . "</a>\n"; ?> </td> </tr> <?php $k = 1 - $k; } ?> <tr> <td class="swmenu_pagination" align="right" colspan="7" > <?php echo $pageNav->getListFooter(); ?> </td> </tr> </table> </td><td width="230" valign="top"> <table cellpadding="0" width="100%" cellspacing="0" class="swmenu_table" border="0"> <tr><td colspan="2" class="swmenu_tabheading"><?php echo _SW_CREATE_MODULE; ?> </td></tr> <tr><td colspan="2" align="center"><br /> <a href="javascript:void(0);" onmouseover="return escape('<?php echo _SW_MENU_SYSTEM_INFO_TIP; ?> ')" onclick="doSystemPopup();"> <img src="components/com_swmenupro/images/info.png" alt="info" align="middle" name="info" border="0" /></a> <?php echo $lists['menutype']; ?> <br /> </td></tr><tr><td style="padding-left:24px;padding-top:10px;" colspan="2"><input type="radio" id="default" name="action2" value="new" onClick="document.getElementById('indexsite2').style.display='none';" checked> <label for="default"><?php echo _SW_USE_DEFAULT_MODULE; ?> </label> </td></tr><tr><td style="padding-left:24px;padding-bottom:10px;" colspan="2"><input type="radio" name="action2" value="index" onClick="document.getElementById('indexsite2').style.display='block';" id="copy"> <label for="copy"><?php echo _SW_COPY_MODULE; ?> </label> </td></tr><tr><td colspan="2" align="center" > <table id="indexsite2" style="display:none"> <tr><td> <a href="javascript:void(0);" onmouseover="return escape('<?php echo _SW_COPY_STYLE_TIP; ?> ')" > <img src="components/com_swmenupro/images/info.png" alt="info" align="middle" name="info" border="0" /></a> <?php echo $lists['menustyle']; ?> </td></tr><tr> <td style="padding-left:10px;padding-bottom:15px;"> <input type="checkbox" id="copyCSS" name="copyCSS" checked> <label for="copyCSS"> <?php echo _SW_COPY_IMAGES; ?> </label> </td></tr></table> </td> </tr> <tr><td colspan="2" align="center"><a href="javascript:void(0);" onmouseover="return escape('<?php echo _SW_CREATE_MENU_TIP; ?> ')" class="swmenu_button_wide_create" onclick="newstyle();" /><?php echo _SW_CREATE_BUTTON; ?> </a> </td></tr></table> </td></tr></table> <input type="hidden" name="option" value="com_swmenupro" /> <input type="hidden" name="task" value="showmodules" /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="do" value="1" /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="boxchecked" value="" /> <input type="hidden" name="id" value="0" /> <input type="hidden" name="menuname" value="" /> <input type="hidden" name="preview" value="2" /> <input type="hidden" name="newmenu" value="0" /> <input type="hidden" name="copymenu" value="0" /> <input type="hidden" name="no_html" id="no_html" value="0" /> </form> </div> <br /> <div style="clear:both;"></div> <script type="text/javascript" src="components/com_swmenupro/js/wz_tooltip.js"></script> <?php }
/** * Performs a check to see if a job is due to be executed * * @access public * @return void */ function check() { if (!file_exists(JWF_CRON_CRONTAB)) { return; } $cronJobs = new JRegistry(); $cronJobs->loadINI(JFile::read(JWF_CRON_CRONTAB)); $jobsArray = $cronJobs->toArray(); $jobsDone = 0; foreach ($jobsArray as $jobName => $jobFrequency) { $seconds = JWFCronJobManager::getTimeUnit('s', $jobFrequency); $minutes = JWFCronJobManager::getTimeUnit('m', $jobFrequency); $hours = JWFCronJobManager::getTimeUnit('h', $jobFrequency); $days = JWFCronJobManager::getTimeUnit('d', $jobFrequency); $weeks = JWFCronJobManager::getTimeUnit('w', $jobFrequency); $frequency = $seconds + $minutes * 60 + $hours * 3600 + $days * 86400 + $weeks * 604800; $lastExecuteTime = JWFCronJobManager::getLastExecuteTime($jobName); $nextExecuteTime = $lastExecuteTime + $frequency; $doneEnoughJobs = $jobsDone >= JWF_CRON_MAXJOBPERCYCLE; if (($lastExecuteTime == 0 || $nextExecuteTime <= time()) && !$doneEnoughJobs && JWF_CRON_MAXJOBPERCYCLE != 0) { JWFCronJobManager::setLastExecuteTime($jobName); call_user_func($jobName); $jobsDone++; } } }
/** * Loads a single plugin from XML file including language files * * @access private * @param string $id identification name of the plugin ,see plugins.list for more information * @param string $name title of the plugin * @return bool true on success , false on failure */ function _loadPlugin($id, $name) { $plugin = new stdClass(); $plugin->id = $id; $plugin->name = $name; $componentPluginsPath = JWF_BACKEND_PATH . DS . 'plugins' . DS . 'component_handlers' . DS; $plugin->php = $componentPluginsPath . $id . DS . $id . '.php'; $registry = new JRegistry(); $registry->loadINI(file_get_contents($componentPluginsPath . $id . DS . $id . '.ini')); $params = $registry->toArray(); $plugin->trigger = $params['Trigger']; $this->loadedPlugins[$id] = $plugin; //Load language files $lang =& JFactory::getLanguage(); $lang->load('component.' . ucfirst($id), JWF_BACKEND_PATH, null, false); return true; }
public function migratePostContentType() { jimport('joomla.registry.registry'); $db = self::getDbo(); $query = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__discuss_configs'); $query .= ' WHERE ' . $db->nameQuote('name') . '=' . $db->Quote('config'); $db->setQuery($query); $rawParams = $db->loadResult(); if (empty($rawParams)) { return true; } $config = new JRegistry(); $editorType = ''; if ($this->getJoomlaVersion() >= '1.6') { $config->loadString($rawParams, 'INI'); $editorType = $config->get('layout_editor', ''); } else { $config->loadINI($rawParams); $editorType = $config->getValue('layout_editor', ''); } if ($editorType == 'bbcode') { $query = 'update `#__discuss_posts` set `content_type` = ' . $db->Quote('bbcode'); $query .= ' where `content_type` is null'; $db->setQuery($query); $db->query(); } else { // replies $query = 'update `#__discuss_posts` set `content_type` = ' . $db->Quote('bbcode'); $query .= ' where `content_type` is null'; $query .= ' and `parent_id` > 0'; $db->setQuery($query); $db->query(); // question $query = 'update `#__discuss_posts` set `content_type` = ' . $db->Quote('html'); $query .= ' where `content_type` is null'; $query .= ' and `parent_id` = 0'; $db->setQuery($query); $db->query(); } }
public static function resetSetting($setting) { if (empty($setting)) { return false; } jimport('joomla.registry.registry'); $reg = new JRegistry(); $setting = self::settingsLocation($setting); if ($setting) { $setting = JFile::read($setting); $reg->loadINI($setting); plgSystemJBetolo::param('', $reg, 'set'); return true; } return false; }
/** * Get version information * @return $html **/ function getVersionInfo($getData = false) { global $option; $url = 'http://dev.jyaml.de/JYAML.GET/version.ini'; $read_online = false; $info['c-j-version'] = '?'; $info['c-j-build'] = '?'; $jc_version = ''; $j_version = ''; $html = ''; $data = false; $allow_url_fopen = ini_get('allow_url_fopen'); if (!@fsockopen('dev.jyaml.de', 80) || !$allow_url_fopen) { $read_online = false; $html .= '<div class="off">' . JText::_('YAML VERSION NOT AVAILABLE') . '</div> '; if (!$allow_url_fopen) { $html .= '<div class="off">' . JText::_('YAML OPEN EXTERNAL URL NOT ALLOWED') . '</div> '; } $html .= '<br />'; } else { $data = JFile::read($url); $read_online = true; } if ($data) { $registry = new JRegistry($option); $registry->loadINI($data); // get current version info $info['c-j-version'] = $registry->getValue($option . '.YAML JOOMLA VERSION'); $info['c-j-build'] = $registry->getValue($option . '.YAML JOOMLA BUILD'); } // Installed component version $xml =& JFactory::getXMLParser('Simple'); if (!$xml->loadFile(JPATH_BASE . DS . 'components' . DS . $option . DS . substr($option, 4) . '.xml')) { unset($xml); } else { $element =& $xml->document->version[0]; $info['i-j-version'] = $element ? $element->data() : ''; $element =& $xml->document->build[0]; $info['i-j-build'] = $element ? $element->data() : ''; } $update = false; if ($info['c-j-version'] . $info['c-j-build'] > $info['i-j-version'] . $info['i-j-build']) { $j_version = '<span class="off" style="font-weight:normal;">' . $info['i-j-version'] . '(Build: ' . $info['i-j-build'] . ')</span>'; $jc_version = '<span class="on" style="font-weight:bold;">' . $info['c-j-version'] . '(Build: ' . $info['c-j-build'] . ')</span>'; $update = true; } else { $j_version = '<span>' . $info['i-j-version'] . '(Build: ' . $info['i-j-build'] . ')</span>'; $jc_version = '<span>' . $info['c-j-version'] . '(Build: ' . $info['c-j-build'] . ')</span>'; } if ($info['i-j-version']) { $html .= JText::_('YAML JOOMLA VERSION INSTALLED') . ': ' . $j_version . '<br />'; } else { $html .= JText::_('YAML JOOMLA VERSION INSTALLED') . ': (SVN Version)<br />'; } $html .= JText::_('YAML JOOMLA VERSION CURRENT') . ': ' . $jc_version . '<br /><br />'; if ($update && $info['i-j-version']) { $bar =& new JToolBar('My ToolBar'); $button =& $bar->loadButtonType('Custom'); $url = 'index3.php?option=' . $option . '&controller=update&task=make_update'; $link = "<a class=\"modal\" href=\"{$url}\" rel=\"{closeWithOverlay:false, handler: 'iframe', size: {x: 640, y: 480}}\">\n"; $link .= JText::_('YAML UPDATE BUTTON'); $link .= "</a>\n"; $html .= '<p id="make_update">' . $button->fetchButton('Custom', $link, 'editfile') . '</p>'; } if ($getData) { return $info; } else { return $html; } }
/** * Stores a Workflow to database * * @access public * @param object $data Workflow Data to be saved * @return int ID of the newly saved workflow on success , 0 on failure */ function save($data) { $user =& JFactory::getUser(); $db =& JFactory::getDBO(); $row =& JTable::getInstance('Workflow', 'Table'); $nullDate = $db->getNullDate(); if (!$row->bind($data)) { JError::raiseError(500, $db->stderr()); return 0; } $row->id = intval($row->id); JArrayHelper::toInteger($data['category']); $row->category = implode(',', $data['category']); $newEntry = $row->id ? false : true; //Copied directly from com_content saveContent() // Are we saving from an item edit? if (!$newEntry) { $datenow =& JFactory::getDate(); $row->modified = $datenow->toMySQL(); $row->modified_by = $user->get('id'); } $row->created_by = $row->created_by ? $row->created_by : $user->get('id'); if ($row->created && strlen(trim($row->created)) <= 10) { $row->created .= ' 00:00:00'; } $config =& JFactory::getConfig(); $tzoffset = $config->getValue('config.offset'); $date =& JFactory::getDate($row->created, $tzoffset); $row->created = $date->toMySQL(); if (strlen(trim($row->publish_up)) == 0) { $date =& JFactory::getDate(1, $tzoffset); } else { $row->publish_up .= ' 00:00:00'; $date =& JFactory::getDate($row->publish_up, $tzoffset); } $row->publish_up = $date->toMySQL(); // Handle never unpublish date if (trim($row->publish_down) == JText::_('Never') || trim($row->publish_down) == '') { $row->publish_down = $nullDate; } else { if (strlen(trim($row->publish_down)) <= 10) { $row->publish_down .= ' 00:00:00'; } $date =& JFactory::getDate($row->publish_down, $tzoffset); $row->publish_down = $date->toMySQL(); } // Make sure the data is valid if (!$row->check()) { JError::raiseError(500, $db->stderr()); } // Store the content to the database if (!$row->store()) { JError::raiseError(500, $db->stderr()); } // Check the form $row->checkin(); //End of faithful copy if ($newEntry) { $row->id = lastInsertId(); } if (!$newEntry) { //Delete stations of this workflow $db->setQuery('DELETE FROM #__jwf_stations WHERE wid=' . $row->id); if (!$db->query()) { JError::raiseError(500, $db->getErrorMsg()); } } $queriesNewId = array(); $queriesOldId = array(); foreach ($data['stations'] as $station) { $wid = intval($row->id); $title = $db->getEscaped($station->title, true); $task = $db->getEscaped($station->task, true); $allocatedTime = intval($station->allocatedTime); $group = intval($station->acl->id); $fields = $db->getEscaped($station->fields, true); $hooks = $station->activeHooks; $validations = $db->getEscaped($station->activeValidations, true); $order = intval($station->order); if ($station->id == null) { $queriesNewId[] = "({$wid}, '{$title}', '{$task}', {$allocatedTime}, {$group}, '{$fields}' , '{$hooks}', '{$validations}', {$order})"; } else { $queriesOldId[] = "({$station->id}, {$wid}, '{$title}', '{$task}', {$allocatedTime}, {$group}, '{$fields}', '{$hooks}', '{$validations}', {$order})"; } } if (count($queriesNewId)) { $sqlNewIds = implode(',', $queriesNewId); $sqlNewIds = 'INSERT INTO `#__jwf_stations` (`wid`,`title`,`task`,`allocatedTime`,`group`,`fields`, `activeHooks`, `activeValidations`, `order`) VALUES ' . $sqlNewIds; $db->setQuery($sqlNewIds); if (!$db->query()) { JError::raiseError(500, $db->getErrorMsg()); } } if (count($queriesOldId)) { $sqlOldIds = implode(',', $queriesOldId); $sqlOldIds = 'INSERT INTO `#__jwf_stations` (`id`,`wid`,`title`,`task`,`allocatedTime`,`group`,`fields`,`activeHooks`, `activeValidations`, `order`) VALUES ' . $sqlOldIds; $db->setQuery($sqlOldIds); if (!$db->query()) { JError::raiseError(500, $db->getErrorMsg()); } } //Update trigger cache $pManager =& getPluginManager(); $pManager->loadPlugins('component'); $plugins = $pManager->settings['component']; $trigger = $plugins[$row->component]->trigger; $category = $row->category; $component = $row->component; $triggerDataPath = JWF_FS_PATH . DS . 'triggerCache.ini'; $triggerCacheData = new JRegistry(); $triggerCacheData->loadINI(file_get_contents($triggerDataPath)); $triggerCacheData->setValue($row->id, $trigger . '-' . $component . '-' . $category); file_put_contents($triggerDataPath, $triggerCacheData->toString('INI')); return $row->id; }
/** * gets the javascript actions the forms elements * @return array of javascript actions */ function getJsActions() { $db =& JFactory::getDBO(); $j = new JRegistry(); $aJsActions = array(); $aElIds = array(); $groups =& $this->getGroupsHiarachy(); foreach ($groups as $groupModel) { $elementModels =& $groupModel->getPublishedElements(); foreach ($elementModels as $elementModel) { // $$$ hugh - only needed getParent when we weren't saving changes to parent params to child // which we should now be doing ... and getParent() causes an extra table lookup for every child // element on the form. $aJsActions[$elementModel->getElement()->id] = array(); $aElIds[] = (int) $elementModel->getElement()->id; } } if (!empty($aElIds)) { $sql = 'SELECT * FROM #__fabrik_jsactions WHERE element_id IN (' . implode(',', $aElIds) . ')'; $db->setQuery($sql); $res = $db->loadObjectList(); } else { $res = array(); } if (is_array($res)) { foreach ($res as $r) { //merge the js attribs back into the array $j->loadINI($r->attribs); $a = $j->toArray(); foreach ($a as $k => $v) { $r->{$k} = $v; } unset($r->attribs); $aJsActions[$r->element_id][] = $r; } } return $aJsActions; }
/** * Loads a language file * * This method will not note the successful loading of a file - use load() instead * * @access private * @param string The name of the file * @param string The name of the extension * @return array|boolean An array of loaded strings * @see JLanguage::load() * @since 1.5 */ function _load($filename, $extension = 'unknown') { $result = false; if ($content = @file_get_contents($filename)) { //Take off BOM if present in the ini file if ($content[0] == "ï" && $content[1] == "»" && $content[2] == "¿") { $content = substr($content, 3); } $registry = new JRegistry(); $registry->loadINI($content); $result = $registry->toArray(); // Record the result of loading the extension's file. if (!isset($this->_paths[$extension])) { $this->_paths[$extension] = array(); } $this->_paths[$extension][$filename] = true; } return $result; }
// no direct access defined('_JEXEC') or die('Restricted access'); //Quit sliently if JWF Extension is not installed if (!file_exists(JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_jwf' . DS . 'globals.php')) { return; } require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_jwf' . DS . 'globals.php'; require_once JWF_BACKEND_PATH . DS . 'libs' . DS . 'plugins.php'; require_once JWF_BACKEND_PATH . DS . 'models' . DS . 'workflow.php'; require_once 'jwf.cron.php'; $GLOBALS['JWFGlobals'] = array(); $GLOBALS['JWFGlobals']['PluginManager'] = new JWFPluginManager(); //Load Trigger cache file $triggerDataPath = JWF_FS_PATH . DS . 'triggerCache.ini'; $triggerCacheData = new JRegistry(); $triggerCacheData->loadINI(file_get_contents($triggerDataPath)); $triggers = $triggerCacheData->toArray(); $GLOBALS['JWFGlobals']['Triggers'] = $triggers; /** * JWF Core system plugin * * @package Joomla * @subpackage JWF.core */ class plgSystemJwf extends JPlugin { /** * constructor * * @return void */
function editCSS($id, $option) { global $mainframe; $absolute_path = JPATH_ROOT; if (!$id) { $id = intval(JRequest::getVar('id', 0)); } $file = $absolute_path . '/modules/mod_swmenupro/styles/menu' . $id . '.css'; if ($fp = fopen($file, 'r')) { $content = fread($fp, filesize($file)); //$content = htmlspecialchars( $content ); $limit = intval(JRequest::getVar('limit', 10)); $limitstart = intval(JRequest::getVar('limitstart', 0)); $database =& JFactory::getDBO(); $row =& JTable::getInstance('module'); // load the row from the db table $row->load($id); $registry = new JRegistry(); $registry->loadINI($row->params); $params = $registry->toObject(); $menu->source = @$params->menutype ? $params->menutype : 'mainmenu'; $menu->name = $row->title; HTML_swmenupro::editCSS($id, $content, $limit, $limitstart, $menu); HTML_swmenupro::footer(); } else { $mainframe->redirect('index.php?option=' . $option . '&client=' . $client, 'Operation Failed: Could not open' . $file); } }
/** * Edit an element */ function edit() { global $_PROFILER; JDEBUG ? $_PROFILER->mark('edit: start') : null; $app =& JFactory::getApplication(); $user =& JFactory::getUser(); $db =& JFactory::getDBO(); $acl =& JFactory::getACL(); $model =& JModel::getInstance('element', 'FabrikModel'); if ($this->_task == 'edit') { $cid = JRequest::getVar('cid', array(0), 'method', 'array'); $cid = array((int) $cid[0]); } else { $cid = array(0); } $model->setId($cid[0]); $row =& $model->getElement(); if ($cid) { $row->checkout($user->get('id')); } // get params definitions $params =& $model->getParams(); require_once JPATH_COMPONENT . DS . 'views' . DS . 'element.php'; $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel'); $db->setQuery("SELECT COUNT(*) FROM #__fabrik_groups"); $total = $db->loadResult(); if ($total == 0) { $app->redirect("index.php?option=com_fabrik&c=group&task=new", JText::_('PLEASE CREATE A GROUP BEFORE CREATING AN ELEMENT')); return; } $lists = array(); if ($cid[0] != '0') { $aEls = array(); $aGroups = array(); $db->setQuery("SELECT form_id FROM #__fabrik_formgroup AS fg\n" . "WHERE fg.group_id = {$row->group_id}"); $formrow = $db->loadObject(); if (is_null($formrow)) { $aEls[] = $aGroups[] = JText::_('GROUP MUST BE IN A FORM'); } else { $formModel = JModel::getInstance('form', 'FabrikModel'); $formModel->setId($formrow->form_id); //get available element types $groups =& $formModel->getGroupsHiarachy(); foreach ($groups as $groupModel) { $group =& $groupModel->getGroup(); $o = new stdClass(); $o->label = $group->name; $o->value = "fabrik_trigger_group_group" . $group->id; $aGroups[] = $o; $elementModels =& $groupModel->getMyElements(); foreach ($elementModels as $elementModel) { $o = new stdClass(); $element =& $elementModel->getElement(); $o->label = FabrikString::getShortDdLabel($element->label); $o->value = "fabrik_trigger_element_" . $elementModel->getFullName(false, true, false); $aEls[] = $o; } } } asort($aEls); $o = new StdClass(); $o->groups = $aGroups; $o->elements = array_values($aEls); $lists['elements'] = $o; } else { // set the publish default to 1 $row->state = '1'; $lists['elements'] = array(JText::_('AVAILABLE ONCE SAVED')); } JDEBUG ? $_PROFILER->mark('edit: after element types') : null; $pluginManager->getPlugInGroup('validationrule'); $pluginManager->loadPlugInGroup('element'); $j = new JRegistry(); $lists['jsActions'] = $model->getJSActions(); //merge the js attribs back into the array foreach ($lists['jsActions'] as $js) { $j->loadINI($js->attribs); $a = $j->toArray(); foreach ($a as $k => $v) { $js->{$k} = $v; } unset($js->attribs); } $no_html = JRequest::getBool('no_html', 0); // Create the form $form = new fabrikParams('', JPATH_COMPONENT . DS . 'models' . DS . 'element.xml'); $form->bind($row); $form->loadINI($row->attribs); $row->parent_id = (int) $row->parent_id; if ($row->parent_id === 0) { $lists['parent'] = 0; } else { $sql = "SELECT * FROM #__fabrik_elements WHERE id = " . (int) $row->parent_id; $db->setQuery($sql); $parent = $db->loadObject(); if (is_null($parent)) { //perhaps the parent element was deleted? $lists['parent'] = 0; $row->parent_id = 0; } else { $lists['parent'] = $parent; } } JDEBUG ? $_PROFILER->mark('view edit: start') : null; if ($no_html != 1) { FabrikViewElement::edit($row, $pluginManager, $lists, $params, $form); } }
/** * Loads a language file * * This method will not note the successful loading of a file - use load() instead * * @access private * @param string The name of the file * @param string The name of the extension * @return boolean True if new strings have been added to the language * @see JLanguage::load() * @since 1.5 */ function _load($filename, $extension = 'unknown') { $result = false; if ($content = @file_get_contents($filename)) { $registry = new JRegistry(); $registry->loadINI($content); $newStrings = $registry->toArray(); if (is_array($newStrings)) { $this->_strings = array_merge($this->_strings, $newStrings); $result = true; } } // Record the result of loading the extension's file. if (!isset($this->_paths[$extension])) { $this->_paths[$extension] = array(); } $this->_paths[$extension][$filename] = $result; return $result; }
/** * (non-PHPdoc) * @see KunenaDatabaseObject::load() */ public function load($id = null) { $exists = parent::load($id); if (!$this->_saving) { $this->_alias = $this->get('alias', ''); } $registry = new JRegistry(); if (version_compare(JVERSION, '1.6', '>')) { if ($this->params) { $registry->loadString($this->params); } } else { if ($this->params) { $registry->loadINI($this->params); } } $this->params = $registry; // Register category if it exists if ($exists) { KunenaForumCategoryHelper::register($this); } return $exists; }
$show_shadow = @$params->show_shadow ? $params->show_shadow : 0; $selectbox_hack = @$params->selectbox_hack ? $params->selectbox_hack : 0; $auto_position = @$params->auto_position ? $params->auto_position : 0; $padding_hack = @$params->padding_hack ? $params->padding_hack : 0; //$css_load = JRequest::getVar( 'cssload', 0 ); } else { if ($preview == 2) { $query = "SELECT * FROM #__swmenufree_config WHERE id = '1'"; $database->setQuery($query); $result = $database->loadObjectList(); $swmenufree = array(); while (list($key, $val) = each($result[0])) { $swmenufree[$key] = $val; } $registry = new JRegistry(); $registry->loadINI($row->params); $params = $registry->toObject(); $menu = @$params->menutype ? $params->menutype : 'mainmenu'; $moduleID = @$params->moduleID; $menustyle = @$params->menustyle; $parent_id = @$params->parentid ? $params->parentid : 1; $hybrid = @$params->hybrid ? $params->hybrid : 0; $active_menu = @$params->active_menu ? $params->active_menu : 0; $parent_level = @$params->parent_level ? $params->parent_level : 0; $levels = @$params->levels ? $params->levels : 0; $sub_indicator = @$params->sub_indicator ? $params->sub_indicator : 0; $show_shadow = @$params->show_shadow ? $params->show_shadow : 0; $css_load = @$params->cssload ? $params->cssload : 0; $selectbox_hack = @$params->selectbox_hack ? $params->selectbox_hack : 0; $auto_position = @$params->auto_position ? $params->auto_position : 0; $padding_hack = @$params->padding_hack ? $params->padding_hack : 0;