コード例 #1
0
ファイル: Upload.php プロジェクト: popdani95/Agenda
 private function __upload()
 {
     foreach ($this->filesContainer as $key => $file) {
         if ($this->__checkType($file['type'])) {
             $this->uploadedFilesContainer[$key]['name'] = $this->__generateRandomName($file['name']) . $this->allowedTypes[$file['type']];
             \move_uploaded_file($file['tmp_name'], build_path(DIR_UPLOADS, $this->uploadedFilesContainer[$key]['name']));
         }
     }
 }
コード例 #2
0
 public function testStaticGet()
 {
     $composerJsonStatic = ComposerJson::get(build_path(__DIR__, "data"));
     $composerJson = new ComposerJson();
     $composerJson->getComposerJsonFile(build_path(__DIR__, "data"));
     $composerJson->parseComposerJsonData();
     $composerJson->validateComposerJsonObject();
     $this->assertTrue($composerJsonStatic == $composerJson);
 }
コード例 #3
0
 /**
  * @param string $package
  * @param string $homeDir
  *
  * @return string
  */
 public function getPotentialLinkLocation($package, $homeDir)
 {
     $linkToPotentialLocation = false;
     $potentialLocation = build_path($homeDir, $package);
     if (file_exists($potentialLocation)) {
         $linkToPotentialLocation = UserPrompt::confirm(sprintf("> Link to '%s'?", $potentialLocation), 'y');
     }
     return $linkToPotentialLocation ? $potentialLocation : "";
 }
コード例 #4
0
 /**
  * @param string $projectDir
  * @param string $fileName
  *
  * @return string
  * @throws BadProjectDirectoryException
  */
 public function getComposerJsonFile($projectDir, $fileName = self::COMPOSER_JSON_FILE)
 {
     $composerJsonLocation = build_path($projectDir, $fileName);
     if (!file_exists($composerJsonLocation)) {
         throw new BadProjectDirectoryException(sprintf("There was no %s file found in '%s'. Perhaps you need " . "set the project directory with -p, or maybe you don't have a " . "%s file. We tried to locate the file at the following " . "location: '%s'", $fileName, $projectDir, $fileName, $composerJsonLocation));
     }
     $this->composerJsonFileData = file_get_contents($composerJsonLocation);
     return $this->composerJsonFileData;
 }
コード例 #5
0
 public function __construct($logDir, $projectDir)
 {
     $this->logFilePath = build_path($logDir, self::LOG_FILE_NAME);
     $this->key = substr(md5($projectDir), 0, 6) . "_";
     if (!file_exists($this->logFilePath)) {
         touch($this->logFilePath);
     }
     if (!$this->canReadWrite()) {
         throw new ComposerSymLogException(sprintf("ComposerSym is unable to read/write a log file to '%s'", $logDir));
     }
     $data = file_get_contents($this->logFilePath);
     if (strlen($data) > 0) {
         $this->logFile = ComposerSymLogFile::fromJson($data);
     } else {
         $this->logFile = new ComposerSymLogFile();
     }
 }
コード例 #6
0
ファイル: SidekixBundl.php プロジェクト: bundl/sidekix
 public static function getDiffuseVersionInfo()
 {
     if (!self::$_versionInfo) {
         $info = [];
         $versionFile = build_path(CUBEX_PROJECT_ROOT, 'DIFFUSE.VERSION');
         if (file_exists($versionFile)) {
             $data = file($versionFile);
             foreach ($data as $line) {
                 $line = trim($line);
                 if (starts_with($line, '== Change Log ==', true)) {
                     break;
                 } else {
                     if (!empty($line)) {
                         list($key, $value) = exploded(':', $line, ['unknown', 'unknown'], 2);
                         $info[Strings::variableToUnderScore($key)] = $value;
                     }
                 }
             }
         }
         self::$_versionInfo = $info;
     }
     return self::$_versionInfo;
 }
