本文整理汇总了PHP中mosArrayToInts函数的典型用法代码示例。如果您正苦于以下问题:PHP mosArrayToInts函数的具体用法?PHP mosArrayToInts怎么用?PHP mosArrayToInts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mosArrayToInts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* @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);
}
示例2: edit
/**
* @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);
}
示例3: sendMail
function sendMail()
{
global $database, $my, $acl;
global $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
josSpoofCheck();
$mode = intval(mosGetParam($_POST, 'mm_mode', 0));
$subject = strval(mosGetParam($_POST, 'mm_subject', ''));
$gou = mosGetParam($_POST, 'mm_group', NULL);
$recurse = strval(mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE'));
// pulls message inoformation either in text or html format
if ($mode) {
$message_body = $_POST['mm_message'];
} else {
// automatically removes html formatting
$message_body = strval(mosGetParam($_POST, 'mm_message', ''));
}
$message_body = stripslashes($message_body);
if (!$message_body || !$subject || $gou === null) {
mosRedirect('index2.php?option=com_massmail&mosmsg=Please fill in the form correctly');
}
// get users in the group out of the acl
$to = $acl->get_group_objects($gou, 'ARO', $recurse);
$rows = array();
if (count($to['users']) || $gou === '0') {
// Get sending email address
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id = " . (int) $my->id;
$database->setQuery($query);
$my->email = $database->loadResult();
mosArrayToInts($to['users']);
$user_ids = 'id=' . implode(' OR id=', $to['users']);
// Get all users email and group except for senders
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id != " . (int) $my->id . ($gou !== '0' ? " AND ( {$user_ids} )" : '');
$database->setQuery($query);
$rows = $database->loadObjectList();
// Build e-mail message format
$message_header = sprintf(_MASSMAIL_MESSAGE, html_entity_decode($mosConfig_sitename, ENT_QUOTES));
$message = $message_header . $message_body;
$subject = html_entity_decode($mosConfig_sitename, ENT_QUOTES) . ' / ' . stripslashes($subject);
//Send email
foreach ($rows as $row) {
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode);
}
}
$msg = 'E-mail sent to ' . count($rows) . ' users';
mosRedirect('index2.php?option=com_massmail', $msg);
}
示例4: publishModule
function publishModule($cid = null, $publish = 1, $option, $client = 'admin')
{
global $database, $my;
if (count($cid) < 1) {
$action = $publish ? 'publish' : 'unpublish';
echo "<script> alert('Select a module to {$action}'); window.history.go(-1);</script>\n";
exit;
}
mosArrayToInts($cid);
$cids = 'id=' . implode(' OR id=', $cid);
$query = "UPDATE #__modules" . "\n SET published = " . (int) $publish . "\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 mosModule($database);
$row->checkin($cid[0]);
}
mosCache::cleanCache('com_content');
$redirect = mosGetParam($_REQUEST, 'redirect', 'index2.php?option=' . $option . '&client=' . $client);
mosRedirect($redirect);
}
示例5: removeMessage
function removeMessage($cid, $option)
{
global $database;
josSpoofCheck();
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n";
exit;
}
if (count($cid)) {
mosArrayToInts($cid);
$cids = 'message_id=' . implode(' OR message_id=', $cid);
$query = "DELETE FROM #__messages" . "\n WHERE ( {$cids} )";
$database->setQuery($query);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
}
}
$limit = intval(mosGetParam($_REQUEST, 'limit', 10));
$limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0));
mosRedirect("index2.php?option={$option}&limit={$limit}&limitstart={$limitstart}");
}
示例6: publish
/**
* Generic Publish/Unpublish function
* @param array An array of id numbers
* @param integer 0 if unpublishing, 1 if publishing
* @param integer The id of the user performnig the operation
* @since 1.0.4
*/
function publish($cid = null, $publish = 1, $user_id = 0)
{
mosArrayToInts($cid, array());
$user_id = (int) $user_id;
$publish = (int) $publish;
$k = $this->_tbl_key;
if (count($cid) < 1) {
$this->_error = "No items selected.";
return false;
}
$cids = $this->_tbl_key . '=' . implode(' OR ' . $this->_tbl_key . '=', $cid);
$query = "UPDATE {$this->_tbl}" . "\n SET published = " . (int) $publish . "\n WHERE ({$cids})" . "\n AND (checked_out = 0 OR checked_out = " . (int) $user_id . ")";
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->_error = $this->_db->getErrorMsg();
return false;
}
if (count($cid) == 1) {
$this->checkin($cid[0]);
}
$this->_error = '';
return true;
}
示例7: removeNewsFeeds
/**
* Removes records
* @param array An array of id keys to remove
* @param string The current GET/POST option
*/
function removeNewsFeeds(&$cid, $option)
{
global $database;
josSpoofCheck();
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n";
exit;
}
if (count($cid)) {
mosArrayToInts($cid);
$cids = 'id=' . implode(' OR id=', $cid);
$query = "DELETE FROM #__newsfeeds" . "\n WHERE ( {$cids} )" . "\n AND checked_out = 0";
$database->setQuery($query);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
}
}
mosRedirect('index2.php?option=' . $option);
}
示例8: unset
}
unset($temp);
break;
case 1:
default:
//Content Items only
$whereCatid = '';
if ($catid) {
$catids = explode(',', $catid);
mosArrayToInts($catids);
$whereCatid = "\n AND ( a.catid=" . implode(" OR a.catid=", $catids) . " )";
}
$whereSecid = '';
if ($secid) {
$secids = explode(',', $secid);
mosArrayToInts($secids);
$whereSecid = "\n AND ( a.sectionid=" . implode(" OR a.sectionid=", $secids) . " )";
}
$query = "SELECT a.id, a.title, a.sectionid, a.catid" . "\n FROM #__content AS a" . "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id" . "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" . "\n INNER JOIN #__sections AS s ON s.id = a.sectionid" . "\n WHERE ( a.state = 1 AND a.sectionid > 0 )" . "\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) . " )" . ($access ? "\n AND a.access <= " . (int) $my->gid . " AND cc.access <= " . (int) $my->gid . " AND s.access <= " . (int) $my->gid : '') . $whereCatid . $whereSecid . ($show_front == '0' ? "\n AND f.content_id IS NULL" : '') . "\n AND s.published = 1" . "\n AND cc.published = 1" . "\n ORDER BY a.created DESC";
$database->setQuery($query, 0, $count);
$rows = $database->loadObjectList();
break;
}
// needed to reduce queries used by getItemid for Content Items
if ($type == 1 || $type == 3) {
$bs = $mainframe->getBlogSectionCount();
$bc = $mainframe->getBlogCategoryCount();
$gbs = $mainframe->getGlobalBlogSectionCount();
}
// Output
?>
示例9: changeState
/**
* Changes the state of one or more content pages
* @param string The name of the category section
* @param integer A unique category id (passed from an edit form)
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
* @param string The name of the current user
*/
function changeState($cid = null, $state = 0, $option)
{
global $database, $my;
josSpoofCheck();
if (count($cid) < 1) {
$action = $state == 1 ? 'publish' : ($state == -1 ? 'archive' : 'unpublish');
echo "<script> alert('Select an item to {$action}'); window.history.go(-1);</script>\n";
exit;
}
mosArrayToInts($cid);
$total = count($cid);
$cids = 'id=' . implode(' OR id=', $cid);
$query = "UPDATE #__content" . "\n SET state = " . (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 mosContent($database);
$row->checkin($cid[0]);
}
// clean any existing cache files
mosCache::cleanCache('com_content');
if ($state == "1") {
$msg = $total . " Item(s) successfully Published";
} else {
if ($state == "0") {
$msg = $total . " Item(s) successfully Unpublished";
}
}
mosRedirect('index2.php?option=' . $option . '&msg=' . $msg);
}
示例10: getUserListFromGroup
/**
* Gets the users from a group
* @param string The value for the group (not used 1.0)
* @param string The name for the group
* @param string If RECURSE, will drill into child groups
* @param string Ordering for the list
* @return array
*/
function getUserListFromGroup($value, $name, $recurse = 'NO_RECURSE', $order = 'name')
{
global $acl;
// Change back in
//$group_id = $acl->get_group_id( $value, $name, $group_type = 'ARO');
$group_id = $acl->get_group_id($name, $group_type = 'ARO');
$objects = $acl->get_group_objects($group_id, 'ARO', 'RECURSE');
if (isset($objects['users'])) {
mosArrayToInts($objects['users']);
$gWhere = '(id =' . implode(' OR id =', $objects['users']) . ')';
$query = "SELECT id AS value, name AS text" . "\n FROM #__users" . "\n WHERE block = '0'" . "\n AND " . $gWhere . "\n ORDER BY " . $order;
$this->_db->setQuery($query);
$options = $this->_db->loadObjectList();
return $options;
} else {
return array();
}
}
示例11: del_object
function del_object($object_id, $object_type = NULL, $erase = FALSE)
{
switch (strtolower(trim($object_type))) {
case 'aco':
$object_type = 'aco';
$table = $this->_db_table_prefix . 'aco';
$object_map_table = $this->_db_table_prefix . 'aco_map';
break;
case 'aro':
$object_type = 'aro';
$table = $this->_db_table_prefix . 'aro';
$object_map_table = $this->_db_table_prefix . 'aro_map';
$groups_map_table = $this->_db_table_prefix . 'aro_groups_map';
$object_group_table = $this->_db_table_prefix . 'groups_aro_map';
break;
case 'axo':
$object_type = 'axo';
$table = $this->_db_table_prefix . 'axo';
$object_map_table = $this->_db_table_prefix . 'axo_map';
$groups_map_table = $this->_db_table_prefix . 'axo_groups_map';
$object_group_table = $this->_db_table_prefix . 'groups_axo_map';
break;
default:
$this->debug_text('del_object(): Invalid Object Type: ' . $object_type);
return FALSE;
}
$this->debug_text("del_object(): ID: {$object_id} Object Type: {$object_type}, Erase all referencing objects: {$erase}");
if (empty($object_id)) {
$this->debug_text("del_object(): Object ID ({$object_id}) is empty, this is required");
return false;
}
if (empty($object_type)) {
$this->debug_text("del_object(): Object Type ({$object_type}) is empty, this is required");
return false;
}
// <mos> $this->db->BeginTrans();
// Get Object section_value/value (needed to look for referencing objects)
$this->db->setQuery('SELECT section_value,value FROM ' . $table . ' WHERE ' . $object_type . '_id=' . (int) $object_id);
$object = $this->db->loadRow();
if (empty($object)) {
$this->debug_text('del_object(): The specified object (' . strtoupper($object_type) . ' ID: ' . $object_id . ') could not be found.<br />SQL = ' . $this->db->stderr());
return FALSE;
}
$section_value = $object[0];
$value = $object[1];
// Get ids of acl referencing the Object (if any)
//$this->db->setQuery( "SELECT acl_id FROM $object_map_table WHERE value=" . $this->db->Quote( $value ) . " AND section_value=" . $this->db->Quote( $section_value ) );
//$acl_ids = $this->db->loadResultArray();
$acl_ids = array();
if ($erase) {
// We were asked to erase all acl referencing it
$this->debug_text("del_object(): Erase was set to TRUE, delete all referencing objects");
if ($object_type == "aro" or $object_type == "axo") {
// The object can be referenced in groups_X_map tables
// in the future this branching may become useless because
// ACO might me "groupable" too
// Get rid of groups_map referencing the Object
$this->db->setQuery('DELETE FROM ' . $object_group_table . ' WHERE ' . $object_type . '_id=' . (int) $object_id);
$rs = $this->db->query();
if (!$rs) {
$this->debug_db('edit_object');
// <mos> $this->db->RollBackTrans();
return false;
}
}
if ($acl_ids) {
//There are acls actually referencing the object
if ($object_type == 'aco') {
// I know it's extremely dangerous but
// if asked to really erase an ACO
// we should delete all acl referencing it
// (and relative maps)
// Do this below this branching
// where it uses $orphan_acl_ids as
// the array of the "orphaned" acl
// in this case all referenced acl are
// orhpaned acl
$orphan_acl_ids = $acl_ids;
} else {
// The object is not an ACO and might be referenced
// in still valid acls regarding also other object.
// In these cases the acl MUST NOT be deleted
// Get rid of $object_id map referencing erased objects
$this->db->setQuery("DELETE FROM {$object_map_table} WHERE section_value=" . $this->db->Quote($section_value) . " AND value=" . $this->db->Quote($value));
$rs = $this->db->query();
if (!$rs) {
$this->debug_db('edit_object');
$this->db->RollBackTrans();
return false;
}
// Find the "orphaned" acl. I mean acl referencing the erased Object (map)
// not referenced anymore by other objects
mosArrayToInts($acl_ids);
$sql_acl_ids = implode(",", $acl_ids);
$this->db->setQuery('
SELECT a.id
FROM ' . $this->_db_table_prefix . 'acl a
LEFT JOIN ' . $object_map_table . ' b ON a.id=b.acl_id
' . '
WHERE value IS NULL
//.........这里部分代码省略.........
示例12: copyMenu
/**
* Form for copying item(s) to a specific menu
*/
function copyMenu($option, $cid, $menutype)
{
global $database;
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('Selecione um item para mover'); window.history.go(-1);</script>\n";
exit;
}
## query to list selected menu items
mosArrayToInts($cid);
$cids = 'a.id=' . implode(' OR a.id=', $cid);
$query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE ( {$cids} )";
$database->setQuery($query);
$items = $database->loadObjectList();
$menuTypes = mosAdminMenus::menutypes();
foreach ($menuTypes as $menuType) {
$menu[] = mosHTML::makeOption($menuType, $menuType);
}
// build the html select list
$MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null);
HTML_menusections::copyMenu($option, $cid, $MenuList, $items, $menutype);
}
示例13: removeProfilers
function removeProfilers($cid, $option)
{
global $database;
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n";
exit;
}
//Delete data from related table
if (count($cid)) {
mosArrayToInts($cid);
$cids = 'profiler_id=' . implode(' OR profiler_id=', $cid);
//Delete the related field
$sql = "Delete From #__im_fields Where ({$cids})";
$database->setQuery($sql);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
}
//Delete global setting
$sql = "Delete From #__im_global Where ({$cids})";
$database->setQuery($sql);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
}
//Delete the global data
$cids = 'id=' . implode(' OR id=', $cid);
$query = "DELETE FROM #__im_profiler " . "\n WHERE ( {$cids} )";
$database->setQuery($query);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
}
}
mosRedirect("index2.php?option={$option}");
}
示例14: copyCategorySelect
/**
* Form for copying item(s) to a specific menu
*/
function copyCategorySelect($option, $cid, $sectionOld)
{
global $database;
$redirect = mosGetParam($_POST, 'section', 'content');
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('Select an item to move'); window.history.go(-1);</script>\n";
exit;
}
## query to list selected categories
mosArrayToInts($cid);
$cids = 'a.id=' . implode(' OR a.id=', $cid);
$query = "SELECT a.name, a.section" . "\n FROM #__categories AS a" . "\n WHERE ( {$cids} )";
$database->setQuery($query);
$items = $database->loadObjectList();
## query to list items from categories
// mosArrayToInts( $cid ); // Just done a few lines earlier
$cids = 'a.catid=' . implode(' OR a.catid=', $cid);
$query = "SELECT a.title, a.id" . "\n FROM #__content AS a" . "\n WHERE ( {$cids} )" . "\n ORDER BY a.catid, a.title";
$database->setQuery($query);
$contents = $database->loadObjectList();
## query to choose section to move to
$query = "SELECT a.name AS `text`, a.id AS `value`" . "\n FROM #__sections AS a" . "\n WHERE a.published = 1" . "\n ORDER BY a.name";
$database->setQuery($query);
$sections = $database->loadObjectList();
// build the html select list
$SectionList = mosHTML::selectList($sections, 'sectionmove', 'class="inputbox" size="10"', 'value', 'text', null);
categories_html::copyCategorySelect($option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect);
}
示例15: defined
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined('_VALID_MOS') or die('Restricted access');
// clientids must be an integer
$clientids = $params->get('banner_cids', '');
$banner = null;
$where = '';
if ($clientids != '') {
$clientidsArray = explode(',', $clientids);
mosArrayToInts($clientidsArray);
$where = "\n AND ( cid=" . implode(" OR cid=", $clientidsArray) . " )";
}
$query = "SELECT *" . "\n FROM #__banner" . "\n WHERE showBanner=1 " . $where;
$database->setQuery($query);
$banners = $database->loadObjectList();
$numrows = count($banners);
$bannum = 0;
if ($numrows > 1) {
$numrows--;
mt_srand((double) microtime() * 1000000);
$bannum = mt_rand(0, $numrows);
}
if ($numrows) {
$banner = $banners[$bannum];
$query = "UPDATE #__banner" . "\n SET impmade = impmade + 1" . "\n WHERE bid = " . (int) $banner->bid;