function testTemplateClass() { $t = new Template('index.html'); $t->replace('FOOTER', '<b>This is the footer</b>'); $t->replace('LOGIN_FORM', joinPaths(CHRIS_VIEW_FOLDER, 'login_form.html')); return $t; }
function settingsInit() { $DUTINGS_DB_NAME = getenv("DUTINGS_DB_NAME"); $DUTINGS_DB_USERNAME = getenv("DUTINGS_DB_USERNAME"); $DUTINGS_DB_HOSTNAME = getenv("DUTINGS_DB_HOSTNAME"); $DUTINGS_DB_PASSWORD = getenv("DUTINGS_DB_PASSWORD"); $GOOGLE_CLIENT_ID = getenv("GOOGLE_CLIENT_ID"); $homeDirectory = getenv('HOME'); $settingsFilePath = "/" . joinPaths($homeDirectory, "settings/dutings.php"); if (file_exists($settingsFilePath)) { require $settingsFilePath; } if (!$DUTINGS_DB_NAME) { throw new SettingsException("Missing database name."); } if (!$DUTINGS_DB_HOSTNAME) { throw new SettingsException("Missing database hostname."); } if (!$DUTINGS_DB_USERNAME) { throw new SettingsException("Missing database username."); } if (!$DUTINGS_DB_PASSWORD) { throw new SettingsException("Missing database password."); } if (!$GOOGLE_CLIENT_ID) { throw new SettingsException("Missing google client id."); } return ["DUTINGS_DB_HOSTNAME" => $DUTINGS_DB_HOSTNAME, "DUTINGS_DB_NAME" => $DUTINGS_DB_NAME, "DUTINGS_DB_USERNAME" => $DUTINGS_DB_USERNAME, "DUTINGS_DB_PASSWORD" => $DUTINGS_DB_PASSWORD, "GOOGLE_CLIENT_ID" => $GOOGLE_CLIENT_ID]; }
require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'pacs.helper.php'); // include chris data models require_once joinPaths(CHRIS_MODEL_FOLDER, 'data.model.php'); // include chris study models require_once joinPaths(CHRIS_MODEL_FOLDER, 'study.model.php'); // include chris patient models require_once joinPaths(CHRIS_MODEL_FOLDER, 'patient.model.php'); // include chris data_patient models require_once joinPaths(CHRIS_MODEL_FOLDER, 'data_patient.model.php'); // include chris data_study models require_once joinPaths(CHRIS_MODEL_FOLDER, 'data_study.model.php'); // include chris feed_data models require_once joinPaths(CHRIS_MODEL_FOLDER, 'feed_data.model.php'); // include chris user_data models require_once joinPaths(CHRIS_MODEL_FOLDER, 'user_data.model.php'); require_once joinPaths(CHRIS_MODEL_FOLDER, 'feed.model.php'); // define the options $shortopts = "u:f:m:s:p:a:c:o:d:e:y:"; $options = getopt($shortopts); $user_id = $options['u']; $feed_chris_id = $options['f']; $details = ""; if (isset($options['m'])) { $details = $options['m']; } $server = $options['s']; $port = $options['p']; $aetitle = $options['a']; $aec = $options['c']; $output_dir = $options['o']; $study_uid = "";
// support for parameters without a flag $value['name'] = '--' . $value['name']; } $command .= ' ' . $value['name'] . ' ' . $value['value']; } } // the subfoldertail can be // if an input parameter is a dropzone // a) the parent directory of the first dropzone // b) information parsed from a 0.info file of the first dropzone // if there is no dropzone // c) the current timestamp $subfoldertail = ""; if ($parentFolder) { // check for a 0.info in the $parentFolder $info_file = joinPaths($parentFolder, '0.info'); if (is_file($info_file)) { // case b) $patientId = ""; $patientAge = ""; $patientSex = ""; // found one, let's parse it $file_handle = fopen($info_file, "r"); while (!feof($file_handle)) { $line = fgets($file_handle); // split the line at : $arr = explode(":", $line); if (trim($arr[0]) == "PatientID") { $patientId = trim($arr[1]); } else { if (trim($arr[0]) == "PatientAge") {
* S&S S&S S&S S&S~YSY%b S&S `S*S * S*b S*S S*S S*S `S%b S*S l*S * S*S. S*S S*S S*S S%S S*S .S*P * SSSbs S*S S*S S*S S&S S*S sSS*S * YSSP SSS S*S S*S SSS S*S YSS' * SP SP SP * Y Y Y * * R E L O A D E D * * (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center * Boston Children's Hospital * * http://childrenshospital.org/FNNDSC/ * dev@babyMRI.org * */ // we define a valid entry point if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } //define('CHRIS_CONFIG_DEBUG',true); // include the configuration require_once 'config.inc.php'; // include the simpletest chris framework require_once SIMPLETEST_CHRIS; SimpleTest_Chris::setPreference(); // include all the tests suites require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'testing/test.controller.php'); require_once joinPaths(CHRIS_MODEL_FOLDER, 'testing/test.model.php');
// return JSON encoded output die(json_encode($output)); } } } } } } } } } break; case "download": if ($what == 'file') { // here we don't create JSON but just pass thru the file content $name = joinPaths(CHRIS_USERS, $parameters); // if the file does not exist, just die if (!is_file($name)) { die; } $fp = fopen($name, 'rb'); header("Content-Length: " . filesize($name)); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"" . basename($name) . "\""); fpassthru($fp); die; } case "help": $result['result'] = 'Perform actions on ChRIS.. Examples: COUNT: ?action=count&what=feed --- GET: ?action=get&what=feed&id=3 --- All parameters can be GET or POST.'; break; case "maintenance":
/** * Get HTML representation of the given object. * @param Feed $object object to be converted to HMTL. * @return string HTML representation of the object */ public static function getHTML($object, $shine = '') { // Format username $username = FeedV::_getUsername($object->user_id); $username_displayed = ucwords($username); $feed_meta_simple = ''; // Format simple meta feed $feedMetaSimpleMapper = new Mapper('Feed'); $feedMetaSimpleMapper->ljoin('Meta', 'meta.target_id = feed.id')->filter('meta.target_type=(?)', 'feed')->filter('meta.name=(?)', 'sharer_id')->filter('meta.target_id=(?)', $object->id)->filter('meta.type=(?)', 'simple'); $feedMetaSimpleResults = $feedMetaSimpleMapper->get(); $shared_feed = false; if (count($feedMetaSimpleResults['Meta']) >= 1) { $username_displayed = 'Shared by ' . ucwords(FeedV::_getUsername($feedMetaSimpleResults['Meta'][0]->value)); $shared_feed = true; } // Format advanced meta feed $root_id = 0; $root_id = FeedV::findFirstRootID($object->id); $feed_meta_advanced = $feed_meta_simple; $feed_status = 'feed_success'; $feed_folder = joinPaths(CHRIS_USERS, $username, $object->plugin, $object->name . '-' . $object->id); if ($handle = opendir($feed_folder)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $match = glob($feed_folder . '/' . $entry . '/_chrisRun_/ERR*'); if (count($match)) { $feed_status = 'feed_failure'; break; } if ($feed_status == 'feed_failure') { break; } } } } // create the status text $status_text = '<span style="background-color: #009DE9;color: #fff;padding: 1px 2px;">Running<i class="icon-refresh rotating_class"></i></span>'; // ('.$object->status.'%) if ($feed_status == 'feed_failure') { $status_text = '<span style="background-color: #E90000;color: #fff;padding: 1px 2px;">Errors</span>'; $feed_status = 'feed_success'; } else { if ($object->status == 100) { $status_text = '<span style="background-color: #41E900;color: #fff;padding: 1px 2px;">Success</span>'; } else { if ($object->status == 101) { $status_text = '<span style="background-color: #E95D00;color: #fff;padding: 1px 2px;">Canceled</span>'; } } } $view_icon = 'icon-eye-open'; $share_icon = 'icon-share-alt'; $tag_icon = 'icon-tag'; $archive_icon = 'icon-remove'; $archive_text = 'Archive'; if ($object->archive == '1') { $archive_icon = 'icon-plus'; $archive_text = 'Restore'; } $favorite_icon = 'icon-star-empty'; $favorite_text = 'Favorite'; if ($object->favorite == '1') { $favorite_icon = 'icon-star'; $favorite_text = '<b>Favorited</b>'; } $edit_icon = ''; $cancel = ''; $view = "display:none"; if ($object->status >= 100 || $shared_feed) { $edit_icon = "<img class='feed_edit_icon show_me focus' src='view/gfx/jigsoar-icons/dark/16_edit_page2.png'>"; // if the job is not queued or running, don't display the cancel icon // also if the feed was shared $cancel = "display:none"; $view = ""; } $t = new Template('feed.html'); $t->replace('ID', $object->id); $t->replace('ROOT_ID', $root_id); $feed_gfx64 = 'plugins/' . $object->plugin . '/feed.png'; $feed_gfx64_checked = 'view/gfx/feed_checked.png'; if (!is_file(joinPaths(CHRIS_WWWROOT, $feed_gfx64))) { $feed_gfx64 = 'http://placehold.it/48x48'; } $t->replace('IMAGE_SRC', $feed_gfx64); $t->replace('IMAGE_CHECKED', $feed_gfx64_checked); $t->replace('USERNAME', $username_displayed); $t->replace('FEED_STATUS', $feed_status); $t->replace('FEED_NAME', $object->name); $t->replace('FEED_META_CONTENT', $feed_meta_advanced); $t->replace('TIME_FORMATED', $object->time); $t->replace('PLUGIN', ucwords(str_replace('_', ' ', $object->plugin))); $t->replace('STATUS', $object->status); $t->replace('STATUS_TEXT', $status_text); $t->replace('VIEW_ICON', $view_icon); $t->replace('SHARE_ICON', $share_icon); $t->replace('TAG_ICON', $tag_icon); $t->replace('ARCHIVE_ICON', $archive_icon); $t->replace('ARCHIVE_TEXT', $archive_text); $t->replace('FAVORITE_ICON', $favorite_icon); $t->replace('FAVORITE_TEXT', $favorite_text); $t->replace('VIEW', $view); $t->replace('CANCEL', $cancel); $t->replace('EDIT_ICON', $edit_icon); $t->replace('FEED_SHINE', $shine); // set data browser $d = new Template('feed_data_browser.html'); $feed_folder = joinPaths($username, $object->plugin, $object->name . '-' . $object->id); if (file_exists($feed_folder)) { $feed_subfolders = scandir(CHRIS_USERS . '/' . $feed_folder); natcasesort($feed_subfolders); // get rid of eventual notes.html or index.html files // find notes.html $notes = array_search('notes.html', $feed_subfolders); if ($notes) { // remove this entry - we don't want to touch it unset($feed_subfolders[$notes]); } // find index.html $index = array_search('index.html', $feed_subfolders); if ($index) { // remove this entry - we don't want to touch it unset($feed_subfolders[$index]); } } $d->replace('FOLDER', $feed_folder); $d->replace('PATIENT_ID', 'fake_patient_id'); $d->replace('DATA_ID', 'fake_data_id'); $t->replace('DATA_BROWSER', $d); // set tags $feedtagMapper = new Mapper('Feed_Tag'); $feedtagMapper->join('Tag', 'feed_tag.tag_id = tag.id')->filter('feed_tag.feed_id=(?)', $object->id); $feedtagResults = $feedtagMapper->get(); $feedtags = ''; if (count($feedtagResults['Feed_Tag']) >= 1) { foreach ($feedtagResults['Tag'] as $key => $value) { $n = new Template('feed_tag.html'); $n->replace('USER_ID', $object->user_id); $n->replace('TAG_ID', $value->id); $n->replace('TAG_NAME', $value->name); $n->replace('TAG_COLOR', $value->color); $n->replace('TEXT_COLOR', invertColor($value->color)); $n->replace('LOCATION', 'infeed'); $feedtags .= $n; } } $t->replace('TAGS', $feedtags); // notes $n = new Template('feed_notes.html'); $n->replace('PATH', joinPaths($username, $object->plugin, $object->name . '-' . $object->id, 'notes.html')); $t->replace('NOTES', $n); // set html viewer if "index.html" exists in username/plugin/feed-id/ if (is_file(joinPaths(CHRIS_USERS, $username, $object->plugin, $object->name . '-' . $object->id, 'index.html'))) { $t->replace('FEED_HTML', 'feed_html.html'); $t->replace('HTML_VIEWER', joinPaths('api.php?action=get&what=file¶meters=', $username, $object->plugin, $object->name . '-' . $object->id, 'index.html')); } else { $t->replace('FEED_HTML', ''); } return $t; }
* SP SP SP * Y Y Y * * R E L O A D E D * * (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center * Boston Children's Hospital * * http://childrenshospital.org/FNNDSC/ * dev@babyMRI.org * */ // we define a valid entry point if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } //define('CHRIS_CONFIG_DEBUG',true); // include the configuration if (!defined('CHRIS_CONFIG_PARSED')) { require_once dirname(dirname(dirname(__FILE__))) . '/config.inc.php'; } // include the simpletest chris framework require_once SIMPLETEST_CHRIS; SimpleTest_Chris::setPreference(); // include the test object class since we derive from that require_once 'test.object.model.php'; // include the data_patient class require_once joinPaths(CHRIS_MODEL_FOLDER, 'data_study.model.php'); class TestData_StudyModel extends TestObjectModel { }
/** * @return string */ public function getCollectionPath() { return joinPaths($this->getPath(), 'collection.anki2'); }
* FEED_ID is important to be able to kill a job. */ define('CLUSTER_RUN', 'nohup /bin/mosbatch -q -b -J{FEED_ID} -m{MEMORY} {COMMAND} < /dev/null & echo $!;'); /** * The cluster kill command. * We specify the command to terminate a job on the cluster. * {FEED_ID} will be replaced in the launcher with the plugin required id, in * the feed.controller.php */ define('CLUSTER_KILL', 'moskillall -9 -J{FEED_ID}'); // -------------------------------------------------------------------------- // // TESTING // // -------------------------------------------------------------------------- define('SIMPLETEST_CHRIS', joinPaths(CHRIS_WWWROOT, 'testing/simpletest_chris.php')); define('SIMPLETEST_HTML_CHRIS', joinPaths(CHRIS_WWWROOT, 'testing/html_chris.php')); define('SIMPLETEST_XML_CHRIS', joinPaths(CHRIS_WWWROOT, 'testing/xml_chris.php')); define('SIMPLETEST_SIMPLETEST', joinPaths(CHRIS_WWWROOT, 'lib/simpletest/simpletest.php')); define('SIMPLETEST_AUTORUN', joinPaths(CHRIS_WWWROOT, 'lib/simpletest/autorun.php')); // GOOGLE ANALYTICS define('ANALYTICS_ACCOUNT', 'UA-39303022-1'); // if CHRIS_DEBUG is defined, print all constants if (defined('CHRIS_CONFIG_DEBUG')) { $all_constants = get_defined_constants(true); print_r($all_constants['user']); } // setup phpseclib for SSH access set_include_path(get_include_path() . PATH_SEPARATOR . joinPaths(CHRIS_LIB_FOLDER, 'phpseclib', 'phpseclib')); // FLAG showing that the config was parsed define('CHRIS_CONFIG_PARSED', true);
* dev@babyMRI.org * */ // we define a valid entry point if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } // include the configuration if (!defined('CHRIS_CONFIG_PARSED')) { require_once dirname(dirname(dirname(__FILE__))) . '/config.inc.php'; } // include the simpletest chris framework require_once SIMPLETEST_CHRIS; SimpleTest_Chris::setPreference(); // include the controller classes require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'pacs.class.php'); class TestPACSClass extends UnitTestCase { /** * Test the ping method */ //! [testPing()] public function testPing() { // ping a valid host (CHB) $server_ip = '134.174.12.21'; $server_port = 104; $pacs_ping = new PACS($server_ip, $server_port); $result = $pacs_ping->ping(); // should return 1 on success $this->assertTrue($result == 1);
function fixRelativePaths($path, $basePath) { // absolute path $isColon = strrpos($path, ":") !== false; $isDoubleSlash = trim(startsWith($path, "//")); $isModxTag = startsWith(trim($path), "[[") && endsWith(trim($path), "]]"); // relative path if (!$isColon && !$isDoubleSlash && !$isModxTag) { return joinPaths($basePath, $path); } else { return $path; } }
# don't show any errors... error_reporting(E_ALL | E_STRICT); # ...but do log them session_start(); include 'config.php'; include 'utils.php'; $response_array = array(); if ($_SESSION["verify"] != "FileManager4TinyMCE") { $response_array['status'] = 'failure'; $response_array['reason'] = 'Forbidden'; returnJSON($response_array); } // Check to make sure we are not traversing the filesystem if (strpos($_POST['path'], '..') !== false) { $response_array['status'] = 'failure'; $response_array['reason'] = 'Forbidden Path'; returnJSON($response_array); } // Join the path to our root paths $path = joinPaths($root, $upload_dir, $_POST['path']); $path_thumbs = joinPaths($root, $thumbs_dir, $_POST['path']); // DELETE STUFF!!! if (!(deleteDir($path) && deleteDir($path_thumbs))) { $response_array['status'] = 'failure'; $response_array['reason'] = 'Error deleting ' . $_POST['path']; returnJSON($response_array); } else { $response_array['status'] = 'success'; $response_array['reason'] = 'Deleted ' . $_POST['path']; returnJSON($response_array); }
} echo "\r\n <div class='row-fluid'>\r\n <div class='span6'>\r\n <div class='control-group'>\r\n <label class='control-label' for='form_entry[machine_id]'>Machine</label>\r\n <div class='controls'>\r\n"; display_machine_dropdown($user, "form_entry[machine_id]", $id === false ? 0 : intval($formEntry->machine['id']), intval($form->machineType['id'])); echo " </div>\r\n </div>\r\n <div class='control-group'>\n"; if ($user->isAdmin()) { echo " <label class='control-label' for='form_entry[machine_id]'>Performed by</label>\r\n <div class='controls'>\n"; display_user_dropdown($user, "form_entry[user_id]", $id === false ? $user->id : intval($formEntry->user['id'])); echo " </div>\n"; } else { echo " <input type='hidden' name='form_entry[user_id]' value='" . ($id === false ? intval($user->id) : intval($formEntry->user['id'])) . "' />\n"; } echo " </div>\r\n </div>\r\n <div class='span6'>\r\n <div class='control-group'>\r\n <label class='control-label' for='form_entry[qa_month]'>QA Month</label>\r\n <div class='controls'>\r\n "; display_month_year_dropdown("form_entry[qa_month]", "form_entry", $id === false ? False : array(intval($formEntry->qaMonth), intval($formEntry->qaYear))); echo "\r\n </div>\r\n </div>\r\n <div class='control-group'>\r\n <label class='control-label' for='form_entry[created_at]'>Inspection Date</label>\r\n <div class='controls'>\r\n <input name='form_entry[created_at]' type='datetime-local' readonly='true' class='input-xlarge enabled' id='form_entry_created_at'" . ($id === false ? "" : " value='" . escape_output($formEntry->createdAt) . "'") . ">\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class='row-fluid'>\r\n <div class='span4'>\r\n <h3 class='center-horizontal'>Contrast Scale</h3>\r\n <h4 class='center-horizontal'>Slice 1-5 (-511 mm)</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n <tr>\r\n <th>Plug</th>\r\n <th>CT #</th>\r\n <th>Nom.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>1</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][contrast_scale_1_value]' class='form_entry_form_values_contrast_scale_1_value span5' id='form_entry_form_values_contrast_scale_1_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_1_value']->value) . "'") . "/> ± <input type='number' step='0.01' name='form_entry[form_values][contrast_scale_1_plusmin]' class='form_entry_form_values_contrast_scale_1_plusmin span5' id='form_entry_form_values_contrast_scale_1_plusmin' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_1_plusmin']->value) . "'") . "/></td>\r\n <td>-95±15</td>\r\n </tr>\r\n <tr>\r\n <td>2</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][contrast_scale_2_value]' class='form_entry_form_values_contrast_scale_2_value span5' id='form_entry_form_values_contrast_scale_2_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_2_value']->value) . "'") . "/> ± <input type='number' step='0.01' name='form_entry[form_values][contrast_scale_2_plusmin]' class='form_entry_form_values_contrast_scale_2_plusmin span5' id='form_entry_form_values_contrast_scale_2_plusmin' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_2_plusmin']->value) . "'") . "/></td>\r\n <td>913±50</td>\r\n </tr>\r\n <tr>\r\n <td>3</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][contrast_scale_3_value]' class='form_entry_form_values_contrast_scale_3_value span5' id='form_entry_form_values_contrast_scale_3_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_3_value']->value) . "'") . "/> ± <input type='number' step='0.01' name='form_entry[form_values][contrast_scale_3_plusmin]' class='form_entry_form_values_contrast_scale_3_plusmin span5' id='form_entry_form_values_contrast_scale_3_plusmin' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_3_plusmin']->value) . "'") . "/></td>\r\n <td>-988±5</td>\r\n </tr>\r\n <tr>\r\n <td>4</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][contrast_scale_4_value]' class='form_entry_form_values_contrast_scale_4_value span5' id='form_entry_form_values_contrast_scale_4_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_4_value']->value) . "'") . "/> ± <input type='number' step='0.01' name='form_entry[form_values][contrast_scale_4_plusmin]' class='form_entry_form_values_contrast_scale_4_plusmin span5' id='form_entry_form_values_contrast_scale_4_plusmin' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_4_plusmin']->value) . "'") . "/></td>\r\n <td>120±15</td>\r\n </tr>\r\n <tr>\r\n <td>5</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][contrast_scale_5_value]' class='form_entry_form_values_contrast_scale_5_value span5' id='form_entry_form_values_contrast_scale_5_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_5_value']->value) . "'") . "/> ± <input type='number' step='0.01' name='form_entry[form_values][contrast_scale_5_plusmin]' class='form_entry_form_values_contrast_scale_5_plusmin span5' id='form_entry_form_values_contrast_scale_5_plusmin' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['contrast_scale_5_plusmin']->value) . "'") . "/></td>\r\n <td>0±4</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n <div class='span4'>\r\n <h3 class='center-horizontal'>Low Contrast Detectability</h3>\r\n <h4 class='center-horizontal'>Slice 2-5 (-471mm) (W/L=100/100)</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>See 6mm row?</td>\r\n <td class='control-group'><input name='form_entry[form_values][low_contrast_detect_6mm_row]' class='form_entry_form_values_low_contrast_detect_6mm_row span12' id='form_entry_form_values_low_contrast_detect_6mm_row' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['low_contrast_detect_6mm_row']->value) . "'") . "/></td>\r\n <td>5</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <h3 class='center-horizontal'>Spatial Integrity</h3>\r\n <h4 class='center-horizontal'>Slice 3-5 (-431mm)</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n <tr>\r\n <th>BB to BB</th>\r\n <th>Nominal</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][spatial_integrity_bb_to_bb]' class='form_entry_form_values_spatial_integrity_bb_to_bb span12' id='form_entry_form_values_spatial_integrity_bb_to_bb' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['spatial_integrity_bb_to_bb']->value) . "'") . "/></td>\r\n <td>100±1</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <h3 class='center-horizontal'>High Contrast Resolution</h3>\r\n <h4 class='center-horizontal'>Slice 4-5 (-391mm) (W/L=100/1100)</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>highest lp/cm block</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][high_contrast_resolution_max_lp_cm_block]' class='form_entry_form_values_high_contrast_resolution_max_lp_cm_block span12' id='form_entry_form_values_high_contrast_resolution_max_lp_cm_block' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['high_contrast_resolution_max_lp_cm_block']->value) . "'") . "/></td>\r\n <td>8</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n <div class='span4'>\r\n <h3 class='center-horizontal'>Laser Position</h3>\r\n <h4 class='center-horizontal'>Wilke Phantom</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n <tr>\r\n <th>Laser</th>\r\n <th>Measurement</th>\r\n <th>Nom.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>Cor</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][laser_position_cor]' class='form_entry_form_values_laser_position_cor span12' id='form_entry_form_values_laser_position_cor' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['laser_position_cor']->value) . "'") . "/></td>\r\n <td>0±2</td>\r\n </tr>\r\n <tr>\r\n <td>Sag</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][laser_position_sag]' class='form_entry_form_values_laser_position_sag span12' id='form_entry_form_values_laser_position_sag' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['laser_position_sag']->value) . "'") . "/></td>\r\n <td>0±2</td>\r\n </tr>\r\n <tr>\r\n <td>Axial</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][laser_position_axial]' class='form_entry_form_values_laser_position_axial span12' id='form_entry_form_values_laser_position_axial' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['laser_position_axial']->value) . "'") . "/></td>\r\n <td>0±2</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <h3 class='center-horizontal'>Laser Localization</h3>\r\n <h4 class='center-horizontal'>Pinnacle</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>BB±1mm?</td>\r\n <td class='control-group'><select id='form_entry_form_values_laser_localization' name='form_entry[form_values][laser_localization]'>\r\n <option value='NULL'" . ($id != false && $formEntry->formValues['laser_localization']->value == 'NULL' ? " selected='selected'" : "") . "></option>\r\n <option value='Y'" . ($id != false && $formEntry->formValues['laser_localization']->value == 'Y' ? " selected='selected'" : "") . ">Y</option>\r\n <option value='N'" . ($id != false && $formEntry->formValues['laser_localization']->value == 'N' ? " selected='selected'" : "") . ">N</option>\r\n </select></td>\r\n <td>8</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n <div class='row-fluid'>\r\n <div class='span4'>\r\n <h3 class='center-horizontal'>Review Daily QA Logs</h3>\r\n <h4 class='center-horizontal'> </h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>Performed</td>\r\n <td class='control-group'><select id='form_entry_form_values_daily_qa_logs_reviewed' name='form_entry[form_values][daily_qa_logs_reviewed]'>\r\n <option value='NULL'" . ($id != false && $formEntry->formValues['daily_qa_logs_reviewed']->value == 'NULL' ? " selected='selected'" : "") . "></option>\r\n <option value='Y'" . ($id != false && $formEntry->formValues['daily_qa_logs_reviewed']->value == 'Y' ? " selected='selected'" : "") . ">Y</option>\r\n <option value='N'" . ($id != false && $formEntry->formValues['daily_qa_logs_reviewed']->value == 'N' ? " selected='selected'" : "") . ">N</option>\r\n </select></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n <div class='span4'>\r\n <h3 class='center-horizontal'>Table Incrementation</h3>\r\n <h4 class='center-horizontal'>Ruler</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>±1mm?</td>\r\n <td class='control-group'><select id='form_entry_form_values_table_incrementation' name='form_entry[form_values][table_incrementation]'>\r\n <option value='NULL'" . ($id != false && $formEntry->formValues['table_incrementation']->value == 'NULL' ? " selected='selected'" : "") . "></option>\r\n <option value='Y'" . ($id != false && $formEntry->formValues['table_incrementation']->value == 'Y' ? " selected='selected'" : "") . ">Y</option>\r\n <option value='N'" . ($id != false && $formEntry->formValues['table_incrementation']->value == 'N' ? " selected='selected'" : "") . ">N</option>\r\n </select></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n <div class='span4'>\r\n <h3 class='center-horizontal'>Slice Thickness</h3>\r\n <h4 class='center-horizontal'>Slice 1-5</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>Slice Thickness (mm)</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][slice_thickness]' class='form_entry_form_values_slice_thickness span12' id='form_entry_form_values_slice_thickness' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['slice_thickness']->value) . "'") . "/></td>\r\n <td>3</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n <div class='row-fluid'>\r\n <div class='span6'>\r\n <h3 class='center-horizontal'>Field Uniformity (head)</h3>\r\n <h4 class='center-horizontal'>Slice 3-5 (-431 mm)</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n <tr>\r\n <th>ROI</th>\r\n <th>CT #</th>\r\n <th>Nominal</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>1</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][field_uniformity_1_value]' class='form_entry_form_values_field_uniformity_1_value span12' id='form_entry_form_values_field_uniformity_1_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['field_uniformity_1_value']->value) . "'") . "/></td>\r\n <td>0±5</td>\r\n </tr>\r\n <tr>\r\n <td>2</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][field_uniformity_2_value]' class='form_entry_form_values_field_uniformity_2_value span12' id='form_entry_form_values_field_uniformity_2_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['field_uniformity_2_value']->value) . "'") . "/></td>\r\n <td>0±5</td>\r\n </tr>\r\n <tr>\r\n <td>3</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][field_uniformity_3_value]' class='form_entry_form_values_field_uniformity_3_value span12' id='form_entry_form_values_field_uniformity_3_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['field_uniformity_3_value']->value) . "'") . "/></td>\r\n <td>0±5</td>\r\n </tr>\r\n <tr>\r\n <td>4</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][field_uniformity_4_value]' class='form_entry_form_values_field_uniformity_4_value span12' id='form_entry_form_values_field_uniformity_4_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['field_uniformity_4_value']->value) . "'") . "/></td>\r\n <td>0±5</td>\r\n </tr>\r\n <tr>\r\n <td>5</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][field_uniformity_5_value]' class='form_entry_form_values_field_uniformity_5_value span12' id='form_entry_form_values_field_uniformity_5_value' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['field_uniformity_5_value']->value) . "'") . "/></td>\r\n <td>0±5</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n <div class='span6'>\r\n <h3 class='center-horizontal'>Noise (head)</h3>\r\n <h4 class='center-horizontal'>Slice 3-5 (-431 mm)</h4>\r\n <table class='table table-bordered table-striped'>\r\n <thead>\r\n <tr>\r\n <th>ROI</th>\r\n <th>Standard Deviation</th>\r\n <th>Nominal</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>1</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][noise_1_stddev]' class='form_entry_form_values_noise_1_stddev span12' id='form_entry_form_values_noise_1_stddev' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['noise_1_stddev']->value) . "'") . "/></td>\r\n <td>11±2</td>\r\n </tr>\r\n <tr>\r\n <td>2</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][noise_2_stddev]' class='form_entry_form_values_noise_2_stddev span12' id='form_entry_form_values_noise_2_stddev' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['noise_2_stddev']->value) . "'") . "/></td>\r\n <td>9±2</td>\r\n </tr>\r\n <tr>\r\n <td>3</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][noise_3_stddev]' class='form_entry_form_values_noise_3_stddev span12' id='form_entry_form_values_noise_3_stddev' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['noise_3_stddev']->value) . "'") . "/></td>\r\n <td>9±2</td>\r\n </tr>\r\n <tr>\r\n <td>4</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][noise_4_stddev]' class='form_entry_form_values_noise_4_stddev span12' id='form_entry_form_values_noise_4_stddev' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['noise_4_stddev']->value) . "'") . "/></td>\r\n <td>9±2</td>\r\n </tr>\r\n <tr>\r\n <td>5</td>\r\n <td class='control-group'><input type='number' step='0.01' name='form_entry[form_values][noise_5_stddev]' class='form_entry_form_values_noise_5_stddev span12' id='form_entry_form_values_noise_5_stddev' " . (!$formEntry->formValues ? "" : " value='" . escape_output($formEntry->formValues['noise_5_stddev']->value) . "'") . "/></td>\r\n <td>9±2</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n <h3>Image</h3>\r\n"; if ($id != false && $formEntry->imagePath != '') { echo "<img src='" . joinPaths(ROOT_URL, escape_output($formEntry->imagePath)) . "' /><br />\r\n"; } echo " <div id='image_preview' class='row-fluid'></div>\r\n <p>Supported formats: JPEG, PNG, GIF, WBMP, GD2</p>\r\n <input name='form_image' class='input-file' type='file' onChange='displayImagePreview(this.files);' />\r\n <h3>Comments</h3>\r\n <textarea name='form_entry[comments]' id='form_entry_comments' rows='10' class='span12' placeholder='Comments go here.'>" . ($id === false ? "" : escape_output($formEntry->comments)) . "</textarea><br />\r\n <div class='form-actions'>\r\n"; if ($id != false && $formEntry->approvedOn != '') { echo " <button type='submit' class='btn btn-primary disabled' disabled='disabled'>Approved</button>\r\n"; } else { echo " <button type='submit' class='btn btn-primary'>" . ($id === false ? "Save" : "Save changes") . "</button>\r\n"; } echo " <a class='btn' href='#' onClick='window.location.replace(document.referrer);' >" . ($id === false ? "Go back" : "Discard changes") . "</a>\r\n"; if ($id != false && $user->isPhysicist()) { if ($formEntry->approvedOn == '') { echo " <a class='btn btn-success' href='form_entry.php?action=approve&id=" . intval($id) . "'>Approve</a>\r\n"; } else { echo " <a class='btn btn-warning' href='form_entry.php?action=unapprove&id=" . intval($id) . "'>Unapprove</a>\r\n"; } }
* SP SP SP * Y Y Y * * R E L O A D E D * * (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center * Boston Children's Hospital * * http://childrenshospital.org/FNNDSC/ * dev@babyMRI.org * */ // we define a valid entry point if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } //define('CHRIS_CONFIG_DEBUG',true); // include the configuration if (!defined('CHRIS_CONFIG_PARSED')) { require_once dirname(dirname(dirname(__FILE__))) . '/config.inc.php'; } // include the simpletest chris framework require_once SIMPLETEST_CHRIS; SimpleTest_Chris::setPreference(); // include the test object class since we derive from that require_once 'test.object.model.php'; // include the patient class require_once joinPaths(CHRIS_MODEL_FOLDER, 'patient.model.php'); class TestPatientModel extends TestObjectModel { }
public static function status($feedid, $status, $op) { // get $db instance $db = DB::getInstance(); $db->lock('feed', 'WRITE'); // grab the feed $feedResult = Mapper::getStatic('Feed', $feedid); if (count($feedResult['Feed']) == 0) { $db->unlock(); die('Invalid feed id.'); } # grab old status $old_status = $feedResult['Feed'][0]->status; $type = gettype($status); echo "Performing '{$op}' with value '{$status}' on current status '{$old_status}'\n"; if ($op == 'inc') { // increasing mode echo "Increasing status of feed {$feedid} by {$status}... "; # increase status $status = $old_status + $status; } if ($op == 'set') { // set mode if ($old_status >= $status || $status > 100) { $db->unlock(); die("Ignoring setting the status since the old status {$old_status} >= the new status {$status} or the old status >= 100.\n"); } else { echo "Setting status of feed {$feedid} to {$status}... "; } } echo "status now {$status}.\n"; # clamp the addition if ($status >= 100) { $status = 100; $startTime = $feedResult['Feed'][0]->time; $endTime = microtime(true); $duration = $endTime - $startTime; $feedResult['Feed'][0]->time = $endTime; $feedResult['Feed'][0]->duration = $duration; } # push to database $feedResult['Feed'][0]->status = $status; Mapper::update($feedResult['Feed'][0], $feedid); $db->unlock(); # update related shared feeds $relatedMapper = new Mapper('Feed'); $relatedMapper->join('Meta', 'Meta.target_id = Feed.id')->filter('Meta.name = (?)', 'root_id')->filter('Meta.value = (?)', $feedResult['Feed'][0]->id)->filter('Feed.id != (?)', $feedResult['Feed'][0]->id); $relatedResult = $relatedMapper->get(); foreach ($relatedResult['Feed'] as $key => $value) { $relatedResult['Feed'][$key]->time = $feedResult['Feed'][0]->time; $relatedResult['Feed'][$key]->duration = $feedResult['Feed'][0]->duration; $relatedResult['Feed'][$key]->status = $feedResult['Feed'][0]->status; Mapper::update($relatedResult['Feed'][$key], $relatedResult['Feed'][$key]->id); } # send email if status == 100 if ($status == 100) { // user's email $userMapper = new Mapper('User'); $userMapper->filter('user.id = (?)', $feedResult['Feed'][0]->user_id); $userResult = $userMapper->get(); // if nothing in DB yet, return -1 if (count($userResult['User']) > 0) { $subject = "ChRIS2 - " . $feedResult['Feed'][0]->plugin . " plugin finished"; $message = "Hello " . $userResult['User'][0]->username . "," . PHP_EOL . PHP_EOL; $message .= "Your results are available at:" . PHP_EOL . PHP_EOL; $dirRoot = joinPaths(CHRIS_USERS, $userResult['User'][0]->username, $feedResult['Feed'][0]->plugin, $feedResult['Feed'][0]->name . '-' . $feedResult['Feed'][0]->id); $dataDir = array_diff(scandir($dirRoot), array('..', '.')); foreach ($dataDir as $dir) { $mailFilePath = $dirRoot . '/' . $dir . '/_chrisRun_/' . 'chris.mail'; if (file_exists($mailFilePath)) { $mailContents = file_get_contents($mailFilePath); $message .= $dirRoot . '/' . $dir . PHP_EOL . $mailContents . PHP_EOL . PHP_EOL; } else { $message .= $dirRoot . '/' . $dir . PHP_EOL . PHP_EOL; } } $message .= "Thank you for using ChRIS."; echo "Sending email to " . $userResult['User'][0]->email . " since the status is '{$status}'%.\n"; // get user email address email(CHRIS_PLUGIN_EMAIL_FROM, $userResult['User'][0]->email, $subject, $message); } } }
} ?> </figure> </li> <?php $k++; } // if (isDir) } // foreach (Folders) //List Files after all folders have been listed foreach ($files as $nu => $file) { //define convenience variables for this file $file_path = joinPaths($cur_upload_path, $file); $file_relative_path = joinPaths($subdir, $file); $file_thumb_path = joinPaths($cur_thumbs_path, $file); $file_url = joinURL($cur_upload_url, $file); $file_thumb_url = joinURL($cur_thumbs_url, $file); if ($file != '.' && $file != '..' && $file[0] != '.' && !is_dir($file_path)) { $is_img = false; $is_video = false; $show_original = false; $file_ext = substr(strrchr($file, '.'), 1); if (in_array($file_ext, $ext)) { if (in_array($file_ext, $ext_img)) { $src = $file_url; $src_thumb = $file_thumb_url; //add to thumbs folder if not already if (!file_exists($file_thumb_path)) { create_img_gd($file_path, $file_thumb_path, $thumbnail_width, $thumbnail_height); }
* R E L O A D E D * * (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center * Boston Children's Hospital * * http://childrenshospital.org/FNNDSC/ * dev@babyMRI.org * */ // prevent direct calls if (!defined('__CHRIS_ENTRY_POINT__')) { die('Invalid access.'); } // include the configuration require_once dirname(dirname(__FILE__)) . '/config.inc.php'; require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'user.controller.php'); interface SecurityControllerInterface { public static function login_attempt(); public static function logout_attempt(); public static function login(); public static function logout(); } // here, we always need a session started session_start(); /** * Security controller class */ class SecurityC implements SecurityControllerInterface { public static function login_attempt()
<?php ini_set('display_errors', '0'); # don't show any errors... error_reporting(E_ALL | E_STRICT); # ...but do log them session_start(); if ($_SESSION["verify"] != "FileManager4TinyMCE") { die('forbidden'); } include 'config.php'; include 'utils.php'; if (empty($_POST['path'])) { die('Forbidden Path'); } $path = joinPaths($root, $upload_dir, $_POST['path']); $path = str_replace(LC_DS . '..', '', $path); $name = $_POST['name']; if (!file_exists($path)) { die('File not found'); } header('Pragma: private'); header('Cache-control: private, must-revalidate'); header("Content-Type: application/octet-stream"); header("Content-Length: " . (string) filesize($path)); header('Content-Disposition: attachment; filename="' . $name . '"'); readfile($path); exit;
$arguments .= ' -c "' . $runfile . '"'; $arguments .= ' -u "' . $username . '"'; $arguments .= ' -p "' . $password . '"'; $arguments .= ' -o "' . $feed_path . '"'; if ($force_chris_local) { // get user group id $groupID = $ssh->exec("id -g"); $groupID = trim($groupID); // open permissions so user can see its plugin running $local_command = "/bin/chgrp -R {$groupID} {$feed_path}; /bin/chmod g+rxw -R {$feed_path}"; $ssh->exec($local_command); unset($ssh); # run command as locally ChRIS! $ssh2 = new Net_SSH2('localhost'); $key = new Crypt_RSA(); $sshkey = joinPaths(CHRIS_HOME, '.ssh/id_rsa'); $key->loadKey(file_get_contents($sshkey)); if (!$ssh2->login('chris', $key)) { exit('Login as ChRIS local user failed...!'); } $local_command = "/bin/bash umask 0002;/bin/bash {$runfile};"; $nohup_wrap = 'bash -c \'nohup bash -c "' . $local_command . '" > /dev/null 2>&1 &\''; $ssh2->exec($nohup_wrap); $pid = -1; } else { if ($status == 100) { // run locally $ssh->exec('bash -c \' /bin/bash ' . $runfile . '\''); $pid = -1; } else { // run on cluster and return pid
include 'utils.php'; // Upload is restricted for the non-admin users if (!\XLite\Core\Auth::getInstance()->isAdmin()) { die('forbidden'); } if (!empty($_FILES) && $upload_files) { $tempFile = $_FILES['file']['tmp_name']; $pathinfo = pathinfo(strtolower($_FILES['file']['name'])); $fileExt = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : ''; $fileName = $pathinfo['filename'] . $fileExt; $targetFile = joinPaths($root, $upload_dir, $_POST['path'], $fileName); $targetFileThumb = joinPaths($root, $thumbs_dir, $_POST['path'], $fileName); if (file_exists($targetFile) || file_exists($targetFileThumb)) { $fileName = $pathinfo['filename'] . '_' . hash('md4', $pathinfo['filename']) . $fileExt; $targetFile = joinPaths($root, $upload_dir, $_POST['path'], $fileName); $targetFileThumb = joinPaths($root, $thumbs_dir, $_POST['path'], $fileName); } move_uploaded_file($tempFile, $targetFile); $is_img = in_array(substr(strrchr($fileName, '.'), 1), $ext_img) ? true : false; if ($is_img) { create_img_gd($targetFile, $targetFileThumb, $thumbnail_width, $thumbnail_height); $imginfo = getimagesize($targetFile); $srcWidth = $imginfo[0]; $srcHeight = $imginfo[1]; if ($image_resizing) { if ($image_width == 0) { if ($image_height == 0) { $image_width = $srcWidth; $image_height = $srcHeight; } else { $image_width = $image_height * $srcWidth / $srcHeight;
// A Beautiful Site (http://abeautifulsite.net/) // 24 March 2008 // // History: // // 1.01 - updated to work with foreign characters in directory/file names (12 April 2008) // 1.00 - released (24 March 2008) // // Output a list of files for jQuery File Tree // // we define a valid entry point define('__CHRIS_ENTRY_POINT__', 666); // include the configuration require_once dirname(dirname(__FILE__)) . '/config.inc.php'; require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'security.controller.php'); require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'template.class.php'); $shortopts = "d:h"; $longopts = array("directory:", "help"); $options = getopt($shortopts, $longopts); if (array_key_exists('h', $options) || array_key_exists('help', $options)) { echo "this is the help!"; echo "\n"; return; } //if no command provided, exit $directory = ''; if (array_key_exists('d', $options)) { $directory = $options['d']; } elseif (array_key_exists('directory', $options)) { $directory = $options['directory']; } else {
public function testSettingsWithSettingsFile() { $homeDirectory = getenv('HOME'); $settingsFolderPath = "/" . joinPaths($homeDirectory, "settings"); if (!file_exists($settingsFolderPath)) { mkdir($settingsFolderPath, 0755, true); } $settingsFilePath = "/" . joinPaths($homeDirectory, "settings/dutings.php"); $settingsFile = fopen($settingsFilePath, "w"); $txt = '<?php $DUTINGS_DB_NAME = "' . $this->DUTINGS_DB_NAME . '"; $DUTINGS_DB_USERNAME = "******"; $DUTINGS_DB_HOSTNAME = "' . $this->DUTINGS_DB_HOSTNAME . '"; $DUTINGS_DB_PASSWORD = "******"; $GOOGLE_CLIENT_ID="' . $this->GOOGLE_CLIENT_ID . '";'; fwrite($settingsFile, $txt); fclose($settingsFile); putenv('DUTINGS_DB_NAME'); putenv('DUTINGS_DB_USERNAME'); putenv('DUTINGS_DB_HOSTNAME'); putenv('DUTINGS_DB_PASSWORD'); putenv('GOOGLE_CLIENT_ID'); $settings = (require PROJECT_ROOT . "/app/settings.php"); $this->assertNotEquals($settings, null); }
function start_html($user, $title = "UC Medicine QA", $subtitle = "", $status = "", $statusClass = "") { echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n\n" . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>' . escape_output($title) . ($subtitle != "" ? " - " . escape_output($subtitle) : "") . '</title> <link rel="shortcut icon" href="http://ucmcqa.dyndns.org/favicon.ico" /> <link rel="stylesheet" href="' . joinPaths(ROOT_URL, "css/bootstrap.min.css") . '" type="text/css" /> <link rel="stylesheet" href="' . joinPaths(ROOT_URL, "css/bootstrap-responsive.min.css") . '" type="text/css" media="all" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" type="text/css" /> <link rel="stylesheet" href="' . joinPaths(ROOT_URL, "css/jquery.dataTables.css") . '" type="text/css" /> <link rel="stylesheet" href="' . joinPaths(ROOT_URL, "css/linac-qa.css") . '" type="text/css" /> <link rel="stylesheet" href="' . joinPaths(ROOT_URL, "css/print.css") . '" type="text/css" media="print" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <script type="text/javascript" src="' . joinPaths(ROOT_URL, "js/jquery-ui-timepicker-addon.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/jquery.dropdownPlain.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/jquery.dataTables.min.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/jquery.autosave.js") . '"></script> <script type="text/javascript" src="' . joinPaths(ROOT_URL, "js/d3.v2.min.js") . '"></script> <script type="text/javascript" src="' . joinPaths(ROOT_URL, "js/d3-helpers.js") . '"></script> <script type="text/javascript" src="' . joinPaths(ROOT_URL, "js/highcharts.js") . '"></script> <script type="text/javascript" src="' . joinPaths(ROOT_URL, "js/exporting.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/calcFunctions.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/renderHighCharts.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/bootstrap.min.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/bootstrap-dropdown.js") . '"></script> <script type="text/javascript" language="javascript" src="' . joinPaths(ROOT_URL, "js/loadInterface.js") . '"></script> </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container-fluid"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a href="./index.php" class="brand">UC Medicine QA</a> <div class="nav-collapse"> <ul class="nav">' . "\n"; // display daily, monthly, yearly forms. if ($user->loggedIn()) { $formTypes = $user->dbConn->stdQuery("SELECT `id`, `name` FROM `form_types` ORDER BY `id` ASC"); while ($formType = $formTypes->fetch_assoc()) { $formType = new FormType($user->dbConn, intval($formType['id'])); echo ' <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> ' . escape_output($formType->name) . ' <b class="caret"></b> </a> <ul class="dropdown-menu">' . "\n"; foreach ($formType->forms as $form) { echo ' <li><a href="form_entry.php?action=new&form_id=' . intval($form['id']) . '">' . escape_output($form['name']) . '</a></li>' . "\n"; } echo ' </ul> </li> <li class="divider-vertical"></li>' . "\n"; } // display analysis toolbar. echo ' <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Analysis <b class="caret"></b> </a> <ul class="dropdown-menu">' . "\n"; $forms = $user->dbConn->stdQuery("SELECT `id`, `name` FROM `forms` ORDER BY `name` ASC"); while ($form = $forms->fetch_assoc()) { echo ' <li class="dropdown-submenu"> <a tabindex="-1" href="#">' . escape_output($form['name']) . '</a> <ul class="dropdown-menu"> <li><a href="form_entry.php?action=index&form_id=' . intval($form['id']) . '">Entries</a></li> <li><a href="graph.php?action=show&form_id=' . intval($form['id']) . '">Plot</a></li> </ul>' . "\n"; } echo ' </ul>' . "\n"; } // display administrator tools. if ($user->isAdmin()) { echo ' <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Admin <b class="caret"></b> </a> <ul class="dropdown-menu"> <li><a href="facility.php">Facilities</a></li> <li><a href="form.php">Forms</a></li> <li><a href="machine_type.php">Machine Types</a></li> <li><a href="machine.php">Machines</a></li> <li><a href="user.php">Users</a></li> <li><a href="backup.php">Backup</a></li> </ul> </li> <li class="divider-vertical"></li>' . "\n"; } echo ' </ul> <ul class="nav pull-right"> <li class="divider-vertical"></li> <li class="dropdown">' . "\n"; // display user settings / log out link, or sign in form. if ($user->loggedIn()) { echo ' <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user icon-white"></i>' . escape_output($user->name) . '<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="/user.php?action=show&id=' . intval($user->id) . '">Profile</a></li> <li><a href="/user.php?action=edit&id=' . intval($user->id) . '">User Settings</a></li> <li class="divider"></li> <li><a href="/logout.php">Sign out</a></li> </ul>' . "\n"; } else { echo ' <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sign in<b class="caret"></b></a> <ul class="dropdown-menu">' . "\n"; display_login_form(); echo ' </ul>' . "\n"; } echo ' </li> </ul> </div> </div> </div> </div> <div class="container-fluid">' . "\n"; // display alerts if applicable. if ($status != "") { echo ' <div class="alert alert-' . escape_output($statusClass) . '"> <button class="close" data-dismiss="alert" href="#">×</button> ' . escape_output($status) . ' </div>' . "\n"; } }
public function create_or_update($form_entry) { // creates or updates the current form entry with the information in $form_entry // returns a redirect_to array. if ($this->id != 0) { //update this form entry. foreach ($form_entry['form_values'] as $name => $value) { if ($value == 'NULL') { continue; } $findField = $this->dbConn->queryFirstValue("SELECT `id` FROM `form_fields` WHERE `form_id` = " . intval($form_entry['form_id']) . " && `name` = " . $this->dbConn->quoteSmart($name)); if (!$findField) { $insertField = $this->dbConn->stdQuery("INSERT INTO `form_fields` (`form_id`, `name`) VALUES (" . intval($form_entry['form_id']) . ", " . $this->dbConn->quoteSmart($name) . ")"); $findField = $this->dbConn->insert_id; } $insertOrUpdateValue = $this->dbConn->stdQuery("INSERT INTO `form_values` (`value`, `form_field_id`, `form_entry_id`) VALUES (" . $this->dbConn->quoteSmart($value) . ", " . intval($findField) . ", " . intval($this->id) . ") ON DUPLICATE KEY UPDATE `value` = " . $this->dbConn->quoteSmart($value)); } // process uploaded image. $file_array = $_FILES['form_image']; $imagePath = ""; if (!empty($file_array['tmp_name']) && is_uploaded_file($file_array['tmp_name'])) { if ($file_array['error'] != UPLOAD_ERR_OK) { return array('location' => 'form_entry.php?action=edit&id=' . intval($this->id), 'status' => "There was an error uploading your image file.", 'class' => 'error'); } $file_contents = file_get_contents($file_array['tmp_name']); if (!$file_contents) { return array('location' => 'form_entry.php?action=edit&id=' . intval($this->id), 'status' => "Could not read contents of uploaded image file.", 'class' => 'error'); } $newIm = @imagecreatefromstring($file_contents); if (!$newIm) { return array('location' => 'form_entry.php?action=edit&id=' . intval($this->id), 'status' => "The image file you uploaded is invalid.", 'class' => 'error'); } $imageSize = getimagesize($file_array['tmp_name']); if ($imageSize[0] > 5000 || $imageSize[1] > 5000) { return array('location' => 'form_entry.php?action=edit&id=' . intval($this->id), 'status' => "The maximum allowed size for images is 5000x5000 pixels.", 'class' => 'error'); } // move file to destination and save path in db. if (!is_dir(joinPaths($_SERVER[''], "uploads", "forms", intval($form_entry['form_id'])))) { mkdir(joinPaths($_SERVER[''], "uploads", "forms", intval($form_entry['form_id']))); } $imagePathInfo = pathinfo($file_array['tmp_name']); $imagePath = joinPaths("uploads", "forms", intval($form_entry['form_id']), $form_entry['id'] . image_type_to_extension($imageSize[2])); if (!move_uploaded_file($file_array['tmp_name'], $imagePath)) { return array('location' => 'form_entry.php?action=edit&id=' . intval($this->id), 'status' => "There was an error moving your uploaded file.", 'class' => 'error'); } } else { $imagePath = $this->imagePath; } $updateFormEntry = $this->dbConn->stdQuery("UPDATE `form_entries` SET `user_id` = " . intval($form_entry['user_id']) . ", `machine_id` = " . intval($form_entry['machine_id']) . ", `comments` = " . $this->dbConn->quoteSmart($form_entry['comments']) . ", `image_path` = " . $this->dbConn->quoteSmart($imagePath) . ", `created_at` = '" . date('Y-m-d H:i:s', strtotime($form_entry['created_at'])) . "', `qa_month` = " . intval($form_entry['qa_month']) . ", `qa_year` = " . intval($form_entry['qa_year']) . ", `updated_at` = '" . date('Y-m-d H:i:s') . "' WHERE `id` = " . intval($form_entry['id']) . " LIMIT 1"); return array('location' => 'form_entry.php?action=index&form_id=' . $form_entry['form_id'], 'status' => "Successfully updated form entry.", 'class' => 'success'); } else { // inserting a form entry. // ensure that this form exists. $checkForm = $this->dbConn->queryCount("SELECT COUNT(*) FROM `forms` WHERE `id` = " . intval($form_entry['form_id'])); if (!$checkForm || $checkForm != 1) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "The specified form does not exist.", 'class' => 'error'); } $insertEntry = $this->dbConn->stdQuery("INSERT INTO `form_entries` (`form_id`, `machine_id`, `user_id`, `comments`, `image_path`, `created_at`, `qa_month`, `qa_year`, `updated_at`) VALUES (" . intval($form_entry['form_id']) . ", " . intval($form_entry['machine_id']) . ", " . intval($form_entry['user_id']) . ", " . $this->dbConn->quoteSmart($form_entry['comments']) . ", '', '" . date('Y-m-d H:i:s', strtotime($form_entry['created_at'])) . "', " . intval($form_entry['qa_month']) . ", " . intval($form_entry['qa_year']) . ", '" . date('Y-m-d H:i:s') . "')"); $form_entry['id'] = intval($this->dbConn->insert_id); $valueQueryArray = []; foreach ($form_entry['form_values'] as $name => $value) { $findField = $this->dbConn->queryFirstValue("SELECT `id` FROM `form_fields` WHERE `form_id` = " . intval($form_entry['form_id']) . " && `name` = " . $this->dbConn->quoteSmart($name)); if (!$findField) { $insertField = $this->dbConn->stdQuery("INSERT INTO `form_fields` (`form_id`, `name`) VALUES (" . intval($form_entry['form_id']) . ", " . $this->dbConn->quoteSmart($name) . ")"); $findField = $this->dbConn->insert_id; } if ($value != '') { $valueQueryArray[] = "(" . $this->dbConn->quoteSmart($value) . ", " . intval($findField) . ", " . intval($form_entry['id']) . ")"; } } $insertFormValues = $this->dbConn->stdQuery("INSERT INTO `form_values` (`value`, `form_field_id`, `form_entry_id`) VALUES " . implode(",", $valueQueryArray)); if (!$insertFormValues) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "Error while inserting form entry. Please try again.", 'class' => 'error'); } // process uploaded image (if there is one) $file_array = $_FILES['form_image']; if (!empty($file_array['tmp_name']) && is_uploaded_file($file_array['tmp_name'])) { if ($file_array['error'] != UPLOAD_ERR_OK) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "There was an error uploading your image file.", 'class' => 'error'); } $file_contents = file_get_contents($file_array['tmp_name']); if (!$file_contents) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "Could not read contents of uploaded image file.", 'class' => 'error'); } $newIm = @imagecreatefromstring($file_contents); if (!$newIm) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "The image file you uploaded is invalid.", 'class' => 'error'); } $imageSize = getimagesize($file_array['tmp_name']); if ($imageSize[0] > 5000 || $imageSize[1] > 5000) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "The maximum allowed size for images is 5000x5000 pixels.", 'class' => 'error'); } // move file to destination and save path in db. if (!is_dir(joinPaths($_SERVER[''], "uploads", "forms", $form_entry['form_id']))) { mkdir(joinPaths($_SERVER[''], "uploads", "forms", $form_entry['form_id'])); } $imagePathInfo = pathinfo($file_array['tmp_name']); $imagePath = joinPaths("uploads", "forms", $form_entry['form_id'], $form_entry['id'] . '.' . $imagePathInfo['extension']); if (!move_uploaded_file($file_array['tmp_name'], $imagePath)) { return array('location' => 'form_entry.php?action=new' . (isset($form_entry['form_id']) ? "&form_id=" . intval($form_entry['form_id']) : ""), 'status' => "There was an error moving your uploaded file.", 'class' => 'error'); } $updateImagePath = $this->dbConn->stdQuery("UPDATE `form_entries` SET `image_path` = " . $this->dbConn->quoteSmart($imagePath) . " WHERE `id` = " . intval($form_entry['id']) . " LIMIT 1"); } return array('location' => 'form_entry.php?action=index&form_id=' . intval($form_entry['form_id']), 'status' => "Successfully inserted form entry.", 'class' => 'success'); } }
* dev@babyMRI.org * * * Quick example: * * ./query.php --studydate=20130416 --modality=MR * * */ if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } // include the configuration require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.inc.php'; // include pacs helper require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'pacs.helper.php'); // check if we are invoked by commandline $commandline_mode = php_sapi_name() == 'cli'; if ($commandline_mode) { // parse the options if we are in commandline mode // define the options $shortopts = "s::p::a::c::i::n::d::m::t::y::e::x::h"; $longopts = array("serverip::", "serverport::", "useraetitle::", "useraec::", "patientid::", "patientname::", "studydate::", "modality::", "studydescription::", "seriesdescription::", "station::", "sex::", "help"); $options = getopt($shortopts, $longopts); if (array_key_exists('h', $options) || array_key_exists('help', $options)) { echo "this is the help!"; echo "\n"; return; } //if no command provided, exit $serverip = '134.174.12.21';
* SP SP SP * Y Y Y * * R E L O A D E D * * (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center * Boston Children's Hospital * * http://childrenshospital.org/FNNDSC/ * dev@babyMRI.org * */ // we define a valid entry point if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } //define('CHRIS_CONFIG_DEBUG',true); // include the configuration if (!defined('CHRIS_CONFIG_PARSED')) { require_once dirname(dirname(dirname(__FILE__))) . '/config.inc.php'; } // include the simpletest chris framework require_once SIMPLETEST_CHRIS; SimpleTest_Chris::setPreference(); // include the test object class since we derive from that require_once 'test.object.model.php'; // include the user_data class require_once joinPaths(CHRIS_MODEL_FOLDER, 'user_data.model.php'); class TestUser_DataModel extends TestObjectModel { }
function tempdir(&$ssh, $dir = false, $prefix = '_chrisRun_') { // $dirname = uniqid($prefix, false); $dirname = $prefix; $tempdir = joinPaths($dir, $dirname); $message = $ssh->exec('bash -c \'umask 0002 ; mkdir -p ' . $tempdir . '\''); # empty return message on mkdir means success if ($message == '') { return $tempdir; } echo '_chrisRun_ could not be created in dir $dir -- possible permission issue: ' . $message . PHP_EOL; }
* * (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center * Boston Children's Hospital * * http://childrenshospital.org/FNNDSC/ * dev@babyMRI.org * */ // prevent direct calls if (!defined('__CHRIS_ENTRY_POINT__')) { die('Invalid access.'); } // include the configuration require_once dirname(dirname(__FILE__)) . '/config.inc.php'; require_once joinPaths(CHRIS_CONTROLLER_FOLDER, 'mapper.class.php'); require_once joinPaths(CHRIS_MODEL_FOLDER, 'token.model.php'); require_once 'Net/SSH2.php'; // interface interface TokenControllerInterface { // Create a new token and return it. public static function create(); // Validate a token. public static function validate($token); } /** * Feed controller class */ class TokenC implements TokenControllerInterface { /**
*/ // we define a valid entry point if (!defined('__CHRIS_ENTRY_POINT__')) { define('__CHRIS_ENTRY_POINT__', 666); } // include the configuration file if (!defined('CHRIS_CONFIG_PARSED')) { require_once dirname(dirname(__FILE__)) . '/config.inc.php'; } // create log file $logFile = joinPaths(CHRIS_LOG, date('YmdHis') . '-pacs_pull_listen.log'); while (!file_exists($logFile)) { if (touch($logFile)) { break; } $logFile = joinPaths(CHRIS_LOG, date('YmdHis') . '-pacs_pull_listen.log'); } $fullReport = ''; // CREATE UNIQUE DIRECTORY $tmpdirname = CHRIS_TMP . '/' . date('Ymdhis'); while (!is_dir($tmpdirname)) { if (mkdir($tmpdirname)) { break; } $tmpdirname .= date('s'); } //write log $startReportPretty = "=========================================" . PHP_EOL; $report = date('Y-m-d h:i:s') . ' ---> Create unique tmp directory...' . PHP_EOL; $report .= $tmpdirname . PHP_EOL; $fullReport .= $report;