示例#1
0
	static function execute() {
		$conf = TConf::getConfig();
		require_once(JPATH_BASE.'/administrator/components/com_adsmanager/models/cron.php');
		$cronmodel = new AdsmanagerModelCron();	
		
		$last = $cronmodel->getLastCronTime();
		$current = time();
		$cronmodel->saveCronTime($current);

		//Daily Action
		if (date("d",$current) != date("d",$last))
		{
			if ($conf->crontype != "onrequest")
				echo "Daily Action<br/>\n";
			$contentmodel = new AdsmanagerModelContent();
			$fieldmodel = new AdsmanagerModelField();
			$contentmodel->manage_expiration($fieldmodel->getPlugins(),$conf);
		}

		//Hourly Action
		if (date("H",$current) != date("H",$last))
		{
			if ($conf->crontype != "onrequest")
				echo "Hourly Action<br/>\n";
			if (function_exists("managePaidOption")) {
				managePaidOption();
			}
			$db = JFactory::getDbo();
		
			$query = "SELECT id FROM #__adsmanager_ads";
			$db->setQuery($query);
		
			$ads = $db->loadObjectList();
		
			foreach($ads as $ad) {
				$query = "UPDATE #__adsmanager_ads
						  SET ordering = ".rand(0, 1000)."
						  WHERE id = ".(int)$ad->id;
				$db->setQuery($query);
				$db->query();
			}
		}
	}
