<?php require_once __DIR__ . '/lib/Classes/PHPExcel.php'; // UI $GLOBALS['navBar']['appMenu'][] = array('url' => 'extensions/ExcelImport/ui/views/MenuItem.html'); AngularApp::addCSS('extensions/ExcelImport/ui/css/style.css'); AngularApp::addJS('extensions/ExcelImport/ui/js/ExcelImport.js'); // Config Config::set('allowedMimeTypes', 'excelImport', array('application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/excel')); class ImportExcel { public $file; private $db; function __construct($filename) { $this->file = $filename; $this->db = Database::singleton(); } public function ParseFile() { Notifications::addLog('------------------------- EXCEL IMPORT STARTED -------------------------', 'ExcelImport'); $this->ProcessFileContent(); Notifications::addLog('------------------------- END OF EXCEL IMPORT -------------------------', 'ExcelImport'); // Close transaction => ROLLBACK or COMMIT. $this->db->closeTransaction('File uploaded', false, true, false); return Notifications::getAll(); } public function ProcessFileContent() { $objPHPExcel = PHPExcel_IOFactory::load($this->file); // Format is as follows:
<?php // UI AngularApp::addJS('extensions/OAuthLogin/ui/js/LoginModule.js'); $GLOBALS['navBar']['roleMenu'][] = array('url' => 'extensions/OAuthLogin/ui/views/MenuItem.html'); class OAuthLoginController { private $token_url; private $client_id; private $client_secret; private $redirect_uri; private $tokenObj; private $dataObj; function __construct($client_id, $client_secret, $redirect_uri, $token_url) { $this->client_id = $client_id; $this->client_secret = $client_secret; $this->redirect_uri = $redirect_uri; $this->token_url = $token_url; } public function requestToken($code) { // Setup token request $token_request = array('token_url' => $this->token_url, 'arguments' => array('client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'grant_type' => 'authorization_code', 'code' => $code, 'redirect_uri' => $this->redirect_uri)); // Make HTTP POST request to OAUTH host to get token $curl = curl_init(); curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $token_request['token_url'], CURLOPT_USERAGENT => Config::get('contextName'), CURLOPT_POST => 1, CURLOPT_POSTFIELDS => http_build_query($token_request['arguments']), CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'))); // Send the request & save response to $resp $token_resp = curl_exec($curl); // Check if response is received: if (!$token_resp) {
<?php // Define hooks $hook1 = array('class' => 'ExecEngine', 'function' => 'run', 'filename' => 'ExecEngine.php', 'filepath' => 'extensions/ExecEngine', 'params' => array()); Hooks::addHook('preDatabaseCloseTransaction', $hook1); $hook2 = array('class' => 'ExecEngine', 'function' => 'run', 'filename' => 'ExecEngine.php', 'filepath' => 'extensions/ExecEngine', 'params' => array(true)); Hooks::addHook('postDatabaseReinstallDB', $hook2); // UI $GLOBALS['navBar']['refreshMenu'][] = array('url' => 'extensions/ExecEngine/ui/views/MenuItem.html'); AngularApp::addJS('extensions/ExecEngine/ui/js/ExecEngine.js'); // Config (can be overwritten in localSettings.php) Config::set('execEngineRoleName', 'execEngine', 'ExecEngine'); Config::set('autoRerun', 'execEngine', true); Config::set('maxRunCount', 'execEngine', 10); class ExecEngine { private static $roleName; public static $doRun = true; public static $autoRerun; public static $runCount; public static function run($allRules = false) { $database = Database::singleton(); Notifications::addLog('------------------------- EXEC ENGINE STARTED -------------------------', 'ExecEngine'); // Load the execEngine functions (security hazard :P) $files = getDirectoryList(__DIR__ . '/functions'); foreach ($files as $file) { if (substr($file, -3) !== 'php') { continue; } require_once __DIR__ . '/functions/' . $file;