コード例 #1
0
ファイル: MiniPlugin.php プロジェクト: youngsun45/miniyun
 /**
  * 静态方法, 单例统一访问入口
  * @return object  返回对象的唯一实例
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance) || !isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
ファイル: Setup3Form.php プロジェクト: youngsun45/miniyun
 public function save()
 {
     if ($this->validate()) {
         $userData = array("name" => $this->userName, "password" => $this->password, "is_admin" => 1, "email" => $this->email, "extend" => array("space" => $this->space));
         MiniUser::getInstance()->create($userData);
         MiniPlugin::getInstance()->enablePlugin("businessTheme");
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: SiteCommand.php プロジェクト: youngsun45/miniyun
 /**
  * 初始化插件
  */
 public function actionInitOfflinePlugin()
 {
     //拉上离线版插件
     MiniPlugin::getInstance()->enablePlugin("offline");
     //拉上商业版主题
     MiniPlugin::getInstance()->enablePlugin("businessTheme");
     //拉上迷你搜索
     MiniPlugin::getInstance()->enablePlugin("miniSearch");
     //拉上迷你文档
     MiniPlugin::getInstance()->enablePlugin("miniDoc");
     //拉上迷你存储
     MiniPlugin::getInstance()->enablePlugin("miniStore");
 }
コード例 #4
0
ファイル: yiic.php プロジェクト: youngsun45/miniyun
 * Yii command line script file.
 *
 * This script is meant to be run on command line to execute
 * one of the pre-defined console commands.
 *
 * @author Qiang Xue <*****@*****.**>
 * @link http://www.yiiframework.com/
 * @copyright 2008-2013 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */
// fix for fcgi
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
defined('YII_DEBUG') or define('YII_DEBUG', true);
require_once dirname(__FILE__) . '/yii.php';
if (isset($config)) {
    $app = Yii::createConsoleApplication($config);
    $app->commandRunner->addCommands(YII_PATH . '/cli/commands');
} else {
    $app = Yii::createConsoleApplication(array('basePath' => dirname(__FILE__) . '/cli'));
}
$env = @getenv('YII_CONSOLE_COMMANDS');
if (!empty($env)) {
    $app->commandRunner->addCommands($env);
}
//迷你云在这里对Yii代码做了侵入,因为它在执行console的command之前尚未对插件完成初始化
//如果YII要升级这里,要注意代码的的处理
try {
    MiniPlugin::getInstance()->load();
} catch (Exception $e) {
}
$app->run();
コード例 #5
0
ファイル: PluginBiz.php プロジェクト: youngsun45/miniyun
 /**
  * 搜索插件
  * @param $key
  */
 public function search($key)
 {
     return MiniPlugin::getInstance()->searchPlugins($key);
 }
コード例 #6
0
ファイル: miniWeixin.php プロジェクト: youngsun45/miniyun
 public function MiniWeixin()
 {
     //如果系统尚未初始化,则直接跳转到安装页面
     $configPath = dirname(__FILE__) . '/protected/config/miniyun-config.php';
     if (!file_exists($configPath)) {
         echo "迷你云尚未安装";
         exit;
     }
     //加载系统信息
     $config = dirname(__FILE__) . '/protected/config/main.php';
     $yii = dirname(__FILE__) . '/yii/framework/yii.php';
     require_once $yii;
     $this->webApp = Yii::createWebApplication($config);
     MiniAppParam::getInstance()->load();
     MiniPlugin::getInstance()->load();
     $port = $_SERVER["SERVER_PORT"];
     if ($port == "443") {
         $this->staticServerHost = "https://" . STATIC_SERVER_HOST . "/";
     } else {
         $this->staticServerHost = "http://" . STATIC_SERVER_HOST . "/";
     }
 }