コード例 #7
0
$db = new sqlite3(build_path($docsetPath, '../docSet.dsidx'));
$db->query('CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)');
$db->query('CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path)');
$extTypes = ['Callback', 'Command', 'Component', 'Constructor', 'Element', 'Entry', 'Error', 'Event', 'Exception', 'Field', 'File', 'Filter', 'Framework', 'Function', 'Instance', 'Library', 'Literal', 'Macro', 'Mixin', 'Module', 'Namespace', 'Object', 'Option', 'Package', 'Protocol', 'Record', 'Resource', 'Sample', 'Service', 'Struct', 'Style', 'Subroutine', 'Tag', 'Union', 'Value'];
foreach (scandir($docsetPath) as $file) {
    if (is_file(build_path($docsetPath, $file)) && strpos($file, '.html') !== false) {
        if (strpos($file, 'guide') === 0) {
            $content = file_get_contents(build_path($docsetPath, $file));
            if (preg_match('/<h1>([\\w\\d\\s]+).*<\\/h1>/s', $content, $m)) {
                $title = trim($m[1]);
                add_to_index($db, $title, 'Guide', $file);
            } else {
                trigger_error('Can\'t find title in file ' . $file . PHP_EOL, E_ERROR);
            }
        } elseif (strpos($file, 'yii') === 0) {
            $content = file_get_contents(build_path($docsetPath, $file));
            if (preg_match('/<h1>\\n*(?:Abstract\\s)?(Class|Interface|Trait)\\s([0-9a-zA-Z\\\\]+)\\n*<\\/h1>/', $content, $m)) {
                $class = trim($m[2]);
                add_to_index($db, $class, $m[1], $file);
                foreach ($extTypes as $type) {
                    if (stripos($m[2], $type) !== false) {
                        add_to_index($db, $class, $type, $file);
                    }
                }
            } else {
                trigger_error('Can\'t find class name in file ' . $file . PHP_EOL, E_ERROR);
            }
            echo $class . PHP_EOL;
            if (preg_match_all('/<div class="summary doc-(property|method|event|const)">.*<table[^>]*>(.+)<\\/table>.*<\\/div>/sU', $content, $m, PREG_SET_ORDER)) {
                foreach ($m as $item) {
                    if (preg_match_all('/<tr[^>]*id="(.+)"[^>]*>.*<td[^>]*><a[^>]*href="(.+)".*<\\/tr>/sU', $item[2], $k, PREG_SET_ORDER)) {
コード例 #8
0
<?php

date_default_timezone_set('UTC');
// If there is an env file, then load it, so that the configs can use them
if (build_path([__DIR__, '..', '.env'], true)) {
    Dotenv::load(build_path([__DIR__, '..']));
}
// Path to config file
$config_file = build_path([__DIR__, '..', 'config', 'generator.php'], true);
// Read the config file if there is one, otherwise set to empty array
$config = (array) ($config_file ? require $config_file : []);
// Return a new generator
return new Spinen\ConnectWise\Generator\Generator($config);
コード例 #9
0
 /**
  * @test
  */
 public function it_takes_third_parameter_for_seperator()
 {
     $expected = "one|two|three";
     $this->assertEquals($expected, build_path(["one", "two", "three"], false, "|"));
 }
コード例 #10
0
ファイル: rrd.php プロジェクト: sbausis/openmediavault
    // Must be included here
    require_once "openmediavault/session.inc";
    require_once "openmediavault/functions.inc";
    $session =& OMVSession::getInstance();
    $session->start();
    if ($session->isAuthenticated()) {
        $session->validate();
        // Do not update last access time
        //$session->updateLastAccess();
    } else {
        throw new OMVException(OMVErrorMsg::E_SESSION_NOT_AUTHENTICATED);
    }
    // The parameter 'name' may not contain the characters '..'. This is
    // because of security reasons: the given canonicalized absolute
    // path MUST be below the given image directory.
    if (1 == preg_match("/\\.\\./", $_GET['name'])) {
        throw new OMVException(OMVErrorMsg::E_RPC_INVALID_PARAMS, sprintf(gettext("The parameter '%s' contains forbidden two-dot symbols"), "name"));
    }
    // Build the image filename. If it does not exist, then display an error
    // image by default.
    $filename = build_path(array($GLOBALS['OMV_RRDGRAPH_DIR'], $_GET['name']));
    if (!file_exists($filename)) {
        $filename = $GLOBALS['OMV_RRDGRAPH_ERROR_IMAGE'];
    }
    $fd = fopen($filename, "r");
    header("Content-type: image/png");
    fpassthru($fd);
} catch (Exception $e) {
    header("Content-Type: text/html");
    printf("Error #" . $e->getCode() . ":<br/>%s", str_replace("\n", "<br/>", $e->__toString()));
}
コード例 #11
0
ファイル: rrd.php プロジェクト: svn2github/omv2
 * You should have received a copy of the GNU General Public License
 * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once "openmediavault/autoloader.inc";
    require_once "openmediavault/globals.inc";
    require_once "openmediavault/functions.inc";
    $session =& \OMV\Session::getInstance();
    $session->start();
    $session->validate();
    // Do not update last access time.
    //$session->updateLastAccess();
    // The parameter 'name' may not contain the characters '..'. This is
    // because of security reasons: the given canonicalized absolute
    // path MUST be below the given image directory.
    if (1 == preg_match("/\\.\\./", $_GET['name'])) {
        throw new \OMV\Exception("The parameter 'name' contains forbidden two-dot symbols.");
    }
    // Build the image file path. If it does not exist, then display an
    // error image by default.
    $pathName = build_path(DIRECTORY_SEPARATOR, $GLOBALS['OMV_RRDGRAPH_DIR'], $_GET['name']);
    if (!file_exists($pathName)) {
        $pathName = $GLOBALS['OMV_RRDGRAPH_ERROR_IMAGE'];
    }
    $fd = fopen($pathName, "r");
    header("Content-type: image/png");
    fpassthru($fd);
} catch (\Exception $e) {
    header("Content-Type: text/html");
    printf("Error #" . $e->getCode() . ":<br/>%s", str_replace("\n", "<br/>", $e->__toString()));
}
コード例 #12
0
ファイル: Parser.php プロジェクト: tommiu/phpjoern_mirror
/**
 * Parses and generates ASTs for all PHP files buried within a
 * directory.
 *
 * @param $path        Path to the directory
 * @param $csvexporter A CSV exporter instance to use for exporting
 *                     the ASTs of all parsed files.
 * @param $top         Boolean indicating whether this call
 *                     corresponds to the top-level call of the
 *                     function. We wouldn't need this if I didn't
 *                     insist on the root directory of a project
 *                     getting node index 0. But, I do insist.
 *
 * @return If the directory corresponding to the function call finds
 *         itself interesting, it stores a directory node for itself
 *         and this function returns the index of that
 *         node. Otherwise, returns -1. A directory finds itself
 *         interesting if it contains PHP files, or if one of its
 *         child directories finds itself interesting. -- As a special
 *         case, the root directory of a project (corresponding to the
 *         top-level call) always finds itself interesting and always
 *         stores a directory node for itself.
 */
function parse_dir($path, $csvexporter, $top = true) : int
{
    // save any interesting directory/file indices in the current folder
    $found = [];
    // if the current folder finds itself interesting, we will create a
    // directory node for it and return its index
    $dirnode = $top ? $csvexporter->store_dirnode(basename($path)) : -1;
    $dhandle = opendir($path);
    // iterate over everything in the current folder
    while (false !== ($filename = readdir($dhandle))) {
        $finfo = new SplFileInfo(build_path($path, $filename));
        if ($finfo->isFile() && $finfo->isReadable() && strtolower($finfo->getExtension()) === 'php') {
            $found[] = parse_file($finfo->getPathname(), $csvexporter);
        } else {
            if ($finfo->isDir() && $finfo->isReadable() && $filename !== '.' && $filename !== '..') {
                if (-1 !== ($childdir = parse_dir($finfo->getPathname(), $csvexporter, false))) {
                    $found[] = $childdir;
                }
            }
        }
    }
    // if the current folder finds itself interesting...
    if (!empty($found)) {
        if (!$top) {
            $dirnode = $csvexporter->store_dirnode(basename($path));
        }
        foreach ($found as $i => $nodeindex) {
            $csvexporter->store_rel($dirnode, $nodeindex, "DIRECTORY_OF");
        }
    }
    closedir($dhandle);
    return $dirnode;
}
コード例 #13
0
ファイル: rpc.php プロジェクト: svn2github/omv2
 * OpenMediaVault is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once "openmediavault/autoloader.inc";
    require_once "openmediavault/globals.inc";
    require_once "openmediavault/env.inc";
    require_once "openmediavault/functions.inc";
    // Load and initialize the RPC services that are not handled by the
    // engine daemon.
    $directory = build_path(DIRECTORY_SEPARATOR, $GLOBALS['OMV_DOCUMENTROOT_DIR'], "rpc");
    foreach (listdir($directory, "inc") as $path) {
        require_once $path;
    }
    $rpcServiceMngr =& \OMV\Rpc\ServiceManager::getInstance();
    $rpcServiceMngr->initializeServices();
    // Initialize the data models.
    $modelMngr = \OMV\DataModel\Manager::getInstance();
    $modelMngr->load();
    $session =& \OMV\Session::getInstance();
    $session->start();
    $server = new \OMV\Rpc\Proxy\Json();
    $server->handle();
    $server->cleanup();
} catch (\Exception $e) {
    if (isset($server)) {
コード例 #14
0
ファイル: LinkWorker.php プロジェクト: garoevans/composer-sym
 /**
  * @param ComposerSymLog  $log
  * @param ComposerSym     $composerSym
  * @param ComposerSymCore $core
  * @param string          $package
  *
  * @throws \Garoevans\ComposerSym\Exception\ComposerSymException
  */
 private static function runSymLink(ComposerSymLog $log, ComposerSym $composerSym, ComposerSymCore $core, $package)
 {
     $potentialLocation = $core->getPotentialLinkLocation($package, $composerSym->homeDir);
     if (strlen($potentialLocation) === 0) {
         $linkTo = $core->getLinkLocation($package);
     } else {
         $linkTo = $potentialLocation;
     }
     // Move the existing package to a new temporary directory and symlink
     // to the local copy
     $tempLocation = build_path($composerSym->projectDir, $composerSym->vendor, $core->getTemporaryPackageName($package));
     $packageLocation = self::getPackageLocation($composerSym, $package);
     rename($packageLocation, $tempLocation);
     if (!symlink($linkTo, $packageLocation)) {
         rename($tempLocation, $packageLocation);
         throw new ComposerSymException("Failed creating sym link, this could be a privileges issue. Try" . "running the console with raised privileges.");
     }
     printf("> %s symlinked:\n", $package);
     printf(">> link: %s\n", $packageLocation);
     printf(">> target: %s\n", $linkTo);
     $log->addPackage($package, $packageLocation, $tempLocation);
     unset($linkTo);
     echo "\n";
 }
コード例 #15
0
ファイル: index.php プロジェクト: popdani95/phoneBook
                <div id="content">
				<?php 
if (isset($_GET['page']) && !empty($_GET['page'])) {
    switch ($_GET['page']) {
        case "add":
            include build_path(DIR_PAGES, 'add.php');
            break;
        case "delete":
            include build_path(DIR_PAGES, 'delete.php');
            break;
        case "search":
            include build_path(DIR_PAGES, 'list.php');
            break;
        case "edit":
            include build_path(DIR_PAGES, 'edit.php');
            break;
        default:
            include build_path(DIR_PAGES, 'list.php');
            break;
    }
} else {
    include build_path(DIR_PAGES, 'list.php');
}
?>
				
				 </div>
				
            </div>
        </center>
    </body>
</html>
コード例 #16
0
     }
     // code to left pad the TestID with 0s.
     $DisplayTestID = sprintf("%05s", trim($row['ReqID']));
     #if($rowcolor=='1'){
     #	$rowcolor='0';
     #	print"<TR BGCOLOR=#FFFFFF ALIGN=LEFT VALIGN=TOP>";
     #}
     #else{
     #	$rowcolor='1';
     #	print"<TR BGCOLOR=#FFFFCC ALIGN=LEFT VALIGN=TOP>";
     #}
     //print("<TR>");
     print "<TD><input type=checkbox></TD>";
     print "<TD><img src='./images/icons/file.gif'><A HREF= 'requirement_detail.php?reqID={$row['ReqID']}'> {$row['ReqFileName']}</A></TD>";
     print "<TD>";
     build_path($row['Req_Folder_ID'], "", $db);
     print "</TD>";
     print "<TD><A HREF= 'requirement_detail.php?reqID={$row['ReqID']}'>{$DisplayTestID}</A></TD>";
     print "<TD>{$row['Type']}</TD>";
     print "<TD>{$row['AreaSpecd']}</TD>";
     print "<TD>{$Status} &nbsp</TD>";
     print "<TD>{$latest_version}</TD>";
     if ($row['Locked_By']) {
         print "<TD><img src='./icons/lock.gif'>{$row['Locked_By']}</TD>";
     } else {
         print "<TD>&nbsp</TD>";
     }
     print "<TD>{$Assign_Release} &nbsp</TD>";
     print "<TD>{$Detail} &nbsp</TD>";
     print "</TR>";
 }
コード例 #17
0
 public function testGlobRecursive()
 {
     $baseDir = dirname(__DIR__);
     $this->assertContains(build_path($baseDir, 'composer.json'), glob_recursive($baseDir, '*.json'));
     $this->assertContains(build_path($baseDir, 'phpunit.xml'), glob_recursive($baseDir, '*.xml'));
     $this->assertContains(build_path($baseDir, 'src', 'includes', 'GlobalFunctions.php'), glob_recursive(build_path($baseDir, 'src', 'includes'), '*.php'));
     $this->assertContains(build_path($baseDir, 'src', 'Traits', 'ArrayAccessTrait.php'), glob_recursive($baseDir, '*.php'));
 }
コード例 #18
0
ファイル: DataSource.php プロジェクト: qubes/defero
 protected function _getLastIdPath($campaignId, $taskId)
 {
     $campaignDir = build_path("/var/lib/defero", class_shortname($this), $campaignId);
     if (!file_exists($campaignDir)) {
         mkdir($campaignDir, 0777, true);
     }
     $fileName = 'campaign-' . preg_replace('/[\\\\\\/\\:\\*\\?]/', '-', $taskId) . '.lastId';
     return build_path($campaignDir, $fileName);
 }
コード例 #19
0
ファイル: init.php プロジェクト: popdani95/Agenda
function __autoload($classname)
{
    require_once build_path(DIR_CLASSES, $classname . '.php');
}