function format_log($msg) { $msg = parent::format_log($msg); $msg or $msg = array(); foreach ($msg as $id => $arr) { $a = explode(" ", $arr["author"]); // need to strip the email address from the author field count($a) > 1 and array_pop($a); $msg[$id]["author"] = implode(" ", $a); } return $msg; }
function __construct($repo) { $current_user =& singleton("current_user"); $this->name = "darcs "; $this->repodir = $repo; $this->repoprefix = " --repodir=" . $repo . " "; $this->commit = " rec --author=" . escapeshellarg($current_user->get_name() . " <" . $current_user->get_value("emailAddress") . ">") . " --all -m "; $this->log = " changes --xml-output "; $this->metadir = "_darcs"; $this->add_everything = " add -r . "; $this->cat = ' show contents %1$s --match %2$s '; parent::__construct($repo); }
function __construct($repo) { $current_user =& singleton("current_user"); //$this->debug = true; $this->name = "git "; $this->repodir = $repo; $this->repoprefix = " --git-dir '" . $repo . ".git' --work-tree '" . $repo . "' "; $this->commit = " commit --author '" . $current_user->get_name() . " <" . $current_user->get_value("emailAddress") . ">' -m "; $this->metadir = ".git"; $this->add_everything = " add " . $repo . "/. "; $this->log = " log --pretty=format:'Hash: %H%nAuthor: %an%nDate: %ct%nMsg: %s' -M -C --follow "; $this->cat = ' show %2$s:%3$s '; parent::__construct($repo); }
function get_file($file, $rev = "") { global $TPL; $f = realpath(wiki_module::get_wiki_path() . $file); if (path_under_path(dirname($f), wiki_module::get_wiki_path())) { $mt = get_mimetype($f); if (strtolower($mt) != "text/plain") { $s = "<h6>Download File</h6>"; $s .= "<a href='" . $TPL["url_alloc_fileDownload"] . "file=" . urlencode($file) . "'>" . $file . "</a>"; $TPL["str_html"] = $s; include_template("templates/fileGetM.tpl"); exit; } // Get the regular revision ... $disk_file = file_get_contents($f) or $disk_file = ""; $vcs = vcs::get(); //$vcs->debug = true; // Get a particular revision if ($vcs) { $vcs_file = $vcs->cat($f, $rev); } if ($vcs && wiki_module::nuke_trailing_spaces_from_all_lines($disk_file) != wiki_module::nuke_trailing_spaces_from_all_lines($vcs_file)) { if (!$vcs_file) { $TPL["msg"] = "<div class='message warn noprint' style='margin-top:0px; margin-bottom:10px; padding:10px;'>\n Warning: This file may not be under version control.\n </div>"; } else { $TPL["msg"] = "<div class='message warn noprint' style='margin-top:0px; margin-bottom:10px; padding:10px;'>\n Warning: This file may not be the latest version.\n </div>"; } } if ($rev && $vcs_file) { $TPL["str"] = $vcs_file; } else { $TPL["str"] = $disk_file; } $wikiMarkup = config::get_config_item("wikiMarkup"); $TPL["str_html"] = $wikiMarkup($TPL["str"]); $TPL["rev"] = urlencode($rev); include_template("templates/fileGetM.tpl"); } }
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ require_once "../alloc.php"; $file = $_POST["file"] or $file = $_GET["file"]; $TPL["file"] = $file; $editName = $_POST["editName"]; $TPL["editName"] = $_POST["editName"]; // Decode the wiki document .. $text = html_entity_decode($_POST["wikitext"]); $text = str_replace("\r\n", "\n", $text); // Check if we're using a VCS $vcs = vcs::get(); if ($_POST["save"]) { path_under_path(wiki_module::get_wiki_path() . dirname($editName), wiki_module::get_wiki_path()) or $errors[] = "Bad filename: " . $editName; is_writeable(wiki_module::get_wiki_path() . dirname($editName)) or $errors[] = "Path is not writeable."; strlen($_POST["wikitext"]) or $errors[] = "File contents empty."; strlen($editName) or $errors[] = "Filename empty."; strlen($_POST["commit_msg"]) or $errors[] = "No description of changes entered."; if ($errors) { $error = "<div class='message warn noprint' style='margin-top:0px; margin-bottom:10px; padding:10px;'>"; $error .= implode("<br>", $errors); $error .= "</div>"; $TPL["loadErrorPage"] = 1; $TPL["str"] = urlencode($_POST["wikitext"]); $TPL["commit_msg"] = urlencode($_POST["commit_msg"]); $TPL["file"] = urlencode($editName); $TPL["msg"] = $error;