示例#2
0
 function getDisplayTab($tab, $user, $ui)
 {
     require_once JPATH_ROOT . "/components/com_adsmanager/lib/core.php";
     $app = JFactory::getApplication();
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/adsmanager.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/column.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/category.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/configuration.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/content.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/field.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/position.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/user.php';
     $juser = JFactory::getUser();
     if ($user->id == $juser->id) {
         $myads = true;
     } else {
         $myads = false;
     }
     if ($myads == true) {
         require_once JPATH_ROOT . '/components/com_adsmanager/views/myads/view.html.php';
     } else {
         require_once JPATH_ROOT . '/components/com_adsmanager/views/list/view.html.php';
     }
     if (file_exists(JPATH_ROOT . "/components/com_paidsystem/api.paidsystem.php")) {
         require_once JPATH_ROOT . "/components/com_paidsystem/api.paidsystem.php";
     }
     $uri = JFactory::getURI();
     $baseurl = JURI::base();
     $document = JFactory::getDocument();
     $templateDir = JPATH_ROOT . '/templates/' . $app->getTemplate();
     if (is_file($templateDir . '/html/com_adsmanager/css/adsmanager.css')) {
         $templateDir = JURI::base() . 'templates/' . $app->getTemplate();
         $document->addStyleSheet($templateDir . '/html/com_adsmanager/css/adsmanager.css');
     } else {
         $document->addStyleSheet($baseurl . 'components/com_adsmanager/css/adsmanager.css');
     }
     $contentmodel = new AdsmanagerModelContent();
     $catmodel = new AdsmanagerModelCategory();
     $positionmodel = new AdsmanagerModelPosition();
     $columnmodel = new AdsmanagerModelColumn();
     $fieldmodel = new AdsmanagerModelField();
     $usermodel = new AdsmanagerModelUser();
     $adsmanagermodel = new AdsmanagerModelAdsmanager();
     $configurationmodel = new AdsmanagerModelConfiguration();
     $catid = 0;
     $config = array();
     $config = array();
     $templateDir = JPATH_ROOT . '/templates/' . $app->getTemplate();
     if ($myads == true) {
         if (is_file($templateDir . '/html/com_adsmanager/myads/default.php')) {
             $config['template_path'] = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/com_adsmanager/myads';
         } else {
             $config['template_path'] = JPATH_BASE . '/components/com_adsmanager/views/myads/tmpl';
         }
         $view = new AdsmanagerViewMyads($config);
     } else {
         if (is_file($templateDir . '/html/com_adsmanager/list/default.php')) {
             $config['template_path'] = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/com_adsmanager/list';
         } else {
             $config['template_path'] = JPATH_BASE . '/components/com_adsmanager/views/list/tmpl';
         }
         $view = new AdsmanagerViewList($config);
     }
     $uri = JFactory::getURI();
     $requestURL = $uri->toString();
     $conf = $configurationmodel->getConfiguration();
     $filters = array();
     if ($myads == false) {
         $filters['publish'] = 1;
     }
     $filters['user'] = $user->id;
     $tsearch = JRequest::getVar('tsearch', '');
     if ($tsearch != "") {
         $filters['search'] = $tsearch;
     }
     $view->assignRef('tsearch', $tsearch);
     $showContact = TPermissions::checkRightContact();
     $view->assignRef('showContact', $showContact);
     $category = new stdClass();
     if ($conf->display_fullname) {
         $category->name = JText::_('ADSMANAGER_LIST_USER_TEXT') . " " . $user->name;
     } else {
         $category->name = JText::_('ADSMANAGER_LIST_USER_TEXT') . " " . $user->username;
     }
     $subcats = array();
     $pathlist = array();
     $orderfields = $fieldmodel->getOrderFields(0);
     $uri = JFactory::getURI();
     $baseurl = JURI::base();
     $view->assign("baseurl", $baseurl);
     $view->assignRef("baseurl", $baseurl);
     $view->assignRef('catid', $catid);
     $view->assignRef('listuser', $user->id);
     $modeuser = 1;
     $view->assignRef('modeuser', $modeuser);
     $tsearch = "";
     $view->assignRef('tsearch', $tsearch);
     $view->assignRef('orders', $orderfields);
     $view->assignRef('subcats', $subcats);
     $view->assignRef('pathlist', $pathlist);
     if (file_exists(JPATH_ROOT . '/components/com_sh404sef')) {
         $limit = $conf->ads_per_page;
     } else {
         $limit = $app->getUserStateFromRequest('com_adsmanager.front_ads_per_page', 'limit', $conf->ads_per_page, 'int');
     }
     $limitstart = JRequest::getInt("limitstart", 0);
     $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order', 'order', 0, 'int');
     $orderdir = $app->getUserStateFromRequest('com_adsmanager.front_content.orderdir', 'orderdir', 'DESC');
     $orderdir = strtoupper($orderdir);
     if ($orderdir != "DESC" && $orderdir != "ASC") {
         $orderdir = "DESC";
     }
     $filter_order = $contentmodel->getFilterOrder($order);
     $filter_order_dir = $orderdir;
     $view->assignRef('order', $order);
     $view->assignRef('orderdir', $orderdir);
     $view->assignRef('lists', $lists);
     $total = $contentmodel->getNbContents($filters);
     $contents = $contentmodel->getContents($filters, $limitstart, $limit, $filter_order, $filter_order_dir, 1);
     if ($juser->guest == false) {
         $favorites = $contentmodel->getFavorites($juser->id);
     } else {
         $favorites = array();
     }
     $view->assignRef('favorites', $favorites);
     $userId = JRequest::getInt("user", 0);
     if ($userId != 0) {
         $userId = '&user='******'';
     }
     $pagination = new JPagination2($total, $limitstart, $limit, "index.php?option=com_comprofiler&tab=AdsmanagerTab&limit={$limit}" . $userId);
     $view->assignRef('pagination', $pagination);
     $view->assignRef('list_name', $category->name);
     $view->assignRef('list_img', $category->img);
     $view->assignRef('list_description', $category->description);
     $view->assignRef('contents', $contents);
     $mode = $app->getUserStateFromRequest('com_adsmanager.front_content.mode', 'mode', $conf->display_expand);
     if ($mode == 2) {
         $mode = 0;
     }
     $view->assignRef('mode', $mode);
     if ($mode == 0) {
         $columns = $columnmodel->getColumns($catid);
         $fcolumns = $fieldmodel->getFieldsbyColumns();
         $view->assignRef('columns', $columns);
         $view->assignRef('fColumns', $fcolumns);
     } else {
         $positions = $positionmodel->getPositions('details');
         $fDisplay = $fieldmodel->getFieldsbyPositions();
         $view->assignRef('positions', $positions);
         $view->assignRef('fDisplay', $fDisplay);
     }
     $fields = $fieldmodel->getFields();
     $view->assignRef('fields', $fields);
     //Unactive Map Display on User List because the loadModule function is not working on CB page (I don't know why)
     $conf->display_map_list = 0;
     $view->assignRef('conf', $conf);
     $my = JFactory::getUser();
     $view->assignRef('userid', $my->id);
     $view->assignRef('requestURL', $requestURL);
     $field_values = $fieldmodel->getFieldValues();
     $plugins = $fieldmodel->getPlugins();
     $field = new JHTMLAdsmanagerField($conf, $field_values, $mode, $plugins, null);
     $view->assignRef('field', $field);
     $general = new JHTMLAdsmanagerGeneral($catid, $conf, $user);
     $view->assignRef('general', $general);
     $return = $view->loadTemplate(null);
     $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table';
     JTable::addIncludePath($path);
     return $return;
 }
示例#3
0
文件: ads.php 项目: politik86/test2
 /**
  * Method to index an item. The item must be a FinderIndexerResult object.
  *
  * @param   FinderIndexerResult  $item    The item to index as an FinderIndexerResult object.
  * @param   string               $format  The item format
  *
  * @return  void
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     // Initialize the item parameters.
     $registry = new JRegistry();
     $registry->loadString($item->params);
     $item->params = $registry;
     $registry = new JRegistry();
     $registry->loadString($item->metadata);
     $item->metadata = $registry;
     // Build the necessary route and path information.
     $item->url = $this->getURL($item->id, $this->extension, $this->layout);
     if ($item->slug instanceof JCategoryNode) {
         $ads_id = $item->slug->id;
     } else {
         $ads_id = (int) $item->slug;
     }
     $adsmodelcontent = new AdsmanagerModelContent();
     $ads_catid = $adsmodelcontent->getContent($ads_id, true)->catid;
     $url = "index.php?option=com_adsmanager&view=details&id=" . $ads_id . "&catid=" . $ads_catid;
     $xhtml = true;
     $ssl = null;
     $item->route = TRoute::_($url);
     //$item->route = AdsmanagerHelperRoute::getAdsRoute($item->slug, $item->catslug);
     //$item->route = AdsmanagerHelperRoute::_("index.php?option=com_adsmanager&view=details&id=".$row->id."&catid=".$row->catid);
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     /*
      * Add the meta-data processing instructions based on the newsfeeds
      * configuration parameters.
      */
     // Add the meta-author.
     $item->metaauthor = $item->metadata->get('author');
     // Handle the link to the meta-data.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'Ads');
     // Add the category taxonomy data.
     $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
     // Add the language taxonomy data.
     $item->addTaxonomy('Language', $item->language);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     $this->indexer->index($item);
 }
示例#4
0
        }
    }
}
if (file_exists(JPATH_BASE . "/components/com_paidsystem/api.paidsystem.php")) {
    require_once JPATH_BASE . "/components/com_paidsystem/api.paidsystem.php";
}
$sort_sql = intval($params->get('random', 0));
$catid = $params->get('catselect', "0");
$catselect = $catid;
$confmodel = new AdsmanagerModelConfiguration();
$conf = $confmodel->getConfiguration();
$nb_images = $conf->nb_images;
$nb_ads = intval($params->get('nb_ads', 3));
$rootid = $params->get('rootid', null);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$contentmodel = new AdsmanagerModelContent();
$contents = $contentmodel->getLatestContents($nb_ads, $sort_sql, $catselect, $rootid);
if (function_exists("getMaxPaidSystemImages")) {
    $nb_images += getMaxPaidSystemImages();
}
if ($rootid != 0) {
    $urlparamroot = "&rootid={$rootid}";
} else {
    $urlparamroot = "";
}
$uri = JFactory::getURI();
$baseurl = JURI::base();
$catmodel = new AdsmanagerModelCategory();
$columnmodel = new AdsmanagerModelColumn();
$fieldmodel = new AdsmanagerModelField();
$usermodel = new AdsmanagerModelUser();