Beispiel #1
0
 function __construct($config = array())
 {
     parent::__construct($config);
     $cfg = BidsHelperTools::getConfig();
     $this->assignRef('cfg', $cfg);
     JHTML::stylesheet('com_bids.css', JURI::root() . 'administrator/components/com_bids/css/');
 }
Beispiel #2
0
    function setFilters() {

        $app	= JFactory::getApplication();
        
        $reset = JRequest::getString('reset', '');
        $this->setState('filters.reset',$reset);
        $this->resetFilters('reset');

        foreach($this->knownFilters as $keyName=>$attribs) {
            $default = isset($attribs['default']) ? $attribs['default'] : null;
            $type = isset($attribs['type'])     ? $attribs['type'] : 'none';
            $value = $app->getUserStateFromRequest($this->context . '.filters.' . $keyName, $keyName, $default, $type );
            if(!empty($value)) {
                $this->setState('filters.'.$keyName, $value );
            }
        }

        $list_limit=BidsHelperTools::getItemsPerPage();

        // Get the pagination request variables
        $this->setState('limit', $app->getUserStateFromRequest($this->context.'.limit','limit', $list_limit, 'int'));
        $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));
        // In case limit has been changed, adjust limitstart accordingly
        $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) :0));

        $this->setState('filter_order_Dir', $app->getUserStateFromRequest($this->context.'.filter_order_Dir', 'filter_order_Dir', "ASC"));
        $this->setState('filter_order', $app->getUserStateFromRequest($this->context.'.filter_order','filter_order', "start_date"));

        //this sets the model's filters according to custom fields
        $profile = BidsHelperTools::getUserProfileObject();
        parent::setCustomFilters($profile);


    }
Beispiel #3
0
 function display()
 {
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $cfg = BidsHelperTools::getConfig();
     $where = array();
     $context = 'com_bids.bidsadminview.users';
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', '', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $app->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     if (!$filter_order) {
         $filter_order = 'u.name';
     }
     $order = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . '';
     if ($search) {
         $where[] = " username LIKE '%" . $db->getEscaped($search) . "%' ";
     }
     // Build the where clause of the content record query
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     // Get the total number of records
     $query = "SELECT COUNT(*) " . "FROM #__users" . $where;
     $db->setQuery($query);
     $total = $db->loadResult();
     // Create the pagination object
     jimport('joomla.html.pagination');
     $page = new JPagination($total, $limitstart, $limit);
     $profileObject = BidsHelperTools::getUserProfileObject();
     $profileTable = $profileObject->getIntegrationTable();
     $profileKey = $profileObject->getIntegrationKey();
     $profileFields = array('verified', 'powerseller');
     if ($cfg->bid_opt_enable_acl) {
         $profileFields = array_merge($profileFields, array('isBidder', 'isSeller'));
     }
     $sqlFields = array();
     foreach ($profileFields as $pf) {
         $field = $profileObject->getFilterField($pf);
         if ($field) {
             $sqlFields[] = 'p.' . $field . ' AS ' . $pf;
         }
     }
     // Get the users
     $query = "SELECT\r\n                    u.id as userid1, u.username as username,u.name as name, u.email AS email,\r\n                    p.id as profid, " . (count($sqlFields) ? implode(',', $sqlFields) . ',' : '') . "\r\n    \t\t\t    COUNT(DISTINCT a.id) AS nr_auctions,\r\n\r\n    \t\t\t    COUNT(DISTINCT btbl.id) as nr_closed_bids,\r\n\r\n    \t\t\t    COUNT(DISTINCT IF(a.close_offer,a.id,NULL)) AS nr_closed_offers,\r\n    \t\t\t    GROUP_CONCAT(DISTINCT IF(a.close_offer,a.id,NULL)) AS closed_offers,\r\n\r\n    \t\t\t    COUNT(DISTINCT IF(a.close_offer,NULL,a.id)) AS nr_open_offers,\r\n    \t\t\t    GROUP_CONCAT(DISTINCT IF(a.close_offer,NULL,a.id)) AS open_offers,\r\n\r\n    \t\t\t    COUNT(DISTINCT IF(a.featured='none',NULL,a.id)) AS nr_featured_offers,\r\n    \t\t\t    GROUP_CONCAT(DISTINCT IF(a.featured='none',NULL,a.id)) AS featured_offers,\r\n\r\n    \t\t\t    AVG(urate.rating) AS rating_user,\r\n    \t\t\t    u.block\r\n                FROM #__users AS u\r\n                LEFT JOIN " . $profileTable . " AS p ON u.id=p." . $profileKey . "\r\n                LEFT JOIN #__bid_auctions AS a ON u.id=a.userid\r\n                LEFT JOIN #__bid_rate AS urate ON u.id=urate.user_rated_id\r\n                LEFT JOIN #__bids AS btbl ON u.id=btbl.userid AND btbl.accept=1 " . $where . " GROUP BY u.id " . $order;
     $db->setQuery($query, $page->limitstart, $page->limit);
     $rows = $db->loadObjectList();
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['search'] = $search;
     JHTML::_('behavior.tooltip');
     $this->assignRef('lists', $lists);
     $this->assignRef('page', $page);
     $this->assignRef('rows', $rows);
     parent::display();
 }
Beispiel #4
0
    function __construct() {

        $this->_my = JFactory::getUser();

        $cfg = BidsHelperTools::getConfig();

        if ($cfg->bid_opt_allow_guest_messaging) {
            array_push($this->anonTasks, "savemessage");
        }
    }
Beispiel #5
0
 static function fbLikeButton($user)
 {
     $cfg = BidsHelperTools::getConfig();
     if (!$cfg->bid_opt_fblikebutton) {
         return;
     }
     $iframeURL = 'https://www.facebook.com/plugins/like.php?href=' . urlencode(self::userProfileURL($user));
     $iframeAttribs = 'scrolling="no" frameborder="0" class="bidsFbLikeButton"';
     return JHTML::iframe($iframeURL, APP_EXTENSION . '_fbLikeButton_' . $user->userid, $iframeAttribs);
 }
Beispiel #6
0
 static function calendar($isodate, $name)
 {
     $cfg = BidsHelperTools::getConfig();
     $result = JHTML::_('calendar', $isodate, $name, $name, BidsHelperDateTime::dateFormatConversion($cfg->date_format));
     if ($isodate) {
         //ISODATES and JHtml::_('calendar') doesn't take kindly all formats
         $result = str_replace(' value="' . htmlspecialchars($isodate, ENT_COMPAT, 'UTF-8') . '"', ' value="' . htmlspecialchars(JHtml::date($isodate, $cfg->date_format, false), ENT_COMPAT, 'UTF-8') . '"', $result);
     }
     return $result;
 }
