/**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 public static function editSection($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator");
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         $menu->type = 'content_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build the html select list for section
     $lists['componentid'] = mosAdminMenus::Section($menu, $uid);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_section_menu_html::editSection($menu, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function editCategory($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         $menu->type = 'content_archive_category';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build the html select list for category
     $lists['componentid'] = mosAdminMenus::Category($menu, $uid);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_archive_category_menu_html::editCategory($menu, $lists, $params, $option);
 }
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     global $mosConfig_absolute_path;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         // load values for new entry
         $menu->type = 'content_typed';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if ($uid) {
         $temp = explode('id=', $menu->link);
         $query = "SELECT a.title, a.title_alias, a.id" . "\n FROM #__content AS a" . "\n WHERE a.id = " . (int) $temp[1];
         $database->setQuery($query);
         $content = $database->loadObjectlist();
         // outputs item name, category & section instead of the select list
         if ($content[0]->title_alias) {
             $alias = '  (<i>' . $content[0]->title_alias . '</i>)';
         } else {
             $alias = '';
         }
         $contents = '';
         $link = 'javascript:submitbutton( \'redirect\' );';
         $lists['content'] = '<input type="hidden" name="content_typed" value="' . $temp[1] . '" />';
         $lists['content'] .= '<a href="' . $link . '" title="Editar conteúdos estáticos">' . $content[0]->title . $alias . '</a>';
     } else {
         $query = "SELECT a.id AS value, CONCAT( a.title, '(', a.title_alias, ')' ) AS text" . "\n FROM #__content AS a" . "\n WHERE a.state = 1" . "\n AND a.sectionid = 0" . "\n AND a.catid = 0" . "\n ORDER BY a.title, a.id";
         $database->setQuery($query);
         $contents = $database->loadObjectList();
         //	Create a list of links
         $lists['content'] = mosHTML::selectList($contents, 'content_typed', 'class="inputbox" size="10"', 'value', 'text', '');
     }
     // build html select list for target window
     $lists['target'] = mosAdminMenus::Target($menu);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_menu_html::edit($menu, $lists, $params, $option, $contents);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator");
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params = new mosParameters($menu->params);
         $catids = $params->def('categoryid', '');
         if ($catids) {
             $catidsArray = explode(',', $catids);
             mosArrayToInts($catidsArray);
             $catids = 'c.id=' . implode(' OR c.id=', $catidsArray);
             $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n AND ( {$catids} )" . "\n ORDER BY s.name,c.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_category';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for category
     $rows[] = mosHTML::makeOption('', 'All Categories');
     $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name,c.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $category = mosHTML::selectList($rows, 'catid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['categoryid'] = $category;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */
     content_blog_category_html::edit($menu, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the section to edit (0 if new)
  */
 function edit($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params = new mosParameters($menu->params);
         $secids = $params->def('sectionid', '');
         if ($secids) {
             $secidsArray = explode(',', $secids);
             mosArrayToInts($secidsArray);
             $secids = 's.id=' . implode(' OR s.id=', $secidsArray);
             $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND ( {$secids} )" . "\n ORDER BY s.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for section
     $rows[] = mosHTML::makeOption('', 'Todas as Seções');
     $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['sectionid'] = $section;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_blog_section_html::edit($menu, $lists, $params, $option);
 }
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         // load values for new entry
         $menu->type = 'component_item_link';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if ($uid) {
         $temp = explode('&Itemid=', $menu->link);
         $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = " . $database->Quote($temp[0]);
         $database->setQuery($query);
         $components = $database->loadResult();
         $lists['components'] = $components;
         $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />';
     } else {
         $query = "SELECT CONCAT( a.link, '&amp;Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = 1" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name";
         $database->setQuery($query);
         $components = $database->loadObjectList();
         //	Create a list of links
         $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', '');
     }
     // build html select list for target window
     $lists['target'] = mosAdminMenus::Target($menu);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid, 1);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     component_item_link_menu_html::edit($menu, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function edit($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     $row = new mosComponent($database);
     // load the row from the db table
     $row->load((int) $menu->componentid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         // do stuff for existing item
         $menu->checkout($my->id);
     } else {
         // do stuff for new item
         $menu->type = 'components';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link != ''" . "\n ORDER BY c.name";
     $database->setQuery($query);
     $components = $database->loadObjectList();
     // build the html select list for section
     $lists['componentid'] = mosAdminMenus::Component($menu, $uid);
     // componentname
     $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('com_xml', $row->option), 'component');
     components_menu_html::edit($menu, $components, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function editCategory($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     global $mosConfig_absolute_path;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         $menu->type = 'newsfeed_category_table';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build list of categories
     $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_newsfeeds', intval($menu->componentid), NULL, 'name', 10, 0);
     if ($uid) {
         $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_newsfeeds'" . "\n AND published = 1" . "\n AND id = " . (int) $menu->componentid;
         $database->setQuery($query);
         $category = $database->loadResult();
         $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $category;
     }
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     newsfeed_category_table_menu_html::editCategory($menu, $lists, $params, $option);
 }
예제 #9
0
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function edit($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         // do stuff for existing item
         $menu->checkout($my->id);
     } else {
         // do stuff for new item
         $menu->type = 'separator';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if (empty($menu->name)) {
         $menu->name = '- - - - - - -';
     }
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     separator_menu_html::edit($menu, $lists, $params, $option);
 }
예제 #10
0
/**
* Remove the selected language
*/
function removeLanguage($cid, $option, $client = 'admin')
{
    global $mosConfig_lang;
    josSpoofCheck();
    $client_id = $client == 'admin' ? 1 : 0;
    $cur_language = $mosConfig_lang;
    if ($cur_language == $cid) {
        mosErrorAlert("You can not delete language in use.");
    }
    /*$lang_path = "../language/$cid.php";
    	$lang_ignore_path = "../language/$cid.ignore.php";
    	$xml_path = "../language/$cid.xml";
    
    	unlink($lang_path);
    	unlink($lang_ignore_path);
    	unlink($xml_path);
    	*/
    mosRedirect('index2.php?option=com_installer&element=language&client=' . $client . '&task=remove&cid[]=' . $cid . '&' . josSpoofValue() . '=1');
}
예제 #11
0
 function editForm($tpl = null)
 {
     $helper = new adagencyAdminModeladagencyTransition();
     global $mainframe;
     $data = JRequest::get('post');
     $db = JFactory::getDBO();
     $ad = $this->get('ad');
     $advertiser_id = JRequest::getVar('advertiser_id', '', 'post');
     if (isset($_SESSION['newest_adv']) & $advertiser_id == "" && $_SESSION['newest_adv'] != '') {
         $advertiser_id = $_SESSION['newest_adv'] + 1;
     }
     if (isset($_SESSION['newest_adv'])) {
         unset($_SESSION['newest_adv']);
     }
     $configs = $this->getModel("adagencyConfig")->getConf();
     $configs->geoparams = @unserialize($configs->geoparams);
     if (isset($ad->id) && $ad->id != 0) {
         $channel = $this->getModel("adagencyTransition")->getChannel($ad->id);
     } else {
         $channel = NULL;
     }
     $isNew = $ad->id < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     if (!$isNew) {
         $advertiser_id = $ad->advertiser_id;
         if (!is_array($ad->parameters)) {
             $ad->parameters = unserialize($ad->parameters);
         }
     } else {
         $ad->parameters['ad_code'] = '';
     }
     JToolBarHelper::title(JText::_('AD_TRANSITION') . ":<small>[" . $text . "]</small>");
     if ($isNew) {
         JToolBarHelper::apply('apply');
         JToolBarHelper::save('save');
         JToolBarHelper::cancel('cancel');
     } else {
         JToolBarHelper::apply('apply');
         JToolBarHelper::save('save');
         JToolBarHelper::cancel('cancel');
     }
     //================check if the banner is added to a campaign===============
     $sqla = "SELECT count(*) FROM #__ad_agency_campaign_banner WHERE `banner_id`=" . intval($ad->id);
     $db->setQuery($sqla);
     $db->query();
     $added = $db->loadResult();
     $this->assign("added", $added);
     if ($isNew) {
         $ad->approved = 'Y';
     }
     $javascript = 'onchange="submitbutton(\'edit\');"';
     $advertisers[] = JHTML::_('select.option', "0", JText::_('AD_SELECT_ADVERTISER'), 'aid', 'company');
     $advertisersloaded = $helper->gettransitionlistAdvertisers();
     $advertisers = array_merge($advertisers, $advertisersloaded);
     $lists['advertiser_id'] = JHTML::_('select.genericlist', $advertisers, 'advertiser_id', 'class="inputbox" size="1"' . $javascript, 'aid', 'company', $advertiser_id);
     $sts_select = new StdClass();
     $sts_select->status = JText::_("ADAG_SEL_STS");
     $sts_select->value = '';
     $sts_approve = new StdClass();
     $sts_approve->status = JText::_("AD_APPROVED");
     $sts_approve->value = "Y";
     $sts_decline = new StdClass();
     $sts_decline->status = JText::_("ADAG_DECLINED");
     $sts_decline->value = "N";
     $sts_pending = new StdClass();
     $sts_pending->status = JText::_("ADAG_PENDING");
     $sts_pending->value = 'P';
     $statuses[] = $sts_select;
     $statuses[] = $sts_approve;
     $statuses[] = $sts_decline;
     $statuses[] = $sts_pending;
     $lists['approved'] = JHTML::_('select.genericlist', $statuses, 'approved', 'class="inputbox" size="1"', 'value', 'status', $ad->approved);
     // Padding  property
     $lists['padding'] = JHTML::_('select.integerlist', 0, 25, 1, 'parameters[padding]', 'class="inputbox"', @$ad->parameters['padding']);
     // Border property
     $lists["border"] = JHTML::_('select.integerlist', 0, 25, 1, 'parameters[border]', 'class="inputbox"', @$ad->parameters['border']);
     // Channels list - begin
     if (isset($ad->channel_id)) {
         $default_channel = $ad->channel_id;
     } else {
         $default_channel = NULL;
     }
     $sql = "SELECT id,name FROM #__ad_agency_channels";
     $db->setQuery($sql);
     $the_channels = $db->loadObjectList();
     $channels[] = JHTML::_('select.option', "0", ' - ' . strtolower(JText::_('ADAG_NONE')) . ' - ', 'id', 'name');
     $channels = array_merge($channels, $the_channels);
     $lists['channel_id'] = JHTML::_('select.genericlist', $channels, 'channel_id', 'class="inputbox" size="1"', 'id', 'name', $default_channel);
     // Channels list - end
     //Show Zone select
     if ($advertiser_id != '' && $advertiser_id != 0) {
         if (!$isNew) {
             $sql = "SELECT `id`, `name` FROM #__ad_agency_campaign WHERE aid = " . $advertiser_id;
             $db->setQuery($sql);
             $assoc_camps = $db->loadObjectList();
         } else {
             $assoc_camps = NULL;
         }
         $this->assign("assoc_camps", $assoc_camps);
         $sql = "SELECT DISTINCT cb.campaign_id FROM #__ad_agency_banners AS b LEFT OUTER JOIN #__ad_agency_campaign_banner AS cb ON cb.banner_id=b.id WHERE b.advertiser_id={$advertiser_id} AND b.id=" . intval($ad->id);
         $db->setQuery($sql);
         $banners_camps = $db->loadColumn();
         $this->assign("banners_camps", (array) $banners_camps);
         $sql1 = "SELECT DISTINCT tid FROM #__ad_agency_order WHERE aid=" . $advertiser_id . " ";
         $db->setQuery($sql1);
         $the_advertiser_packages = $db->loadResultArray();
         $nothing = "";
         if (isset($the_advertiser_packages)) {
             foreach ($the_advertiser_packages as $pk) {
                 $query = "SELECT zones_wildcard FROM #__ad_agency_order_type WHERE tid=" . $pk . " ";
                 $db->setQuery($query);
                 $rezult_wild = $db->loadResult();
                 $rezult_wild = explode("|", $rezult_wild);
                 //print_r($rezult_wild);
                 $rezult_wild = implode(",", $rezult_wild);
                 $nothing .= $rezult_wild . " ";
             }
         }
         $wildzones = substr(str_replace(" ", ",", $nothing), 0, -1);
         if ($wildzones == false) {
             $wildzones = "''";
         }
         if (strstr($wildzones, ",,")) {
             $wildzones = "''";
         }
         $the_advertiser_packages = @implode(",", $the_advertiser_packages);
         if ($the_advertiser_packages == "") {
             $notice_cond = "-1";
         } else {
             $notice_cond = "-1,";
         }
         $sql2 = "SELECT DISTINCT zones FROM #__ad_agency_order_type WHERE tid IN (" . $notice_cond . $the_advertiser_packages . ") ";
         $db->setQuery($sql2);
         $packages_positions = $db->loadResultArray();
         @($packages_positions = implode("','", $packages_positions));
         // If we have one package that contains All Zones, then we don't need a condition
         $packages_positions = str_replace("|", "','", $packages_positions);
         if (!preg_match("/All Zones/i", $packages_positions)) {
             $packages_positions = "('" . $packages_positions . "')";
             $condition = " AND position IN " . $packages_positions . " ";
         }
         if (!isset($condition)) {
             $condition = "";
         }
         if ($wildzones[strlen($wildzones) - 1] == ',') {
             $wildzones = substr($wildzones, 0, strlen($wildzones) - 1);
         }
         if (isset($wildzones[0]) && $wildzones[0] == ',') {
             $wildzones = substr($wildzones, 1, strlen($wildzones));
         }
         if ($wildzones == "" || $wildzones == ",") {
             $wildzones = "''";
         }
         $sql = "SELECT id, title FROM #__modules WHERE module='mod_ijoomla_adagency_zone' " . $condition . " OR id IN (" . $wildzones . ") ORDER BY title ASC";
         $db->setQuery($sql);
         if (!$db->query()) {
             mosErrorAlert($db->getErrorMsg());
             return;
         }
         $the_zzones = $db->loadRowlist();
         $zone[] = JHTML::_('select.option', "0", JText::_('AD_SELECT_ZONE'), 'id', 'title');
         $zone = array_merge($zone, $db->loadObjectList());
         $lists['zone_id'] = JHTML::_('select.genericlist', $zone, 'zone', 'class="inputbox" size="1"', 'id', 'title', $ad->zone);
     } else {
         $no_advertiser_sel = JText::_('ADS_SEL_ADV');
     }
     ///////////////////
     if (isset($the_zzones) && $the_zzones != NULL) {
         $lists['zone_id'] = "<select id='zone' class='inputbox' size='1' name='zone'>\n\t\t\t<option value='0'>" . JText::_("AD_SELECT_ZONE") . "</option>";
         foreach ($the_zzones as $value) {
             if (isset($ad->zone) && $ad->zone == $value[0]) {
                 $current_selected = "selected='selected'";
             } else {
                 $current_selected = "";
             }
             $already[] = $value[0];
             $lists['zone_id'] .= "<option value='" . $value[0] . "' " . $current_selected . ">" . $value[1] . "</option>";
         }
         $sql_allzones = "SELECT z.zoneid, z.z_title\n\t\t\tFROM #__ad_agency_zone AS z\n\t\t\tLEFT JOIN #__modules AS m ON z.zoneid = m.id\n\t\t\tWHERE m.module = 'mod_ijoomla_adagency_zone'";
         $db->setQuery($sql_allzones);
         $all_existing_zones = $db->loadRowlist();
         if (isset($all_existing_zones)) {
             foreach ($all_existing_zones as $currentz) {
                 if (!in_array($currentz[0], $already)) {
                     if (isset($ad->zone) && $ad->zone == $currentz[0]) {
                         $current_selected = "selected='selected'";
                     } else {
                         $current_selected = "";
                     }
                     $lists['zone_id'] .= "<option value='" . $currentz[0] . "' " . $current_selected . " style='font-size: 12px; color: #FF0000;'>" . $currentz[1] . "</option>";
                 }
             }
         }
         $lists['zone_id'] .= "</select>";
     } else {
         $lists['zone_id'] = "<select id='zone' class='inputbox' size='1' name='zone'>\n\t\t\t<option value='0'>" . JText::_("AD_SELECT_ZONE") . "</option>";
         $sql_allzones = "SELECT z.zoneid, z.z_title\n\t\t\tFROM #__ad_agency_zone AS z\n\t\t\tLEFT JOIN #__modules AS m ON z.zoneid = m.id\n\t\t\tWHERE m.module = 'mod_ijoomla_adagency_zone'";
         $db->setQuery($sql_allzones);
         $all_existing_zones = $db->loadRowlist();
         if (isset($all_existing_zones)) {
             foreach ($all_existing_zones as $currentz) {
                 if (isset($ad->zone) && $ad->zone == $currentz[0]) {
                     $current_selected = "selected='selected'";
                 } else {
                     $current_selected = "";
                 }
                 $lists['zone_id'] .= "<option value='" . $currentz[0] . "' " . $current_selected . " style='font-size: 12px; color: #FF0000;'>" . $currentz[1] . "</option>";
             }
         }
         $lists['zone_id'] .= "</select>";
     }
     if (isset($no_advertiser_sel)) {
         $lists['zone_id'] = JText::_("AD_WARN_SEL_ADV");
     }
     ////////////////////
     ///===================select available campaigns============================
     $adv_id = $advertiser_id;
     if ($adv_id) {
         $camps = $this->getModel("adagencyTransition")->getCampsByAid($adv_id);
     } else {
         $camps = '';
     }
     if ($advertiser_id > 0) {
         $advt = $this->getModel("adagencyConfig")->getAdvById($advertiser_id);
     } else {
         $advt = NULL;
     }
     $exist_zone = $this->get('ExistsZone');
     //echo "<pre>";var_dump($exist_zone);die();
     if (!$exist_zone) {
         $no_zone = "<div id=\"system-message-container\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n\t\t\t\t\t\t\t<div class=\"alert alert-notice\">\n\t\t\t\t\t\t\t\t<p>" . JText::_('ADAG_NO_ZONE_TYPE') . "&nbsp;&nbsp; <a href='http://www.ijoomla.com/redirect/adagency/ad_support.htm' target='_blank'>" . JText::_('AD_VIDEO') . "<img src='components/com_adagency/images/icon_video.gif' alt='watch video'></a></p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>";
     } else {
         $no_zone = NULL;
     }
     if ((!is_array($camps) || count($camps) <= 0) && $advt != NULL && $no_zone == NULL) {
         $no_zone = "<div id=\"system-message-container\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n\t\t\t\t\t\t\t<div class=\"alert alert-notice\">\n\t\t\t\t\t\t\t\t<p>" . JText::_('ADAG_NO_CAMP_TYPE') . '&nbsp;&nbsp; <a href="http://www.ijoomla.com/redirect/adagency/ad_support.htm" target="_blank">' . JText::_('AD_VIDEO') . "<img src='components/com_adagency/images/icon_video.gif' alt='watch video'></a></p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>";
     }
     $query = "SELECT `params` FROM #__ad_agency_settings ORDER BY id ASC LIMIT 1";
     $db->setQuery($query);
     $params = $db->loadColumn();
     $params = unserialize($params["0"]);
     /*$campaigns_zones = $this->getModel("adagencyTransition")->getCampZones($camps);
     		$czones = $this->getModel("adagencyTransition")->processCampZones($camps);
     		$czones = $this->getModel("adagencyTransition")->createSelectBox($czones,$ad->id);*/
     $campaigns_zones = $this->getModel("adagencyTransition")->getCampZones($camps);
     $czones = $this->getModel("adagencyTransition")->processCampZones($camps);
     $czones_select = $this->getModel("adagencyTransition")->createSelectBox($czones, $ad->id, $ad);
     $camps = $this->getModel("adagencyTransition")->getCampsByAid($adv_id, 1);
     $this->assign("campaigns_zones", $campaigns_zones);
     $this->assign("czones", $czones);
     $this->assign("czones_select", $czones_select);
     $this->assign("czones", $czones);
     $this->assign("no_zone", $no_zone);
     $this->assign("advt", $advt);
     $this->assign('advertiser_id', $advertiser_id);
     $this->assign("channel", $channel);
     $this->assign("configs", $configs);
     $this->assign("ad", $ad);
     $this->assign("lists", $lists);
     $this->assign("data", $data);
     $this->assign("camps", $camps);
     $this->assign("params", $params);
     parent::display($tpl);
 }
예제 #12
0
function saveRegistration()
{
    global $database, $acl;
    global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation, $mosConfig_allowUserRegistration;
    global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailfrom, $mosConfig_fromname;
    if ($mosConfig_allowUserRegistration == 0) {
        mosNotAuth();
        return;
    }
    // simple spoof check security
    josSpoofCheck();
    $row = new mosUser($database);
    if (!$row->bind($_POST, 'usertype')) {
        mosErrorAlert($row->getError());
    }
    $row->name = trim($row->name);
    $row->email = trim($row->email);
    $row->username = trim($row->username);
    $row->password = trim($row->password);
    mosMakeHtmlSafe($row);
    $row->id = 0;
    $row->usertype = '';
    $row->gid = $acl->get_group_id('Registered', 'ARO');
    if ($mosConfig_useractivation == 1) {
        $row->activation = md5(mosMakePassword());
        $row->block = '1';
    }
    if (!$row->check()) {
        echo "<script> alert('" . html_entity_decode($row->getError()) . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $pwd = $row->password;
    $salt = mosMakePassword(16);
    $crypt = md5($row->password . $salt);
    $row->password = $crypt . ':' . $salt;
    $row->registerDate = date('Y-m-d H:i:s');
    if (!$row->store()) {
        echo "<script> alert('" . html_entity_decode($row->getError()) . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $row->checkin();
    $name = trim($row->name);
    $email = trim($row->email);
    $username = trim($row->username);
    $subject = sprintf(_SEND_SUB, $name, $mosConfig_sitename);
    $subject = html_entity_decode($subject, ENT_QUOTES);
    if ($mosConfig_useractivation == 1) {
        $message = sprintf(_USEND_MSG_ACTIVATE, $name, $mosConfig_sitename, $mosConfig_live_site . "/index.php?option=com_registration&task=activate&activation=" . $row->activation, $mosConfig_live_site, $username, $pwd);
    } else {
        $message = sprintf(_USEND_MSG, $name, $mosConfig_sitename, $mosConfig_live_site);
    }
    $message = html_entity_decode($message, ENT_QUOTES);
    // check if Global Config `mailfrom` and `fromname` values exist
    if ($mosConfig_mailfrom != '' && $mosConfig_fromname != '') {
        $adminName2 = $mosConfig_fromname;
        $adminEmail2 = $mosConfig_mailfrom;
    } else {
        // use email address and name of first superadmin for use in email sent to user
        $query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'";
        $database->setQuery($query);
        $rows = $database->loadObjectList();
        $row2 = $rows[0];
        $adminName2 = $row2->name;
        $adminEmail2 = $row2->email;
    }
    // Send email to user
    mosMail($adminEmail2, $adminName2, $email, $subject, $message);
    // Send notification to all administrators
    $subject2 = sprintf(_SEND_SUB, $name, $mosConfig_sitename);
    $message2 = sprintf(_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username);
    $subject2 = html_entity_decode($subject2, ENT_QUOTES);
    $message2 = html_entity_decode($message2, ENT_QUOTES);
    // get email addresses of all admins and superadmins set to recieve system emails
    $query = "SELECT email, sendEmail" . "\n FROM #__users" . "\n WHERE ( gid = 24 OR gid = 25 )" . "\n AND sendEmail = 1" . "\n AND block = 0";
    $database->setQuery($query);
    $admins = $database->loadObjectList();
    foreach ($admins as $admin) {
        // send email to admin & super admin set to recieve system emails
        mosMail($adminEmail2, $adminName2, $admin->email, $subject2, $message2);
    }
    if ($mosConfig_useractivation == 1) {
        echo _REG_COMPLETE_ACTIVATE;
    } else {
        echo _REG_COMPLETE;
    }
}
    function edit(&$uid, $menutype, $option)
    {
        global $database, $my, $mainframe;
        global $mosConfig_absolute_path;
        $menu = new mosMenu($database);
        $menu->load((int) $uid);
        // fail if checked out not by 'me'
        if ($menu->checked_out && $menu->checked_out != $my->id) {
            mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator");
        }
        if ($uid) {
            $menu->checkout($my->id);
        } else {
            // load values for new entry
            $menu->type = 'content_item_link';
            $menu->menutype = $menutype;
            $menu->browserNav = 0;
            $menu->ordering = 9999;
            $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
            $menu->published = 1;
        }
        if ($uid) {
            $link = 'javascript:submitbutton( \'redirect\' );';
            $temp = explode('id=', $menu->link);
            $query = "SELECT a.title, c.name AS category, s.name AS section" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS c ON a.catid = c.id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.id = " . (int) $temp[1];
            $database->setQuery($query);
            $content = $database->loadObjectlist();
            // outputs item name, category & section instead of the select list
            $lists['content'] = '
			<table width="100%">
			<tr>
				<td width="10%">
				Item:
				</td>
				<td>
				<a href="' . $link . '" title="Edit Content Item">
				' . $content[0]->title . '
				</a>
				</td>
			</tr>
			<tr>
				<td width="10%">
				Category:
				</td>
				<td>
				' . $content[0]->category . '
				</td>
			</tr>
			<tr>
				<td width="10%">
				Section:
				</td>
				<td>
				' . $content[0]->section . '
				</td>
			</tr>
			</table>';
            $contents = '';
            $lists['content'] .= '<input type="hidden" name="content_item_link" value="' . $temp[1] . '" />';
        } else {
            $query = "SELECT a.id AS value," . "\n CONCAT(s.title, ' - ',c.title,' / ',a.title, '&nbsp;&nbsp;&nbsp;&nbsp;') AS text" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n INNER JOIN #__sections AS s ON a.sectionid = s.id AND s.scope = 'content'" . "\n WHERE a.state = 1" . "\n ORDER BY a.sectionid, a.catid, a.title";
            $database->setQuery($query);
            $contents = $database->loadObjectList();
            //	Create a list of links
            $lists['content'] = mosHTML::selectList($contents, 'content_item_link', 'class="inputbox" size="10"', 'value', 'text', '');
        }
        // build html select list for target window
        $lists['target'] = mosAdminMenus::Target($menu);
        // build the html select list for ordering
        $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($menu);
        // build the html select list for paraent item
        $lists['parent'] = mosAdminMenus::Parent($menu);
        // build published button option
        $lists['published'] = mosAdminMenus::Published($menu);
        // build the url link output
        $lists['link'] = mosAdminMenus::Link($menu, $uid);
        // get params definitions
        $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
        content_item_link_menu_html::edit($menu, $lists, $params, $option, $contents);
    }
예제 #14
0
/**
* Changes the state of one or more content pages
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
* @param string The current option
*/
function changeContact($cid = null, $state = 0, $option)
{
    global $database, $my;
    josSpoofCheck();
    if (!is_array($cid) || count($cid) < 1) {
        $action = $state ? 'publish' : 'unpublish';
        mosErrorAlert("Select an item to {$action}");
    }
    mosArrayToInts($cid);
    $cids = 'id=' . implode(' OR id=', $cid);
    $query = "UPDATE #__contact_details" . "\n SET published = " . (int) $state . "\n WHERE ( {$cids} )" . "\n AND ( checked_out = 0 OR ( checked_out = " . (int) $my->id . ") )";
    $database->setQuery($query);
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosContact($database);
        $row->checkin(intval($cid[0]));
    }
    mosRedirect("index2.php?option={$option}");
}
예제 #15
0
    if (file_exists($base_Dir . $userfile_name)) {
        mosErrorAlert('A imagem ' . $userfile_name . ' já existe.', $action);
    }
    if (strcasecmp(substr($userfile_name, -4), '.gif') && strcasecmp(substr($userfile_name, -4), '.jpg') && strcasecmp(substr($userfile_name, -4), '.png') && strcasecmp(substr($userfile_name, -4), '.bmp') && strcasecmp(substr($userfile_name, -4), '.doc') && strcasecmp(substr($userfile_name, -4), '.xls') && strcasecmp(substr($userfile_name, -4), '.ppt') && strcasecmp(substr($userfile_name, -4), '.swf') && strcasecmp(substr($userfile_name, -4), '.pdf')) {
        mosErrorAlert('O arquivo deve ser do tipo gif, png, jpg, bmp, swf, doc, xls ou ppt', $action);
    }
    if (eregi('.pdf', $userfile_name) || eregi('.doc', $userfile_name) || eregi('.xls', $userfile_name) || eregi('.ppt', $userfile_name)) {
        if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $media_path . $_FILES['userfile']['name']) || !mosChmod($media_path . $_FILES['userfile']['name'])) {
            mosErrorAlert('O envio do arquivo ' . $userfile_name . ' falhou', $action);
        } else {
            mosErrorAlert('O envio do arquivo ' . $userfile_name . ' para o diretório ' . $base_Dir . ' foi realizado com sucesso', "window.close()");
        }
    } elseif (!move_uploaded_file($_FILES['userfile']['tmp_name'], $base_Dir . $_FILES['userfile']['name']) || !mosChmod($base_Dir . $_FILES['userfile']['name'])) {
        mosErrorAlert('O envio do arquivo ' . $userfile_name . ' falhou', $action);
    } else {
        mosErrorAlert('O envio do arquivo ' . $userfile_name . ' para ' . $base_Dir . ' foi realizado com sucesso', "window.close()");
    }
    echo $base_Dir . $_FILES['userfile']['name'];
}
// css file handling
// check to see if template exists
if ($css != '' && !is_dir($mosConfig_absolute_path . '/administrator/templates/' . $css . '/css/template_css.css')) {
    $css = 'joomla_admin';
} else {
    if ($css == '') {
        $css = 'joomla_admin';
    }
}
$iso = split('=', _ISO);
// xml prolog
echo '<?xml version="1.0" encoding="' . $iso[1] . '"?' . '>';
예제 #16
0
        // check if auto_purge value set
        if ($my->cfg_name == 'auto_purge') {
            $purge = $my->cfg_value;
        } else {
            // if no value set, default is 7 days
            $purge = 7;
        }
        // calculation of past date
        $past = date('Y-m-d H:i:s', time() - $purge * 60 * 60 * 24);
        // if purge value is not 0, then allow purging of old messages
        if ($purge != 0) {
            // purge old messages at day set in message configuration
            $query = "DELETE FROM #__messages" . "\n WHERE date_time < " . $database->Quote($past) . "\n AND user_id_to = " . (int) $my->id;
            $database->setQuery($query);
            if (!$database->query()) {
                echo $database->stderr();
            }
        }
        /** cannot using mosredirect as this stuffs up the cookie in IIS */
        // redirects page to admin homepage by default or expired page
        echo "<script>document.location.href='{$expired}';</script>\n";
        exit;
    } else {
        mosErrorAlert("Erro no nome do usuário ou senha.  Por favor, verifique os dados introduzidos e tente novamente", "document.location.href='index.php?mosmsg=Erro no nome do usuário ou senha.  Por favor, verifique os dados introduzidos e tente novamente'");
    }
} else {
    initGzip();
    $path = $mosConfig_absolute_path . '/administrator/templates/' . $mainframe->getTemplate() . '/login.php';
    require_once $path;
    doGzip();
}
예제 #17
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editModule($option, $uid, $client)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosModule($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
    }
    $row->content = htmlspecialchars($row->content);
    if ($uid) {
        $row->checkout($my->id);
    }
    // if a new record we must still prime the mosModule object with a default
    // position and the order; also add an extra item to the order list to
    // place the 'new' record in last position if desired
    if ($uid == 0) {
        $row->position = 'left';
        $row->showtitle = true;
        //$row->ordering = $l;
        $row->published = 1;
    }
    if ($client == 'admin') {
        $where = "client_id = 1";
        $lists['client_id'] = 1;
        $path = 'mod1_xml';
    } else {
        $where = "client_id = 0";
        $lists['client_id'] = 0;
        $path = 'mod0_xml';
    }
    $query = "SELECT position, ordering, showtitle, title" . "\n FROM #__modules" . "\n WHERE {$where}" . "\n ORDER BY ordering";
    $database->setQuery($query);
    if (!($orders = $database->loadObjectList())) {
        echo $database->stderr();
        return false;
    }
    $query = "SELECT position, description" . "\n FROM #__template_positions" . "\n WHERE position != ''" . "\n ORDER BY position";
    $database->setQuery($query);
    // hard code options for now
    $positions = $database->loadObjectList();
    $orders2 = array();
    $pos = array();
    foreach ($positions as $position) {
        $orders2[$position->position] = array();
        $pos[] = mosHTML::makeOption($position->position, $position->description);
    }
    $l = 0;
    $r = 0;
    for ($i = 0, $n = count($orders); $i < $n; $i++) {
        $ord = 0;
        if (array_key_exists($orders[$i]->position, $orders2)) {
            $ord = count(array_keys($orders2[$orders[$i]->position])) + 1;
        }
        $orders2[$orders[$i]->position][] = mosHTML::makeOption($ord, $ord . '::' . addslashes($orders[$i]->title));
    }
    // build the html select list
    $pos_select = 'onchange="changeDynaList(\'ordering\',orders,document.adminForm.position.options[document.adminForm.position.selectedIndex].value, originalPos, originalOrder)"';
    $active = $row->position ? $row->position : 'left';
    $lists['position'] = mosHTML::selectList($pos, 'position', 'class="inputbox" size="1" ' . $pos_select, 'value', 'text', $active);
    // get selected pages for $lists['selections']
    if ($uid) {
        $query = "SELECT menuid AS value" . "\n FROM #__modules_menu" . "\n WHERE moduleid = " . (int) $row->id;
        $database->setQuery($query);
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
        $lists['showtitle'] = 'N/A <input type="hidden" name="showtitle" value="1" />';
        $lists['selections'] = 'N/A';
    } else {
        if ($client == 'admin') {
            $lists['access'] = 'N/A';
            $lists['selections'] = 'N/A';
        } else {
            $lists['access'] = mosAdminMenus::Access($row);
            $lists['selections'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
        }
        $lists['showtitle'] = mosHTML::yesnoRadioList('showtitle', 'class="inputbox"', $row->showtitle);
    }
    // build the html select list for published
    $lists['published'] = mosAdminMenus::Published($row);
    $row->description = '';
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mainframe->getPath($path, $row->module);
    $xmlDoc = new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() == 'mosinstall' && $root->getAttribute('type') == 'module') {
            $element =& $root->getElementsByPath('description', 1);
            $row->description = $element ? trim($element->getText()) : '';
        }
    }
    // get params definitions
    $params = new mosParameters($row->params, $xmlfile, 'module');
    HTML_modules::editModule($row, $orders2, $lists, $params, $option);
}
예제 #18
0
function sendmail($con_id, $option)
{
    global $mainframe, $database, $Itemid;
    global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_db;
    // simple spoof check security
    josSpoofCheck(1);
    $query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE id = " . (int) $con_id;
    $database->setQuery($query);
    $contact = $database->loadObjectList();
    if (count($contact) > 0) {
        $default = $mosConfig_sitename . ' ' . _ENQUIRY;
        $email = strval(mosGetParam($_POST, 'email', ''));
        $text = strval(mosGetParam($_POST, 'text', ''));
        $name = strval(mosGetParam($_POST, 'name', ''));
        $subject = strval(mosGetParam($_POST, 'subject', $default));
        $email_copy = strval(mosGetParam($_POST, 'email_copy', 0));
        $menu = $mainframe->get('menu');
        $mparams = new mosParameters($menu->params);
        $bannedEmail = $mparams->get('bannedEmail', '');
        $bannedSubject = $mparams->get('bannedSubject', '');
        $bannedText = $mparams->get('bannedText', '');
        $sessionCheck = $mparams->get('sessionCheck', 1);
        // check for session cookie
        if ($sessionCheck) {
            // Session Cookie `name`
            $sessionCookieName = mosMainFrame::sessionCookieName();
            // Get Session Cookie `value`
            $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
            if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
                mosErrorAlert(_NOT_AUTH);
            }
        }
        // Prevent form submission if one of the banned text is discovered in the email field
        if ($bannedEmail) {
            $bannedEmail = explode(';', $bannedEmail);
            foreach ($bannedEmail as $value) {
                if (stristr($email, $value)) {
                    mosErrorAlert(_NOT_AUTH);
                }
            }
        }
        // Prevent form submission if one of the banned text is discovered in the subject field
        if ($bannedSubject) {
            $bannedSubject = explode(';', $bannedSubject);
            foreach ($bannedSubject as $value) {
                if (stristr($subject, $value)) {
                    mosErrorAlert(_NOT_AUTH);
                }
            }
        }
        // Prevent form submission if one of the banned text is discovered in the text field
        if ($bannedText) {
            $bannedText = explode(';', $bannedText);
            foreach ($bannedText as $value) {
                if (stristr($text, $value)) {
                    mosErrorAlert(_NOT_AUTH);
                }
            }
        }
        // test to ensure that only one email address is entered
        $check = explode('@', $email);
        if (strpos($email, ';') || strpos($email, ',') || strpos($email, ' ') || count($check) > 2) {
            mosErrorAlert(_CONTACT_MORE_THAN);
        }
        if (!$email || !$text || JosIsValidEmail($email) == false) {
            mosErrorAlert(_CONTACT_FORM_NC);
        }
        $prefix = sprintf(_ENQUIRY_TEXT, $mosConfig_live_site);
        $text = $prefix . "\n" . $name . ' <' . $email . '>' . "\n\n" . stripslashes($text);
        $success = mosMail($email, $name, $contact[0]->email_to, $mosConfig_fromname . ': ' . $subject, $text);
        if (!$success) {
            mosErrorAlert(_CONTACT_FORM_NC);
        }
        // parameter check
        $params = new mosParameters($contact[0]->params);
        $emailcopyCheck = $params->get('email_copy', 0);
        // check whether email copy function activated
        if ($email_copy && $emailcopyCheck) {
            $copy_text = sprintf(_COPY_TEXT, $contact[0]->name, $mosConfig_sitename);
            $copy_text = $copy_text . "\n\n" . $text . '';
            $copy_subject = _COPY_SUBJECT . $subject;
            $success = mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $copy_subject, $copy_text);
            if (!$success) {
                mosErrorAlert(_CONTACT_FORM_NC);
            }
        }
        $link = sefRelToAbs('index.php?option=com_contact&task=view&contact_id=' . $contact[0]->id . '&Itemid=' . $Itemid);
        mosRedirect($link, _THANK_MESSAGE);
    }
}
예제 #19
0
/**
* Save the item(s) to the menu selected
*/
function copyMenuSave($option, $cid, $menu, $menutype)
{
    global $database;
    $curr = new mosMenu($database);
    $cidref = array();
    foreach ($cid as $id) {
        $curr->load($id);
        $curr->id = NULL;
        if (!$curr->store()) {
            mosErrorAlert($curr->getError());
            exit;
        }
        $cidref[] = array($id, $curr->id);
    }
    foreach ($cidref as $ref) {
        $curr->load($ref[1]);
        if ($curr->parent != 0) {
            $found = false;
            foreach ($cidref as $ref2) {
                if ($curr->parent == $ref2[0]) {
                    $curr->parent = $ref2[1];
                    $found = true;
                    break;
                }
            }
            // if
            if (!$found && $curr->menutype != $menu) {
                $curr->parent = 0;
            }
        }
        // if
        $curr->menutype = $menu;
        $curr->ordering = '9999';
        if (!$curr->store()) {
            mosErrorAlert($curr->getError());
            exit;
        }
        $curr->updateOrder('menutype = ' . $database->Quote($curr->menutype) . ' AND parent = ' . (int) $curr->parent);
    }
    // foreach
    // clean any existing cache files
    mosCache::cleanCache('com_content');
    $msg = count($cid) . ' Itens de menu copiado para ' . $menu;
    mosRedirect('index2.php?option=' . $option . '&menutype=' . $menutype . '&mosmsg=' . $msg);
}
예제 #20
0
 function publishPlugins($publishing = true)
 {
     global $database, $allow;
     foreach ($this->plugins as $plugin) {
         if ($plugin->type == 'encoding' && !file_exists($plugin->value)) {
             //configuration value of the encoding plugin stores full path to the encoder executable
             //if it does not exist - plugin won't work
             $tmp = mosGetParam($_REQUEST, $plugin->name);
             if ($tmp == 1) {
                 $msg = _JAS_PLG_ERROR;
             }
             $query = "update #__ad_agency_plugins set publishing=0 where name='" . $plugin->name . "'";
             $database->setQuery($query);
             $database->query();
             continue;
         }
         $param[$plugin->name] = mosGetParam($_REQUEST, $plugin->name);
     }
     foreach ($param as $i => $v) {
         if ($v == 1 && $publishing) {
             $query = "select value from #__ad_agency_plugins where name='" . $i . "'";
             $database->setQuery($query);
             $allow = $database->loadResult();
             if ($allow) {
                 $query = "update #__ad_agency_plugins set publishing=1 where name='" . $i . "'";
                 $database->setQuery($query);
                 $database->query();
             } else {
                 if (!$allow) {
                     mosErrorAlert(_JAS_PLG_UNCOMPLETED);
                     exit;
                 }
             }
         } elseif ($v == 1) {
             $query = "update #__ad_agency_plugins set publishing=0 where name='" . $i . "'";
             $database->setQuery($query);
             $database->query();
         }
     }
     return $msg;
 }
