Updated installation files
This commit is contained in:
parent
b1e5b153df
commit
3f95b62c25
5 changed files with 18 additions and 9 deletions
|
@ -757,7 +757,7 @@ class YellowPage {
|
|||
}
|
||||
|
||||
// Return page setting as language specific date format, relative to today
|
||||
public function getDateRelative($key, $format = "", $daysLimit = 0) {
|
||||
public function getDateRelative($key, $format = "", $daysLimit = 30) {
|
||||
if (!empty($format)) {
|
||||
$format = $this->yellow->text->get($format);
|
||||
} else {
|
||||
|
@ -767,7 +767,7 @@ class YellowPage {
|
|||
}
|
||||
|
||||
// Return page setting as language specific date format, relative to today, HTML encoded
|
||||
public function getDateRelativeHtml($key, $format = "", $daysLimit = 0) {
|
||||
public function getDateRelativeHtml($key, $format = "", $daysLimit = 30) {
|
||||
return htmlspecialchars($this->getDateRelative($key, $format, $daysLimit));
|
||||
}
|
||||
|
||||
|
@ -1754,8 +1754,8 @@ class YellowText {
|
|||
public function getDateRelative($timestamp, $format, $daysLimit) {
|
||||
$timeDifference = time() - $timestamp;
|
||||
$days = abs(intval($timeDifference / 86400));
|
||||
$tokens = preg_split("/\s*,\s*/", $this->get($timeDifference>=0 ? "datePast" : "dateFuture"));
|
||||
if ($days<=$daysLimit || $daysLimit==0) {
|
||||
$tokens = preg_split("/\s*,\s*/", $this->get($timeDifference>=0 ? "datePast" : "dateFuture"));
|
||||
if ($days==0) {
|
||||
$output = $tokens[0];
|
||||
} elseif ($days==1) {
|
||||
|
@ -1772,7 +1772,7 @@ class YellowText {
|
|||
$output = preg_replace("/@x/i", intval($days/365.25), $tokens[6]);
|
||||
}
|
||||
} else {
|
||||
$output = $this->getDateFormatted($timestamp, $format);
|
||||
$output = preg_replace("/@x/i", $this->getDateFormatted($timestamp, $format), $tokens[7]);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowEdit {
|
||||
const VERSION = "0.8.4";
|
||||
const VERSION = "0.8.5";
|
||||
const TYPE = "feature";
|
||||
public $yellow; //access to API
|
||||
public $response; //web response
|
||||
|
@ -161,6 +161,7 @@ class YellowEdit {
|
|||
$status = "ok";
|
||||
list($command, $option, $email, $password, $name) = $args;
|
||||
if (empty($email) || empty($password)) $status = $this->response->status = "incomplete";
|
||||
if (empty($name)) $name = $this->yellow->system->get("sitename");
|
||||
if ($status=="ok") $status = $this->getUserAccount($email, $password, "add");
|
||||
if ($status=="ok" && $this->users->isTaken($email)) $status = "taken";
|
||||
switch ($status) {
|
||||
|
@ -173,6 +174,7 @@ class YellowEdit {
|
|||
$fileNameUser = $this->yellow->system->get("settingDir").$this->yellow->system->get("editUserFile");
|
||||
$status = $this->users->save($fileNameUser, $email, $password, $name, "", "active") ? "ok" : "error";
|
||||
if ($status=="error") echo "ERROR updating settings: Can't write file '$fileNameUser'!\n";
|
||||
$this->yellow->log($status=="ok" ? "info" : "error", "Add user '".strtok($name, " ")."'");
|
||||
}
|
||||
if ($status=="ok") {
|
||||
$algorithm = $this->yellow->system->get("editUserHashAlgorithm");
|
||||
|
@ -210,7 +212,9 @@ class YellowEdit {
|
|||
public function userRemove($args) {
|
||||
$status = "ok";
|
||||
list($command, $option, $email) = $args;
|
||||
$name = $this->users->getName($email);
|
||||
if (empty($email)) $status = $this->response->status = "invalid";
|
||||
if (empty($name)) $name = $this->yellow->system->get("sitename");
|
||||
if ($status=="ok") $status = $this->getUserAccount($email, "", "remove");
|
||||
if ($status=="ok" && !$this->users->isExisting($email)) $status = "unknown";
|
||||
switch ($status) {
|
||||
|
@ -221,6 +225,7 @@ class YellowEdit {
|
|||
$fileNameUser = $this->yellow->system->get("settingDir").$this->yellow->system->get("editUserFile");
|
||||
$status = $this->users->remove($fileNameUser, $email) ? "ok" : "error";
|
||||
if ($status=="error") echo "ERROR updating settings: Can't write file '$fileNameUser'!\n";
|
||||
$this->yellow->log($status=="ok" ? "info" : "error", "Remove user '".strtok($name, " ")."'");
|
||||
}
|
||||
$statusCode = $status=="ok" ? 200 : 500;
|
||||
echo "Yellow $command: User account ".($statusCode!=200 ? "not " : "")."removed\n";
|
||||
|
@ -374,6 +379,7 @@ class YellowEdit {
|
|||
$fileNameUser = $this->yellow->system->get("settingDir").$this->yellow->system->get("editUserFile");
|
||||
$this->response->status = $this->users->save($fileNameUser, $email, "", "", "", "active") ? "ok" : "error";
|
||||
if ($this->response->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
|
||||
$this->yellow->log($status=="ok" ? "info" : "error", "Add user '".strtok($this->users->getName($email), " ")."'");
|
||||
}
|
||||
if ($this->response->status=="ok") {
|
||||
$this->response->status = $this->response->sendMail($scheme, $address, $base, $email, "welcome") ? "done" : "error";
|
||||
|
@ -618,6 +624,7 @@ class YellowEdit {
|
|||
$fileNameUser = $this->yellow->system->get("settingDir").$this->yellow->system->get("editUserFile");
|
||||
$this->response->status = $this->users->save($fileNameUser, $email, "", "", "", "removed") ? "ok" : "error";
|
||||
if ($this->response->status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameUser'!");
|
||||
$this->yellow->log($status=="ok" ? "info" : "error", "Remove user '".strtok($this->users->getName($email), " ")."'");
|
||||
}
|
||||
if ($this->response->status=="ok") {
|
||||
$this->response->status = $this->response->sendMail($scheme, $address, $base, $email, "goodbye") ? "ok" : "error";
|
||||
|
@ -1132,11 +1139,11 @@ class YellowEditResponse {
|
|||
$toolbarButtons = $this->yellow->system->get("editToolbarButtons");
|
||||
if ($toolbarButtons=="auto") {
|
||||
$toolbarButtons = "";
|
||||
if ($this->yellow->extensions->isExisting("markdown")) $toolbarButtons = "preview, format, bold, italic, strikethrough, code, list, link, file";
|
||||
if ($this->yellow->extensions->isExisting("markdown")) $toolbarButtons = "format, bold, italic, strikethrough, code, list, link, file";
|
||||
if ($this->yellow->extensions->isExisting("emojiawesome")) $toolbarButtons .= ", emojiawesome";
|
||||
if ($this->yellow->extensions->isExisting("fontawesome")) $toolbarButtons .= ", fontawesome";
|
||||
if ($this->yellow->extensions->isExisting("draft")) $toolbarButtons .= ", draft";
|
||||
if ($this->yellow->extensions->isExisting("markdown")) $toolbarButtons .= ", markdown";
|
||||
if ($this->yellow->extensions->isExisting("markdown")) $toolbarButtons .= ", preview, markdown";
|
||||
}
|
||||
} else {
|
||||
$toolbarButtons = $this->yellow->system->get("{$name}ToolbarButtons");
|
||||
|
@ -1518,7 +1525,8 @@ class YellowEditUsers {
|
|||
$fileData = $this->yellow->toolbox->readFile($fileName);
|
||||
foreach ($this->yellow->toolbox->getTextLines($fileData) as $line) {
|
||||
preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches);
|
||||
if (!empty($matches[1]) && !empty($matches[2]) && $matches[1]!=$email) $fileDataNew .= $line;
|
||||
if (!empty($matches[1]) && $matches[1]==$email) continue;
|
||||
$fileDataNew .= $line;
|
||||
}
|
||||
return $this->yellow->toolbox->createFile($fileName, $fileDataNew);
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -154,6 +154,7 @@ class YellowInstall {
|
|||
public function updateUser($email, $password, $name, $language) {
|
||||
$statusCode = 200;
|
||||
if (!empty($email) && !empty($password) && $this->yellow->extensions->isExisting("edit")) {
|
||||
if (empty($name)) $name = $this->yellow->system->get("sitename");
|
||||
$fileNameUser = $this->yellow->system->get("settingDir").$this->yellow->system->get("editUserFile");
|
||||
if (!$this->yellow->extensions->get("edit")->users->save($fileNameUser, $email, $password, $name, $language)) {
|
||||
$statusCode = 500;
|
||||
|
@ -304,7 +305,7 @@ class YellowInstall {
|
|||
$rawData .= "<p>".$this->yellow->text->get("installExtension")."<p>";
|
||||
foreach ($this->getExtensionsInstall() as $extension) {
|
||||
$checked = $extension=="website" ? " checked=\"checked\"" : "";
|
||||
$rawData .= "<label for=\"$extension\"><input type=\"radio\" name=\"extension\" id=\"$extension\" value=\"$extension\"$checked> ".ucfirst($extension)."</label><br />";
|
||||
$rawData .= "<label for=\"$extension\"><input type=\"radio\" name=\"extension\" id=\"$extension\" value=\"$extension\"$checked> ".$this->yellow->text->getHtml("installExtension".ucfirst($extension))."</label><br />";
|
||||
}
|
||||
$rawData .= "</p>\n";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue