示例#1
0
// Delete Bible handler.
if (isset($_GET['delete'])) {
    $bible = $_GET['delete'];
    @($confirm = $_GET['confirm']);
    if ($confirm != "") {
        ignore_user_abort(true);
        set_time_limit(0);
        // User needs write access for delete operation.
        if (Access_Bible::write($bible)) {
            Bible_Logic::deleteBible($bible);
            $gitdirectory = Filter_Git::git_directory($bible);
            if (file_exists($gitdirectory)) {
                Filter_Rmdir::rmdir($gitdirectory);
            }
        } else {
            Assets_Page::error("Insufficient privileges to complete action");
        }
    } else {
        $dialog_yes = new Dialog_Yes(NULL, Locale_Translate::_("Would you like to delete Bible {$bible}?"), "delete");
        die;
    }
}
// New Bible handler.
if (isset($_GET['new'])) {
    $dialog_entry = new Dialog_Entry("", Locale_Translate::_("Please enter a name for the new empty Bible"), "", "new", "");
    die;
}
if (isset($_POST['new'])) {
    $bible = $_POST['entry'];
    $bibles = $database_bibles->getBibles();
    if (in_array($bible, $bibles)) {
示例#2
0
    foreach ($bibles as $bible) {
        if ($font == $database_config_bible->getTextFont($bible)) {
            $font_in_use = true;
        }
    }
    if (!$font_in_use) {
        unlink($font);
    } else {
        Assets_Page::error(Locale_Translate::_("The font could not be deleted because it is in use."));
    }
}
// Upload a font.
if (isset($_POST['upload'])) {
    // Upload may take time in case the file is large or the network is slow.
    ignore_user_abort(true);
    set_time_limit(0);
    $filename = $_FILES['data']['name'];
    $tmpfile = $_FILES['data']['tmp_name'];
    if (move_uploaded_file($tmpfile, $filename)) {
        Assets_Page::success(Locale_Translate::_("The font has been uploaded."));
    } else {
        Assets_Page::error(Filter_Upload::error2text($_FILES['data']['error']));
    }
}
$header = new Assets_Header(Locale_Translate::_("Fonts"));
$header->run();
$view = new Assets_View(__FILE__);
$view->view->upload_max_filesize = ini_get("upload_max_filesize");
$view->view->fonts = Fonts_Logic::getFonts();
$view->render("index.php");
Assets_Page::footer();
示例#3
0
 /**
  * Uncompresses a .tar.gz archive identified by $file.
  * Returns the path to the folder it created.
  * If $show_errors is true, it outputs errors in html.
  */
 public static function untargz($file, $show_errors)
 {
     $file = escapeshellarg($file);
     $folder = uniqid(sys_get_temp_dir() . "/");
     mkdir($folder);
     exec("cd {$folder} && tar zxf {$file} 2>&1", $output, $return_var);
     if ($return_var != 0) {
         Filter_Rmdir::rmdir($folder);
         $folder = NULL;
         if ($show_errors) {
             Assets_Page::error(Locale_Translate::_("Failed to uncompress archive"));
             foreach ($output as $line) {
                 Assets_Page::error($line);
             }
             Assets_Page::error("Return status: {$return_var}");
         }
     }
     return $folder;
 }
示例#4
0
        if ($write) {
            $database_styles->deleteSheet($delete);
            $database_styles->revokeWriteAccess("", $delete);
            Assets_Page::success(Locale_Translate::_("The stylesheet has been deleted"));
        }
    } else {
        $dialog_yes = new Dialog_Yes(NULL, Locale_Translate::_("Would you like to delete this stylesheet?"), "delete");
        die;
    }
}
// Delete empty sheet that may have been there.
$database_styles->deleteSheet("");
if (isset($_POST['new'])) {
    $name = $_POST['entry'];
    if (in_array($name, $database_styles->getSheets())) {
        Assets_Page::error(Locale_Translate::_("This stylesheet already exists"));
    } else {
        $database_styles->createSheet($name);
        $database_styles->grantWriteAccess($username, $name);
        Styles_Sheets::create_all();
        Assets_Page::success(Locale_Translate::_("The stylesheet has been created"));
    }
}
if (isset($_GET['new'])) {
    $dialog_entry = new Dialog_Entry("", Locale_Translate::_("Please enter the name for the new stylesheet"), "", "new", "");
    die;
}
$sheets = $database_styles->getSheets();
$editable = array();
foreach ($sheets as $sheet) {
    $write = $database_styles->hasWriteAccess($username, $sheet);
示例#5
0
        Assets_Page::success(Locale_Translate::_("The style has been created"));
    }
}
if (isset($_GET['new'])) {
    $dialog_entry = new Dialog_Entry(array("name" => $name), Locale_Translate::_("Please enter the name for the new style"), "", "new", "");
    die;
}
if (isset($_POST['submit'])) {
    $data = $_POST['data'];
    if ($data != "") {
        if ($write) {
            $database_styles->deleteSheet($name);
            $database_styles->importXml($name, $data);
            Assets_Page::success(Locale_Translate::_("The stylesheet has been imported"));
        } else {
            Assets_Page::error(Locale_Translate::_("No write access to the stylesheet"));
        }
    }
}
@($delete = $_GET['delete']);
if ($delete != "") {
    if ($write) {
        $database_styles->deleteMarker($name, $delete);
    }
}
$markers_names = $database_styles->getMarkersAndNames($name);
foreach ($markers_names as $row) {
    $markers[] = $row['marker'];
    $names[] = $row['name'];
}
$view->view->markers = $markers;
示例#6
0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
$database_usfmresources = Database_UsfmResources::getInstance();
@($delete = $_GET['delete']);
if (isset($delete)) {
    if (Access_Bible::write($delete)) {
        $database_usfmresources->deleteResource($delete);
    } else {
        Assets_Page::error(Locale_Translate::_("You do not have write access to this resource"));
    }
}
@($convert = $_GET['convert']);
if (isset($convert)) {
    if (Access_Bible::write($convert)) {
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/convert2bible.php", $convert));
        Filter_Url::redirect("../journal/index.php");
        die;
    } else {
        Assets_Page::error(Locale_Translate::_("Insufficient privileges"));
    }
}
$header = new Assets_Header(Locale_Translate::_("USFM Resources"));
$header->jQueryUIOn("dialog");
$header->run();
$view = new Assets_View(__FILE__);
$resources = $database_usfmresources->getResources();
$view->view->resources = $resources;
$view->render("manage.php");
Assets_Page::footer();
示例#7
0
文件: css.php 项目: alerque/bibledit
$view = new Assets_View(__FILE__);
$database_config_bible = Database_Config_Bible::getInstance();
// The name of the Bible.
$bible = Access_Bible::clamp($_GET['bible']);
$view->view->bible = Filter_Html::sanitize($bible);
// Data submission.
if (isset($_POST['submit'])) {
    $font = $_POST["font"];
    $font = trim($font);
    $database_config_bible->setTextFont($bible, $font);
    $direction = $_POST["direction"];
    $direction = Filter_CustomCSS::directionValue($direction);
    $mode = $_POST["mode"];
    $mode = Filter_CustomCSS::writingModeValue($mode);
    $database_config_bible->setTextDirection($bible, $mode * 10 + $direction);
    Assets_Page::error("The information was saved.");
}
$font = $database_config_bible->getTextFont($bible);
$view->view->font = $font;
$direction = $database_config_bible->getTextDirection($bible);
$view->view->direction_none = Filter_CustomCSS::directionUnspecified($direction);
$view->view->direction_ltr = Filter_CustomCSS::directionLeftToRight($direction);
$view->view->direction_rtl = Filter_CustomCSS::directionRightToLeft($direction);
$view->view->mode_none = Filter_CustomCSS::writingModeUnspecified($direction);
$view->view->mode_tblr = Filter_CustomCSS::writingModeTopBottomLeftRight($direction);
$view->view->mode_tbrl = Filter_CustomCSS::writingModeTopBottomRightLeft($direction);
$view->view->mode_btlr = Filter_CustomCSS::writingModeBottomTopLeftRight($direction);
$view->view->mode_btrl = Filter_CustomCSS::writingModeBottomTopRightLeft($direction);
$class = Filter_CustomCSS::getClass($bible);
$view->view->custom_class = $class;
$view->view->custom_css = Filter_CustomCSS::getCss($class, Fonts_Logic::getFontPath($font), $direction);
示例#8
0
// User's email address.
@($email = $_GET['email']);
if (isset($email)) {
    if ($email == "") {
        $dialog_entry = new Dialog_Entry(array("usernamemail" => $_GET['user']), Locale_Translate::_("Please enter an email address for the user"), $database_users->getUserToEmail($user), "email", "");
        die;
    }
}
if (isset($_POST['email'])) {
    $email = $_POST['entry'];
    $validator = new Zend_Validate_EmailAddress();
    if ($validator->isValid($email)) {
        Assets_Page::success(Locale_Translate::_("Email address was updated"));
        $database_users->updateUserEmail($_GET['usernamemail'], $email);
    } else {
        Assets_Page::error(Locale_Translate::_("The email address is not valid"));
    }
}
// Fetch the Bibles the current user has access to.
$accessibleBibles = $database_bibles->getBibles();
foreach ($accessibleBibles as $offset => $bible) {
    if (!$database_users->hasAccess2Bible($currentUser, $bible)) {
        unset($accessibleBibles[$offset]);
    }
}
$accessibleBibles = array_values($accessibleBibles);
sort($accessibleBibles);
// Add Bible to user account.
@($addbible = $_GET['addbible']);
if (isset($addbible)) {
    if ($addbible == "") {
示例#9
0
Copyright (©) 2003-2014 Teus Benschop.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
Assets_Page::header(Locale_Translate::_("Import"));
set_time_limit(0);
$folder = $_GET['folder'];
if (file_exists($folder)) {
    $workingdirectory = dirname(__FILE__);
    $command = "php {$workingdirectory}/importcli.php {$folder}";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$workingdirectory}/importcli.php", $folder));
    $view = new Assets_View(__FILE__);
    $view->render("import4.php");
} else {
    Assets_Page::error(Locale_Translate::_("Could not find the folder with the consultation notes"));
}
Assets_Page::footer();
示例#10
0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
$view = new Assets_View(__FILE__);
@($bible = $_GET['bible']);
$view->view->bible = $bible;
$database_resources = Database_Resources::getInstance();
$database_usfmresources = Database_UsfmResources::getInstance();
$usfmResources = $database_usfmresources->getResources();
if (in_array($bible, $usfmResources)) {
    $view->view->error = Locale_Translate::_("A USFM Resource with this name already exists");
}
$externalResources = $database_resources->getNames();
if (in_array($bible, $externalResources)) {
    $view->view->error = Locale_Translate::_("An external resource with this name already exists");
}
@($convert = $_GET['convert']);
if (isset($convert)) {
    if (Access_Bible::write($bible)) {
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/convert2resource.php", $bible));
        Filter_Url::redirect("../journal/index.php");
        die;
    } else {
        Assets_Page::error(Locale_Translate::_("Insufficient privileges to complete operation."));
    }
}
$header = new Assets_Header(Locale_Translate::_("Convert"));
$header->run();
$view->render("bible2resource.php");
Assets_Page::footer();
示例#11
0
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
Assets_Page::header(Locale_Translate::_("Verse Mappings"));
$view = new Assets_View(__FILE__);
$database_mappings = Database_Mappings::getInstance();
$session_logic = Session_Logic::getInstance();
$username = $session_logic->currentUser();
$userlevel = $session_logic->currentLevel();
if (isset($_POST['new'])) {
    $name = $_POST['entry'];
    if (in_array($name, $database_mappings->names())) {
        Assets_Page::error(Locale_Translate::_("This verse mapping already exists"));
    } else {
        $database_mappings->create($name);
    }
}
if (isset($_GET['new'])) {
    $dialog_entry = new Dialog_Entry("", Locale_Translate::_("Enter a name for the new verse mapping"), "", "new", "");
    die;
}
$mappings = $database_mappings->names();
$editable = array();
foreach ($mappings as $mapping) {
    //$write = $database_styles->hasWriteAccess ($username, $sheet);
    $write = true;
    if ($userlevel >= Filter_Roles::ADMIN_LEVEL) {
        $write = true;