예제 #21
0
 function editForm($tpl = null)
 {
     $helper = new adagencyAdminModeladagencyTextlink();
     $helperView = new adagencyAdminViewadagencyTextlink();
     global $mainframe;
     $data = JRequest::get('post');
     $db = JFactory::getDBO();
     $ad = $this->get('ad');
     $advertiser_id = JRequest::getVar('advertiser_id', '', 'post');
     if (isset($_SESSION['newest_adv']) & $advertiser_id == "" && $_SESSION['newest_adv'] != '') {
         $advertiser_id = $_SESSION['newest_adv'] + 1;
     }
     if (isset($_SESSION['newest_adv'])) {
         unset($_SESSION['newest_adv']);
     }
     $configs = $this->getModel("adagencyConfig")->getConf();
     $configs->geoparams = @unserialize($configs->geoparams);
     if (isset($ad->id) && $ad->id != 0) {
         $channel = $this->getModel("adagencyTextlink")->getChannel($ad->id);
     } else {
         $channel = NULL;
     }
     if (isset($_SESSION['channelz'])) {
         $channel = new stdClass();
         $channel->sets[0] = $_SESSION['channelz'];
         unset($_SESSION['channelz']);
     }
     if (isset($_SESSION['channelz2'])) {
         $channel = NULL;
         $ad->channel_id = $_SESSION['channelz2'];
         unset($_SESSION['channelz2']);
     }
     if (!$advertiser_id) {
         $advertiser_id = $ad->advertiser_id;
     }
     $isNew = $ad->id < 1;
     $text = $isNew ? JText::_('AD_NEW') : JText::_('AD_EDIT');
     if (!$isNew) {
         $advertiser_id = $ad->advertiser_id;
         if (!is_array($ad->parameters)) {
             $ad->parameters = unserialize($ad->parameters);
         }
         if (is_array($ad->parameters)) {
             foreach ($ad->parameters as $key => $value) {
                 $key = str_replace("\\'", "", $key);
                 $ad->parameters[$key] = $value;
             }
         }
         if (!isset($ad->parameters['align'])) {
             $ad->parameters['align'] = '';
         }
         if (!isset($ad->parameters['target_window'])) {
             $ad->parameters['target_window'] = '';
         }
         if (!isset($ad->parameters['font_family'])) {
             $ad->parameters['font_family'] = '';
         }
         if (!isset($ad->parameters['font_family_b'])) {
             $ad->parameters['font_family_b'] = '';
         }
         if (!isset($ad->parameters['font_family_a'])) {
             $ad->parameters['font_family_a'] = '';
         }
         if (!isset($ad->parameters['font_weight'])) {
             $ad->parameters['font_weight'] = '';
         }
         if (!isset($ad->parameters['font_weight_b'])) {
             $ad->parameters['font_weight_b'] = '';
         }
         if (!isset($ad->parameters['font_weight_a'])) {
             $ad->parameters['font_weight_a'] = '';
         }
         if (!isset($ad->parameters['font_size'])) {
             $ad->parameters['font_size'] = '';
         }
         if (!isset($ad->parameters['font_size_b'])) {
             $ad->parameters['font_size_b'] = '';
         }
         if (!isset($ad->parameters['font_size_a'])) {
             $ad->parameters['font_size_a'] = '';
         }
     } else {
         $ad->parameters['align'] = '';
         $ad->parameters['target_window'] = '';
         $ad->parameters['font_family'] = '';
         $ad->parameters['font_family_b'] = '';
         $ad->parameters['font_family_a'] = '';
         $ad->parameters['font_weight'] = '';
         $ad->parameters['font_weight_a'] = '';
         $ad->parameters['font_weight_b'] = '';
         $ad->parameters['font_size'] = '';
         $ad->parameters['font_size_b'] = '';
         $ad->parameters['font_size_a'] = '';
     }
     //get the image folder
     $imgfolder = $configs->imgfolder;
     if (intval($advertiser_id) > 0) {
         $imagepath = str_replace("/administrator", "", JPATH_BASE);
         $imagepath = $imagepath . "/images/stories/";
         $newimgfolder = $imgfolder . "/" . $advertiser_id;
         if (!is_dir($imagepath . $newimgfolder)) {
             @mkdir($imagepath . "/" . $newimgfolder);
             @chmod($imagepath . "/" . $newimgfolder, 0755);
         } else {
             @chmod($imagepath . "/" . $newimgfolder, 0755);
         }
     }
     //end image folder
     // Imagelist
     $javascript = 'onchange="changeDisplayImage();"';
     $directory = "/images/stories/" . $imgfolder . "/{$advertiser_id}";
     // $livesite = $mainframe->getSiteURL();
     $absolutepath = JPATH_SITE;
     $image_folder = "{$absolutepath}{$directory}";
     $lists['image_path'] = "/images/stories/" . $imgfolder . "/{$advertiser_id}/";
     if (!is_dir($image_folder)) {
         @mkdir($image_folder, 0755);
         @chmod($mosConfig_absolute_path . "/images/stories/" . $imgfolder, 0755);
     }
     $javascript = 'onchange="changeDisplayImage();"';
     if (isset($this->uploaded_file)) {
         $ad->image_url = $this->uploaded_file;
     }
     $lists['image_url'] = JHTML::_('list.images', 'image_url', $ad->image_url, $javascript, $directory, $extensions = "bmp|gif|jpg|png|jpeg");
     $lists['image_directory'] = "../images/stories/" . $imgfolder . "/" . $advertiser_id . "/";
     $director = $image_folder;
     $imgs = $helperView->scandir_php4($director);
     $realimgs = array();
     foreach ($imgs as $img) {
         if (is_file($director . "/" . $img)) {
             $props = @getimagesize($director . "/" . $img);
             if ($props === false) {
                 continue;
             }
             array_push($realimgs, array("width" => $props[0], "height" => $props[1], "name" => "'" . addslashes($img) . "'"));
         }
     }
     if (isset($ad->image_url)) {
         $imgdt = @getimagesize($director . "/" . $ad->image_url);
         $selsize['width'] = $imgdt[0];
         $selsize['height'] = $imgdt[1];
     } else {
         $selsize['width'] = '';
         $selsize['height'] = '';
     }
     //		echo "<pre>";var_dump($props);die();
     //////////////
     if ($isNew) {
         $ad->approved = 'Y';
     }
     JToolBarHelper::title(JText::_('VIEWTREEADDTEXTLINK') . ":<small>[" . $text . "]</small>");
     if ($isNew) {
         JToolBarHelper::apply('apply');
         JToolBarHelper::save('save');
         JToolBarHelper::cancel('cancel');
     } else {
         JToolBarHelper::apply('apply');
         JToolBarHelper::save('save');
         JToolBarHelper::cancel('cancel');
     }
     $javascript = 'onchange="submitbutton(\'edit\');"';
     $advertisers[] = JHTML::_('select.option', "0", JText::_('AD_SELECT_ADVERTISER'), 'aid', 'company');
     $advertisersloaded = $helper->gettextlistAdvertisers();
     $advertisers = array_merge($advertisers, $advertisersloaded);
     $lists['advertiser_id'] = JHTML::_('select.genericlist', $advertisers, 'advertiser_id', 'class="inputbox" size="1"' . $javascript, 'aid', 'company', $advertiser_id);
     $sts_select = new StdClass();
     $sts_select->status = JText::_("ADAG_SEL_STS");
     $sts_select->value = '';
     $sts_approve = new StdClass();
     $sts_approve->status = JText::_("AD_APPROVED");
     $sts_approve->value = "Y";
     $sts_decline = new StdClass();
     $sts_decline->status = JText::_("ADAG_DECLINED");
     $sts_decline->value = "N";
     $sts_pending = new StdClass();
     $sts_pending->status = JText::_("ADAG_PENDING");
     $sts_pending->value = 'P';
     $statuses[] = $sts_select;
     $statuses[] = $sts_approve;
     $statuses[] = $sts_decline;
     $statuses[] = $sts_pending;
     $lists['approved'] = JHTML::_('select.genericlist', $statuses, 'approved', 'class="inputbox" size="1"', 'value', 'status', $ad->approved);
     // Window option
     $window[] = JHTML::_('select.option', '_blank', JText::_('AD_OPENNEWWINDOW'), 'value', 'option');
     $window[] = JHTML::_('select.option', '_self', JText::_('AD_OPENSAMEWINDOW'), 'value', 'option');
     $lists['window'] = JHTML::_('select.genericlist', $window, 'parameters[target_window]', 'class="inputbox" size="1"  id="show_hide_box"', 'value', 'option', $ad->parameters['target_window']);
     // Channels list - begin
     if (isset($ad->channel_id)) {
         $default_channel = $ad->channel_id;
     } else {
         $default_channel = NULL;
     }
     $sql = "SELECT id,name FROM #__ad_agency_channels";
     $db->setQuery($sql);
     $the_channels = $db->loadObjectList();
     $channels[] = JHTML::_('select.option', "0", ' - ' . strtolower(JText::_('ADAG_NONE')) . ' - ', 'id', 'name');
     $channels = array_merge($channels, $the_channels);
     $lists['channel_id'] = JHTML::_('select.genericlist', $channels, 'channel_id', 'class="inputbox" size="1"', 'id', 'name', $default_channel);
     // Channels list - end
     // Font family
     $font_family[] = JHTML::_('select.option', '', JText::_('ADAG_DEFAULT'), 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Arial', 'Arial', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Helvetica', 'Helvetica', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Garamond', 'Garamond', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'sans-serif', 'Sans Serif', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Verdana', 'Verdana', 'value', 'option');
     $lists['font_family'] = JHTML::_('select.genericlist', $font_family, 'parameters[font_family]', 'class="inputbox" size="1" onChange="javascript:changeFontTitle()" ', 'value', 'option', $ad->parameters['font_family']);
     $lists['font_family_b'] = JHTML::_('select.genericlist', $font_family, 'parameters[font_family_b]', 'class="inputbox" size="1" onChange="javascript:changeFontBody()" ', 'value', 'option', $ad->parameters['font_family_b']);
     $lists['font_family_a'] = JHTML::_('select.genericlist', $font_family, 'parameters[font_family_a]', 'class="inputbox" size="1" onChange="javascript:changeFontAction()" ', 'value', 'option', $ad->parameters['font_family_a']);
     // Font size
     if (isset($ad->parameters)) {
         $font_size_value = $ad->parameters['font_size'] > 0 ? $ad->parameters['font_size'] : 14;
         $lists["font_size"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size]', 'class="inputbox" onChange="javascript:changeFSTitle()"', $font_size_value);
         $font_size_value_b = $ad->parameters['font_size_b'] > 0 ? $ad->parameters['font_size_b'] : 12;
         $lists["font_size_b"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size_b]', 'class="inputbox" onChange="javascript:changeFSBody()"', $font_size_value_b);
         $font_size_value_a = $ad->parameters['font_size_a'] > 0 ? $ad->parameters['font_size_a'] : 12;
         $lists["font_size_a"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size_a]', 'class="inputbox" onChange="javascript:changeFSAction()"', $font_size_value_a);
     } else {
         $font_size_value = 14;
         $font_size_value_b = 12;
         $font_size_value_a = 12;
         $lists["font_size"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size]', 'class="inputbox"', $font_size_value);
         $lists["font_size_b"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size_b]', 'class="inputbox"', $font_size_value_b);
         $lists["font_size_a"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size_a]', 'class="inputbox"', $font_size_value_a);
     }
     // Padding  property
     $lists['padding'] = JHTML::_('select.integerlist', 0, 25, 1, 'parameters[padding]', 'class="inputbox" onChange="changePadding();" ', @$ad->parameters['padding']);
     // Border property
     $lists["border"] = JHTML::_('select.integerlist', 0, 25, 1, 'parameters[border]', 'class="inputbox" onChange="changeBorder();"', @$ad->parameters['border']);
     // Alignment options :
     $alignments[] = JHTML::_('select.option', "left", JText::_('AD_LEFT'), 'value', 'option');
     $alignments[] = JHTML::_('select.option', "center", JText::_('AD_CENTER'), 'value', 'option');
     $alignments[] = JHTML::_('select.option', "right", JText::_('AD_RIGHT'), 'value', 'option');
     $lists['alignment'] = JHTML::_('select.genericlist', $alignments, 'parameters[align]', 'class="inputbox" size="1"', 'value', 'option', $ad->parameters['align']);
     // Image alignment options :
     /*$js_alignments2 = ' onchange="setImageAlign();" ';
     		if(!isset($ad->parameters['ia'])) { $ad->parameters['ia'] = NULL; }
     		$alignments2[] = JHTML::_('select.option',  "t", JText::_('AD_TOP'), 'value', 'option' );
     		$alignments2[] = JHTML::_('select.option',  "l", JText::_('AD_LEFT'), 'value', 'option' );
     		$alignments2[] = JHTML::_('select.option',  "r", JText::_('AD_RIGHT'), 'value', 'option' );
     		$lists['ia']  =  JHTML::_( 'select.genericlist', $alignments2, 'parameters[ia]', 'class="inputbox" size="1"'.$js_alignments2,'value', 'option', $ad->parameters['ia']);
     
     		$js_wrap = ' onchange="setImageWrap();" ';
     		if(!isset($ad->parameters['wrap_img'])) { $ad->parameters['wrap_img'] = '0'; }
     		$wraps[] = JHTML::_('select.option',  "0", JText::_('JAS_NO'), 'value', 'option' );
     		$wraps[] = JHTML::_('select.option',  "1", JText::_('JAS_YES'), 'value', 'option' );
     		$lists['wrap_img'] = JHTML::_( 'select.genericlist', $wraps, 'parameters[wrap_img]', 'class="inputbox" size="1"'.$js_wrap,'value', 'option', $ad->parameters['wrap_img']);
     	*/
     // Font weight
     if (isset($ad->parameters['font_weight']) && $ad->parameters['font_weight'] != '') {
         $font_weight_value = $ad->parameters['font_weight'] != "" ? $ad->parameters['font_weight'] : "normal";
         $font_weight_value_b = $ad->parameters['font_weight_b'] != "" ? $ad->parameters['font_weight_b'] : "normal";
         $font_weight_value_a = $ad->parameters['font_weight_a'] != "" ? $ad->parameters['font_weight_a'] : "normal";
     } else {
         $font_weight_value = "light underlined";
         $font_weight_value_b = "normal";
         $font_weight_value_a = "light underlined";
     }
     $font_weight[] = JHTML::_('select.option', 'lighter underlined', 'light underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'lighter underlined', 'lighter underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bold underlined', 'bold underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bolder underlined', 'bolder underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'lighter', 'lighter', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'normal', 'normal', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bold', 'bold', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bolder', 'bolder', 'value', 'option');
     $lists['font_weight'] = JHTML::_('select.genericlist', $font_weight, 'parameters[font_weight]', 'class="inputbox" size="1" onChange="javascript:changeFWTitle()" ', 'value', 'option', $font_weight_value);
     $lists['font_weight_b'] = JHTML::_('select.genericlist', $font_weight, 'parameters[font_weight_b]', 'class="inputbox" size="1" onChange="javascript:changeFWBody()" ', 'value', 'option', $font_weight_value_b);
     $lists['font_weight_a'] = JHTML::_('select.genericlist', $font_weight, 'parameters[font_weight_a]', 'class="inputbox" size="1" onChange="javascript:changeFWAction()" ', 'value', 'option', $font_weight_value_a);
     //Show Zone select
     //Show zones available for advertiser
     if ($advertiser_id != '' && $advertiser_id != 0) {
         if (!$isNew) {
             $sql = "SELECT `id`, `name` FROM #__ad_agency_campaign WHERE aid = " . $advertiser_id;
             $db->setQuery($sql);
             $assoc_camps = $db->loadObjectList();
         } else {
             $assoc_camps = NULL;
         }
         $this->assign("assoc_camps", $assoc_camps);
         $sql = "SELECT DISTINCT cb.campaign_id FROM #__ad_agency_banners AS b LEFT OUTER JOIN #__ad_agency_campaign_banner AS cb ON cb.banner_id=b.id WHERE b.advertiser_id={$advertiser_id} AND b.id=" . intval($ad->id);
         $db->setQuery($sql);
         $banners_camps = $db->loadColumn();
         $this->assign("banners_camps", (array) $banners_camps);
         $sql1 = "SELECT DISTINCT tid FROM #__ad_agency_order WHERE aid=" . $advertiser_id . " ";
         $db->setQuery($sql1);
         $the_advertiser_packages = $db->loadColumn();
         $nothing = "";
         foreach ($the_advertiser_packages as $pk) {
             $query = "SELECT zones_wildcard FROM #__ad_agency_order_type WHERE tid=" . $pk . " ";
             $db->setQuery($query);
             $rezult_wild = $db->loadResult();
             $rezult_wild = explode("|", $rezult_wild);
             $rezult_wild = implode(",", $rezult_wild);
             $nothing .= $rezult_wild . " ";
         }
         $wildzones = substr(str_replace(" ", ",", $nothing), 0, -1);
         if ($wildzones == false) {
             $wildzones = "''";
         }
         if (strstr($wildzones, ",,")) {
             $wildzones = "''";
         }
         $the_advertiser_packages = implode(",", $the_advertiser_packages);
         if ($the_advertiser_packages == "") {
             $notice_cond = "-1";
         } else {
             $notice_cond = "-1,";
         }
         $sql2 = "SELECT DISTINCT zones FROM #__ad_agency_order_type WHERE tid IN (" . $notice_cond . $the_advertiser_packages . ") ";
         $db->setQuery($sql2);
         $packages_positions = $db->loadColumn();
         @($packages_positions = implode("','", $packages_positions));
         // If we have one package that contains All Zones, then we don't need a condition
         $packages_positions = str_replace("|", "','", $packages_positions);
         if (!preg_match("/All Zones/i", $packages_positions)) {
             $packages_positions = "('" . $packages_positions . "')";
             $condition = " AND position IN " . $packages_positions . " ";
         }
         if (!isset($condition)) {
             $condition = "";
         }
         if ($wildzones[0] == ',') {
             $wildzones = substr($wildzones, 1, strlen($wildzones));
         }
         if ($wildzones[strlen($wildzones) - 1] == ',') {
             $wildzones = substr($wildzones, 0, strlen($wildzones) - 1);
         }
         if ($wildzones == "" || $wildzones == ",") {
             $wildzones = "''";
         }
         $sql = "SELECT id, title FROM #__modules WHERE module='mod_ijoomla_adagency_zone' " . $condition . " OR id IN (" . $wildzones . ") ORDER BY title ASC";
         $db->setQuery($sql);
         if (!$db->query()) {
             mosErrorAlert($db->getErrorMsg());
             return;
         }
         if (!isset($ad->zone) && isset($data['zone'])) {
             $ad->zone = $data['zone'];
         }
         $the_zzones = $db->loadRowlist();
         $zone[] = JHTML::_('select.option', "0", JText::_('AD_SELECT_ZONE'), 'id', 'title');
         $zone = array_merge($zone, $db->loadObjectList());
         $lists['zone_id'] = JHTML::_('select.genericlist', $zone, 'zone', 'class="inputbox" size="1"', 'id', 'title', $ad->zone);
     } else {
         $no_advertiser_sel = JText::_('ADS_SEL_ADV');
     }
     //END Show Zone select
     /////////////////////
     if (isset($the_zzones) && $the_zzones != NULL) {
         $lists['zone_id'] = "<select id='zone' class='inputbox' size='1' name='zone'>\n\t\t\t<option value='0'>" . JText::_("AD_SELECT_ZONE") . "</option>";
         foreach ($the_zzones as $value) {
             if (isset($ad->zone) && $ad->zone == $value[0]) {
                 $current_selected = "selected='selected'";
             } else {
                 $current_selected = "";
             }
             $already[] = $value[0];
             $lists['zone_id'] .= "<option value='" . $value[0] . "' " . $current_selected . ">" . $value[1] . "</option>";
         }
         $sql_allzones = "SELECT z.zoneid, z.z_title\n\t\t\tFROM #__ad_agency_zone AS z\n\t\t\tLEFT JOIN #__modules AS m ON z.zoneid = m.id\n\t\t\tWHERE m.module = 'mod_ijoomla_adagency_zone'";
         $db->setQuery($sql_allzones);
         $all_existing_zones = $db->loadRowlist();
         if (isset($all_existing_zones)) {
             foreach ($all_existing_zones as $currentz) {
                 if (!in_array($currentz[0], $already)) {
                     if (isset($ad->zone) && $ad->zone == $currentz[0]) {
                         $current_selected = "selected='selected'";
                     } else {
                         $current_selected = "";
                     }
                     $lists['zone_id'] .= "<option value='" . $currentz[0] . "' " . $current_selected . " style='font-size: 12px; color: #FF0000;'>" . $currentz[1] . "</option>";
                 }
             }
         }
         $lists['zone_id'] .= "</select>";
     } else {
         $lists['zone_id'] = "<select id='zone' class='inputbox' size='1' name='zone'>\n\t\t\t<option value='0'>" . JText::_("AD_SELECT_ZONE") . "</option>";
         $sql_allzones = "SELECT z.zoneid, z.z_title\n\t\t\tFROM #__ad_agency_zone AS z\n\t\t\tLEFT JOIN #__modules AS m ON z.zoneid = m.id\n\t\t\tWHERE m.module = 'mod_ijoomla_adagency_zone'";
         $db->setQuery($sql_allzones);
         $all_existing_zones = $db->loadRowlist();
         if (isset($all_existing_zones)) {
             foreach ($all_existing_zones as $currentz) {
                 if (isset($ad->zone) && $ad->zone == $currentz[0]) {
                     $current_selected = "selected='selected'";
                 } else {
                     $current_selected = "";
                 }
                 $lists['zone_id'] .= "<option value='" . $currentz[0] . "' " . $current_selected . " style='font-size: 12px; color: #FF0000;'>" . $currentz[1] . "</option>";
             }
         }
         $lists['zone_id'] .= "</select>";
     }
     if (isset($no_advertiser_sel)) {
         $lists['zone_id'] = JText::_("AD_WARN_SEL_ADV");
     }
     //////////////
     ///===================select available campaigns============================
     $adv_id = $advertiser_id;
     if ($adv_id) {
         $camps = $this->getModel("adagencyTextlink")->getCampsByAid($adv_id);
     } else {
         $camps = '';
     }
     $lists['prevzones'] = NULL;
     $lists['hidden_zones'] = NULL;
     $text_zones = $this->getModel("adagencyTextlink")->getPrevZones();
     if ($text_zones != NULL && is_array($text_zones)) {
         foreach ($text_zones as $element) {
             $lists['prevzones'] .= '<option value="' . $element->zoneid . '">' . $element->z_title . '</option>';
             $lists['hidden_zones'] .= "<input type='hidden' id='z" . $element->zoneid . "' value='" . $element->textadparams . "' />";
         }
     }
     //echo "<pre>";var_dump($lists['prevzones']);die();
     //$lists['prevzones']
     $max_chars = $configs->maxchars;
     if ($advertiser_id > 0) {
         $advt = $this->getModel("adagencyConfig")->getAdvById($advertiser_id);
     } else {
         $advt = NULL;
     }
     $exist_zone = $this->get('ExistsZone');
     if (!$exist_zone) {
         $no_zone = "<div id=\"system-message-container\">\n\t\t\t\t\t\t\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n\t\t\t\t\t\t\t<div class=\"alert alert-notice\">\n\t\t\t\t\t\t\t\t<p>" . JText::_('ADAG_NO_ZONE_TYPE') . ".&nbsp;&nbsp; <a href='http://www.ijoomla.com/redirect/adagency/ad_support.htm' target='_blank'>" . JText::_('AD_VIDEO') . "<img src='components/com_adagency/images/icon_video.gif' alt='watch video'></a></p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>";
     } else {
         $no_zone = NULL;
     }
     if ((!is_array($camps) || count($camps) <= 0) && $advt != NULL && $no_zone == NULL) {
         $no_zone = "<div id=\"system-message-container\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n\t\t\t\t\t\t\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n\t\t\t\t\t\t\t<div class=\"alert alert-notice\">\n\t\t\t\t\t\t\t\t<p>" . JText::_('ADAG_NO_CAMP_TYPE') . ".&nbsp;&nbsp; <a href='http://www.ijoomla.com/redirect/adagency/ad_support.htm' target='_blank'>" . JText::_('AD_VIDEO') . "<img src='components/com_adagency/images/icon_video.gif' alt='watch video'></a></p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>";
     }
     $query = "SELECT `params` FROM #__ad_agency_settings ORDER BY id ASC LIMIT 1";
     $db->setQuery($query);
     $params = $db->loadColumn();
     $params = unserialize($params["0"]);
     $campaigns_zones = $this->getModel("adagencyTextlink")->getCampZones($camps);
     $czones = $this->getModel("adagencyTextlink")->processCampZones($camps);
     $czones_select = $this->getModel("adagencyTextlink")->createSelectBox($czones, $ad->id, $ad);
     $camps = $this->getModel("adagencyTextlink")->getCampsByAid($adv_id, 1);
     $this->assign("campaigns_zones", $campaigns_zones);
     $this->assign("czones", $czones);
     $this->assign("czones_select", $czones_select);
     $this->assign("no_zone", $no_zone);
     $this->assign("advt", $advt);
     $this->assign('selsize', $selsize);
     $this->assign('advertiser_id', $advertiser_id);
     $this->assign("configs", $configs);
     $this->assign("channel", $channel);
     $this->assign("ad", $ad);
     $this->assign("max_chars", $max_chars);
     $this->assign("lists", $lists);
     $this->assign("data", $data);
     $this->assign("camps", $camps);
     $this->assign("realimgs", $realimgs);
     $this->assign("params", $params);
     parent::display($tpl);
 }
