Exemple #1
0
 public function purge()
 {
     $db = Komento::getDBO();
     $query = 'DELETE FROM ' . $db->nameQuote('#__komento_mailq');
     $db->setQuery($query);
     $db->Query();
 }
Exemple #2
0
 public function getEditorList($selected)
 {
     $db = Komento::getDBO();
     // compile list of the editors
     if (Komento::joomlaVersion() >= '1.6') {
         $query = 'SELECT `element` AS value, `name` AS text' . ' FROM `#__extensions`' . ' WHERE `folder` = "editors"' . ' AND `type` = "plugin"' . ' AND `enabled` = 1' . ' ORDER BY ordering, name';
     } else {
         $query = 'SELECT element AS value, name AS text' . ' FROM #__plugins' . ' WHERE folder = "editors"' . ' AND published = 1' . ' ORDER BY ordering, name';
     }
     //echo $query;
     $db->setQuery($query);
     $editors = $db->loadObjectList();
     if (count($editors) > 0) {
         if (Komento::joomlaVersion() >= '1.6') {
             $lang = JFactory::getLanguage();
             for ($i = 0; $i < count($editors); $i++) {
                 $editor = $editors[$i];
                 $lang->load($editor->text . '.sys', JPATH_ADMINISTRATOR, null, false, false);
                 $editor->text = JText::_($editor->text);
             }
         }
     }
     // temporary. remove when wysiwyg editors are ready
     $editors = array();
     $bbcode = new stdClass();
     $bbcode->value = 'bbcode';
     $bbcode->text = JText::_('COM_KOMENTO_EDITOR_BBCODE');
     $none = new stdClass();
     $none->value = 'none';
     $none->text = JText::_('COM_KOMENTO_EDITOR_NONE');
     $editors[] = $bbcode;
     $editors[] = $none;
     return JHTML::_('select.genericlist', $editors, 'form_editor', 'class="inputbox" size="1"', 'value', 'text', $selected);
 }
Exemple #3
0
	public function send( $max = 5 )
	{
		$konfig		= Komento::getKonfig();

		if( $konfig->get( 'disable_mailq' ) )
		{
			return false;
		}

		$db			= Komento::getDBO();
		$config		= Komento::getConfig();

		$sql = Komento::getSql();

		$sql->select( '#__komento_mailq' )
			->column( 'id' )
			->where( 'status', 0 )
			->order( 'created' )
			->limit( $max );

		$result = $sql->loadObjectList();

		if(! empty($result))
		{
			foreach($result as $mail)
			{
				$mailq	= Komento::getTable('mailq');
				$mailq->load($mail->id);

				$sendHTML = $mailq->type == 'html' ? 1 : 0;

				$state = 0;

				if( empty( $mailq->recipient ) )
				{
					$state = 1;
				}

				//send emails.
				if( Komento::isJoomla15() )
				{
					$state = JUtility::sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
				}
				else
				{
					$mail = JFactory::getMailer();
					$state = $mail->sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
				}

				if( $state )
				{
					// update the status to 1 == proccessed
					$mailq->status  = 1;
					$mailq->store();
				}
			}
		}
	}
Exemple #4
0
 /**
  * Delete the outdated entries.
  */
 public function clear()
 {
     $db = Komento::getDBO();
     $date = Komento::getDate();
     $query = 'DELETE FROM ' . $db->nameQuote('#__komento_captcha') . ' WHERE ' . $db->nameQuote('created') . ' <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
     $db->setQuery($query);
     $db->query();
     return true;
 }
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT c.id, c.title, c.parent_id, c.title AS name, c.parent_id AS parent' . ' FROM #__categories AS c' . ' WHERE c.extension = ' . $db->quote(FLEXI_CAT_EXTENSION) . ' AND (c.lft > ' . $db->quote(FLEXI_LFT_CATEGORY) . ' AND c.rgt < ' . $db->quote(FLEXI_RGT_CATEGORY) . ') GROUP BY c.id ORDER BY c.lft ';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     foreach ($categories as &$row) {
         $repeat = $row->level - 1 >= 0 ? $row->level - 1 : 0;
         $row->treename = str_repeat('.&#160;&#160;&#160;', $repeat) . ($row->level - 1 > 0 ? '|_&#160;' : '') . $row->title;
     }
     return $categories;
 }
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT `id`, `title`, `level`, `parent_id` FROM `CATEGORY_TABLE`';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     // optional. populate tree listing
     foreach ($categories as &$row) {
         $repeat = $row->level - 1 >= 0 ? $row->level - 1 : 0;
         $row->treename = str_repeat('.&#160;&#160;&#160;', $repeat) . ($row->level - 1 > 0 ? '|_&#160;' : '') . $row->title;
     }
     return $categories;
 }