Beispiel #7
0
    static function getUTCDate($d,$h,$m,$s) {

        $jconfig = JFactory::getConfig();
        $cfg = BidsHelperTools::getConfig();

        $error_msg = array();

        $date = BidsHelperTools::auctionDatetoIso($d);

        if(!$date) {
            return false;
        }

        $hour = $minutes = '00';
        if ($cfg->bid_opt_enable_hour) {
            $hour = $h ? $h : '00';
            $minutes = $m ? $m : '00';
            if ($hour > 24 || $minutes > 60) {
                return false;
            }
        }

        $DateTime = JFactory::getDate($date . ' ' . $hour . ':' . $minutes . ':00', $jconfig->getValue('config.offset'));
        if (!$DateTime) {
            return false;
        }

        $date = BidsHelperTools::auctionDatetoIso($d);

        if ($cfg->bid_opt_enable_hour) {
            $hour = intval($h);
            if($hour<0 || $hour>59) {
                $hour = 0;
            }
            if( 1==strlen($hour) ) {
                $hour = '0'.$hour;
            }
            $minutes = intval($m);
            if($minutes<0 || $minutes>59) {
                $minutes = 0;
            }
            if( 1==strlen($minutes) ) {
                $minutes = '0'.$minutes;
            }
        } else {
            $hour = $minutes = '00';
        }

        $DateTime = JFactory::getDate($date . ' ' . $hour . ':' . $minutes . ':00', $jconfig->getValue('config.offset'));

        return ($DateTime->toUnix() < time() ) ? JFactory::getDate()->toMySQL() : $DateTime->toMySQL();
    }
Beispiel #8
0
 function display()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $id = JRequest::getInt('id', 0, 'default', 'int');
     if (!$id) {
         $cid = JRequest::getVar('cid', array());
         $id = $cid[0];
     }
     $profile = BidsHelperTools::getUserProfileObject($id);
     $lists = array();
     $db->setQuery("SELECT\r\n                            rating,count(*) as nr,\r\n                            auction_id, a.title as auction,\r\n                            voter_id, u.username\r\n                        FROM #__bid_rate\r\n                        LEFT JOIN #__bid_auctions AS a on auction_id = a.id\r\n                        LEFT JOIN #__users AS u on voter_id = u.id\r\n                        WHERE user_rated_id=" . $db->quote($id) . "\r\n                        GROUP BY rating\r\n                        ORDER BY rating");
     $lists['ratings'] = $db->loadObjectList();
     $db->setQuery("SELECT\r\n                        m.id,\r\n                        auction_id, a.title as auction,\r\n                        u.id as from_id, u.username as fromuser,\r\n                        u2.id as to_id, u2.username as touser,\r\n                        m.modified,\r\n                        m.message,\r\n                        m.published\r\n\r\n                    FROM #__bid_messages as m\r\n                    LEFT JOIN #__bid_auctions AS a on m.auction_id = a.id\r\n                    LEFT JOIN #__users AS u on m.userid1 = u.id\r\n                    LEFT JOIN #__users AS u2 on m.userid2 = u2.id\r\n                    WHERE userid1=" . $db->quote($id) . " OR userid2 = " . $db->quote($id));
     $lists['messages'] = $db->loadObjectList();
     $query = "SELECT COUNT(*) AS nr_auctions,MAX(modified) AS last_auction_date FROM #__bid_auctions WHERE userid='{$id}'";
     $db->setQuery($query);
     $res = $db->loadAssocList();
     $lists['nr_auctions'] = $res[0]['nr_auctions'];
     $lists['last_auction_placed'] = $res[0]['last_auction_date'];
     $query = "select count(*) as nr_bids_won from #__bids where userid='{$id}' and accept=1 ";
     $db->setQuery($query);
     $res = $db->loadAssocList();
     $lists['nr_won_bids'] = $res[0]['nr_bids_won'];
     $query = "select count(*) as nr_bids, max(modified) as last_date from #__bids where userid='{$id}' ";
     $db->setQuery($query);
     $res = $db->loadAssocList();
     $lists['nr_bids'] = $res[0]['nr_bids'];
     $lists['last_bid_placed'] = $res[0]['last_date'];
     $query = "select c.*, a.title, a.BIN_price, cr.name as currency\r\n\t\tFROM #__bids as c\r\n\t\tLEFT join #__bid_auctions as a on c.auction_id = a.id\r\n\t\tLEFT join #__bid_currency as cr on a.currency = cr.id\r\n\t\tWHERE c.userid = '{$id}'";
     $db->setQuery($query);
     $lists['bids'] = $db->loadObjectList();
     $query = "SELECT * FROM #__bid_payment_balance WHERE userid=" . $db->quote($id);
     $db->setQuery($query);
     $r = $db->loadObject();
     $lists['balance'] = new stdClass();
     $lists['balance']->balance = isset($r->balance) ? $r->balance : 0;
     $lists['balance']->currency = isset($r->currency) ? $r->currency : '';
     $u = JTable::getInstance('user');
     $u->load($profile->id);
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('sliders', array('allowAllClose' => true));
     JHTML::_('behavior.tooltip');
     $this->assignRef('lists', $lists);
     $this->assignRef('pane', $pane);
     $this->assignRef('u', $u);
     $this->assignRef('user', $profile);
     parent::display();
 }
Beispiel #9
0
    function setPagination() {

        jimport('joomla.html.pagination');
        $app = JFactory::getApplication();
        $jconfig = &JFactory::getConfig();

        $cfg = BidsHelperTools::getConfig();

        $limit = $cfg->bid_opt_nr_items_per_page>0 ? $cfg->bid_opt_nr_items_per_page : $jconfig->getValue('config.list_limit');
        $this->setState('limit', $app->getUserStateFromRequest($this->context.'limit','limit',$limit));
        $this->setState('limitstart', JRequest::getVar('limitstart', 0, 'default', 'int'));
        // In case limit has been changed, adjust limitstart accordingly
        //$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));

        $this->pagination = new JPagination( $this->countTotal(), $this->getState('limitstart'), $this->getState('limit'));
    }
Beispiel #10
0
 function _selectProfileIntegrationFilter($filterName, $filterValue = null)
 {
     static $filters = array();
     if (!isset($filters[$filterName])) {
         $db = JFactory::getDbo();
         $profile = BidsHelperTools::getUserProfileObject();
         $tableField = $profile->getFilterField($filterName);
         $tableName = $profile->getFilterTable($filterName);
         $query = 'SELECT DISTINCT `' . $tableField . '` AS value, `' . $tableField . '` AS text FROM `' . $tableName . '`' . 'WHERE `' . $tableField . '`<>\'\'';
         $db->setQuery($query);
         $rows = array();
         $rows[] = JHTML::_('select.option', '', JText::_('COM_BIDS_ALL'));
         $rows = array_merge($rows, $db->loadObjectList());
         $filters[$filterName] = JHTML::_('select.genericlist', $rows, 'user_profile%' . $tableField, 'class="inputbox"', 'value', 'text', $filterValue);
     }
     return $filters[$filterName];
 }