예제 #22
0
 function addad($tpl = null)
 {
     $helperView = new adagencyAdminViewadagencyStandard();
     global $mainframe;
     $data = JRequest::get('post');
     $db = JFactory::getDBO();
     $ad = $this->get('ad');
     $advertiser_id = JRequest::getVar('advertiser_id', '', 'post');
     //get the image folder
     $sqla = "SELECT `imgfolder` FROM #__ad_agency_settings LIMIT 1";
     $db->setQuery($sqla);
     $db->query();
     $imgfolder = $db->loadResult();
     if (intval($advertiser_id) > 0) {
         $imagepath = str_replace("/administrator", "", JPATH_BASE);
         $imagepath = $imagepath . "/images/stories/";
         $newimgfolder = $imgfolder . "/" . $advertiser_id;
         if (!is_dir($imagepath . $newimgfolder)) {
             @mkdir($imagepath . "/" . $newimgfolder);
             @chmod($imagepath . "/" . $newimgfolder, 0755);
         } else {
             @chmod($imagepath . "/" . $newimgfolder, 0755);
         }
     }
     //end image folder
     $isNew = $ad->id < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     if (!$isNew) {
         $advertiser_id = $ad->advertiser_id;
         if (!is_array($ad->parameters)) {
             $ad->parameters = unserialize($ad->parameters);
         }
         if ($ad->approved == 'N') {
             $ad->approved = '0';
         } else {
             $ad->approved = '1';
         }
         if (!isset($ad->parameters['align'])) {
             $ad->parameters['align'] = '';
         }
         if (!isset($ad->parameters['target_window'])) {
             $ad->parameters['target_window'] = '';
         }
     } else {
         $ad->parameters['align'] = '';
         $ad->parameters['target_window'] = '';
     }
     JToolBarHelper::title(JText::_('VIEWTREEADDSTANDARD') . ":<small>[" . $text . "]</small>");
     if ($isNew) {
         JToolBarHelper::save('save');
         JToolBarHelper::cancel('cancel');
     } else {
         JToolBarHelper::save('save');
         JToolBarHelper::cancel('cancel');
     }
     if ($isNew) {
         $ad->approved = '1';
     }
     //================check if the banner is added to a campaign===============
     $sqla = "SELECT count(*) FROM #__ad_agency_campaign_banner WHERE `banner_id`=" . intval($ad->id);
     $db->setQuery($sqla);
     $db->query();
     $added = $db->loadResult();
     $javascript = 'onchange="submitbutton(\'edit\');"';
     $advertisers[] = JHTML::_('select.option', "0", JText::_('AD_SELECT_ADVERTISER'), 'aid', 'company');
     $advertisersloaded = $helper->getstandardlistAdvertisers();
     $advertisers = array_merge($advertisers, $advertisersloaded);
     $lists['advertiser_id'] = JHTML::_('select.genericlist', $advertisers, 'advertiser_id', 'class="inputbox" size="1"' . $javascript, 'aid', 'company', $advertiser_id);
     $lists['approved'] = JHTML::_('select.booleanlist', 'approved', '', $ad->approved);
     // Padding  property
     $lists['padding'] = JHTML::_('select.integerlist', 0, 25, 1, 'parameters[padding]', 'class="inputbox"', @$ad->parameters['padding']);
     // Border property
     $lists["border"] = JHTML::_('select.integerlist', 0, 25, 1, 'parameters[border]', 'class="inputbox"', @$ad->parameters['border']);
     // Alignment options :
     $alignments[] = JHTML::_('select.option', "0", JText::_('position'), 'value', 'option');
     $alignments[] = JHTML::_('select.option', "left", JText::_('left'), 'value', 'option');
     $alignments[] = JHTML::_('select.option', "center", JText::_('center'), 'value', 'option');
     $alignments[] = JHTML::_('select.option', "right", JText::_('right'), 'value', 'option');
     $lists['align'] = JHTML::_('select.genericlist', $alignments, 'parameters[align]', 'class="inputbox" size="1"', 'value', 'option', $ad->parameters['align']);
     // Window option
     $window[] = JHTML::_('select.option', '_blank', JText::_('open in new window'), 'value', 'option');
     $window[] = JHTML::_('select.option', '_self', JText::_('open in the same window'), 'value', 'option');
     $lists['window'] = JHTML::_('select.genericlist', $window, 'parameters[target_window]', 'class="inputbox" size="1"  id="show_hide_box"', 'value', 'option', $ad->parameters['target_window']);
     // Imagelist
     $javascript = 'onchange="changeDisplayImage1();"';
     $directory = "/images/stories/" . $imgfolder . "/{$advertiser_id}";
     $livesite = $mainframe->getSiteURL();
     $absolutepath = JPATH_SITE;
     $image_folder = "{$absolutepath}{$directory}";
     $lists['image_path'] = "/images/stories/" . $imgfolder . "/{$advertiser_id}/";
     if (!is_dir($image_folder)) {
         @mkdir($image_folder, 0755);
         @chmod($mosConfig_absolute_path . "/images/stories/" . $imgfolder, 0755);
     }
     $javascript = 'onchange="changeDisplayImage1();"';
     $lists['image_url'] = JHTML::_('list.images', 'image_url', $ad->image_url, $javascript, $directory, $extensions = "bmp|gif|jpg|png|jpeg");
     $lists['image_directory'] = "../images/stories/" . $imgfolder . "/" . $advertiser_id . "/";
     $director = $image_folder;
     $imgs = $helperView->scandir_php4($director);
     $realimgs = array();
     foreach ($imgs as $img) {
         if (is_file($director . "/" . $img)) {
             $props = @getimagesize($director . "/" . $img);
             if ($props === false) {
                 continue;
             }
             array_push($realimgs, array("width" => $props[0], "height" => $props[1], "name" => "'" . addslashes($img) . "'"));
         }
     }
     //Show Zone select
     if ($advertiser_id != '') {
         $sql1 = "SELECT tid FROM #__ad_agency_order WHERE aid=" . $advertiser_id . " ";
         $db->setQuery($sql1);
         $the_advertiser_packages = $db->loadColumn();
         $the_advertiser_packages = implode(",", $the_advertiser_packages);
         $sql2 = "SELECT DISTINCT zones FROM #__ad_agency_order_type WHERE tid IN (" . $the_advertiser_packages . ") ";
         $db->setQuery($sql2);
         $packages_positions = $db->loadColumn();
         @($packages_positions = implode("','", $packages_positions));
         $packages_positions = "('" . $packages_positions . "')";
         $condition = " AND position IN " . $packages_positions . " ";
     }
     $sql = "SELECT id, title FROM #__modules WHERE module='mod_ijoomla_adagency_zone' " . $condition . "ORDER BY title ASC";
     $db->setQuery($sql);
     if (!$db->query()) {
         mosErrorAlert($db->getErrorMsg());
         return;
     }
     $zone[] = JHTML::_('select.option', "0", JText::_('AD_SELECT_ZONE'), 'id', 'title');
     $zone = array_merge($zone, $db->loadObjectList());
     $lists['zone_id'] = JHTML::_('select.genericlist', $zone, 'zone', 'class="inputbox" size="1"', 'id', 'title', $ad->zone);
     ///===================select available campaigns============================
     $adv_id = $advertiser_id;
     if ($adv_id) {
         $sqls = "SELECT `id`,`name` FROM #__ad_agency_campaign WHERE `aid`={$adv_id}";
         $db->setQuery($sqls);
         if (!$db->query()) {
             mosErrorAlert($db->getErrorMsg());
             return;
         }
         $camps = $db->loadObjectList();
     } else {
         $camps = '';
     }
     if (isset($_FILES['image_file'])) {
         $ad->swf_url = $_FILES['image_file']['name'];
     }
     $lists['image_url'] = JHTML::_('list.images', 'image', $ad->swf_url, $javascript, $directory);
     $director = $image_folder;
     $imgs = $helperView->scandir_php4($director);
     $realimgs = array();
     foreach ($imgs as $img) {
         if (is_file($director . "/" . $img)) {
             $props = @getimagesize($director . "/" . $img);
             if ($props === false) {
                 continue;
             }
             array_push($realimgs, array("width" => $props[0], "height" => $props[1], "name" => "'" . addslashes($img) . "'"));
         }
     }
     $lists['flash_directory'] = $mainframe->getSiteURL() . "/images/stories/" . $imgfolder . "/{$ad->advertiser_id}/";
     $javascript = 'onchange="changeDisplayFlash();"';
     $lists['swf_url'] = $helperView->listswfs('swf_url', $ad->swf_url, $javascript, $directory);
     if (isset($_POST['parameters']['popup_type'])) {
         $popup_check = $_POST['parameters']['popup_type'];
     } else {
         $popup_check = 'webpage';
     }
     if ($isNew) {
         $javascript = 'onchange="Change();"';
     } else {
         $javascript = 'onchange="Change();" disabled="disabled"';
     }
     $type[] = JHTML::_('select.option', 'webpage', 'webpage', 'value', 'option');
     $type[] = JHTML::_('select.option', 'image', 'image', 'value', 'option');
     $type[] = JHTML::_('select.option', 'html', 'html', 'value', 'option');
     $lists['type'] = JHTML::_('select.genericlist', $type, 'parameters[popup_type]', 'class="inputbox" size="1" ' . $javascript, 'value', 'option', $popup_check);
     // Imagelist
     $javascript = 'onchange="changeDisplayImage5();"';
     $directory = "/images/stories/" . $imgfolder . "/{$advertiser_id}";
     $livesite = $mainframe->getSiteURL();
     $absolutepath = JPATH_SITE;
     $image_folder = "{$absolutepath}{$directory}";
     $lists['image_path'] = "/images/stories/" . $imgfolder . "/{$advertiser_id}/";
     if (!is_dir($image_folder)) {
         @mkdir($image_folder, 0755);
         @chmod($mosConfig_absolute_path . "/images/stories/" . $imgfolder, 0755);
     }
     $javascript = 'onchange="changeDisplayImage5();"';
     $lists['image_url_5'] = JHTML::_('list.images', 'image_url_5', $ad->image_url, $javascript, $directory);
     $lists['image_directory'] = "../images/stories/" . $imgfolder . "/" . $advertiser_id . "/";
     $director = $image_folder;
     $imgs = $helperView->scandir_php4($director);
     $realimgs = array();
     foreach ($imgs as $img) {
         if (is_file($director . "/" . $img)) {
             $props = @getimagesize($director . "/" . $img);
             if ($props === false) {
                 continue;
             }
             array_push($realimgs, array("width" => $props[0], "height" => $props[1], "name" => "'" . addslashes($img) . "'"));
         }
     }
     $ad->parameters['font_family'] = '';
     $ad->parameters['font_family_b'] = '';
     $ad->parameters['font_family_a'] = '';
     $ad->parameters['font_weight'] = '';
     $ad->parameters['font_weight_a'] = '';
     $ad->parameters['font_weight_b'] = '';
     $ad->parameters['font_size'] = '';
     $ad->parameters['font_size_b'] = '';
     $ad->parameters['font_size_a'] = '';
     // Font family
     $font_family[] = JHTML::_('select.option', 'Arial', 'Arial', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Helvetica', 'Helvetica', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Garamond', 'Garamond', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'sans-serif', 'Sans Serif', 'value', 'option');
     $font_family[] = JHTML::_('select.option', 'Verdana', 'Verdana', 'value', 'option');
     $lists['font_family'] = JHTML::_('select.genericlist', $font_family, 'parameters[font_family]', 'class="inputbox" size="1"', 'value', 'option', $ad->parameters['font_family']);
     $lists['font_family_b'] = JHTML::_('select.genericlist', $font_family, 'parameters[font_family_b]', 'class="inputbox" size="1"', 'value', 'option', $ad->parameters['font_family_b']);
     $lists['font_family_a'] = JHTML::_('select.genericlist', $font_family, 'parameters[font_family_a]', 'class="inputbox" size="1"', 'value', 'option', $ad->parameters['font_family_a']);
     $font_size_value = 12;
     $font_size_value_b = 12;
     $font_size_value_a = 12;
     $lists["font_size"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size]', 'class="inputbox"', $font_size_value);
     $lists["font_size_b"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size_b]', 'class="inputbox"', $font_size_value_b);
     $lists["font_size_a"] = JHTML::_('select.integerlist', 1, 48, 1, 'parameters[font_size_a]', 'class="inputbox"', $font_size_value_a);
     $font_weight_value = "normal";
     $font_weight_value_b = "normal";
     $font_weight_value_a = "normal";
     $font_weight[] = JHTML::_('select.option', 'lighter', 'lighter', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'normal', 'normal', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bold', 'bold', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bolder', 'bolder', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'ligher underlined', 'ligher underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'light underlined', 'light underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bold underlined', 'bold underlined', 'value', 'option');
     $font_weight[] = JHTML::_('select.option', 'bolder underlined', 'bolder underlined', 'value', 'option');
     $lists['font_weight'] = JHTML::_('select.genericlist', $font_weight, 'parameters[font_weight]', 'class="inputbox" size="1"', 'value', 'option', $font_weight_value);
     $lists['font_weight_b'] = JHTML::_('select.genericlist', $font_weight, 'parameters[font_weight_b]', 'class="inputbox" size="1"', 'value', 'option', $font_weight_value_b);
     $lists['font_weight_a'] = JHTML::_('select.genericlist', $font_weight, 'parameters[font_weight_a]', 'class="inputbox" size="1"', 'value', 'option', $font_weight_value_a);
     $this->assign('advertiser_id', $advertiser_id);
     $this->assign("ad", $ad);
     $this->assign("added", $added);
     $this->assign("lists", $lists);
     $this->assign("data", $data);
     $this->assign("camps", $camps);
     $this->assign("realimgs", $realimgs);
     parent::display($tpl);
 }
    function edit(&$uid, $menutype, $option)
    {
        global $database, $my, $mainframe;
        global $mosConfig_absolute_path;
        $menu = new mosMenu($database);
        $menu->load((int) $uid);
        // fail if checked out not by 'me'
        if ($menu->checked_out && $menu->checked_out != $my->id) {
            mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
        }
        if ($uid) {
            $menu->checkout($my->id);
        } else {
            // load values for new entry
            $menu->type = 'newsfeed_link';
            $menu->menutype = $menutype;
            $menu->browserNav = 0;
            $menu->ordering = 9999;
            $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
            $menu->published = 1;
        }
        if ($uid) {
            $temp = explode('feedid=', $menu->link);
            $query = "SELECT *, c.title AS category" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.id = " . (int) $temp[1];
            $database->setQuery($query);
            $newsfeed = $database->loadObjectlist();
            // outputs item name, category & section instead of the select list
            $lists['newsfeed'] = '
			<table width="100%">
			<tr>
				<td width="10%">
				Item:
				</td>
				<td>
				' . $newsfeed[0]->name . '
				</td>
			</tr>
			<tr>
				<td width="10%">
				Position:
				</td>
				<td>
				' . $newsfeed[0]->category . '
				</td>
			</tr>
			</table>';
            $lists['newsfeed'] .= '<input type="hidden" name="newsfeed_link" value="' . $temp[1] . '" />';
            $newsfeeds = '';
        } else {
            $query = "SELECT a.id AS value, CONCAT( c.title, ' - ', a.name ) AS text, a.catid " . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.published = 1" . "\n ORDER BY a.catid, a.name";
            $database->setQuery($query);
            $newsfeeds = $database->loadObjectList();
            //	Create a list of links
            $lists['newsfeed'] = mosHTML::selectList($newsfeeds, 'newsfeed_link', 'class="inputbox" size="10"', 'value', 'text', '');
        }
        // build html select list for target window
        $lists['target'] = mosAdminMenus::Target($menu);
        // build the html select list for ordering
        $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($menu);
        // build the html select list for paraent item
        $lists['parent'] = mosAdminMenus::Parent($menu);
        // build published button option
        $lists['published'] = mosAdminMenus::Published($menu);
        // build the url link output
        $lists['link'] = mosAdminMenus::Link($menu, $uid);
        // get params definitions
        $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
        newsfeed_link_menu_html::edit($menu, $lists, $params, $option, $newsfeeds);
    }
예제 #24
0
/**
* Remove the selected template
*/
function removeTemplate($cid, $option, $client)
{
    global $database;
    josSpoofCheck();
    $client_id = $client == 'admin' ? 1 : 0;
    $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = " . (int) $client_id . "\n AND menuid = 0";
    $database->setQuery($query);
    $cur_template = $database->loadResult();
    if ($cur_template == $cid) {
        mosErrorAlert("Você não pode deletar template em uso");
    }
    // Un-assign
    $query = "DELETE FROM #__templates_menu" . "\n WHERE template = " . $database->Quote($cid) . "\n AND client_id = " . (int) $client_id . "\n AND menuid != 0";
    $database->setQuery($query);
    $database->query();
    mosRedirect('index2.php?option=com_installer&element=template&client=' . $client . '&task=remove&cid[]=' . $cid . '&' . josSpoofValue() . '=1');
}
예제 #25
0
        // check if auto_purge value set
        if ($my->cfg_name == 'auto_purge') {
            $purge = $my->cfg_value;
        } else {
            // if no value set, default is 7 days
            $purge = 7;
        }
        // calculation of past date
        $past = date('Y-m-d H:i:s', time() - $purge * 60 * 60 * 24);
        // if purge value is not 0, then allow purging of old messages
        if ($purge != 0) {
            // purge old messages at day set in message configuration
            $query = "DELETE FROM #__messages" . "\n WHERE date_time < " . $database->Quote($past) . "\n AND user_id_to = " . (int) $my->id;
            $database->setQuery($query);
            if (!$database->query()) {
                echo $database->stderr();
            }
        }
        /** cannot using mosredirect as this stuffs up the cookie in IIS */
        // redirects page to admin homepage by default or expired page
        echo "<script>document.location.href='{$expired}';</script>\n";
        exit;
    } else {
        mosErrorAlert("Incorrect Username, Password, or Access Level.  Please try again", "document.location.href='index.php?mosmsg=Incorrect Username, Password, or Access Level. Please try again'");
    }
} else {
    initGzip();
    $path = $mosConfig_absolute_path . '/administrator/templates/' . $mainframe->getTemplate() . '/login.php';
    require_once $path;
    doGzip();
}
function JLMS_saveDropBox($option)
{
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $Itemid = $JLMS_CONFIG->get('Itemid');
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $db =& JFactory::getDbo();
    $user = JLMSFactory::getUser();
    $course_id = intval(mosGetParam($_REQUEST, 'course_id', 0));
    //	if ($user->get('id') && $course_id && JLMS_GetUserType($user->get('id'), $course_id) ) {
    $JLMS_ACL =& JLMSFactory::getACL();
    if ($user->get('id') && $course_id && $JLMS_ACL->CheckPermissions('dropbox', 'view')) {
        $recv_id = intval(mosGetParam($_REQUEST, 'recv_id', 0));
        $recv_id = mosGetParam($_POST, 'recv_id', array(0));
        if (!is_array($recv_id)) {
            $recv_id = array(0);
        }
        if (isset($recv_id[0]) && !$recv_id[0] || !count($recv_id)) {
            //fix one user (ticket  [QDHZ-1096])
            $msg = _JLMS_DROP_ERROR_NO_SEND_TO;
            JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"), $msg);
        }
        //convert array of receiver's to numeric values
        $i = 0;
        while ($i < count($recv_id)) {
            $recv_id[$i] = intval($recv_id[$i]);
            $i++;
        }
        $recv_ids = implode(',', $recv_id);
        $do_continue = false;
        /*
        New permissions (Max)
        */
        $query = "SELECT count(user_id) FROM #__lms_user_courses" . "\n WHERE course_id = '" . $course_id . "' AND user_id IN ( {$recv_ids} )";
        $db->setQuery($query);
        $count_users = $db->LoadResult();
        if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers')) {
            if ($count_users) {
                $do_continue = true;
            } else {
                $query = "SELECT count(c.user_id) FROM #__lms_users_in_groups as c" . "\n WHERE c.course_id = '" . $course_id . "' AND c.user_id IN ( {$recv_ids} )";
                $db->setQuery($query);
                $count_users = $db->LoadResult();
                if ($count_users) {
                    $do_continue = true;
                }
            }
        }
        if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners')) {
            if ($count_users) {
                $do_continue = true;
            }
        }
        /*
        Old part
        */
        /*
        if (JLMS_GetUserType($user->get('id'), $course_id) == 1) {
        	$query = "SELECT count(user_id) FROM #__lms_user_courses"
        	. "\n WHERE course_id = '".$course_id."' AND (role_id = 1 OR role_id = 4) AND user_id IN ( $recv_ids )";
        	$db->setQuery($query);
        	$count_users = $db->LoadResult();
        	
        	if ($count_users) {
        		$do_continue = true;
        	} else {
        		$query = "SELECT count(c.user_id) FROM #__lms_users_in_groups as c"
        		. "\n WHERE c.course_id = '".$course_id."' AND c.user_id IN ( $recv_ids )";
        		$db->setQuery($query);
        		$count_users = $db->LoadResult();
        		if ($count_users) {
        			$do_continue = true;
        		}
        	}
        } elseif (JLMS_GetUserType($user->get('id'), $course_id) == 2) {
        	$query = "SELECT count(user_id) FROM #__lms_user_courses"
        	. "\n WHERE course_id = '".$course_id."' AND (role_id = 1 OR role_id = 4) AND user_id IN ( $recv_ids )";
        	$db->setQuery($query);
        	$count_users = $db->LoadResult();
        	if ($count_users) {
        		$do_continue = true;
        	}
        }
        */
        // (TIPS)
        // sender: teacher - RECEIVER must be teacher of this course or student of this course
        // sender: student - RECEIVER must be teacher of this course
        $flag = false;
        if ($do_continue) {
            if ($_FILES['userfile']['name'] == '') {
                $file_id = 0;
                $flag = true;
            } else {
                $file_id = JLMS_uploadFile($course_id);
                if ($file_id) {
                    $flag = true;
                }
            }
            $_POST['drp_type'] = 1;
            if (intval(mosGetParam($_REQUEST, 'file_id', 0))) {
                $file_id = intval(mosGetParam($_REQUEST, 'file_id', 0));
                $_POST['drp_type'] = 2;
            }
            if ($flag) {
                $row = new mos_Joomla_LMS_DropBox($db);
                if (!$row->bind($_POST)) {
                    echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
                    exit;
                }
                $row->file_id = $file_id;
                $row->owner_id = $user->get('id');
                $row->drp_mark = 1;
                /*$query = "SELECT file_name FROM #__lms_files WHERE id = '".$file_id."'";
                				$db->SetQuery( $query );
                
                				$row->drp_name = $db->LoadResult();*/
                //$row->drp_name = strval(mosGetParam($_FILES['userfile'], 'name', 'dropbox_file'));
                if ($file_id > 0) {
                    if ($row->drp_type == 1) {
                        $drp_name = isset($_FILES['userfile']['name']) ? strval($_FILES['userfile']['name']) : 'dropbox_file';
                    } else {
                        if ($row->drp_type == 2) {
                            $drp_name = strval(mosGetParam($_REQUEST, 'dropbox_name', 'dropbox_file_(' . time() . ')'));
                        }
                    }
                } else {
                    $drp_name = mosGetParam($_REQUEST, 'dropbox_name');
                }
                $drp_name = get_magic_quotes_gpc() ? stripslashes($drp_name) : $drp_name;
                $row->drp_name = ampReplace(strip_tags($drp_name));
                $row->drp_description = strval(JLMS_getParam_LowFilter($_POST, 'drp_description', ''));
                //$row->drp_description = JLMS_ProcessText_LowFilter($row->drp_description);
                //				if (JLMS_GetUserType($user->get('id'), $course_id ) == 1) {
                if ($JLMS_ACL->CheckPermissions('dropbox', 'mark_as_corrected')) {
                    $drp_corr = intval(mosGetParam($_REQUEST, 'drp_corrected', 0));
                    if ($drp_corr != 1) {
                        $drp_corr = 0;
                    }
                    $row->drp_corrected = $drp_corr;
                } else {
                    $row->drp_corrected = 0;
                }
                $row->drp_time = date('Y-m-d H:i:s');
                //Replace old function JLMS_GetUserType //tmp
                $users_teachers = array();
                $users_learners = array();
                if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers')) {
                    $query = "SELECT a.* FROM #__users as a, #__lms_user_courses as c" . "\n WHERE a.id = c.user_id AND c.course_id = '" . $course_id . "' AND a.id <> '" . $user->id . "'" . "\n ORDER BY a.username";
                    $db->SetQuery($query);
                    $users_teachers = $db->LoadObjectList();
                    $i = 0;
                    while ($i < count($users_teachers)) {
                        $users_teachers[$i]->username = _JLMS_ROLE_TEACHER . ' - ' . $users_teachers[$i]->name . ' (' . $users_teachers[$i]->username . ')';
                        $i++;
                    }
                }
                if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners')) {
                    $users_learners = JLMS_getCourseStudentsList($course_id);
                }
                $tmp = array();
                foreach ($users_teachers as $n => $ut) {
                    $tmp[$n] = $ut->id;
                }
                if (count($tmp)) {
                    $users_teachers = $tmp;
                }
                $tmp = array();
                foreach ($users_learners as $n => $ul) {
                    $tmp[$n] = $ul->id;
                }
                if (count($tmp)) {
                    $users_learners = $tmp;
                }
                //Replace old function JLMS_GetUserType //tmp
                foreach ($recv_id as $recv) {
                    $check_recv = false;
                    //Replace old function JLMS_GetUserType //tmp
                    if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers') && in_array($recv, $users_teachers)) {
                        $check_recv = true;
                    }
                    if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners') && in_array($recv, $users_learners)) {
                        $check_recv = true;
                    }
                    //Replace old function JLMS_GetUserType //tmp
                    //					if ($recv && ($recv != $user->get('id')) && ((JLMS_GetUserType($user->get('id'), $course_id) == 1 && JLMS_GetUserType($recv, $course_id)) || ((JLMS_GetUserType($user->get('id'), $course_id) == 2) && (JLMS_GetUserType($recv, $course_id, true) == 1))) || ((JLMS_GetUserType($user->get('id'), $course_id) == 2) && (JLMS_GetUserType($recv, $course_id, true) == 2)) ) { //old
                    if ($recv && $recv != $user->get('id') && $check_recv) {
                        $row->id = 0;
                        $row->recv_id = $recv;
                        if (!$row->check()) {
                            echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
                            exit;
                        }
                        if (!$row->store()) {
                            echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
                            exit;
                        }
                        //*** send email notification
                        $e_course = new stdClass();
                        $e_course->course_alias = '';
                        $e_course->course_name = '';
                        $query = "SELECT course_name, name_alias FROM #__lms_courses WHERE id = '" . $course_id . "'";
                        $db->setQuery($query);
                        $e_course = $db->loadObject();
                        $e_user = new stdClass();
                        $e_user->name = '';
                        $e_user->email = '';
                        $e_user->username = '';
                        $query = "SELECT email, name, username FROM #__users WHERE id = '" . $recv . "'";
                        $db->setQuery($query);
                        $e_user = $db->loadObject();
                        $e_params['user_id'] = $recv;
                        $e_params['course_id'] = $course_id;
                        $e_params['markers']['{email}'] = $e_user->email;
                        $e_params['markers']['{name}'] = $e_user->name;
                        $e_params['markers']['{username}'] = $e_user->username;
                        $e_params['markers']['{coursename}'] = $e_course->course_name;
                        //( $e_course->course_alias )?$e_course->course_alias:$e_course->course_name;
                        $e_params['markers']['{filename}'] = $row->drp_name;
                        $e_params['markers']['{courselink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}&task=details_course&id={$course_id}");
                        $e_params['markers_nohtml']['{courselink}'] = $e_params['markers']['{courselink}'];
                        $e_params['markers']['{courselink}'] = '<a href="' . $e_params['markers']['{courselink}'] . '">' . $e_params['markers']['{courselink}'] . '</a>';
                        $e_params['markers']['{lmslink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}");
                        $e_params['markers_nohtml']['{lmslink}'] = $e_params['markers']['{lmslink}'];
                        $e_params['markers']['{lmslink}'] = '<a href="' . $e_params['markers']['{lmslink}'] . '">' . $e_params['markers']['{lmslink}'] . '</a>';
                        $e_params['action_name'] = 'OnNewDropboxFile';
                        $_JLMS_PLUGINS->loadBotGroup('emails');
                        $plugin_result_array = $_JLMS_PLUGINS->trigger('OnNewDropboxFile', array(&$e_params));
                        //*** end of emails
                    }
                }
                JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"));
            } else {
                mosErrorAlert("Upload of " . $userfile_name . " failed");
            }
        } else {
            JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"));
        }
    } else {
        JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"));
    }
}
예제 #27
0
/**
* Compiles information to add or edit content
* @param database A database connector object
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
*/
function edit($uid, $option)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset;
    $row = new mosContent($database);
    $row->load((int) $uid);
    $lists = array();
    $nullDate = $database->getNullDate();
    if ($uid) {
        // fail if checked out not by 'me'
        if ($row->isCheckedOut($my->id)) {
            mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
        }
        $row->checkout($my->id);
        if (trim($row->images)) {
            $row->images = explode("\n", $row->images);
        } else {
            $row->images = array();
        }
        $row->created = mosFormatDate($row->created, _CURRENT_SERVER_TIME_FORMAT);
        $row->modified = $row->modified == $nullDate ? '' : mosFormatDate($row->modified, _CURRENT_SERVER_TIME_FORMAT);
        $row->publish_up = mosFormatDate($row->publish_up, _CURRENT_SERVER_TIME_FORMAT);
        if (trim($row->publish_down) == $nullDate || trim($row->publish_down) == '' || trim($row->publish_down) == '-') {
            $row->publish_down = 'Never';
        }
        $row->publish_down = mosFormatDate($row->publish_down, _CURRENT_SERVER_TIME_FORMAT);
        $query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->created_by;
        $database->setQuery($query);
        $row->creator = $database->loadResult();
        // test to reduce unneeded query
        if ($row->created_by == $row->modified_by) {
            $row->modifier = $row->creator;
        } else {
            $query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->modified_by;
            $database->setQuery($query);
            $row->modifier = $database->loadResult();
        }
        // get list of links to this item
        $and = "\n AND componentid = " . (int) $row->id;
        $menus = mosAdminMenus::Links2Menu('content_typed', $and);
    } else {
        // initialise values for a new item
        $row->version = 0;
        $row->state = 1;
        $row->images = array();
        $row->publish_up = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
        $row->publish_down = 'Never';
        $row->sectionid = 0;
        $row->catid = 0;
        $row->creator = '';
        $row->modified = $nullDate;
        $row->modifier = '';
        $row->ordering = 0;
        $menus = array();
    }
    // calls function to read image from directory
    $pathA = $mosConfig_absolute_path . '/images/stories';
    $pathL = $mosConfig_live_site . '/images/stories';
    $images = array();
    $folders = array();
    $folders[] = mosHTML::makeOption('/');
    mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
    // list of folders in images/stories/
    $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
    // list of images in specfic folder in images/stories/
    $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL);
    // list of saved images
    $lists['imagelist'] = mosAdminMenus::GetSavedImages($row, $pathL);
    // build list of users
    $active = intval($row->created_by) ? intval($row->created_by) : $my->id;
    $lists['created_by'] = mosAdminMenus::UserSelect('created_by', $active);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    // build the select list for the image positions
    $lists['_align'] = mosAdminMenus::Positions('_align');
    // build the select list for the image caption alignment
    $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
    // build the select list for the image caption position
    $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM);
    $pos[] = mosHTML::makeOption('top', _CMN_TOP);
    $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
    // get params definitions
    $params = new mosParameters($row->attribs, $mainframe->getPath('com_xml', 'com_typedcontent'), 'component');
    HTML_typedcontent::edit($row, $images, $lists, $params, $option, $menus);
}
예제 #28
0
/**
 * Shows the email form for a given content item.
 * @param int The content item id
 */
