<span style="font-family:SimSun;"><span style="font-size:12px;"><span style="line-height: 21px;"></span></span></span>
最近项目需求要了解owncloud这个开源的软件。来自开源中国上的介绍wnCloud 是一个来自 KDE 社区开发的免费软件,提供私人的 Web 服务。当前主要功能包括文件管理(内建文件分享)、音乐、日历、联系人等等,可在PC和服务器上运行。简单来说就是一个基于Php的自建网盘。基本上是私人使用这样,因为直到现在开发版本也没有暴露注册功能。
现在分析一下登录过程,因为看了好久的源码,里边全都是PHP面向对象的写法,自己是个菜鸟,看不懂,只能蒙着找。大概理请了一下思路:
1.首先从index.php着手,因为我们用浏览器访问目录的时候默认就是这个。看一下源码:
<?php
/**
* @author Frank Karlitschek <frank@owncloud.org>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@owncloud.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <icewind@owncloud.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
// Show warning if a PHP version below 5.4.0 is used, this has to happen here
// because base.php will already use 5.4 syntax.
if (version_compare(PHP_VERSION, '5.4.0') === -1) {
echo 'This version of ownCloud requires at least PHP 5.4.0<br/>';
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
return;
}
try {
require_once 'lib/base.php';
OC::handleRequ