// ------------------------------------------------------------------- // switch ($a) { case 'create_form': echo ' <div class="alert alert-info" role="alert"> ' . _('#core#_#23#') . ' </div> <p> <select name="job"> '; $pluginM = new pluginManager(); $jobM = new jobManager(); foreach ($init->pluginsIndex as $plugin) { foreach (scandir('plugins/' . $plugin) as $file) { if (!is_dir('plugins/' . $plugin . '/' . $file) && preg_match('#^task_.*_loader.php$#', $file) && $jobM->getId($pluginM->getId($plugin), substr($file, 5, strlen($file) - 16)) == 0) { echo '<option value="' . $pluginM->getId($plugin) . ';' . substr($file, 5, strlen($file) - 16) . '">' . $file . '</option>'; } } } echo ' </select> </p> <button type="button" class="btn btn-primary" onClick="popupFormSubmit(\'index.php?m=a&g=core&p=admin_jobs&a=create\',$(\'form#popupForm\').serialize());"> Ajouter </button> '; break; case 'create': if (!isset($_POST['job']) || $_POST['job'] == '') {
$groupM = new groupManager(); $pluginM = new pluginManager(); if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('admins')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) { $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('admins')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 100); } if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('members')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) { $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('members')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 20); } if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('guests')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) { $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('guests')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 10); } // Add default job echo ' - Fill jobs table<BR>'; $jobM = new jobManager(); $pluginM = new pluginManager(); if ($jobM->getId($pluginM->getId('core'), 'translate') == 0) { $jobM->create($pluginM->getId('core'), 'translate'); } if ($jobM->getId($pluginM->getId('core'), 'backup') == 0) { $jobM->create($pluginM->getId('core'), 'backup'); } if ($jobM->getId($pluginM->getId('core'), 'upkeep') == 0) { $jobM->create($pluginM->getId('core'), 'upkeep'); } // Add default parameter echo ' - Fill parameters table<BR>'; $parameterM = new parameterManager(); if ($parameterM->getId(getPluginId('core'), 'DEFAULT_GROUP') == 0) { $parameterM->create(getPluginId('core'), 'DEFAULT_GROUP', 'members', 'members'); } if ($parameterM->getId(getPluginId('core'), 'LOCAL_REGISTER') == 0) {
$q0 = get_link()->prepare("SELECT \n\t\t\t\t\t\t\t\t\tg.id AS ID,\n\t\t\t\t\t\t\t\t\tg.name AS NAME,\n\t\t\t\t\t\t\t\t\tg.version AS VERSION,\n\t\t\t\t\t\t\t\t\tg.activated AS ACTIVATED,\n\t\t\t\t\t\t\t\t\tg.created_date AS CREATED_DATE,\n\t\t\t\t\t\t\t\t\tg.created_id AS CREATED_ID,\n\t\t\t\t\t\t\t\t\tg.edited_date AS EDITED_DATE,\n\t\t\t\t\t\t\t\t\tg.edited_id AS EDITED_ID,\n\t\t\t\t\t\t\t\t\tg.deleted_date AS DELETED_DATE,\n\t\t\t\t\t\t\t\t\tg.deleted_id AS DELETED_ID\n\t\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\t" . get_ini('BDD_PREFIX') . "core_plugins g\n\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\tg.deleted_date=0\n\t\t\t\t\t\t\t\tORDER BY g.name ASC"); $q0->execute(); while ($r0 = $q0->fetch(PDO::FETCH_OBJ)) { array_push($dataArray['data'], array("ID" => $r0->ID, "NAME" => $r0->NAME, "VERSION" => $r0->VERSION, "ENABLE" => $r0->ACTIVATED, "ACTION" => '<a href="#" data-toggle="modal" data-target="#popup" onClick="insertLoader(\'#popupContent\');setPopupTitle(\'Modifier le plugin\');$(\'#popupContent\').load(\'index.php?m=a&g=core&p=admin_plugins&a=updateForm&id=' . $r0->ID . '\');"><span class="iconfa-edit-write"> Modifier</span></a>')); } $q0->closeCursor(); echo json_encode($dataArray); break; case 'availableJsonList': $dir = 'plugins'; $dataArray['data'] = array(); if (is_dir($dir) && ($handle = opendir($dir))) { $blacklist = array('.', '..'); $pluginM = new pluginManager(); while ($file = readdir($handle)) { if (!in_array($file, $blacklist) && $pluginM->getId($file) == 0 && !is_file($dir . '/' . $file) && $file != 'sample') { array_push($dataArray['data'], array("NAME" => $file, "ACTION" => '<a href="#" data-toggle="modal" data-target="#popup" onClick="insertLoader(\'#popupContent\');setPopupTitle(\'Ajouter le plugin\');$(\'#popupContent\').load(\'index.php?m=a&g=core&p=admin_plugins&a=setupForm&name=' . $file . '\');"><span class="iconfa-edit-write"> Setup</span></a>')); } } closedir($handle); } echo json_encode($dataArray); break; // Display Html table container // Display Html table container default: echo ' <div class="box"> <div class="box-header"> <h3 class="box-title">Liste des plugins installés</h3> </div>