| 11 |
|
|
| 12 |
function &getParamsByName ($name) { |
function &getParamsByName ($name) { |
| 13 |
$params = null; |
$params = null; |
| 14 |
$row = new mosComponent( $database ); |
$row = new mosComponent(); |
| 15 |
$query = "SELECT a.params, a.option" |
$query = "SELECT a.params, a.option" |
| 16 |
. "\n FROM #__components AS a" |
. "\n FROM #__components AS a" |
| 17 |
. "\n WHERE a.name = '$name'" |
. "\n WHERE a.name = '$name'" |
| 84 |
/** |
/** |
| 85 |
* @param database A database connector object |
* @param database A database connector object |
| 86 |
*/ |
*/ |
| 87 |
function mosComponent( &$db ) { |
function mosComponent() { |
| 88 |
|
$db = mamboDatabase::getInstance(); |
| 89 |
$this->mosDBTable( '#__components', 'id', $db ); |
$this->mosDBTable( '#__components', 'id', $db ); |
| 90 |
} |
} |
| 91 |
} |
} |
| 92 |
|
|
| 93 |
|
class mosComponentUserSide { |
| 94 |
|
var $magic_quotes_value = 0; |
| 95 |
|
var $option = ''; |
| 96 |
|
|
| 97 |
|
function mosComponentUserSide ($component, $control_name, $alternatives, $default, $title) { |
| 98 |
|
$this->option = mamboCore::get('option'); |
| 99 |
|
// Is magic quotes on? |
| 100 |
|
if (get_magic_quotes_gpc()) { |
| 101 |
|
// Yes? Strip the added slashes |
| 102 |
|
$_REQUEST = $this->remove_magic_quotes($_REQUEST); |
| 103 |
|
$_GET = $this->remove_magic_quotes($_GET); |
| 104 |
|
$_POST = $this->remove_magic_quotes($_POST); |
| 105 |
|
} |
| 106 |
|
$this->magic_quotes_value = get_magic_quotes_runtime(); |
| 107 |
|
set_magic_quotes_runtime(0); |
| 108 |
|
$mainframe =& mosMainFrame::getInstance(); |
| 109 |
|
$mainframe->SetPageTitle($title); |
| 110 |
|
$func = mosGetParam ($_REQUEST, $control_name, $default); |
| 111 |
|
if (isset($alternatives[$func])) $method = $alternatives[$func]; |
| 112 |
|
else $method = $func; |
| 113 |
|
$classname = $component.'_'.$method.'_Controller'; |
| 114 |
|
if (class_exists($classname)) { |
| 115 |
|
$controller =& new $classname($this); |
| 116 |
|
if (is_callable(array(&$controller,$method))) $controller->$method($func); |
| 117 |
|
else trigger_error("Component $component error: attempt to use non-existent method $method in $controller"); |
| 118 |
|
} |
| 119 |
|
else trigger_error("Component $component error: attempt to use non-existent class $classname"); |
| 120 |
|
$this->restore_magic_quotes(); |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
function &remove_magic_quotes (&$array) { |
| 124 |
|
foreach ($array as $k => $v) { |
| 125 |
|
if (is_array($v)) $array[$k] = $this->remove_magic_quotes($v); |
| 126 |
|
else $array[$k] = stripslashes($v); |
| 127 |
|
} |
| 128 |
|
return $array; |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
function restore_magic_quotes () { |
| 132 |
|
set_magic_quotes_runtime($this->magic_quotes_value); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
function newHTMLClassCheck ($name, &$controller, $total_items, $clist) { |
| 136 |
|
if (class_exists($name)) return new $name ($controller, $this->limit, $clist); |
| 137 |
|
trigger_error("Component $this->plugin_name error: attempt to use non-existent class ".$name); |
| 138 |
|
return false; |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
function checkCallable ($object, $method) { |
| 142 |
|
if (is_callable(array(&$object, $method))) return true; |
| 143 |
|
$name = get_class($object); |
| 144 |
|
trigger_error("Component $this->plugin_name error: attempt to use non-existent class $method in $name"); |
| 145 |
|
return false; |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
} |
| 149 |
|
|
| 150 |
/** |
/** |
| 151 |
* Template Table Class |
* Template Table Class |
| 257 |
} |
} |
| 258 |
|
|
| 259 |
/** |
/** |
| 260 |
|
* @param string Name of module required |
| 261 |
|
*/ |
| 262 |
|
function &getByName( $name, $isAdmin=false ) { |
| 263 |
|
$this->initModules($isAdmin); |
| 264 |
|
foreach ($this->_modules as $position) { |
| 265 |
|
foreach ($position as $module) if ($module->module == $name) return $module; |
| 266 |
|
} |
| 267 |
|
$module = null; |
| 268 |
|
return $module; |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
/** |
| 272 |
* @param string The position |
* @param string The position |
| 273 |
* @param int The style. 0=normal, 1=horiz, -1=no wrapper |
* @param int The style. 0=normal, 1=horiz, -1=no wrapper |
| 274 |
*/ |
*/ |