/** * Register a page handler for administrator; * @pages: * administrator, * administrator/dasbhoard, * administrator/component, * administrator/components, * administrator/com_installer, * administrator/theme_installer, * administrator/settings/<page>, * administrator/cache, * administrator/users, * administrator/edituser * * @return bool */ function ossn_administrator_pagehandler($pages) { $page = $pages[0]; if (empty($page)) { $page = 'dashboard'; } switch ($page) { case 'dashboard': $title = ossn_print('admin:dashboard'); $contents['contents'] = ossn_view('pages/administrator/contents/dashboard'); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'component': global $Ossn; if (isset($pages[1]) && in_array($pages[1], ossn_registered_com_panel())) { $com['com'] = OssnComponents::getCom($pages[1]); $com['settings'] = ossn_components()->getComSettings($pages[1]); $title = $com['com']->com_name; $contents['contents'] = ossn_view("components/{$pages[1]}/administrator/{$Ossn->com_panel[$pages[1]]}", $com); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); } break; case 'components': $title = 'Components'; $contents['contents'] = ossn_view("pages/administrator/contents/components"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'themes': $title = 'Themes'; $contents['contents'] = ossn_view("pages/administrator/contents/themes"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'com_installer': $title = 'Component Installer'; $contents['contents'] = ossn_view("pages/administrator/contents/com_installer"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'theme_installer': $title = 'Theme Installer'; $contents['contents'] = ossn_view("pages/administrator/contents/theme_installer"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'settings': global $Ossn; if (isset($pages[1]) && in_array($pages[1], ossn_registered_settings_pages())) { $title = ossn_print("{$pages[1]}:settings"); $contents['contents'] = ossn_view($Ossn->adminSettingsPage[$pages[1]]); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); } break; case 'cache': $title = 'Cache Settings'; $contents['contents'] = ossn_view("pages/administrator/contents/cache"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'adduser': $title = 'Add User'; $contents['contents'] = ossn_view("pages/administrator/contents/adduser"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'users': $title = 'Users List'; $contents['contents'] = ossn_view("pages/administrator/contents/users/list"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'edituser': if (isset($pages[1])) { $user['user'] = ossn_user_by_username($pages[1]); } $title = 'Edit User'; $contents['contents'] = ossn_view("pages/administrator/contents/user/edit", $user); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; default: echo 403; break; } }
<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $OssnComs = new OssnComponents(); foreach ($OssnComs->getComponents() as $Com) { $Component = $OssnComs->getCom($Com); echo "<div class='ossn-components-item'>"; echo "<div class='component-controls'>"; if (!$OssnComs->isActive($Com)) { $enable = ossn_site_url("action/component/enable?com={$Com}", true); echo "<a href='{$enable}' class='components-button components-button-green'>" . ossn_print('admin:button:enable') . "</a>"; } elseif (!in_array($Com, $OssnComs->requiredComponents())) { $disable = ossn_site_url("action/component/disable?com={$Com}", true); echo "<a href='{$disable}' class='components-button components-button-orange'>" . ossn_print('admin:button:disable') . "</a>"; } if (in_array($Com, ossn_registered_com_panel())) { $configure = ossn_site_url("administrator/component/{$Com}", true); echo "<a href='{$configure}' class='components-button components-button-blue'>" . ossn_print('admin:button:configure') . "</a>"; } if (!in_array($Com, $OssnComs->requiredComponents())) { $delete = ossn_site_url("action/component/delete?component={$Com}", true); echo "<a href='{$delete}' class='components-button components-button-red'>" . ossn_print('admin:button:delete') . "</a>"; }
/** * Register a page handler for administrator; * @pages: * administrator, * administrator/dasbhoard, * administrator/component, * administrator/components, * administrator/com_installer, * administrator/theme_installer, * administrator/settings/<page>, * administrator/cache, * administrator/users, * administrator/edituser * * @return boolean|null */ function ossn_administrator_pagehandler($pages) { $page = $pages[0]; if (empty($page)) { $page = 'dashboard'; } switch ($page) { case 'dashboard': $title = ossn_print('admin:dashboard'); $contents['contents'] = ossn_plugin_view('pages/administrator/contents/dashboard'); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'component': global $Ossn; if (isset($pages[1]) && in_array($pages[1], ossn_registered_com_panel())) { $com['com'] = OssnComponents::getCom($pages[1]); $com['settings'] = ossn_components()->getComSettings($pages[1]); $title = $com['com']->name; $contents['contents'] = ossn_plugin_view("settings/administrator/{$pages[1]}/{$Ossn->com_panel[$pages[1]]}", $com); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); } break; case 'components': $title = ossn_print('admin:components'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/components"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'themes': $title = ossn_print('admin:themes'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/themes"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'com_installer': $title = ossn_print('admin:com:installer'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/com_installer"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'theme_installer': $title = ossn_print('admin:theme:installer'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/theme_installer"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'settings': global $Ossn; if (isset($pages[1]) && in_array($pages[1], ossn_registered_settings_pages())) { $title = ossn_print("{$pages[1]}:settings"); //file should be in plugins/views/default/settings/<file> $arsalanshah $contents['contents'] = ossn_plugin_view($Ossn->adminSettingsPage[$pages[1]]); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); } break; case 'cache': $title = ossn_print('admin:cache:settings'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/cache"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'adduser': $title = ossn_print('admin:add:user'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/adduser"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'users': $title = ossn_print('admin:user:list'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/users/list"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'unvalidated_users': $title = ossn_print('admin:users:unvalidated'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/users/unvalidated"); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'edituser': if (isset($pages[1])) { $user['user'] = ossn_user_by_username($pages[1]); } $title = ossn_print('admin:edit:user'); $contents['contents'] = ossn_plugin_view("pages/administrator/contents/user/edit", $user); $contents['title'] = $title; $content = ossn_set_page_layout('administrator/administrator', $contents); echo ossn_view_page($title, $content, 'administrator'); break; case 'version': header('Content-Type: application/json'); $version = array('version' => ossn_check_update()); echo json_encode($version); break; default: ossn_error_page(); break; } }
<?php /** * Open Source Social Network * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ ?> <div class="panel-group" id="accordion"> <?php $OssnComs = new OssnComponents(); $list = $OssnComs->getComponents(); if ($list) { foreach ($list as $component) { $vars = array(); $vars['OssnCom'] = $OssnComs; $vars['component'] = $OssnComs->getCom($component); $vars['name'] = $component; echo ossn_plugin_view("admin/components/list/item", $vars); } } ?> </div>