public function install() { $mod = new Modules(); $mod->getModuleByName('roles'); $perms = array('create roles', 'update roles', 'delete roles', 'manage roles'); $perm_ids = FabriqModules::register_perms($mod->id, $perms); global $db; $sql = "CREATE TABLE IF NOT EXISTS `fabmod_roles_roles` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`role` VARCHAR(100) NOT NULL,\n\t\t\t`enabled` TINYINT(1) NOT NULL DEFAULT 1,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;"; $db->query($sql); $sql = "CREATE TABLE IF NOT EXISTS `fabmod_roles_moduleperms` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`permission` INT(11) NOT NULL,\n\t\t\t`role` INT(11) NOT NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`),\n\t\t\tCONSTRAINT `fk_moduleperms_permission` FOREIGN KEY (`permission`) REFERENCES fabmods_perms(id) ON DELETE CASCADE,\n\t\t\tCONSTRAINT `fk_moduleperms_role` FOREIGN KEY (`role`) REFERENCES fabmod_roles_roles(id) ON DELETE CASCADE\n\t\t) ENGINE=INNODB;"; $db->query($sql); // create base roles $role = FabriqModules::new_model('roles', 'Roles'); $role->role = "unauthenticated"; $role->enabled = 1; $role->id = $role->create(); $role = FabriqModules::new_model('roles', 'Roles'); $role->role = "authenticated"; $role->enabled = 1; $role->id = $role->create(); $role = FabriqModules::new_model('roles', 'Roles'); $role->role = "administrator"; $role->enabled = 1; $role->id = $role->create(); // map paths $pathmap =& FabriqModules::module('pathmap'); $pathmap->register_path('fabriqadmin/roles/manage', 'roles', 'index', 'module'); $pathmap->register_path('fabriqadmin/roles/create', 'roles', 'create', 'module'); $pathmap->register_path('fabriqadmin/roles/perms', 'roles', 'perms', 'module'); // set module as installed $mod->installed = 1; $mod->update(); }
public function displayAccessWarning() { if (Yii::app()->isCommonSSL) { return; } $access_warning_cookie = Yii::app()->request->cookies['access_warning']; if ($access_warning_cookie === null || $access_warning_cookie->value !== 'false') { $objModule = Modules::model()->LoadByName('wsaccesswarning'); if (!$objModule) { Yii::import('ext.wsaccesswarning.models.*'); $arrDefaultConfig = $this->getAdminModel()->getDefaultConfiguration(); $objModule = new Modules(); $objModule->module = 'wsaccesswarning'; $objModule->category = 'extension'; $objModule->name = 'Site Access Warning'; $objModule->version = 1; $objModule->active = 0; $objModule->configuration = serialize($arrDefaultConfig); $objModule->save(); } if ($objModule->active) { $arrConfig = $objModule->GetConfigValues(); $globalScript = sprintf("var accessWarningMessage = %s;", json_encode($this->_transformMessageForDisplay($arrConfig['message']))); // No HTML tags are allowed in the button caption so we encode to HTML entities. $globalScript .= sprintf("var accessWarningButtonCaption = %s;", json_encode(CHtml::encode($arrConfig['button_caption']))); $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScript('_', $globalScript, CClientScript::POS_HEAD); $cs->registerCssFile($assets . '/css/wsaccesswarning.css'); $cs->registerScriptFile($assets . '/thirdparty/carhartl-jquery-cookie/jquery.cookie.js'); $cs->registerScriptFile($assets . '/js/wsaccesswarning.js'); } } }
function indexAction() { $config_table = new Config(); $modules_table = new Modules("core"); $request = new Bolts_Request($this->getRequest()); if ($request->has('modid')) { $modid = $request->modid; } else { $modid = 'bolts'; } if ($this->_request->isPost()) { //we are posting $config_params = $this->_request->getParams(); foreach ($config_params as $ckey => $value) { $data = array('value' => $value); $config_table->update($data, "ckey = '" . $ckey . "' and module='" . $modid . "'"); } $this->view->success = $this->_T('Configuration Updated.'); $config_table->cache(); $params = array(); $this->_Bolts_plugin->doAction($this->_mca . '_post_save', $params); // ACTION HOOK } $config = $config_table->fetchAll($config_table->select()->where('module = ?', $modid)); if (count($config) > 0) { $config = $config->toArray(); sort($config); $this->view->config = $config; } $modules = $modules_table->getEnabledModules(); sort($modules); $this->view->modules = $modules; $this->view->current = $modid; $this->view->modid = $modid; }
/** * @param Modules $modules * @return Modules */ public function sort(Modules $modules) { $this->result = []; $this->initial = $modules->getArrayCopy(); $this->run(); return new Modules($this->result); }
/** * Class Constructor * * @param Config $configs Konfigurasi */ public function __construct(Config $conf = null) { // Menerapkan konfigurasi $this->conf = $conf; // Menerapkan konfigurasi (@link http://php.net/manual/en/function.ob-get-level.php) $this->buffer = ob_get_level(); self::$instance =& $this; // Default konfigurasi $baseurl if ($this->conf('baseurl') == '' && isset($_SERVER['HTTP_HOST'])) { $this->conf('baseurl', '//' . $_SERVER['HTTP_HOST'] . '/'); } session_name($this->conf('basename')); session_start(); // Inisiasi routing container $this->add('routes', function ($c) { return []; }); // Inisiasi uri container $this->add('uri', function ($c) { return new Uri(); }); // Inisiasi modules container $this->add('modules', function ($c, $name) { $modules = new Modules($name); // Menyimpan sementara semua modules yang ada dalam cache $c->add($name, $modules->all()); return $modules; }); }
public function uninstall() { $mod = new Modules(); $mod->getModuleByName('blog'); // remove perms FabriqModules::remove_perms($mod->id); // remove paths $pathmap =& FabriqModules::module('pathmap'); $pathmap->remove_path('blog'); $pathmap->remove_path('blog/create'); $pathmap->remove_path('blog/update/!#'); $pathmap->remove_path('blog/destroy/!#'); $pathmap->remove_path('blog/show/!#'); // delete database table global $db; $sql = "DROP TABLE `fabmod_blog_blogs`;"; $db->query($sql); // uninstall any terms if (FabriqModules::enabled('taxonomy')) { FabriqModules::module('taxonomy')->uninstallMaps('fabmod_blog_blogs'); } // set module as not installed $mod->installed = 0; $mod->update(); }
public function perms() { if ($this->requiresPermission('manage roles', $this->name)) { Fabriq::title('Admin | Manage permissions'); FabriqModules::add_css('roles', 'roles'); $perms = new Perms(); $perms->getAll(); $modules = new Modules(); $modules->getEnabled(); $roles = FabriqModules::new_model('roles', 'Roles'); $roles->getRoles(); $modulePerms = FabriqModules::new_model('roles', 'ModulePerms'); $modulePerms->getAll(); $permissions = array(); foreach ($perms as $perm) { $permissions[$perm->id] = array(); foreach ($roles as $role) { if (isset($modulePerms->perms[$perm->id][$role->id])) { $permissions[$perm->id][$role->id] = 1; } else { $permissions[$perm->id][$role->id] = 0; } } } if (isset($_POST['submit'])) { foreach ($perms as $perm) { foreach ($roles as $role) { if (isset($_POST['permission'][$perm->id][$role->id])) { $permissions[$perm->id][$role->id] = 1; // add to database if it's not already set if (!isset($modulePerms->perms[$perm->id][$role->id])) { $p = FabriqModules::new_model('roles', 'ModulePerms'); $p->permission = $perm->id; $p->role = $role->id; $p->id = $p->create(); $modulePerms->perms[$perm->id][$role->id] = $modulePerms->count(); $modulePerms->add($p); } } else { $permissions[$perm->id][$role->id] = 0; // remove from database if it is already set if (isset($modulePerms->perms[$perm->id][$role->id])) { $p = FabriqModules::new_model('roles', 'ModulePerms'); $p->find($modulePerms[$modulePerms->perms[$perm->id][$role->id]]->id); $p->destroy(); $modulePerms->remove($modulePerms->perms[$perm->id][$role->id]); $modulePerms->reindex(); } } } } Messaging::message('Permissions have been updated.', 'success'); } FabriqModules::set_var($this->name, 'perms', $perms); FabriqModules::set_var($this->name, 'modules', $modules); FabriqModules::set_var($this->name, 'roles', $roles); FabriqModules::set_var($this->name, 'permissions', $permissions); } }
function autorisation($nomplugin) { $module = new Modules(); if ($module->charger($nomplugin) && $module->actif && $module->est_autorise()) { return 1; } exit; }
public function update_2_1_8() { // update the module version number $mod = new Modules(); $mod->getModuleByName('users'); $mod->versioninstalled = '2.1.8'; $mod->update(); }
public function uninstall() { $mod = new Modules(); $mod->getModuleByName('googleanalytics'); // set module as not installed $mod->installed = 0; $mod->update(); }
public function update_1_5_1() { // update the module version number $mod = new Modules(); $mod->getModuleByName('users'); $mod->versioninstalled = '1.5.1'; $mod->update(); }
public function update_2_1_3() { // update the module version number $mod = new Modules(); $mod->getModuleByName('pathmap'); $mod->versioninstalled = '2.1.3'; $mod->update(); }
public function getAllLinkPages() { $data = array(); $modules = new Modules(); $criteria = new CDbCriteria(); $criteria->select = 'page_id, module_id'; foreach ($this->findAll($criteria) as $value) { $data[$value->page_id] = $modules->findByPk($value->module_id)->name; } return $data; }
function port($type = 0, $_pays = false, $_cpostal = "") { if ($_SESSION['navig']->commande->transport == "" && !$type) { return -1; } if ($_SESSION['navig']->adresse != 0) { $chadr = 1; } else { $chadr = 0; } $modules = new Modules(); if (!$type) { $modules->charger_id($_SESSION['navig']->commande->transport); } else { $modules->charger_id($type); } if ($modules->type != Modules::TRANSPORT || !$modules->actif) { return -1; } $p = new Pays(); if ($chadr) { $adr = new adresse(); $adr->charger($_SESSION['navig']->adresse); $p->charger($adr->pays); $cpostal = $adr->cpostal; } else { $p->charger($_SESSION['navig']->client->pays); $cpostal = $_SESSION['navig']->client->cpostal; } // Prise en compte des infos passée, si aucune des infos précédentes n'est pertinente. if (empty($p->id) && $_pays) { $p->charger($_pays); } if (empty($cpostal) && $_cpostal != "") { $cpostal = $_cpostal; } $zone = new Zone(); $zone->charger($p->zone); try { $port = ActionsModules::instance()->instancier($modules->nom); $port->nbart = $_SESSION['navig']->panier->nbart(); $port->poids = $_SESSION['navig']->panier->poids(); $port->total = $_SESSION['navig']->panier->total(); $port->zone = $p->zone; $port->pays = $p->id; $port->unitetr = $zone->unite; $port->cpostal = $cpostal; $frais = $port->calcule(); ActionsModules::instance()->appel_module("port", $frais); return $frais; } catch (exception $e) { return -1; } }
public function update_2_3_1() { // update the path(s) for the fabriqupdate module to point to the proper actions $pathmap =& FabriqModules::module('pathmap'); $pathmap->remove_path('fabriqupdates'); $pathmap->register_path('fabriqupdates', 'fabriqinstall', 'fetchUpdates', 'module'); // update the module version number $mod = new Modules(); $mod->getModuleByName('fabriqinstall'); $mod->versioninstalled = '2.3.1'; $mod->update(); }
public function init($app) { $mdl = new Modules($this->c); $this->modulesLocations = $mdl->getLocations(); ob_start(); foreach ($this->modulesLocations as $module) { require $module->Path . $module->Controller; } foreach ($this->modulesLocations as $module) { include_once $module->Path . $module->Routes; } return ob_get_clean(); }
function indexAction() { // retrieve the ID of the requested page $pageID = $this->view->pageID = $this->_getParam('ID'); $pageDetails = new PagesIndex(); $pageDetailsSelect = $pageDetails->select(); $pageDetailsSelect->where('PI_PageID = ?', $pageID)->where('PI_LanguageID = ?', $this->_defaultEditLanguage); $pageDetailsData = $pageDetails->fetchRow($pageDetailsSelect)->toArray(); $this->view->assign("pageTitle", $pageDetailsData["PI_PageTitle"]); $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "data")) { $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "structure")) { $this->view->assign('hasAccessToStructure', true); } // Retrieve the page view layout $page = new Pages(); $page_select = $page->select()->setIntegrityCheck(false); $page_select->from('Pages')->join('Views', 'Pages.P_ViewID = Views.V_ID')->where('P_ID = ?', $pageID); $page_info = Cible_FunctionsPages::getPageViewDetails($pageID); $template_file = 'index/' . $page_info['V_Path']; $_zone_count = $page_info['V_ZoneCount']; // make a request to get all the blocks to be displayed $blocks = new Blocks(); $select = $blocks->select()->setIntegrityCheck(false); $select->from('Blocks')->join('Modules', 'Modules.M_ID = Blocks.B_ModuleID')->join('Pages', 'Blocks.B_PageID = P_ID')->join('BlocksIndex', 'Blocks.B_ID = BlocksIndex.BI_BlockID')->where('Blocks.B_PageID = ?', $pageID)->where('BlocksIndex.BI_LanguageID = ?', Zend_Registry::get('languageID'))->order('Blocks.B_Position ASC'); //Send the results to the view $rows = $blocks->fetchAll($select); $_blocks = array(); foreach ($rows as $row) { // create the placeholder object if not already defined if (!isset($_blocks[$row['B_ZoneID']])) { $_blocks[$row['B_ZoneID']] = array(); } $_blocks[$row['B_ZoneID']][] = $row->toArray(); } $this->view->assign('template_file', $template_file); $this->view->assign('zone_count', $_zone_count); $this->view->assign('blocks', $_blocks); // Load the modules in the view $Modules = new Modules(); $modules = $Modules->fetchAll(); $this->view->assign('modules', $modules->toArray()); } else { $this->view->assign('template_file', ""); $this->view->assign('error_message_permission', $this->view->getCibleText('error_message_permission')); } }
/** * Sets the range object and checks whether the calendar is available. * * @param string $range_id The id of a course, institute or user. * @throws AccessDeniedException */ private function setRangeObject($range_id) { $this->range_object = get_object_by_range_id($range_id); if (!is_object($this->range_object)) { throw new AccessDeniedException(); } $range_map = array('User' => Calendar::RANGE_USER, 'Course' => Calendar::RANGE_SEM, 'Institute' => Calendar::RANGE_INST); $this->range = $range_map[get_class($this->range_object)]; if ($this->range == Calendar::RANGE_INST || $this->range == Calendar::RANGE_SEM) { $modules = new Modules(); if (!$modules->getStatus('calendar', $this->range_object->getId())) { throw new AccessDeniedException(); } } }
function create() { // Modules::run('secure_tings/ni_met'); $update_id = $this->uri->segment(3); $data = array(); $this->load->model('mdl_jobcard'); $this->load->model('spareparts/mdl_spareparts'); if (!isset($update_id)) { $update_id = $this->input->post('update_id', $id); $data['maequipment'] = $this->mdl_spareparts->getequip(); } if (is_numeric($update_id)) { $data = $this->get_data_from_db($update_id); $data['update_id'] = $update_id; $data['maequipment'] = $this->mdl_spareparts->getequip(); $this->session->set_flashdata('Umsg', '<div id="alert-message" class="alert alert-warning text-center">Please Check the Reason for Failure and Tests Administered Sections before Updating !</div>'); } else { $data = $this->get_data_from_post(); $data['maequipment'] = $this->mdl_spareparts->getequip(); } $data['section'] = "Maintenance"; $data['subtitle'] = "Job Card"; $data['page_title'] = "Cold Chain Maintenance Job Card"; $data['module'] = "jobcard"; $data['view_file'] = "create_jobcard_form"; $data['user_object'] = $this->get_user_object(); $data['main_title'] = $this->get_title(); echo Modules::run('template/' . $this->redirect($this->session->userdata['logged_in']['user_group']), $data); }
function _dialog($page) { if (in_array($page, array('edit'))) { $this->response->dialog(array('body' => Modules::run('exp_field/' . $page))); } $this->response->send(); }
public function index() { $data['module'] = 'cashier'; $data['view_file'] = 'dashboard_view'; $data['sidebar'] = 'cashier/cashier_sidebar'; echo Modules::run('templates/bilis_noside', $data); }
function _parse_methods($string, $depth = 0) { if ($depth > 50) { //super simple recursive fix return $string; } if (FALSE === ($matches = $this->_match_methods($string, 'module'))) { return $string; } foreach ($matches[0] as $match) { $result = str_replace($this->l_delim . "module:", '', $match); $result = str_replace($this->r_delim, '', $result); $values = explode('|', $result); $handler = $values[0] . "/_remap"; $arguments = array(); if (array_key_exists(1, $values)) { $arguments = explode(',', $values[1]); } if (count($arguments) == 0) { array_push($arguments, "index"); } $module_content = Modules::run_with_params($handler, $arguments); $string = str_replace($match, $module_content, $string); } return $this->_parse_methods($string, ++$depth); }
function create() { $update_id = $this->uri->segment(3); $data = array(); $this->load->model('mdl_vaccines'); if (!isset($update_id)) { $update_id = $this->input->post('update_id', $id); $data['mavaccine'] = $this->mdl_vaccines->getVaccine(); } if (is_numeric($update_id)) { $data = $this->get_data_from_db($update_id); $data['update_id'] = $update_id; $data['mavaccine'] = $this->mdl_vaccines->getVaccine(); } else { $data = $this->get_data_from_post(); $data['mavaccine'] = $this->mdl_vaccines->getVaccine(); } $data['module'] = "vaccines"; $data['view_file'] = "create_vaccines_form"; $data['section'] = "Configuration"; $data['subtitle'] = "Add Vaccine"; $data['page_title'] = "Vaccines"; $data['user_object'] = $this->get_user_object(); $data['main_title'] = $this->get_title(); echo Modules::run('template/' . $this->redirect($this->session->userdata['logged_in']['user_group']), $data); }
public static function load() { global $Settings; if (is_array(self::$Modules) && count(self::$Modules)) { return; } // Load the various modules (search for the "tv" subdirectory in case it might // find some other "modules" directory, too. if (modules_path && modules_path != 'modules_path') { foreach (get_sorted_files(modules_path) as $module) { if (preg_match('/^_/', $module)) { continue; } if (!is_dir(modules_path . "/{$module}")) { continue; } if (!file_exists(modules_path . "/{$module}/init.php")) { continue; } require_once modules_path . "/{$module}/init.php"; } } if (empty($Modules)) { tailored_error('no_modules'); } // Sort the modules uasort($Modules, 'Modules::by_module_sort'); self::$Modules = $Modules; unset($Modules); }
function getkanalrubrik() { $id_kanal = $_POST['id_kanal']; $batas = $_POST['batas']; $dt = $this->m_kanal->hitung_kanalrubrik($id_kanal); if ($_POST['hal'] == "end") { $hal = ceil($dt['count'] / $batas); } else { $hal = $_POST['hal']; } $mulai = ($hal - 1) * $batas; $data['mulai'] = $mulai + 1; if ($dt['count'] != 0) { $data['hslquery'] = $this->m_kanal->getkanalrubrik($mulai, $batas, $id_kanal); foreach ($data['hslquery'] as $it => $val) { $iniKat = $this->m_kanal->inikanalrubrik($data['hslquery'][$it]->id_kategori); @($data['hslquery'][$it]->nama_kategori = @$iniKat[0]->nama_kategori); if ($mulai + $it == 0) { $data['hslquery'][$it]->naik = "tidak"; } else { $data['hslquery'][$it]->naik = "ya"; } if ($mulai + $it + 1 == $dt['count']) { $data['hslquery'][$it]->turun = "tidak"; } else { $data['hslquery'][$it]->turun = "ya"; } } } $de = Modules::run("cmsuser/pagerB", $dt['count'], $batas, $hal); $data['pager'] = $de; echo json_encode($data); }
public function load($file = 'config', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = '') { if (in_array($file, $this->is_loaded, TRUE)) { return $this->item($file); } $_module or $_module = CI::$APP->router->fetch_module(); list($path, $file) = Modules::find($file, $_module, 'config/'); if ($path === FALSE) { parent::load($file, $use_sections, $fail_gracefully); return $this->item($file); } if ($config = Modules::load_file($file, $path, 'config')) { /* reference to the config array */ $current_config =& $this->config; if ($use_sections === TRUE) { if (isset($current_config[$file])) { $current_config[$file] = array_merge($current_config[$file], $config); } else { $current_config[$file] = $config; } } else { $current_config = array_merge($current_config, $config); } $this->is_loaded[] = $file; unset($config); return $this->item($file); } }
public function __construct() { parent::__construct(); Modules::run('login/is_logged_in'); $this->load->model('view'); $this->load->config('config'); }
public function load($langfile = array(), $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '') { if (is_array($langfile)) { foreach ($langfile as $_lang) { $this->load($_lang); } return $this->language; } $deft_lang = CI::$APP->config->item('language'); $idiom = $lang == '' ? $deft_lang : $lang; if (in_array($langfile . '_lang' . EXT, $this->is_loaded, TRUE)) { return $this->language; } $_module or $_module = CI::$APP->router->fetch_module(); list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/'); if ($path === FALSE) { if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) { return $lang; } } else { if ($lang = Modules::load_file($_langfile, $path, 'lang')) { if ($return) { return $lang; } $this->language = array_merge($this->language, $lang); $this->is_loaded[] = $langfile . '_lang' . EXT; unset($lang); } } return $this->language; }
public function __construct() { parent::__construct(); Modules::run('users/index'); $forgroups = array(); Modules::run('users/in_groups', $forgroups); }
function ditch($update_id) { Modules::run('site_security/check_is_admin'); $item_id = $this->uri->segment(4); $this->_delete($update_id); redirect('Store_item_colours/update/' . $item_id); }