function getReplacedConnectionFileForSimpleApp($arguments = "") { $rootFolder = FILES_TO_COPY_PHP_TEMPLATE_SIMPLE; $rootCommon = $rootFolder . FILE_SEPARATOR . "common"; if ($arguments != "") { $thisDb = $arguments['db']; } if (HAVE_AUTHENTICATION) { $dbUserName = $_SESSION['dbUserName']; $dbHostName = $_SESSION['dbHostName']; $encDbPassword = $_SESSION['dbPassword']; $thisEncrypter = new textEncrypter(); $unEncodedDbPassword = $thisEncrypter->decode($encDbPassword); } else { $dbUserName = DATABASE_USER_NAME; $dbHostName = DATABASE_HOST; $unEncodedDbPassword = DATABASE_PASSWORD; } // DB CONNECTION FILE TO REPLACE $replacePair = array(); $replacePair[] = new pair("{DB_HOST}", $dbHostName); $replacePair[] = new pair("{DB_USER}", $dbUserName); $replacePair[] = new pair("{DB_PASSWORD}", $unEncodedDbPassword); $replacePair[] = new pair("{DB_NAME}", $thisDb); $dbConnectionFileName = $rootCommon . FILE_SEPARATOR . "dbConnection.php"; $newDbConnectionText = stringUtils::replaceStringInFileAndReturnString($dbConnectionFileName, $replacePair); return $newDbConnectionText; }
<div class="path"> <?php if (null !== $statusAction->getRepository()) { echo link_to($statusAction->getRepository(), 'default/branchList', array('query_string' => 'repository=' . $statusAction->getRepositoryId())); } ?> <?php if (null !== $statusAction->getBranch()) { ?> > <?php echo link_to($statusAction->getBranch(), 'default/fileList', array('query_string' => 'branch=' . $statusAction->getBranchId())); } ?> <?php if (null !== $statusAction->getFile()) { ?> > <?php echo link_to(stringUtils::lshorten($statusAction->getFile(), 50), 'default/file', array('query_string' => 'file=' . $statusAction->getFileId(), 'title' => $statusAction->getFile())); } ?> </div> </td> </tr> <?php } ?> </table> </div> </div> <?php }
function xReplaceStringInFiles($rootDirectory, $replacementPairs) { if (!is_dir($rootDirectory)) { return 0; } else { $handle = @dir($rootDirectory); while (@($entry = $handle->read()) !== false) { if ($entry != "." && $entry != ".." && $entry != "cvs" && $entry != "CVS") { if (is_dir("{$source}/{$entry}") && $dest !== $source . FILE_SEPARATOR . $entry) { fileSystemUtils::xReplaceStringInFiles($source . FILE_SEPARATOR . $entry, $replacementPairs); } else { stringUtils::replaceStringInFileAndSaveFile($rootDirectory . FILE_SEPARATOR . $entry, $replacementPairs); } } } $handle->close(); return 1; } }
echo url_for("default/file"); ?> ?file=<?php echo $file['Id']; ?> " title="<?php echo stringUtils::trimTicketInfos($file['LastChangeCommitDesc']); ?> "><?php } ?> <span style="display: none;"><?php echo $pathDir !== "." ? stringUtils::lshorten($pathDir . '/', $maxLength - strlen($filename)) : ''; ?> </span><?php echo stringUtils::lshorten($filename, $maxLength); ?> <?php if ($file['IsBinary']) { ?> </a><?php } ?> </h3> </td> <td class="view_infos"> <?php if ($file['NbFileComments']) { ?> <span class="ricon<?php $file['NbFileCommentsNotChecked'] == 0 && (print ' ricon0');
/** * @param string $type * @param string $comment */ protected function createCommentNotificationMessage($type, $comment) { $configEvent = $this->getEventConfig('comment'); $message = ''; if (isset($configEvent[$type . '_message'])) { $message = $configEvent[$type . '_message']; $message = str_replace('%branch%', $comment->getBranch()->__toString(), $message); $message = str_replace('%message%', stringUtils::shorten($comment->getValue(), 40, '...', true), $message); $message = str_replace('%date%', date('d/m/Y H:i'), $message); $message = str_replace('%author%', $this->subject->getUser()->__toString(), $message); switch ($type) { case 'line': $message = str_replace('%line%', $comment->getLine(), $message); case 'file': $message = str_replace('%file%', $comment->getFile()->getFilename(), $message); } if (isset($configEvent['add-links']) && $configEvent['add-links']) { switch ($type) { case 'branch': $link = " : " . $this->generateUrl('fileList', array('branch' => $comment->getBranch()->getId(), 'anchor' => 'comment-' . $comment->getId())); break; case 'file': case 'line': $link = " : " . $this->generateUrl('file', array('file' => $comment->getFileId(), 'anchor' => 'comment-' . $comment->getId())); break; } $message .= $link; } } return $message; }
<h3> <?php if ($branch['reviewRequest'] == 1) { ?> <span class="new">new!</span><?php } ?> <?php echo link_to($branch['name'], 'default/fileList', array('query_string' => 'branch=' . $branch['id'])); ?> </h3><br /> <span title="<?php echo $branch['lastCommitDesc']; ?> " class="commit_desc tooltip"><?php echo stringUtils::shorten(stringUtils::trimTicketInfos($branch['lastCommitDesc']), 105); ?> </span> </td> <td class="branch_ago"><?php echo time_ago_in_words($branch['created']); ?> ago</td> <td class="branch_infos"> <?php echo $branch['total'] . ' files'; ?> <?php if ($branch['added']) { ?> <span class="added tooltip" title="<?php
function replaceApplicationRootForSimpleGen($rootDirectory, $rootURL) { $commonPath = $rootDirectory . FILE_SEPARATOR . "common"; $filesToChange = ""; $filesToChange[] = $commonPath . FILE_SEPARATOR . "footer.php"; $filesToChange[] = $commonPath . FILE_SEPARATOR . "header.php"; $replacementPairs = ""; $replacementPairs[] = new pair("{APPLICATION_ROOT}", $rootURL); for ($a = 0; $a < count($filesToChange); $a++) { stringUtils::replaceStringInFileAndSaveFile($filesToChange[$a], $replacementPairs); } }
if (!empty($commentBoard['ProjectId'])) { echo link_to($commentBoard['ProjectName'], 'default/branchList', array('query_string' => 'repository=' . $commentBoard['ProjectId'])); } ?> <?php if (!empty($commentBoard['BranchId'])) { ?> > <?php echo link_to($commentBoard['BranchName'], 'default/fileList', array('query_string' => 'branch=' . $commentBoard['BranchId'])); } ?> <?php if (!empty($commentBoard['FileId'])) { ?> > <?php echo link_to(stringUtils::lshorten($commentBoard['FileName'], 40), 'default/file', array('query_string' => 'file=' . $commentBoard['FileId'], 'title' => $commentBoard['FileName'], 'class' => 'tooltip')); } ?> <?php if (!empty($commentBoard['Position'])) { ?> > <?php echo link_to(sprintf('line %s', $commentBoard['Line']), 'default/file', array('query_string' => sprintf('file=%s#position_%s', $commentBoard['FileId'], $commentBoard['Position']))); } ?> </div> </td> </tr> <?php } ?>
?> " /> <?php echo $file->getsfGuardUser()->getProfile()->__toString(); ?> : <?php } ?> </span> <span class="tooltip" title="<?php echo stringUtils::trimTicketInfos($file->getLastChangeCommitDesc()); ?> "> <?php echo stringUtils::shorten(stringUtils::trimTicketInfos($file->getLastChangeCommitDesc()), 65); ?> </span> <ul class="right dropdown-action"> <li class="dropdown"> <?php if (BranchPeer::OK === $file->getStatus()) { ?> <?php echo link_to('Ã', 'default/changeStatus', array('query_string' => sprintf('type=file&id=%s&status=%s', $file->getId(), BranchPeer::OK), 'class' => 'dropdown-toggle ricon validate tooltip', 'title' => 'Validated')); ?> <ul class="dropdown-menu"> <lI><?php echo link_to('Â', 'default/changeStatus', array('query_string' => sprintf('type=file&id=%s&status=%s', $file->getId(), BranchPeer::KO), 'class' => 'ricon invalidate item-status-action tooltip', 'title' => 'Invalidated')); ?> </lI>
<?php } ?> <?php if ($currentBreadCrumbFile) { ?> <?php $fileNeedList = sizeof($fileBreadCrumbList); ?> <li class="selected<?php echo $fileNeedList ? ' dropdown' : ''; ?> "> <span class="ricon">E</span> <?php echo link_to(stringUtils::shortenFilePath($currentBreadCrumbFile), 'default/file?file=' . $currentBreadCrumbFile->getId(), array('class' => 'tooltip', 'title' => $currentBreadCrumbFile)); ?> <?php if ($fileNeedList) { ?> <?php echo link_to('@', '@homepage', array('class' => 'dropdown-toggle')); ?> <ul class="dropdown-menu"> <?php foreach ($fileBreadCrumbList as $item) { ?> <li> <span class="ricon"><?php if ($item->getStatus() == 1) { ?>
function replaceStringInFileAndSaveFile($fullFileName, $replacementPairs) { $fileString = fileSystemUtils::getStringFromFile($fullFileName); $newString = stringUtils::replaceAndGetNewString($fileString, $replacementPairs); return fileSystemUtils::saveStringInFile($fullFileName, $newString); }