本文整理汇总了PHP中mosParameters类的典型用法代码示例。如果您正苦于以下问题:PHP mosParameters类的具体用法?PHP mosParameters怎么用?PHP mosParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了mosParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: botSearchNewsfeedslinks
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchNewsfeedslinks($text, $phrase = '', $ordering = '')
{
global $database, $my, $_MAMBOTS;
// check if param query has previously been processed
if (!isset($_MAMBOTS->_search_mambot_params['newsfeeds'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'newsfeeds.searchbot'" . "\n AND folder = 'search'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_search_mambot_params['newsfeeds'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_search_mambot_params['newsfeeds'];
$botParams = new mosParameters($mambot->params);
$limit = $botParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$wheres2 = array();
$wheres2[] = "LOWER(a.name) LIKE '%{$text}%'";
$wheres2[] = "LOWER(a.link) LIKE '%{$text}%'";
$where = '(' . implode(') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$wheres2 = array();
$wheres2[] = "LOWER(a.name) LIKE '%{$word}%'";
$wheres2[] = "LOWER(a.link) LIKE '%{$word}%'";
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
break;
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'oldest':
case 'popular':
case 'newest':
default:
$order = 'a.name ASC';
}
$query = "SELECT a.name AS title," . "\n '' AS created," . "\n a.link AS text," . "\n CONCAT_WS( ' / '," . $database->Quote(_SEARCH_NEWSFEEDS) . ", b.title )AS section," . "\n CONCAT( 'index.php?option=com_newsfeeds&task=view&feedid=', a.id ) AS href," . "\n '1' AS browsernav" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid" . "\n WHERE ( {$where} )" . "\n AND a.published = 1" . "\n AND b.published = 1" . "\n AND b.access <= " . (int) $my->gid . "\n ORDER BY {$order}";
$database->setQuery($query, 0, $limit);
$rows = $database->loadObjectList();
return $rows;
}
示例2: botMosImage
/**
*/
function botMosImage($published, &$row, &$params, $page = 0)
{
global $database, $_MAMBOTS;
// simple performance check to determine whether bot should process further
if (strpos($row->text, 'mosimage') === false) {
return true;
}
// expression to search for
$regex = '/{mosimage\\s*.*?}/i';
// check whether mosimage has been disabled for page
// check whether mambot has been unpublished
if (!$published || !$params->get('image')) {
$row->text = preg_replace($regex, '', $row->text);
return true;
}
//count how many {mosimage} are in introtext if it is set to hidden.
$introCount = 0;
if (!$params->get('introtext') & !$params->get('intro_only')) {
preg_match_all($regex, $row->introtext, $matches);
$introCount = count($matches[0]);
}
// find all instances of mambot and put in $matches
preg_match_all($regex, $row->text, $matches);
// Number of mambots
$count = count($matches[0]);
// mambot only processes if there are any instances of the mambot in the text
if ($count) {
// check if param query has previously been processed
if (!isset($_MAMBOTS->_content_mambot_params['mosimage'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mosimage'" . "\n AND folder = 'content'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_content_mambot_params['mosimage'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_content_mambot_params['mosimage'];
$botParams = new mosParameters($mambot->params);
$botParams->def('padding');
$botParams->def('margin');
$botParams->def('link', 0);
$images = processImages($row, $botParams, $introCount);
// store some vars in globals to access from the replacer
$GLOBALS['botMosImageCount'] = 0;
$GLOBALS['botMosImageParams'] =& $botParams;
$GLOBALS['botMosImageArray'] =& $images;
//$GLOBALS['botMosImageArray'] =& $combine;
// perform the replacement
$row->text = preg_replace_callback($regex, 'botMosImage_replacer', $row->text);
// clean up globals
unset($GLOBALS['botMosImageCount']);
unset($GLOBALS['botMosImageMask']);
unset($GLOBALS['botMosImageArray']);
unset($GLOBALS['botJosIntroCount']);
return true;
}
}
示例3: saveSyndicate
/**
* Saves the record from an edit form submit
* @param string The current GET/POST option
*/
function saveSyndicate($option)
{
global $database;
josSpoofCheck();
$params = mosGetParam($_POST, 'params', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$_POST['params'] = mosParameters::textareaHandling($txt);
}
$id = intval(mosGetParam($_POST, 'id', '17'));
$row = new mosComponent($database);
$row->load($id);
if (!$row->bind($_POST)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
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;
}
$msg = 'Settings successfully Saved';
mosRedirect('index2.php?option=' . $option, $msg);
}
示例4: botSearchSections
/**
* Sections Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchSections($text, $phrase = '', $ordering = '')
{
global $database, $my, $_MAMBOTS;
// check if param query has previously been processed
if (!isset($_MAMBOTS->_search_mambot_params['sections'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'sections.searchbot'" . "\n AND folder = 'search'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_search_mambot_params['sections'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_search_mambot_params['sections'];
$botParams = new mosParameters($mambot->params);
$limit = $botParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$query = "SELECT a.name AS title," . "\n a.description AS text," . "\n '' AS created," . "\n '2' AS browsernav," . "\n a.id AS secid, m.id AS menuid, m.type AS menutype" . "\n FROM #__sections AS a" . "\n LEFT JOIN #__menu AS m ON m.componentid = a.id" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.title LIKE '%{$text}%'" . "\n OR a.description LIKE '%{$text}%' )" . "\n AND a.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n AND ( m.type = 'content_section' OR m.type = 'content_blog_section' )" . "\n GROUP BY a.id" . "\n ORDER BY {$order}";
$database->setQuery($query, 0, $limit);
$rows = $database->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
if ($rows[$i]->menutype == 'content_section') {
$rows[$i]->href = 'index.php?option=com_content&task=section&id=' . $rows[$i]->secid . '&Itemid=' . $rows[$i]->menuid;
$rows[$i]->section = _SEARCH_SECLIST;
}
if ($rows[$i]->menutype == 'content_blog_section') {
$rows[$i]->href = 'index.php?option=com_content&task=blogsection&id=' . $rows[$i]->secid . '&Itemid=' . $rows[$i]->menuid;
$rows[$i]->section = _SEARCH_SECBLOG;
}
}
return $rows;
}
示例5: getObjectTitle
function getObjectTitle($id)
{
$title = 'JComments';
$menu = jc_com_jcomments::getMenuItem($id);
if ($menu != '') {
if (JCOMMENTS_JVERSION == '1.5') {
$params = new JParameter($menu->params);
} else {
$params = new mosParameters($menu->params);
}
$title = $params->get('page_title');
if ($title == '') {
$title = $menu->name;
}
}
return $title;
}
示例6: virtuemart_is_installed
function virtuemart_is_installed()
{
global $database, $mosConfig_absolute_path, $mosConfig_dbprefix, $VMVERSION, $shortversion, $myVersion, $version_info;
if (is_null($database) && class_exists('jfactory')) {
$database = JFactory::getDBO();
}
//add VirtueMart admin menu image
$database->setQuery("UPDATE #__components SET admin_menu_img = '../components/com_virtuemart/shop_image/ps_image/menu_icon.png' WHERE admin_menu_link = 'option=com_virtuemart'");
$database->query();
$option = 'com_virtuemart';
$installfile = dirname(__FILE__) . "/install.php";
$database->setQuery("SHOW TABLES LIKE '" . $mosConfig_dbprefix . "vm_%'");
$vm_tables = $database->loadObjectList();
if (file_exists($mosConfig_absolute_path . '/administrator/components/' . $option . '/classes/htmlTools.class.php') && count($vm_tables) > 30) {
// VirtueMart is installed! But is it an older version that needs to be updated?
$database->setQuery('SELECT id, params FROM `#__components` WHERE name = \'virtuemart_version\'');
$database->loadObject($old_version);
if ($old_version && file_exists($mosConfig_absolute_path . '/administrator/components/com_virtuemart/classes/htmlTools.class.php')) {
$version_info = new mosParameters($old_version->params);
include_once $mosConfig_absolute_path . '/administrator/components/' . $option . '/version.php';
$VMVERSION = new vmVersion();
$result = version_compare($version_info->get('RELEASE'), '1.1.0');
if ($result == -1) {
return false;
}
}
@unlink($installfile);
if (file_exists($installfile) || !file_exists(dirname(__FILE__) . "/virtuemart.cfg.php")) {
die('<h2>Virtuemart Installation Notice</h2>
<p>You already have installed VirtueMart.</p>
<p>You MUST
<ol>
<li>DELETE the file <strong>' . $installfile . '</strong>,</li>
<li>RENAME the file <strong>virtuemart.cfg-dist.php</strong> to <strong>virtuemart.cfg.php</strong></li>
</ol>before you can use VirtueMart.
</p>');
} else {
header('Location: index2.php?option=com_virtuemart');
echo '<script type="text/javascript">document.location=\'' . $GLOBALS['mosConfig_live_site'] . '/administrator/index2.php?option=com_virtuemart\';</script>';
exit;
}
}
return false;
}
示例7: botSearchContacts
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchContacts($text, $phrase = '', $ordering = '')
{
global $database, $my, $_MAMBOTS;
// check if param query has previously been processed
if (!isset($_MAMBOTS->_search_mambot_params['contacts'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'contacts.searchbot'" . "\n AND folder = 'search'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_search_mambot_params['contacts'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_search_mambot_params['contacts'];
$botParams = new mosParameters($mambot->params);
$limit = $botParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$section = _CONTACT_TITLE;
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
break;
}
$query = "SELECT a.name AS title," . "\n CONCAT_WS( ', ', a.name, a.con_position, a.misc ) AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ', " . $database->Quote($section) . ", b.title ) AS section," . "\n '2' AS browsernav," . "\n CONCAT( 'index.php?option=com_contact&task=view&contact_id=', a.id ) AS href" . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.misc LIKE '%{$text}%'" . "\n OR a.con_position LIKE '%{$text}%'" . "\n OR a.address LIKE '%{$text}%'" . "\n OR a.suburb LIKE '%{$text}%'" . "\n OR a.state LIKE '%{$text}%'" . "\n OR a.country LIKE '%{$text}%'" . "\n OR a.postcode LIKE '%{$text}%'" . "\n OR a.telephone LIKE '%{$text}%'" . "\n OR a.fax LIKE '%{$text}%' )" . "\n AND a.published = 1" . "\n AND b.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n AND b.access <= " . (int) $my->gid . "\n GROUP BY a.id" . "\n ORDER BY {$order}";
$database->setQuery($query, 0, $limit);
$rows = $database->loadObjectList();
return $rows;
}
示例8: botExtendedMenuSourceWeblinks_onLoadMenu
function botExtendedMenuSourceWeblinks_onLoadMenu(&$menuLoader, $name = '')
{
global $database;
$botName = 'bot_exmenu_source_weblinks';
// load parameters
$database->setQuery('SELECT m.params FROM #__mambots AS m WHERE element = \'' . $botName . '\' AND folder = \'exmenu\'');
$params = new mosParameters($database->loadResult());
$params->def('source_name', 'weblinks');
if ($name != $params->get('source_name')) {
return FALSE;
}
$rootMenuNode =& $menuLoader->getRootMenuNode();
$database->setQuery('SELECT * FROM #__weblinks WHERE published = 1 ORDER BY hits DESC, title LIMIT 10');
$rows = $database->loadObjectList();
foreach (array_keys($rows) as $key) {
$row =& $rows[$key];
$menuNode =& $menuLoader->getEmptyMenuNode();
$menuNode->type = 'url';
$menuNode->link = $row->url;
$menuNode->name = $row->title;
$menuLoader->addMenuNode($rootMenuNode, $menuNode);
}
return TRUE;
}
示例9: botMosLoadPosition
/**
* Mambot that loads module positions within content
*/
function botMosLoadPosition($published, &$row, &$params, $page = 0)
{
global $database, $_MAMBOTS;
// simple performance check to determine whether bot should process further
if (strpos($row->text, 'mosloadposition') === false) {
return true;
}
// expression to search for
$regex = '/{mosloadposition\\s*.*?}/i';
// check whether mambot has been unpublished
if (!$published) {
$row->text = preg_replace($regex, '', $row->text);
return true;
}
// find all instances of mambot and put in $matches
preg_match_all($regex, $row->text, $matches);
// Number of mambots
$count = count($matches[0]);
// mambot only processes if there are any instances of the mambot in the text
if ($count) {
// check if param query has previously been processed
if (!isset($_MAMBOTS->_content_mambot_params['mosloadposition'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mosloadposition'" . "\n AND folder = 'content'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_content_mambot_params['mosloadposition'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_content_mambot_params['mosloadposition'];
$botParams = new mosParameters($mambot->params);
$style = $botParams->def('style', -2);
processPositions($row, $matches, $count, $regex, $style);
}
}
示例10: saveMenu
function saveMenu($option, $task)
{
global $database;
$params = mosGetParam($_POST, 'params', '');
$secids = mosGetParam($_POST, 'secid', array());
$secid = implode(',', $secids);
$params[sectionid] = $secid;
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$_POST['params'] = mosParameters::textareaHandling($txt);
}
$row = new mosMenu($database);
if (!$row->bind($_POST)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (count($secids) == 1 && $secids[0] != '') {
$row->link = str_replace('id=0', 'id=' . $secids[0], $row->link);
$row->componentid = $secids[0];
}
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;
}
$row->checkin();
$row->updateOrder("menutype='{$row->menutype}' AND parent='{$row->parent}'");
$msg = 'Menu item Saved';
switch ($task) {
case 'apply':
mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg);
break;
case 'save':
default:
mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg);
break;
}
}
示例11: saveMenu
function saveMenu($option, $task)
{
global $database;
$params = mosGetParam($_POST, 'params', '');
$params[url] = mosGetParam($_POST, 'url', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$_POST['params'] = mosParameters::textareaHandling($txt);
}
$row = new mosMenu($database);
if (!$row->bind($_POST)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
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;
}
$row->checkin();
$row->updateOrder('menutype = ' . $database->Quote($row->menutype) . ' AND parent = ' . (int) $row->parent);
$msg = 'Item de menu salvo';
switch ($task) {
case 'apply':
mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg);
break;
case 'save':
default:
mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg);
break;
}
}
示例12: showWrap
function showWrap($option)
{
global $database, $Itemid, $mainframe;
$menu = $mainframe->get('menu');
$params = new mosParameters($menu->params);
$params->def('back_button', $mainframe->getCfg('back_button'));
$params->def('scrolling', 'auto');
$params->def('page_title', '1');
$params->def('pageclass_sfx', '');
$params->def('header', $menu->name);
$params->def('height', '500');
$params->def('height_auto', '0');
$params->def('width', '100%');
$params->def('add', '1');
$url = $params->def('url', '');
$row = new stdClass();
if ($params->get('add')) {
// adds 'http://' if none is set
if (substr($url, 0, 1) == '/') {
// relative url in component. use server http_host.
$row->url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
} elseif (!strstr($url, 'http') && !strstr($url, 'https')) {
$row->url = 'http://' . $url;
} else {
$row->url = $url;
}
} else {
$row->url = $url;
}
// auto height control
if ($params->def('height_auto')) {
$row->load = 'onload="iFrameHeight()"';
} else {
$row->load = '';
}
$mainframe->SetPageTitle($menu->name);
HTML_wrapper::displayWrap($row, $params, $menu);
}
示例13: editSection
/**
* Compiles information to add or edit a section
* @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)
* @param string The name of the current user
*/
function editSection($uid = 0, $scope = '', $option)
{
global $database, $my, $mainframe;
$row = new mosSection($database);
// load the row from the db table
$row->load((int) $uid);
// fail if checked out not by 'me'
if ($row->isCheckedOut($my->id)) {
$msg = 'The section ' . $row->title . ' is currently being edited by another administrator';
mosRedirect('index2.php?option=' . $option . '&scope=' . $row->scope . '&mosmsg=' . $msg);
}
$selected_folders = NULL;
if ($uid) {
$row->checkout($my->id);
if ($row->id > 0) {
$query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . "\n AND ( type = 'content_archive_section' OR type = 'content_blog_section' OR type = 'content_section' )";
$database->setQuery($query);
$menus = $database->loadObjectList();
$count = count($menus);
for ($i = 0; $i < $count; $i++) {
switch ($menus[$i]->type) {
case 'content_section':
$menus[$i]->type = 'Section Table';
break;
case 'content_blog_section':
$menus[$i]->type = 'Section Blog';
break;
case 'content_archive_section':
$menus[$i]->type = 'Section Blog Archive';
break;
}
}
} else {
$menus = array();
}
// handling for MOSImage directories
if (trim($row->params)) {
// get params definitions
$params = new mosParameters($row->params, $mainframe->getPath('com_xml', 'com_sections'), 'component');
$temps = $params->get('imagefolders', '');
$temps = explode(',', $temps);
foreach ($temps as $temp) {
$selected_folders[] = mosHTML::makeOption($temp, $temp);
}
} else {
$selected_folders[] = mosHTML::makeOption('*1*');
}
} else {
$row->scope = $scope;
$row->published = 1;
$menus = array();
// handling for MOSImage directories
$selected_folders[] = mosHTML::makeOption('*1*');
}
// build the html select list for section types
$types[] = mosHTML::makeOption('', 'Select Type');
$types[] = mosHTML::makeOption('content_section', 'Section List');
$types[] = mosHTML::makeOption('content_blog_section', 'Section Blog');
$types[] = mosHTML::makeOption('content_archive_section', 'Section Archive Blog');
$lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
// build the html select list for ordering
$query = "SELECT ordering AS value, title AS text" . "\n FROM #__sections" . "\n WHERE scope=" . $database->Quote($row->scope) . " ORDER BY ordering";
$lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
// build the select list for the image positions
$active = $row->image_position ? $row->image_position : 'left';
$lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0);
// build the html select list for images
$lists['image'] = mosAdminMenus::Images('image', $row->image);
// build the html select list for the group access
$lists['access'] = mosAdminMenus::Access($row);
// build the html radio buttons for published
$lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
// build the html select list for menu selection
$lists['menuselect'] = mosAdminMenus::MenuSelect();
// list of folders in images/stories/
$imgFiles = recursive_listdir(COM_IMAGE_BASE);
$len = strlen(COM_IMAGE_BASE);
// handling for MOSImage directories
$folders[] = mosHTML::makeOption('*1*', 'All');
$folders[] = mosHTML::makeOption('*0*', 'None');
$folders[] = mosHTML::makeOption('*#*', '---------------------');
$folders[] = mosHTML::makeOption('/');
foreach ($imgFiles as $file) {
$folders[] = mosHTML::makeOption(substr($file, $len));
}
$lists['folders'] = mosHTML::selectList($folders, 'folders[]', 'class="inputbox" size="17" multiple="multiple"', 'value', 'text', $selected_folders);
sections_html::edit($row, $option, $lists, $menus);
}
示例14: vcard
function vcard()
{
$contact = new mosContact();
$contact->load($this->contact_id);
$params = new mosParameters($contact->params);
if (!$params->get('vcard')) {
echo "<script>alert (\"" . T_('There are no vCards available for download.') . "\"); window.history.go(-1);</script>";
exit(0);
}
$name = explode(' ', $contact->name);
$firstname = $name[0];
unset($name[0]);
$last = count($name);
if (isset($name[$last])) {
$surname = $name[$last];
unset($name[$last]);
} else {
$surname = '';
}
$middlename = trim(implode(' ', $name));
$v = new MambovCard();
$v->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE');
$v->setPhoneNumber($contact->fax, 'WORK;FAX');
$v->setName($surname, $firstname, $middlename, '');
$v->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL');
$v->setEmail($contact->email_to);
$v->setNote($contact->misc);
$v->setURL(mamboCore::get('mosConfig_live_site'), 'WORK');
$v->setTitle($contact->con_position);
$v->setOrg(mamboCore::get('mosConfig_sitename'));
$filename = str_replace(' ', '_', $contact->name);
$v->setFilename($filename);
$output = $v->getVCard(mamboCore::get('mosConfig_sitename'));
$filename = $v->getFileName();
// header info for page
header('Content-Disposition: attachment; filename=' . $filename);
header('Content-Length: ' . strlen($output));
header('Connection: close');
header('Content-Type: text/x-vCard; name=' . $filename);
print $output;
//mosRedirect('index.php');
}
示例15: saveModule
/**
* Saves the module after an edit form submit
*/
function saveModule($option, $client, $task)
{
global $database;
$params = mosGetParam($_POST, 'params', '', _MOS_ALLOWHTML);
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$_POST['params'] = mosParameters::textareaHandling($txt);
}
$row = new mosModule($database);
if (!$row->bind($_POST, 'selections')) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
// special access groups
if (is_array($row->groups)) {
$row->groups = implode(',', $row->groups);
} else {
$row->groups = '';
}
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;
}
$row->checkin();
if ($client == 'admin') {
$where = "client_id='1'";
} else {
$where = "client_id='0'";
}
$row->updateOrder("position='{$row->position}' AND ({$where})");
$menus = mosGetParam($_POST, 'selections', array());
$database->setQuery("DELETE FROM #__modules_menu WHERE moduleid='{$row->id}'");
$database->query();
foreach ($menus as $menuid) {
// this check for the blank spaces in the select box that have been added for cosmetic reasons
if ($menuid != "-999" && $menuid != "-998") {
$query = "INSERT INTO #__modules_menu SET moduleid='{$row->id}', menuid='{$menuid}'";
$database->setQuery($query);
$database->query();
}
}
switch ($task) {
case 'apply':
$msg = sprintf(T_('Successfully Saved changes to Module: %s'), $row->title);
mosRedirect('index2.php?option=' . $option . '&client=' . $client . '&task=editA&hidemainmenu=1&id=' . $row->id, $msg);
break;
case 'save':
default:
$msg = sprintf(T_('Successfully Saved Module: %s'), $row->title);
mosRedirect('index2.php?option=' . $option . '&client=' . $client, $msg);
break;
}
}