Exemple #7
0
 public function store($updateNulls = false)
 {
     $sql = Komento::getSql();
     $sql->select('#__komento_configs')->column('1', '', 'count', true)->where('component', $this->component);
     $exists = $sql->loadResult() > 0 ? true : false;
     $data = new stdClass();
     $data->component = $this->component;
     $data->params = trim($this->params);
     $database = Komento::getDBO();
     if ($exists) {
         return $database->updateObject('#__komento_configs', $data, 'component');
     }
     return $database->insertObject('#__komento_configs', $data);
 }
Exemple #8
0
 function __construct()
 {
     $mainframe = JFactory::getApplication();
     $db = Komento::getDBO();
     $this->limit = $mainframe->getUserStateFromRequest('com_komento.reports.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = $mainframe->getUserStateFromRequest('com_komento.reports.limitstart', 'limitstart', 0, 'int');
     $this->filter_publish = $mainframe->getUserStateFromRequest('com_komento.reports.filter_publish', 'filter_publish', '*', 'string');
     $this->filter_component = $mainframe->getUserStateFromRequest('com_komento.reports.filter_component', 'filter_component', '*', 'string');
     $this->order = $mainframe->getUserStateFromRequest('com_komento.reports.filter_order', 'filter_order', 'created', 'cmd');
     $this->order_dir = $mainframe->getUserStateFromRequest('com_komento.reports.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
     $this->search = $mainframe->getUserStateFromRequest('com_komento.reports.search', 'search', '', 'string');
     Komento::import('helper', 'string');
     $this->search = KomentoStringHelper::escape(trim(JString::strtolower($this->search)));
     parent::__construct();
 }
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT c.category_id, cx.category_child_id, cx.category_child_id AS id, cx.category_parent_id,' . ' cx.category_parent_id AS parent_id, c.category_name, c.category_name AS title,' . ' c.category_description, c.published,ordering,' . ' c.category_name AS name, cx.category_parent_id AS parent' . ' FROM `#__redshop_category` AS c,' . ' `#__redshop_category_xref` AS cx' . ' WHERE c.category_id = cx.category_child_id' . ' ORDER BY c.ordering';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     $children = array();
     foreach ($categories as $row) {
         $pt = $row->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         $list[] = $row;
         $children[$pt] = $list;
     }
     $categories = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     return $categories;
 }
Exemple #10
0
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT c.id, c.name AS title, c.parent AS parent_id, c.name, c.parent' . ' FROM `#__zoo_category` as c USE INDEX (APPLICATIONID_ID_INDEX)' . ' ORDER BY c.ordering';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     $children = array();
     foreach ($categories as $row) {
         $pt = $row->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         $list[] = $row;
         $children[$pt] = $list;
     }
     $categories = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     return $categories;
 }
