本文整理汇总了PHP中joinPaths函数的典型用法代码示例。如果您正苦于以下问题:PHP joinPaths函数的具体用法?PHP joinPaths怎么用?PHP joinPaths使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了joinPaths函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTemplateClass
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;
}
示例2: settingsInit
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];
}
示例3: joinPaths
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 = "";
示例4: joinPaths
// 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") {
示例5: define
* 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');
示例6: die
// 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":
示例7: getHTML
/**
* 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);
//.........这里部分代码省略.........
示例8: define
* 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
{
}
示例9: getCollectionPath
/**
* @return string
*/
public function getCollectionPath()
{
return joinPaths($this->getPath(), 'collection.anki2');
}
示例10: define
* 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);
示例11: define
* 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);
示例12: fixRelativePaths
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;
}
}
示例13: error_reporting
# 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);
}
示例14: define
* 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
{
}
示例15: status
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);
}
}
}