コード例 #7
0
ファイル: miniBox.php プロジェクト: youngsun45/miniyun
 public function MiniBox()
 {
     $requestUri = Util::getRequestUri();
     $this->isMixCloudVersion = Util::isMixCloudVersion();
     //如果系统尚未初始化,则直接跳转到安装页面
     $configPath = dirname(__FILE__) . '/protected/config/miniyun-config.php';
     if (!file_exists($configPath) && !strpos($requestUri, "install")) {
         header('Location: ' . Util::getMiniHost() . "index.php/install/index");
         exit;
     }
     //加载系统信息
     $config = dirname(__FILE__) . '/protected/config/main.php';
     $yii = dirname(__FILE__) . '/yii/framework/yii.php';
     require_once $yii;
     $this->webApp = Yii::createWebApplication($config);
     MiniAppParam::getInstance()->load();
     MiniPlugin::getInstance()->load();
     //根据外部的参数判断是什么客户端
     $this->isWeb = !Util::isPCClient();
     //初始化cookie等信息
     $accessToken = Util::getParam("accessToken");
     if (!empty($accessToken)) {
         Yii::app()->session["accessToken"] = $accessToken;
         setcookie("accessToken", $accessToken, time() + 10 * 24 * 3600, "/");
     }
     $version = Util::getParam("cloudVersion");
     if (!empty($version)) {
         setcookie("cloudVersion", $version, time() + 10 * 24 * 3600, "/");
     }
     $appKey = Util::getParam("appKey");
     if (!empty($appKey)) {
         setcookie("appKey", $appKey, time() + 10 * 24 * 3600, "/");
     }
     $appSecret = Util::getParam("appSecret");
     if (!empty($appSecret)) {
         setcookie("appSecret", $appSecret, time() + 10 * 24 * 3600, "/");
     }
     //根据物理路径判断网页客户端本地是否存在
     $this->offline = $this->isOffline();
     if ($this->isMixCloudVersion) {
         $port = $_SERVER["SERVER_PORT"];
         if ($port == "443") {
             $this->staticServerHost = "https://" . STATIC_SERVER_HOST . "/";
         } else {
             $this->staticServerHost = "http://" . STATIC_SERVER_HOST . "/";
         }
     } else {
         //私有云模式下
         $this->staticServerHost = "http://" . $_SERVER["HTTP_HOST"] . "/statics/";
     }
     //解析形如/index.php/site/login?backUrl=/index.php/box/index这样的字符串
     //提取出controller与action
     $uriInfo = explode("/", $requestUri);
     if (count($uriInfo) === 1) {
         //用户输入的是根路径
         $url = Util::getMiniHost() . "index.php/box/index";
         $this->redirectUrl($url);
     }
     //兼容/index.php/box,自动到/index.php/box/index下
     $this->controller = $uriInfo[1];
     if ($this->controller === "k") {
         //外链短地址
         $key = $uriInfo[2];
         $url = Util::getMiniHost() . "index.php/link/access/key/" . $key;
         $this->redirectUrl($url);
     }
     if (count($uriInfo) === 2 || empty($uriInfo[2])) {
         if (empty($this->controller)) {
             $this->controller = "box";
         }
         $url = Util::getMiniHost() . "index.php/" . $this->controller . "/index";
         $this->redirectUrl($url);
     } else {
         $actionInfo = explode("?", $uriInfo[2]);
         $this->action = $actionInfo[0];
     }
     if ($this->isWeb) {
         if (empty($this->controller)) {
             $accessToken = $this->getCookie("accessToken");
             if (!empty($accessToken)) {
                 //根目录访问
                 if ($this->offline) {
                     $url = Util::getMiniHost() . "index.php/netdisk/index";
                 } else {
                     $url = Util::getMiniHost() . "index.php/box/index";
                 }
             } else {
                 $url = Util::getMiniHost() . "index.php/site/login";
             }
             $this->redirectUrl($url);
         }
     }
 }
コード例 #8
0
 /**
  * 成功安装页面
  */
 public function actionSetup3()
 {
     $this->layout = '//layouts/install';
     MiniPlugin::getInstance()->enablePlugin("businessTheme");
     $this->render('setup3', array());
 }