Beispiel #11
0
    function getUserProfile($userid=null) {

        parent::getUserProfile($userid);

        $cfg = BidsHelperTools::getConfig();

        //override main profile behavior with some component specific rules
        if(!$cfg->bid_opt_enable_acl) {
            $this->isSeller = 1-$this->guest;
            $this->isBidder = 1-$this->guest;
        } else {
            $u = JFactory::getUser($userid);

            $this->isBidder = count( array_intersect($u->groups,$cfg->bid_opt_bidder_groups) ) ? 1:0;
            $this->isSeller = count( array_intersect($u->groups,$cfg->bid_opt_seller_groups) ) ? 1:0;
        }
    }
Beispiel #12
0
	static function &getGalleryPlugin()
    {
        static $gallery;
        if (isset($gallery)&&is_object($gallery))
            return $gallery;
            	   
        $cfg= BidsHelperTools::getConfig();
		$gallery_name = "gl_".$cfg->bid_opt_gallery;
		require_once(JPATH_COMPONENT_SITE.DS."gallery".DS."$gallery_name.php");
        
		$gallery = new $gallery_name( AUCTION_PICTURES,
            $cfg->bid_opt_medium_width,
            $cfg->bid_opt_medium_height,
            $cfg->bid_opt_thumb_width,
            $cfg->bid_opt_thumb_height
         );
		return $gallery;
	}
Beispiel #13
0
 function getItemPrice()
 {
     $userprofile = BidsHelperTools::getUserProfileObject();
     $userprofile->getUserProfile();
     $r = $this->loadPricingObject();
     $params = new JParameter($r->params);
     if (isset($userprofile->powerseller) && $userprofile->powerseller) {
         $defaultprice = $params->get('price_powerseller', $r->price);
     } elseif (isset($userprofile->verified) && $userprofile->verified) {
         $defaultprice = $params->get('price_verified', $r->price);
     } else {
         $defaultprice = $r->price;
     }
     $res = new stdClass();
     $res->price = $defaultprice;
     $res->currency = $r->currency;
     return $res;
 }
Beispiel #14
0
    function display() {
        $app = JFactory::getApplication();
        // Get the page/component configuration
        $params = $app->getParams();
        $database = JFactory::getDBO();

        $searchType = $params->get("user_type");
        $this->assign("search_type", $searchType);


        if ($params->get('show_page_title', 1)) {

            $page_title = $this->escape($params->get('page_title'));
            if ($page_title == "") {
                $page_title = JText::_("COM_BIDS_SEARCH_USERS");
            }
            $this->assign("page_title", $page_title);
        }

        $extra_field_list = $params->get('extra_fields', array());

        $lists['country']["label"] = "Country";
        $lists['country']["html"] = BidsHelperHtml::selectCountry("country");

        JHTML::_('behavior.calendar');

        $profileMode = BidsHelperTools::getProfileMode();
        if('component'==$profileMode) {
            $fields = CustomFieldsFactory::getSearchableFieldsList('user_profile');
            $lists['custom_fields'] = JHtml::_('customfields.displaysearchhtml',$fields);
            //$this->assign('customFilters', $customFilters);
        }

        $lists["city"]["label"] = JText::_("COM_BIDS_CITY");
        $lists["city"]["html"] = '<input type="text" name="city" />';
        $lists["name"]["label"] = JText::_('COM_BIDS_NAME');
        $lists["name"]["html"] = '<input type="text" name="name" />';

        $this->assign('lists', $lists);

        $this->assign("search_fields", $extra_field_list);

        parent::display('elements/search/t_search_users.tpl');
    }
Beispiel #15
0
    function display($tmpl) {

        $database = JFactory::getDBO();
        $my = JFactory::getUser();
        $cfg = BidsHelperTools::getConfig();

        $lists = array();

        $user = BidsHelperTools::getUserProfileObject($my->id);
        JFilterOutput::objectHTMLSafe( $user, ENT_QUOTES );

        $opts = array();
        $opts[] = JHTML::_('select.option', '', JText::_('COM_BIDS_CHOOSE_COUNTRY'));

        $database->setQuery("SELECT name AS value,name AS text FROM `#__bid_country` WHERE active=1 order by name");
        $opts = array_merge($opts, $database->loadObjectList());

        $lists["country"] = JHTML::_('select.genericlist', $opts, 'country', 'class="inputbox required"', 'value', 'text', $user->country);

        $lists['token'] = JHtml::_('form.token');

        $lists["validate_custom_fields"] = " new Array()";
        $lists["validate_custom_fields_count"] = "0";

        $fields = CustomFieldsFactory::getFieldsList("user_profile");
        $fields_html=JHtml::_('customfields.displayfieldshtml',$user,$fields);

        JHTML::_('behavior.formvalidation');
        JHTML::script(JURI::root().'components/com_bids/js/validator/validator.js');

        $formAction =
                ( !$my->id && 'component'==$cfg->bid_opt_registration_mode && 'component'==$cfg->bid_opt_profile_mode ) ?
                (JUri::root().'index.php?option=com_users&task=registration.register') :
                (JUri::root().'/index.php?option=com_bids&task=saveuserdetails') ;

        $this->assign("custom_fields_html", $fields_html );
        $this->assign("user", $user);
        $this->assign("formAction", $formAction);
        $this->assign("lists", $lists);

        parent::display($tmpl);
    }
Beispiel #16
0
 function getItemPrice($category)
 {
     $userprofile = BidsHelperTools::getUserProfileObject();
     $userprofile->getUserProfile();
     $r = $this->loadPricingObject();
     $params = new JParameter($r->params);
     if (isset($userprofile->powerseller) && $userprofile->powerseller) {
         $defaultprice = $params->get('price_powerseller', $r->price);
     } elseif (isset($userprofile->verified) && $userprofile->verified) {
         $defaultprice = $params->get('price_verified', $r->price);
     } else {
         $defaultprice = $r->price;
     }
     $db = $this->getDbo();
     $db->setQuery("select price from `#__" . APP_PREFIX . "_pricing_categories` where `itemname`='" . $this->name . "' and category='{$category}'");
     $price = $db->loadResult();
     $res = new stdClass();
     $res->price = $price === NULL ? $defaultprice : $price;
     $res->currency = $r->currency;
     return $res;
 }
Beispiel #17
0
    function display($tmpl) {

        $model = $this->getModel('suggestions');

        $userProfile = BidsHelperTools::getUserProfileObject();

        $filter_bidtype = $model->getState('filters.filter_bidtype');
        $lists['filter_bidtype'] = JHTML::_('listauctions.selectBidType', $filter_bidtype );
        $sfilters['bid_type'] = $filter_bidtype;

        $gallery = BidsHelperGallery::getGalleryPlugin();

        $suggestions = $model->get('suggestions');
        $rownr = 0;
        foreach($suggestions as &$s) {
            $s->rownr = ++$rownr;
            $s->links = JHTML::_('auctiondetails.createLinks',$s);
            BidsHelperAuction::renderAuctionTiming($s);
            $s->countdownHtml = JHTML::_('auctiondetails.countdownHtml',$s);

            $gallery->clearImages();
            $gallery->addImageList(explode(',', $s->pictures));
            $s->thumbnail = $gallery->getThumbImage();
        }

        JHTML::script(JURI::root().'components/com_bids/js/jquery/jquery.js');
        JHTML::script(JURI::root().'components/com_bids/js/jquery/jquery.noconflict.js');

        BidsHelperHtml::loadCountdownJS();

        JHTML::script( JURI::root().'components/com_bids/js/startup.js' );

        $this->assign('auction_rows', $suggestions);
        $this->assign('pagination', $model->get('pagination') );
        $this->assign('lists', $lists);
        $this->assign('sfilters', $sfilters);
        $this->assign('userProfile',$userProfile);

        parent::display($tmpl);
    }
