| 98 |
class mosComponentManager { |
class mosComponentManager { |
| 99 |
var $plugin_name = ''; |
var $plugin_name = ''; |
| 100 |
var $magic_quotes_value = 0; |
var $magic_quotes_value = 0; |
| 101 |
|
var $plugin_version = ''; |
| 102 |
|
var $option = ''; |
| 103 |
|
|
| 104 |
|
function mosComponentManager ($component_name, $version) { |
| 105 |
|
$this->text_name = $component_name; |
| 106 |
|
$this->plugin_name = strtolower(str_replace(' ', '', $component_name)); |
| 107 |
|
$this->plugin_version = $version; |
| 108 |
|
$this->option = mamboCore::get('option'); |
| 109 |
|
$this->noMagicQuotes(); |
| 110 |
|
$cname = 'com_'.$this->plugin_name; |
| 111 |
|
$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path'); |
| 112 |
|
if(file_exists($mosConfig_absolute_path."/components/$cname/language/".mamboCore::get('mosConfig_lang').'.php')) require_once($mosConfig_absolute_path."/components/$cname/language/".mamboCore::get('mosConfig_lang').'.php'); |
| 113 |
|
else if (file_exists($mosConfig_absolute_path."/components/$cname/language/english.php")) require_once($mosConfig_absolute_path."/components/$cname/language/english.php"); |
| 114 |
|
|
| 115 |
|
} |
| 116 |
|
|
| 117 |
function noMagicQuotes () { |
function noMagicQuotes () { |
| 118 |
// Is magic quotes on? |
// Is magic quotes on? |
| 150 |
* @package Mambo |
* @package Mambo |
| 151 |
*/ |
*/ |
| 152 |
class mosComponentUserManager extends mosComponentManager { |
class mosComponentUserManager extends mosComponentManager { |
|
var $option = ''; |
|
| 153 |
|
|
| 154 |
function mosComponentUserManager ($component, $control_name, $alternatives, $default, $title) { |
function mosComponentUserManager ($component_name, $control_name, $alternatives, $default, $title, $version) { |
| 155 |
$this->plugin_name = strtolower(str_replace(' ', '', $component)); |
mosComponentManager::mosComponentManager($component_name, $version); |
|
$this->option = mamboCore::get('option'); |
|
|
$this->noMagicQuotes(); |
|
| 156 |
$mainframe =& mosMainFrame::getInstance(); |
$mainframe =& mosMainFrame::getInstance(); |
| 157 |
$mainframe->SetPageTitle($title); |
$mainframe->SetPageTitle($title); |
| 158 |
$func = mosGetParam ($_REQUEST, $control_name, $default); |
$func = mosGetParam ($_REQUEST, $control_name, $default); |
| 188 |
var $order = 0; |
var $order = 0; |
| 189 |
var $currid = 0; |
var $currid = 0; |
| 190 |
|
|
| 191 |
function mosComponentAdminManager ($plugin_name) { |
function mosComponentAdminManager ($component_name, $version) { |
| 192 |
$this->plugin_name = strtolower(str_replace(' ', '', $plugin_name)); |
mosComponentManager::mosComponentManager($component_name, $version); |
| 193 |
$this->noMagicQuotes(); |
$this->act = mosGetParam ($_REQUEST, 'act', $this->plugin_name); |
| 194 |
if ($this->act = mosGetParam ($_REQUEST, 'act', $this->plugin_name)); |
$this->task = mosGetParam($_REQUEST, 'task', 'list'); |
|
if ($this->task = mosGetParam($_REQUEST, 'task', 'list')); |
|
|
else $this->task = 'list'; |
|
| 195 |
$mainframe = mosMainFrame::getInstance(); |
$mainframe = mosMainFrame::getInstance(); |
| 196 |
$default_limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', 20 ); |
$default_limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', 20 ); |
| 197 |
$this->limit = intval( mosGetParam( $_REQUEST, 'limit', $default_limit ) ); |
$this->limit = intval( mosGetParam( $_REQUEST, 'limit', $default_limit ) ); |
| 241 |
var $admin = ''; |
var $admin = ''; |
| 242 |
var $user = ''; |
var $user = ''; |
| 243 |
var $pageNav = ''; |
var $pageNav = ''; |
| 244 |
|
var $rootPath = ''; |
| 245 |
|
var $language = ''; |
| 246 |
|
|
| 247 |
function mosComponentAdminControllers ($admin) { |
function mosComponentAdminControllers ($admin) { |
| 248 |
$this->admin = $admin; |
$this->admin = $admin; |
| 249 |
$this->user = mamboCore::get('currentUser'); |
$this->user = mamboCore::get('currentUser'); |
| 250 |
|
$this->rootPath = mamboCore::get('mosConfig_absolute_path'); |
| 251 |
|
$this->language = mamboCore::get('mosConfig_lang'); |
| 252 |
} |
} |
| 253 |
|
|
| 254 |
function makePageNav (&$admin, $total) { |
function makePageNav (&$admin, $total) { |
| 318 |
class mosModuleHandler { |
class mosModuleHandler { |
| 319 |
var $_db = null; |
var $_db = null; |
| 320 |
var $_modules = null; |
var $_modules = null; |
| 321 |
|
var $_unpublished = null; |
| 322 |
|
var $_isAdmin = null; |
| 323 |
|
|
| 324 |
function mosModuleHandler () { |
function mosModuleHandler () { |
| 325 |
$this->_db =& mamboDatabase::getInstance(); |
$this->_db =& mamboDatabase::getInstance(); |
| 336 |
* @return array |
* @return array |
| 337 |
*/ |
*/ |
| 338 |
function initModules($isAdmin=false) { |
function initModules($isAdmin=false) { |
| 339 |
if (!isset($this->_modules)) { |
if (!isset($this->_modules) OR $isAdmin != $this->_isAdmin) { |
| 340 |
|
$this->_isAdmin = $isAdmin; |
| 341 |
if ($isAdmin) { |
if ($isAdmin) { |
| 342 |
$query = "SELECT id, title, module, position, content, showtitle, params" |
$query = "SELECT id, title, module, position, content, showtitle, params, published" |
| 343 |
. "\n FROM #__modules AS m" |
. "\n FROM #__modules AS m" |
| 344 |
. "\n WHERE m.published = '1'" |
. "\n WHERE m.published = '1'" |
| 345 |
. "\n AND (m.client_id = 1)" |
. "\n AND (m.client_id = 1)" |
| 348 |
else { |
else { |
| 349 |
$my = mamboCore::get('currentUser'); |
$my = mamboCore::get('currentUser'); |
| 350 |
$Itemid = mamboCore::get('Itemid'); |
$Itemid = mamboCore::get('Itemid'); |
| 351 |
$query = "SELECT id, title, module, position, content, showtitle, params" |
$query = "SELECT id, title, module, position, content, showtitle, params, published" |
| 352 |
."\nFROM #__modules AS m, #__modules_menu AS mm" |
."\nFROM #__modules AS m, #__modules_menu AS mm" |
| 353 |
. "\nWHERE m.published='1' AND m.access <= '$my->gid' AND m.client_id='0'" |
. "\nWHERE m.access <= '$my->gid' AND m.client_id='0'" |
| 354 |
. "\nAND mm.moduleid=m.id" |
. "\nAND mm.moduleid=m.id" |
| 355 |
. "\nAND (mm.menuid = '$Itemid' OR mm.menuid = '0')" |
. "\nAND (mm.menuid = '$Itemid' OR mm.menuid = '0')" |
| 356 |
. "\nORDER BY ordering"; |
. "\nORDER BY ordering"; |
| 358 |
$this->_db->setQuery( $query ); |
$this->_db->setQuery( $query ); |
| 359 |
$modules = $this->_db->loadObjectList(); |
$modules = $this->_db->loadObjectList(); |
| 360 |
foreach ($modules as $module) { |
foreach ($modules as $module) { |
| 361 |
$this->_modules[$module->position][] = $module; |
if ($module->published == 1) $this->_modules[$module->position][] = $module; |
| 362 |
|
else $this->_unpublished[] = $module; |
| 363 |
} |
} |
| 364 |
} |
} |
| 365 |
} |
} |
| 374 |
/** |
/** |
| 375 |
* @param string Name of module required |
* @param string Name of module required |
| 376 |
*/ |
*/ |
| 377 |
function &getByName( $name, $isAdmin=false ) { |
function &getByName( $name, $isAdmin=false, $unpublished=false ) { |
| 378 |
$this->initModules($isAdmin); |
$this->initModules($isAdmin); |
| 379 |
$modules = array(); |
$modules = array(); |
| 380 |
foreach ($this->_modules as $position) { |
foreach ($this->_modules as $position) { |
| 381 |
foreach ($position as $module) if ($module->module == $name) $modules[] = $module; |
foreach ($position as $module) if ($module->module == $name) $modules[] = $module; |
| 382 |
} |
} |
| 383 |
|
if ($unpublished AND $this->_unpublished) foreach ($this->_unpublished as $module) if ($module->module == $name) $modules[] = $module; |
| 384 |
return $modules; |
return $modules; |
| 385 |
} |
} |
| 386 |
|
|