Ejemplo n.º 1
0
 /**
  * Method to get the content types.
  *
  * @return  array  An array of JContentType objects.
  *
  * @since   12.1
  * @throws  RuntimeException
  */
 public function getTypes()
 {
     $types = array();
     // Get the cache store id.
     $storeId = $this->getStoreId('getTypes');
     // Attempt to retrieve the types from cache first.
     $cached = $this->retrieve($storeId);
     // Check if the cached value is usable.
     if (is_array($cached)) {
         return $cached;
     }
     // Build the query to get the content types.
     $query = $this->db->getQuery(true);
     $query->select('a.*');
     $query->from($query->qn('#__content_types') . ' AS a');
     // Get the content types.
     $this->db->setQuery($query);
     $results = $this->db->loadObjectList();
     // Reorganize the type information.
     foreach ($results as $result) {
         // Create a new JContentType object.
         $type = $this->factory->getType();
         // Bind the type data.
         $type->bind($result);
         // Add the type, keyed by alias.
         $types[$result->alias] = $type;
     }
     // Store the types in cache.
     return $this->store($storeId, $types);
 }
Ejemplo n.º 2
0
 /**
  * Execute the application.
  *
  * @return  void
  */
 public function doExecute()
 {
     // Get the query builder class from the database and set it up
     // to select everything in the 'db' table.
     $query = $this->dbo->getQuery(true)->select('*')->from($this->dbo->qn('db'));
     // Push the query builder object into the database connector.
     $this->dbo->setQuery($query);
     // Get all the returned rows from the query as an array of objects.
     $rows = $this->dbo->loadObjectList();
     // Just dump the value returned.
     var_dump($rows);
 }
Ejemplo n.º 3
0
 public function getK2Users()
 {
     $query = "SELECT id, userID, userName, description, image, url from #__k2_users ;";
     $query_set = $this->dbo->setQuery($query);
     $items = $this->dbo->loadObjectList();
     return $items;
 }
Ejemplo n.º 4
0
 public function getBrands()
 {
     $query = "SELECT a.group_id,u.*, ku.userName, ku.description, ku.image, ku.url FROM `#__user_usergroup_map` as a LEFT JOIN #__users as u ON u.id = a.user_id LEFT JOIN #__k2_users as ku ON ku.userID = a.user_id where a.group_id = 13;";
     $query_set = $this->dbo->setQuery($query);
     $items = $this->dbo->loadObjectList();
     return $items;
 }