function emailContentSend($uid, $gid)
{
    global $database, $mainframe;
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_hideEmail;
    $id = intval(mosGetParam($_REQUEST, 'id', 0));
    if ($id) {
        $query = 'SELECT attribs FROM #__content WHERE `id`=' . $id;
        $database->setQuery($query);
        $params = new mosParameters($database->loadResult());
    } else {
        $params = new mosParameters('');
    }
    $paramEmail = intval($params->get('email', 0));
    if ($mosConfig_hideEmail && !$paramEmail) {
        echo _NOT_AUTH;
        return;
    }
    // simple spoof check security
    josSpoofCheck(1);
    // check for session cookie
    // Session Cookie `name`
    $sessionCookieName = mosMainFrame::sessionCookieName();
    // Get Session Cookie `value`
    $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
    if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
        mosErrorAlert(_NOT_AUTH);
    }
    $itemid = intval(mosGetParam($_POST, 'itemid', 0));
    $now = _CURRENT_SERVER_TIME;
    $nullDate = $database->getNullDate();
    // query to check for state and access levels
    $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n  s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $uid . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
    $database->setQuery($query);
    $row = NULL;
    if ($database->loadObject($row)) {
        /*
         * check whether category is published
         */
        if (!$row->cat_pub && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section is published
         */
        if (!$row->sec_pub && $row->sectionid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether category access level allows access
         */
        if ($row->cat_access > $gid && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section access level allows access
         */
        if ($row->sec_access > $gid && $row->sectionid) {
            mosNotAuth();
            return;
        }
        $email = strval(mosGetParam($_POST, 'email', ''));
        $yourname = strval(mosGetParam($_POST, 'yourname', ''));
        $youremail = strval(mosGetParam($_POST, 'youremail', ''));
        $subject = strval(mosGetParam($_POST, 'subject', ''));
        if (empty($subject)) {
            $subject = _EMAIL_INFO . ' ' . $yourname;
        }
        if ($uid < 1 || !$email || !$youremail || JosIsValidEmail($email) == false || JosIsValidEmail($youremail) == false) {
            mosErrorAlert(_EMAIL_ERR_NOINFO);
        }
        $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
        $database->setQuery($query);
        $template = $database->loadResult();
        // determine Itemid for Item
        if ($itemid) {
            $_itemid = '&Itemid=' . $itemid;
        } else {
            $itemid = $mainframe->getItemid($uid, 0, 0);
            $_itemid = '&Itemid=' . $itemid;
        }
        // link sent in email
        $link = sefRelToAbs('index.php?option=com_content&task=view&id=' . $uid . $_itemid);
        // message text
        $msg = sprintf(_EMAIL_MSG, html_entity_decode($mosConfig_sitename, ENT_QUOTES), $yourname, $youremail, $link);
        // mail function
        $success = mosMail($youremail, $yourname, $email, $subject, $msg);
        if (!$success) {
            mosErrorAlert(_EMAIL_ERR_NOINFO);
        }
        HTML_content::emailSent($email, $template);
    } else {
        mosNotAuth();
        return;
    }
}
예제 #29
0
		<?php 
        }
        if ($return && !(strpos($return, 'com_registration') || strpos($return, 'com_login'))) {
            // checks for the presence of a return url
            // and ensures that this url is not the registration or logout pages
            mosRedirect($return);
        } else {
            mosRedirect($mosConfig_live_site . '/index.php');
        }
    } else {
        if ($option == 'cookiecheck') {
            // No cookie was set upon login. If it is set now, redirect to the given page. Otherwise, show error message.
            if (isset($_COOKIE[mosMainFrame::sessionCookieName()])) {
                mosRedirect($return);
            } else {
                mosErrorAlert(_ALERT_ENABLED);
            }
        }
    }
}
// detect first visit
$mainframe->detect();
// set for overlib check
$mainframe->set('loadOverlib', false);
$gid = intval($my->gid);
// gets template for page
$cur_template = $mainframe->getTemplate();
/** temp fix - this feature is currently disabled */
/** @global A places to store information from processing of the component */
$_MOS_OPTION = array();
// precapture the output of the component
예제 #30
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editMambot($option, $uid, $client)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosMambot($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("O módulo " . $row->title . " está, atualmente, a ser editado por outro administrador");
    }
    if ($client == 'admin') {
        $where = "client_id='1'";
    } else {
        $where = "client_id='0'";
    }
    // get list of groups
    if ($row->access == 99 || $row->client_id == 1) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
    } else {
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($row);
    }
    if ($uid) {
        $row->checkout($my->id);
        if ($row->ordering > -10000 && $row->ordering < 10000) {
            // build the html select list for ordering
            $query = "SELECT ordering AS value, name AS text" . "\n FROM #__mambots" . "\n WHERE folder = " . $database->Quote($row->folder) . "\n AND published > 0" . "\n AND {$where}" . "\n AND ordering > -10000" . "\n AND ordering < 10000" . "\n ORDER BY ordering";
            $order = mosGetOrderingList($query);
            $lists['ordering'] = mosHTML::selectList($order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
        } else {
            $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />Este plugin não pode ser reordenado';
        }
        $lists['folder'] = '<input type="hidden" name="folder" value="' . $row->folder . '" />' . $row->folder;
        // XML library
        require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
        // xml file for module
        $xmlfile = $mosConfig_absolute_path . '/mambots/' . $row->folder . '/' . $row->element . '.xml';
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if ($xmlDoc->loadXML($xmlfile, false, true)) {
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() == 'mosinstall' && $root->getAttribute('type') == 'mambot') {
                $element =& $root->getElementsByPath('description', 1);
                $row->description = $element ? trim($element->getText()) : '';
            }
        }
    } else {
        $row->folder = '';
        $row->ordering = 999;
        $row->published = 1;
        $row->description = '';
        $folders = mosReadDirectory($mosConfig_absolute_path . '/mambots/');
        $folders2 = array();
        foreach ($folders as $folder) {
            if (is_dir($mosConfig_absolute_path . '/mambots/' . $folder) && $folder != 'CVS') {
                $folders2[] = mosHTML::makeOption($folder);
            }
        }
        $lists['folder'] = mosHTML::selectList($folders2, 'folder', 'class="inputbox" size="1"', 'value', 'text', null);
        $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />Os novos itens, por padrão, serão adicionados ao final da lista. A ordem pode ser alterada após este item serem salvos.';
    }
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    $path = $mosConfig_absolute_path . "/mambots/{$row->folder}/{$row->element}.xml";
    if (!file_exists($path)) {
        $path = '';
    }
    // get params definitions
    $params = new mosParameters($row->params, $path, 'mambot');
    HTML_modules::editMambot($row, $lists, $params, $option);
}