See http://rockmongo.com for more details.
- -If you have any questions, please send email to me: iwind.liu@gmail.com .
'; - + + * @version 1.0 + */ + +$message["TRANSLATION_NAME"] = "日本語 - Jananese"; +$message["TRANSLATION_ID"] = 4; + +/** connection **/ +$message["can_not_connect"] = "MongoDB connection exception: %s. Please check your configuration."; + +/** buttons and titles **/ +$message["server"] = "サーバー"; +$message["status"] = "ステータス"; +$message["databases"] = "データベース"; +$message["processlist"] = "Processlist"; +$message["command"] = "コマンド"; +$message["execute"] = "実行"; +$message["master_slave"] = "マスター/スレーブ"; +$message["query"] = "クエリー"; +$message["refresh"] = "リフレッシュ"; +$message["insert"] = "挿入"; +$message["clear"] = "Clear"; +$message["delete"] = "削除"; +$message["update"] = "更新"; +$message["duplicate"] = "重複"; +$message["text"] = "Text"; +$message["statistics"] = "統計"; +$message["export"] = "輸出"; +$message["import"] = "インポート"; +$message["transfer"] = "転送"; +$message["drop"] = "ドロップ"; +$message["more"] = "もっと"; +$message["rename"] = "リネーム"; +$message["indexes"] = "インデックス"; +$message["properties"] = "プロパティ"; +$message["validate"] = "検証"; +$message["repair"] = "修理"; +$message["authentication"] = "認証"; +$message["profile"] = "Profile"; +$message["create_collection"] = "New Collection"; +$message["create_collection_full"] = "Create new Collection"; +$message["create_database"] = "Create new Database"; +$message["save"] = "保存"; +$message["back"] = "バック"; + +/** collection operations **/ +$message["submit_query"] = "Submit Query"; +$message["explain"] = "Explain"; +$message["clear_conditions"] = "Clear Conditions"; +$message["rows_per_page"] = "Rows per Page"; +$message["action"] = "アクション"; +$message["limit"] = "制限"; + +/** top bar **/ +$message["tools"] = "ツール"; +$message["manuals"] = "マニュアル"; +$message["logout"] = "ログアウト"; + +/** about **/ +$message["about_content"] = 'RockMongo is a MongoDB administration tool, written in PHP 5. + +See http://rockmongo.com for more details.
+ +If you have any questions, please send email to me: iwind.liu@gmail.com .
'; + ?> \ No newline at end of file diff --git a/app/langs/pt_br/message.php b/app/langs/pt_br/message.php index 5c21220..6363dee 100644 --- a/app/langs/pt_br/message.php +++ b/app/langs/pt_br/message.php @@ -6,7 +6,7 @@ * @author Klaus SilveiraVisite http://rockmongo.com para mais detalhes.
- -Se têm alguma dúvida, envie um email para: iwind.liu@gmail.com .
'; - + + * @version 1.1 + */ + +$message["TRANSLATION_NAME"] = "Português - Portugal"; +$message["TRANSLATION_ID"] = 11; + +/** Conexão **/ +$message["can_not_connect"] = "Impossível conectar com o MongoDB: %s. Verifique a configuração"; + +/** Botões e Títulos **/ +$message["server"] = "Servidor"; +$message["status"] = "Estado"; +$message["databases"] = "Base de Dados"; +$message["processlist"] = "Processos"; +$message["command"] = "Comando"; +$message["execute"] = "Executar"; +$message["master_slave"] = "Master/Slave"; +$message["query"] = "Query"; +$message["refresh"] = "Atualizar"; +$message["insert"] = "Inserir"; +$message["clear"] = "Limpar"; +$message["delete"] = "Apagar"; +$message["update"] = "Atualizar"; +$message["duplicate"] = "Duplicar"; +$message["text"] = "Texto"; +$message["statistics"] = "Estatísticas"; +$message["export"] = "Exportar"; +$message["import"] = "Importar"; +$message["transfer"] = "Transferir"; +$message["drop"] = "Apagar"; +$message["more"] = "Mais"; +$message["rename"] = "Renomear"; +$message["indexes"] = "Índices"; +$message["properties"] = "Propriedades"; +$message["validate"] = "Validar"; +$message["repair"] = "Reparar"; +$message["authentication"] = "Autenticação"; +$message["profile"] = "Perfil"; +$message["create_collection"] = "Nova Coleção"; +$message["create_collection_full"] = "Criar nova Coleção"; +$message["create_database"] = "Criar nova Base de Dados"; +$message["save"] = "Salvar"; +$message["back"] = "Voltar"; + +/** Operações de Coleções **/ +$message["submit_query"] = "Enviar Query"; +$message["explain"] = "Explicar"; +$message["clear_conditions"] = "Limpar Condições"; +$message["rows_per_page"] = "Linhas por Página"; +$message["action"] = "Ação"; +$message["limit"] = "Limite"; + +/** Barra do Topo **/ +$message["tools"] = "Ferramentas"; +$message["manuals"] = "Manuais"; +$message["logout"] = "Sair"; + +/** Sobre **/ +$message["about_content"] = 'RockMongo é uma ferramenta de administração para o MongoDB, escrito em PHP 5. + +Visite http://rockmongo.com para mais detalhes.
+ +Se têm alguma dúvida, envie um email para: iwind.liu@gmail.com .
'; + ?> \ No newline at end of file diff --git a/app/langs/ru_ru/message.php b/app/langs/ru_ru/message.php index 29c4942..63ae739 100644 --- a/app/langs/ru_ru/message.php +++ b/app/langs/ru_ru/message.php @@ -1,210 +1,210 @@ - - * @version 1.1 - */ - -$message["TRANSLATION_NAME"] = "Русский - Russian"; -$message["TRANSLATION_ID"] = 9; - -/** Login interface **/ -$message["admin"] = "Администратор"; -$message["password"] = "Пароль"; -$message["language"] = "Язык"; -$message["hour"] = "Час"; -$message["hours"] = "Часы"; -$message["month"] = "Месяц"; -$message["alive"] = "Работает"; -$message["authenticate"] = "Войти"; - -/** Connection **/ -$message["can_not_connect"] = "Ошибка подключения к MongoDB: %s. Проверьте конфигурацию."; -$message["can_not_auth"] = "Аутентификация в MongoDB не удалась. Проверьте имя пользователя и пароль администратора MongoDB."; - -/** Buttons and titles **/ -$message["overview"] = "Обзор"; -$message["server"] = "Сервер"; -$message["status"] = "Статус"; -$message["databases"] = "Базы данных"; -$message["processlist"] = "Список процессов"; -$message["command"] = "Команда"; -$message["execute"] = "Выполнить"; -$message["master"] = "Мастер"; -$message["masters"] = "Мастера"; -$message["slave"] = "Slave"; -$message["slaves"] = "Slaves"; -$message["master_slave"] = "Master/Slave"; -$message["query"] = "Запрос"; -$message["refresh"] = "Обновить"; -$message["insert"] = "Вставить"; -$message["add"] = "Добавить"; -$message["clear"] = "Очистить"; -$message["delete"] = "Удалить"; -$message["remove"] = "Удалить"; -$message["argument"] = "Аргумент"; -$message["update"] = "Обновить"; -$message["duplicate"] = "Дубликат"; -$message["text"] = "Текст"; -$message["yes"] = "Да"; -$message["no"] = "Нет"; -$message["statistics"] = "Статистика"; -$message["export"] = "Экспорт"; -$message["import"] = "Импорт"; -$message["transfer"] = "Перенос"; -$message["drop"] = "Удалить"; -$message["more"] = "Ещё"; -$message["rename"] = "Переименовать"; -$message["indexes"] = "Индексы"; -$message["properties"] = "Свойства"; -$message["validate"] = "Валидировать"; -$message["repair"] = "Исправить"; -$message["all"] = "Все"; -$message["authentication"] = "Аутентификация"; -$message["profile"] = "Профилировка"; -$message["create_collection"] = "Новая коллекция"; -$message["create_collection_full"] = "Создать новую коллекцию"; -$message["create_database"] = "Создать новую базу данных"; -$message["save"] = "Сохранить"; -$message["back"] = "Назад"; -$message["server_status"] = "Статус сервера"; -$message["command_line"] = "Командная строка"; -$message["connection"] = "Подключение"; -$message["web"] = "Веб"; -$message["directives"] = "Директивы"; -$message["directive"] = "Директива"; -$message["global_value"] = "Глобальное значение"; -$message["local_value"] = "Локальное значение"; -$message["build_info"] = "Информация о сборке"; -$message["kill"] = "Завершить"; -$message["killop"] = "Вы уверены, что желаете завершить операцию"; -$message["killoperation"] = "Завершить операцию"; -$message["create"] = "Создать"; -$message["name"] = "Имя"; -$message["newname"] = "Новое имя"; -$message["oldname"] = "Старое имя"; -$message["iscapped"] = "Is Capped"; -$message["size"] = "Размер"; -$message["max"] = "Макс"; -$message["modifyrow"] = "Изменить запись"; -$message["data"] = "Данные"; -$message["validarray"] = "Данные должны быть корректным массивом PHP:"; -$message["responseserver"] = "Ответ сервера:"; -$message["db"] = "БД"; -$message["gotodbs"] = "Перейти к базам данных"; -$message["dropdatabase"] = "Удалить базу данных"; -$message["dropwarning"] = "Внимание: вы уверены, что желаете удалить базу данных"; -$message["dropwarning2"] = "Все данные в базе будут утеряны!"; -$message["createrow"] = "Создать запись"; -$message["storagesize"] = "Размер хранилища"; -$message["datasize"] = "Размер данных"; -$message["indexsize"] = "Размер индекса"; -$message["collections"] = "Коллекции"; -$message["objects"] = "Объект"; -$message["repairdbmsg"] = "Вы уверены, что желаете восстановить базу данных"; -$message["nocollections"] = "В базе нет коллекций, невозможно выполнить перенос."; -$message["nocollections2"] = "Нет коллекций"; -$message["download"] = "Загрузить?"; -$message["compressed"] = "Сжатый"; -$message["rowsexported"] = "записей экспортировано"; -$message["createnewcollection"] = "Создать новую коллекцию в базе"; -$message["target"] = "Цель"; -$message["host"] = "Хост"; -$message["port"] = "Порт"; -$message["copyindexes"] = "Копировать индексы?"; -$message["confirm"] = "Подтвердить"; -$message["fields"] = "Поля"; -$message["unique"] = "Уникальные"; -$message["key"] = "Ключ"; -$message["operation"] = "Операция"; -$message["removeduplicates"] = "Удалить дубликаты?"; -$message["listdbcommands"] = "Список команд БД"; -$message["format"] = "Формат"; -$message["execute_command"] = "Выполнить команду"; -$message["validate"] = "Валидировать"; -$message["dropifexists"] = "Удалить если существует?"; -$message["warningprops"] = "Замечание: для изменений опций коллекции будет создана новая, в которую будут перенесены все данные. Для больших коллекций это может занять много времени."; -$message["warningindex"] = "Вы уверены, что желаете удалить индекс"; -$message["createindex"] = "Создать индекс"; -$message["copycollection"] = "Копировать коллекцию"; -$message["to"] = "В"; -$message["removeifexists"] = "Удалить цель если существует?"; -$message["selectdb"] = "Выбор базы данных"; - -/** Add user **/ -$message["users"] = "Пользователи"; -$message["adduser"] = "Добавить пользователя"; -$message["username"] = "Имя пользователя"; -$message["confirm_pass"] = "Подтверждение пароля"; -$message["readonly"] = "Только для чтения?"; -$message["addreplace"] = "Добавить или заменить"; - -/** Manual links **/ -$message["querying"] = "Запросы"; -$message["updating"] = "Изменение"; -$message["commands"] = "Команды"; -$message["jsapi"] = "JS API"; -$message["phpmongo"] = "PHP Mongo"; - -/** Replication **/ -$message["repstatus"] = "Статус репликации"; -$message["me"] = "Me"; - -$message["repstatus"] = "Исправить базу данных"; -$message["response_from_server"] = "Ответ сервера"; - -$message["dropped_from_database"] = "удалено с сервера"; - -$message["noqueryhistory"] = "Нет истории запросов."; -$message["requery"] = "Повторить запрос"; - -$message["date"] = "Дата"; -$message["change_level"] = "Изменить уровень"; -$message["clear_profile"] = "Вы уверены, что желаете очистить профиль для базы"; -$message["choose_profiling_level"] = "Выбрать текущий уровень профилировки"; -$message["profiling_level1"] = "0 - выкл"; -$message["profiling_level2"] = "1 - логировать медленные операции (>N ms)"; -$message["profiling_level3"] = "2 - логировать все операции"; -$message["timecost"] = "Стоимость времени"; - -/** Collection operations **/ -$message["submit_query"] = "Отправить запрос"; -$message["explain"] = "Описать"; -$message["clear_conditions"] = "Очистить условия"; -$message["rows_per_page"] = "Записей на странице"; -$message["action"] = "Действие"; -$message["limit"] = "Лимит"; -$message["new_field"] = "Новое поле"; - -/** Top bar **/ -$message["tools"] = "Инструменты"; -$message["manuals"] = "Документация"; -$message["logout"] = "Выход"; - -$message["switch_hosts"] = "Switch Hosts"; - -/** About **/ -$message["about_content"] = 'RockMongo --- инструмент администрирования MongoDB, написанный на PHP5. - -См. http://rockmongo.com подробнее.
- -Вопросы можно писать Xiangchao Liu: iwind.liu@gmail.com .
- -Документация:
-'; - -/** Login **/ -$message["loginandrock"] = "Войти и отжечь"; -$message["changeconfig"] = "Можно изменить имя пользователя и пароль в config.php."; -$message["rockmongocredits"] = "Работает на RockMongo v" . (ROCK_MONGO_VERSION) . ", посмотреть новую версию."; - -?> + + * @version 1.1 + */ + +$message["TRANSLATION_NAME"] = "Русский - Russian"; +$message["TRANSLATION_ID"] = 9; + +/** Login interface **/ +$message["admin"] = "Администратор"; +$message["password"] = "Пароль"; +$message["language"] = "Язык"; +$message["hour"] = "Час"; +$message["hours"] = "Часы"; +$message["month"] = "Месяц"; +$message["alive"] = "Работает"; +$message["authenticate"] = "Войти"; + +/** Connection **/ +$message["can_not_connect"] = "Ошибка подключения к MongoDB: %s. Проверьте конфигурацию."; +$message["can_not_auth"] = "Аутентификация в MongoDB не удалась. Проверьте имя пользователя и пароль администратора MongoDB."; + +/** Buttons and titles **/ +$message["overview"] = "Обзор"; +$message["server"] = "Сервер"; +$message["status"] = "Статус"; +$message["databases"] = "Базы данных"; +$message["processlist"] = "Список процессов"; +$message["command"] = "Команда"; +$message["execute"] = "Выполнить"; +$message["master"] = "Мастер"; +$message["masters"] = "Мастера"; +$message["slave"] = "Slave"; +$message["slaves"] = "Slaves"; +$message["master_slave"] = "Master/Slave"; +$message["query"] = "Запрос"; +$message["refresh"] = "Обновить"; +$message["insert"] = "Вставить"; +$message["add"] = "Добавить"; +$message["clear"] = "Очистить"; +$message["delete"] = "Удалить"; +$message["remove"] = "Удалить"; +$message["argument"] = "Аргумент"; +$message["update"] = "Обновить"; +$message["duplicate"] = "Дубликат"; +$message["text"] = "Текст"; +$message["yes"] = "Да"; +$message["no"] = "Нет"; +$message["statistics"] = "Статистика"; +$message["export"] = "Экспорт"; +$message["import"] = "Импорт"; +$message["transfer"] = "Перенос"; +$message["drop"] = "Удалить"; +$message["more"] = "Ещё"; +$message["rename"] = "Переименовать"; +$message["indexes"] = "Индексы"; +$message["properties"] = "Свойства"; +$message["validate"] = "Валидировать"; +$message["repair"] = "Исправить"; +$message["all"] = "Все"; +$message["authentication"] = "Аутентификация"; +$message["profile"] = "Профилировка"; +$message["create_collection"] = "Новая коллекция"; +$message["create_collection_full"] = "Создать новую коллекцию"; +$message["create_database"] = "Создать новую базу данных"; +$message["save"] = "Сохранить"; +$message["back"] = "Назад"; +$message["server_status"] = "Статус сервера"; +$message["command_line"] = "Командная строка"; +$message["connection"] = "Подключение"; +$message["web"] = "Веб"; +$message["directives"] = "Директивы"; +$message["directive"] = "Директива"; +$message["global_value"] = "Глобальное значение"; +$message["local_value"] = "Локальное значение"; +$message["build_info"] = "Информация о сборке"; +$message["kill"] = "Завершить"; +$message["killop"] = "Вы уверены, что желаете завершить операцию"; +$message["killoperation"] = "Завершить операцию"; +$message["create"] = "Создать"; +$message["name"] = "Имя"; +$message["newname"] = "Новое имя"; +$message["oldname"] = "Старое имя"; +$message["iscapped"] = "Is Capped"; +$message["size"] = "Размер"; +$message["max"] = "Макс"; +$message["modifyrow"] = "Изменить запись"; +$message["data"] = "Данные"; +$message["validarray"] = "Данные должны быть корректным массивом PHP:"; +$message["responseserver"] = "Ответ сервера:"; +$message["db"] = "БД"; +$message["gotodbs"] = "Перейти к базам данных"; +$message["dropdatabase"] = "Удалить базу данных"; +$message["dropwarning"] = "Внимание: вы уверены, что желаете удалить базу данных"; +$message["dropwarning2"] = "Все данные в базе будут утеряны!"; +$message["createrow"] = "Создать запись"; +$message["storagesize"] = "Размер хранилища"; +$message["datasize"] = "Размер данных"; +$message["indexsize"] = "Размер индекса"; +$message["collections"] = "Коллекции"; +$message["objects"] = "Объект"; +$message["repairdbmsg"] = "Вы уверены, что желаете восстановить базу данных"; +$message["nocollections"] = "В базе нет коллекций, невозможно выполнить перенос."; +$message["nocollections2"] = "Нет коллекций"; +$message["download"] = "Загрузить?"; +$message["compressed"] = "Сжатый"; +$message["rowsexported"] = "записей экспортировано"; +$message["createnewcollection"] = "Создать новую коллекцию в базе"; +$message["target"] = "Цель"; +$message["host"] = "Хост"; +$message["port"] = "Порт"; +$message["copyindexes"] = "Копировать индексы?"; +$message["confirm"] = "Подтвердить"; +$message["fields"] = "Поля"; +$message["unique"] = "Уникальные"; +$message["key"] = "Ключ"; +$message["operation"] = "Операция"; +$message["removeduplicates"] = "Удалить дубликаты?"; +$message["listdbcommands"] = "Список команд БД"; +$message["format"] = "Формат"; +$message["execute_command"] = "Выполнить команду"; +$message["validate"] = "Валидировать"; +$message["dropifexists"] = "Удалить если существует?"; +$message["warningprops"] = "Замечание: для изменений опций коллекции будет создана новая, в которую будут перенесены все данные. Для больших коллекций это может занять много времени."; +$message["warningindex"] = "Вы уверены, что желаете удалить индекс"; +$message["createindex"] = "Создать индекс"; +$message["copycollection"] = "Копировать коллекцию"; +$message["to"] = "В"; +$message["removeifexists"] = "Удалить цель если существует?"; +$message["selectdb"] = "Выбор базы данных"; + +/** Add user **/ +$message["users"] = "Пользователи"; +$message["adduser"] = "Добавить пользователя"; +$message["username"] = "Имя пользователя"; +$message["confirm_pass"] = "Подтверждение пароля"; +$message["readonly"] = "Только для чтения?"; +$message["addreplace"] = "Добавить или заменить"; + +/** Manual links **/ +$message["querying"] = "Запросы"; +$message["updating"] = "Изменение"; +$message["commands"] = "Команды"; +$message["jsapi"] = "JS API"; +$message["phpmongo"] = "PHP Mongo"; + +/** Replication **/ +$message["repstatus"] = "Статус репликации"; +$message["me"] = "Me"; + +$message["repstatus"] = "Исправить базу данных"; +$message["response_from_server"] = "Ответ сервера"; + +$message["dropped_from_database"] = "удалено с сервера"; + +$message["noqueryhistory"] = "Нет истории запросов."; +$message["requery"] = "Повторить запрос"; + +$message["date"] = "Дата"; +$message["change_level"] = "Изменить уровень"; +$message["clear_profile"] = "Вы уверены, что желаете очистить профиль для базы"; +$message["choose_profiling_level"] = "Выбрать текущий уровень профилировки"; +$message["profiling_level1"] = "0 - выкл"; +$message["profiling_level2"] = "1 - логировать медленные операции (>N ms)"; +$message["profiling_level3"] = "2 - логировать все операции"; +$message["timecost"] = "Стоимость времени"; + +/** Collection operations **/ +$message["submit_query"] = "Отправить запрос"; +$message["explain"] = "Описать"; +$message["clear_conditions"] = "Очистить условия"; +$message["rows_per_page"] = "Записей на странице"; +$message["action"] = "Действие"; +$message["limit"] = "Лимит"; +$message["new_field"] = "Новое поле"; + +/** Top bar **/ +$message["tools"] = "Инструменты"; +$message["manuals"] = "Документация"; +$message["logout"] = "Выход"; + +$message["switch_hosts"] = "Switch Hosts"; + +/** About **/ +$message["about_content"] = 'RockMongo --- инструмент администрирования MongoDB, написанный на PHP5. + +См. http://rockmongo.com подробнее.
+ +Вопросы можно писать Xiangchao Liu: iwind.liu@gmail.com .
+ +Документация:
+'; + +/** Login **/ +$message["loginandrock"] = "Войти и отжечь"; +$message["changeconfig"] = "Можно изменить имя пользователя и пароль в config.php."; +$message["rockmongocredits"] = "Работает на RockMongo v" . (ROCK_MONGO_VERSION) . ", посмотреть новую версию."; + +?> diff --git a/app/langs/zh_cn/message.php b/app/langs/zh_cn/message.php index fcb662c..ad03bb7 100644 --- a/app/langs/zh_cn/message.php +++ b/app/langs/zh_cn/message.php @@ -1,81 +1,81 @@ - - * @version 1.0 - */ - -$message["TRANSLATION_NAME"] = "简体中文 - Chinese simplified"; -$message["TRANSLATION_ID"] = 2; - -/** login interface **/ -$message["admin"] = "管理员"; -$message["password"] = "密码"; -$message["language"] = "语言"; -$message["hour"] = "小时"; -$message["hours"] = "小时"; -$message["month"] = "月"; -$message["alive"] = "有效期"; - -/** connection **/ -$message["can_not_connect"] = "MongoDB连接错误: %s. 请检查配置是否正确."; - -$message["overview"] = "全局"; -$message["server"] = "服务器"; -$message["status"] = "状态"; -$message["databases"] = "数据库"; -$message["processlist"] = "进程"; -$message["command"] = "命令"; -$message["execute"] = "代码执行"; -$message["master_slave"] = "主/从"; -$message["query"] = "查询"; -$message["refresh"] = "刷新"; -$message["insert"] = "插入"; -$message["clear"] = "清除"; -$message["delete"] = "删除"; -$message["update"] = "更新"; -$message["duplicate"] = "复制"; -$message["text"] = "文本"; -$message["statistics"] = "统计"; -$message["export"] = "导出"; -$message["import"] = "导入"; -$message["transfer"] = "克隆"; -$message["drop"] = "删除"; -$message["more"] = "更多"; -$message["rename"] = "更名"; -$message["indexes"] = "索引"; -$message["properties"] = "属性"; -$message["validate"] = "校验"; -$message["repair"] = "修复"; -$message["authentication"] = "用户"; -$message["profile"] = "调试信息"; -$message["create_collection"] = "创建集合"; -$message["create_collection_full"] = "创建集合"; -$message["create_database"] = "创建数据库"; -$message["save"] = "保存"; -$message["back"] = "返回"; - - -$message["submit_query"] = "查询"; -$message["explain"] = "分析"; -$message["clear_conditions"] = "清除条件"; -$message["rows_per_page"] = "每页显示数"; -$message["action"] = "动作"; -$message["limit"] = "条数"; -$message["new_field"] = "新字段"; - -$message["tools"] = "工具"; -$message["manuals"] = "手册"; -$message["logout"] = "退出"; - -/** about **/ -$message["loginandrock"] = "登录"; -$message["about_content"] = 'RockMongo是可视化的MongoDB管理工具. - -请访问 http://rockmongo.com 获取更多信息.
- -如果有任何问题和反馈,请发送邮件到:iwind.liu@gmail.com .
'; - + + * @version 1.0 + */ + +$message["TRANSLATION_NAME"] = "简体中文 - Chinese simplified"; +$message["TRANSLATION_ID"] = 2; + +/** login interface **/ +$message["admin"] = "管理员"; +$message["password"] = "密码"; +$message["language"] = "语言"; +$message["hour"] = "小时"; +$message["hours"] = "小时"; +$message["month"] = "月"; +$message["alive"] = "有效期"; + +/** connection **/ +$message["can_not_connect"] = "MongoDB连接错误: %s. 请检查配置是否正确."; + +$message["overview"] = "全局"; +$message["server"] = "服务器"; +$message["status"] = "状态"; +$message["databases"] = "数据库"; +$message["processlist"] = "进程"; +$message["command"] = "命令"; +$message["execute"] = "代码执行"; +$message["master_slave"] = "主/从"; +$message["query"] = "查询"; +$message["refresh"] = "刷新"; +$message["insert"] = "插入"; +$message["clear"] = "清除"; +$message["delete"] = "删除"; +$message["update"] = "更新"; +$message["duplicate"] = "复制"; +$message["text"] = "文本"; +$message["statistics"] = "统计"; +$message["export"] = "导出"; +$message["import"] = "导入"; +$message["transfer"] = "克隆"; +$message["drop"] = "删除"; +$message["more"] = "更多"; +$message["rename"] = "更名"; +$message["indexes"] = "索引"; +$message["properties"] = "属性"; +$message["validate"] = "校验"; +$message["repair"] = "修复"; +$message["authentication"] = "用户"; +$message["profile"] = "调试信息"; +$message["create_collection"] = "创建集合"; +$message["create_collection_full"] = "创建集合"; +$message["create_database"] = "创建数据库"; +$message["save"] = "保存"; +$message["back"] = "返回"; + + +$message["submit_query"] = "查询"; +$message["explain"] = "分析"; +$message["clear_conditions"] = "清除条件"; +$message["rows_per_page"] = "每页显示数"; +$message["action"] = "动作"; +$message["limit"] = "条数"; +$message["new_field"] = "新字段"; + +$message["tools"] = "工具"; +$message["manuals"] = "手册"; +$message["logout"] = "退出"; + +/** about **/ +$message["loginandrock"] = "登录"; +$message["about_content"] = 'RockMongo是可视化的MongoDB管理工具. + +请访问 http://rockmongo.com 获取更多信息.
+ +如果有任何问题和反馈,请发送邮件到:iwind.liu@gmail.com .
'; + ?> \ No newline at end of file diff --git a/app/langs/zh_tw/message.php b/app/langs/zh_tw/message.php index 7139576..1b150c2 100644 --- a/app/langs/zh_tw/message.php +++ b/app/langs/zh_tw/message.php @@ -1,81 +1,81 @@ - - * @version 1.0 - */ - -$message["TRANSLATION_NAME"] = "繁體中文 - Chinese traditional"; -$message["TRANSLATION_ID"] = 3; - -/** login interface **/ -$message["admin"] = "管理員"; -$message["password"] = "密碼"; -$message["language"] = "語言"; -$message["hour"] = "小時"; -$message["hours"] = "小時"; -$message["month"] = "月"; -$message["alive"] = "有效期"; - -/** connection **/ -$message["can_not_connect"] = "MongoDB連接錯誤: %s. 請檢查配置是否正確."; - -$message["overview"] = "全局"; -$message["server"] = "服務器"; -$message["status"] = "狀態"; -$message["databases"] = "數據庫"; -$message["processlist"] = "進程"; -$message["command"] = "命令"; -$message["execute"] = "代碼執行"; -$message["master_slave"] = "主/從"; -$message["query"] = "查詢"; -$message["refresh"] = "刷新"; -$message["insert"] = "插入"; -$message["clear"] = "清除"; -$message["delete"] = "刪除"; -$message["update"] = "更新"; -$message["duplicate"] = "復制"; -$message["text"] = "文本"; -$message["statistics"] = "統計"; -$message["export"] = "導出"; -$message["import"] = "導入"; -$message["transfer"] = "克隆"; -$message["drop"] = "刪除"; -$message["more"] = "更多"; -$message["rename"] = "更名"; -$message["indexes"] = "索引"; -$message["properties"] = "屬性"; -$message["validate"] = "校驗"; -$message["repair"] = "修復"; -$message["authentication"] = "用戶"; -$message["profile"] = "調試信息"; -$message["create_collection"] = "創建集合"; -$message["create_collection_full"] = "創建集合"; -$message["create_database"] = "創建數據庫"; -$message["save"] = "保存"; -$message["back"] = "返回"; - - -$message["submit_query"] = "查詢"; -$message["explain"] = "分析"; -$message["clear_conditions"] = "清除條件"; -$message["rows_per_page"] = "每頁顯示數"; -$message["action"] = "動作"; -$message["limit"] = "條數"; -$message["new_field"] = "新字段"; - -$message["tools"] = "工具"; -$message["manuals"] = "手冊"; -$message["logout"] = "退出"; - -/** about **/ -$message["loginandrock"] = "登錄"; -$message["about_content"] = 'RockMongo是可視化的MongoDB管理工具. - -請訪問 http://rockmongo.com 獲取更多信息.
- -如果有任何問題和反饋,請發送郵件到:iwind.liu@gmail.com .
'; - + + * @version 1.0 + */ + +$message["TRANSLATION_NAME"] = "繁體中文 - Chinese traditional"; +$message["TRANSLATION_ID"] = 3; + +/** login interface **/ +$message["admin"] = "管理員"; +$message["password"] = "密碼"; +$message["language"] = "語言"; +$message["hour"] = "小時"; +$message["hours"] = "小時"; +$message["month"] = "月"; +$message["alive"] = "有效期"; + +/** connection **/ +$message["can_not_connect"] = "MongoDB連接錯誤: %s. 請檢查配置是否正確."; + +$message["overview"] = "全局"; +$message["server"] = "服務器"; +$message["status"] = "狀態"; +$message["databases"] = "數據庫"; +$message["processlist"] = "進程"; +$message["command"] = "命令"; +$message["execute"] = "代碼執行"; +$message["master_slave"] = "主/從"; +$message["query"] = "查詢"; +$message["refresh"] = "刷新"; +$message["insert"] = "插入"; +$message["clear"] = "清除"; +$message["delete"] = "刪除"; +$message["update"] = "更新"; +$message["duplicate"] = "復制"; +$message["text"] = "文本"; +$message["statistics"] = "統計"; +$message["export"] = "導出"; +$message["import"] = "導入"; +$message["transfer"] = "克隆"; +$message["drop"] = "刪除"; +$message["more"] = "更多"; +$message["rename"] = "更名"; +$message["indexes"] = "索引"; +$message["properties"] = "屬性"; +$message["validate"] = "校驗"; +$message["repair"] = "修復"; +$message["authentication"] = "用戶"; +$message["profile"] = "調試信息"; +$message["create_collection"] = "創建集合"; +$message["create_collection_full"] = "創建集合"; +$message["create_database"] = "創建數據庫"; +$message["save"] = "保存"; +$message["back"] = "返回"; + + +$message["submit_query"] = "查詢"; +$message["explain"] = "分析"; +$message["clear_conditions"] = "清除條件"; +$message["rows_per_page"] = "每頁顯示數"; +$message["action"] = "動作"; +$message["limit"] = "條數"; +$message["new_field"] = "新字段"; + +$message["tools"] = "工具"; +$message["manuals"] = "手冊"; +$message["logout"] = "退出"; + +/** about **/ +$message["loginandrock"] = "登錄"; +$message["about_content"] = 'RockMongo是可視化的MongoDB管理工具. + +請訪問 http://rockmongo.com 獲取更多信息.
+ +如果有任何問題和反饋,請發送郵件到:iwind.liu@gmail.com .
'; + ?> \ No newline at end of file diff --git a/app/lib/core/REvent.php b/app/lib/core/REvent.php index d747168..f47c9ed 100644 --- a/app/lib/core/REvent.php +++ b/app/lib/core/REvent.php @@ -1,80 +1,93 @@ - $listener) { - call_user_func_array($listener["callback"], array($params)); - if (isset(self::$_events[$event]["enabled"]) && !self::$_events[$event]["enabled"]) { - return; - } - } - } - - /** - * add a event listener - * - * @param string $event Event Name - * @param callback $callback Callback - * @param integer $priority Priority - */ - public static function listen($event, $callback, $priority = -1) { - if ($priority == -1) { - if (isset(self::$_listeners[$event])) { - $priority = count(self::$_listeners[$event]); - } - } - self::$_listeners[$event][] = array( - "callback" => $callback, - "priority" => $priority - ); - } - - /** - * stop event propagation - * - * @param string $event Event Name - */ - public static function stop($event) { - self::$_events[$event]["enabled"] = false; - } - - /** - * remove a event listener - * - * @param string $event Event Name - * @param callback $callback Callback - */ - public static function remove($event, $callback) { - if (empty(self::$_listeners[$event])) { - return; - } - $indexes = array(); - foreach (self::$_listeners[$event] as $index => $listener) { - if ($listener["callback"] == $callback) { - $indexes[] = $index; - } - } - if (!empty($indexes)) { - foreach (array_reverse($indexes) as $index) { - unset(self::$_listeners[$event][$index]); - } - } - } -} - + $listener) + { + call_user_func_array($listener["callback"], array($params)); + if (isset(self::$_events[$event]["enabled"]) && !self::$_events[$event]["enabled"]) + { + return; + } + } + } + + /** + * add a event listener + * + * @param string $event Event Name + * @param callback $callback Callback + * @param integer $priority Priority + */ + public static function listen($event, $callback, $priority = -1) + { + if ($priority == -1) + { + if (isset(self::$_listeners[$event])) + { + $priority = count(self::$_listeners[$event]); + } + } + self::$_listeners[$event][] = array("callback" => $callback, "priority" => $priority); + } + + /** + * stop event propagation + * + * @param string $event Event Name + */ + public static function stop($event) + { + self::$_events[$event]["enabled"] = false; + } + + /** + * remove a event listener + * + * @param string $event Event Name + * @param callback $callback Callback + */ + public static function remove($event, $callback) + { + if (empty(self::$_listeners[$event])) + { + return; + } + $indexes = array(); + foreach (self::$_listeners[$event] as $index => $listener) + { + if ($listener["callback"] == $callback) + { + $indexes[] = $index; + } + } + if (!empty($indexes)) + { + foreach (array_reverse($indexes) as $index) + { + unset(self::$_listeners[$event][$index]); + } + } + } +} + ?> \ No newline at end of file diff --git a/app/lib/core/RFilter.php b/app/lib/core/RFilter.php index 01a3deb..f299fcb 100644 --- a/app/lib/core/RFilter.php +++ b/app/lib/core/RFilter.php @@ -1,86 +1,100 @@ - $filter) { - call_user_func_array($filter["callback"], $newParams); - if (isset(self::$_dataTypes[$dataType]["enabled"]) && !self::$_dataTypes[$dataType]["enabled"]) { - return; - } - } - } - - /** - * add a new filter - * - * @param unknown_type $dataType - * @param unknown_type $filter - * @param unknown_type $priority - */ - public static function add($dataType, $filter, $priority = -1) { - if ($priority == -1) { - if (isset(self::$_filters[$dataType])) { - $priority = count(self::$_filters[$dataType]); - } - } - self::$_filters[$dataType][] = array( - "callback" => $filter, - "priority" => $priority - ); - } - - /** - * stop filter chain - * - * @param unknown_type $dataType - */ - public static function stop($dataType) { - self::$_dataTypes[$dataType]["enabled"] = false; - } - - /** - * remove a filter - * - * @param unknown_type $dataType - * @param unknown_type $filter - */ - public static function remove($dataType, $filter) { - if (empty(self::$_filters[$dataType])) { - return; - } - $indexes = array(); - foreach (self::$_filters[$dataType] as $index => $_filter) { - if ($_filter["callback"] == $filter) { - $indexes[] = $index; - } - } - if (!empty($indexes)) { - foreach (array_reverse($indexes) as $index) { - unset(self::$_filters[$dataType][$index]); - } - } - } -} - + $filter) + { + call_user_func_array($filter["callback"], $newParams); + if (isset(self::$_dataTypes[$dataType]["enabled"]) && !self::$_dataTypes[$dataType]["enabled"]) + { + return; + } + } + } + + /** + * add a new filter + * + * @param unknown_type $dataType + * @param unknown_type $filter + * @param unknown_type $priority + */ + public static function add($dataType, $filter, $priority = -1) + { + if ($priority == -1) + { + if (isset(self::$_filters[$dataType])) + { + $priority = count(self::$_filters[$dataType]); + } + } + self::$_filters[$dataType][] = array("callback" => $filter, "priority" => $priority); + } + + /** + * stop filter chain + * + * @param unknown_type $dataType + */ + public static function stop($dataType) + { + self::$_dataTypes[$dataType]["enabled"] = false; + } + + /** + * remove a filter + * + * @param unknown_type $dataType + * @param unknown_type $filter + */ + public static function remove($dataType, $filter) + { + if (empty(self::$_filters[$dataType])) + { + return; + } + $indexes = array(); + foreach (self::$_filters[$dataType] as $index => $_filter) + { + if ($_filter["callback"] == $filter) + { + $indexes[] = $index; + } + } + if (!empty($indexes)) + { + foreach (array_reverse($indexes) as $index) + { + unset(self::$_filters[$dataType][$index]); + } + } + } +} + ?> \ No newline at end of file diff --git a/app/lib/core/RPlugin.php b/app/lib/core/RPlugin.php index 1b11a7c..ae465bb 100644 --- a/app/lib/core/RPlugin.php +++ b/app/lib/core/RPlugin.php @@ -1,101 +1,117 @@ - "Default Plugin", - "author" => "rock", - "version" => "1.0" - ); - } - - /** - * register a plugin - * - * @param string $pluginClass plugin class name - * @param integer $priority priority - * @throws Exception - */ - public static function register($pluginClass, $priority = -1) { - if ($priority == -1) { - $priority = count(self::$_plugins); - } - if (!is_subclass_of($pluginClass, "RPlugin")) { - throw new Exception("plugin class '{$pluginClass}' must be inherited from RPlugin"); - } - self::$_plugins[] = array( "obj" => new $pluginClass, "priority" => $priority ); - } - - /** - * call onBefore() method in plugin - * - */ - public static function callBefore() { - $plugins = rock_array_sort(self::$_plugins, "priority"); - foreach ($plugins as $plugin) { - $plugin["obj"]->onBefore(); - } - } - - /** - * call onAfter() method in plugin - * - */ - public static function callAfter() { - $plugins = rock_array_sort(self::$_plugins, "priority", false); - foreach ($plugins as $plugin) { - $plugin["obj"]->onAfter(); - } - } - - /** - * load all of plugins - * - */ - public static function load() { - if (self::$_loaded) { - return; - } - require(__ROOT__ . DS . "configs" . DS . "rplugin.php"); - if (empty($plugins) || !is_array($plugins)) { - return; - } - foreach ($plugins as $name => $plugin) { - if ($plugin["enabled"]) { - $dir = __ROOT__ . DS . "plugins" . DS . $name; - if (!is_dir($dir)) { - $dir = dirname(dirname(__ROOT__)) . DS . "plugins" . DS . $name; - } - $initFile = $dir . DS . "init.php"; - if (is_file($initFile)) { - require $dir . DS . "init.php"; - } - else { - trigger_error("could not find initialize file '{$initFile}' for plugin '{$name}', you can disable it in app/configs/rplugin.php"); - } - } - } - - self::$_loaded = true; - } -} - + "Default Plugin", "author" => "rock", "version" => "1.0"); + } + + /** + * register a plugin + * + * @param string $pluginClass plugin class name + * @param integer $priority priority + * + * @throws Exception + */ + public static function register($pluginClass, $priority = -1) + { + if ($priority == -1) + { + $priority = count(self::$_plugins); + } + if (!is_subclass_of($pluginClass, "RPlugin")) + { + throw new Exception("plugin class '{$pluginClass}' must be inherited from RPlugin"); + } + self::$_plugins[] = array("obj" => new $pluginClass, "priority" => $priority); + } + + /** + * call onBefore() method in plugin + * + */ + public static function callBefore() + { + $plugins = rock_array_sort(self::$_plugins, "priority"); + foreach ($plugins as $plugin) + { + $plugin["obj"]->onBefore(); + } + } + + /** + * call onAfter() method in plugin + * + */ + public static function callAfter() + { + $plugins = rock_array_sort(self::$_plugins, "priority", false); + foreach ($plugins as $plugin) + { + $plugin["obj"]->onAfter(); + } + } + + /** + * load all of plugins + * + */ + public static function load() + { + if (self::$_loaded) + { + return; + } + require(__ROOT__ . DS . "configs" . DS . "rplugin.php"); + if (empty($plugins) || !is_array($plugins)) + { + return; + } + foreach ($plugins as $name => $plugin) + { + if ($plugin["enabled"]) + { + $dir = __ROOT__ . DS . "plugins" . DS . $name; + if (!is_dir($dir)) + { + $dir = dirname(dirname(__ROOT__)) . DS . "plugins" . DS . $name; + } + $initFile = $dir . DS . "init.php"; + if (is_file($initFile)) + { + require $dir . DS . "init.php"; + } + else + { + trigger_error("could not find initialize file '{$initFile}' for plugin '{$name}', you can disable it in app/configs/rplugin.php"); + } + } + } + + self::$_loaded = true; + } +} + ?> \ No newline at end of file diff --git a/app/lib/ext/RExtController.php b/app/lib/ext/RExtController.php index b2b4245..51c30c8 100644 --- a/app/lib/ext/RExtController.php +++ b/app/lib/ext/RExtController.php @@ -1,48 +1,57 @@ redirectUrl($this->path($action, $params), $js); exit(); } - - function redirectUrl($url, $js = false) { - if ($js) { + + function redirectUrl($url, $js = false) + { + if ($js) + { echo ''; exit(); } header("location:{$url}"); exit(); } - - function path($action, array $params = array()) { - if (!strstr($action, ".")) { + + function path($action, array $params = array()) + { + if (!strstr($action, ".")) + { $action = $this->name() . "." . $action; } $url = $_SERVER["PHP_SELF"] . "?action=" . $action; - if (!empty($params)) { + if (!empty($params)) + { $url .= "&" . http_build_query($params); } return $url; } - + /** * Is POST request? * * @return boolean */ - function isPost() { + function isPost() + { return ($_SERVER["REQUEST_METHOD"] == "POST"); } - + /** * Is from AJAX request? * * @return boolean */ - function isAjax() { + function isAjax() + { return (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest"); } } diff --git a/app/lib/mime/types.php b/app/lib/mime/types.php index 599d0a4..db7c5d4 100644 --- a/app/lib/mime/types.php +++ b/app/lib/mime/types.php @@ -1,190 +1,5 @@ "text/h323", -"acx" => "application/internet-property-stream", -"ai" => "application/postscript", -"aif" => "audio/x-aiff", -"aifc" => "audio/x-aiff", -"aiff" => "audio/x-aiff", -"asf" => "video/x-ms-asf", -"asr" => "video/x-ms-asf", -"asx" => "video/x-ms-asf", -"au" => "audio/basic", -"avi" => "video/x-msvideo", -"axs" => "application/olescript", -"bas" => "text/plain", -"bcpio" => "application/x-bcpio", -"bin" => "application/octet-stream", -"bmp" => "image/bmp", -"c" => "text/plain", -"cat" => "application/vnd.ms-pkiseccat", -"cdf" => "application/x-cdf", -"cer" => "application/x-x509-ca-cert", -"class" => "application/octet-stream", -"clp" => "application/x-msclip", -"cmx" => "image/x-cmx", -"cod" => "image/cis-cod", -"cpio" => "application/x-cpio", -"crd" => "application/x-mscardfile", -"crl" => "application/pkix-crl", -"crt" => "application/x-x509-ca-cert", -"csh" => "application/x-csh", -"css" => "text/css", -"dcr" => "application/x-director", -"der" => "application/x-x509-ca-cert", -"dir" => "application/x-director", -"dll" => "application/x-msdownload", -"dms" => "application/octet-stream", -"doc" => "application/msword", -"dot" => "application/msword", -"dvi" => "application/x-dvi", -"dxr" => "application/x-director", -"eps" => "application/postscript", -"etx" => "text/x-setext", -"evy" => "application/envoy", -"exe" => "application/octet-stream", -"fif" => "application/fractals", -"flr" => "x-world/x-vrml", -"gif" => "image/gif", -"gtar" => "application/x-gtar", -"gz" => "application/x-gzip", -"h" => "text/plain", -"hdf" => "application/x-hdf", -"hlp" => "application/winhlp", -"hqx" => "application/mac-binhex40", -"hta" => "application/hta", -"htc" => "text/x-component", -"htm" => "text/html", -"html" => "text/html", -"htt" => "text/webviewhtml", -"ico" => "image/x-icon", -"ief" => "image/ief", -"iii" => "application/x-iphone", -"ins" => "application/x-internet-signup", -"isp" => "application/x-internet-signup", -"jfif" => "image/pipeg", -"jpe" => "image/jpeg", -"jpeg" => "image/jpeg", -"jpg" => "image/jpeg", -"js" => "application/x-javascript", -"latex" => "application/x-latex", -"lha" => "application/octet-stream", -"lsf" => "video/x-la-asf", -"lsx" => "video/x-la-asf", -"lzh" => "application/octet-stream", -"m13" => "application/x-msmediaview", -"m14" => "application/x-msmediaview", -"m3u" => "audio/x-mpegurl", -"man" => "application/x-troff-man", -"mdb" => "application/x-msaccess", -"me" => "application/x-troff-me", -"mht" => "message/rfc822", -"mhtml" => "message/rfc822", -"mid" => "audio/mid", -"mny" => "application/x-msmoney", -"mov" => "video/quicktime", -"movie" => "video/x-sgi-movie", -"mp2" => "video/mpeg", -"mp3" => "audio/mpeg", -"mpa" => "video/mpeg", -"mpe" => "video/mpeg", -"mpeg" => "video/mpeg", -"mpg" => "video/mpeg", -"mpp" => "application/vnd.ms-project", -"mpv2" => "video/mpeg", -"ms" => "application/x-troff-ms", -"mvb" => "application/x-msmediaview", -"nws" => "message/rfc822", -"oda" => "application/oda", -"p10" => "application/pkcs10", -"p12" => "application/x-pkcs12", -"p7b" => "application/x-pkcs7-certificates", -"p7c" => "application/x-pkcs7-mime", -"p7m" => "application/x-pkcs7-mime", -"p7r" => "application/x-pkcs7-certreqresp", -"p7s" => "application/x-pkcs7-signature", -"pbm" => "image/x-portable-bitmap", -"pdf" => "application/pdf", -"pfx" => "application/x-pkcs12", -"pgm" => "image/x-portable-graymap", -"pko" => "application/ynd.ms-pkipko", -"pma" => "application/x-perfmon", -"pmc" => "application/x-perfmon", -"pml" => "application/x-perfmon", -"pmr" => "application/x-perfmon", -"pmw" => "application/x-perfmon", -"pnm" => "image/x-portable-anymap", -"pot" => "application/vnd.ms-powerpoint", -"ppm" => "image/x-portable-pixmap", -"pps" => "application/vnd.ms-powerpoint", -"ppt" => "application/vnd.ms-powerpoint", -"prf" => "application/pics-rules", -"ps" => "application/postscript", -"pub" => "application/x-mspublisher", -"qt" => "video/quicktime", -"ra" => "audio/x-pn-realaudio", -"ram" => "audio/x-pn-realaudio", -"ras" => "image/x-cmu-raster", -"rgb" => "image/x-rgb", -"rmi" => "audio/mid", -"roff" => "application/x-troff", -"rtf" => "application/rtf", -"rtx" => "text/richtext", -"scd" => "application/x-msschedule", -"sct" => "text/scriptlet", -"setpay" => "application/set-payment-initiation", -"setreg" => "application/set-registration-initiation", -"sh" => "application/x-sh", -"shar" => "application/x-shar", -"sit" => "application/x-stuffit", -"snd" => "audio/basic", -"spc" => "application/x-pkcs7-certificates", -"spl" => "application/futuresplash", -"src" => "application/x-wais-source", -"sst" => "application/vnd.ms-pkicertstore", -"stl" => "application/vnd.ms-pkistl", -"stm" => "text/html", -"svg" => "image/svg+xml", -"sv4cpio" => "application/x-sv4cpio", -"sv4crc" => "application/x-sv4crc", -"t" => "application/x-troff", -"tar" => "application/x-tar", -"tcl" => "application/x-tcl", -"tex" => "application/x-tex", -"texi" => "application/x-texinfo", -"texinfo" => "application/x-texinfo", -"tgz" => "application/x-compressed", -"tif" => "image/tiff", -"tiff" => "image/tiff", -"tr" => "application/x-troff", -"trm" => "application/x-msterminal", -"tsv" => "text/tab-separated-values", -"txt" => "text/plain", -"uls" => "text/iuls", -"ustar" => "application/x-ustar", -"vcf" => "text/x-vcard", -"vrml" => "x-world/x-vrml", -"wav" => "audio/x-wav", -"wcm" => "application/vnd.ms-works", -"wdb" => "application/vnd.ms-works", -"wks" => "application/vnd.ms-works", -"wmf" => "application/x-msmetafile", -"wps" => "application/vnd.ms-works", -"wri" => "application/x-mswrite", -"wrl" => "x-world/x-vrml", -"wrz" => "x-world/x-vrml", -"xaf" => "x-world/x-vrml", -"xbm" => "image/x-xbitmap", -"xla" => "application/vnd.ms-excel", -"xlc" => "application/vnd.ms-excel", -"xlm" => "application/vnd.ms-excel", -"xls" => "application/vnd.ms-excel", -"xlt" => "application/vnd.ms-excel", -"xlw" => "application/vnd.ms-excel", -"xof" => "x-world/x-vrml", -"xpm" => "image/x-xpixmap", -"xwd" => "image/x-xwindowdump", -"z" => "application/x-compress", -"zip" => "application/zip"); +$mime_types = array("323" => "text/h323", "acx" => "application/internet-property-stream", "ai" => "application/postscript", "aif" => "audio/x-aiff", "aifc" => "audio/x-aiff", "aiff" => "audio/x-aiff", "asf" => "video/x-ms-asf", "asr" => "video/x-ms-asf", "asx" => "video/x-ms-asf", "au" => "audio/basic", "avi" => "video/x-msvideo", "axs" => "application/olescript", "bas" => "text/plain", "bcpio" => "application/x-bcpio", "bin" => "application/octet-stream", "bmp" => "image/bmp", "c" => "text/plain", "cat" => "application/vnd.ms-pkiseccat", "cdf" => "application/x-cdf", "cer" => "application/x-x509-ca-cert", "class" => "application/octet-stream", "clp" => "application/x-msclip", "cmx" => "image/x-cmx", "cod" => "image/cis-cod", "cpio" => "application/x-cpio", "crd" => "application/x-mscardfile", "crl" => "application/pkix-crl", "crt" => "application/x-x509-ca-cert", "csh" => "application/x-csh", "css" => "text/css", "dcr" => "application/x-director", "der" => "application/x-x509-ca-cert", "dir" => "application/x-director", "dll" => "application/x-msdownload", "dms" => "application/octet-stream", "doc" => "application/msword", "dot" => "application/msword", "dvi" => "application/x-dvi", "dxr" => "application/x-director", "eps" => "application/postscript", "etx" => "text/x-setext", "evy" => "application/envoy", "exe" => "application/octet-stream", "fif" => "application/fractals", "flr" => "x-world/x-vrml", "gif" => "image/gif", "gtar" => "application/x-gtar", "gz" => "application/x-gzip", "h" => "text/plain", "hdf" => "application/x-hdf", "hlp" => "application/winhlp", "hqx" => "application/mac-binhex40", "hta" => "application/hta", "htc" => "text/x-component", "htm" => "text/html", "html" => "text/html", "htt" => "text/webviewhtml", "ico" => "image/x-icon", "ief" => "image/ief", "iii" => "application/x-iphone", "ins" => "application/x-internet-signup", "isp" => "application/x-internet-signup", "jfif" => "image/pipeg", "jpe" => "image/jpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "js" => "application/x-javascript", "latex" => "application/x-latex", "lha" => "application/octet-stream", "lsf" => "video/x-la-asf", "lsx" => "video/x-la-asf", "lzh" => "application/octet-stream", "m13" => "application/x-msmediaview", "m14" => "application/x-msmediaview", "m3u" => "audio/x-mpegurl", "man" => "application/x-troff-man", "mdb" => "application/x-msaccess", "me" => "application/x-troff-me", "mht" => "message/rfc822", "mhtml" => "message/rfc822", "mid" => "audio/mid", "mny" => "application/x-msmoney", "mov" => "video/quicktime", "movie" => "video/x-sgi-movie", "mp2" => "video/mpeg", "mp3" => "audio/mpeg", "mpa" => "video/mpeg", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mpp" => "application/vnd.ms-project", "mpv2" => "video/mpeg", "ms" => "application/x-troff-ms", "mvb" => "application/x-msmediaview", "nws" => "message/rfc822", "oda" => "application/oda", "p10" => "application/pkcs10", "p12" => "application/x-pkcs12", "p7b" => "application/x-pkcs7-certificates", "p7c" => "application/x-pkcs7-mime", "p7m" => "application/x-pkcs7-mime", "p7r" => "application/x-pkcs7-certreqresp", "p7s" => "application/x-pkcs7-signature", "pbm" => "image/x-portable-bitmap", "pdf" => "application/pdf", "pfx" => "application/x-pkcs12", "pgm" => "image/x-portable-graymap", "pko" => "application/ynd.ms-pkipko", "pma" => "application/x-perfmon", "pmc" => "application/x-perfmon", "pml" => "application/x-perfmon", "pmr" => "application/x-perfmon", "pmw" => "application/x-perfmon", "pnm" => "image/x-portable-anymap", "pot" => "application/vnd.ms-powerpoint", "ppm" => "image/x-portable-pixmap", "pps" => "application/vnd.ms-powerpoint", "ppt" => "application/vnd.ms-powerpoint", "prf" => "application/pics-rules", "ps" => "application/postscript", "pub" => "application/x-mspublisher", "qt" => "video/quicktime", "ra" => "audio/x-pn-realaudio", "ram" => "audio/x-pn-realaudio", "ras" => "image/x-cmu-raster", "rgb" => "image/x-rgb", "rmi" => "audio/mid", "roff" => "application/x-troff", "rtf" => "application/rtf", "rtx" => "text/richtext", "scd" => "application/x-msschedule", "sct" => "text/scriptlet", "setpay" => "application/set-payment-initiation", "setreg" => "application/set-registration-initiation", "sh" => "application/x-sh", "shar" => "application/x-shar", "sit" => "application/x-stuffit", "snd" => "audio/basic", "spc" => "application/x-pkcs7-certificates", "spl" => "application/futuresplash", "src" => "application/x-wais-source", "sst" => "application/vnd.ms-pkicertstore", "stl" => "application/vnd.ms-pkistl", "stm" => "text/html", "svg" => "image/svg+xml", "sv4cpio" => "application/x-sv4cpio", "sv4crc" => "application/x-sv4crc", "t" => "application/x-troff", "tar" => "application/x-tar", "tcl" => "application/x-tcl", "tex" => "application/x-tex", "texi" => "application/x-texinfo", "texinfo" => "application/x-texinfo", "tgz" => "application/x-compressed", "tif" => "image/tiff", "tiff" => "image/tiff", "tr" => "application/x-troff", "trm" => "application/x-msterminal", "tsv" => "text/tab-separated-values", "txt" => "text/plain", "uls" => "text/iuls", "ustar" => "application/x-ustar", "vcf" => "text/x-vcard", "vrml" => "x-world/x-vrml", "wav" => "audio/x-wav", "wcm" => "application/vnd.ms-works", "wdb" => "application/vnd.ms-works", "wks" => "application/vnd.ms-works", "wmf" => "application/x-msmetafile", "wps" => "application/vnd.ms-works", "wri" => "application/x-mswrite", "wrl" => "x-world/x-vrml", "wrz" => "x-world/x-vrml", "xaf" => "x-world/x-vrml", "xbm" => "image/x-xbitmap", "xla" => "application/vnd.ms-excel", "xlc" => "application/vnd.ms-excel", "xlm" => "application/vnd.ms-excel", "xls" => "application/vnd.ms-excel", "xlt" => "application/vnd.ms-excel", "xlw" => "application/vnd.ms-excel", "xof" => "x-world/x-vrml", "xpm" => "image/x-xpixmap", "xwd" => "image/x-xwindowdump", "z" => "application/x-compress", "zip" => "application/zip"); ?> \ No newline at end of file diff --git a/app/lib/mongo/RMongo.php b/app/lib/mongo/RMongo.php index a474885..519305c 100644 --- a/app/lib/mongo/RMongo.php +++ b/app/lib/mongo/RMongo.php @@ -1,282 +1,335 @@ _mongo = new MongoClient($server, $options); } - else { + else + { $this->_mongo = new Mongo($server, $options); } } - + /** * Closes this connection - * + * * @param boolean|string $connection Connection + * * @return boolean */ - public function close($connection) { + public function close($connection) + { return $this->_mongo->close($connection); } - + /** * Connects to a database server */ - public function connect() { + public function connect() + { return $this->_mongo->connect(); } - + /** * Drops a database - * + * * @param mixed $db The database to drop. Can be a MongoDB object or the name of the database + * * @return array */ - public function dropDB($db) { - if (!is_object($db)) { + public function dropDB($db) + { + if (!is_object($db)) + { $db = $this->selectDB($db); - } - if (method_exists($db, "drop")) { + } + if (method_exists($db, "drop")) + { return $db->drop(); } - if (method_exists($this->_mongo, "dropDB")) { + if (method_exists($this->_mongo, "dropDB")) + { $this->_mongo->dropDB($db); } } - + /** * Force server to response error */ - public function forceError() { - if (method_exists($this->_mongo, "forceError")) { + public function forceError() + { + if (method_exists($this->_mongo, "forceError")) + { return $this->_mongo->forceError(); } return false; } - + /** * Gets a database - * + * * @param string $dbname The database name + * * @return MongoDB */ - public function __get($dbname) { + public function __get($dbname) + { return $this->_mongo->$dbname; } - + /** * Updates status for all associated hosts - * + * * @return array * @todo implement it under different versions */ - public function getHosts() { - if (method_exists($this->_mongo, "getHosts")) { + public function getHosts() + { + if (method_exists($this->_mongo, "getHosts")) + { return $this->_mongo->getHosts(); } return array(); } - + /** * Get the read preference for this connection - * + * * @return array * @todo implement it under different versions */ - public function getReadPreference() { - if (method_exists($this->_mongo, "getReadPreference")) { + public function getReadPreference() + { + if (method_exists($this->_mongo, "getReadPreference")) + { return $this->_mongo->getReadPreference(); } return array(); } - + /** * Get last erro * * @return array */ - public function lastError() { - if (method_exists($this->_mongo, "lastError")) { + public function lastError() + { + if (method_exists($this->_mongo, "lastError")) + { return $this->_mongo->lastError(); } return array(); } - + /** * Lists all of the databases available - * + * * @return array */ - public function listDBs() { + public function listDBs() + { return $this->_mongo->listDBs(); } - + /** * Connect pair servers - * + * * @return boolean */ - public function pairConnect() { - if (method_exists($this->_mongo, "pairConnect")) { + public function pairConnect() + { + if (method_exists($this->_mongo, "pairConnect")) + { return $this->_mongo->pairConnect(); - } + } return false; } - + /** * Create pair persist connection - * + * * @param string $username * @param string $password + * * @return boolean */ - public function pairPersistConnect($username = "" , $password = "") { - if (method_exists($this->_mongo, "pairPersistConnect")) { + public function pairPersistConnect($username = "", $password = "") + { + if (method_exists($this->_mongo, "pairPersistConnect")) + { return $this->_mongo->pairPersistConnect($username, $password); } return false; } - + /** * Create persist connection - * + * * @param string $username * @param string $password + * * @return boolean */ - public function persistConnect($username = "" , $password = "" ) { - if (method_exists($this->_mongo, "persistConnect")) { + public function persistConnect($username = "", $password = "") + { + if (method_exists($this->_mongo, "persistConnect")) + { return $this->_mongo->persistConnect($username, $password); } return false; } - + /** * Get previous error - * + * * @return array */ - public function prevError() { - if (method_exists($this->_mongo, "prevError")) { + public function prevError() + { + if (method_exists($this->_mongo, "prevError")) + { return $this->_mongo->prevError(); } return array(); } - + /** * Reset error - * + * * @return array */ - public function resetError() { - if (method_exists($this->_mongo, "resetError")) { + public function resetError() + { + if (method_exists($this->_mongo, "resetError")) + { return $this->_mongo->resetError(); } return array(); } - + /** * Gets a database collection - * + * * @param string $db The database name * @param string $collection The collection name + * * @return MongoCollection */ - public function selectCollection($db, $collection) { + public function selectCollection($db, $collection) + { return $this->_mongo->selectCollection($db, $collection); } - + /** * Gets a database - * + * * @param string $db The database name + * * @return MongoDB */ - public function selectDB($db) { + public function selectDB($db) + { return $this->_mongo->selectDB($db); } - + /** * Set the read preference for this connection - * - * @param int $readPreference The read preference mode: Mongo::RP_PRIMARY, Mongo::RP_PRIMARY_PREFERRED, Mongo::RP_SECONDARY, Mongo::RP_SECONDARY_PREFERRED, or Mongo::RP_NEAREST + * + * @param int $readPreference The read preference mode: Mongo::RP_PRIMARY, Mongo::RP_PRIMARY_PREFERRED, Mongo::RP_SECONDARY, Mongo::RP_SECONDARY_PREFERRED, or Mongo::RP_NEAREST * @param array $tags An array of zero or more tag sets, where each tag set is itself an array of criteria used to match tags on replica set members + * * @return boolean */ - public function setReadPreference($readPreference, array $tags = array()) { - if (method_exists($this->_mongo, "setReadPreference")) { + public function setReadPreference($readPreference, array $tags = array()) + { + if (method_exists($this->_mongo, "setReadPreference")) + { return $this->_mongo->setReadPreference($readPreference, $tags); } return false; } - + /** * Change slaveOkay setting for this connection * * @param boolean $ok If reads should be sent to secondary members of a replica set for all possible queries using this Mongo instance + * * @return boolean */ - public function setSlaveOkay($ok) { - if (method_exists($this->_mongo, "setSlaveOkay")) { + public function setSlaveOkay($ok) + { + if (method_exists($this->_mongo, "setSlaveOkay")) + { return $this->_mongo->setSlaveOkay($ok); } return false; } - + /** * String representation of this connection - * + * * @return string */ - public function __toString() { + public function __toString() + { return $this->_mongo->__toString(); } - + /** * Get mongo driver version - * + * * @return string * @since 1.1.4 */ - public static function getVersion() { - if (class_exists("MongoClient")) { + public static function getVersion() + { + if (class_exists("MongoClient")) + { return MongoClient::VERSION; } - if (class_exists("Mongo")) { + if (class_exists("Mongo")) + { return Mongo::VERSION; } return "0"; } - + /** * Compare another version with current version - * + * * @param string $version Version to compare + * * @return integer -1,0,1 * @since 1.1.4 */ - public static function compareVersion($version) { + public static function compareVersion($version) + { $currentVersion = self::getVersion(); preg_match("/^[\\.\\d]+/", $currentVersion, $match); $number = $match[0]; - return version_compare($number, $version); + return version_compare($number, $version); } - - static function setLastInsertId($lastId) { + + static function setLastInsertId($lastId) + { self::$_lastId = $lastId; } - + /** * Enter description here... * * @return string */ - static function lastInsertId() { + static function lastInsertId() + { return self::$_lastId; } } diff --git a/app/lib/mongo/RMongoException.php b/app/lib/mongo/RMongoException.php index 552ff31..7661c92 100644 --- a/app/lib/mongo/RMongoException.php +++ b/app/lib/mongo/RMongoException.php @@ -1,7 +1,8 @@ \ No newline at end of file diff --git a/app/lib/mongo/RObject.php b/app/lib/mongo/RObject.php index 03354a9..1a80f46 100644 --- a/app/lib/mongo/RObject.php +++ b/app/lib/mongo/RObject.php @@ -1,330 +1,382 @@ -setAttrs($attrs); - } - - /** - * 设置属性值 - * - * @param string $name 属性名 - * @param mixed $value 属性值 - */ - function setAttr($name, $value) { - if ($name == "_id") { - $this->setId($value); - return; - } - $this->_attrs = rock_array_set($this->_attrs, $name, $value); - $this->_execOperator('$set', $name, $value); - } - - /** - * 设置属性集 - * - * @param array $attrs 属性集 - */ - function setAttrs(array $attrs) { - foreach ($attrs as $field => $value) { - $this->setAttr($field, $value); - } - } - - /** - * 设置原始属性集,即刚从数据库中查出来的属性集 - * - * @param array $attrs 原始属性集 - */ - function setSource(array $attrs) { - if (isset($attrs["_id"])) { - $this->setId($attrs["_id"]); - } - $this->_attrs = array_merge($this->_attrs, $attrs); - } - - private function _execOperator($operator, $attr, $newValue) { - if (!isset($this->_operations[$operator])) { - $this->_operations[$operator] = array(); - } - $this->_operations[$operator][$attr] = $newValue; - } - - - /** - * 当前对象的ID,可以用来判断对象是否已经存储 - * - * @return MongoId - */ - function id() { - return $this->_id; - } - - /** - * 取得当前对象的ID值 - * - * @return string - */ - function idValue() { - return $this->_id ? $this->_id->__toString() : null; - } - - /** - * 设置当前对象的ID - * - * @param string|MongoId $id 新的Id,如果非长度为24的16禁止的字符串,则MongoDB会认为是非法的ID,而忽略之 - */ - function setId($id) { - $this->_id = ($id); - } - - /** - * 增加一个属性的值 - * - * @param string $attr 属性 - * @param integer $count 增加的数量 - */ - function increase($attr, $count = 1) { - $this->_execOperator('$inc', $attr, $count); - } - - /** - * 删除一个属性值。如果是一个集合只会将其值设置为NULL, - * 这时候你需要调用$obj->pull($attrParent, null)来删除null值。 - * - * @param string $attr 属性 - * @param boolean $pullNull 是否自动删除NULL值 - */ - function remove($attr, $pullNull = true) { - if ($pullNull) { - $this->_execOperator('$unset', $attr, 1); - $this->save(); - if (strstr($attr, ".")) { - $parent = substr($attr, 0, strrpos($attr, ".")); - $this->pull($parent, null); - } - } - else { - $this->_execOperator('$unset', $attr, 1); - } - } - - /** - * 在一个集合末尾增加新的元素 - * - * 注意索引数组和关联数组不能混合 - * - * @param string $attr 属性 - * @param mixed $value 属性值 - * @param boolean|string|integer $genId 是否自动生成ID,如果是boolean,则可以指定是否自动生成ID,如果是string和integer,则直接使用此值作为ID - */ - function push($attr, $value, $genId = false) { - if (is_bool($genId) && $genId) { - $attr .= "." . strtoupper(uniqid("ID_")); - $this->setAttr($attr, $value); - } - elseif (is_string($genId) || is_integer($genId)) { - $attr .= "." . $genId; - $this->setAttr($attr, $value); - } - else { - $this->_execOperator('$push', $attr, $value); - } - } - - /** - * 在一个集合末尾增加一组新的元素 - * - * @param string $attr 属性 - * @param array $values 属性值 - */ - function pushAll($attr, array $values) { - $this->_execOperator('$pushAll', $attr, $values); - } - - function addToSet($attr, $value) { - $this->_execOperator('$addToSet', $attr, $value); - } - - function addAllToSet($attr, array $values) { - $this->_execOperator('$addToSet', $attr, array( '$each' => $values )); - } - - function pop($attr) { - $this->_execOperator('$pop', $attr, 1); - } - - function shift($attr) { - $this->_execOperator('$pop', $attr, -1); - } - - /** - * 拽出某一个数组中的值为$value的元素 - * - * @param string $attr 属性 - * @param mixed $value 元素值 - */ - function pull($attr, $value) { - $this->_execOperator('$pull', $attr, $value); - } - - function pullAll($attr, array $values) { - $this->_execOperator('$pullAll', $attr, $values); - } - - /** - * 保存当前对象 - * - * @param boolean $refresh 是否刷新当前对象 - * @return boolean - */ - function save($refresh = false) { - if (!$this->_collection) { - import("@.RMongoException"); - throw new RMongoException("Object is not in any collection, please use setCollection() to method to set a collection."); - } - $bool = true; - if ($this->_id) {//if exists - if (!empty($this->_operations)) { - $bool = $this->_collection->update(array( "_id" => $this->_id ), $this->_operations, array( "upsert" => false, "multiple" => false, "safe" => true )); - if ($refresh) { - $bool = $this->refresh(); - } - } - } - else { - $bool = $this->_collection->insert($this->_attrs, true); - if ($bool) { - $this->_id = $this->_attrs["_id"]; - import("@.RMongo"); - RMongo::setLastInsertId($this->_id->__toString()); - } - } - $this->_operations = array(); - return $bool; - } - - /** - * 刷新当前对象 - * - * @return boolean - */ - function refresh() { - if (!$this->_collection) { - import("@.RMongoException"); - throw new RMongoException("Object is not in any collection, please use setCollection() to method to set a collection."); - } - if (!$this->_id) { - return true; - } - $this->setSource($this->_collection->findOne( array( "_id" => $this->_id ) )); - return true; - } - - function setCollection(MongoCollection $collection) { - $this->_collection = $collection; - } - - function attr($name) { - return rock_array_get($this->_attrs, $name); - } - - /** - * 取得当前对象的所有属性值 - * - * @return array - */ - function attrs() { - return $this->_attrs; - } - - /** - * 删除当前对象 - * - */ - function delete() { - if ($this->_collection && $this->_id) { - $this->_collection->remove(array( "_id" => $this->_id )); - } - $this->_id = null; - $this->_attrs = array(); - } - - function __get($name) { - return $this->attr($name); - } - - /** - * 判断一个偏移量是否存在 - * - * 实现了 ArrayAccess 接口对应方法 - * - * @param integer $index - * @return boolean - * @since 1.0 - */ - function offsetExists($index) { - return !is_null($this->attr($index)); - } - - /** - * 从一个偏移量中取得数据 - * - * 实现了 ArrayAccess 接口对应方法 - * - * @param integer $index 偏移量 - * @return mixed - */ - function offsetGet($index) { - return $this->attr($index); - } - - /** - * 设置偏移量位置上的值 - * - * 实现了 ArrayAccess 接口对应方法 - * - * @param integer $index 偏移量 - * @param mixed $item 值 - */ - function offsetSet($index, $item) { - $this->setAttr($index, $item); - } - - /** - * 删除偏移量位置对应的元素 - * - * 实现了 ArrayAccess 接口对应方法 - * - * @param integer $index 偏移量 - */ - function offsetUnset($index) { - $this->setAttr($index, null); - } -} - +setAttrs($attrs); + } + + /** + * 设置属性值 + * + * @param string $name 属性名 + * @param mixed $value 属性值 + */ + function setAttr($name, $value) + { + if ($name == "_id") + { + $this->setId($value); + return; + } + $this->_attrs = rock_array_set($this->_attrs, $name, $value); + $this->_execOperator('$set', $name, $value); + } + + /** + * 设置属性集 + * + * @param array $attrs 属性集 + */ + function setAttrs(array $attrs) + { + foreach ($attrs as $field => $value) + { + $this->setAttr($field, $value); + } + } + + /** + * 设置原始属性集,即刚从数据库中查出来的属性集 + * + * @param array $attrs 原始属性集 + */ + function setSource(array $attrs) + { + if (isset($attrs["_id"])) + { + $this->setId($attrs["_id"]); + } + $this->_attrs = array_merge($this->_attrs, $attrs); + } + + private function _execOperator($operator, $attr, $newValue) + { + if (!isset($this->_operations[$operator])) + { + $this->_operations[$operator] = array(); + } + $this->_operations[$operator][$attr] = $newValue; + } + + + /** + * 当前对象的ID,可以用来判断对象是否已经存储 + * + * @return MongoId + */ + function id() + { + return $this->_id; + } + + /** + * 取得当前对象的ID值 + * + * @return string + */ + function idValue() + { + return $this->_id ? $this->_id->__toString() : null; + } + + /** + * 设置当前对象的ID + * + * @param string|MongoId $id 新的Id,如果非长度为24的16禁止的字符串,则MongoDB会认为是非法的ID,而忽略之 + */ + function setId($id) + { + $this->_id = ($id); + } + + /** + * 增加一个属性的值 + * + * @param string $attr 属性 + * @param integer $count 增加的数量 + */ + function increase($attr, $count = 1) + { + $this->_execOperator('$inc', $attr, $count); + } + + /** + * 删除一个属性值。如果是一个集合只会将其值设置为NULL, + * 这时候你需要调用$obj->pull($attrParent, null)来删除null值。 + * + * @param string $attr 属性 + * @param boolean $pullNull 是否自动删除NULL值 + */ + function remove($attr, $pullNull = true) + { + if ($pullNull) + { + $this->_execOperator('$unset', $attr, 1); + $this->save(); + if (strstr($attr, ".")) + { + $parent = substr($attr, 0, strrpos($attr, ".")); + $this->pull($parent, null); + } + } + else + { + $this->_execOperator('$unset', $attr, 1); + } + } + + /** + * 在一个集合末尾增加新的元素 + * + * 注意索引数组和关联数组不能混合 + * + * @param string $attr 属性 + * @param mixed $value 属性值 + * @param boolean|string|integer $genId 是否自动生成ID,如果是boolean,则可以指定是否自动生成ID,如果是string和integer,则直接使用此值作为ID + */ + function push($attr, $value, $genId = false) + { + if (is_bool($genId) && $genId) + { + $attr .= "." . strtoupper(uniqid("ID_")); + $this->setAttr($attr, $value); + } + elseif (is_string($genId) || is_integer($genId)) + { + $attr .= "." . $genId; + $this->setAttr($attr, $value); + } + else + { + $this->_execOperator('$push', $attr, $value); + } + } + + /** + * 在一个集合末尾增加一组新的元素 + * + * @param string $attr 属性 + * @param array $values 属性值 + */ + function pushAll($attr, array $values) + { + $this->_execOperator('$pushAll', $attr, $values); + } + + function addToSet($attr, $value) + { + $this->_execOperator('$addToSet', $attr, $value); + } + + function addAllToSet($attr, array $values) + { + $this->_execOperator('$addToSet', $attr, array('$each' => $values)); + } + + function pop($attr) + { + $this->_execOperator('$pop', $attr, 1); + } + + function shift($attr) + { + $this->_execOperator('$pop', $attr, -1); + } + + /** + * 拽出某一个数组中的值为$value的元素 + * + * @param string $attr 属性 + * @param mixed $value 元素值 + */ + function pull($attr, $value) + { + $this->_execOperator('$pull', $attr, $value); + } + + function pullAll($attr, array $values) + { + $this->_execOperator('$pullAll', $attr, $values); + } + + /** + * 保存当前对象 + * + * @param boolean $refresh 是否刷新当前对象 + * + * @return boolean + */ + function save($refresh = false) + { + if (!$this->_collection) + { + import("@.RMongoException"); + throw new RMongoException("Object is not in any collection, please use setCollection() to method to set a collection."); + } + $bool = true; + if ($this->_id) + { //if exists + if (!empty($this->_operations)) + { + $bool = $this->_collection->update(array("_id" => $this->_id), $this->_operations, array("upsert" => false, "multiple" => false, "safe" => true)); + if ($refresh) + { + $bool = $this->refresh(); + } + } + } + else + { + $bool = $this->_collection->insert($this->_attrs, true); + if ($bool) + { + $this->_id = $this->_attrs["_id"]; + import("@.RMongo"); + RMongo::setLastInsertId($this->_id->__toString()); + } + } + $this->_operations = array(); + return $bool; + } + + /** + * 刷新当前对象 + * + * @return boolean + */ + function refresh() + { + if (!$this->_collection) + { + import("@.RMongoException"); + throw new RMongoException("Object is not in any collection, please use setCollection() to method to set a collection."); + } + if (!$this->_id) + { + return true; + } + $this->setSource($this->_collection->findOne(array("_id" => $this->_id))); + return true; + } + + function setCollection(MongoCollection $collection) + { + $this->_collection = $collection; + } + + function attr($name) + { + return rock_array_get($this->_attrs, $name); + } + + /** + * 取得当前对象的所有属性值 + * + * @return array + */ + function attrs() + { + return $this->_attrs; + } + + /** + * 删除当前对象 + * + */ + function delete() + { + if ($this->_collection && $this->_id) + { + $this->_collection->remove(array("_id" => $this->_id)); + } + $this->_id = null; + $this->_attrs = array(); + } + + function __get($name) + { + return $this->attr($name); + } + + /** + * 判断一个偏移量是否存在 + * + * 实现了 ArrayAccess 接口对应方法 + * + * @param integer $index + * + * @return boolean + * @since 1.0 + */ + function offsetExists($index) + { + return !is_null($this->attr($index)); + } + + /** + * 从一个偏移量中取得数据 + * + * 实现了 ArrayAccess 接口对应方法 + * + * @param integer $index 偏移量 + * + * @return mixed + */ + function offsetGet($index) + { + return $this->attr($index); + } + + /** + * 设置偏移量位置上的值 + * + * 实现了 ArrayAccess 接口对应方法 + * + * @param integer $index 偏移量 + * @param mixed $item 值 + */ + function offsetSet($index, $item) + { + $this->setAttr($index, $item); + } + + /** + * 删除偏移量位置对应的元素 + * + * 实现了 ArrayAccess 接口对应方法 + * + * @param integer $index 偏移量 + */ + function offsetUnset($index) + { + $this->setAttr($index, null); + } +} + ?> \ No newline at end of file diff --git a/app/lib/mongo/RQuery.php b/app/lib/mongo/RQuery.php index cac2510..0ac41ac 100644 --- a/app/lib/mongo/RQuery.php +++ b/app/lib/mongo/RQuery.php @@ -1,601 +1,720 @@ - array(..), field2 => array(...) ... - private $_results = array();//field => [1|0] - private $_sort = array();//field => [1|-1] - private $_offset = -1; - private $_limit = 0; - private $_conds = array();//field1 => array( '$lt' => value1, .. ) - private $_noPk = false; - private $_hints = array(); - - /** - * 构造查询 - * - * @param Mongo $mongo MongoDB连接 - * @param string $db 数据库 - * @param string $collection 集合 - */ - function __construct(RMongo $mongo, $db, $collection) { - $this->_dbName = $db; - $this->_collectionName = $collection; - $this->_db = $mongo->selectDB($this->_dbName); - $this->_collection = $mongo->selectCollection($this->_dbName, $this->_collectionName); - } - - /** - * 指定属性值 - * - * @param string|array $nameOrAttrs 属性名或一组属性值 - * @param string $value 属性值 - * @return RQuery - */ - function attr($nameOrAttrs, $value = null) { - if (!is_array($nameOrAttrs)) { - $nameOrAttrs = array( $nameOrAttrs => $value ); - } - foreach ($nameOrAttrs as $attr => $value) { - if ($attr == "_id" && (!is_object($value) || !($value instanceof MongoId)) && strlen($attr) == 24) { - $value = new MongoId($value); - } - if (!isset($this->_attrs[$attr])) { - $this->_attrs[$attr] = array(); - } - if (is_array($value)) { - $this->_attrs[$attr] = array_merge($this->_attrs[$attr], array($value)); - } - else { - $this->_attrs[$attr][] = $value; - } - } - return $this; - } - - /** - * 指定返回的结果属性。在当前的mongo版本中(<1.4.x),不能混合使用result()和exclude() - * - * @param string $attr1 第一个属性 - * @param ... - * @return RQuery - */ - function result($attr1 = null) { - foreach (func_get_args() as $arg) { - if ($arg) { - if (is_array($arg)) { - foreach ($arg as $v) { - $this->_results[$v] = 1; - } - } - else if (strstr($arg, ",")) { - foreach (preg_split("/\s*,\s*/", $arg) as $attr) { - $this->_results[$attr] = 1; - } - } - else { - $this->_results[$arg] = 1; - } - } - } - return $this; - } - - /** - * 指定返回的结果中要排除的属性 - * - * @param string $attr1 第一个属性 - * @param ... - * @return RQuery - */ - function exclude($attr1 = null) { - foreach (func_get_args() as $arg) { - if ($arg) { - if (strstr($arg, ",")) { - foreach (preg_split("/\s*,\s*/", $arg) as $attr) { - $this->_results[$attr] = 0; - } - } - else { - $this->_results[$arg] = 0; - } - } - } - return $this; - } - - /** - * 设置正排序条件 - * - * @param string $attr 需要排序的属性 - * @return RQuery - */ - function asc($attr = "_id") { - $this->_sort[$attr] = 1; - return $this; - } - - /** - * 设置倒排序条件 - * - * @param string $attr 需要排序的属性 - * @return RQuery - */ - function desc($attr = "_id") { - $this->_sort[$attr] = -1; - return $this; - } - - /** - * 设置记录开始的位置 - * - * @param integer $offset 开始位置 - * @return RQuery - */ - function offset($offset) { - $this->_offset = intval($offset); - return $this; - } - - /** - * 设置需要查询的记录行数 - * - * @param integer $size 行数 - * @return RQuery - */ - function limit($size) { - $this->_limit = intval($size); - return $this; - } - - /** - * 增加查询条件 - * - * @param array $cond 查询条件 - * @return RQuery - */ - function cond(array $cond) { - foreach ($cond as $key => $value) { - $this->_conds[$key] = $value; - } - return $this; - } - - /** - * 添加操作符 - * - * @param string $attr 属性名 - * @param string $operator 操作符,比如$gt, $lt ... - * @param mixed $value 操作符对应的值 - * @return RQuery - */ - function operator($attr, $operator, $value) { - if (!isset($this->_conds[$attr])) { - $this->_conds[$attr] = array(); - } - $this->_conds[$attr][$operator] = $value; - return $this; - } - - function gt($attr, $value) { - return $this->operator($attr, '$gt', $value); - } - - function lt($attr, $value) { - return $this->operator($attr, '$lt', $value); - } - - function gte($attr, $value) { - return $this->operator($attr, '$gte', $value); - } - - function lte($attr, $value) { - return $this->operator($attr, '$lte', $value); - } - - /** - * 设置不等于(!=)条件 - * - * @param string $attr 属性名 - * @param mixed $value 和属性比较的值 - * @return RQuery - */ - function ne($attr, $value) { - return $this->operator($attr, '$ne', $value); - } - - function in($attr, array $values) { - return $this->operator($attr, '$in', $values); - } - - function nin($attr, array $values) { - return $this->operator($attr, '$nin', $values); - } - - function mod($attr, $value) { - return $this->operator($attr, '$mod', $value); - } - - function all($attr, $value) { - return $this->operator($attr, '$all', $value); - } - - function contains($attr, $value) { - return $this->all($attr, '$all', $value); - } - - /** - * 限定集合属性的尺寸 - * - * @param string $attr 属性名 - * @param integer $size 限制的尺寸 - * @return RQuery - */ - function size($attr, $size) { - return $this->operator($attr, '$size', intval($size)); - } - - function exists($attr, $bool = true) { - return $this->operator($attr, '$exists', $bool); - } - - function type($attr, $type) { - return $this->operator($attr, '$type', intval($type)); - } - - function match($attr, $regexp) { - return $this->attr($attr, new MongoRegex($regexp)); - } - - /** - * 分割一个是集合(相当于PHP中的索引数组)的属性值 - * - * @param string $attr 属性名 - * @param integer $subOffset 开始位置 - * @param integer $subLimit 要取出的条数 - * @return RQuery - */ - function slice($attr, $subOffset, $subLimit) { - $this->_results[$attr]['$slice'] = array( intval($subOffset), intval($subLimit) ); - return $this; - } - - /** - * 使用函数。如果数据较多话,将会非常慢。 - * - * @param string $func Javascript函数 - * @return RQuery - */ - function func($func) { - $this->_conds['$where'] = $func; - return $this; - } - - /** - * 设置否是不返回主键(_id) - * - * @param unknown_type $returnPk - * @return RQuery - */ - function noPk($noPk = true) { - $this->_noPk = $noPk; - return $this; - } - - /** - * 设置查询的主键值 - * - * @param string $pk1 主键1 - * @param string ... - * @return RQuery - */ - function id($pk1) { - foreach (func_get_args() as $arg) { - $this->attr("_id", $arg); - } - return $this; - } - - function copy() { - exit(__METHOD__ . "() to be implemented"); - } - - /** - * 现有查询条件的组合 - * - * @return array - */ - function criteria() { - $attrs = $this->_attrs; - foreach ($this->_attrs as $attr => $values) { - if (!empty($values)) { - if (count($values) == 1) { - $attrs[$attr] = $values[0]; - } - else { - $attrs[$attr]['$in'] = $values; - } - } - } - foreach ($this->_conds as $key => $value) { - $attrs[$key] = $value; - } - return $attrs; - } - - /** - * add hints for query - * - * @param unknown_type $hint - * @return RQuery - */ - function hint($hint) { - $this->_hints[] = $hint; - return $this; - } - - /** - * 取得当前查询的游标 - * - * @return MongoCursor - */ - function cursor() { - $cursor = $this->_collection->find($this->criteria(), $this->_results); - if ($this->_offset >= 0) { - $cursor->skip($this->_offset); - } - if ($this->_limit > 0) { - $cursor->limit($this->_limit); - } - if ($this->_sort) { - $cursor->sort($this->_sort); - } - if (!empty($this->_hints)) { - foreach ($this->_hints as $hint) { - $cursor->hint($hint); - } - } - return $cursor; - } - - /** - * 查找一行数据,并以一个对象的形式返回 - * - * @param string $id 主键_id值 - * @return RObject - */ - function find($id = null) { - if (!is_null($id)) { - $this->id($id); - } - $row = $this->findOne(); - if (empty($row)) { - return null; - } - import("@.RObject"); - $obj = new RObject(); - $obj->setSource($row); - $obj->setCollection($this->_collection); - $obj->setId($row["_id"]); - return $obj; - } - - /** - * 查找一行数据,以数组的形式返回 - * - * @param string $id 主键_id值 - * @return array - */ - function findOne($id = null) { - if (!is_null($id)) { - $this->id($id); - } - $this->limit(1); - $all = $this->findAll(); - return empty($all) ? array() : $all[0]; - } - - /** - * 查找一行数据,但只返回ID数据 - * - * @param string $id 主键_id值 - * @return RObjct - */ - function findId($id = null) { - if (!is_null($id)) { - $this->id($id); - } - $this->_results = array(); - $this->_results["_id"] = 1; - return $this->find(); - } - - /** - * 根据请求的参数查询数据 - * - * @param string $requestPkName 值为主键值的请求参数 - * @return RObject - */ - function findx($requestPkName = "id") { - return $this->find(x($requestPkName)); - } - - /** - * 取出所有记录 - * - * @param boolean $keepId 是否保留ID的原始状态 - * @return array - */ - function findAll($keepId = true) { - $rets = array(); - foreach ($this->cursor() as $value) { - if ($this->_noPk) { - unset($value["_id"]); - } - else { - if (!$keepId && isset($value["_id"]) && ($value["_id"] instanceof MongoId)) { - $value["_id"] = $value["_id"]->__toString(); - } - } - $rets[] = $value; - } - return $rets; - } - - /** - * 分页 - * - * @param array $params 分页参数 - * @param string $style 分页样式 - * @return RPage - */ - function page(array $params = array(), $style = null) { - import("RPage"); - if (!class_exists("RPage")) { - exit("You must use the method " . __METHOD__ . "() with page plugin."); - } - $page = RPage::pageWithStyle($style, $params); - $this->offset($page->offset()); - $this->limit($page->size()); - $page->setRows($this->findAll()); - return $page; - } - - /** - * 计算符合条件的行数 - * - * @param boolean $withLimit limit()/offset()方法是否有效 - * @return integer - */ - function count($withLimit = false) { - return $this->cursor()->count($withLimit); - } - - /** - * Insert new record - * - * @param array $attrs attributes of new record - * @param boolean $safe check result - * @return boolean - */ - function insert(array $attrs, $safe = false) { - $bool = $this->_collection->insert($attrs, array( "safe" => $safe )); - if ($bool) { - import("@.RMongo"); - if ($attrs["_id"] instanceof MongoId) { - RMongo::setLastInsertId($attrs["_id"]->__toString()); - } - else { - RMongo::setLastInsertId($attrs["_id"]); - } - } - return $bool; - } - - /** - * 插入新的行,_id是上一行的ID加1 - * - * @param array $attrs 新行的属性集 - * @return boolean - */ - function insertNext(array $attrs) { - $response = $this->_db->execute('function insertObject(o, myCollection) { - var x = db.getCollection(myCollection); - while( 1 ) { - // determine next _id value to try - var c = x.find({},{_id:1}).sort({_id:-1}).limit(1); - var i = c.hasNext() ? c.next()._id + 1 : 1; - o._id = i; - x.insert(o); - var err = db.getLastErrorObj(); - if( err && err.code ) { - if( err.code == 11000 /* dup key */ ) - continue; - else - print("unexpected error inserting data: " + tojson(err)); - } - break; - } - return o._id; - }', array( $attrs, $this->_collectionName )); - - if ($response["ok"]) { - import("@.RMongo"); - RMongo::setLastInsertId($response["retval"]); - } - - return $response["ok"]; - } - - /** - * 删除符合条件的记录 - * - * @return boolean - */ - function delete() { - return $this->_collection->remove($this->criteria()); - } - - /** - * 更改或插入新的对象 - * - * 在当前驱动下不能正常工作 - * - * @param array $obj 新的对象 - * @return boolean - */ - function upsert(array $obj) { - return $this->_collection->update($this->criteria(), $obj, array( "upsert" => true, "multiple" => true)); - } - - /** - * 批量插入一组新的数据 - * - * @param array $array 每一个元素包含一个要插入的行 - * @return boolean - */ - function batchInsert(array $array) { - return $this->_collection->batchInsert($array); - } - /** - * 当前操作的集合 - * - * @return MongoCollection - */ - function collection() { - return $this->_collection; - } - - /** - * 当前操作的数据库 - * - * @return MongoDB - */ - function db() { - return $this->_db; - } -} - + array(..), field2 => array(...) ... + private $_results = array(); //field => [1|0] + private $_sort = array(); //field => [1|-1] + private $_offset = -1; + private $_limit = 0; + private $_conds = array(); //field1 => array( '$lt' => value1, .. ) + private $_noPk = false; + private $_hints = array(); + + /** + * 构造查询 + * + * @param Mongo $mongo MongoDB连接 + * @param string $db 数据库 + * @param string $collection 集合 + */ + function __construct(RMongo $mongo, $db, $collection) + { + $this->_dbName = $db; + $this->_collectionName = $collection; + $this->_db = $mongo->selectDB($this->_dbName); + $this->_collection = $mongo->selectCollection($this->_dbName, $this->_collectionName); + } + + /** + * 指定属性值 + * + * @param string|array $nameOrAttrs 属性名或一组属性值 + * @param string $value 属性值 + * + * @return RQuery + */ + function attr($nameOrAttrs, $value = null) + { + if (!is_array($nameOrAttrs)) + { + $nameOrAttrs = array($nameOrAttrs => $value); + } + foreach ($nameOrAttrs as $attr => $value) + { + if ($attr == "_id" && (!is_object($value) || !($value instanceof MongoId)) && strlen($attr) == 24) + { + $value = new MongoId($value); + } + if (!isset($this->_attrs[$attr])) + { + $this->_attrs[$attr] = array(); + } + if (is_array($value)) + { + $this->_attrs[$attr] = array_merge($this->_attrs[$attr], array($value)); + } + else + { + $this->_attrs[$attr][] = $value; + } + } + return $this; + } + + /** + * 指定返回的结果属性。在当前的mongo版本中(<1.4.x),不能混合使用result()和exclude() + * + * @param string $attr1 第一个属性 + * @param ... + * + * @return RQuery + */ + function result($attr1 = null) + { + foreach (func_get_args() as $arg) + { + if ($arg) + { + if (is_array($arg)) + { + foreach ($arg as $v) + { + $this->_results[$v] = 1; + } + } + else if (strstr($arg, ",")) + { + foreach (preg_split("/\s*,\s*/", $arg) as $attr) + { + $this->_results[$attr] = 1; + } + } + else + { + $this->_results[$arg] = 1; + } + } + } + return $this; + } + + /** + * 指定返回的结果中要排除的属性 + * + * @param string $attr1 第一个属性 + * @param ... + * + * @return RQuery + */ + function exclude($attr1 = null) + { + foreach (func_get_args() as $arg) + { + if ($arg) + { + if (strstr($arg, ",")) + { + foreach (preg_split("/\s*,\s*/", $arg) as $attr) + { + $this->_results[$attr] = 0; + } + } + else + { + $this->_results[$arg] = 0; + } + } + } + return $this; + } + + /** + * 设置正排序条件 + * + * @param string $attr 需要排序的属性 + * + * @return RQuery + */ + function asc($attr = "_id") + { + $this->_sort[$attr] = 1; + return $this; + } + + /** + * 设置倒排序条件 + * + * @param string $attr 需要排序的属性 + * + * @return RQuery + */ + function desc($attr = "_id") + { + $this->_sort[$attr] = -1; + return $this; + } + + /** + * 设置记录开始的位置 + * + * @param integer $offset 开始位置 + * + * @return RQuery + */ + function offset($offset) + { + $this->_offset = intval($offset); + return $this; + } + + /** + * 设置需要查询的记录行数 + * + * @param integer $size 行数 + * + * @return RQuery + */ + function limit($size) + { + $this->_limit = intval($size); + return $this; + } + + /** + * 增加查询条件 + * + * @param array $cond 查询条件 + * + * @return RQuery + */ + function cond(array $cond) + { + foreach ($cond as $key => $value) + { + $this->_conds[$key] = $value; + } + return $this; + } + + /** + * 添加操作符 + * + * @param string $attr 属性名 + * @param string $operator 操作符,比如$gt, $lt ... + * @param mixed $value 操作符对应的值 + * + * @return RQuery + */ + function operator($attr, $operator, $value) + { + if (!isset($this->_conds[$attr])) + { + $this->_conds[$attr] = array(); + } + $this->_conds[$attr][$operator] = $value; + return $this; + } + + function gt($attr, $value) + { + return $this->operator($attr, '$gt', $value); + } + + function lt($attr, $value) + { + return $this->operator($attr, '$lt', $value); + } + + function gte($attr, $value) + { + return $this->operator($attr, '$gte', $value); + } + + function lte($attr, $value) + { + return $this->operator($attr, '$lte', $value); + } + + /** + * 设置不等于(!=)条件 + * + * @param string $attr 属性名 + * @param mixed $value 和属性比较的值 + * + * @return RQuery + */ + function ne($attr, $value) + { + return $this->operator($attr, '$ne', $value); + } + + function in($attr, array $values) + { + return $this->operator($attr, '$in', $values); + } + + function nin($attr, array $values) + { + return $this->operator($attr, '$nin', $values); + } + + function mod($attr, $value) + { + return $this->operator($attr, '$mod', $value); + } + + function all($attr, $value) + { + return $this->operator($attr, '$all', $value); + } + + function contains($attr, $value) + { + return $this->all($attr, '$all', $value); + } + + /** + * 限定集合属性的尺寸 + * + * @param string $attr 属性名 + * @param integer $size 限制的尺寸 + * + * @return RQuery + */ + function size($attr, $size) + { + return $this->operator($attr, '$size', intval($size)); + } + + function exists($attr, $bool = true) + { + return $this->operator($attr, '$exists', $bool); + } + + function type($attr, $type) + { + return $this->operator($attr, '$type', intval($type)); + } + + function match($attr, $regexp) + { + return $this->attr($attr, new MongoRegex($regexp)); + } + + /** + * 分割一个是集合(相当于PHP中的索引数组)的属性值 + * + * @param string $attr 属性名 + * @param integer $subOffset 开始位置 + * @param integer $subLimit 要取出的条数 + * + * @return RQuery + */ + function slice($attr, $subOffset, $subLimit) + { + $this->_results[$attr]['$slice'] = array(intval($subOffset), intval($subLimit)); + return $this; + } + + /** + * 使用函数。如果数据较多话,将会非常慢。 + * + * @param string $func Javascript函数 + * + * @return RQuery + */ + function func($func) + { + $this->_conds['$where'] = $func; + return $this; + } + + /** + * 设置否是不返回主键(_id) + * + * @param unknown_type $returnPk + * + * @return RQuery + */ + function noPk($noPk = true) + { + $this->_noPk = $noPk; + return $this; + } + + /** + * 设置查询的主键值 + * + * @param string $pk1 主键1 + * @param string ... + * + * @return RQuery + */ + function id($pk1) + { + foreach (func_get_args() as $arg) + { + $this->attr("_id", $arg); + } + return $this; + } + + function copy() + { + exit(__METHOD__ . "() to be implemented"); + } + + /** + * 现有查询条件的组合 + * + * @return array + */ + function criteria() + { + $attrs = $this->_attrs; + foreach ($this->_attrs as $attr => $values) + { + if (!empty($values)) + { + if (count($values) == 1) + { + $attrs[$attr] = $values[0]; + } + else + { + $attrs[$attr]['$in'] = $values; + } + } + } + foreach ($this->_conds as $key => $value) + { + $attrs[$key] = $value; + } + return $attrs; + } + + /** + * add hints for query + * + * @param unknown_type $hint + * + * @return RQuery + */ + function hint($hint) + { + $this->_hints[] = $hint; + return $this; + } + + /** + * 取得当前查询的游标 + * + * @return MongoCursor + */ + function cursor() + { + $cursor = $this->_collection->find($this->criteria(), $this->_results); + if ($this->_offset >= 0) + { + $cursor->skip($this->_offset); + } + if ($this->_limit > 0) + { + $cursor->limit($this->_limit); + } + if ($this->_sort) + { + $cursor->sort($this->_sort); + } + if (!empty($this->_hints)) + { + foreach ($this->_hints as $hint) + { + $cursor->hint($hint); + } + } + return $cursor; + } + + /** + * 查找一行数据,并以一个对象的形式返回 + * + * @param string $id 主键_id值 + * + * @return RObject + */ + function find($id = null) + { + if (!is_null($id)) + { + $this->id($id); + } + $row = $this->findOne(); + if (empty($row)) + { + return null; + } + import("@.RObject"); + $obj = new RObject(); + $obj->setSource($row); + $obj->setCollection($this->_collection); + $obj->setId($row["_id"]); + return $obj; + } + + /** + * 查找一行数据,以数组的形式返回 + * + * @param string $id 主键_id值 + * + * @return array + */ + function findOne($id = null) + { + if (!is_null($id)) + { + $this->id($id); + } + $this->limit(1); + $all = $this->findAll(); + return empty($all) ? array() : $all[0]; + } + + /** + * 查找一行数据,但只返回ID数据 + * + * @param string $id 主键_id值 + * + * @return RObjct + */ + function findId($id = null) + { + if (!is_null($id)) + { + $this->id($id); + } + $this->_results = array(); + $this->_results["_id"] = 1; + return $this->find(); + } + + /** + * 根据请求的参数查询数据 + * + * @param string $requestPkName 值为主键值的请求参数 + * + * @return RObject + */ + function findx($requestPkName = "id") + { + return $this->find(x($requestPkName)); + } + + /** + * 取出所有记录 + * + * @param boolean $keepId 是否保留ID的原始状态 + * + * @return array + */ + function findAll($keepId = true) + { + $rets = array(); + foreach ($this->cursor() as $value) + { + if ($this->_noPk) + { + unset($value["_id"]); + } + else + { + if (!$keepId && isset($value["_id"]) && ($value["_id"] instanceof MongoId)) + { + $value["_id"] = $value["_id"]->__toString(); + } + } + $rets[] = $value; + } + return $rets; + } + + /** + * 分页 + * + * @param array $params 分页参数 + * @param string $style 分页样式 + * + * @return RPage + */ + function page(array $params = array(), $style = null) + { + import("RPage"); + if (!class_exists("RPage")) + { + exit("You must use the method " . __METHOD__ . "() with page plugin."); + } + $page = RPage::pageWithStyle($style, $params); + $this->offset($page->offset()); + $this->limit($page->size()); + $page->setRows($this->findAll()); + return $page; + } + + /** + * 计算符合条件的行数 + * + * @param boolean $withLimit limit()/offset()方法是否有效 + * + * @return integer + */ + function count($withLimit = false) + { + return $this->cursor()->count($withLimit); + } + + /** + * Insert new record + * + * @param array $attrs attributes of new record + * @param boolean $safe check result + * + * @return boolean + */ + function insert(array $attrs, $safe = false) + { + $bool = $this->_collection->insert($attrs, array("safe" => $safe)); + if ($bool) + { + import("@.RMongo"); + if ($attrs["_id"] instanceof MongoId) + { + RMongo::setLastInsertId($attrs["_id"]->__toString()); + } + else + { + RMongo::setLastInsertId($attrs["_id"]); + } + } + return $bool; + } + + /** + * 插入新的行,_id是上一行的ID加1 + * + * @param array $attrs 新行的属性集 + * + * @return boolean + */ + function insertNext(array $attrs) + { + $response = $this->_db->execute('function insertObject(o, myCollection) { + var x = db.getCollection(myCollection); + while( 1 ) { + // determine next _id value to try + var c = x.find({},{_id:1}).sort({_id:-1}).limit(1); + var i = c.hasNext() ? c.next()._id + 1 : 1; + o._id = i; + x.insert(o); + var err = db.getLastErrorObj(); + if( err && err.code ) { + if( err.code == 11000 /* dup key */ ) + continue; + else + print("unexpected error inserting data: " + tojson(err)); + } + break; + } + return o._id; + }', array($attrs, $this->_collectionName)); + + if ($response["ok"]) + { + import("@.RMongo"); + RMongo::setLastInsertId($response["retval"]); + } + + return $response["ok"]; + } + + /** + * 删除符合条件的记录 + * + * @return boolean + */ + function delete() + { + return $this->_collection->remove($this->criteria()); + } + + /** + * 更改或插入新的对象 + * + * 在当前驱动下不能正常工作 + * + * @param array $obj 新的对象 + * + * @return boolean + */ + function upsert(array $obj) + { + return $this->_collection->update($this->criteria(), $obj, array("upsert" => true, "multiple" => true)); + } + + /** + * 批量插入一组新的数据 + * + * @param array $array 每一个元素包含一个要插入的行 + * + * @return boolean + */ + function batchInsert(array $array) + { + return $this->_collection->batchInsert($array); + } + + /** + * 当前操作的集合 + * + * @return MongoCollection + */ + function collection() + { + return $this->_collection; + } + + /** + * 当前操作的数据库 + * + * @return MongoDB + */ + function db() + { + return $this->_db; + } +} + ?> \ No newline at end of file diff --git a/app/lib/mongo/mongo.php b/app/lib/mongo/mongo.php new file mode 100644 index 0000000..054f264 --- /dev/null +++ b/app/lib/mongo/mongo.php @@ -0,0 +1,656 @@ + TRUE)); + + /** + * @param mixed $db + * + * @return array + */ + public function dropDB(mixed $db); + + /** + * @return bool + */ + public function forceError(); + + /** + * @param string $dbname + * + * @return MongoDB + */ + public function __get($dbname); + + /** + * @return array + */ + public function lastError(); + + /** + * @return array + */ + public function listDBs(); + + /** + * @return boolean + */ + public function pairConnect(); + + /** + * @param string $username + * @param string $password + * + * @return boolean + */ + public function pairPersistConnect($username = "", $password = ""); + + /** + * @param string $username + * @param string $password + * + * @return boolean + */ + public function persistConnect($username = "", $password = ""); + + /** + * @return array + */ + public function prevError(); + + /** + * @return array + */ + public function resetError(); + + /** + * @param string|MongoDB $db + * @param string $collection + * + * @return MongoCollection + */ + public function selectCollection($db, $collection); + + /** + * @param string $dbname + * + * @return MongoDB + */ + public function selectDB($dbname); + + /** + * @return string + */ + public function __toString(); +} + +class MongoDB +{ + /* Constants */ + /** + * @var int + */ + const PROFILING_OFF = 0; + /** + * @var int + */ + const PROFILING_SLOW = 1; + /** + * @var int + */ + const PROFILING_ON = 2; + + /* Methods */ + /** + * @param string $username + * @param string $password + * + * @return array + */ + public function authenticate($username, $password); + + /** + * @param array $data + * + * @return array + */ + public function command(array $data); + + /** + * @param Mongo $conn + * @param string $name + */ + function __construct(Mongo $conn, string $name); + + /** + * @param string $name + * @param bool $capped + * @param int $size + * @param int $max + * + * @return MongoCollection + */ + public function createCollection(string $name, bool $capped = FALSE, int $size = 0, int $max = 0); + + /** + * @param string $collection + * @param mixed $a + * + * @return array + */ + public function createDBRef(string $collection, mixed $a); + + /** + * @return array + */ + public function drop(); + + /** + * @param mixed $coll + * + * @return array + */ + public function dropCollection(mixed $coll); + + /** + * @param mixed $code + * @param array $args + * + * @return array + */ + public function execute(mixed $code, array $args = array()); + + /** + * @return bool + */ + public function forceError(); + + /** + * @return MongoCollection + */ + public function __get(string $name); + + /** + * @return array + */ + public function getDBRef(array $ref); + + /** + * @return MongoGridFS + */ + public function getGridFS(string $prefix = "fs"); + + /** + * @return int + */ + public function getProfilingLevel(); + + /** + * @return array + */ + public function lastError(); + + /** + * @return array + */ + public function listCollections(); + + /** + * @return array + */ + public function prevError(); + + /** + * @return array + */ + public function repair(bool $preserve_cloned_files = FALSE, bool $backup_original_files = FALSE); + + /** + * @return array + */ + public function resetError(); + + /** + * @return MongoCollection + */ + public function selectCollection(string $name); + + /** + * @return int + */ + public function setProfilingLevel(int $level); + + /** + * @return string + */ + public function __toString(); +} + +class MongoCollection +{ + /* Fields */ + /** + * @var MongoDB + */ + public $db = NULL; + + /* Methods */ + /** + * @return mixed + */ + public function batchInsert(array $a, array $options = array()); + + public function __construct(MongoDB $db, string $name); + + /** + * @return int + */ + public function count(mixed $query = array()); + + /** + * @return array + */ + public function createDBRef(array $a); + + /** + * @param string|array $keys + * + * @return array + */ + public function deleteIndex($keys); + + /** + * @return array + */ + public function deleteIndexes(); + + /** + * @return array + */ + public function drop(); + + /** + * @return boolean + */ + public function ensureIndex(array $keys, array $options); + + /** + * @return MongoCursor + */ + public function find(array $query = array(), array $fields = array()); + + /** + * @return array + */ + public function findOne(array $query = array(), array $fields = array()); + + /** + * @return MongoCollection + */ + public function __get(string $name); + + /** + * @return array + */ + public function getDBRef(array $ref); + + /** + * @return array + */ + public function getIndexInfo(); + + /** + * @return string + */ + public function getName(); + + /** + * @return array + */ + public function group(mixed $keys, array $initial, MongoCode $reduce, array $condition = array()); + + /** + * @return mixed + */ + public function insert(array $a, array $options = array()); + + /** + * @return mixed + */ + public function remove(array $criteria, array $options = array()); + + /** + * @return mixed + */ + public function save(array $a, array $options = array()); + + /** + * @return string + */ + public function __toString(); + + /** + * @return boolean + */ + public function update(array $criteria, array $newobj, array $options = array()); + + /** + * @return array + */ + public function validate(bool $scan_data = FALSE); +} + +class MongoCursor implements Iterator +{ + /* Static Fields */ + /** + * @var boolean + */ + static $slaveOkay = FALSE; + + /* Methods */ + /** + * @return MongoCursor + */ + public function addOption(string $key, mixed $value); + + function __construct(resource $connection, string $ns, array $query = array(), array $fields = array()); + + /** + * + * @param boolean $all 是否使用limit和skip信息 + * + * @return int + */ + public function count(boolean $all = FALSE); + + /** + * @return array + */ + public function current(); + + /** + * @return boolean + */ + public function dead(); + + protected function doQuery(); + + /** + * @return array + */ + public function explain(); + + /** + * @return MongoCursor + */ + public function fields(array $f); + + /** + * @return array + */ + public function getNext(); + + /** + * @return array + */ + public function info(); + + /** + * @return boolean + */ + public function hasNext(); + + /** + * @return MongoCursor + */ + public function hint(array $key_pattern); + + /** + * @return MongoCursor + */ + public function immortal(boolean $liveForever = true); + + /** + * @return string + */ + public function key(); + + /** + * @return MongoCursor + */ + public function limit(int $num); + + public function next(); + + public function reset(); + + public function rewind(); + + /** + * @return MongoCursor + */ + public function skip(int $num); + + /** + * @return MongoCursor + */ + public function slaveOkay(boolean $okay = true); + + /** + * @return MongoCursor + */ + public function snapshot(); + + /** + * @return MongoCursor + */ + public function sort(array $fields); + + /** + * @return MongoCursor + */ + public function tailable(boolean $tail = true); + + /** + * @return MongoCursor + */ + public function timeout(int $ms); + + /** + * @return boolean + */ + public function valid(); +} + +class MongoId +{ + /* Methods */ + function __construct(string $id = NULL); + + /** + * @return int + */ + public function getTimestamp(); + + /** + * @return string + */ + public function __toString(); +} + +class MongoRegex +{ + /* Fields */ + /** + * @var string + */ + public $regex; + /** + * @var string + */ + public $flags; + + /* Methods */ + function __construct(string $regex); + + /** + * @return string + */ + public function __toString(); +} + +class MongoCode +{ + /* Methods */ + function __construct(string $code, array $scope = array()); + + /** + * @return string + * + */ + public function __toString(); +} + +class MongoGridFS extends MongoCollection +{ + /* Fields */ + /** + * @var MongoCollection + */ + public $chunks = NULL; + /** + * @return string + */ + protected $filesName = NULL; + /** + * @return string + */ + protected $chunksName = NULL; + + /* Methods */ + function __construct(MongoDB $db, string $prefix = "fs"); + + /** + * @return array + */ + public function drop(); + + /** + * @return MongoGridFSCursor + */ + public function find(array $query = array(), array $fields = array()); + + /** + * @return MongoGridFSFile + */ + public function findOne(mixed $query = array()); + + /** + * @return boolean + */ + public function remove(array $criteria = array(), boolean $just_one = FALSE); + + /** + * @return mixed + */ + public function storeBytes(string $bytes, array $extra = array(), array $options = array()); + + /** + * @return mixed + */ + public function storeFile(string $filename, array $extra = array(), array $options = array()); + + /** + * @return mixed + */ + public function storeUpload(string $name, string $filename = NULL); +} + + +class MongoException extends Exception +{ +} + +class MongoCursorException extends MongoException +{ +} + +class MongoCursorTimeoutException extends MongoCursorException +{ +} + +class MongoConnectionException extends MongoException +{ +} + +class MongoGridFSException extends MongoException +{ +} + +?> \ No newline at end of file diff --git a/app/lib/page/RPage.php b/app/lib/page/RPage.php index 04735ec..171d7df 100644 --- a/app/lib/page/RPage.php +++ b/app/lib/page/RPage.php @@ -1,492 +1,570 @@ - - * $pager = new RPage(); - * $pager->total(100); - * $pager->setSize(21); - * $pager->setKeyword("page"); - * $pager->setPath("pager.php"); - * $pager->setQuery("a=b&pager=%{PAGE_NO}&d=1"); - * echo $pager; - * echo "offset:" . $pager->offset(); - * - * - * @author iwind
- * $page->addQuery(array(
- * "e" => 5,
- * "f" => 6
- * ));
- * $page->addQuery("g=7");
- *
- *
- * @param mixed $query string|array
- * @return RPage
- * @since 1.0.3
- */
- function addQuery($query) {
- if (is_array($query)) {
- $_query = array();
- foreach ($query as $key => $value) {
- if ($key == $this->keyword()) {
- continue;
- }
- if (is_array($value)) {
- foreach ($value as $key1=>$value1) {
- $_query[] = "{$key}[]=" . urlencode($value1);
- }
- }
- else {
- $_query[] = "{$key}=" . urlencode($value);
- }
- }
- $query = implode("&", $_query);
- }
- $this->query .= ($this->query ? "&" : "") . $query;
- return $this;
- }
-
- /**
- * 开启自动构造查询条件功能
- *
- * @param boolean $bool 是否开启该功能
- * @param string|array $except 要去除的参数名
- * @param string|array $only 限制的参数名
- * @return RPage
- * @since 1.0.3
- */
- function setAutoQuery($bool = true, $except = "", $only = "") {
- if ($bool) {
- $x = xn();
- foreach ($x as $name => $value) {
- if ($except && if_in_array($name, $except)) {
- unset($x[$name]);
- }
- if ($only && !if_in_array($name, $only)) {
- unset($x[$name]);
- }
- }
- $this->setQuery($x);
- }
- return $this;
- }
-
- /**
- * 取得查询
- *
- * @return array
- * @since 1.0
- */
- function query() {
- return $this->query;
- }
-
- /**
- * 取得一个分页好号对应的URL
- *
- * @param integer $pageNo 分页号
- * @return string
- * @since 1.0
- */
- function url($pageNo) {
- $query = $this->query();
- if (strstr($query, self::PAGER_VARIABLE_STRING)) {
- $query = str_replace(self::PAGER_VARIABLE_STRING, $pageNo, $query);
- }
- else {
- if ($query == "") {
- $query = $this->keyword() . "=" . $pageNo;
- }
- else {
- $query .= "&" . $this->keyword() . "=" . $pageNo;
- }
- }
- return $this->path() . "?" . $query;
- }
-
- /**
- * 取得总分页数
- *
- * @return integer
- * @since 1.0
- */
- function length() {
- if ($this->size() == 0) {
- return 0;
- }
- return ceil($this->total()/$this->size());
- }
-
- /**
- * 添加记录
- *
- * @param mixed $row 记录
- * @return RPage
- */
- function addRow($row) {
- $this->rows[] = $row;
- return $this;
- }
-
- /**
- * 添加记录集
- *
- * @param array $rows 记录集
- * @return RPage
- */
- function addRows(array $rows) {
- foreach ($rows as $row) {
- $this->rows[] = $row;
- }
- return $this;
- }
-
- /**
- * 取得记录集
- *
- * @return array
- */
- function rows() {
- return $this->rows;
- }
-
- /**
- * 设置记录集
- *
- * @param array|iterable $rows 记录集
- * @return RPage
- */
- function setRows($rows) {
- $this->rows = $rows;
- return $this;
- }
-
- /**
- * 取得键值对应的消息文本
- *
- * @param string $key 键值
- * @return string
- * @since 1.0
- */
- protected function message($key) {
- if (!$this->localeLoaded) {
- $locale = __LANG__;
- if (!$locale) {
- $locale = "default";
- }
-
- $message = x("~" . $key);
- if ($message) {
- return $message;
- }
-
- //简写
- $dirname = dirname(__FILE__) . "/lang";
- $langFile = $dirname . "/" . $locale . ".php";
- if (is_file($langFile)) {
- require($langFile);
- $this->messages = $message;
- }
- $this->localeLoaded = true;
- }
- if (is_array($this->messages) && array_key_exists($key, $this->messages)) {
- return $this->messages[$key];
- }
- return null;
- }
-
- /**
- * 转换成字符串
- *
- * @return string
- */
- public abstract function __toString();
-
- /**
- * 设置分页集尺寸
- *
- * @param integer $num 大于1
- * @return RPage
- * @since 1.0
- */
- function setPageSetNum($num){
- $this->pageSetSize = $num;
- return $this;
- }
-
- /**
- * 取得分页集尺寸
- *
- * @return integer
- * @since 1.0
- */
- function pageSetNum(){
- return $this->pageSetSize;
- }
-
- static function pageWithStyle($style, array $params = null) {
- exit(__METHOD__ . " need to be implemented.");
- }
-}
-
-
+
+ * $pager = new RPage();
+ * $pager->total(100);
+ * $pager->setSize(21);
+ * $pager->setKeyword("page");
+ * $pager->setPath("pager.php");
+ * $pager->setQuery("a=b&pager=%{PAGE_NO}&d=1");
+ * echo $pager;
+ * echo "offset:" . $pager->offset();
+ *
+ *
+ * @author iwind
+ * $page->addQuery(array(
+ * "e" => 5,
+ * "f" => 6
+ * ));
+ * $page->addQuery("g=7");
+ *
+ *
+ * @param mixed $query string|array
+ *
+ * @return RPage
+ * @since 1.0.3
+ */
+ function addQuery($query)
+ {
+ if (is_array($query))
+ {
+ $_query = array();
+ foreach ($query as $key => $value)
+ {
+ if ($key == $this->keyword())
+ {
+ continue;
+ }
+ if (is_array($value))
+ {
+ foreach ($value as $key1 => $value1)
+ {
+ $_query[] = "{$key}[]=" . urlencode($value1);
+ }
+ }
+ else
+ {
+ $_query[] = "{$key}=" . urlencode($value);
+ }
+ }
+ $query = implode("&", $_query);
+ }
+ $this->query .= ($this->query ? "&" : "") . $query;
+ return $this;
+ }
+
+ /**
+ * 开启自动构造查询条件功能
+ *
+ * @param boolean $bool 是否开启该功能
+ * @param string|array $except 要去除的参数名
+ * @param string|array $only 限制的参数名
+ *
+ * @return RPage
+ * @since 1.0.3
+ */
+ function setAutoQuery($bool = true, $except = "", $only = "")
+ {
+ if ($bool)
+ {
+ $x = xn();
+ foreach ($x as $name => $value)
+ {
+ if ($except && if_in_array($name, $except))
+ {
+ unset($x[$name]);
+ }
+ if ($only && !if_in_array($name, $only))
+ {
+ unset($x[$name]);
+ }
+ }
+ $this->setQuery($x);
+ }
+ return $this;
+ }
+
+ /**
+ * 取得查询
+ *
+ * @return array
+ * @since 1.0
+ */
+ function query()
+ {
+ return $this->query;
+ }
+
+ /**
+ * 取得一个分页好号对应的URL
+ *
+ * @param integer $pageNo 分页号
+ *
+ * @return string
+ * @since 1.0
+ */
+ function url($pageNo)
+ {
+ $query = $this->query();
+ if (strstr($query, self::PAGER_VARIABLE_STRING))
+ {
+ $query = str_replace(self::PAGER_VARIABLE_STRING, $pageNo, $query);
+ }
+ else
+ {
+ if ($query == "")
+ {
+ $query = $this->keyword() . "=" . $pageNo;
+ }
+ else
+ {
+ $query .= "&" . $this->keyword() . "=" . $pageNo;
+ }
+ }
+ return $this->path() . "?" . $query;
+ }
+
+ /**
+ * 取得总分页数
+ *
+ * @return integer
+ * @since 1.0
+ */
+ function length()
+ {
+ if ($this->size() == 0)
+ {
+ return 0;
+ }
+ return ceil($this->total() / $this->size());
+ }
+
+ /**
+ * 添加记录
+ *
+ * @param mixed $row 记录
+ *
+ * @return RPage
+ */
+ function addRow($row)
+ {
+ $this->rows[] = $row;
+ return $this;
+ }
+
+ /**
+ * 添加记录集
+ *
+ * @param array $rows 记录集
+ *
+ * @return RPage
+ */
+ function addRows(array $rows)
+ {
+ foreach ($rows as $row)
+ {
+ $this->rows[] = $row;
+ }
+ return $this;
+ }
+
+ /**
+ * 取得记录集
+ *
+ * @return array
+ */
+ function rows()
+ {
+ return $this->rows;
+ }
+
+ /**
+ * 设置记录集
+ *
+ * @param array|iterable $rows 记录集
+ *
+ * @return RPage
+ */
+ function setRows($rows)
+ {
+ $this->rows = $rows;
+ return $this;
+ }
+
+ /**
+ * 取得键值对应的消息文本
+ *
+ * @param string $key 键值
+ *
+ * @return string
+ * @since 1.0
+ */
+ protected function message($key)
+ {
+ if (!$this->localeLoaded)
+ {
+ $locale = __LANG__;
+ if (!$locale)
+ {
+ $locale = "default";
+ }
+
+ $message = x("~" . $key);
+ if ($message)
+ {
+ return $message;
+ }
+
+ //简写
+ $dirname = dirname(__FILE__) . "/lang";
+ $langFile = $dirname . "/" . $locale . ".php";
+ if (is_file($langFile))
+ {
+ require($langFile);
+ $this->messages = $message;
+ }
+ $this->localeLoaded = true;
+ }
+ if (is_array($this->messages) && array_key_exists($key, $this->messages))
+ {
+ return $this->messages[$key];
+ }
+ return null;
+ }
+
+ /**
+ * 转换成字符串
+ *
+ * @return string
+ */
+ public abstract function __toString();
+
+ /**
+ * 设置分页集尺寸
+ *
+ * @param integer $num 大于1
+ *
+ * @return RPage
+ * @since 1.0
+ */
+ function setPageSetNum($num)
+ {
+ $this->pageSetSize = $num;
+ return $this;
+ }
+
+ /**
+ * 取得分页集尺寸
+ *
+ * @return integer
+ * @since 1.0
+ */
+ function pageSetNum()
+ {
+ return $this->pageSetSize;
+ }
+
+ static function pageWithStyle($style, array $params = null)
+ {
+ exit(__METHOD__ . " need to be implemented.");
+ }
+}
+
+
?>
\ No newline at end of file
diff --git a/app/lib/page/RPageStyle1.php b/app/lib/page/RPageStyle1.php
index 3a6f9a5..4b7851c 100644
--- a/app/lib/page/RPageStyle1.php
+++ b/app/lib/page/RPageStyle1.php
@@ -18,55 +18,68 @@
* @since 1.0
*/
import("@.RPage");
-class RPageStyle1 extends RPage {
- function __toString() {
- $pages = array();
- $pageNum = $this->length();
- $currPageNo = $this->current();
- $query = $this->query();
- $size = $this->size();
- $total = $this->total();
- $pageSetNum = $this->pageSetNum();
- $middlePageNum = ceil($pageSetNum/2);
- if ($pageNum > 0) {
- if ($currPageNo <= $middlePageNum) {
+class RPageStyle1 extends RPage
+{
+ function __toString()
+ {
+ $pages = array();
+ $pageNum = $this->length();
+ $currPageNo = $this->current();
+ $query = $this->query();
+ $size = $this->size();
+ $total = $this->total();
+ $pageSetNum = $this->pageSetNum();
+ $middlePageNum = ceil($pageSetNum / 2);
+ if ($pageNum > 0)
+ {
+ if ($currPageNo <= $middlePageNum)
+ {
$start = 1;
$end = min($pageNum, $pageSetNum);
}
- else if ($currPageNo + $middlePageNum - 1 > $pageNum) {
+ else if ($currPageNo + $middlePageNum - 1 > $pageNum)
+ {
$start = max(1, $pageNum - $pageSetNum - 1);
$end = $pageNum;
}
- else {
+ else
+ {
$start = max(1, $currPageNo - $middlePageNum);
$end = min($currPageNo + $middlePageNum - 1, $pageNum);
}
- if ($pageNum > 1) {
- $pages[] = "url(1) . "\" title=\"First Page\">« ";
+ if ($pageNum > 1)
+ {
+ $pages[] = "url(1) . "\" title=\"First Page\">« ";
}
- if ($currPageNo > 1) {
- $pages[] = "url($currPageNo - 1) . "\" title=\"Previous {$size}\">" . $this->message("pager_prev") . " ";
+ if ($currPageNo > 1)
+ {
+ $pages[] = "url($currPageNo - 1) . "\" title=\"Previous {$size}\">" . $this->message("pager_prev") . " ";
}
- for ($i = $start; $i <= $end; $i++) {
+ for ($i = $start; $i <= $end; $i++)
+ {
$_start = $size * ($i - 1) + 1;
$_end = min($size * $i, $total);
- if ($i != $currPageNo) {
+ if ($i != $currPageNo)
+ {
$pages[] = "url($i) . "\" title=\"Results {$_start} - {$_end}\">{$i}";
}
- else {
+ else
+ {
$pages[] = "url($i) . "\" title=\"Results {$_start} - {$_end}\">{$i}";
}
}
- if ($currPageNo < $pageNum) {
+ if ($currPageNo < $pageNum)
+ {
$pages[] = " url($currPageNo + 1) . "\" title=\"Next {$size}\">" . $this->message("pager_next") . "";
}
- if ($pageNum > 1) {
- $pages[] = "url($pageNum) . "\" title=\"Last Page\">» ";
+ if ($pageNum > 1)
+ {
+ $pages[] = "url($pageNum) . "\" title=\"Last Page\">» ";
}
}
-
- $string = implode(" ", $pages);
-
- return $string;
+
+ $string = implode(" ", $pages);
+
+ return $string;
}
}
\ No newline at end of file
diff --git a/app/lib/page/lang/de_de.php b/app/lib/page/lang/de_de.php
index d08c619..e3bc5f6 100644
--- a/app/lib/page/lang/de_de.php
+++ b/app/lib/page/lang/de_de.php
@@ -1,7 +1,7 @@
\ No newline at end of file
diff --git a/app/lib/page/lang/en.php b/app/lib/page/lang/en.php
index 221331a..5bd94b6 100644
--- a/app/lib/page/lang/en.php
+++ b/app/lib/page/lang/en.php
@@ -1,17 +1,17 @@
-
\ No newline at end of file
diff --git a/app/lib/page/lang/en_us.php b/app/lib/page/lang/en_us.php
index 221331a..5bd94b6 100644
--- a/app/lib/page/lang/en_us.php
+++ b/app/lib/page/lang/en_us.php
@@ -1,17 +1,17 @@
-
\ No newline at end of file
diff --git a/app/lib/page/lang/es_es.php b/app/lib/page/lang/es_es.php
index 061ed33..cded3cf 100644
--- a/app/lib/page/lang/es_es.php
+++ b/app/lib/page/lang/es_es.php
@@ -1,7 +1,7 @@
+
diff --git a/app/lib/page/lang/zh.php b/app/lib/page/lang/zh.php
index 2e69b21..9212376 100644
--- a/app/lib/page/lang/zh.php
+++ b/app/lib/page/lang/zh.php
@@ -1,17 +1,17 @@
-
\ No newline at end of file
diff --git a/app/lib/page/lang/zh_cn.php b/app/lib/page/lang/zh_cn.php
index 2e69b21..9212376 100644
--- a/app/lib/page/lang/zh_cn.php
+++ b/app/lib/page/lang/zh_cn.php
@@ -1,17 +1,17 @@
-
\ No newline at end of file
diff --git a/app/models/MCollection.php b/app/models/MCollection.php
index f31b637..ea6d50e 100644
--- a/app/models/MCollection.php
+++ b/app/models/MCollection.php
@@ -1,78 +1,95 @@
selectCollection($collection)->findOne();
- if (empty($one)) {
+ if (empty($one))
+ {
return array();
}
$fields = array();
self::_fieldsFromRow($fields, $one);
return $fields;
}
-
- private static function _fieldsFromRow(&$fields, $row, $prefix = null) {
- foreach ($row as $field => $value) {
- if (is_integer($field) || is_float($field)) {
+
+ private static function _fieldsFromRow(&$fields, $row, $prefix = null)
+ {
+ foreach ($row as $field => $value)
+ {
+ if (is_integer($field) || is_float($field))
+ {
continue;
}
$namespace = (is_null($prefix)) ? $field : $prefix . "." . $field;
$fields[] = $namespace;
- if (is_array($value)) {
+ if (is_array($value))
+ {
self::_fieldsFromRow($fields, $value, $namespace);
}
}
}
-
+
/**
* If a row is GridFS row
*
* @param array $row record data
+ *
* @return boolean
*/
- static function isFile(array $row) {
+ static function isFile(array $row)
+ {
return isset($row["filename"]) && isset($row["chunkSize"]);
}
-
+
/**
* get .chunks collection name from .files collection name
*
* @param string $filesCollection
+ *
* @return string
*/
- static function chunksCollection($filesCollection) {
+ static function chunksCollection($filesCollection)
+ {
return preg_replace("/\\.files$/", ".chunks", $filesCollection);
}
-
+
/**
* read collection information
*
* @param MongoDB $db database
- * @param string $collection collection name
+ * @param string $collection collection name
*/
- static function info(MongoDB $db, $collection) {
- $ret = $db->command(array( "collStats" => $collection ));
-
- if (!$ret["ok"]) {
+ static function info(MongoDB $db, $collection)
+ {
+ $ret = $db->command(array("collStats" => $collection));
+
+ if (!$ret["ok"])
+ {
exit("There is something wrong:{$ret['errmsg']}, please refresh the page to try again.");
}
- if (!isset($ret["retval"]["options"])) {
+ if (!isset($ret["retval"]["options"]))
+ {
$ret["retval"]["options"] = array();
}
$isCapped = 0;
$size = 0;
$max = 0;
$options = $ret["retval"]["options"];
- if (isset($options["capped"])) {
+ if (isset($options["capped"]))
+ {
$isCapped = $options["capped"];
}
- if (isset($options["size"])) {
+ if (isset($options["size"]))
+ {
$size = $options["size"];
}
- if (isset($options["max"])) {
+ if (isset($options["max"]))
+ {
$max = $options["max"];
}
- return array( "capped" => $isCapped, "size" => $size, "max" => $max );
+ return array("capped" => $isCapped, "size" => $size, "max" => $max);
}
}
diff --git a/app/models/MDb.php b/app/models/MDb.php
index 1f21b1c..c65255f 100644
--- a/app/models/MDb.php
+++ b/app/models/MDb.php
@@ -1,64 +1,82 @@
execute($code, $params);
- if (!$query["ok"]) {
+ if (!$query["ok"])
+ {
exit("Execute failed:" . $query["errmsg"] . "" . $code . ""); } return $query["retval"]; } - + /** * List collections in a DB - * + * * @param MongoDB $db DB + * * @return array
=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l =0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l ";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q =0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f
0)for(var j=d;j 0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e -1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"+d+">"},F={option:[1,""],legend:[1,""],thead:[1," ","
"],tr:[2,"","
"],td:[3,""],col:[2,"
"," "],area:[1,""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
"," ",""];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e 0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===" "&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/ - + + diff --git a/themes/default/views/admin/index.php b/themes/default/views/admin/index.php index 494027d..8925fd9 100644 --- a/themes/default/views/admin/index.php +++ b/themes/default/views/admin/index.php @@ -1,116 +1,74 @@ - -
RockMongo - - - + +RockMongo + + + - - - - - - - - -- --- - --- - -- -- -- - - - - + \ No newline at end of file diff --git a/themes/default/views/admin/top.php b/themes/default/views/admin/top.php index 854bba1..509faf9 100644 --- a/themes/default/views/admin/top.php +++ b/themes/default/views/admin/top.php @@ -1,25 +1,10 @@ - --- - | ▼ | " target="right" title="">" target="right" title=""> ++\ No newline at end of file diff --git a/themes/default/views/collection/collectionDuplicate.php b/themes/default/views/collection/collectionDuplicate.php index 07757ef..61e19c3 100644 --- a/themes/default/views/collection/collectionDuplicate.php +++ b/themes/default/views/collection/collectionDuplicate.php @@ -1,27 +1,27 @@ -+-| ▼ | | "width:100px", "onchange" => "window.top.location='index.php?action=admin.changeLang&lang='+this.value" )); ?> | " target="right">RockMongo v- +»
+»
- -- + +
+
- - - - - - - \ No newline at end of file diff --git a/themes/default/views/collection/collectionIndexes.php b/themes/default/views/collection/collectionIndexes.php index 272d3ba..c59df93 100644 --- a/themes/default/views/collection/collectionIndexes.php +++ b/themes/default/views/collection/collectionIndexes.php @@ -1,31 +1,28 @@ -» [">]
+» + [">]
- + --
- + »
+»
- -- + +
+
- - - - + - - \ No newline at end of file + \ No newline at end of file diff --git a/themes/default/views/collection/collectionRename.php b/themes/default/views/collection/collectionRename.php index 87d9507..754b833 100644 --- a/themes/default/views/collection/collectionRename.php +++ b/themes/default/views/collection/collectionRename.php @@ -1,36 +1,36 @@ -»
+»
- - - - - - + + + + + + - - + -- -++ +- - - + + + \ No newline at end of file diff --git a/themes/default/views/collection/collectionStats.php b/themes/default/views/collection/collectionStats.php index 0437b25..b7d8c25 100644 --- a/themes/default/views/collection/collectionStats.php +++ b/themes/default/views/collection/collectionStats.php @@ -1,36 +1,40 @@ -» [">]
+» + [">]
--
- db..stats() ++
diff --git a/themes/default/views/collection/collectionValidate.php b/themes/default/views/collection/collectionValidate.php index a5fa540..a343173 100644 --- a/themes/default/views/collection/collectionValidate.php +++ b/themes/default/views/collection/collectionValidate.php @@ -1,8 +1,8 @@ -+ - $stat):?> -db..stats() - - " . var_export($stat, true) . ""); + $stat): ?> + + - - -+ " . var_export($stat, true) . ""); } - else { - if (in_array($name, array( "size", "storageSize", "lastExtentSize", "totalIndexSize" ))) { - $stat = round($stat/1024/1024, 2) . "m"; + else + { + if (in_array($name, array("size", "storageSize", "lastExtentSize", "totalIndexSize"))) + { + $stat = round($stat / 1024 / 1024, 2) . "m"; } h($stat); } ?> - {top:1} + + ++ - $stat):?> -{top:1} - - $stat): ?> + + - - + ++ »
+»
-- -++ +diff --git a/themes/default/views/collection/createIndex.php b/themes/default/views/collection/createIndex.php index 2b036f6..5bb42ed 100644 --- a/themes/default/views/collection/createIndex.php +++ b/themes/default/views/collection/createIndex.php @@ -1,67 +1,78 @@ - - - + + + - -» $db, - "collection" => $collection - ))); - ?>"> »
- - - +» $db, "collection" => $collection))); +?>"> »
+ + + - - \ No newline at end of file diff --git a/themes/default/views/collection/createRow.php b/themes/default/views/collection/createRow.php index e8418a4..1bbeb6c 100644 --- a/themes/default/views/collection/createRow.php +++ b/themes/default/views/collection/createRow.php @@ -1,38 +1,40 @@ - -»
+»
- - + + - - + + - \ No newline at end of file diff --git a/themes/default/views/collection/explainQuery.php b/themes/default/views/collection/explainQuery.php index 3d311bc..f510442 100644 --- a/themes/default/views/collection/explainQuery.php +++ b/themes/default/views/collection/explainQuery.php @@ -1,12 +1,12 @@ - - - + + + - -- -+ ++ +- \ No newline at end of file + \ No newline at end of file diff --git a/themes/default/views/collection/index.php b/themes/default/views/collection/index.php index 235c8f9..6fa67d6 100644 --- a/themes/default/views/collection/index.php +++ b/themes/default/views/collection/index.php @@ -1,408 +1,492 @@ - - - - - + + + + - + -- [style="text-decoration:underline">Array|style="text-decoration:underline">JSON] | History | - "> | ++ [style="text-decoration:underline">Array|style="text-decoration:underline">JSON + ] | History + | + "> |-- +-- total() == 0):?> - -rows may be affected.
- -No records is found.
- ++ total() == 0): ?> + +rows may be affected.
+ +No records is found.
+ -(total(), $page->offset()+$page->size()));?>/total());?>)
- - - $row):?> --