Beispiel #18
0
    function display() {

        $model = $this->getModel('auctions');

        $lists = array();
        $lists['users'] = JHTML::_('searchform.selectUsers',$model->getState('filters.users') );
        $lists['active_users'] = JHTML::_('searchform.selectActiveUsers', $model->getState('filters.username') );
        $lists['cats'] = JHTML::_('searchform.selectCategory', $model->getState('filters.cat') );
        $lists['tags'] = JHTML::_('searchform.inputTags', $model->getState('filters.tagnames') );
        $lists['after_calendar'] = JHTML::calendar($model->getState('filters.afterd'),'afterd','afterd','%Y-%m-%d');
        $lists['before_calendar'] = JHTML::calendar($model->getState('filters.befored'),'befored','befored','%Y-%m-%d');
        $lists['startprice'] = JHTML::_('searchform.inputPrice', 'startprice', $model->getState('filters.startprice') );
        $lists['endprice'] = JHTML::_('searchform.inputPrice', 'endprice', $model->getState('filters.endprice') );
        $lists['currency'] = JHTML::_('searchform.selectCurrency', 'currency', $model->getState('filters.currency'));
        $lists['inputReset'] = JHTML::_('searchform.inputReset');

        //filters for integration fields

        $profile = BidsHelperTools::getUserProfileObject();
        $integrationArray = $profile->getIntegrationArray();
        foreach($integrationArray as $alias=>$fieldName) {
            if(''!=$fieldName) {
                $lists[$alias] = JHTML::_('searchform._selectProfileIntegrationFilter', $fieldName, $model->getState('filters.user_profile%'.$fieldName) );
            }
        }

        JHTML::_('behavior.calendar');

        JHTML::script(JURI::root() . 'components/com_bids/js/auctions.js');

        $fields = CustomFieldsFactory::getSearchableFieldsList('auctions');
        $fields_html=JHtml::_('customfields.displaysearchhtml',$fields,'divs');

        $this->assign('lists', $lists);
        $this->assign("custom_fields_html", $fields_html );

        parent::display('t_search.tpl');
    }
Beispiel #19
0
JFactory::getLanguage()->load('com_bids');
jimport('joomla.html.parameter');

$jdoc = JFactory::getDocument();
$js = "
        var days='".JText::_('COM_BIDS_DAYS').",';
        var expired='".JText::_('COM_BIDS_EXPIRED')."';

	window.addEvent('domready', function() {
		if ((typeof moduleSetTimeLeft =='function'))
			moduleSetTimeLeft('modulebidstime{$mid}_',".count($rows).");
	});
";
$jdoc->addScriptDeclaration( $js );

$Itemid = BidsHelperTools::getMenuItemId( array("task" => "listauctions") , 1 );
?>

