public function cron_job($type) { sh_cache::disable(); $start = time(); if ($type == sh_cron::JOB_HOUR) { $this->backupSite(); } }
public function startPage() { sh_cache::disable(); $this->linker->html->setTitle($this->getI18n('startPage_title')); $values = array('login' => $this->getParam('models>0>login')); $values['links']['try'] = $this->getParam('models>0>link'); $values['links']['createAccount'] = $this->linker->path->getLink('user/createAccount/'); $this->render('startPage', $values); return true; }
public function getForSending() { sh_cache::disable(); $mailer = $_GET['mailer']; $id = $_GET['id']; $extMailer = $this->getParam('mailers>external>name', ''); $intMailer = $this->getParam('mailers>internal>name', ''); if ($mailer == $extMailer || $mailer == SH_CUSTOM_PREFIX . $extMailer) { $usedMailer = $this->get(true); } elseif ($mailer == $intMailer || $mailer == SH_CUSTOM_PREFIX . $intMailer) { $usedMailer = $this->get(false); } else { $this->linker->path->error(404); } // We decode in order to use iso-8859-1 charset echo $usedMailer->nl_getContent($id, false); return true; }
public function callPage() { $this->debug(__FUNCTION__, 3, __LINE__); sh_cache::disable(); $id = $this->linker->path->page['id']; if ($this->getParam('callPage>' . $id, false)) { $session = $this->getParam('callPage>' . $id); $bank = $this->get($session['bank']); $method = $session['method']; if ($this->linker->method_exists($bank, $method)) { return $bank->{$method}($session['id'], $id); } } return false; }
public function cron_job($type) { sh_cache::disable(); $start = time(); if ($type == sh_cron::JOB_QUARTERHOUR) { echo 'Shop : Sending the bills... '; // We check if there are any bill to send made $bills = $this->getParam('bills_to_create', array()); if (!empty($bills)) { foreach ($bills as $billId => $bill) { if ($time + 60 * 12 > time()) { // We won't take the risk to have 2 cron jobs in the same time trying to do the same thing... // so we stop after 12 minutes echo 'Time is out, so we will continue on next cron job<br />'; echo 'Started at ' . $time . ', and time is now ' . ($time + 60 * 12) . '<br />'; break; } if ($bill != 'done') { $this->sendBill($bill); $this->setParam('bills_to_create>' . $billId, 'done'); $this->writeParams(); echo 'One bill has been sent...<br />'; flush(); } } } else { echo 'There is no bill to create and send'; } } elseif ($type == sh_cron::JOB_HALFDAY) { echo 'Shop : Deleting old pending files... '; // Cleaning old pending command files (older than 4 hours) $timestamp = floatval(date('YmdHi', mktime(date('H') - 4, 0, 0, date('m'), date('d'), date('Y')))); $pendingFiles = scandir($this->commandsFolder . 'pending'); foreach ($pendingFiles as $file) { if (substr($file, 0, 1) != '.') { $fileTimestamp = floatval(substr($file, 0, 12)); if ($fileTimestamp < $timestamp) { echo 'Removing old pending file ' . $file . '<br />'; unlink($this->commandsFolder . 'pending/' . $file); $pendingFilesDeleted = true; } } } if (!$pendingFilesDeleted) { echo 'There was no old pending files to delete<br />'; } } elseif ($type == sh_cron::JOB_DAY) { // We should update the prices, in case there are discounts that have //just started/ended echo 'Shop : Caching the prices... '; $this->cachePrices(); echo 'Done!<br />'; } return true; }
/** * public function get * */ public function job() { sh_cache::disable(); $log = ''; $allowed = false; list($part1, $part2, $part3, $part4) = explode('.', $_SERVER['REMOTE_ADDR']); foreach ($this->getParam('launchers', array()) as $launcher) { list($launcherPart1, $launcherPart2, $launcherPart3, $launcherPart4) = explode('.', $_SERVER['REMOTE_ADDR']); if ($launcherPart1 == '*') { $allowed = true; break; } elseif ($launcherPart1 == $part1) { if ($launcherPart2 == '*') { $allowed = true; break; } elseif ($launcherPart2 == $part2) { if ($launcherPart3 == '*') { $allowed = true; break; } elseif ($launcherPart3 == $part3) { if ($launcherPart4 == '*' || $launcherPart2 == $part2) { $allowed = true; break; } } } } } if ($allowed) { $id = (int) $this->linker->path->page['id']; if ($id == 0) { // We ask not to launch new actions after 4 minutes, in order // not to have 2 jobs running at the same time $stopAt = microtime(true) + 4 * 60; $ret = true; $classes = $this->get_shared_methods(); $lastLaunchedJobs = $this->getParam('lastLaunchedJobs', array()); list($now, $y, $m, $d, $h, $i, $s) = explode('-', date('U-Y-m-d-H-i-s')); $datesFor = array(self::JOB_YEAR => date('U', mktime($h, $i, $s, $m, $d, $y - 1)), self::JOB_HALFYEAR => date('U', mktime($h, $i, $s, $m - 6, $d, $y)), self::JOB_QUARTERYEAR => date('U', mktime($h, $i, $s, $m - 3, $d, $y)), self::JOB_MONTH => date('U', mktime($h, $i, $s, $m - 1, $d, $y)), self::JOB_WEEK => date('U', mktime($h, $i, $s, $m, $d - 7, $y)), self::JOB_DAY => date('U', mktime($h, $i, $s, $m, $d - 1, $y)), self::JOB_HALFDAY => date('U', mktime($h - 12, $i, $s, $m, $d, $y)), self::JOB_HOUR => date('U', mktime($h - 1, $i, $s, $m, $d, $y)), self::JOB_HALFHOUR => date('U', mktime($h, $i - 30, $s, $m, $d, $y)), self::JOB_QUARTERHOUR => date('U', mktime($h, $i - 15, $s, $m, $d, $y))); $method = 'cron_job'; for ($job = self::JOB_FROM; $job <= self::JOB_TO; $job++) { $lastDate = $lastLaunchedJobs[$job]; if (empty($lastDate) || $datesFor[$job] > $lastDate) { $log .= 'Launching a job #' . $job . ' (last : ' . $lastDate . ')' . "\n"; foreach ($classes as $class) { if (microtime(true) > $stopAt) { $log .= 'Cron stopped because of its durations. Will be started again later' . "\n"; $ret = false; break; } $log .= 'Cron (' . $job . ') on ' . $class . "\n"; $tempRet = $this->linker->{$class}->{$method}($job, $stopAt) && $ret !== false; if (!empty($tempRet)) { $ret = $ret && $tempRet; } } if ($ret !== false) { $this->setParam('lastLaunchedJobs>' . $job, date('U')); $this->writeParams(); } } else { $log .= 'No need for a cron job #' . $job . '. Last one was on ' . date('Y-m-d \\a\\t H:i:s', $lastDate) . "\n"; } } } else { $ret = true; $classes = $this->get_shared_methods(); foreach ($classes as $class) { $method = 'cron_job'; $log .= 'Cron (' . $id . ') on ' . $class . "\n"; $ret = $this->linker->{$class}->{$method}($id) && $ret; } } $this->helper->writeInFile(SH_TEMP_FOLDER . __CLASS__ . '/' . SH_SITENAME . '_last.log', 'Called cron job is ' . $id . ' - ' . date('H:i:s') . "\n" . $log); echo 'OK'; return $ret; } echo 'YOU ARE NOT ALLOWED TO LAUNCH CRON JOBS FROM YOUR IP (' . $_SERVER['REMOTE_ADDR'] . ')!' . "\n"; return false; }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { $index = array('/', '/index.php', '/index.php3', '/index.htm', '/index.html'); if (in_array($uri, $index)) { // We check if there is an history if (!isset($_SESSION[__CLASS__]['introPageShown'])) { // We check if there is an intro page if ($this->getParam('intro>activated', false)) { sh_cache::disable(); $page = $this->getParam('intro>class') . '/' . $this->getParam('intro>method') . '/'; $page .= $this->getParam('intro>id', ''); $_SESSION[__CLASS__]['introPageShown'] = true; return $page; } $_SESSION[__CLASS__]['introPageShown'] = true; } $page = $this->getParam('class') . '/' . $this->getParam('action') . '/'; $page .= $this->getParam('id', ''); return $page; } if ($uri == '/' . $this->shortClassName . '/' . $this->getI18n('choose_uri') . '.php') { $page = $this->shortClassName . '/choose/'; return $page; } return parent::translatePageToUri($page); }
public function editImage() { $this->debug(__METHOD__, 2, __LINE__); sh_cache::disable(); $id = (int) $this->linker->path->page['id']; $name = $_SESSION[__CLASS__]['uploaded_images'][$id]['name']; $srcFolder = $_SESSION[__CLASS__]['uploaded_images'][$id]['src']; $destFolder = $_SESSION[__CLASS__]['uploaded_images'][$id]['destination']; $filePath = $srcFolder . $name; $values['img']['src'] = $this->linker->path->changeToShortFolder($filePath); if (file_exists($destFolder . self::DIMENSIONFILE)) { // The file has to be resized $dims = file_get_contents($destFolder . self::DIMENSIONFILE); $margins = !file_exists($destFolder . self::NOMARGINS); list($width, $height) = explode('x', $dims); $haxFixedDimensions = true; } elseif (file_exists($destFolder . self::MAXDIMENSIONFILE)) { // The file has to be resized $dims = file_get_contents($destFolder . self::MAXDIMENSIONFILE); list($width, $height) = explode('x', $dims); $haxMaxDimensions = true; } if (isset($_GET['cancel'])) { $this->linker->path->redirect(__CLASS__, __FUNCTION__, $id); } if (isset($_GET['crop'])) { $filePath = $this->crop_image($filePath, $_GET['startX'], $_GET['startY'], $_GET['stopX'], $_GET['stopY']); $name = baseName($filePath); $_SESSION[__CLASS__]['uploaded_images'][$id]['name'] = $name; $this->linker->path->redirect(__CLASS__, __FUNCTION__, $id); } elseif (isset($_GET['rotation'])) { $rotation = $_GET['rotation']; $filePath = $this->rotateImage($filePath, $rotation); $_SESSION[__CLASS__]['uploaded_images'][$id]['name'] = basename($filePath); $this->linker->path->redirect(__CLASS__, __FUNCTION__, $id); } if (isset($_GET['action'])) { $action = $_GET['action']; if ($action == 'crop') { if ($margins) { $values['dimensions']['forced'] = true; $values['dimensions']['forcedX'] = $width; $values['dimensions']['forcedY'] = $height; } elseif ($haxFixedDimensions) { $values['dimensions']['max'] = true; $values['dimensions']['maxX'] = $width; $values['dimensions']['maxY'] = $height; } echo $this->render('editor/crop', $values, false, false); } elseif ($action == 'rotate') { $ext = '.' . array_pop(explode('.', $name)); $miniPath = $filePath . '.mini'; copy($filePath, $miniPath . $ext); $newFile = $this->resize_image($miniPath . $ext, 100, 100, true); $ext = '.png'; copy($newFile, $miniPath . '.90' . $ext); $this->rotateImage($miniPath . '.90' . $ext, 90); copy($newFile, $miniPath . '.180' . $ext); $this->rotateImage($miniPath . '.180' . $ext, 180); copy($newFile, $miniPath . '.270' . $ext); $this->rotateImage($miniPath . '.270' . $ext, 270); $values['images']['path'] = $this->linker->path->changeToShortFolder($miniPath); echo $this->render('editor/rotate', $values, false, false); } elseif ($action == 'validate') { list($oWidth, $oHeight) = getImageSize($filePath); if ($haxFixedDimensions) { $filePath = $this->resize_image($filePath, $width, $height, $margins); } elseif ($haxMaxDimensions && ($oWidth > $width || $oHeight > $height)) { $filePath = $this->resize_image($filePath, $width, $height, false); } elseif (($oWidth > 900 || $oHeight > 900) && !file_exists($destFolder . self::NOMAXSIZEFILE)) { $filePath = $this->resize_image($filePath, 900, 900, false); } $name = basename($filePath); rename($filePath, $destFolder . $name); $this->raiseEvent(self::ONADD, $destFolder); $session = $_SESSION[__CLASS__]['uploaded_images'][$id]['browserSession']; unset($_SESSION[__CLASS__]['uploaded_images'][$id]); header('location: /browser/show.php?type=session&session=' . $session); return true; } } else { list($oWidth, $oHeight) = getImageSize($filePath); if ($oWidth > $oHeight) { $values['img']['direction'] = 'hImage'; } else { $values['img']['direction'] = 'vImage'; } $actions = scandir(SH_CLASS_FOLDER . $this->__tostring() . '/renderFiles/editor/'); foreach ($actions as $action) { if (substr($action, 0, 1) != '.') { $name = substr($action, 0, -7); $values['actions'][] = array('name' => $name, 'description' => $this->getI18n('editor_' . $name)); } } echo $this->render('editImage', $values, false, false); } return true; }
/** * public function search */ public function search() { $this->debug(__FUNCTION__, 3, __LINE__); if ($this->getParam('activated', true) === false) { $this->linker->path->error(404); } sh_cache::disable(); $search = stripslashes(urldecode($_GET['value'])); $this->linker->html->setTitle($this->getI18n('theQueryWas') . ' [' . str_replace(array('&', '<', '>'), array('&', '<', '>'), $search) . ']'); $this->activeSearch = $search; $search = trim($this->cleanSearchText($search)); $rfNoResults = 'show_noResults'; if (strlen(trim($search)) < 3) { $values['error']['tooShort'] = true; $this->render($rfNoResults, $values); return true; } // Global search $allKeyWordsResults = $this->db_execute('searchAllWords', array('search' => $search, 'lang' => $this->linker->i18n->getLang())); if (!is_array($allKeyWordsResults)) { $this->render($rfNoResults); return true; } // Giving points for the amount of found words in all rows $sorted = array(); foreach ($allKeyWordsResults as $res) { $name =& $sorted[$res['class']][$res['method']][$res['id']]; $name = 1000 - 100 * $res['keywords']; } // Search in each rows $results[0] = $this->db_execute('search', array('search' => $search, 'lang' => $this->linker->i18n->getLang(), 'level' => 1, 'weight' => 8)); $results[1] = $this->db_execute('search', array('search' => $search, 'lang' => $this->linker->i18n->getLang(), 'level' => 2, 'weight' => 3)); $results[2] = $this->db_execute('search', array('search' => $search, 'lang' => $this->linker->i18n->getLang(), 'level' => 3, 'weight' => 1)); // Giving points using Mysql's match return foreach ($results as $level => $oneLevelResults) { if (!is_null($oneLevelResults)) { foreach ($oneLevelResults as $res) { $name =& $sorted[$res['class']][$res['method']][$res['id']]; $name -= $res['match'] * $res['weight']; } } } // Sorting the results foreach ($sorted as $class => &$methods) { foreach ($methods as $method => &$elements) { asort($elements); $counts[$class][$method] = count($elements); $elements = array_chunk($elements, 8, true); if (count($elements[0]) > 5) { $cpt = 0; foreach ($elements[0] as $id => $content) { $smallResultsList[$id] = $content; if (++$cpt >= 5) { break; } } array_unshift($elements, $smallResultsList); } else { array_unshift($elements, $elements[0]); } } } // We save the results in the session in order to show some other results $searchId = substr(md5($search), 0, 6); $_SESSION[__CLASS__]['results'][$searchId] = $sorted; $_SESSION[__CLASS__]['results'][$searchId]['search'] = $search; // Rendering $showingOrder = $this->getParam('showingOrder'); $resultsLink = $this->translatePageToUri($this->shortClassName . '/showResults/'); $cpt = 0; if (is_array($showingOrder)) { foreach ($showingOrder as $type) { if (is_array($sorted[$type])) { foreach ($sorted[$type] as $method => $element) { if ($this->linker->method_exists($type, 'searcher_showResults')) { $link = $resultsLink . '?searchId=' . $searchId; $link .= '&scope=' . $type . '&action=' . $method; $rendered = $this->linker->{$type}->searcher_showResults($method, array_keys($element[0])); if (!empty($rendered)) { $values['results'][$cpt] = $rendered; if (isset($element[2]) || count($element[1]) > count($element[0])) { $values['results'][$cpt]['listLink'] = $link; } if ($counts[$type][$method] > 1) { $values['results'][$cpt]['count'] = $counts[$type][$method]; } $cpt++; } } } } } } if (empty($values['results'])) { $this->render($rfNoResults); return true; } $this->render('show_results', $values); return true; }
public function useConnectionTicket_master() { $this->checkIntegrity(); sh_cache::disable(); $id = md5(__CLASS__ . $site . microtime()); $site = $this->getFromAnyServer('site'); $siteName = $this->getFromAnyServer('siteName'); $ticketId = $this->getFromAnyServer('ticket'); $ticketId = $this->linker->masterServer->uncrypt($ticketId, $site); // We look for the ticket $ticketsFile = SH_SITE_FOLDER . __CLASS__ . '/tickets/' . $siteName . '.params.php'; $this->linker->params->addElement($ticketsFile, true); $tickets = $this->linker->params->get($ticketsFile, '', null); $ticket = $this->linker->params->get($ticketsFile, $ticketId, null); if (is_null($ticket)) { echo 'Response' . "\n" . self::WRONG_DATA_TEXT . "\n"; echo sh_masterServer::LINE_SEPARATOR . "\n"; echo 'text' . "\nELEMENT NOT FOUND!!\n"; return false; } if ($ticket['eraseDate'] > date('U') && $ticket['maxUseTimes'] > 0) { echo 'response' . "\n" . self::OK . "\n"; echo sh_masterServer::LINE_SEPARATOR . "\n"; echo 'id' . "\n"; echo $ticket['id']; $ticket['maxUseTimes']--; if ($ticket['maxUseTimes'] == 0) { unlink($ticketsFile); } else { $this->linker->params->set($ticketsFile, $ticketId, $ticket); $this->linker->params->write($ticketsFile); } return true; } echo 'response' . "\n" . self::DELAY_ELAPSED; return false; }
public function setCryptingCode() { sh_cache::disable(); $site = urldecode(stripslashes($_POST['site'])); $crypting_key = urldecode(stripslashes($_POST['crypting_key'])); $site = $this->linker->crypter->uncrypt($site, md5(__CLASS__)); $crypting_key = $this->linker->crypter->uncrypt($crypting_key, md5(__CLASS__)); // We save those datas in the params file $this->setParam('sites>' . $site, $crypting_key); $this->writeParams(); $ok = $this->linker->crypter->crypt('OK', $crypting_key); echo $ok; exit; }
public function construct() { if (!isset($_SESSION)) { session_start(); } $installedVersion = $this->getClassInstalledVersion(); if ($installedVersion != self::CLASS_VERSION) { // The class datas are not in the same version as this file, or don't exist (installation) $this->setClassInstalledVersion(self::CLASS_VERSION); } // Sets the main variables $this->domain = $_SERVER['SERVER_NAME']; $this->pathinfo = pathInfo($_SERVER['REQUEST_URI']); if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { $this->protocol = 'https'; } else { $this->protocol = 'http'; } $request = $_SERVER['REQUEST_URI']; $uriParts = explode('?', $request); $this->uri = $uriParts[0]; $this->baseUri = $this->protocol . '://' . $this->domain; $this->url = $this->baseUri . $request; $this->thisLink = $request; $this->parsed_url = parse_url($this->url); parse_str($this->parsed_url['query'], $this->parsed_url['parsed_query']); // If we're not waiting for an html file : if (isset($_GET['path_type']) && $_GET['path_type'] == 'favicon') { // We are asking for the favicon image. $this->page = array('element' => 'favicon', 'action' => 'get'); } elseif (isset($_GET['path_type']) && $_GET['path_type'] == 'css') { // We are asking for a CSS file. $this->page = array('element' => 'css', 'action' => 'get'); sh_cache::content_is_css(); } elseif (isset($_GET['path_type']) && $_GET['path_type'] == 'image') { // We are asking for an image if (isset($_GET['width']) && isset($_GET['height'])) { $_GET['file'] .= '.resized.' . $_GET['width'] . '.' . $_GET['height'] . '.png'; } elseif (isset($_GET['width'])) { $_GET['file'] .= '.resizedX.' . $_GET['width'] . '.png'; } elseif ($_GET['file'] != 'createPreview' && isset($_GET['height'])) { //echo '<div><span class="bold">$_GET : </span>'.nl2br( htmlentities( print_r( $_GET, true ) ) ).'</div>';exit; $_GET['file'] .= '.resizedY.' . $_GET['height'] . '.png'; } $this->page = array('element' => 'images', 'action' => 'get'); } elseif (isset($_GET['path_type']) && $_GET['path_type'] == 'menuImage') { // We are asking for an image $this->page = array('element' => 'images', 'action' => 'get_menuImage'); } elseif (isset($_GET['path_type']) && $_GET['path_type'] == 'browser') { // We are asking for a browser $this->page = array('element' => 'browser', 'action' => 'show'); } elseif (isset($_GET['path_type']) && $_GET['path_type'] == 'mp3') { // We are loading a sound sh_cache::disable(); if (file_exists(SH_SITE_FOLDER . 'sh_mp3/' . $_GET['folder'] . $_GET['file'])) { header('Content-type: audio/mpeg'); readfile(SH_SITE_FOLDER . 'sh_mp3/' . $_GET['file']); exit; } $this->error(404); } else { // Updates the session's history variable, if needed if (!isset($_SESSION['history'])) { $_SESSION['history'] = array(); } if ($_SESSION['history'][0] != urldecode($request)) { array_unshift($_SESSION['history'], urldecode($request)); } if (count($_SESSION['history']) > 10) { array_pop($_SESSION['history']); } // If we don't find the url in the db, we send a 404 error $data = $this->getPage($this->uri); if (!$data) { $this->error(404); } $this->thisPage = $data; $parts = explode('/', $data); // Set the $page var with every usefull things $this->page = array('element' => $parts[0], 'action' => $parts[1], 'id' => $parts[2], 'page' => $data); $this->linker->html->addToBody('class', 'pages_' . $this->page['element']); $this->linker->html->addToBody('class', 'pages_' . $this->page['element'] . '_' . $this->page['action']); $this->linker->html->addToBody('class', 'pages_' . $this->page['element'] . '_' . $this->page['action'] . '_' . $this->page['id']); } if (SH_MASTERSERVER && !SH_MASTERISUSER) { // We check if the page that is called may be called on a master server if (!$this->linker->masterServer->isPathAllowed($this->linker->cleanObjectName($parts[0]), $parts[1])) { header('HTTP/1.1 403 Forbidden'); echo 'ERROR : 403'; exit; } } }
public function confirmSubscription() { sh_cache::disable(); $mail = $_GET['mail']; $verif = $_GET['verif']; $mailer = $this->linker->mailer->get(true); $list = $mailer->ml_getAll(); if (is_array($list)) { foreach ($list as $id => $newsletter) { $paramsFile = SH_SITEPARAMS_FOLDER . __CLASS__ . '_sub_' . $id; $this->linker->params->addElement($paramsFile, true); $preliminaryList = $this->linker->params->get($paramsFile, 'needConfirmation', array()); if (isset($preliminaryList[$mail])) { $date = $preliminaryList[$mail]['date']; if ($date > date('U')) { if ($verif == $preliminaryList[$mail]['verif']) { $this->linker->params->set($paramsFile, 'needConfirmation>' . $mail . '>verif', 'DONE'); $this->linker->params->write($paramsFile); $mailer = $this->linker->mailer->get(true); $mailer->ml_addAddress($newsletter['id'], $mail); $values['response']['ok'] = true; $values['response']['validated'] = true; } elseif ('DONE' == $preliminaryList[$mail]['verif']) { $values['response']['ok'] = true; $values['response']['alreadyValidated'] = true; } } else { $values['response']['dateOver'] = true; } } } } $values['links']['subscribe'] = $this->translatePageToUri('/subscribe/'); $values['site']['base'] = $this->linker->path->getBaseUri(); $this->render('subscription_confirmation', $values); return true; }
/** * Verifies if a master session is opened.<br /> * If so, disables the cache. * @static * @return boolean * True if a master session has been opened.<br /> * False if not. */ public static function staticIsMaster() { if ($_SESSION[__CLASS__]['master']) { sh_cache::disable(); return true; } return false; }
public function edit() { $this->debug(__FUNCTION__ . '();', 2, __LINE__); sh_cache::disable(); if (!$this->linker->user->isConnected()) { $this->linker->path->error(403); exit; } // There are 3 possibilities : // - the user is an admin/master // He can set rights on any documents // He can give rights_managements rights to others for the documents he can manage // - the user has rights_managements right // He can view his own rights on the documents he has access to // He can allow other users/groups to access the documents // - the user is a simple user // He can view his rights on the documents he has access to // We list all the rights this user has access to $user = $this->user; // We get the user's groups $groups_for_query = $this->getUserGroups($user); foreach ($groups_for_query as $group) { $groups[] = $group['group_id']; } if ($this->isAdmin()) { $pages = $this->db_execute('get_all_manager_pages', array()); $this->showManagerPages($pages); } elseif ($this->isManager($user)) { $pages = $this->db_execute('get_manager_pages', array('user_id' => $user)); $this->showManagerPages($pages); } else { echo 'The user has no management rights<br />'; } }
public function test() { $this->onlyMaster(); sh_cache::disable(); if (isset($_GET['rf'])) { $rf = $_GET['rf']; $values = array(); if (file_exists(dirname(__FILE__) . '/renderFiles/tests/' . $rf . '.values.php')) { include dirname(__FILE__) . '/renderFiles/tests/' . $rf . '.values.php'; } $this->render('tests/' . $rf, $values); return true; } $this->linker->html->insert('L\'url doit se finir par ?rf=nom_du_rf_sans_extension'); return false; }