Merge branch 'master' into sharing
Conflicts: .gitignore lib/base.php
9
.gitignore
vendored
|
@ -16,6 +16,15 @@ _darcs/*
|
|||
CVS/*
|
||||
.svn/*
|
||||
RCS/*
|
||||
|
||||
# kdevelop
|
||||
.kdev
|
||||
*.kdev4
|
||||
<<<<<<< HEAD
|
||||
.project
|
||||
=======
|
||||
|
||||
# Lokalize
|
||||
*lokalize*
|
||||
|
||||
>>>>>>> master
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
ErrorDocument 404 //owncloud/templates/404.php
|
||||
ErrorDocument 404 //core/templates/404.php
|
||||
php_value upload_max_filesize 20M
|
||||
php_value post_max_size 20M
|
||||
SetEnv htaccessWorking true
|
||||
Options -Indexes
|
||||
|
|
|
@ -639,7 +639,7 @@ class MDB2
|
|||
*/
|
||||
static function isError($data, $code = null)
|
||||
{
|
||||
if (is_a($data, 'MDB2_Error')) {
|
||||
if ($data instanceof MDB2_Error) {
|
||||
if (is_null($code)) {
|
||||
return true;
|
||||
} elseif (is_string($code)) {
|
||||
|
@ -666,7 +666,7 @@ class MDB2
|
|||
*/
|
||||
static function isConnection($value)
|
||||
{
|
||||
return is_a($value, 'MDB2_Driver_Common');
|
||||
return ($value instanceof MDB2_Driver_Common);
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
@ -683,7 +683,7 @@ class MDB2
|
|||
*/
|
||||
static function isResult($value)
|
||||
{
|
||||
return is_a($value, 'MDB2_Result');
|
||||
return $value instanceof MDB2_Result;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
@ -700,7 +700,7 @@ class MDB2
|
|||
*/
|
||||
static function isResultCommon($value)
|
||||
{
|
||||
return is_a($value, 'MDB2_Result_Common');
|
||||
return ($value instanceof MDB2_Result_Common);
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
@ -717,7 +717,7 @@ class MDB2
|
|||
*/
|
||||
static function isStatement($value)
|
||||
{
|
||||
return is_a($value, 'MDB2_Statement_Common');
|
||||
return $value instanceof MDB2_Statement_Common;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
|
|
@ -127,13 +127,6 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
$this->val =new MDB2_Schema_Validate($fail_on_invalid_names, $valid_types, $force_defaults);
|
||||
}
|
||||
|
||||
function MDB2_Schema_Parser($variables, $fail_on_invalid_names = true,
|
||||
$structure = false, $valid_types = array(),
|
||||
$force_defaults = true)
|
||||
{
|
||||
$this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults);
|
||||
}
|
||||
|
||||
function startHandler($xp, $element, $attribs)
|
||||
{
|
||||
if (strtolower($element) == 'variable') {
|
||||
|
@ -503,7 +496,7 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
$this->element = implode('-', $this->elements);
|
||||
}
|
||||
|
||||
function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE,$a=null,$b=null,$c=null)
|
||||
function raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE,$a=null,$b=null,$c=null)
|
||||
{
|
||||
if (is_null($this->error)) {
|
||||
$error = '';
|
||||
|
|
|
@ -91,11 +91,6 @@ class MDB2_Schema_Validate
|
|||
$this->force_defaults = $force_defaults;
|
||||
}
|
||||
|
||||
function MDB2_Schema_Validate($fail_on_invalid_names = true, $valid_types = array(), $force_defaults = true)
|
||||
{
|
||||
$this->__construct($fail_on_invalid_names, $valid_types, $force_defaults);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ raiseError()
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ class PEAR
|
|||
*/
|
||||
static function isError($data, $code = null)
|
||||
{
|
||||
if (is_a($data, 'PEAR_Error')) {
|
||||
if ($data instanceof PEAR_Error) {
|
||||
if (is_null($code)) {
|
||||
return true;
|
||||
} elseif (is_string($code)) {
|
||||
|
@ -305,7 +305,7 @@ class PEAR
|
|||
|
||||
function setErrorHandling($mode = null, $options = null)
|
||||
{
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
if (isset($this) && $this instanceof PEAR) {
|
||||
$setmode = &$this->_default_error_mode;
|
||||
$setoptions = &$this->_default_error_options;
|
||||
} else {
|
||||
|
@ -557,7 +557,7 @@ class PEAR
|
|||
$code = null,
|
||||
$userinfo = null)
|
||||
{
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
if (isset($this) && $this instanceof PEAR) {
|
||||
return $this->raiseError($message, $code, null, null, $userinfo);
|
||||
} else {
|
||||
return PEAR::raiseError($message, $code, null, null, $userinfo);
|
||||
|
@ -653,7 +653,7 @@ class PEAR
|
|||
function pushErrorHandling($mode, $options = null)
|
||||
{
|
||||
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
if (isset($this) && $this instanceof PEAR) {
|
||||
$def_mode = &$this->_default_error_mode;
|
||||
$def_options = &$this->_default_error_options;
|
||||
} else {
|
||||
|
@ -662,7 +662,7 @@ class PEAR
|
|||
}
|
||||
$stack[] = array($def_mode, $def_options);
|
||||
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
if (isset($this) && $this instanceof PEAR) {
|
||||
$this->setErrorHandling($mode, $options);
|
||||
} else {
|
||||
PEAR::setErrorHandling($mode, $options);
|
||||
|
@ -687,7 +687,7 @@ class PEAR
|
|||
array_pop($stack);
|
||||
list($mode, $options) = $stack[sizeof($stack) - 1];
|
||||
array_pop($stack);
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
if (isset($this) && $this instanceof PEAR) {
|
||||
$this->setErrorHandling($mode, $options);
|
||||
} else {
|
||||
PEAR::setErrorHandling($mode, $options);
|
||||
|
|
|
@ -7,7 +7,7 @@ require_once('../../lib/base.php');
|
|||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ require_once('../../lib/base.php');
|
|||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ require_once('../../lib/base.php');
|
|||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
|
||||
exit();
|
||||
}
|
||||
|
|
9
admin/ajax/disableapp.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../lib/base.php');
|
||||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
OC_APP::disable($_POST['appid']);
|
||||
|
||||
?>
|
9
admin/ajax/enableapp.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../lib/base.php');
|
||||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
OC_APP::enable($_POST['appid']);
|
||||
|
||||
?>
|
|
@ -7,7 +7,7 @@ require_once('../../lib/base.php');
|
|||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ require_once('../../lib/base.php');
|
|||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ require_once('../../lib/base.php');
|
|||
header( "Content-Type: application/jsonrequest" );
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -5,9 +5,8 @@ OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administratio
|
|||
OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_HELPER::imagePath( "admin", "administration.png" )));
|
||||
OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "users.png" )));
|
||||
OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "apps.png" )));
|
||||
OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "plugins.png" )));
|
||||
|
||||
// Add subentries for App installer
|
||||
OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?add=some¶meters=here" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
|
||||
OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?installed" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
|
||||
|
||||
?>
|
||||
|
|
|
@ -22,36 +22,55 @@
|
|||
*/
|
||||
|
||||
require_once('../lib/base.php');
|
||||
include_once('../lib/installer.php');
|
||||
require( 'template.php' );
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
header( "Location: ".OC_HELPER::linkTo( "", "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
||||
// Load the files we need
|
||||
OC_UTIL::addStyle( "admin", "apps" );
|
||||
OC_UTIL::addScript( "admin", "apps" );
|
||||
|
||||
|
||||
if(isset($_GET['id'])) $id=$_GET['id']; else $id=0;
|
||||
if(isset($_GET['cat'])) $cat=$_GET['cat']; else $cat=0;
|
||||
if(isset($_GET['installed'])) $installed=true; else $installed=false;
|
||||
|
||||
$categories=OC_OCSCLIENT::getCategories();
|
||||
if($installed){
|
||||
global $SERVERROOT;
|
||||
OC_INSTALLER::installShippedApps(false);
|
||||
$apps = OC_APPCONFIG::getApps();
|
||||
$records = array();
|
||||
|
||||
/*
|
||||
|
||||
All
|
||||
Installed Apps
|
||||
|
||||
|
||||
|
||||
foreach($categories as $key=>$value) {
|
||||
print_r($value);
|
||||
OC_APP::setActiveNavigationEntry( "core_apps_installed" );
|
||||
foreach($apps as $app){
|
||||
$info=OC_APP::getAppInfo("$SERVERROOT/apps/$app/appinfo/info.xml");
|
||||
$record = array( 'id' => $app,
|
||||
'name' => $info['name'],
|
||||
'version' => $info['version'],
|
||||
'author' => $info['author'],
|
||||
'enabled' => OC_APP::isEnabled( $app ));
|
||||
$records[]=$record;
|
||||
}
|
||||
|
||||
$tmpl = new OC_TEMPLATE( "admin", "appsinst", "admin" );
|
||||
$tmpl->assign( "apps", $records );
|
||||
$tmpl->printPage();
|
||||
unset($tmpl);
|
||||
exit();
|
||||
}else{
|
||||
|
||||
*/
|
||||
$categories=OC_OCSCLIENT::getCategories();
|
||||
if($categories==NULL){
|
||||
OC_APP::setActiveNavigationEntry( "core_apps" );
|
||||
|
||||
// OC_APP::setActiveNavigationEntry( "core_apps_installed" );
|
||||
$tmpl = new OC_TEMPLATE( "admin", "app_noconn", "admin" );
|
||||
$tmpl->printPage();
|
||||
unset($tmpl);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if($id==0) {
|
||||
|
@ -85,7 +104,6 @@ if($id==0) {
|
|||
unset($tmpl);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
@ -7,6 +7,22 @@ table td.date
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
table td.version, table td.enabled, table td.disabled
|
||||
{
|
||||
padding: 0.5em 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input[type="button"].enabled
|
||||
{
|
||||
color: #006600;
|
||||
}
|
||||
|
||||
input[type="button"].disabled
|
||||
{
|
||||
color: #660000;
|
||||
}
|
||||
|
||||
.preview
|
||||
{
|
||||
padding: 3px;
|
||||
|
@ -47,3 +63,6 @@ table td.name a
|
|||
}
|
||||
|
||||
|
||||
input[type="button"].appbutton { padding:0.1em 1em; border:1px solid #999; font-weight:bold; font-size:0.9em; cursor:pointer; }
|
||||
input[type="button"]:hover.appbutton, form input[type="submit"]:focus { border:1px solid #999; background-color:#999; outline:0; }
|
||||
input[type="button"]:active.appbutton { outline:0; }
|
18
admin/js/apps.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
$("input[x-use='appenablebutton']").live( "click", function(){
|
||||
appid = $(this).parent().parent().attr("x-uid");
|
||||
|
||||
//alert("dsfsdfsdf");
|
||||
if($(this).val() == "enabled"){
|
||||
$(this).attr("value","disabled");
|
||||
$(this).removeClass( "enabled" );
|
||||
$(this).addClass( "disabled" );
|
||||
//$.post( "ajax/disableapp.php", $(appid).serialize(), function(data){} );
|
||||
$.post( "ajax/disableapp.php", { appid: appid }, function(data){ alert(data.status);});
|
||||
}
|
||||
else if($(this).val() == "disabled"){
|
||||
$(this).attr("value","enabled");
|
||||
$(this).removeClass( "disabled" );
|
||||
$(this).addClass( "enabled" );
|
||||
$.post( "ajax/enableapp.php", { appid: appid }, function(data){ alert(data.status);} );
|
||||
}
|
||||
});
|
20
admin/l10n/da.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"read more" => "læs mere",
|
||||
"INSTALL" => "INSTALLER",
|
||||
"Apps Repository" => "Applikation arkiv",
|
||||
"Cannot connect to apps repository" => "Kan ikke oprette forbindelse til applikations arkivet",
|
||||
"Name" => "Navn",
|
||||
"Modified" => "Ændret",
|
||||
"Administration" => "Administration",
|
||||
"System Settings" => "System indstillinger",
|
||||
"Add user" => "Tilføj bruger",
|
||||
"Password" => "Kodeord",
|
||||
"Create user" => "Lav bruger",
|
||||
"remove" => "slet",
|
||||
"Groups" => "Grupper",
|
||||
"Create group" => "Lav gruppe",
|
||||
"Force new password:" => "Tving ny adgangskode",
|
||||
"Set" => "Indstil",
|
||||
"Do you really want to delete user" => "Vil du virkelig slette denne bruger?",
|
||||
"Do you really want to delete group" => "Vil du virkelig slette denne gruppe?"
|
||||
);
|
20
admin/l10n/de.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"read more" => "mehr …",
|
||||
"INSTALL" => "Installieren",
|
||||
"Apps Repository" => "Anwendungen",
|
||||
"Cannot connect to apps repository" => "Verbindung fehlgeschlagen",
|
||||
"Name" => "Name",
|
||||
"Modified" => "Änderungsdatum",
|
||||
"Administration" => "Verwaltung",
|
||||
"System Settings" => "Systemeinstellungen",
|
||||
"Groups" => "Gruppen",
|
||||
"Add user" => "Nutzer hinzufügen",
|
||||
"Password" => "Passwort",
|
||||
"Create user" => "Nutzer erstellen",
|
||||
"remove" => "entfernen",
|
||||
"Create group" => "Gruppe erstellen",
|
||||
"Force new password:" => "Neues Passwort:",
|
||||
"Set" => "OK",
|
||||
"Do you really want to delete user" => "Möchtest du den Nutzer wirklich entfernen?",
|
||||
"Do you really want to delete group" => "Möchtest du die Gruppe wirklich entfernen?"
|
||||
);
|
20
admin/l10n/nl.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"read more" => "Meer informatie",
|
||||
"INSTALL" => "Installeer",
|
||||
"Apps Repository" => "Applicatiedatabase",
|
||||
"Cannot connect to apps repository" => "Kan geen verbinding maken met de applicatiedatabase",
|
||||
"Name" => "Naam",
|
||||
"Modified" => "Laatst aangepast",
|
||||
"Administration" => "Administratie",
|
||||
"System Settings" => "Systeeminstellingen",
|
||||
"Groups" => "Groepen",
|
||||
"Add user" => "Gebruiker toevoegen",
|
||||
"Password" => "Wachtwoord",
|
||||
"Create user" => "Gebruiker aanmaken",
|
||||
"remove" => "verwijder",
|
||||
"Create group" => "Groep aanmaken",
|
||||
"Force new password:" => "Forceer nieuw wachtwoord:",
|
||||
"Set" => "Ok",
|
||||
"Do you really want to delete user" => "Wilt u deze gebruiker verwijderen",
|
||||
"Do you really want to delete group" => "Wilt u deze groep verwijderen"
|
||||
);
|
21
admin/l10n/pl.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"read more" => "czytaj więcej",
|
||||
"INSTALL" => "INSTALUJ",
|
||||
"Apps Repository" => "Repozytorium aplikacji",
|
||||
"Cannot connect to apps repository" => "Nie można połączyć się z repozytorium aplikacji",
|
||||
"Name" => "Nazwa",
|
||||
"Modified" => "Zmodyfikowano",
|
||||
"Administration" => "Administracja",
|
||||
"System Settings" => "Ustawienia systemowe",
|
||||
"Add user" => "Dodaj użytkownika",
|
||||
"Password" => "Hasło",
|
||||
"Create user" => "Utwórz użytkownika",
|
||||
"remove" => "usuń",
|
||||
"Groups" => "Grupy",
|
||||
"Create group" => "Utwórz grupę",
|
||||
"Force new password:" => "Wymuś nowe hasło",
|
||||
"Set" => "Ustaw",
|
||||
"Do you really want to delete user" => "Czy naprawdę chcesz usunąć użytkownika",
|
||||
"Do you really want to delete group" => "Czy naprawdę chcesz usunąć grupę",
|
||||
"Users" => "Użytkownicy"
|
||||
);
|
5
admin/l10n/xgettextfiles
Normal file
|
@ -0,0 +1,5 @@
|
|||
../templates/app.php
|
||||
../templates/app_noconn.php
|
||||
../templates/apps.php
|
||||
../templates/system.php
|
||||
../templates/users.php
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('../lib/base.php');
|
||||
require( 'template.php' );
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
||||
OC_APP::setActiveNavigationEntry( "core_plugins" );
|
||||
$plugins=array();
|
||||
$blacklist=OC_PLUGIN::loadBlackList();
|
||||
|
||||
foreach( OC_PLUGIN::listPlugins() as $i ){
|
||||
// Gather data about plugin
|
||||
$data = OC_PLUGIN::getPluginData($plugin);
|
||||
|
||||
// Is it enabled?
|
||||
$data["enabled"] = ( array_search( $plugin, $blacklist ) === false );
|
||||
|
||||
// Add the data
|
||||
$plugins[] = $data;
|
||||
}
|
||||
|
||||
|
||||
$tmpl = new OC_TEMPLATE( "admin", "plugins", "admin" );
|
||||
$tmpl->assign( "plugins", $plugins );
|
||||
$tmpl->printPage();
|
||||
|
||||
?>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
require_once('../lib/base.php');
|
||||
require( 'template.php' );
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ $app=$_['app'];
|
|||
?>
|
||||
<h1><?php echo $app["name"]; ?></h1>
|
||||
<?php echo('<span class="type">'.$app['typename'].'</span>'); ?><br />
|
||||
<span class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></span><br />
|
||||
<span class="date"><?php echo $l->l('datetime', $app["changed"]); ?></span><br />
|
||||
|
||||
|
||||
<table cellspacing="6" border="0" width="100%">
|
||||
|
@ -19,9 +19,9 @@ $app=$_['app'];
|
|||
<td class="description" valign="top">
|
||||
<?php echo $app["description"]; ?>
|
||||
<br />
|
||||
<?php echo('<a class="description" target="_blank" href="'.$app["detailpage"].'">read more</a><br />'); ?>
|
||||
<?php echo('<a class="description" target="_blank" href="'.$app["detailpage"].'">'.$l->t( 'read more' ).'</a><br />'); ?>
|
||||
</td>
|
||||
<td width="1" valign="top"><a class="prettybutton" href="">INSTALL</a></td>
|
||||
<td width="1" valign="top"><a class="prettybutton" href=""><?php echo $l->t( 'INSTALL' ); ?></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
7
admin/templates/app_noconn.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
* Template for Apps when can't connect to app store
|
||||
*/
|
||||
?>
|
||||
<h1><?php echo $l->t( 'Apps Repository' ); ?></h1>
|
||||
<h2><?php echo $l->t( 'Cannot connect to apps repository' ); ?></h2>
|
|
@ -3,15 +3,15 @@
|
|||
* Template for Apps
|
||||
*/
|
||||
?>
|
||||
<h1>Apps Repository</h1>
|
||||
<h1><?php echo $l->t( 'Apps Repository' ); ?></h1>
|
||||
|
||||
|
||||
<table cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Modified</th>
|
||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||
<th><?php echo $l->t( 'Modified' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -19,7 +19,7 @@
|
|||
<tr>
|
||||
<td width="1"><?php if($app["preview"] <> "") { echo('<a href="'.OC_HELPER::linkTo( "admin", "apps.php" ).'?id='.$app['id'].'"><img class="preview" border="0" src="'.$app["preview"].'" /></a>'); } ?> </a></td>
|
||||
<td class="name"><a href="<?php echo(OC_HELPER::linkTo( "admin", "apps.php" ).'?id='.$app['id']); ?>" title=""><?php echo $app["name"]; ?></a><br /><?php echo('<span class="type">'.$app['typename'].'</span>'); ?></td>
|
||||
<td class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></td>
|
||||
<td class="date"><?php echo $l->l('datetime', $app["changed"]); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
27
admin/templates/appsinst.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/*
|
||||
* Template for Installed Apps
|
||||
*/
|
||||
?>
|
||||
<h1><?php echo $l->t( 'Installed Applications' ); ?></h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||
<th><?php echo $l->t( 'Version' ); ?></th>
|
||||
<th><?php echo $l->t( 'Author' ); ?></th>
|
||||
<th><?php echo $l->t( 'Status' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($_["apps"] as $app): ?>
|
||||
<tr x-uid="<?php echo($app['id']); ?>">
|
||||
<td class="name" width="200"><?php echo($app['name']); ?></td>
|
||||
<td class="version"><?php echo($app['version']); ?></td>
|
||||
<td><?php echo($app['author']); ?></td>
|
||||
<td><input x-use="appenablebutton" type='button' value='<?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?>' class='appbutton prettybutton <?php echo( $app['enabled'] ? 'enabled' : 'disabled' ); ?>'/></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Template for admin pages
|
||||
*/
|
||||
?>
|
||||
<h1>Administration</h1>
|
||||
<h2>Plugins</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Version</th>
|
||||
<th>Author</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($_["plugins"] as $plugin): ?>
|
||||
<td><?php echo $plugin["info"]["id"]; ?></td>
|
||||
<td><?php echo $plugin["info"]["version"]; ?></td>
|
||||
<td><?php echo $plugin["info"]["name"]; ?></td>
|
||||
<td><?php echo $plugin["info"]["author"]; ?></td>
|
||||
<td>enable</td>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
|
@ -3,6 +3,6 @@
|
|||
* Template for admin pages
|
||||
*/
|
||||
?>
|
||||
<h1>Administration</h1>
|
||||
<h2>System Settings</h2>
|
||||
<h1><?php echo $l->t( 'Administration' ); ?></h1>
|
||||
<h2><?php echo $l->t( 'System Settings' ); ?></h2>
|
||||
#TBD
|
|
@ -1,33 +1,33 @@
|
|||
<h2>Users</h2>
|
||||
<h2><?php echo $l->t( 'Users' ); ?></h2>
|
||||
|
||||
<table id="usertable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Groups</th>
|
||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||
<th><?php echo $l->t( 'Groups' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr id="createuseroption">
|
||||
<td><button id="createuseroptionbutton">Add user</button></td>
|
||||
<td><button id="createuseroptionbutton"><?php echo $l->t( 'Add user' ); ?></button></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<form id="createuserdata">
|
||||
<tr id="createuserform" style="display:none;">
|
||||
<td>
|
||||
Name <input x-use="createuserfield" type="text" name="username" /><br>
|
||||
Password <input x-use="createuserfield" type="password" name="password" />
|
||||
<?php echo $l->t( 'Name' ); ?> <input x-use="createuserfield" type="text" name="username" /><br>
|
||||
<?php echo $l->t( 'Password' ); ?> <input x-use="createuserfield" type="password" name="password" />
|
||||
</td>
|
||||
<td id="createusergroups">
|
||||
<?php foreach($_["groups"] as $i): ?>
|
||||
<input x-use="createusercheckbox" x-gid="<? echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<? echo $i["name"]; ?>" />
|
||||
<span x-gid="<? echo $i["name"]; ?>"><? echo $i["name"]; ?><br></span>
|
||||
<input x-use="createusercheckbox" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" />
|
||||
<span x-gid="<?php echo $i["name"]; ?>"><?php echo $i["name"]; ?><br></span>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
<td>
|
||||
<button id="createuserbutton">Create user</button>
|
||||
<button id="createuserbutton"><?php echo $l->t( 'Create user' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
|
@ -37,17 +37,17 @@
|
|||
<tr x-uid="<?php echo $user["name"] ?>">
|
||||
<td x-use="username"><div x-use="usernamediv"><?php echo $user["name"]; ?></div></td>
|
||||
<td x-use="usergroups"><div x-use="usergroupsdiv"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo " ";} ?></div></td>
|
||||
<td><a class="removeuserbutton" href="">remove</a></td>
|
||||
<td><a class="removeuserbutton" href=""><?php echo $l->t( 'remove' ); ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Groups</h2>
|
||||
<h2><?php echo $l->t( 'Groups' ); ?></h2>
|
||||
<table id="grouptable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<form id="creategroupdata">
|
||||
<tr>
|
||||
<td><input x-use="creategroupfield" type="text" name="groupname" /></td>
|
||||
<td><button id="creategroupbutton">Create group</button></td>
|
||||
<td><button id="creategroupbutton"><?php echo $l->t( 'Create group' ); ?></button></td>
|
||||
</tr>
|
||||
</form>
|
||||
</tfoot>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<td><?php echo $group["name"] ?></td>
|
||||
<td>
|
||||
<?php if( $group["name"] != "admin" ): ?>
|
||||
<a class="removegroupbutton" href="">remove</a>
|
||||
<a class="removegroupbutton" href=""><?php echo $l->t( 'remove' ); ?></a>
|
||||
<?php else: ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
@ -82,8 +82,8 @@
|
|||
<input id="changegroupuid" type="hidden" name="username" value="" />
|
||||
<input id="changegroupgid" type="hidden" name="group" value="" />
|
||||
<?php foreach($_["groups"] as $i): ?>
|
||||
<input x-use="togglegroup" x-gid="<? echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<? echo $i["name"]; ?>" />
|
||||
<span x-use="togglegroup" x-gid="<? echo $i["name"]; ?>"><? echo $i["name"]; ?><br></span>
|
||||
<input x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" />
|
||||
<span x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>"><?php echo $i["name"]; ?><br></span>
|
||||
<?php endforeach; ?>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -91,22 +91,22 @@
|
|||
<div id="changepassword" style="display:none">
|
||||
<form id="changepasswordform">
|
||||
<input id="changepassworduid" type="hidden" name="username" value="" />
|
||||
Force new password:
|
||||
<?php echo $l->t( 'Force new password:' ); ?>
|
||||
<input id="changepasswordpwd" type="password" name="password" value="" />
|
||||
<button id="changepasswordbutton">Set</button>
|
||||
<button id="changepasswordbutton"><?php echo $l->t( 'Set' ); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="removeuserform" title="Remove user">
|
||||
<form id="removeuserdata">
|
||||
Do you really want to delete user <span id="deleteuserusername">$user</span>?
|
||||
<?php echo $l->t( 'Do you really want to delete user' ); ?> <span id="deleteuserusername">$user</span>?
|
||||
<input id="deleteusernamefield" type="hidden" name="username" value="">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="removegroupform" title="Remove Group">
|
||||
<form id="removegroupdata">
|
||||
Do you really want to delete group <span id="removegroupgroupname">$group</span>?
|
||||
<?php echo $l->t( 'Do you really want to delete group' ); ?> <span id="removegroupgroupname">$group</span>?
|
||||
<input id="removegroupnamefield" type="hidden" name="groupname" value="">
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
require_once('../lib/base.php');
|
||||
require( 'template.php' );
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ require( 'template.php' );
|
|||
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
|
||||
if( !OC_USER::isLoggedIn()){
|
||||
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<notnull>true</notnull>
|
||||
</field>
|
||||
<index>
|
||||
<name>token</name>
|
||||
<name>a_files_publiclink_token</name>
|
||||
<unique>true</unique>
|
||||
<field>
|
||||
<name>token</name>
|
||||
|
|
|
@ -8,7 +8,7 @@ $(document).ready(function() {
|
|||
source: "../../files/ajax/autocomplete.php",
|
||||
minLength: 1
|
||||
});
|
||||
$("button.delete").live('click', function() {
|
||||
$("button.delete").live('click', function( event ) {
|
||||
event.preventDefault();
|
||||
var token=$(this).attr('data-token');
|
||||
var data="token="+token;
|
||||
|
@ -22,7 +22,7 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
$('#newlink').submit(function(){
|
||||
$('#newlink').submit(function( event ){
|
||||
event.preventDefault();
|
||||
var path=$('#path').val();
|
||||
var expire=$('#expire_time').val()||0;
|
||||
|
@ -48,5 +48,5 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
|
@ -7,7 +7,7 @@ class OC_PublicLink{
|
|||
*/
|
||||
public function __construct($path,$expiretime=0){
|
||||
if($path and OC_FILESYSTEM::file_exists($path) and OC_FILESYSTEM::is_readable($path)){
|
||||
$user=$_SESSION['user_id'];
|
||||
$user=OC_USER::getUser();
|
||||
$token=sha1("$user-$path-$expiretime");
|
||||
$query=OC_DB::prepare("INSERT INTO *PREFIX*publiclink VALUES(?,?,?,?)");
|
||||
$result=$query->execute(array($token,$path,$user,$expiretime));
|
||||
|
@ -60,7 +60,7 @@ class OC_PublicLink{
|
|||
*/
|
||||
static public function getLinks(){
|
||||
$query=OC_DB::prepare("SELECT * FROM *PREFIX*publiclink WHERE user=?");
|
||||
return $query->execute(array($_SESSION['user_id']))->fetchAll();
|
||||
return $query->execute(array(OC_USER::getUser()))->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ class OC_PublicLink{
|
|||
static public function delete($token){
|
||||
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
|
||||
$result=$query->execute(array($token))->fetchAll();
|
||||
if(count($result)>0 and $result[0]['user']==$_SESSION['user_id']){
|
||||
if(count($result)>0 and $result[0]['user']==OC_USER::getUser()){
|
||||
$query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE token=?");
|
||||
$query->execute(array($token));
|
||||
}
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
<table id='linklist'>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class='path'>Path</td>
|
||||
<td class='expire'>Expires</td>
|
||||
<td class='link'>Link</td>
|
||||
<td class='path'><?php echo $l->t( 'Path' ); ?></td>
|
||||
<td class='expire'><?php echo $l->t( 'Expires' ); ?></td>
|
||||
<td class='link'><?php echo $l->t( 'Link' ); ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($_['links'] as $link):?>
|
||||
<tr class='link' id='<?php echo $link['token'];?>'>
|
||||
<td class='path'><?php echo $link['path'];?></td>
|
||||
<td class='expire'><?php echo ($link['expire_time']==0)?'Never':OC_UTIL::formatdate($link['expire_time'],true);?></td>
|
||||
<td class='expire'><?php echo ($link['expire_time']==0)?'Never':$l->l('datetime', $link['expire_time']);?></td>
|
||||
<td class='link'><a href='get.php?token=<?php echo $link['token'];?>'><?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?></a></td>
|
||||
<td><button class='delete fancybutton' data-token='<?php echo $link['token'];?>'>Delete</button></td>
|
||||
<td><button class='delete fancybutton' data-token='<?php echo $link['token'];?>'><?php echo $l->t( 'Delete' ); ?></button></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr id='newlink_row'>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" id="select_all" /></th>
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Modified</th>
|
||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||
<th><?php echo $l->t( 'Size' ); ?></th>
|
||||
<th><?php echo $l->t( 'Modified' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
39
apps/user_ldap/appinfo/app.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - user_ldap
|
||||
*
|
||||
* @author Dominik Schmidt
|
||||
* @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('apps/user_ldap/user_ldap.php');
|
||||
|
||||
// define LDAP_DEFAULT_PORT
|
||||
define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389);
|
||||
|
||||
// register user backend
|
||||
OC_USER::useBackend( "LDAP" );
|
||||
|
||||
// add settings page to navigation
|
||||
$entry = array(
|
||||
'id' => "user_ldap_settings",
|
||||
'order'=>1,
|
||||
'href' => OC_HELPER::linkTo( "user_ldap", "settings.php" ),
|
||||
'name' => 'LDAP'
|
||||
);
|
||||
OC_APP::addNavigationSubEntry( "core_users", $entry);
|
10
apps/user_ldap/appinfo/info.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>user_ldap</id>
|
||||
<name>LDAP user backend</name>
|
||||
<description>Authenticate Users by LDAP</description>
|
||||
<version>0.1</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Dominik Schmidt</author>
|
||||
<require>2</require>
|
||||
</info>
|
52
apps/user_ldap/settings.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - user_ldap
|
||||
*
|
||||
* @author Dominik Schmidt
|
||||
* @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('../../lib/base.php');
|
||||
require( 'template.php' );
|
||||
|
||||
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
|
||||
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter');
|
||||
|
||||
foreach($params as $param){
|
||||
if(isset($_POST[$param])){
|
||||
OC_APPCONFIG::setValue('user_ldap', $param, $_POST[$param]);
|
||||
}
|
||||
}
|
||||
OC_APP::setActiveNavigationEntry( "user_ldap_settings" );
|
||||
|
||||
|
||||
// fill template
|
||||
$tmpl = new OC_TEMPLATE( 'user_ldap', 'settings', 'admin' );
|
||||
foreach($params as $param){
|
||||
$value = OC_APPCONFIG::getValue('user_ldap', $param,'');
|
||||
$tmpl->assign($param, $value);
|
||||
}
|
||||
|
||||
// ldap_port has a default value
|
||||
$tmpl->assign( 'ldap_port', OC_APPCONFIG::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT));
|
||||
|
||||
$tmpl->printPage();
|
27
apps/user_ldap/templates/settings.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<form id="ldap" action='#' method='post'>
|
||||
<fieldset>
|
||||
<legend>LDAP</legend>
|
||||
<div>
|
||||
<div>
|
||||
<span>Host: *</span><span><input type="text" name="ldap_host" width="200" value="<?php echo $_['ldap_host']; ?>"></span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Port: *</span><span><input type="text" name="ldap_port" width="200" value="<?php echo $_['ldap_port']; ?>"></span>
|
||||
</div>
|
||||
<div>
|
||||
<span>DN:<input type="text" name="ldap_dn" width="200" value="<?php echo $_['ldap_dn']; ?>"></span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Password:<input type="password" name="ldap_password" width="200" value="<?php echo $_['ldap_password']; ?>"></span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Base: *<input type="text" name="ldap_base" width="200" value="<?php echo $_['ldap_base']; ?>"></span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Filter * (use %uid placeholder):<input type="text" name="ldap_filter" width="200" value="<?php echo $_['ldap_filter']; ?>"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type='submit' value='Save'/>
|
||||
<br/> * required
|
||||
</fieldset>
|
||||
</form>
|
114
apps/user_ldap/user_ldap.php
Normal file
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Dominik Schmidt
|
||||
* @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('User/backend.php');
|
||||
|
||||
class OC_USER_LDAP extends OC_USER_BACKEND {
|
||||
|
||||
protected $ds;
|
||||
protected $configured = false;
|
||||
|
||||
// cached settings
|
||||
protected $ldap_host;
|
||||
protected $ldap_port;
|
||||
protected $ldap_dn;
|
||||
protected $ldap_password;
|
||||
protected $ldap_base;
|
||||
protected $ldap_filter;
|
||||
|
||||
function __construct() {
|
||||
$this->ldap_host = OC_APPCONFIG::getValue('user_ldap', 'ldap_host','');
|
||||
$this->ldap_port = OC_APPCONFIG::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT );
|
||||
$this->ldap_dn = OC_APPCONFIG::getValue('user_ldap', 'ldap_dn','');
|
||||
$this->ldap_password = OC_APPCONFIG::getValue('user_ldap', 'ldap_password','');
|
||||
$this->ldap_base = OC_APPCONFIG::getValue('user_ldap', 'ldap_base','');
|
||||
$this->ldap_filter = OC_APPCONFIG::getValue('user_ldap', 'ldap_filter','');
|
||||
|
||||
if( !empty($this->ldap_host)
|
||||
&& !empty($this->ldap_port)
|
||||
&& !empty($this->ldap_dn)
|
||||
&& !empty($this->ldap_password)
|
||||
&& !empty($this->ldap_base)
|
||||
&& !empty($this->ldap_filter)
|
||||
)
|
||||
{
|
||||
$this->configured = true;
|
||||
}
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
// close the connection
|
||||
if( $this->ds )
|
||||
ldap_unbind($this->ds);
|
||||
}
|
||||
|
||||
private function getDs() {
|
||||
if(!$this->ds) {
|
||||
$this->ds = ldap_connect( $this->ldap_host, $this->ldap_port );
|
||||
}
|
||||
|
||||
// login
|
||||
if(!empty($this->ldap_dn)) {
|
||||
$ldap_login = @ldap_bind( $this->ds, $this->ldap_dn, $this->ldap_password );
|
||||
if(!$ldap_login)
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->ds;
|
||||
}
|
||||
|
||||
private function getDn( $uid ) {
|
||||
if(!$this->configured)
|
||||
return false;
|
||||
|
||||
// connect to server
|
||||
$ds = $this->getDs();
|
||||
if( !$ds )
|
||||
return false;
|
||||
|
||||
// get dn
|
||||
$filter = str_replace("%uid", $uid, $this->ldap_filter);
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
$entries = ldap_get_entries( $this->getDs(), $sr );
|
||||
|
||||
if( $entries["count"] == 0 )
|
||||
return false;
|
||||
|
||||
return $entries[0]["dn"];
|
||||
}
|
||||
public function checkPassword( $uid, $password ) {
|
||||
$dn = $this->getDn( $uid );
|
||||
if( !$dn )
|
||||
return false;
|
||||
|
||||
return @ldap_bind( $this->getDs(), $dn, $password );
|
||||
}
|
||||
|
||||
public function userExists( $uid ) {
|
||||
$dn = $this->getDn($uid);
|
||||
return !empty($dn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
47
apps/user_openid/appinfo/app.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
//check if curl extension installed
|
||||
if (!in_array ('curl', get_loaded_extensions())){
|
||||
return;
|
||||
}
|
||||
|
||||
$urlBase=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
|
||||
OC_UTIL::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_HELPER::linkTo( "user_openid", "user.php" ).'/'));
|
||||
OC_UTIL::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_HELPER::linkTo( "user_openid", "user.php" ).'/'));
|
||||
|
||||
require_once 'apps/user_openid/user_openid.php';
|
||||
|
||||
OC_APP::addSettingsPage( array( "id" => "user_openid_settings", 'order'=>1, "href" => OC_HELPER::linkTo( "user_openid", "settings.php" ), "name" => "OpenID"));
|
||||
|
||||
//active the openid backend
|
||||
OC_USER::useBackend('openid');
|
||||
|
||||
//check for results from openid requests
|
||||
if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
|
||||
error_log('openid retured');
|
||||
$openid = new SimpleOpenID;
|
||||
$openid->SetIdentity($_GET['openid_identity']);
|
||||
$openid_validation_result = $openid->ValidateWithServer();
|
||||
if ($openid_validation_result == true){ // OK HERE KEY IS VALID
|
||||
error_log('auth sucessfull');
|
||||
global $WEBROOT;
|
||||
$identity=$openid->GetIdentity();
|
||||
error_log("auth as $identity");
|
||||
$user=OC_USER_OPENID::findUserForIdentity($identity);
|
||||
if($user){
|
||||
$_SESSION['user_id']=$user;
|
||||
header("Location: $WEBROOT");
|
||||
}
|
||||
}else if($openid->IsError() == true){ // ON THE WAY, WE GOT SOME ERROR
|
||||
$error = $openid->GetError();
|
||||
error_log("ERROR CODE: " . $error['code']);
|
||||
error_log("ERROR DESCRIPTION: " . $error['description']);
|
||||
}else{ // Signature Verification Failed
|
||||
error_log("INVALID AUTHORIZATION");
|
||||
}
|
||||
}else if (isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'cancel'){ // User Canceled your Request
|
||||
error_log("USER CANCELED REQUEST");
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
10
apps/user_openid/appinfo/info.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>user_openid</id>
|
||||
<name>OpenID user backend</name>
|
||||
<description>Allow login through OpenID</description>
|
||||
<version>0.1</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Robin Appelman</author>
|
||||
<require>2</require>
|
||||
</info>
|
328
apps/user_openid/class.openid.v3.php
Normal file
|
@ -0,0 +1,328 @@
|
|||
<?php
|
||||
/*
|
||||
FREE TO USE
|
||||
Under License: GPLv3
|
||||
Simple OpenID PHP Class
|
||||
|
||||
Some modifications by Eddie Roosenmaallen, eddie@roosenmaallen.com
|
||||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
This Class was written to make easy for you to integrate OpenID on your website.
|
||||
This is just a client, which checks for user's identity. This Class Requires CURL Module.
|
||||
It should be easy to use some other HTTP Request Method, but remember, often OpenID servers
|
||||
are using SSL.
|
||||
We need to be able to perform SSL Verification on the background to check for valid signature.
|
||||
|
||||
HOW TO USE THIS CLASS:
|
||||
STEP 1)
|
||||
$openid = new SimpleOpenID;
|
||||
:: SET IDENTITY ::
|
||||
$openid->SetIdentity($_POST['openid_url']);
|
||||
:: SET RETURN URL ::
|
||||
$openid->SetApprovedURL('http://www.yoursite.com/return.php'); // Script which handles a response from OpenID Server
|
||||
:: SET TRUST ROOT ::
|
||||
$openid->SetTrustRoot('http://www.yoursite.com/');
|
||||
:: FETCH SERVER URL FROM IDENTITY PAGE :: [Note: It is recomended to cache this (Session, Cookie, Database)]
|
||||
$openid->GetOpenIDServer(); // Returns false if server is not found
|
||||
:: REDIRECT USER TO OPEN ID SERVER FOR APPROVAL ::
|
||||
|
||||
:: (OPTIONAL) SET OPENID SERVER ::
|
||||
$openid->SetOpenIDServer($server_url); // If you have cached previously this, you don't have to call GetOpenIDServer and set value this directly
|
||||
|
||||
STEP 2)
|
||||
Once user gets returned we must validate signature
|
||||
:: VALIDATE REQUEST ::
|
||||
true|false = $openid->ValidateWithServer();
|
||||
|
||||
ERRORS:
|
||||
array = $openid->GetError(); // Get latest Error code
|
||||
|
||||
FIELDS:
|
||||
OpenID allowes you to retreive a profile. To set what fields you'd like to get use (accepts either string or array):
|
||||
$openid->SetRequiredFields(array('email','fullname','dob','gender','postcode','country','language','timezone'));
|
||||
or
|
||||
$openid->SetOptionalFields('postcode');
|
||||
|
||||
IMPORTANT TIPS:
|
||||
OPENID as is now, is not trust system. It is a great single-sign on method. If you want to
|
||||
store information about OpenID in your database for later use, make sure you handle url identities
|
||||
properly.
|
||||
For example:
|
||||
https://steve.myopenid.com/
|
||||
https://steve.myopenid.com
|
||||
http://steve.myopenid.com/
|
||||
http://steve.myopenid.com
|
||||
... are representing one single user. Some OpenIDs can be in format openidserver.com/users/user/ - keep this in mind when storing identities
|
||||
|
||||
To help you store an OpenID in your DB, you can use function:
|
||||
$openid_db_safe = $openid->OpenID_Standarize($upenid);
|
||||
This may not be comatible with current specs, but it works in current enviroment. Use this function to get openid
|
||||
in one format like steve.myopenid.com (without trailing slashes and http/https).
|
||||
Use output to insert Identity to database. Don't use this for validation - it may fail.
|
||||
|
||||
*/
|
||||
|
||||
class SimpleOpenID{
|
||||
var $openid_url_identity;
|
||||
var $URLs = array();
|
||||
var $error = array();
|
||||
var $fields = array(
|
||||
'required' => array(),
|
||||
'optional' => array(),
|
||||
);
|
||||
|
||||
function SimpleOpenID(){
|
||||
if (!function_exists('curl_exec')) {
|
||||
die('Error: Class SimpleOpenID requires curl extension to work');
|
||||
}
|
||||
}
|
||||
function SetOpenIDServer($a){
|
||||
$this->URLs['openid_server'] = $a;
|
||||
}
|
||||
function SetTrustRoot($a){
|
||||
$this->URLs['trust_root'] = $a;
|
||||
}
|
||||
function SetCancelURL($a){
|
||||
$this->URLs['cancel'] = $a;
|
||||
}
|
||||
function SetApprovedURL($a){
|
||||
$this->URLs['approved'] = $a;
|
||||
}
|
||||
function SetRequiredFields($a){
|
||||
if (is_array($a)){
|
||||
$this->fields['required'] = $a;
|
||||
}else{
|
||||
$this->fields['required'][] = $a;
|
||||
}
|
||||
}
|
||||
function SetOptionalFields($a){
|
||||
if (is_array($a)){
|
||||
$this->fields['optional'] = $a;
|
||||
}else{
|
||||
$this->fields['optional'][] = $a;
|
||||
}
|
||||
}
|
||||
function SetIdentity($a){ // Set Identity URL
|
||||
if ((stripos($a, 'http://') === false)
|
||||
&& (stripos($a, 'https://') === false)){
|
||||
$a = 'http://'.$a;
|
||||
}
|
||||
/*
|
||||
$u = parse_url(trim($a));
|
||||
if (!isset($u['path'])){
|
||||
$u['path'] = '/';
|
||||
}else if(substr($u['path'],-1,1) == '/'){
|
||||
$u['path'] = substr($u['path'], 0, strlen($u['path'])-1);
|
||||
}
|
||||
if (isset($u['query'])){ // If there is a query string, then use identity as is
|
||||
$identity = $a;
|
||||
}else{
|
||||
$identity = $u['scheme'] . '://' . $u['host'] . $u['path'];
|
||||
}
|
||||
//*/
|
||||
$this->openid_url_identity = $a;
|
||||
}
|
||||
function GetIdentity(){ // Get Identity
|
||||
return $this->openid_url_identity;
|
||||
}
|
||||
function GetError(){
|
||||
$e = $this->error;
|
||||
return array('code'=>$e[0],'description'=>$e[1]);
|
||||
}
|
||||
|
||||
function ErrorStore($code, $desc = null){
|
||||
$errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.';
|
||||
if ($desc == null){
|
||||
$desc = $errs[$code];
|
||||
}
|
||||
$this->error = array($code,$desc);
|
||||
}
|
||||
|
||||
function IsError(){
|
||||
if (count($this->error) > 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function splitResponse($response) {
|
||||
$r = array();
|
||||
$response = explode("\n", $response);
|
||||
foreach($response as $line) {
|
||||
$line = trim($line);
|
||||
if ($line != "") {
|
||||
list($key, $value) = explode(":", $line, 2);
|
||||
$r[trim($key)] = trim($value);
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function OpenID_Standarize($openid_identity = null){
|
||||
if ($openid_identity === null)
|
||||
$openid_identity = $this->openid_url_identity;
|
||||
|
||||
$u = parse_url(strtolower(trim($openid_identity)));
|
||||
|
||||
if (!isset($u['path']) || ($u['path'] == '/')) {
|
||||
$u['path'] = '';
|
||||
}
|
||||
if(substr($u['path'],-1,1) == '/'){
|
||||
$u['path'] = substr($u['path'], 0, strlen($u['path'])-1);
|
||||
}
|
||||
if (isset($u['query'])){ // If there is a query string, then use identity as is
|
||||
return $u['host'] . $u['path'] . '?' . $u['query'];
|
||||
}else{
|
||||
return $u['host'] . $u['path'];
|
||||
}
|
||||
}
|
||||
|
||||
function array2url($arr){ // converts associated array to URL Query String
|
||||
if (!is_array($arr)){
|
||||
return false;
|
||||
}
|
||||
$query = '';
|
||||
foreach($arr as $key => $value){
|
||||
$query .= $key . "=" . $value . "&";
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
function FSOCK_Request($url, $method="GET", $params = ""){
|
||||
$fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds
|
||||
if (!$fp) {
|
||||
$this->ErrorStore('OPENID_SOCKETERROR', $errstr);
|
||||
return false;
|
||||
} else {
|
||||
$request = $method . " /server HTTP/1.0\r\n";
|
||||
$request .= "User-Agent: Simple OpenID PHP Class (http://www.phpclasses.org/simple_openid)\r\n";
|
||||
$request .= "Connection: close\r\n\r\n";
|
||||
fwrite($fp, $request);
|
||||
stream_set_timeout($fp, 4); // Connection response timeout is 4 seconds
|
||||
$res = fread($fp, 2000);
|
||||
$info = stream_get_meta_data($fp);
|
||||
fclose($fp);
|
||||
|
||||
if ($info['timed_out']) {
|
||||
$this->ErrorStore('OPENID_SOCKETTIMEOUT');
|
||||
} else {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
function CURL_Request($url, $method="GET", $params = "") { // Remember, SSL MUST BE SUPPORTED
|
||||
if (is_array($params)) $params = $this->array2url($params);
|
||||
$curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : ""));
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($curl, CURLOPT_HEADER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_HTTPGET, ($method == "GET"));
|
||||
curl_setopt($curl, CURLOPT_POST, ($method == "POST"));
|
||||
if ($method == "POST") curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl) == 0){
|
||||
$response;
|
||||
}else{
|
||||
$this->ErrorStore('OPENID_CURL', curl_error($curl));
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function HTML2OpenIDServer($content) {
|
||||
$get = array();
|
||||
|
||||
// Get details of their OpenID server and (optional) delegate
|
||||
preg_match_all('/<link[^>]*rel=[\'"](openid2.provider )?openid.server[\'"][^>]*href=[\'"]([^\'"]+)[\'"][^>]*\/?>/i', $content, $matches1);
|
||||
preg_match_all('/<link[^>]*href=\'"([^\'"]+)[\'"][^>]*rel=[\'"](openid2.provider )?openid.server[\'"][^>]*\/?>/i', $content, $matches2);
|
||||
$servers = array_merge($matches1[2], $matches2[1]);
|
||||
|
||||
preg_match_all('/<link[^>]*rel=[\'"]openid.delegate[\'"][^>]*href=[\'"]([^\'"]+)[\'"][^>]*\/?>/i', $content, $matches1);
|
||||
|
||||
preg_match_all('/<link[^>]*href=[\'"]([^\'"]+)[\'"][^>]*rel=[\'"]openid.delegate[\'"][^>]*\/?>/i', $content, $matches2);
|
||||
|
||||
$delegates = array_merge($matches1[1], $matches2[1]);
|
||||
|
||||
$ret = array($servers, $delegates);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function GetOpenIDServer(){
|
||||
$response = $this->CURL_Request($this->openid_url_identity);
|
||||
list($servers, $delegates) = $this->HTML2OpenIDServer($response);
|
||||
if (count($servers) == 0){
|
||||
$this->ErrorStore('OPENID_NOSERVERSFOUND');
|
||||
return false;
|
||||
}
|
||||
if (isset($delegates[0])
|
||||
&& ($delegates[0] != "")){
|
||||
$this->SetIdentity($delegates[0]);
|
||||
}
|
||||
$this->SetOpenIDServer($servers[0]);
|
||||
return $servers[0];
|
||||
}
|
||||
|
||||
function GetRedirectURL(){
|
||||
$params = array();
|
||||
$params['openid.return_to'] = urlencode($this->URLs['approved']);
|
||||
$params['openid.mode'] = 'checkid_setup';
|
||||
$params['openid.identity'] = urlencode($this->openid_url_identity);
|
||||
$params['openid.trust_root'] = urlencode($this->URLs['trust_root']);
|
||||
|
||||
if (isset($this->fields['required'])
|
||||
&& (count($this->fields['required']) > 0)) {
|
||||
$params['openid.sreg.required'] = implode(',',$this->fields['required']);
|
||||
}
|
||||
if (isset($this->fields['optional'])
|
||||
&& (count($this->fields['optional']) > 0)) {
|
||||
$params['openid.sreg.optional'] = implode(',',$this->fields['optional']);
|
||||
}
|
||||
return $this->URLs['openid_server'] . "?". $this->array2url($params);
|
||||
}
|
||||
|
||||
function Redirect(){
|
||||
$redirect_to = $this->GetRedirectURL();
|
||||
if (headers_sent()){ // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
|
||||
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
||||
echo $redirect_to;
|
||||
echo '\';</script>';
|
||||
}else{ // Default Header Redirect
|
||||
header('Location: ' . $redirect_to);
|
||||
}
|
||||
}
|
||||
|
||||
function ValidateWithServer(){
|
||||
$params = array(
|
||||
'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
|
||||
'openid.signed' => urlencode($_GET['openid_signed']),
|
||||
'openid.sig' => urlencode($_GET['openid_sig'])
|
||||
);
|
||||
// Send only required parameters to confirm validity
|
||||
$arr_signed = explode(",",str_replace('sreg.','sreg_',$_GET['openid_signed']));
|
||||
for ($i=0; $i<count($arr_signed); $i++){
|
||||
$s = str_replace('sreg_','sreg.', $arr_signed[$i]);
|
||||
$c = $_GET['openid_' . $arr_signed[$i]];
|
||||
// if ($c != ""){
|
||||
$params['openid.' . $s] = urlencode($c);
|
||||
// }
|
||||
}
|
||||
$params['openid.mode'] = "check_authentication";
|
||||
|
||||
$openid_server = $this->GetOpenIDServer();
|
||||
if ($openid_server == false){
|
||||
return false;
|
||||
}
|
||||
$response = $this->CURL_Request($openid_server,'POST',$params);
|
||||
$data = $this->splitResponse($response);
|
||||
|
||||
if ($data['is_valid'] == "true") {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
1740
apps/user_openid/phpmyid.php
Normal file
24
apps/user_openid/settings.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
require_once('../../lib/base.php');
|
||||
require( 'template.php' );
|
||||
if( !OC_USER::isLoggedIn()){
|
||||
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||
exit();
|
||||
}
|
||||
|
||||
if(isset($_POST['input_identity'])){
|
||||
OC_PREFERENCES::setValue(OC_USER::getUser(),'user_openid','identity',$_POST['input_identity']);
|
||||
}
|
||||
|
||||
OC_APP::setActiveNavigationEntry( "user_openid_settings" );
|
||||
|
||||
$identity=OC_PREFERENCES::getValue(OC_USER::getUser(),'user_openid','identity','');
|
||||
|
||||
$tmpl = new OC_TEMPLATE( "user_openid", "settings", "admin");
|
||||
$tmpl->assign('identity',$identity);
|
||||
$tmpl->assign('user',OC_USER::getUser());
|
||||
|
||||
$tmpl->printPage();
|
||||
|
||||
?>
|
28
apps/user_openid/templates/nomode.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
global $profile;
|
||||
|
||||
?>
|
||||
|
||||
<div id="login">
|
||||
<img src="<?php echo image_path("", "owncloud-logo-medium-white.png"); ?>" alt="ownCloud" />
|
||||
<ul>
|
||||
<li class='error'>
|
||||
<div id="setup_form">
|
||||
<p><?php echo($l->t('This is an OpenID server endpoint. For more information, see '));?><a href='http://openid.net/' title='openid.net'>http://openid.net/</a></p>
|
||||
<?php if($_['user']):?>
|
||||
<p><?php echo($l->t('Identity: <b>').$profile['idp_url']); ?></b></p>
|
||||
<p><?php echo($l->t('Realm: <b>').$profile['php_realm']); ?></b></p>
|
||||
<p><?php echo($l->t('User: <b>').$_['user']); ?></b>
|
||||
<p><a href="<?php echo($profile['idp_url']); ?>?openid.mode=login"><?php echo($l->t('Login')); ?></a>
|
||||
<?php if($profile['allow_test'] === true): ?>
|
||||
<a href="<?php echo($profile['idp_url']); ?>?openid.mode=test">Test</a>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<p><?php echo($l->t('Error: <b>No user Selected')); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
7
apps/user_openid/templates/settings.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<form id="identity" action='#' method='post'>
|
||||
<fieldset>
|
||||
<legend><?php echo $l->t( 'OpenID identity' );?></legend>
|
||||
<label for='input_identity'>OpenID identity for <b><?php echo $_['user'];?></b></label><br/>
|
||||
<input name='input_identity' id='input_identity' value="<?php echo $_['identity'];?>"/><input type='submit' value='Save'/>
|
||||
</fieldset>
|
||||
</form>
|
47
apps/user_openid/user.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Robin Appelman
|
||||
* @copyright 2011 Robin Appelman icewind1991@gmail.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
$USERNAME=substr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],'.php/')+5);
|
||||
if(strpos($USERNAME,'?')!==false){
|
||||
$USERNAME=substr($USERNAME,0,strpos($USERNAME,'?'));
|
||||
}
|
||||
|
||||
|
||||
if($USERNAME=='' and isset($_SERVER['PHP_AUTH_USER'])){
|
||||
$USERNAME=$_SERVER['PHP_AUTH_USER'];
|
||||
}
|
||||
|
||||
$RUNTIME_NOAPPS=true;
|
||||
$RUNTIME_NOAPPS=false;
|
||||
require_once '../../lib/base.php';
|
||||
|
||||
if(!OC_USER::userExists($USERNAME)){
|
||||
$USERNAME='';
|
||||
}
|
||||
global $WEBROOT;
|
||||
$IDENTITY=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$WEBROOT.'/apps/user_openid/user.php/'.$USERNAME;
|
||||
|
||||
require_once 'phpmyid.php';
|
||||
|
||||
|
||||
?>
|
71
apps/user_openid/user_openid.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Robin Appelman
|
||||
* @copyright 2011 Robin Appelman icewind1991gmailc.om
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('User/backend.php');
|
||||
require_once('class.openid.v3.php');
|
||||
|
||||
/**
|
||||
* Class for user management in a SQL Database (e.g. MySQL, SQLite)
|
||||
*/
|
||||
class OC_USER_OPENID extends OC_USER_BACKEND {
|
||||
/**
|
||||
* @brief Check if the password is correct
|
||||
* @param $uid The username
|
||||
* @param $password The password
|
||||
* @returns true/false
|
||||
*
|
||||
* Check if the password is correct without logging in the user
|
||||
*/
|
||||
public function checkPassword( $uid, $password ){
|
||||
global $WEBROOT;
|
||||
// Get identity from user and redirect browser to OpenID Server
|
||||
$openid = new SimpleOpenID;
|
||||
$openid->SetIdentity($uid);
|
||||
$openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"]);
|
||||
if ($openid->GetOpenIDServer()){
|
||||
$openid->SetApprovedURL('http://' . $_SERVER["HTTP_HOST"] . $WEBROOT); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
exit;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* find the user that can be authenticated with an openid identity
|
||||
*/
|
||||
public static function findUserForIdentity($identity){
|
||||
$query=OC_DB::prepare('SELECT userid FROM *PREFIX*preferences WHERE appid=? AND configkey=? AND configvalue=?');
|
||||
$result=$query->execute(array('user_openid','identity',$identity))->fetchAll();
|
||||
if(count($result)>0){
|
||||
return $result[0]['userid'];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
0
config/.gitignore
vendored
Normal file → Executable file
34
core/ajax/translations.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - ajax frontend
|
||||
*
|
||||
* @author Jakob Sack
|
||||
* @copyright 2011 Jakob Sack kde@jakobsack.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../lib/base.php');
|
||||
|
||||
$app = $_POST["app"];
|
||||
|
||||
// We send json data
|
||||
header( "Content-Type: application/jsonrequest" );
|
||||
$l = new OC_L10N( $app );
|
||||
|
||||
echo json_encode( array( 'status' => 'success', 'data' => $l->getTranslations()));
|
||||
?>
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 153 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
@ -269,6 +269,7 @@ p.actions a.delete, div.actions a.delete { background-image:url('../img/delete.p
|
|||
#logs_options span { margin:0 2em 0 0.5em; font-weight:bold; }
|
||||
#logs_options label { margin:0 1em 0 0; }
|
||||
#logs_options input[type="submit"] { float:right; margin:0 2em 0 0; }
|
||||
#logs_options input[type="submit"].nofloat { float:none; margin:0 2em 0 0; }
|
||||
#logs_options input[type="text"] { margin:0; padding:0; border:1px solid #ccc; text-align:right; }
|
||||
li.error{ list-style:none; width:640px; margin:4em auto; padding:1em 1em 1em 4em; background-color:#fee; background-image:url('../img/task-attention.png'); background-position:0.8em 0.8em; background-repeat:no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
|
||||
|
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 396 B |
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 695 B |
Before Width: | Height: | Size: 391 B After Width: | Height: | Size: 391 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
23
core/js/js.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
var _l10ncache = {};
|
||||
function t(app,text){
|
||||
if( !( app in _l10ncache )){
|
||||
$.post( oc_webroot+'/core/ajax/translations.php', {'app': app}, function(jsondata){
|
||||
_l10ncache[app] = jsondata.data;
|
||||
});
|
||||
|
||||
// Bad answer ...
|
||||
if( !( app in _l10ncache )){
|
||||
_l10ncache[app] = [];
|
||||
}
|
||||
}
|
||||
if( typeof( _l10ncache[app][text] ) !== 'undefined' ){
|
||||
return _l10ncache[app][text];
|
||||
}
|
||||
else{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
// Put fancy stuff in here
|
||||
});
|
27
core/l10n/da.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Error 404, Cloud not found" => "Fejl 404, Skyen kan ikke findes",
|
||||
"Welcome to <strong>ownCloud</strong>, your personnal cloud." => "Velkommen til <strong>ownCloud</strong>, din personlige Sky.",
|
||||
"To finish the installation, please follow the steps below." => "For at fuldføre installationen, følg venligst nedenstående trin",
|
||||
"Create an <strong>admin account.</strong>" => "Lav en <strong>administrator konto.</strong>",
|
||||
"Login:" => "Login:",
|
||||
"Password:" => "Kodeord:",
|
||||
"Advanced" => "Avanceret",
|
||||
"Set where to store the data." => "Indstil data mappe.",
|
||||
"Data directory:" => "Data mappe:",
|
||||
"Configure your database." => "Konfigurer din database.",
|
||||
"I will use a SQLite database. You have nothing to do!" => "Jeg vil benytte en SQLite database. Du skal ikke gøre noget!",
|
||||
"SQLite" => "SQLite",
|
||||
"I will use a MySQL database." => "Jeg vil benytte en MySQL database.",
|
||||
"Host:" => "Host:",
|
||||
"Database name:" => "Database navn:",
|
||||
"Table prefix:" => "Tabel prefix:",
|
||||
"MySQL user login:" => "MySQL bruger login:",
|
||||
"MySQL user password:" => "MySQL bruger password:",
|
||||
"Finish setup" => "Afslut installation",
|
||||
"<a href=\"http://owncloud.org/\">ownCloud</a> is a personal cloud which runs on your own server.</p>" => "<a href=\"http://owncloud.org/\">ownCloud</a> er din personly sky der køre på din egen server.</p>",
|
||||
"Login failed!" => "Login mislykkedes",
|
||||
"You are logged out." => "Du er nu logget ud",
|
||||
"prev" => "forrige",
|
||||
"next" => "næste",
|
||||
"Search" => "Søg"
|
||||
);
|
27
core/l10n/de.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Error 404, Cloud not found" => "Cloud konnte nicht gefunden werden.",
|
||||
"Welcome to <strong>ownCloud</strong>, your personnal cloud." => "Willkommen bei <strong>ownCloud</strong>, deinem persönlichen Online-Speicher.",
|
||||
"To finish the installation, please follow the steps below." => "Die Installation ist fast abgeschlossen.",
|
||||
"Create an <strong>admin account.</strong>" => "<strong>Verwaltungskonto</strong> erstellen.",
|
||||
"Login:" => "Benutzername:",
|
||||
"Password:" => "Passwort:",
|
||||
"Advanced" => "Erweitert",
|
||||
"Set where to store the data." => "Speicherort der Daten",
|
||||
"Data directory:" => "Datenverzeichnis:",
|
||||
"Configure your database." => "Datenbank einstellen.",
|
||||
"I will use a SQLite database. You have nothing to do!" => "Es wird eine SQLite-Datenbank genutzt.",
|
||||
"SQLite" => "SQLite",
|
||||
"I will use a MySQL database." => "Es wird eine MySQL-Datenbank genutzt.",
|
||||
"Host:" => "Host:",
|
||||
"Database name:" => "Datenbankname:",
|
||||
"Table prefix:" => "Tabellenpräfix:",
|
||||
"MySQL user login:" => "MySQL-Nutzername:",
|
||||
"MySQL user password:" => "MySQL-Passwort:",
|
||||
"<a href=\"http://owncloud.org/\">ownCloud</a> is a personal cloud which runs on your own server.</p>" => "<a href=\"http://owncloud.org/\">ownCloud</a> ist ein privater Online-Speicher für deinen eigenen Server.</p>",
|
||||
"Login failed!" => "Anmeldung Fehlgeschlagen!",
|
||||
"You are logged out." => "Sie wurden abgemeldet.",
|
||||
"prev" => "zurück",
|
||||
"next" => "weiter",
|
||||
"Search" => "Suchen",
|
||||
"Finish setup" => "Installation abschließen"
|
||||
);
|