Exemple #11
0
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT a.id, a.name AS title, a.parent AS parent_id, a.name, a.parent' . ' FROM `#__k2_categories` AS a' . ' WHERE a.trash = 0' . ' ORDER BY a.ordering';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     $children = array();
     foreach ($categories as $row) {
         $pt = $row->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         $list[] = $row;
         $children[$pt] = $list;
     }
     $categories = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     return $categories;
 }
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT a.id, a.title, a.level, a.parent_id' . ' FROM `#__categories` AS a' . ' WHERE a.extension = ' . $db->quote('com_content') . ' AND a.parent_id > 0' . ' ORDER BY a.lft';
     if (Komento::joomlaVersion() == '1.5') {
         $query = 'SELECT a.id, a.title' . ' FROM `#__categories` AS a' . ' ORDER BY a.ordering';
     }
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     if (Komento::joomlaVersion() >= '1.6') {
         foreach ($categories as &$row) {
             $repeat = $row->level - 1 >= 0 ? $row->level - 1 : 0;
             $row->treename = str_repeat('.&#160;&#160;&#160;', $repeat) . ($row->level - 1 > 0 ? '|_&#160;' : '') . $row->title;
         }
     }
     return $categories;
 }
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT a.`cat_id` AS `id`, a.`cat_name` AS `title` , a.`cat_parent` AS `parent_id`' . ' FROM `#__mt_cats` AS a' . ' ORDER BY a.`lft`';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     $children = array();
     foreach ($categories as $row) {
         if ($row->parent_id != -1) {
             $pt = $row->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             $list[] = $row;
             $children[$pt] = $list;
         }
     }
     $res = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     return $res;
 }
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT c.category_id AS id, cd.name, cd.name AS title, c.parent_id, c.parent_id AS parent' . ' FROM `#__aceshop_category` AS c,' . ' `#__aceshop_category_description` AS cd' . ' WHERE c.category_id = cd.category_id' . ' ORDER BY c.sort_order';
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $categories = array();
     if (count($rows)) {
         $children = array();
         foreach ($rows as $v) {
             $pt = $v->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
         $treelist = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
         foreach ($treelist as &$row) {
             $category->title = $row->treename;
             $categories[] = $row;
         }
     }
     return $categories;
 }
 public function onBeforeLoad($eventTrigger, $context, &$article, &$params, &$page, &$options)
 {
     // We got to go through 3 checks:
     // 1. Check if POST parameter have id (this is when user go to an event page through event listings)
     // 2. Check if page parameter have id (this is when user assign an event on a menu item)
     // 3. Find back the id based on text parameter passed in (this was the old trigger before changing from onPrepareContent to onAfterDisplayContent for Joomla 1.5)
     $cid = JRequest::getInt('id');
     if (empty($cid)) {
         $pageParameters = JFactory::getApplication()->getPageParameters();
         $cid = $pageParameters->get('id');
     }
     if (empty($cid)) {
         // Bad fallback due to limited data that is being passed in
         // Use the description text to backtrace and search for the article id
         $text = $article->text;
         $text = str_ireplace('<!--{emailcloak=off}-->', '', $text);
         $db = Komento::getDBO();
         $query = 'SELECT ohanah_event_id FROM `#__ohanah_events` WHERE description = ' . $db->quote($text);
         $db->setQuery($query);
         $cid = $db->loadResult();
     }
     // If cid is still empty then we don't continue
     if (empty($cid)) {
         return false;
     }
     $article->id = $cid;
     return true;
 }
	public function getCategories()
	{
		$db		= Komento::getDBO();
		$query	= 'SELECT a.id, a.title, a.parent_id, count(b.id) - 1 AS level'
				. ' FROM `#__easyblog_category` AS a'
				. ' INNER JOIN `#__easyblog_category` AS b ON a.lft BETWEEN b.lft and b.rgt'
				. ' GROUP BY a.id'
				. ' ORDER BY a.lft ASC';

		$db->setQuery( $query );
		$categories = $db->loadObjectList();

		if( Komento::joomlaVersion() >= '1.6' )
		{
			foreach( $categories as &$row )
			{
				$repeat = ( $row->level - 1 >= 0 ) ? $row->level - 1 : 0;
				$row->treename = str_repeat( '.&#160;&#160;&#160;', $repeat ) . ( $row->level - 1 > 0 ? '|_&#160;' : '' ) . $row->title;
			}
		}

		return $categories;
	}
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT id, name as title, parent as parent_id, parent, name' . ' FROM `#__sobipro_object`' . ' WHERE oType IN (' . $db->quote('category') . ',' . $db->quote('section') . ')';
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     $children = array();
     foreach ($categories as $row) {
         $pt = $row->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         $list[] = $row;
         $children[$pt] = $list;
     }
     $categories = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     return $categories;
 }