<table width="100%" class="mod_bids_table_vertical" cellpadding="0" cellspacing="0" border="0">
	<?php
        $i=1;
	foreach($rows as $row) {

		$overlib_str = $row->title.'::';
		$overlib_str .= JText::_("By")." ".$row->by_user."<br />";

		if($row->auction_type == 1){
			$overlib_str .= JText::_("Start Bid").": ".BidsHelperAuction::formatPrice($row->initial_price)." ".$row->currency;
		}

		if( $i%2 == 0 ){
Beispiel #20
0
    static function getItemsPerPage()
    {
        $jconfig = JFactory::getConfig();
        $cfg = BidsHelperTools::getConfig();

        return $cfg->bid_opt_nr_items_per_page>0 ? $cfg->bid_opt_nr_items_per_page : $jconfig->getValue('config.list_limit');         
    }
Beispiel #21
0
    function getUserCountries()
    {
        $db= $this->getDbo();
        $query = JTheFactoryDatabase::getQuery();
        $profile = BidsHelperTools::getUserProfileObject();
        $field = $profile->getFilterField('country');
        $table = $profile->getFilterTable('country');

        
        $query->select("distinct `{$field}` country");
        $query->from($table);
        $query->where("`{$field}`<>'' and `{$field}` is not null");
        $db->setQuery((string)$query);
        return $db->loadObjectList();
        
    }
Beispiel #22
0
 function display($tpl = null)
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_bids', JPATH_SITE);
     $model = $this->getModel('auction');
     $auction = $model->get('auction');
     $bidCfg = BidsHelperTools::getConfig();
     $lists = array();
     $lists['title'] = JHTML::_('editauction.inputTitle', $auction, 1);
     $lists['cats'] = JHTML::_('editauction.selectCategory', $auction, 1);
     //$lists['cats']    = JHTML::_('factorycategory.select','cat','',$auction->cat,false,false,true);
     $lists['published'] = JHTML::_('editauction.selectPublished', $auction, 1);
     $lists['tags'] = JHTML::_('editauction.inputTags', $auction, 1);
     $lists['shortDescription'] = JHTML::_('editauction.inputShortDescription', $auction, 1);
     $lists['description'] = JHTML::_('editauction.inputDescription', $auction, 1);
     $lists['auctiontype'] = JHTML::_('editauction.selectAuctionType', $auction, 1);
     $lists['automatic'] = JHTML::_('editauction.inputAutomatic', $auction, 1);
     $lists['binType'] = JHTML::_('editauction.selectBINType', $auction, 1);
     $lists['binPrice'] = JHTML::_('editauction.inputBINPrice', $auction, 1);
     $lists['autoAcceptBIN'] = JHTML::_('editauction.selectAutoAcceptBIN', $auction, 1);
     $lists['quantity'] = JHTML::_('editauction.inputQuantity', $auction, 1);
     $lists['enableSuggestions'] = JHTML::_('editAuction.selectEnableSuggestions', $auction, 1);
     $lists['minNumberSuggestions'] = JHTML::_('editAuction.inputMinNumberSuggestions', $auction, 1);
     $lists['currency'] = JHTML::_('editauction.selectCurrency', $auction, 1);
     $lists['initialPrice'] = JHTML::_('editauction.inputInitialPrice', $auction, 1);
     $lists['showMaxPrice'] = JHTML::_('editauction.selectShowMaxPrice', $auction, 1);
     $lists['showNumberBids'] = JHTML::_('editauction.selectShowNumberBids', $auction, 1);
     $lists['reservePrice'] = JHTML::_('editauction.inputReservePrice', $auction, 1);
     $lists['showReservePrice'] = JHTML::_('editauction.selectShowReservePrice', $auction, 1);
     $lists['minIncrease'] = JHTML::_('editauction.inputMinIncrease', $auction, 1);
     $lists['shippingPrice'] = JHTML::_('editAuction.inputShipmentPrice', $auction, 1);
     $lists['uploadImages'] = JHTML::_('editauction.uploadImages', $auction, 1);
     $lists['paymentInfo'] = JHTML::_('editauction.textPaymentInfo', $auction, 1);
     $lists['shipmentInfo'] = JHTML::_('editauction.textShipmentInfo', $auction, 1);
     //$lists[''] = JHTML::_('editauction.',$auction);
     $lists['currentLocalTime_field'] = JHTML::_('editAuction.currentLocalTime', $auction);
     $lists['startDate_field'] = JHTML::_('editAuction.editStartDate', $auction, 1);
     $lists['endDate_field'] = JHTML::_('editAuction.editEndDate', $auction, 1);
     $lists['editFormTitle'] = JHTML::_('editAuction.formTitle', $auction);
     $auction->links = JHTML::_('auctiondetails.createLinks', $auction);
     $fields = CustomFieldsFactory::getFieldsList("auctions");
     $fields_html = JHtml::_('listauctions.displayfieldshtml', $auction, $fields);
     $custom_fields_with_cat = $model->getNrFieldsWithFilters();
     $this->assign("custom_fields", $fields);
     $this->assign("custom_fields_html", $fields_html);
     $this->assign("custom_fields_with_cat", $custom_fields_with_cat ? 1 : 0);
     $this->assign('lists', $lists);
     $this->assign('auction', $auction);
     $this->assign('bidCfg', $bidCfg);
     JHtml::_('behavior.framework');
     JHtml::_('behavior.tooltip');
     JHtml::_('behavior.calendar');
     JHTML::_('behavior.formvalidation');
     JHtml::script(JURI::root() . 'components/com_bids/js/auctions.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/date.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/multifile.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/auction_edit.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.noconflict.js');
     JHTML::script(JURI::root() . 'components/com_bids/js/jquery/clock/jquery.clock.js');
     JHtml::script(JURI::base() . 'index.php?option=com_bids&task=jsgen&view=editauction&format=raw');
     JHtml::stylesheet(JURI::root() . 'components/com_bids/templates/default/bid_template.css');
     parent::display($tpl);
 }
Beispiel #23
0
 function display($id)
 {
     $database = JFactory::getDBO();
     $my = JFactory::getUser();
     $modelAuction = $this->getModel('auction');
     $auction = $modelAuction->get('auction');
     $lists = array();
     $lang = JFactory::getLanguage();
     $lang->load('com_bids', JPATH_SITE);
     $bidCfg = BidsHelperTools::getConfig();
     $lists = array();
     $lists['title'] = JHTML::_('editauction.inputTitle', $auction, 1);
     $lists['cats'] = JHTML::_('editauction.selectCategory', $auction, 1);
     //$lists['cats']    = JHTML::_('factorycategory.select','cat','',$auction->cat,false,false,true);
     $lists['published'] = JHTML::_('editauction.selectPublished', $auction, 1);
     $lists['tags'] = JHTML::_('editauction.inputTags', $auction, 1);
     $lists['shortDescription'] = JHTML::_('editauction.inputShortDescription', $auction, 1);
     $lists['description'] = JHTML::_('editauction.inputDescription', $auction, 1);
     $lists['auctiontype'] = JHTML::_('editauction.selectAuctionType', $auction, 1);
     $lists['automatic'] = JHTML::_('editauction.inputAutomatic', $auction, 1);
     $lists['binType'] = JHTML::_('editauction.selectBINType', $auction, 1);
     $lists['binPrice'] = JHTML::_('editauction.inputBINPrice', $auction, 1);
     $lists['autoAcceptBIN'] = JHTML::_('editauction.selectAutoAcceptBIN', $auction, 1);
     $lists['quantity'] = JHTML::_('editauction.inputQuantity', $auction, 1);
     $lists['enableSuggestions'] = JHTML::_('editAuction.selectEnableSuggestions', $auction, 1);
     $lists['minNumberSuggestions'] = JHTML::_('editAuction.inputMinNumberSuggestions', $auction, 1);
     $lists['currency'] = JHTML::_('editauction.selectCurrency', $auction, 1);
     $lists['initialPrice'] = JHTML::_('editauction.inputInitialPrice', $auction, 1);
     $lists['showMaxPrice'] = JHTML::_('editauction.selectShowMaxPrice', $auction, 1);
     $lists['showNumberBids'] = JHTML::_('editauction.selectShowNumberBids', $auction, 1);
     $lists['reservePrice'] = JHTML::_('editauction.inputReservePrice', $auction, 1);
     $lists['showReservePrice'] = JHTML::_('editauction.selectShowReservePrice', $auction, 1);
     $lists['minIncrease'] = JHTML::_('editauction.inputMinIncrease', $auction, 1);
     $lists['shippingPrice'] = JHTML::_('editAuction.inputShipmentPrice', $auction, 1);
     $lists['uploadImages'] = JHTML::_('editauction.uploadImages', $auction, 1);
     $lists['paymentInfo'] = JHTML::_('editauction.textPaymentInfo', $auction, 1);
     $lists['shipmentInfo'] = JHTML::_('editauction.textShipmentInfo', $auction, 1);
     //$lists[''] = JHTML::_('editauction.',$auction);
     $lists['currentLocalTime_field'] = JHTML::_('editAuction.currentLocalTime', $auction);
     $lists['startDate_field'] = JHTML::_('editAuction.editStartDate', $auction, 1);
     $lists['endDate_field'] = JHTML::_('editAuction.editEndDate', $auction, 1);
     $lists['editFormTitle'] = JHTML::_('editAuction.formTitle', $auction);
     $auction->links = JHTML::_('auctiondetails.createLinks', $auction);
     $fields = CustomFieldsFactory::getFieldsList("auctions");
     $fields_html = JHtml::_('listauctions.displayfieldshtml', $auction, $fields);
     $custom_fields_with_cat = $modelAuction->getNrFieldsWithFilters();
     $this->assign("custom_fields", $fields);
     $this->assign("custom_fields_html", $fields_html);
     $this->assign("custom_fields_with_cat", $custom_fields_with_cat ? 1 : 0);
     $this->assign('lists', $lists);
     $this->assign('auction', $auction);
     $this->assign('bidCfg', $bidCfg);
     JHtml::_('behavior.framework');
     JHtml::_('behavior.tooltip');
     JHtml::_('behavior.calendar');
     JHTML::_('behavior.formvalidation');
     JHtml::script(JURI::root() . 'components/com_bids/js/auctions.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/date.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/multifile.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/auction_edit.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.noconflict.js');
     JHTML::script(JURI::root() . 'components/com_bids/js/jquery/clock/jquery.clock.js');
     JHtml::script(JURI::base() . 'index.php?option=com_bids&task=jsgen&view=editauction&format=raw');
     JHtml::stylesheet(JURI::root() . 'components/com_bids/templates/default/bid_template.css');
     $user = BidsHelperTools::getUserProfileObject($auction->userid);
     $auction->userdetails = $user;
     $query = "update #__bid_messages set wasread=1 where userid2='{$my->id}' and auction_id='{$id}'";
     $database->setQuery($query);
     $database->query();
     $query = "update #__bid_auctions set newmessages=0 where id='{$id}'";
     $database->setQuery($query);
     $database->query();
     $feat[] = JHTML::_('select.option', 'none', JText::_('COM_BIDS_NONE'));
     $feat[] = JHTML::_('select.option', 'featured', JText::_('COM_BIDS_PAYMENT_FEATURED'));
     $lists['featured'] = JHTML::_('select.genericlist', $feat, 'featured', 'class="inputbox" id="featured" style="width:120px;"', 'value', 'text', $auction->featured);
     $database = JFactory::getDBO();
     $my = JFactory::getUser();
     $database->setQuery("select max(bid_price) from #__bids where auction_id='{$auction->id}'");
     $auction->max_bid = $database->loadResult();
     $database->setQuery("select * from #__bid_pictures where auction_id='{$auction->id}'");
     $photos = $database->loadObjectList();
     $query = "select m.*,u1.username as fromuser, u2.username as touser  from #__bid_messages m\r\n                            left join #__users u1 on u1.id = m.userid1\r\n                            left join #__users u2 on u2.id = m.userid2\r\n                            where m.auction_id='{$auction->id}'\r\n\r\n            ";
     // and (m.userid1 = '$my->id' or m.userid2 = '$my->id') */
     $database->setQuery($query);
     $adminMessages = $database->loadObjectList();
     $query = "\r\n            SELECT a.*,b.username, bp.max_proxy_price\r\n            FROM `#__bids` AS a\r\n            LEFT JOIN `#__users` b\r\n                ON a.userid=b.id\r\n            LEFT JOIN `#__bid_proxy` AS bp\r\n                ON a.id_proxy=bp.id AND bp.active=1\r\n            WHERE a.auction_id=" . intval($auction->id);
     $database->setQuery($query);
     $bids = $database->loadObjectList();
     JHTML::_('behavior.modal');
     JHTML::_('behavior.tooltip');
     jimport('joomla.filesystem.file');
     $this->assignRef('lists', $lists);
     $this->assignRef('bids', $bids);
     $this->assignRef('adminMessages', $adminMessages);
     $this->assignRef('photos', $photos);
     $this->assignRef('user', $user);
     $this->assignRef('auction', $auction);
     parent::display();
 }
Beispiel #24
0
<?php

defined('_JEXEC') or die('Restrited access.');
$bidCfg = BidsHelperTools::getConfig();
$lang = JFactory::getLanguage();
$lang->load('com_bids', JPATH_SITE);
?>
function html_entity_decode(str)
{
    //jd-tech.net
    var tarea=document.createElement('textarea');
    tarea.innerHTML = str; return tarea.value;
    tarea.parentNode.removeChild(tarea);
}


function dateformat(php_format)
{
    d='y-mm-dd';
    if (php_format=='Y-m-d') d='y-mm-dd';
    if (php_format=='Y-d-m') d='y-dd-mm';
    if (php_format=='m/d/Y') d='mm/dd/y';
    if (php_format=='d/m/Y') d='dd/mm/y';
    if (php_format=='D, F d Y') d='y-mm-dd';

    return d;
}

function termsAlert(){
    var txt_info = language['bid_err_terms'];
    alert(txt_info);
Beispiel #25
0
    function cron()
    {
        /* cron script Pass and authentication*/
        $cfg=BidsHelperTools::getConfig();
        $config =JFactory::getConfig();
        $pass=JRequest::getVar('pass');
        $debug= JRequest::getVar('debug',0);

        $date=new JDate();
        $nowMysql=$date->toMySQL(false);

        $database = JFactory::getDbo();

        JTheFactoryHelper::modelIncludePath('payments');
        JTheFactoryHelper::tableIncludePath('payments');

        $log= JTable::getInstance('bidcronlog');
        $log->priority='log';
        $log->event='cron';
        $log->logtime=$nowMysql;
        $logtext="";

        if ($cfg->bid_opt_cron_password!==$pass) {
            //Bad Password, log and exit;
            $log->log=JText::_("COM_BIDS_BAD_PASSWORD_USED")." > $pass";
            $log->store();
            die(JText::_("COM_BIDS_ACCESS_DENIED"));
        }
    	@set_time_limit(0);
    	@ignore_user_abort(true);



        // reminder for due to expire suggestions
        $database->setQuery(" SELECT s.auction_id,a.userid
                                FROM #__bid_suggestions AS s
                                LEFT JOIN #__bid_auctions AS a
                                    ON s.auction_id = a.id
                                WHERE
                                    s.status=2
                                    AND UTC_TIMESTAMP() > DATE_ADD( s.modified, INTERVAL 24 HOUR)
                                    AND a.published=1
                                    AND a.close_offer=0
                                    AND a.close_by_admin=0
                                    AND UTC_TIMESTAMP() < a.end_date
                                GROUP BY s.auction_id");
        $curs = $database->loadObjectList();
        
        if(count($curs)>0) {
            $auction =  JTable::getInstance('auction');
            $userIds = array();
        
            foreach($curs as $k=>$val) {
                $userIds[] = $val->userid;
            }
            $database->setQuery('SELECT u.* FROM #__users AS u WHERE u.id IN ( '.implode(',',$userIds).' )');
            $mails = $database->loadObjectList();
            $auction->SendMails($mails,'suggest_reminder'); //Notyfy Sellers abour pending suggestions
        }
        
        // reject expired suggestions
        $database->setQuery(" SELECT a.id AS suggestionId,a.auction_id,b.userid
                                FROM #__bid_suggestions AS a
                                LEFT JOIN #__bid_auctions AS b
                                    ON a.auction_id = b.id
        			WHERE
                                    UTC_TIMESTAMP() > DATE_ADD( a.modified, INTERVAL 48 HOUR)
                                    AND a.status=2");
        $curs = $database->loadObjectList();
        
        if(count($curs)>0) {
            $auction =  JTable::getInstance('auction');
            $userIds = array();
            $suggestionIds = array();
        
            foreach($curs as $k=>$val) {
                $suggestionIds[] = $val->suggestionId;
                $userIds[] = $val->userid;
            }
        
            $database->setQuery('UPDATE #__bid_suggestions SET status=0 WHERE id IN ('.implode(',',$suggestionIds).')');
            $database->query();// reject the suggestions
        
            $database->setQuery('SELECT u.* FROM #__users AS u WHERE u.id IN ( '.implode(',',$userIds).' )');
            $mails = $database->loadObjectList();
            $auction->SendMails($mails,'suggest_rejected'); //Notyfy Bidders abour rejected suggestion
        }
        
        //CLOSE auctions
        $query = "SELECT
                        a.*,
                        a.id as auctionId,
                        GROUP_CONCAT(b.userid) AS bidderIds,
                        GROUP_CONCAT(w.userid) AS watcherIds
                    FROM #__bid_auctions AS a
                    LEFT JOIN #__bids AS b
                        ON a.id=b.auction_id
                    LEFT JOIN #__bid_watchlist AS w
                        ON a.id=w.auction_id
                    WHERE
                        UTC_TIMESTAMP() >= a.end_date
                        AND a.close_offer = 0
                        AND a.published = 1
                        AND a.close_by_admin=0
                    GROUP BY a.id";
        $database->setQuery($query);
        $rows = $database->loadObjectList('auctionId');


        $extendedAuctions = array();
        if($cfg->bid_opt_auto_extent && $cfg->bid_opt_auto_extent_nobids) {
            //these auctions have no bids and will be extended
            foreach($rows as $id=>$r) {
                if(!$r->bidderIds) {
                    $extendedAuctions[] = $id;
                }
            }
        }

        if(count($rows)>0) {
            $auction =  JTable::getInstance('auction');

            //exclude auctions that are going to be extended
            $closeAuctions = array_diff(array_keys($rows),$extendedAuctions);
            if(count($closeAuctions)) {
                $database->setQuery('UPDATE
                                        #__bid_auctions
                                     SET
                                        close_offer=1,
                                        closed_date=UTC_TIMESTAMP()
                                     WHERE
                                        id IN ('.implode(',',  $closeAuctions).')');
                $database->query();
            }
        
            foreach ($rows as $r) {
                //Notify bidders
                $auction->bind($r);
        
                //extend auctions with no bids
                if($cfg->bid_opt_auto_extent && $cfg->bid_opt_auto_extent_nobids>0 && !$r->bidderIds) {
                    $extendedPeriodSeconds = $cfg->bid_opt_auto_extent_nobids * BidsHelperDateTime::translateAutoextendPeriod($cfg->bid_opt_auto_extent_nobids_type);
                    $endTime = BidsHelperDateTime::getTimeStamp($auction->end_date);
                    $newEndTime = $endTime + $extendedPeriodSeconds;

                    $auction->end_date = gmdate('Y-m-d H:i:s',$newEndTime);
                    $auction->store();

                    continue;
                }
        
                jimport('joomla.application.component.model');
                JModelLegacy::addIncludePath(JPATH_COMPONENT_SITE.DS.'models');
                $auctionmodel = JModelLegacy::getInstance('auction','bidsModel');
                $auctionmodel->load($r->auctionId);
        
                $seller = JTable::getInstance('user');
                $seller->load($r->userid);
        
                if($r->automatic) {
        
                    $a = $auctionmodel->get('auction');
                    $highestBid = $a->highestBid;
        
                    $nrHighestBids = 1;
                    if( AUCTION_TYPE_PRIVATE == $a->auction_type ) {
                        if($highestBid) {
                            $query = 'SELECT COUNT(1) AS nrHighestBids
                                        FROM #__bids
                                        WHERE
                                            auction_id='.$r->auctionId.'
                                            AND bid_price='.$highestBid->bid_price;
                            $database->setQuery($query);
                            $nrHighestBids = $database->loadResult();
                        }
                        else {
                            $nrHighestBids = 0;
                        }
                    }
        
                    if($highestBid) {
                        if ($nrHighestBids>1) {
                            //mark auction as NOT automatic and alert owner that 2 or more bids are the same
                            $database->setQuery('UPDATE #__bid_auctions SET automatic=0 WHERE id='.$a->id);
                            $database->query();
        
                            $auctionmodel->SendMails(array($seller),'bid_choose_winner');
                        } else {
                            if ($cfg->bid_opt_global_enable_reserve_price && $a->reserve_price>0 && $a->reserve_price>=$highestBid->bid_price) {
                                //reserve price not met!
                                $auctionmodel->SendMails(array($seller),'bid_reserve_not_met');//reserve price not met
                            } else {
                                $bid = JTable::getInstance('bid');
                                $bid->bind($highestBid);
                                $auctionmodel->close($bid);
                            }
                        }
                    } else {
                        $auctionmodel->SendMails(array($seller),'bid_offer_no_winner_to_owner');
                    }
        
                } else {
                    // Notify owner to choose winner OR that his auction has no winner
                    $auctionmodel->SendMails(array($seller), $r->bidderIds ? 'bid_choose_winner' : 'bid_offer_no_winner_to_owner');
                }
        
                if($r->bidderIds) {
                    $database->setQuery('SELECT u.* FROM #__users AS u WHERE u.id IN ('.$r->bidderIds.')');
                    $mails = $database->loadObjectList();
                    $auctionmodel->SendMails($mails,'bid_closed'); //Notyfy Bidders abour closed Auction
        
                    $database->setQuery('DELETE FROM #__bid_watchlist WHERE auction_id='.$r->id.' AND userid IN ('.$r->bidderIds.')');
                    $database->query();//delete bidders from watchlist, to avoid double notification
                }
                //Notify  Watchlist, Clean Watchlist
                if($r->watcherIds) {
                    $database->setQuery('SELECT u.* FROM #__users AS u WHERE u.id IN ('.$r->watcherIds.')');
                    $mails = $database->loadObjectList();
                    $auctionmodel->SendMails($mails,'bid_watchlist_closed'); //Notify Watchlist
        
                    $database->setQuery('DELETE FROM #__bid_watchlist WHERE auction_id='.$r->id);
                    $database->query();
                }
            }
        }
        
        // END EXPIRED AUCTION
    
    
        //Daily Jobs (things that should run once a day )
        $daily= JRequest::getVar('daily','');
        if ($daily){
            //Notify upcoming expirations
        	$query = "SELECT a.* from #__bid_auctions AS a
        		 	  WHERE UTC_TIMESTAMP() >= DATE_ADD(end_date,INTERVAL -1 DAY) AND a.close_offer != 1 AND published = 1 AND a.close_by_admin!=1";
        	$database->setQuery($query);
        	$rows = $database->loadObjectList();
    
        	$auction =  JTable::getInstance('auction');
  	        
            $logtext.=sprintf("Soon to expire: %d auctions\r\n",count($rows));
    
            foreach ($rows as $row){
                    $auction->load($row->id);
                    $usr=JFactory::getUser($row->userid);
                    $auction->SendMails(array($usr),'bid_your_will_expire'); // Notify Owner that his auction will soon expire
    
                    $query = "SELECT u.* FROM #__users u
                            left join #__bid_watchlist w on u.id = w.userid
                            where w.auction_id = ".$row->id;
    
                    $database->setQuery($query);
                    $watchlist_mails = $database->loadObjectList();
                    $auction->SendMails($watchlist_mails,'bid_watchlist_will_expire'); //Notify Users in watchlist that an auction will expire
            }
    
        	//Close all auctions without a parent user (deleted users?)s
        	$query = "UPDATE
                        #__bid_auctions AS a
                        LEFT JOIN #__users AS b
                            ON a.userid=b.id
                        SET
                            close_by_admin=1,
                            closed_date=UTC_TIMESTAMP()
                        WHERE b.id IS NULL";
        	$database->setQuery($query);
        	$database->query();
            //delete Very old auctions (past Archived time)
        	$interval =  intval($bidCfg->bid_opt_archive);
            $d_opt = ( $bidCfg->bid_opt_archive_type!='') ? $bidCfg->bid_opt_archive_type : 'month';
            $d_opt_sql = strtoupper($d_opt);
        	if ($interval>0){
            	$query = "SELECT id
                                FROM #__bid_auctions
                                WHERE UTC_TIMESTAMP() > DATE_ADD( closed_date, INTERVAL $interval
                                {$d_opt_sql} )
                                AND (close_offer =1
                                or  close_by_admin=1)";
                $database->setQuery($query);
                $idx = $database->loadResultArray(); //select auctions that have to be purged
    
    
                $row =  JTable::getInstance('auction');
                if (count($idx)) {
                    foreach ($idx as $id){
                        $row->delete($id);
                    }
                }
        	}

            $model= JModelLegacy::getInstance('Currency','JTheFactoryModel');
            $currtable= JTable::getInstance('CurrencyTable','JTheFactory');
    
            $currencies=$model->getCurrencyList();
            $default_currency=$model->getDefault();
            $results=array();
            foreach($currencies as $currency){
                if ($currency->name==$default_currency){
                    $currtable->load($currency->id);
                    $currtable->convert=1;
                    $currtable->store();
                    $results[]=$currency->name." ---> ".$default_currency." = 1";
                    continue;
                }
                $conversion=$model->getGoogleCurrency($currency->name,$default_currency);
                if ($conversion===false){
                    $results[]=JText::_("COM_BIDS_ERROR_CONVERTING")." {$currency->name} --> $default_currency";
                    continue;
                }
                $currtable->load($currency->id);
                $currtable->convert=$conversion;
                $currtable->store();
                $results[]=$currency->name." ---> ".$default_currency." = $conversion ";
            }
            $logtext.=implode("\r\n",$results);
            $logtext.="\r\n";
            //some cleanup
        	
        }
        $log->log=$logtext;
        $log->store();
        if ($debug) return;
        ob_clean();
        exit();
        

    }
Beispiel #26
0
 function onAfterSendMessage($auction,$message)//
 {
     $cfg= BidsHelperTools::getConfig();
     $usr=JFactory::getUser($message->userid2);
     
     $app=JFactory::getApplication();
     
     if ($app->isAdmin()) {
         $auction->SendMails(array($usr), 'bid_admin_message');
     } else {
         $auction->SendMails(array($usr),"new_message");
     }
     if ($cfg->bid_opt_uddeim) {
         $comment = str_replace('<br>', "\n", $message->message);
         $comment = JText::sprintf('COM_BIDS_SUBJECT_FORMAT', $auction->title, $auction->auction_nr) . PHP_EOL . $comment;
         BidsHelperUdde::sendMessage($message->userid1, $message->userid2, $comment);
     }
         
 }
Beispiel #27
0
    protected function checkTCAgreed() {

        $cfg = BidsHelperTools::getConfig();
        if ('component' != $cfg->bid_opt_profile_mode) {
            return true;
        }

        $my = JFactory::getUser();
        $db = JFactory::getDbo();
        $db->setQuery("SELECT agree_tc FROM #__bid_users WHERE userid=" . $my->id);

        return $db->loadResult();
    }
 function onPaymentForOrder($paylog, $order)
 {
     if (!$order->status == 'C') {
         return;
     }
     $modelorder = JTheFactoryPricingHelper::getModel('orders');
     $items = $modelorder->getOrderItems($order->id, self::getItemName());
     if (!is_array($items) || !count($items)) {
         return;
     }
     //no Listing items in order
     $cfg = BidsHelperTools::getConfig();
     $nowDate = new JDate();
     $auction = JTable::getInstance('auction');
     foreach ($items as $item) {
         if (!$item->iteminfo) {
             continue;
         }
         //AuctionID is stored in iteminfo
         if ($item->itemname != self::getItemName()) {
             continue;
         }
         if (!$auction->load($item->iteminfo)) {
             continue;
         }
         //auction no longer exists
         $auction->modified = $nowDate->toMySQL();
         $auction->published = 1;
         if (!$cfg->bid_opt_enable_date) {
             $startDate = new JDate($auction->start_date);
             $diff = $nowDate->toUnix() - $startDate->toUnix();
             if ($diff > 0) {
                 $auction->start_date = $nowDate->toMySQL();
                 $endDate = new JDate($auction->end_date);
                 $endDate->add(new DateInterval('PT' . $diff . 'S'));
                 $auction->end_date = $endDate->toMySQL();
             }
         }
         $auction->store();
         JTheFactoryEventsHelper::triggerEvent('onAfterSaveAuctionSuccess', array($auction));
         //for email notifications
     }
 }
Beispiel #29
0
 static function uploadImages($auction)
 {
     $cfg = BidsHelperTools::getConfig();
     $document = JFactory::getDocument();
     $imageList = '';
     $images = $auction->get('images');
     foreach ($images as $img) {
         $imageList .= '<div>' . JHTML::image(AUCTION_PICTURES . 'resize_' . $img->picture, $img->picture, 'style="vertical-align:middle"') . '&nbsp;<input type="checkbox" name="delete_pictures[]" value="' . $img->id . '" id="bidsDelImg' . $img->id . '" />&nbsp;<label for="bidsDelImg' . $img->id . '" />' . JText::_('COM_BIDS_DELETE') . '</label>' . '</div><br />';
     }
     JHTML::script('Stickman.MultiUpload.js', 'components/' . APP_EXTENSION . '/js/');
     $dirImages = JUri::root() . 'components/com_bids/images/';
     $startScript = 'window.addEvent(\'domready\', function(){' . 'new MultiUpload( $( \'bidpicture\' ), ' . ($cfg->bid_opt_maxnr_images - $auction->get('imagecount')) . ', \'_{id}\', true, true, \'' . $dirImages . '\' );' . '});';
     $document->addScriptDeclaration($startScript);
     $class = 'inputbox ' . ($cfg->bid_opt_require_picture ? 'required' : '');
     $disabled = $auction->get('imagecount') >= $cfg->bid_opt_maxnr_images ? 'disabled="disabled"' : '';
     $inputUpload = JHTML::tooltip(JText::sprintf('COM_BIDS_UPLOAD_IMAGES_HELP', $cfg->bid_opt_max_picture_size)) . '&nbsp;' . '<input type="file" name="picture" id="bidpicture" ' . $class . ' ' . $disabled . ' />';
     $html = $imageList . $inputUpload;
     return $html;
 }
Beispiel #30
0
    static function getItemid($needles=null) {

        require_once('tools.php');

        $Itemid=JRequest::getInt('Itemid');
        if (!$Itemid) $Itemid=BidsHelperTools::getMenuItemId($needles);

        if ($Itemid) return "&Itemid=".$Itemid;

        return "";
    }