コード例 #1
0
ファイル: kphpui.php プロジェクト: marclaporte/KeePassPHP-UI
 /**
  * Selects the language to use in the user interface, if it has been
  * registered before.
  */
 public static function setLang($lang)
 {
     if (!array_key_exists($lang, self::$availableLangData)) {
         return false;
     }
     self::$lang = $lang;
     self::$langData = self::$availableLangData[self::$lang];
     return true;
 }
コード例 #2
0
ファイル: main.php プロジェクト: marclaporte/KeePassPHP-UI
<?php

// Location of KeePassPHP main file, relative to index.php and ajaxopen.php (!)
define('KEEPASSPHP_LOCATION', 'keepassphp/keepassphp.php');
// Debug mode for KeePassPHP
define('KEEPASSPHP_DEBUG', false);
// The maximum accepted size for uploaded files, in bytes. This is rougly 1 Mb,
// and should be okay for regular password databases. You may want to change
// it if you expect specifically heavy databases.
define("MAX_FILE_SIZE", 1048576);
// We'll need this
require_once "kphpui.php";
/*************************
 * Languages declaration *
 *************************/
// register french
require_once "lang/fr.php";
KPHPUI::registerLang("fr", $lang_fr);
// register english
require_once "lang/en.php";
KPHPUI::registerLang("en", $lang_en);
/**********************
 * language selection *
 **********************/
// selects the language, depending on the query string or HTTP header
if (!isset($_GET["l"]) || !KPHPUI::setLang($_GET["l"])) {
    KPHPUI::setLang(KPHPUI::getPreferredLanguage($_SERVER["HTTP_ACCEPT_LANGUAGE"]));
}
コード例 #3
0
                    if (!empty($icon)) {
                        $icon = $db->getIconSrc($icon);
                    }
                    if (empty($icon) && isset($entry[Database::KEY_ICON])) {
                        $icon = KPHPUI::iconPath($entry[Database::KEY_ICON]);
                    }
                    $s .= '<tr><td>' . ($icon == null ? '' : '<img src="' . KPHPUI::htmlify($icon) . '" />') . '</td>';
                    $s .= '<td>' . KPHPUI::htmlify($entry[Database::KEY_TITLE]) . '</td>';
                    $url = $entry[Database::KEY_URL];
                    $protoSep = strpos($url, "://");
                    $proto = $protoSep === false ? null : substr($url, 0, $protoSep);
                    $isHttp = $proto == "http" || $proto == "https";
                    $displayed = $isHttp ? substr($url, $protoSep + 3) : $url;
                    $s .= '<td>' . ($isHttp ? '<a href="' : '<span title="') . KPHPUI::htmlify($url) . '">' . KPHPUI::htmlify(strlen($displayed) > 20 ? substr($displayed, 0, 17) . '...' : $displayed) . ($isHttp ? '</a>' : '</span>') . '</td>';
                    $s .= '<td><input type="text" class="col-sm-3 form-control selectOnFocus" value="' . KPHPUI::htmlify($entry[Database::KEY_USERNAME]) . '" /></td>';
                    $s .= '<td id="pwd_' . $uuid . '"><button type="button" class="btn btn-primary passwordLoader" data-uuid="' . $uuid . '" autocomplete="off" data-loading-text="...">' . KPHPUI::l(KPHPUI::LANG_SEE_ENTRY_LOAD) . '</button></td></tr>';
                }
                $s .= '</tbody></table>';
                $answer->set(AjaxAnswer::SUCCESS, $s);
            }
        } else {
            $answer->set(AjaxAnswer::BAD_PASSWORD);
        }
    } else {
        $answer->set(AjaxAnswer::NO_SUCH_ID);
    }
    if (KeePassPHP::$isError) {
        $answer > setDebug(KeePassPHP::$errordump);
    }
}
$answer->send();
コード例 #4
0
ファイル: index.php プロジェクト: marclaporte/KeePassPHP-UI
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h3><?php 
    echo KPHPUI::l(KPHPUI::LANG_MODAL_SUCCESS_TITLE);
    ?>
</h3>
				</div>
				<div class="modal-body">
					<p class="alert alert-success"><?php 
    echo KPHPUI::l(KPHPUI::LANG_MODAL_SUCCESS_TEXT);
    ?>
</p>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" data-dismiss="modal"><?php 
    echo KPHPUI::l(KPHPUI::LANG_MODAL_CLOSE);
    ?>
</button>
				</div>
			</div>
		</div>
	</div>
<?php 
}
?>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
	<script src="js/bootstrap.min.js?3.3.6"></script>
	<script type="text/javascript"><?php 
echo $javascriptContent;
?>
</script>