コード例 #1
0
ファイル: cron.router.php プロジェクト: parkerj/eduTrac-SIS
/**
 * Saves cronjob handler activity to a log file.
 *
 * @since 6.0.00
 */
function saveLogs($text)
{
    $cronDir = cronDir() . 'cron/';
    if (!file_put_contents($cronDir . 'logs/cronjobs.log', date('Y-m-d H:i:s') . ' - ' . $text . PHP_EOL . _file_get_contents($cronDir . 'logs/cronjobs.log'))) {
        etsis_monolog('cron', _t('cannot write to cronjobs database file, please check file rights'), 'addError');
    }
}
コード例 #2
0
 /**
  * @desc   $max_times 过期时间,获取的时候需要设置.在系统负载压力过大的时候,仍然返回数据,默认保留10个小时
  * @author
  * @since  2013-07-14 15:55:31
  * @throws 注意:无DB异常处理
  */
 function get($key, $max_times = 36000)
 {
     $unserialize = NULL;
     $file = $this->_dir($key);
     if (_sys_overload()) {
         _status(1, VHOST . "(本机缓存)", "过载命中");
         $unserialize = unserialize(_file_get_contents($file));
     } elseif (filemtime($file) > time() - $max_times) {
         $unserialize = unserialize(_file_get_contents($file));
     }
     if ($unserialize) {
         _status(1, VHOST . "(本机缓存)", "命中");
     } else {
         _status(1, VHOST . "(本机缓存)", "未命中");
     }
     return $unserialize;
 }
コード例 #3
0
ファイル: index.php プロジェクト: parkerj/eduTrac-SIS
	<div class="modal fade" id="myModal">
		<div class="modal-dialog">
			<div class="modal-content">
				<!-- Modal heading -->
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h3 class="modal-title"><?php 
echo _t('Person Search');
?>
</h3>
				</div>
				<!-- // Modal heading END -->
				<!-- Modal body -->
				<div class="modal-body">
					<?php 
echo _file_get_contents(APP_PATH . 'Info/person-search.txt');
?>
				</div>
				<!-- // Modal body END -->
				<!-- Modal footer -->
				<div class="modal-footer">
					<a href="#" class="btn btn-default" data-dismiss="modal"><?php 
echo _t('Close');
?>
</a> 
				</div>
				<!-- // Modal footer END -->
			</div>
		</div>
	</div>
	<!-- // Modal END -->
コード例 #4
0
/**
 * Retrieves a list of available locales.
 * 
 * @since 6.1.09
 * @param string $active
 */
function etsis_dropdown_languages($active = '')
{
    if (function_exists('enable_url_ssl')) {
        $protocol = 'https://';
    } else {
        $protocol = 'http://';
    }
    $locales = _file_get_contents($protocol . 'etsis.s3.amazonaws.com/core/1.1/translations.json');
    $json = json_decode($locales, true);
    foreach ($json as $locale) {
        echo '<option value="' . $locale['language'] . '"' . selected($active, $locale['language'], false) . '>' . $locale['native_name'] . '</option>';
    }
}
コード例 #5
0
ファイル: log.php プロジェクト: parkerj/eduTrac-SIS
            </div>
            <!-- // Tabs Heading END -->
            
			<div class="widget-body">
			
				<!-- Row -->
				<div class="row">
					
					<!-- Column -->
					<div class="col-md-12">
						
						<!-- Group -->
						<div class="form-group">
							<div class="col-md-12">
								<textarea class="col-md-12 form-control" rows="10"><?php 
echo file_exists($cronlog) ? _file_get_contents($cronlog) : 'No log found';
?>
</textarea>
							</div>
						</div>
						<!-- // Group END -->
						
					</div>
					<!-- // Column END -->
					
				</div>
				<!-- // Row END -->
			
				<hr class="separator" />
				
				<!-- Form actions -->
