| 93 | | 'modules1' => array('type'=>'tool', 'category' => 'Admin', 'name' => 'Module Admin', 'sort' => -9), |
|---|
| 94 | | 'modules2' => array('type'=>'setup', 'category' => 'Admin', 'name' => 'Module Admin', 'sort' => -9), |
|---|
| 95 | | 'dashboard1' => array('type'=>'setup', 'category' => 'Admin', 'name' => 'Status Dashboard', 'sort' => -10), |
|---|
| 96 | | 'dashboard2' => array('type'=>'tool', 'category' => 'Admin', 'name' => 'Status Dashboard', 'sort' => -10), |
|---|
| | 93 | 'modules1' => array('display'=>'modules', 'type'=>'tool', 'category' => 'Admin', 'name' => 'Module Admin', 'sort' => -9), |
|---|
| | 94 | 'modules2' => array('display'=>'modules', 'type'=>'setup', 'category' => 'Admin', 'name' => 'Module Admin', 'sort' => -9), |
|---|
| | 118 | |
|---|
| | 119 | // check access |
|---|
| | 120 | // TODO : do we always include functions.inc (like it is now), or do we put this check first? |
|---|
| | 121 | if (!$_SESSION["AMP_user"]->checkSection($itemKey)) { |
|---|
| | 122 | // no access, skip to the next |
|---|
| | 123 | continue; |
|---|
| | 124 | } |
|---|
| | 125 | |
|---|
| | 126 | // if the module has it's own translations, use them for displaying menu item |
|---|
| | 127 | if (extension_loaded('gettext')) { |
|---|
| | 128 | if (is_dir("modules/{$key}/i18n")) { |
|---|
| | 129 | bindtextdomain($key,"modules/{$key}/i18n"); |
|---|
| | 130 | bind_textdomain_codeset($key, 'utf8'); |
|---|
| | 131 | textdomain($key); |
|---|
| | 132 | } else { |
|---|
| | 133 | bindtextdomain('amp','./i18n'); |
|---|
| | 134 | textdomain('amp'); |
|---|
| | 135 | } |
|---|
| | 136 | } |
|---|
| | 137 | |
|---|
| 160 | | if (is_array($fpbx_menu)) { |
|---|
| 161 | | foreach ($fpbx_menu as $key => $value) { |
|---|
| 162 | | // check access |
|---|
| 163 | | if ($_SESSION["AMP_user"]->checkSection($key)) { |
|---|
| 164 | | // if the module has it's own translations, use them for displaying menu item |
|---|
| 165 | | if (extension_loaded('gettext')) { |
|---|
| 166 | | if (is_dir("modules/{$key}/i18n")) { |
|---|
| 167 | | bindtextdomain($key,"modules/{$key}/i18n"); |
|---|
| 168 | | bind_textdomain_codeset($key, 'utf8'); |
|---|
| 169 | | textdomain($key); |
|---|
| 170 | | } else { |
|---|
| 171 | | bindtextdomain('amp','./i18n'); |
|---|
| 172 | | textdomain('amp'); |
|---|
| 173 | | } |
|---|
| 174 | | } |
|---|
| 175 | | } else { |
|---|
| 176 | | // they don't have access to this, remove it completely |
|---|
| 177 | | unset($fpbx_menu[$key]); |
|---|
| 178 | | } |
|---|
| 179 | | } |
|---|
| 180 | | } |
|---|
| 181 | | |
|---|
| 182 | | |
|---|
| 183 | | |
|---|
| 216 | | if (!isset($active_modules) || (isset($active_modules) && !is_array($active_modules))) { |
|---|
| 217 | | break; |
|---|
| 218 | | } |
|---|
| 219 | | |
|---|
| 220 | | foreach ($active_modules as $modkey => $module) { |
|---|
| 221 | | if (!isset($module['items']) || (isset($module['items']) && !is_array($module['items']))){ |
|---|
| 222 | | continue; |
|---|
| 223 | | } |
|---|
| 224 | | |
|---|
| 225 | | foreach (array_keys($module['items']) as $item){ |
|---|
| 226 | | if ($display != $item) { |
|---|
| 227 | | continue; |
|---|
| 228 | | } |
|---|
| 229 | | |
|---|
| 230 | | // set the active modules |
|---|
| 231 | | $module_name = $modkey; |
|---|
| 232 | | $module_page = $item; |
|---|
| 233 | | |
|---|
| 234 | | // modules can use their own translation files |
|---|
| 235 | | if (extension_loaded('gettext')) { |
|---|
| 236 | | if(is_dir("./modules/{$modkey}/i18n")) { |
|---|
| 237 | | bindtextdomain($modkey,"./modules/{$modkey}/i18n"); |
|---|
| 238 | | bind_textdomain_codeset($modkey, 'utf8'); |
|---|
| 239 | | textdomain($modkey); |
|---|
| 240 | | } |
|---|
| 241 | | } |
|---|
| 242 | | |
|---|
| 243 | | //TODO Determine which item is this module displaying. Currently this is over the place, we should standarize on a "itemid" request var for now, we'll just cover all possibilities :-( |
|---|
| 244 | | $possibilites = array( |
|---|
| 245 | | 'userdisplay', |
|---|
| 246 | | 'extdisplay', |
|---|
| 247 | | 'id', |
|---|
| 248 | | 'itemid', |
|---|
| 249 | | 'category', |
|---|
| 250 | | 'selection' |
|---|
| 251 | | ); |
|---|
| 252 | | $itemid = ''; |
|---|
| 253 | | foreach($possibilites as $possibility) { |
|---|
| 254 | | if ( isset($_REQUEST[$possibility]) && $_REQUEST[$possibility] != '' ) |
|---|
| 255 | | $itemid = $_REQUEST[$possibility]; |
|---|
| 256 | | } |
|---|
| 257 | | |
|---|
| 258 | | // create a module_hook object for this module's page |
|---|
| 259 | | $module_hook = new moduleHook; |
|---|
| 260 | | |
|---|
| 261 | | // populate object variables |
|---|
| 262 | | $module_hook->install_hooks($itemid,$modkey,$item); |
|---|
| 263 | | |
|---|
| 264 | | // let hooking modules process the $_REQUEST |
|---|
| 265 | | $module_hook->process_hooks($itemid,$modkey,$item,$_REQUEST); |
|---|
| 266 | | |
|---|
| 267 | | // include the module page |
|---|
| 268 | | include "modules/{$modkey}/page.{$item}.php"; |
|---|
| 269 | | |
|---|
| 270 | | // global component |
|---|
| 271 | | if ( isset($currentcomponent) ) { |
|---|
| 272 | | echo $currentcomponent->generateconfigpage(); |
|---|
| 273 | | } |
|---|
| 274 | | |
|---|
| 275 | | } |
|---|
| 276 | | } |
|---|
| | 234 | $module_name = $cur_menuitem['module']['rawname']; |
|---|
| | 235 | $module_page = $cur_menuitem['display']; |
|---|
| | 236 | |
|---|
| | 237 | $module_file = 'modules/'.$module_name.'/page.'.$module_page.'.php'; |
|---|
| | 238 | |
|---|
| | 239 | |
|---|
| | 240 | //TODO Determine which item is this module displaying. Currently this is over the place, we should standarize on a "itemid" request var for now, we'll just cover all possibilities :-( |
|---|
| | 241 | $possibilites = array( |
|---|
| | 242 | 'userdisplay', |
|---|
| | 243 | 'extdisplay', |
|---|
| | 244 | 'id', |
|---|
| | 245 | 'itemid', |
|---|
| | 246 | 'category', |
|---|
| | 247 | 'selection' |
|---|
| | 248 | ); |
|---|
| | 249 | $itemid = ''; |
|---|
| | 250 | foreach($possibilites as $possibility) { |
|---|
| | 251 | if ( isset($_REQUEST[$possibility]) && $_REQUEST[$possibility] != '' ) |
|---|
| | 252 | $itemid = $_REQUEST[$possibility]; |
|---|
| | 253 | } |
|---|
| | 254 | |
|---|
| | 255 | // create a module_hook object for this module's page |
|---|
| | 256 | $module_hook = new moduleHook; |
|---|
| | 257 | |
|---|
| | 258 | // populate object variables |
|---|
| | 259 | $module_hook->install_hooks($itemid,$modkey,$item); |
|---|
| | 260 | |
|---|
| | 261 | // let hooking modules process the $_REQUEST |
|---|
| | 262 | $module_hook->process_hooks($itemid,$modkey,$item,$_REQUEST); |
|---|
| | 263 | |
|---|
| | 264 | |
|---|
| | 265 | |
|---|
| | 266 | // include the module page |
|---|
| | 267 | if (file_exists($module_file)) { |
|---|
| | 268 | include($module_file); |
|---|
| | 269 | } else { |
|---|
| | 270 | echo "404 Not found"; |
|---|
| | 271 | } |
|---|
| | 272 | |
|---|
| | 273 | // global component |
|---|
| | 274 | if ( isset($currentcomponent) ) { |
|---|
| | 275 | echo $currentcomponent->generateconfigpage(); |
|---|
| | 276 | } |
|---|
| | 277 | |
|---|