コード例 #1
0
 public static function formatLink($l, $limit)
 {
     $b = substr($l, 0, 7);
     $p = '<span title="';
     $r = $l;
     $a = '</span>';
     if ($b == "http://" || $b == "https:/" && strlen($l) > 7 && $l[7] == '/') {
         $p = '<a href="';
         $a = '</a>';
         $r = substr($l, $b == "http://" ? 7 : 8);
     }
     return $p . KphpUI::makePrintable($l) . '">' . KphpUI::makePrintable(strlen($r) > $limit ? substr($r, 0, $limit - 3) . "..." : $r) . $a;
 }
コード例 #2
0
ファイル: mainui.php プロジェクト: rolandkohn/KeePassPHP-UI
 private function displayControlGroup($k, $label)
 {
     $i = $this->inputs[$k];
     $d = $i[0] == 'checkbox' ? isset($_POST['submitted']) && !isset($_POST[$k]) ? null : 'checked="checked"' : ($i[0] == 'text' && isset($_POST[$k]) ? 'value="' . parent::makePrintable($_POST[$k]) . '"' : null);
     return '<div class="control-group' . ($i[3] != null ? ' ' . $i[3] : '') . '">' . '<label class="control-label" for="' . $k . '">' . $label . '</label>' . '<div class="controls"><input type="' . $i[0] . '" id="' . $k . '" name="' . $k . '"' . ($d != null ? ' ' . $d : '') . ($i[1] != null ? ' ' . $i[1] : '') . ' />' . ($i[2] == null ? '' : self::START_HI_NOHIDE . $i[2] . '</span>') . '</div></div>';
 }
コード例 #3
0
ファイル: ajaxui.php プロジェクト: rolandkohn/KeePassPHP-UI
 public function __construct($defaultResult = self::FAIL)
 {
     parent::__construct();
     $this->result = $defaultResult;
     $this->html = "";
 }
コード例 #4
0
ファイル: ajaxopen.php プロジェクト: rolandkohn/KeePassPHP-UI
<?php

require_once "kphpui/conf.php";
require_once "kphpui/ajaxui.php";
$isPwd = KphpUI::getString("r", $_GET) == "p" && ($uuid = KphpUI::getString("uuid", $_POST)) != null;
$dbid = KphpUI::getString("dbid", $_POST);
$pwd = KphpUI::getString("mainPwd", $_POST);
$usePwdForCK = KphpUI::getString("usePwdForCK", $_POST, "0") != "0";
$otherPwd = KphpUI::getString("openPwd1", $_POST);
$ui = new AjaxUI(AjaxUI::FAIL);
if (strlen($dbid) == 0) {
    $ui->setResult(AjaxUI::SOMETHING_EMPTY);
    $ui->setHTML("dbid");
} elseif (strlen($pwd) == 0) {
    $ui->setResult(AjaxUI::SOMETHING_EMPTY);
    $ui->setHTML("mainPwd");
} elseif (!$usePwdForCK && strlen($otherPwd) == 0) {
    $ui->setResult(AjaxUI::SOMETHING_EMPTY);
    $ui->setHTML("openPwd1");
} else {
    require_once KEEPASSPHP_LOCATION;
    KeePassPHP::init(KEEPASSPHP_DEBUG);
    if (KeePassPHP::exists($dbid)) {
        $db = KeePassPHP::get($dbid, $pwd, $usePwdForCK ? $pwd : $otherPwd);
        if ($db != null && $db->tryLoad()) {
            require_once "kphpui/htmlformat.php";
            if ($isPwd) {
                $pwd = $db->getPassword($uuid);
                if ($pwd != null) {
                    $ui->setResult(AjaxUI::SUCCESS);
                    $ui->addHTML(HTMLFormat::formatPassword($pwd));
コード例 #5
0
ファイル: index.php プロジェクト: rolandkohn/KeePassPHP-UI
    }
    return $f['tmp_name'];
}
$ui = new MainUI();
$submitted = KphpUI::getString("submitted", $_POST);
if ($submitted == "add") {
    if (($dbid = KphpUI::getString("addDbid", $_POST)) == "") {
        $ui->setIfEmpty("addDbid", MainUI::HI_EMPTY, "warning");
    }
    if (($mainPwd = KphpUI::getString("addMainPwd", $_POST)) == "") {
        $ui->setIfEmpty("addMainPwd", MainUI::HI_EMPTY, "warning");
    }
    $kdbxFile = checkFile("addKdbxFile", getFile("addKdbxFile"), $ui);
    $pwd1 = KphpUI::getString("addPwd1", $_POST);
    $keyfile = getFile("addFile1");
    if (!($usePwdForCK = KphpUI::getString("addUsePwdForCK", $_POST, "") != "") && $pwd1 == "" && $keyfile == null) {
        $ui->setIfEmpty("addUsePwdForCK", null, "error");
        $ui->setIfEmpty("addPwd1", MainUI::HI_NOOTHERKEY, "error");
        $ui->setIfEmpty("addFile1", MainUI::HI_ERROR, "error");
    }
    if (!$ui->isSomethingEmpty) {
        require_once KEEPASSPHP_LOCATION;
        KeePassPHP::init(KEEPASSPHP_DEBUG);
        if (!KeePassPHP::exists($dbid) || KeePassPHP::checkPassword($dbid, $mainPwd)) {
            $keys = $usePwdForCK ? array(array(KeePassPHP::KEY_PWD, $mainPwd)) : array();
            if ($pwd1 != '') {
                $keys[] = array(KeePassPHP::KEY_PWD, $pwd1);
            }
            if ($keyfile != null) {
                if (($keyfile = checkFile("addFile1", $keyfile, $ui)) != null) {
                    $keys[] = array(KeePassPHP::KEY_FILE, $keyfile);