コード例 #6
0
ファイル: api.router.php プロジェクト: parkerj/eduTrac-SIS
 $app->delete('/(\\w+)/(\\w+)/(\\d+)', function ($table, $field, $id) use($app) {
     $query = [sprintf('DELETE FROM %s WHERE %s = ?', $table, $field)];
     $query = sprintf('%s;', implode(' ', $query));
     $result = $app->db->query($query, [$id]);
     if ($result === false) {
         $app->res->_format('json', 404);
     } else {
         if (empty($result) === true) {
             $app->res->_format('json', 204);
         } else {
             $app->res->_format('json');
         }
     }
 });
 if (in_array($http = strtoupper($_SERVER['REQUEST_METHOD']), ['POST', 'PUT']) === true) {
     if (preg_match('~^\\x78[\\x01\\x5E\\x9C\\xDA]~', $data = _file_get_contents('php://input')) > 0) {
         $data = gzuncompress($data);
     }
     if (array_key_exists('CONTENT_TYPE', $_SERVER) === true && empty($data) !== true) {
         if (strncasecmp($_SERVER['CONTENT_TYPE'], 'application/json', 16) === 0) {
             $GLOBALS['_' . $http] = json_decode($data, true);
         } else {
             if (strncasecmp($_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded', 33) === 0 && strncasecmp($_SERVER['REQUEST_METHOD'], 'PUT', 3) === 0) {
                 parse_str($data, $GLOBALS['_' . $http]);
             }
         }
     }
     if (isset($GLOBALS['_' . $http]) !== true || is_array($GLOBALS['_' . $http]) !== true) {
         $GLOBALS['_' . $http] = [];
     }
     unset($data);
コード例 #7
0
ファイル: etsis_Updater.php プロジェクト: parkerj/eduTrac-SIS
 protected function getCurrentRelease()
 {
     $file = parse_ini_string(_file_get_contents($this->url . 'core/1.1/update-check/etsis.ini'), true);
     return $file;
 }
コード例 #8
0
ファイル: add.php プロジェクト: parkerj/eduTrac-SIS
                </div>
				<div class="modal fade" id="myModal">
					<div class="modal-dialog">
						<div class="modal-content">
							<!-- Modal heading -->
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								<h3 class="modal-title"><?php 
echo _t('Person Type');
?>
</h3>
							</div>
							<!-- // Modal heading END -->
		                    <div class="modal-body">
		                        <?php 
echo _file_get_contents(APP_PATH . 'Info/person-type.txt');
?>
		                    </div>
		                    <div class="modal-footer">
		                        <a href="#" data-dismiss="modal" class="btn btn-primary"><?php 
echo _t('Cancel');
?>
</a>
		                    </div>
	                   	</div>
                  	</div>
                </div>
				
				<!-- Form actions -->
				<div class="form-actions">
					<button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i><?php 
コード例 #9
0
ファイル: staff.router.php プロジェクト: parkerj/eduTrac-SIS
     } else {
         $app->view->display('staff/view', ['title' => get_name($staf->staffID), 'cssArray' => $css, 'jsArray' => $js, 'staff' => $staf, 'addr' => $q]);
     }
 });
 /**
  * Before route middleware check.
  */
 $app->before('GET|POST', '/add/(\\d+)/', function ($id) {
     if (!hasPermission('create_staff_record')) {
         redirect(get_base_url() . 'dashboard' . '/');
     }
 });
 $app->match('GET|POST', '/add/(\\d+)/', function ($id) use($app, $css, $js, $json_url, $flashNow) {
     $json_p = _file_get_contents($json_url . 'person/personID/' . $id . '/?key=' . get_option('api_key'));
     $p_decode = json_decode($json_p, true);
     $json_s = _file_get_contents($json_url . 'staff/staffID/' . $id . '/?key=' . get_option('api_key'));
     $s_decode = json_decode($json_s, true);
     if ($app->req->isPost()) {
         $staff = $app->db->staff();
         $staff->staffID = $id;
         $staff->schoolCode = $_POST['schoolCode'];
         $staff->buildingCode = $_POST['buildingCode'];
         $staff->officeCode = $_POST['officeCode'];
         $staff->office_phone = $_POST['office_phone'];
         $staff->deptCode = $_POST['deptCode'];
         $staff->status = $_POST['status'];
         $staff->addDate = $staff->NOW();
         $staff->approvedBy = get_persondata('personID');
         /**
          * Fires during the saving/creating of a staff record.
          *
コード例 #10
0
                    }
                }
            }
            $args[0] = $matches[2];
            //filename
            $args[1] = $matches[3];
            //type
            $args[2] = $tmp_name;
            //tmp_name
            $args[3] = 0;
            //error
            $args[4] = $size;
            //size
            $_FILES[$name] = $file;
        }
    }
}
function _file_get_contents()
{
    $dir_path = 'upload/';
    $img_path = $_FILES['files']['tmp_name'];
    $type = explode('/', $_FILES['files']['type'])[1];
    $content = file_get_contents($img_path);
    if ($content !== false) {
        $file_name = explode('.', end(explode('\\', $img_path)))[0];
        file_put_contents($dir_path . $file_name . '.' . $type, $content);
    }
}
_put_save_for_upload();
_file_get_contents();
コード例 #11
0
ファイル: index.php プロジェクト: dw4dev/Phalanger
function run_test($file, $www)
{
    // parse the test '$file'
    $section_text = parse_file($file);
    // setup environment
    if (EndsWith($www, '.php')) {
        $www = dirname($www);
    }
    if (!EndsWith($www, '/')) {
        $www .= '/';
    }
    $phpfile = replace_extension($file, 'php');
    $tested = trim($section_text['TEST']);
    $env = array('HTTP_CONTENT_ENCODING' => '');
    $opts = array('http' => array('method' => "GET", 'header' => ''));
    if (!empty($section_text['ENV'])) {
        foreach (explode("\n", trim($section_text['ENV'])) as $e) {
            $e = explode('=', trim($e), 2);
            if (!empty($e[0]) && isset($e[1])) {
                $env[$e[0]] = $e[1];
            }
        }
    }
    // Default ini settings
    $ini_settings = array();
    // put additional INI settings here
    // Any special ini settings, these may overwrite the test defaults...
    if (array_key_exists('INI', $section_text)) {
        if (strpos($section_text['INI'], '{PWD}') !== false) {
            $section_text['INI'] = str_replace('{PWD}', dirname(realpath($file)), $section_text['INI']);
        }
        settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
    }
    // prepend custom ini settings
    if (count($ini_settings) > 0) {
        $section_text['FILE'] = get_ini_code($ini_settings) . $section_text['FILE'];
    }
    // skip this test ?
    try_skip($file, $www, $section_text);
    // redirect test ?
    try_redirect($file, $www, $section_text);
    // request .php script
    save_text($phpfile, $section_text['FILE']);
    if (array_key_exists('GET', $section_text)) {
        $query_string = trim($section_text['GET']);
    } else {
        $query_string = '';
    }
    $env['QUERY_STRING'] = $query_string;
    if (array_key_exists('COOKIE', $section_text)) {
        $env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
        $opts["http"]["header"] .= "Cookie: " . $env['HTTP_COOKIE'] . "\r\n";
    } else {
        $env['HTTP_COOKIE'] = '';
    }
    $args = isset($section_text['ARGS']) ? ' -- ' . $section_text['ARGS'] : '';
    if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) {
        $post = trim($section_text['POST_RAW']);
        $raw_lines = explode("\n", $post);
        $request = '';
        $started = false;
        foreach ($raw_lines as $line) {
            if (empty($env['CONTENT_TYPE']) && preg_match('/^Content-Type:(.*)/i', $line, $res)) {
                $env['CONTENT_TYPE'] = trim(str_replace("\r", '', $res[1]));
                continue;
            }
            if ($started) {
                $request .= "\n";
            }
            $started = true;
            $request .= $line;
        }
        $env['CONTENT_LENGTH'] = strlen($request);
        $env['REQUEST_METHOD'] = 'POST';
        $opts["http"]["method"] = "POST";
        $opts["http"]["header"] .= "Content-type: " . $env['CONTENT_TYPE'] . "\r\n";
        $opts["http"]["content"] = $request;
        if (empty($request)) {
            error("POST empty in '{$file}'");
        }
    } else {
        if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
            $post = trim($section_text['POST']);
            if (array_key_exists('GZIP_POST', $section_text) && function_exists('gzencode')) {
                $post = gzencode($post, 9, FORCE_GZIP);
                $env['HTTP_CONTENT_ENCODING'] = 'gzip';
            } else {
                if (array_key_exists('DEFLATE_POST', $section_text) && function_exists('gzcompress')) {
                    $post = gzcompress($post, 9);
                    $env['HTTP_CONTENT_ENCODING'] = 'deflate';
                }
            }
            //save_text($tmp_post, $post);
            $content_length = strlen($post);
            $env['REQUEST_METHOD'] = 'POST';
            $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
            $env['CONTENT_LENGTH'] = $content_length;
            $opts["http"]["method"] = "POST";
            $opts["http"]["header"] .= "Content-type: " . $env['CONTENT_TYPE'] . "\r\n";
            $opts["http"]["header"] .= "Content-encoding: " . $env['HTTP_CONTENT_ENCODING'] . "\r\n";
            $opts["http"]["header"] .= "Content-length: " . $content_length . "\r\n";
            $opts["http"]["content"] = $post;
        } else {
            $env['REQUEST_METHOD'] = 'GET';
            $env['CONTENT_TYPE'] = '';
            $env['CONTENT_LENGTH'] = '';
        }
    }
    $context = stream_context_create($opts);
    $out = _file_get_contents($www . $phpfile, false, $context, &$headers);
    if ($out === FALSE) {
        echo '<br/>';
        error("See <a target='_blank' href='{$phpfile}'>{$phpfile}</a>, exception ");
    }
    if (StartsWith($out, "\r\nCompileError") || StartsWith($out, "\r\nCompileWarning")) {
        show_result("<span class='skip'>SKIP</span>", $file, ", Script generates <b>CompileError</b> or <b>CompileWarning</b>, so it cannot be compared with PHP. <a href='{$phpfile}' target='_blank'>Try the script</a><pre>{$out}</pre>");
    }
    // perform clean
    try_clean($file, $www, $section_text);
    // compare .php response with expected output
    // Does the output match what is expected?
    $output = preg_replace("/\r\n/", "\n", trim($out));
    $output = str_replace("string[binary](", "string(", $output);
    $failed_headers = false;
    if (isset($section_text['EXPECTHEADERS'])) {
        $want = array();
        $wanted_headers = array();
        $lines = preg_split("/[\n\r]+/", (string) $section_text['EXPECTHEADERS']);
        foreach ($lines as $line) {
            if (strpos($line, ':') !== false) {
                $line = explode(':', $line, 2);
                $want[trim($line[0])] = trim($line[1]);
                $wanted_headers[] = trim($line[0]) . ': ' . trim($line[1]);
            }
        }
        $org_headers = $headers;
        $headers = array();
        $output_headers = array();
        foreach ($want as $k => $v) {
            if (isset($org_headers[$k])) {
                $headers = $org_headers[$k];
                $output_headers[] = $k . ': ' . $org_headers[$k];
            }
            if (!isset($org_headers[$k]) || $org_headers[$k] != $v) {
                $failed_headers = true;
            }
        }
        ksort($wanted_headers);
        $wanted_headers = join("\n", $wanted_headers);
        ksort($output_headers);
        $output_headers = join("\n", $output_headers);
    }
    if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) {
        if (isset($section_text['EXPECTF'])) {
            $wanted = trim($section_text['EXPECTF']);
        } else {
            $wanted = trim($section_text['EXPECTREGEX']);
        }
        $wanted_re = preg_replace('/\\r\\n/', "\n", $wanted);
        if (isset($section_text['EXPECTF'])) {
            // do preg_quote, but miss out any %r delimited sections
            $temp = "";
            $r = "%r";
            $startOffset = 0;
            $length = strlen($wanted_re);
            while ($startOffset < $length) {
                $start = strpos($wanted_re, $r, $startOffset);
                if ($start !== false) {
                    // we have found a start tag
                    $end = strpos($wanted_re, $r, $start + 2);
                    if ($end === false) {
                        // unbalanced tag, ignore it.
                        $end = $start = $length;
                    }
                } else {
                    // no more %r sections
                    $start = $end = $length;
                }
                // quote a non re portion of the string
                $temp = $temp . preg_quote(substr($wanted_re, $startOffset, $start - $startOffset), '/');
                // add the re unquoted.
                if ($end > $start) {
                    $temp = $temp . '(' . substr($wanted_re, $start + 2, $end - $start - 2) . ')';
                }
                $startOffset = $end + 2;
            }
            $wanted_re = $temp;
            $wanted_re = str_replace(array('%binary_string_optional%'), version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? 'string' : 'binary string', $wanted_re);
            $wanted_re = str_replace(array('%unicode_string_optional%'), version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? 'string' : 'Unicode string', $wanted_re);
            $wanted_re = str_replace(array('%unicode\\|string%', '%string\\|unicode%'), version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? 'string' : 'unicode', $wanted_re);
            $wanted_re = str_replace(array('%u\\|b%', '%b\\|u%'), version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? '' : 'u', $wanted_re);
            // Stick to basics
            $wanted_re = str_replace('%e', '\\' . '\\', $wanted_re);
            $wanted_re = str_replace('%s', '[^\\r\\n]+', $wanted_re);
            $wanted_re = str_replace('%S', '[^\\r\\n]*', $wanted_re);
            $wanted_re = str_replace('%a', '.+', $wanted_re);
            $wanted_re = str_replace('%A', '.*', $wanted_re);
            $wanted_re = str_replace('%w', '\\s*', $wanted_re);
            $wanted_re = str_replace('%i', '[+-]?\\d+', $wanted_re);
            $wanted_re = str_replace('%d', '\\d+', $wanted_re);
            $wanted_re = str_replace('%x', '[0-9a-fA-F]+', $wanted_re);
            $wanted_re = str_replace('%f', '[+-]?\\.?\\d+\\.?\\d*(?:[Ee][+-]?\\d+)?', $wanted_re);
            $wanted_re = str_replace('%c', '.', $wanted_re);
            // %f allows two points "-.0.0" but that is the best *simple* expression
        }
        /* DEBUG YOUR REGEX HERE
        		var_dump($wanted_re);
        		print(str_repeat('=', 80) . "\n");
        		var_dump($output);
        */
        if (preg_match("/^{$wanted_re}\$/s", $output)) {
            @unlink($phpfile);
            show_result("<span class='pass'>PASS</span>", "{$file}", '');
        }
    } else {
        $wanted = (string) trim($section_text['EXPECT']);
        $wanted = preg_replace('/\\r\\n/', "\n", $wanted);
        // compare and leave on success
        if (!strcmp($output, $wanted)) {
            @unlink($phpfile);
            show_result("<span class='pass'>PASS</span>", $file, '');
        }
        $wanted_re = null;
    }
    // Test failed so we need to report details.
    if ($failed_headers) {
        $passed = false;
        $wanted = (string) $wanted_headers . "\n--HEADERS--\n" . (string) $wanted;
        $output = (string) $output_headers . "\n--HEADERS--\n" . (string) $output;
        if (isset($wanted_re)) {
            $wanted_re = preg_quote($wanted_headers . "\n--HEADERS--\n", '/') . $wanted_re;
        }
    }
    // write .exp
    if (file_put_contents($file . '.exp', (string) $wanted, FILE_BINARY) === false) {
        error("Cannot create expected test output '{$file}.exp'");
    }
    // write .out
    if (file_put_contents($file . '.out', (string) $output, FILE_BINARY) === false) {
        error("Cannot create test output - '{$file}.out'");
    }
    // write .diff
    $diff = generate_diff($wanted, $wanted_re, $output);
    if (file_put_contents($file . '.diff', (string) $diff, FILE_BINARY) === false) {
        error("Cannot create test diff - '{$file}.diff'");
    }
    $resultid = "result_" . strlen($phpfile) . '_' . crc32($phpfile);
    $sourceid = "source_" . strlen($phpfile) . '_' . crc32($phpfile);
    show_result("<span class='fail'>FAIL</span>", $file, ", <a href='{$phpfile}' target='_blank'>Try the script</a>" . ", <a href='#' onclick='\$(\"#{$sourceid}\").slideToggle();return false;'>source</a>" . ", <a href='#' onclick='\$(\"#{$resultid}\").slideToggle();return false;'>details</a>" . "<div id='{$sourceid}' style='display:none;background:#eee;border:1px dashed #888;'><pre>" . htmlspecialchars(trim(_file_get_contents($file, false, null, &$dummyheaders))) . "</pre></div>" . "<div id='{$resultid}' style='display:none;'><table border='1'><tr><td><b>Output</b><br/><pre style='background:#fee;font-size:8px;'>" . htmlspecialchars($output) . "</pre></td><td><b>Expected</b><br/><pre  style='background:#efe;font-size:8px;'>" . htmlspecialchars($wanted) . "</pre></td></tr></table></div>");
    // write .sh
    //if (strpos($log_format, 'S') !== false && file_put_contents($sh_filename, b"#!/bin/sh{$cmd}", FILE_BINARY) === false) {
    //error("Cannot create test shell script - $sh_filename");
    //}
    //chmod($sh_filename, 0755);
    /*foreach ($restype as $type) {
    		$PHP_FAILED_TESTS[$type.'ED'][] = array (
    			'name'      => $file,
    			'test_name' => (is_array($IN_REDIRECT) ? $IN_REDIRECT['via'] : '') . $tested . " [$tested_file]",
    			'output'    => $output_filename,
    			'diff'      => $diff_filename,
    			'info'      => $info,
    		);
    	}*/
}
コード例 #12
0
 $app->before('GET|POST', '/add-prog/(\\d+)/', function () {
     if (!hasPermission('create_stu_record')) {
         redirect(get_base_url() . 'dashboard' . '/');
     }
     /**
      * If user is logged in and the lockscreen cookie is set, 
      * redirect user to the lock screen until he/she enters 
      * his/her password to gain access.
      */
     if (isset($_COOKIE['SCREENLOCK'])) {
         redirect(get_base_url() . 'lock' . '/');
     }
 });
 $app->match('GET|POST', '/add-prog/(\\d+)/', function ($id) use($app, $css, $js, $json_url, $flashNow) {
     if ($app->req->isPost()) {
         $json = _file_get_contents($json_url . 'acad_program/acadProgCode/' . $_POST['acadProgCode'] . '/?key=' . get_option('api_key'));
         $decode = json_decode($json, true);
         $level = $app->db->stu_acad_level()->where('stuID = ?', $id)->_and_()->where('acadProgCode = ?', $_POST['acadProgCode']);
         $sql = $level->find(function ($data) {
             $array = [];
             foreach ($data as $d) {
                 $array[] = $d;
             }
             return $array;
         });
         $sacp = $app->db->stu_program();
         $sacp->stuID = $id;
         $sacp->acadProgCode = _trim($_POST['acadProgCode']);
         $sacp->currStatus = $_POST['currStatus'];
         $sacp->statusDate = $app->db->NOW();
         $sacp->startDate = $_POST['startDate'];
コード例 #13
0
ファイル: File.php プロジェクト: WKnight02/BitterFox_III
 public function read()
 {
     return @_file_get_contents($this->_path);
 }
コード例 #14
0
ファイル: core-function.php プロジェクト: parkerj/eduTrac-SIS
/**
 * Performs a check within a php script and returns any other files
 * that might have been required or included.
 *
 * @since 6.2.0
 * @param string $file_name
 *            PHP script to check.
 */
function etsis_php_check_includes($file_name)
{
    if ('' == _trim($file_name)) {
        $message = _t('Invalid file name: empty file name given.');
        _incorrectly_called(__FUNCTION__, $message, '6.2.0');
        return;
    }
    // NOTE that any file coming into this function has already passed the syntax check, so
    // we can assume things like proper line terminations
    $includes = [];
    // Get the directory name of the file so we can prepend it to relative paths
    $dir = dirname($file_name);
    // Split the contents of $fileName about requires and includes
    // We need to slice off the first element since that is the text up to the first include/require
    $requireSplit = array_slice(preg_split('/require|include/i', _file_get_contents($file_name)), 1);
    // For each match
    foreach ($requireSplit as $string) {
        // Substring up to the end of the first line, i.e. the line that the require is on
        $string = substr($string, 0, strpos($string, ";"));
        // If the line contains a reference to a variable, then we cannot analyse it
        // so skip this iteration
        if (strpos($string, "\$") !== false) {
            continue;
        }
        // Split the string about single and double quotes
        $quoteSplit = preg_split('/[\'"]/', $string);
        // The value of the include is the second element of the array
        // Putting this in an if statement enforces the presence of '' or "" somewhere in the include
        // includes with any kind of run-time variable in have been excluded earlier
        // this just leaves includes with constants in, which we can't do much about
        if ($include = $quoteSplit[1]) {
            // If the path is not absolute, add the dir and separator
            // Then call realpath to chop out extra separators
            if (strpos($include, ':') === FALSE) {
                $include = realpath($dir . DS . $include);
            }
            array_push($includes, $include);
        }
    }
    return $includes;
}
コード例 #15
0
 /**
  * Echoes the stats of the cache.
  *
  * Gives the cache hits, cache misses and cache uptime.
  *
  * @since 6.2.0
  */
 public function getStats()
 {
     if (!$this->enable) {
         return false;
     }
     echo "<p>";
     echo "<strong>" . _t('Cache Hits:') . "</strong> " . _file_get_contents($this->_dir . 'cache_hits.txt') . "<br />";
     echo "<strong>" . _t('Cache Misses:') . "</strong> " . _file_get_contents($this->_dir . 'cache_misses.txt') . "<br />";
     echo "<strong>" . _t('Uptime:') . "</strong> " . timeAgo(file_mod_time($this->_dir)) . "<br />";
     echo "</p>";
 }
コード例 #16
0
 function TransformSchema($schema, $xsl, $schematype = 'string')
 {
     // Fail if XSLT extension is not available
     if (!function_exists('xslt_create')) {
         return FALSE;
     }
     $xsl_file = dirname(__FILE__) . '/xsl/' . $xsl . '.xsl';
     // look for xsl
     if (!is_readable($xsl_file)) {
         return FALSE;
     }
     switch ($schematype) {
         case 'file':
             if (!is_readable($schema)) {
                 return FALSE;
             }
             $schema = _file_get_contents($schema);
             break;
         case 'string':
         default:
             if (!is_string($schema)) {
                 return FALSE;
             }
     }
     $arguments = array('/_xml' => $schema, '/_xsl' => _file_get_contents($xsl_file));
     // create an XSLT processor
     $xh = xslt_create();
     // set error handler
     xslt_set_error_handler($xh, array(&$this, 'xslt_error_handler'));
     // process the schema
     $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
     xslt_free($xh);
     return $result;
 }
コード例 #17
0
ファイル: person.router.php プロジェクト: parkerj/eduTrac-SIS
     } elseif (count($decode[0]['personID']) <= 0) {
         $app->view->display('error/404', ['title' => '404 Error']);
     } else {
         $app->view->display('person/role', ['title' => get_name($id), 'cssArray' => $css, 'jsArray' => $js, 'nae' => $decode, 'staff' => $staff]);
     }
 });
 /**
  * Before route check.
  */
 $app->before('GET|POST', '/perms/(\\d+)/', function () {
     if (!hasPermission('access_user_permission_screen')) {
         redirect(get_base_url() . 'dashboard' . '/');
     }
 });
 $app->match('GET|POST', '/perms/(\\d+)/', function ($id) use($app, $css, $js, $json_url, $flashNow) {
     $json = _file_get_contents($json_url . 'person/personID/' . $id . '/?key=' . _h(get_option('api_key')));
     $decode = json_decode($json, true);
     $staff = $app->db->staff()->where('staffID = ?', $id)->findOne();
     if ($app->req->isPost()) {
         if (count($_POST['permission']) > 0) {
             $q = $app->db->query(sprintf("REPLACE INTO person_perms SET personID = %u, permission = '%s'", $id, maybe_serialize($_POST['permission'])));
         } else {
             $q = $app->db->query(sprintf("DELETE FROM person_perms WHERE personID = %u", $id));
         }
         if ($q) {
             $app->flash('success_message', $flashNow->notice(200));
             redirect(get_base_url() . 'nae/perms' . '/' . $id . '/');
         } else {
             $app->flash('error_message', $flashNow->notice(409));
             redirect($app->req->server['HTTP_REFERER']);
         }