Ejemplo n.º 5
0
 /**
  * Compacts the ordering sequence of the selected records
  *
  * @access public
  * @param string Additional where query to limit ordering to a particular subset of records
  */
 function reorder($where = '')
 {
     $k = $this->_tbl_key;
     if (!in_array('ordering', array_keys($this->getProperties()))) {
         $this->setError(get_class($this) . ' does not support ordering');
         return false;
     }
     if ($this->_tbl == '#__content_frontpage') {
         $order2 = ", content_id DESC";
     } else {
         $order2 = "";
     }
     $query = 'SELECT ' . $this->_tbl_key . ', ordering' . ' FROM ' . $this->_tbl . ' WHERE ordering >= 0' . ($where ? ' AND ' . $where : '') . ' ORDER BY ordering' . $order2;
     $this->_db->setQuery($query);
     if (!($orders = $this->_db->loadObjectList())) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // compact the ordering numbers
     for ($i = 0, $n = count($orders); $i < $n; $i++) {
         if ($orders[$i]->ordering >= 0) {
             if ($orders[$i]->ordering != $i + 1) {
                 $orders[$i]->ordering = $i + 1;
                 $query = 'UPDATE ' . $this->_tbl . ' SET ordering = ' . (int) $orders[$i]->ordering . ' WHERE ' . $k . ' = ' . $this->_db->Quote($orders[$i]->{$k});
                 $this->_db->setQuery($query);
                 $this->_db->query();
             }
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 public function getK2Categories()
 {
     //$query = "SELECT * from #__k2_categories WHERE trash != 1 and published = 1 and extraFieldsGroup = 1 order by id;" ;
     $query = "SELECT * from #__k2_categories WHERE trash != 1 and published = 1 order by id;";
     $query_set = $this->dbo->setQuery($query);
     $categories = $this->dbo->loadObjectList();
     return $categories;
 }
Ejemplo n.º 7
0
	public function getElementScripts(){
		$retArray = array();
		$this->db->setQuery("Select id, package, name, title, description, type From #__facileforms_scripts Where published = 1 And type = 'Element Validation'");
		$retArray['validation'] = $this->db->loadObjectList();
		$this->db->setQuery("Select id, package, name, title, description, type From #__facileforms_scripts Where published = 1 And type = 'Element Action'");
		$retArray['action'] = $this->db->loadObjectList();
		$this->db->setQuery("Select id, package, name, title, description, type From #__facileforms_scripts Where published = 1 And type = 'Element Init'");
		$retArray['init'] = $this->db->loadObjectList();;
		return $retArray;
	}
Ejemplo n.º 8
0
 public function getRecentItems()
 {
     $query = "SELECT id, alias, catid, title, created_by, publish_up, TIMESTAMPDIFF(HOUR,NOW(),publish_up) as `differences`  FROM #__k2_items where TIMESTAMPDIFF(HOUR,NOW(),publish_up) > -24 and TIMESTAMPDIFF(HOUR,NOW(),publish_up) < 0 and published = 1 order by `differences`  desc";
     $query_set = $this->dbo->setQuery($query);
     //$this->out("Query Object set --> " .  print_r($query_set,true));
     $items = $this->dbo->loadObjectList();
     if (empty($items)) {
         return false;
     }
     return $items;
 }
Ejemplo n.º 9
0
 /**
  * Method to compact the ordering values of rows in a group of rows
  * defined by an SQL WHERE clause.
  *
  * @param   string  $where  WHERE clause to use for limiting the selection of rows to compact the ordering values.
  *
  * @return  mixed  Boolean true on success.
  *
  * @link    http://docs.joomla.org/JTable/reorder
  * @since   11.1
  */
 public function reorder($where = '')
 {
     // If there is no ordering field set an error and return false.
     if (!property_exists($this, 'ordering')) {
         $e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_CLASS_DOES_NOT_SUPPORT_ORDERING', get_class($this)));
         $this->setError($e);
         return false;
     }
     // Initialise variables.
     $k = $this->_tbl_key;
     // Get the primary keys and ordering values for the selection.
     $query = $this->_db->getQuery(true);
     $query->select($this->_tbl_key . ', ordering');
     $query->from($this->_tbl);
     $query->where('ordering >= 0');
     $query->order('ordering');
     // Setup the extra where and ordering clause data.
     if ($where) {
         $query->where($where);
     }
     $this->_db->setQuery($query);
     $rows = $this->_db->loadObjectList();
     // Check for a database error.
     if ($this->_db->getErrorNum()) {
         $e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_REORDER_FAILED', get_class($this), $this->_db->getErrorMsg()));
         $this->setError($e);
         return false;
     }
     // Compact the ordering values.
     foreach ($rows as $i => $row) {
         // Make sure the ordering is a positive integer.
         if ($row->ordering >= 0) {
             // Only update rows that are necessary.
             if ($row->ordering != $i + 1) {
                 // Update the row ordering field.
                 $query = $this->_db->getQuery(true);
                 $query->update($this->_tbl);
                 $query->set('ordering = ' . ($i + 1));
                 $query->where($this->_tbl_key . ' = ' . $this->_db->quote($row->{$k}));
                 $this->_db->setQuery($query);
                 // Check for a database error.
                 if (!$this->_db->execute()) {
                     $e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_REORDER_UPDATE_ROW_FAILED', get_class($this), $i, $this->_db->getErrorMsg()));
                     $this->setError($e);
                     return false;
                 }
             }
         }
     }
     return true;
 }
Ejemplo n.º 10
0
 public function loadK2ItemsMap()
 {
     $db = $this->dbo;
     $query = "select * from #__k2_recipe_map  ;";
     $query_set = $this->dbo->setQuery($query);
     $items = $this->dbo->loadObjectList();
     $this->k2_items_maps = array();
     foreach ($items as $key => $item) {
         $obj = new stdClass();
         $obj->item_type = $item->item_type;
         $obj->new_item_id = $item->new_item_id;
         $this->k2_items_maps[$item->k2_item_id] = $obj;
     }
 }
Ejemplo n.º 11
0
	public function getCriteriaFixed($ruleId){
		
		$this->db->setQuery("
		
			Select 
				crit.*
			From 
				#__facileforms_integrator_criteria_fixed As crit
			Where
				crit.rule_id = ".$this->db->Quote($ruleId)."
			Group By crit.id
			Order By crit.id Desc
		");
		
		$ret = $this->db->loadObjectList();
		return $ret;
	}
Ejemplo n.º 12
0
 /**
  * get exisiting records sets, optionally filtered by inn list
  *
  * @param string $table table suffix
  * @param array $filter array of inns or numbers
  * @return array of record objects
  */
 private function getExistingRecords($filter = array(), $table = "")
 {
     if ($table && $table == "_oldcert") {
         $fields = "id,number,adding_date";
         $wherefld = "number";
     } else {
         $fields = "id,inn,adding_date";
         $wherefld = "inn";
     }
     $sql = "SELECT {$fields} FROM #__sro{$table} ";
     if (!empty($filter)) {
         $numbers = implode(",", $filter);
         $sql .= " WHERE {$wherefld} IN ({$numbers})";
     }
     $this->_db->setQuery($sql);
     $result = $this->_db->loadObjectList($wherefld);
     if (is_null($result)) {
         $this->setError("Ошибка при загрузке существующих данных:" . $this->_db->getErrorMsg());
         return array();
     }
     return $result;
 }
Ejemplo n.º 13
0
 public function getRows($class = null)
 {
     // get the subset (based on limits) of records
     $query = 'SELECT *' . ' FROM #__acctexp_' . $this->table . $this->getConstraints() . $this->getOrdering() . $this->getLimit();
     $this->db->setQuery($query);
     $rows = $this->db->loadObjectList();
     if ($this->db->getErrorNum()) {
         echo $this->db->stderr();
         return false;
     }
     if ($class) {
         foreach ($rows as $k => $obj) {
             $rows[$k] = new $class();
             $rows[$k]->load($obj->id);
         }
     }
     return $rows;
 }
Ejemplo n.º 14
0
 /**
  * Get a JSON formatted list of installed extensions
  * Needs to be public so we can call it from the audit.
  *
  * @return string
  */
 public function getExtensions()
 {
     // connect/get the Joomla db object
     $this->db = JFactory::getDbo();
     // crazy way of handling Joomla 1.5.x legacy :-(
     $one5 = FALSE;
     // Get Joomla 2.0+ Extensions
     $this->db->setQuery('SELECT e.extension_id, e.name, e.type, e.element, e.enabled, e.folder,
                             (
                              SELECT title
                              FROM #__menu AS m
                              WHERE m.component_id = e.extension_id
                              AND parent_id = 1
                              ORDER BY ID ASC LIMIT 1
                              )
                              AS title
                             FROM #__extensions AS e
                             WHERE protected = 0');
     $installedExtensions = $this->db->loadObjectList();
     // ok if we have none maybe we are Joomla < 1.5.26
     if (!$installedExtensions) {
         // Yooo hoo I'm on a crap old, out of date, probably hackable Joomla version!
         $one5 = TRUE;
         // Get the extensions - used to be called components
         $this->db->setQuery('SELECT "component" as "type", name, `option` as "element", enabled FROM #__components WHERE iscore != 1 and parent = 0');
         $components = $this->db->loadObjectList();
         // Get the plugins
         $this->db->setQuery('SELECT "plugin" as "type", name, element, folder, published as enabled FROM #__plugins WHERE iscore != 1');
         $plugins = $this->db->loadObjectList();
         // get the modules
         $this->db->setQuery('SELECT  "module" as "type", module, module as name, client_id, published as enabled FROM #__modules WHERE iscore != 1');
         $modules = $this->db->loadObjectList();
         /**
          * Get the templates - I n Joomla 1.5.x the templates are not in the
          * db unless published so we need to read the folders from the /templates folders
          * Note in Joomla 1.5.x there was no such think as admin templates
          */
         $folders = array_merge(scandir(JPATH_BASE . '/templates'), scandir(JPATH_ADMINISTRATOR . '/templates'));
         $templates = array();
         foreach ($folders as $templateFolder) {
             $f = JPATH_BASE . '/templates/' . trim($templateFolder);
             $a = JPATH_ADMINISTRATOR . '/templates/' . trim($templateFolder);
             // We dont want index.html etc...
             if (!is_dir($f) && !is_dir($a) || ($templateFolder == '.' || $templateFolder == '..')) {
                 continue;
             }
             if (is_dir($a)) {
                 $client_id = 1;
             } else {
                 $client_id = 0;
             }
             // make it look like we want like Joomla 2.5+ would
             $template = array('type' => 'template', 'template' => $templateFolder, 'client_id' => $client_id, 'enabled' => 1);
             // Convert to an obj
             $templates[] = json_decode(json_encode($template));
         }
         // Merge all the "extensions" we have found all over the place
         $installedExtensions = array_merge($components, $plugins, $modules, $templates);
     }
     $lang = JFactory::getLanguage();
     // Load all the language strings up front incase any strings are shared
     foreach ($installedExtensions as $k => $ext) {
         $lang->load(strtolower($ext->element) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($ext->element) . ".sys", JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($ext->name) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($ext->name) . ".sys", JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($ext->title) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($ext->title) . ".sys", JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($ext->element), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($ext->element), JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($ext->name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($ext->name), JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($ext->title), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($ext->title), JPATH_SITE, 'en-GB', TRUE);
         $element = str_replace('_TITLE', '', strtoupper($ext->element));
         $name = str_replace('_TITLE', '', strtoupper($ext->name));
         $title = str_replace('_TITLE', '', strtoupper($ext->title));
         $lang->load(strtolower($element) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($element) . ".sys", JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($name) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($name) . ".sys", JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($title) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($title) . ".sys", JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($element), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($element), JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($name), JPATH_SITE, 'en-GB', TRUE);
         $lang->load(strtolower($title), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load(strtolower($title), JPATH_SITE, 'en-GB', TRUE);
         // templates
         $lang->load('tpl_' . strtolower($name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load('tpl_' . strtolower($name), JPATH_SITE, 'en-GB', TRUE);
         // Joomla 1.5.x modules
         $lang->load('mod_' . strtolower($name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         $lang->load('mod_' . strtolower($name), JPATH_SITE, 'en-GB', TRUE);
         // tut tut Akeeba - bad naming!
         $lang->load(strtolower('PLG_SYSTEM_SRP'), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         // should be plg_srp
         $lang->load(strtolower('PLG_SYSTEM_ONECLICKACTION'), JPATH_SITE, 'en-GB', TRUE);
         // should be plg_oneclickaction
         $lang->load(strtolower('PLG_SYSTEM_ONECLICKACTION'), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         // should be plg_oneclickaction
         // Joomla 1.5 plugins
         if ($ext->type == 'plugin') {
             $plg = 'plg_' . $ext->folder . '_' . $ext->element;
             $lang->load(strtolower($plg), JPATH_SITE, 'en-GB', TRUE);
             $lang->load(strtolower($plg), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         }
         if ($ext->type == 'template') {
             $plg = 'tpl_' . $ext->name;
             $lang->load(strtolower($plg), JPATH_SITE, 'en-GB', TRUE);
             $lang->load(strtolower($plg), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
         }
     }
     // ok now we have the extensions - get the xml for further offline crunching
     foreach ($installedExtensions as $k => $ext) {
         // remove not supported types :-(
         if ($ext->type == 'file' || $ext->type == 'package') {
             unset($installedExtensions[$k]);
             continue;
         }
         $ext->xmlFile = $this->findManifest($ext);
         try {
             if ($ext->xmlFile !== FALSE) {
                 $parts = explode('/', $ext->xmlFile);
                 array_pop($parts);
                 $ext->path = implode('/', $parts);
                 bfLog::log('Loading XML file = ' . str_replace(JPATH_BASE, '', $ext->xmlFile));
                 $xml = trim(file_get_contents($ext->xmlFile));
                 $myXML = new SimpleXMLElement($xml);
                 if (property_exists($myXML, 'description')) {
                     $ext->desc = $myXML->description;
                 }
                 $ext->xmlFileContents = base64_encode(gzcompress($xml));
                 $ext->xmlFileCreated = filemtime($ext->xmlFile);
             } else {
                 $ext->MANIFESTERROR = TRUE;
             }
         } catch (Exception $e) {
             bfLog::log('EXCEPTION = ' . $ext->xmlFile . ' ' . $e->getMessage());
             die('Could not process XML file at: ' . str_replace(JPATH_BASE, '', $ext->xmlFile));
         }
         $ext->name = JText::_($ext->name);
         $ext->title = JText::_($ext->title);
         $ext->desc = base64_encode(gzcompress(JText::_($ext->desc)));
         // remove base paths - we dont want to leak data :)
         $ext->xmlFile = $this->removeBase($ext->xmlFile);
         $ext->path = $this->removeBase($ext->path);
         // Sort so its pretty - not that anyone sees, but debugging is easier
         $ext = (array) $ext;
         ksort($ext);
         // push to the result
         $installedExtensions[$k] = $ext;
     }
     return json_encode($installedExtensions);
 }
Ejemplo n.º 15
0
	function expcsv(array $ids)
	{
                global $ff_config;

                $csvdelimiter = stripslashes($ff_config->csvdelimiter);
                $csvquote = stripslashes($ff_config->csvquote);
                $cellnewline = $ff_config->cellnewline == 0 ? "\n" : "\\n";

		$fields = array();
		$lines = array();
		$ids = implode(',', $ids);
		$this->db->setQuery(
			"select * from #__facileforms_records where id in ($ids) order by submitted Desc"
		);
		$recs = $this->db->loadObjectList();
		$recsSize = count($recs);
		for($r = 0; $r < $recsSize; $r++) {

                        $rec = $recs[$r];

			$lineNum = count($lines);

			$fields['ZZZ_A_ID'] = true;
			$fields['ZZZ_B_SUBMITTED'] = true;
			$fields['ZZZ_C_USER_ID'] = true;
			$fields['ZZZ_D_USERNAME'] = true;
			$fields['ZZZ_E_USER_FULL_NAME'] = true;
			$fields['ZZZ_F_TITLE'] = true;
			$fields['ZZZ_G_IP'] = true;
			$fields['ZZZ_H_BROWSER'] = true;
			$fields['ZZZ_I_OPSYS'] = true;
			$fields['ZZZ_J_TRANSACTION_ID'] = true;
			$fields['ZZZ_K_DATE'] = true;
			$fields['ZZZ_L_TEST_ACCOUNT'] = true;
			$fields['ZZZ_M_DOWNLOAD_TRIES'] = true;

			$lines[$lineNum]['ZZZ_A_ID'][] = $rec->id;
			$lines[$lineNum]['ZZZ_B_SUBMITTED'][] = $rec->submitted;
			$lines[$lineNum]['ZZZ_C_USER_ID'][] = $rec->user_id;
			$lines[$lineNum]['ZZZ_D_USERNAME'][] = $rec->username;
			$lines[$lineNum]['ZZZ_E_USER_FULL_NAME'][] = $rec->user_full_name;
			$lines[$lineNum]['ZZZ_F_TITLE'][] = $rec->title;
			$lines[$lineNum]['ZZZ_G_IP'][] = $rec->ip;
			$lines[$lineNum]['ZZZ_H_BROWSER'][] = $rec->browser;
			$lines[$lineNum]['ZZZ_I_OPSYS'][] = $rec->opsys;
			$lines[$lineNum]['ZZZ_J_TRANSACTION_ID'][] = $rec->paypal_tx_id;
			$lines[$lineNum]['ZZZ_K_DATE'][] = $rec->paypal_payment_date;
			$lines[$lineNum]['ZZZ_L_TEST_ACCOUNT'][] = $rec->paypal_testaccount;
			$lines[$lineNum]['ZZZ_M_DOWNLOAD_TRIES'][] = $rec->paypal_download_tries;

			$rec = $recs[$r];
			$this->db->setQuery(
				"select Distinct * from #__facileforms_subrecords where record = $rec->id order by id"
			);
			$subs = $this->db->loadObjectList();
			$subsSize = count($subs);
			for($s = 0; $s < $subsSize; $s++) {
				$sub = $subs[$s];
				if($sub->name != 'bfFakeName' && $sub->name != 'bfFakeName2' && $sub->name != 'bfFakeName3' && $sub->name != 'bfFakeName4'){
					if(!isset($fields[strtoupper($sub->name)]))
					{
						$fields[strtoupper($sub->name)] = true;
					}
					$lines[$lineNum][strtoupper($sub->name)][] = $sub->value;
				}
			}
		}

		$head = '';
		ksort($fields);
		$lineLength = count($lines);
		foreach($fields As $fieldName => $null)
		{
			$head .= $csvquote.$fieldName.$csvquote.$csvdelimiter;
			for($i = 0; $i < $lineLength;$i++)
			{
				if(!isset($lines[$i][$fieldName]))
				{
					$lines[$i][$fieldName] = array();
				}
			}
		}

		$head = substr($head,0,strlen($head)-1) . nl();

		$out = '';
		for($i = 0; $i < $lineLength;$i++)
		{
			ksort($lines[$i]);
			foreach($lines[$i] As $line){
				$out .= $csvquote.str_replace($csvquote,$csvquote.$csvquote,str_replace("\n",$cellnewline,str_replace("\r","",implode('|',$line)))).$csvquote.$csvdelimiter;
			}
			$out = substr($out,0,strlen($out)-1);
			$out .= nl();
		}

		$csvname = JPATH_SITE.'/components/com_breezingforms/exports/ffexport-'.date('YmdHis').'.csv';
		JFile::makeSafe($csvname);
		if (!JFile::write($csvname,$head.$out)) {
			echo "<script> alert('".addslashes(BFText::_('COM_BREEZINGFORMS_RECORDS_XMLNORWRTBL'))."'); window.history.go(-1);</script>\n";
			exit();
		} // if

                $this->db->setQuery(
			"update #__facileforms_records set exported=1 where id in ($ids)"
		);
                $this->db->query();

		/*
		$data = JFile::read($csvname);
		$files[] = array('name' => basename($csvname), 'data' => $data);

		$zip = JArchive::getAdapter('zip');
		$path = JPATH_SITE.'/components/com_breezingforms/exports/ffexport-csv-'.date('YmdHis').'.zip';
		$zip->create($path, $files);
		JFile::delete($csvname);
		*/
		@ob_end_clean();
		$_size = filesize($csvname);
		$_name = basename($csvname);
		@ini_set("zlib.output_compression", "Off");

                Header("Content-Type: text/comma-separated-values; charset=utf-8");
                Header("Content-Disposition: attachment;filename=\"$_name\"");
                Header("Content-Transfer-Encoding: 8bit");

		header("Pragma: public");
		header("Expires: 0");
		header("Cache-Control: private");
		//header("Content-Type: application/octet-stream");
		//header("Content-Disposition: attachment; filename=$_name");
		//header("Accept-Ranges: bytes");
		//header("Content-Length: $_size");
                ob_start();
		readfile($csvname);
                $c = ob_get_contents();
                ob_end_clean();
                if(function_exists('mb_convert_encoding')){
                    echo chr(255).chr(254).mb_convert_encoding( $c, 'UTF-16LE', 'UTF-8');
                } else {
                    echo $c;
                }
		exit;
	}
Ejemplo n.º 16
0
 /**
  * Custom doExecute method.
  *
  * This method loads a list of the published plugins from the 'cron' group,
  * then loads the plugins and registers them against the 'doCron' event.
  * The event is then triggered and results logged.
  *
  * Any configuration for the cron plugins is done via the Joomla CMS
  * administrator interface and plugin parameters.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function doExecute()
 {
     //
     // Check we have some critical information.
     //
     if (!defined('JPATH_PLUGINS') || !is_dir(JPATH_PLUGINS)) {
         throw new Exception('JPATH_PLUGINS not defined');
     }
     // Add a start message.
     JLog::add('Starting cron run.');
     //
     // Prepare the plugins
     //
     // Get the quey builder class from the database.
     $query = $this->dbo->getQuery(true);
     // Get a list of the plugins from the database.
     $query->select('p.*')->from('#__extensions AS p')->where('p.enabled = 1')->where('p.type = ' . $this->dbo->quote('plugin'))->where('p.folder = ' . $this->dbo->quote('cron'))->order('p.ordering');
     // Push the query builder object into the database connector.
     $this->dbo->setQuery($query);
     // Get all the returned rows from the query as an array of objects.
     $plugins = $this->dbo->loadObjectList();
     // Log how many plugins were loaded from the database.
     JLog::add(sprintf('.loaded %d plugin(s).', count($plugins)));
     // Loop through each of the results from the database query.
     foreach ($plugins as $plugin) {
         // Build the class name of the plugin.
         $className = 'plg' . ucfirst($plugin->folder) . ucfirst($plugin->element);
         $element = preg_replace('#[^A-Z0-9-~_]#i', '', $plugin->element);
         // If the class doesn't already exist, try to load it.
         if (!class_exists($className)) {
             // Compute the path to the plugin file.
             $path = sprintf(rtrim(JPATH_PLUGINS, '\\/') . '/cron/%s/%s.php', $element, $element);
             // Check if the file exists.
             if (is_file($path)) {
                 // Include the file.
                 include $path;
                 // Double check if we have a valid class.
                 if (!class_exists($className)) {
                     // Log a warning and contine to the next record.
                     JLog::add(sprintf('..plugin class for `%s` not found in file.', $element), JLog::WARNING);
                     continue;
                 }
             } else {
                 // Log a warning and contine to the next record.
                 JLog::add(sprintf('..plugin file for `%s` not found.', $element), JLog::WARNING);
                 continue;
             }
         }
         JLog::add(sprintf('..registering `%s` plugin.', $element));
         // Register the event.
         $this->registerEvent('doCron', new $className($this->dispatcher, array('params' => new JRegistry($plugin->params))));
     }
     //
     // Run the cron plugins.
     //
     // Each plugin should have been installed in the Joomla CMS site
     // and must include a 'doCron' method. Configuration of the plugin
     // is done via plugin parameters.
     //
     JLog::add('.triggering `doCron` event.');
     // Trigger the event and let the Joomla plugins do all the work.
     $results = $this->triggerEvent('doCron');
     // Log the results.
     foreach ($this->triggerEvent('doCron') as $result) {
         JLog::add(sprintf('..plugin returned `%s`.', var_export($result, true)));
     }
     JLog::add('Finished cron run.');
 }
Ejemplo n.º 17
0
 public function getCriteriaFixed($ruleId)
 {
     $this->db->setQuery("\n\t\t\n\t\t\tSelect \n\t\t\t\tcrit.*\n\t\t\tFrom \n\t\t\t\t#__facileforms_integrator_criteria_fixed As crit\n\t\t\tWhere\n\t\t\t\tcrit.rule_id = " . $this->db->Quote($ruleId) . "\n\t\t\tGroup By crit.id\n\t\t\tOrder By crit.id Desc\n\t\t");
     $ret = $this->db->loadObjectList();
     return $ret;
 }
Ejemplo n.º 18
0
 /**
  * Execute a query to the database and load the result returned as a list of objects
  *
  * The result returned by this method is the same as the one returned by JDatabase::loadObjectList()
  * Basically, it returns a list of results (objects) of a database operation
  * Generally used for SELECT operations
  *
  * @param string $query The query to be executed
  * @param string $key The class to be used to create objects (default: stdClass)
  *
  * @return array The results of the query
  *
  * @throws RuntimeException
  *
  * @since 1.0.0
  */
 public function queryObjectList($query, $key = '')
 {
     // query database table
     $this->_database->setQuery($query);
     return $this->_database->loadObjectList($key);
 }