Exemple #18
0
 public static function clearCaptcha($days = '7')
 {
     $db = Komento::getDBO();
     $query = 'DELETE FROM ' . $db->nameQuote('#__komento_captcha') . ' WHERE ' . $db->nameQuote('created') . ' <= DATE_SUB(NOW(), INTERVAL ' . $days . ' DAY)';
     $db->setQuery($query);
     $db->query();
     return $query;
 }
 private function updateDepth($ids, $depth)
 {
     $db = Komento::getDBO();
     $query = 'UPDATE ' . $db->nameQuote('#__komento_comments') . ' SET ' . $db->nameQuote('depth') . ' = ' . $db->quote($depth);
     $query .= ' WHERE ' . $db->nameQuote('id') . ' IN(' . $db->quote($ids) . ')';
     $db->setQuery($query);
     $db->query();
 }
 function clearComments()
 {
     $db = Komento::getDBO();
     $db->setQuery('DELETE FROM `#__komento_comments` WHERE `component` = ' . $db->quote('com_easyblog'));
     $db->query();
     $this->ajax->success();
     $this->ajax->send();
 }
 public function getCategoryId()
 {
     $db = Komento::getDBO();
     $query = 'SELECT `virtuemart_category_id` FROM `#__virtuemart_product_categories` WHERE `virtuemart_product_id` = ' . $db->quote($this->getContentId());
     $db->setQuery($query);
     $productCategory = $db->loadResult();
     return $productCategory;
 }
Exemple #22
0
	public function clear()
	{
		$db = Komento::getDBO();

		$query = 'SELECT * FROM ' . $db->nameQuote( '#__komento_captcha' ) . ' WHERE ' . $db->nameQuote( 'created' ) . ' <= DATE_SUB(NOW(), INTERVAL 7 DAY)';

		$db->setQuery( $query );
		$db->query();
	}
Exemple #23
0
	function isIndexKeyExists( $tableName, $indexName )
	{
		$db = Komento::getDBO();
		$query	= 'SHOW INDEX FROM ' . $db->nameQuote( $tableName );
		$db->setQuery( $query );
		$indexes	= $db->loadObjectList();

		$result = array();

		foreach( $indexes as $index )
		{
			$result[ $index->Key_name ]	= preg_replace( '/[(0-9)]/' , '' , $index->Column_name );
		}

		if( array_key_exists($indexName, $result) )
		{
			return true;
		}

		return false;
	}
Exemple #24
0
 public function debug()
 {
     $table = JRequest::getString('table');
     $tablename = '#__' . $table;
     $db = Komento::getDBO();
     $db->setQuery('show columns from ' . $db->nameQuote($tablename));
     $result = $db->loadObjectList();
     $html = '<table><tr>';
     foreach ($result as $row) {
         $html .= '<td>' . $row->Field . '</td>';
     }
     $html .= '</tr>';
     $db->setQuery('select * from ' . $db->nameQuote($tablename) . ' order by id');
     $result = $db->loadObjectList();
     foreach ($result as $row) {
         $html .= '<tr>';
         foreach ($row as $key => $value) {
             $html .= '<td>' . $value . '</td>';
         }
         $html .= '</tr>';
     }
     $html .= '</table>';
     echo $html;
     exit;
 }
Exemple #25
0
 function __construct()
 {
     $this->_db = Komento::getDBO();
 }
	function removeActions( $userId )
	{
		$db = Komento::getDBO();

		$query  = 'DELETE FROM ' . $db->nameQuote( '#__komento_actions' );
		$query .= ' WHERE ' . $db->nameQuote( 'action_by' ) . ' = ' . $db->quote( $userId );

		$db->setQuery( $query );
		$db->query();

		if($db->getErrorNum())
		{
			JError::raiseError( 500, $db->stderr());
		}
	}
 public function getCategoryId()
 {
     $db = Komento::getDBO();
     $query = 'SELECT ' . $db->nameQuote('category_id') . ' FROM ' . $db->nameQuote('#__hwdms_category_map') . ' WHERE ' . $db->nameQuote('element_id') . ' = ' . $db->quote($this->_item->id);
     $db->setQuery($query);
     $result = $db->loadResult();
     if (count($result) > 0) {
         return $result;
     }
     return true;
 }