Merge branch 'master' into routing

Conflicts:
	apps/contacts/js/contacts.js
	apps/contacts/lib/search.php
	apps/files_archive/js/archive.js
	apps/gallery/lib/tiles.php
	apps/gallery/templates/index.php
	lib/ocs.php
This commit is contained in:
Bart Visscher 2012-08-30 21:49:28 +02:00
commit b483f2aab8
1916 changed files with 16808 additions and 304209 deletions

View File

@ -1,182 +0,0 @@
[main]
host = https://www.transifex.net
[owncloud.core]
file_filter = l10n/<lang>/core.po
host = http://www.transifex.net
source_file = l10n/templates/core.pot
source_lang = en
trans.bg_BG = l10n/bg_BG/core.po
trans.ca = l10n/ca/core.po
trans.cs_CZ = l10n/cs_CZ/core.po
trans.da = l10n/da/core.po
trans.de = l10n/de/core.po
trans.el = l10n/el/core.po
trans.es = l10n/es/core.po
trans.et_EE = l10n/et_EE/core.po
trans.fr = l10n/fr/core.po
trans.id = l10n/id/core.po
trans.it = l10n/it/core.po
trans.lb = l10n/lb/core.po
trans.ms_MY = l10n/ms_MY/core.po
trans.nb_NO = l10n/nb_NO/core.po
trans.nl = l10n/nl/core.po
trans.pl = l10n/pl/core.po
trans.pt_BR = l10n/pt_BR/core.po
trans.pt_PT = l10n/pt_PT/core.po
trans.ro = l10n/ro/core.po
trans.ru = l10n/ru/core.po
trans.sr = l10n/sr/core.po
trans.sr@latin = l10n/sr@latin/core.po
trans.sv = l10n/sv/core.po
trans.zh_CN = l10n/zh_CN/core.po
[owncloud.settings]
file_filter = l10n/<lang>/settings.po
host = http://www.transifex.net
source_file = l10n/templates/settings.pot
source_lang = en
trans.bg_BG = l10n/bg_BG/settings.po
trans.ca = l10n/ca/settings.po
trans.cs_CZ = l10n/cs_CZ/settings.po
trans.da = l10n/da/settings.po
trans.de = l10n/de/settings.po
trans.el = l10n/el/settings.po
trans.es = l10n/es/settings.po
trans.et_EE = l10n/et_EE/settings.po
trans.fr = l10n/fr/settings.po
trans.id = l10n/id/settings.po
trans.it = l10n/it/settings.po
trans.lb = l10n/lb/settings.po
trans.ms_MY = l10n/ms_MY/settings.po
trans.nb_NO = l10n/nb_NO/settings.po
trans.nl = l10n/nl/settings.po
trans.pl = l10n/pl/settings.po
trans.pt_BR = l10n/pt_BR/settings.po
trans.pt_PT = l10n/pt_PT/settings.po
trans.ro = l10n/ro/settings.po
trans.ru = l10n/ru/settings.po
trans.sr = l10n/sr/settings.po
trans.sr@latin = l10n/sr@latin/settings.po
trans.sv = l10n/sv/settings.po
trans.zh_CN = l10n/zh_CN/settings.po
[owncloud.files]
file_filter = translations/owncloud.files/<lang>.po
host = http://www.transifex.net
source_file = l10n/templates/files.pot
source_lang = en
trans.bg_BG = l10n/bg_BG/files.po
trans.ca = l10n/ca/files.po
trans.cs_CZ = l10n/cs_CZ/files.po
trans.da = l10n/da/files.po
trans.de = l10n/de/files.po
trans.el = l10n/el/files.po
trans.es = l10n/es/files.po
trans.et_EE = l10n/et_EE/files.po
trans.fr = l10n/fr/files.po
trans.id = l10n/id/files.po
trans.it = l10n/it/files.po
trans.lb = l10n/lb/files.po
trans.ms_MY = l10n/ms_MY/files.po
trans.nb_NO = l10n/nb_NO/files.po
trans.nl = l10n/nl/files.po
trans.pl = l10n/pl/files.po
trans.pt_BR = l10n/pt_BR/files.po
trans.pt_PT = l10n/pt_PT/files.po
trans.ro = l10n/ro/files.po
trans.ru = l10n/ru/files.po
trans.sr = l10n/sr/files.po
trans.sr@latin = l10n/sr@latin/files.po
trans.sv = l10n/sv/files.po
trans.zh_CN = l10n/zh_CN/files.po
[owncloud.media]
file_filter = translations/owncloud.media/<lang>.po
host = http://www.transifex.net
source_file = l10n/templates/media.pot
source_lang = en
trans.bg_BG = l10n/bg_BG/media.po
trans.ca = l10n/ca/media.po
trans.cs_CZ = l10n/cs_CZ/media.po
trans.da = l10n/da/media.po
trans.de = l10n/de/media.po
trans.el = l10n/el/media.po
trans.es = l10n/es/media.po
trans.et_EE = l10n/et_EE/media.po
trans.fr = l10n/fr/media.po
trans.id = l10n/id/media.po
trans.it = l10n/it/media.po
trans.lb = l10n/lb/media.po
trans.ms_MY = l10n/ms_MY/media.po
trans.nb_NO = l10n/nb_NO/media.po
trans.nl = l10n/nl/media.po
trans.pl = l10n/pl/media.po
trans.pt_BR = l10n/pt_BR/media.po
trans.pt_PT = l10n/pt_PT/media.po
trans.ro = l10n/ro/media.po
trans.ru = l10n/ru/media.po
trans.sr = l10n/sr/media.po
trans.sr@latin = l10n/sr@latin/media.po
trans.sv = l10n/sv/media.po
trans.zh_CN = l10n/zh_CN/media.po
[owncloud.calendar]
file_filter = l10n/<lang>/calendar.po
host = http://www.transifex.net
source_file = l10n/templates/calendar.pot
source_lang = en
trans.bg_BG = l10n/bg_BG/calendar.po
trans.ca = l10n/ca/calendar.po
trans.cs_CZ = l10n/cs_CZ/calendar.po
trans.da = l10n/da/calendar.po
trans.de = l10n/de/calendar.po
trans.el = l10n/el/calendar.po
trans.es = l10n/es/calendar.po
trans.et_EE = l10n/et_EE/calendar.po
trans.fr = l10n/fr/calendar.po
trans.id = l10n/id/calendar.po
trans.it = l10n/it/calendar.po
trans.lb = l10n/lb/calendar.po
trans.ms_MY = l10n/ms_MY/calendar.po
trans.nb_NO = l10n/nb_NO/calendar.po
trans.nl = l10n/nl/calendar.po
trans.pl = l10n/pl/calendar.po
trans.pt_BR = l10n/pt_BR/calendar.po
trans.pt_PT = l10n/pt_PT/calendar.po
trans.ro = l10n/ro/calendar.po
trans.ru = l10n/ru/calendar.po
trans.sr = l10n/sr/calendar.po
trans.sr@latin = l10n/sr@latin/calendar.po
trans.sv = l10n/sv/calendar.po
trans.zh_CN = l10n/zh_CN/calendar.po
[owncloud.contacts]
file_filter = translations/owncloud.contacts/<lang>.po
host = http://www.transifex.net
source_file = l10n/templates/contacts.pot
source_lang = en
trans.bg_BG = l10n/bg_BG/contacts.po
trans.ca = l10n/ca/contacts.po
trans.cs_CZ = l10n/cs_CZ/contacts.po
trans.da = l10n/da/contacts.po
trans.de = l10n/de/contacts.po
trans.el = l10n/el/contacts.po
trans.es = l10n/es/contacts.po
trans.et_EE = l10n/et_EE/contacts.po
trans.fr = l10n/fr/contacts.po
trans.id = l10n/id/contacts.po
trans.it = l10n/it/contacts.po
trans.lb = l10n/lb/contacts.po
trans.ms_MY = l10n/ms_MY/contacts.po
trans.nb_NO = l10n/nb_NO/contacts.po
trans.nl = l10n/nl/contacts.po
trans.pl = l10n/pl/contacts.po
trans.pt_BR = l10n/pt_BR/contacts.po
trans.pt_PT = l10n/pt_PT/contacts.po
trans.ro = l10n/ro/contacts.po
trans.ru = l10n/ru/contacts.po
trans.sr = l10n/sr/contacts.po
trans.sr@latin = l10n/sr@latin/contacts.po
trans.sv = l10n/sv/contacts.po
trans.zh_CN = l10n/zh_CN/contacts.po

View File

@ -1412,7 +1412,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
if (PEAR::isError($db)) {
return $db;
}
if (isset($db->function) && is_object($this->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
if (isset($db->function) && is_object($db->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
return $db->function->now('timestamp');
}
return 'CURRENT_TIMESTAMP';

View File

@ -80,7 +80,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
protected $start_transaction = false;
protected $varchar_max_length = 255;
public $varchar_max_length = 255;
// }}}
// {{{ constructor

View File

@ -0,0 +1,29 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**
* Include this in any file to start coverage, coverage will automatically end
* when process dies.
*/
require_once(dirname(__FILE__) .'/coverage.php');
if (CodeCoverage::isCoverageOn()) {
$coverage = CodeCoverage::getInstance();
$coverage->startCoverage();
register_shutdown_function("stop_coverage");
}
function stop_coverage() {
# hack until i can think of a way to run tests first and w/o exiting
$autorun = function_exists("run_local_tests");
if ($autorun) {
$result = run_local_tests();
}
CodeCoverage::getInstance()->stopCoverage();
if ($autorun) {
exit($result ? 0 : 1);
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
/**
* Close code coverage data collection, next step is to generate report
* @package SimpleTest
* @subpackage Extensions
*/
/**
* include coverage files
*/
require_once(dirname(__FILE__) . '/../coverage.php');
$cc = CodeCoverage::getInstance();
$cc->readSettings();
$cc->writeUntouched();
?>

View File

@ -0,0 +1,31 @@
<?php
/**
* Initialize code coverage data collection, next step is to run your tests
* with ini setting auto_prepend_file=autocoverage.php ...
*
* @package SimpleTest
* @subpackage Extensions
*/
# optional arguments:
# --include=<some filepath regexp> these files should be included coverage report
# --exclude=<come filepath regexp> these files should not be included in coverage report
# --maxdepth=2 when considering which file were not touched, scan directories
#
# Example:
# php-coverage-open.php --include='.*\.php$' --include='.*\.inc$' --exclude='.*/tests/.*'
/**#@+
* include coverage files
*/
require_once(dirname(__FILE__) . '/../coverage_utils.php');
CoverageUtils::requireSqlite();
require_once(dirname(__FILE__) . '/../coverage.php');
/**#@-*/
$cc = new CodeCoverage();
$cc->log = 'coverage.sqlite';
$args = CoverageUtils::parseArguments($_SERVER['argv'], TRUE);
$cc->includes = CoverageUtils::issetOr($args['include[]'], array('.*\.php$'));
$cc->excludes = CoverageUtils::issetOr($args['exclude[]']);
$cc->maxDirectoryDepth = (int)CoverageUtils::issetOr($args['maxdepth'], '1');
$cc->resetLog();
$cc->writeSettings();
?>

View File

@ -0,0 +1,29 @@
<?php
/**
* Generate a code coverage report
*
* @package SimpleTest
* @subpackage Extensions
*/
# optional arguments:
# --reportDir=some/directory the default is ./coverage-report
# --title='My Coverage Report' title the main page of your report
/**#@+
* include coverage files
*/
require_once(dirname(__FILE__) . '/../coverage_utils.php');
require_once(dirname(__FILE__) . '/../coverage.php');
require_once(dirname(__FILE__) . '/../coverage_reporter.php');
/**#@-*/
$cc = CodeCoverage::getInstance();
$cc->readSettings();
$handler = new CoverageDataHandler($cc->log);
$report = new CoverageReporter();
$args = CoverageUtils::parseArguments($_SERVER['argv']);
$report->reportDir = CoverageUtils::issetOr($args['reportDir'], 'coverage-report');
$report->title = CoverageUtils::issetOr($args['title'], "Simpletest Coverage");
$report->coverage = $handler->read();
$report->untouched = $handler->readUntouchedFiles();
$report->generate();
?>

View File

@ -0,0 +1,196 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**
* load coverage data handle
*/
require_once dirname(__FILE__) . '/coverage_data_handler.php';
/**
* Orchestrates code coverage both in this thread and in subthread under apache
* Assumes this is running on same machine as apache.
* @package SimpleTest
* @subpackage Extensions
*/
class CodeCoverage {
var $log;
var $root;
var $includes;
var $excludes;
var $directoryDepth;
var $maxDirectoryDepth = 20; // reasonable, otherwise arbitrary
var $title = "Code Coverage";
# NOTE: This assumes all code shares the same current working directory.
var $settingsFile = './code-coverage-settings.dat';
static $instance;
function writeUntouched() {
$touched = array_flip($this->getTouchedFiles());
$untouched = array();
$this->getUntouchedFiles($untouched, $touched, '.', '.');
$this->includeUntouchedFiles($untouched);
}
function &getTouchedFiles() {
$handler = new CoverageDataHandler($this->log);
$touched = $handler->getFilenames();
return $touched;
}
function includeUntouchedFiles($untouched) {
$handler = new CoverageDataHandler($this->log);
foreach ($untouched as $file) {
$handler->writeUntouchedFile($file);
}
}
function getUntouchedFiles(&$untouched, $touched, $parentPath, $rootPath, $directoryDepth = 1) {
$parent = opendir($parentPath);
while ($file = readdir($parent)) {
$path = "$parentPath/$file";
if (is_dir($path)) {
if ($file != '.' && $file != '..') {
if ($this->isDirectoryIncluded($path, $directoryDepth)) {
$this->getUntouchedFiles($untouched, $touched, $path, $rootPath, $directoryDepth + 1);
}
}
}
else if ($this->isFileIncluded($path)) {
$relativePath = CoverageDataHandler::ltrim($rootPath .'/', $path);
if (!array_key_exists($relativePath, $touched)) {
$untouched[] = $relativePath;
}
}
}
closedir($parent);
}
function resetLog() {
error_log('reseting log');
$new_file = fopen($this->log, "w");
if (!$new_file) {
throw new Exception("Could not create ". $this->log);
}
fclose($new_file);
if (!chmod($this->log, 0666)) {
throw new Exception("Could not change ownership on file ". $this->log);
}
$handler = new CoverageDataHandler($this->log);
$handler->createSchema();
}
function startCoverage() {
$this->root = getcwd();
if(!extension_loaded("xdebug")) {
throw new Exception("Could not load xdebug extension");
};
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
}
function stopCoverage() {
$cov = xdebug_get_code_coverage();
$this->filter($cov);
$data = new CoverageDataHandler($this->log);
chdir($this->root);
$data->write($cov);
unset($data); // release sqlite connection
xdebug_stop_code_coverage();
// make sure we wind up on same current working directory, otherwise
// coverage handler writer doesn't know what directory to chop off
chdir($this->root);
}
function readSettings() {
if (file_exists($this->settingsFile)) {
$this->setSettings(file_get_contents($this->settingsFile));
} else {
error_log("could not find file ". $this->settingsFile);
}
}
function writeSettings() {
file_put_contents($this->settingsFile, $this->getSettings());
}
function getSettings() {
$data = array(
'log' => realpath($this->log),
'includes' => $this->includes,
'excludes' => $this->excludes);
return serialize($data);
}
function setSettings($settings) {
$data = unserialize($settings);
$this->log = $data['log'];
$this->includes = $data['includes'];
$this->excludes = $data['excludes'];
}
function filter(&$coverage) {
foreach ($coverage as $file => $line) {
if (!$this->isFileIncluded($file)) {
unset($coverage[$file]);
}
}
}
function isFileIncluded($file) {
if (!empty($this->excludes)) {
foreach ($this->excludes as $path) {
if (preg_match('|' . $path . '|', $file)) {
return False;
}
}
}
if (!empty($this->includes)) {
foreach ($this->includes as $path) {
if (preg_match('|' . $path . '|', $file)) {
return True;
}
}
return False;
}
return True;
}
function isDirectoryIncluded($dir, $directoryDepth) {
if ($directoryDepth >= $this->maxDirectoryDepth) {
return false;
}
if (isset($this->excludes)) {
foreach ($this->excludes as $path) {
if (preg_match('|' . $path . '|', $dir)) {
return False;
}
}
}
return True;
}
static function isCoverageOn() {
$coverage = self::getInstance();
$coverage->readSettings();
if (empty($coverage->log) || !file_exists($coverage->log)) {
trigger_error('No coverage log');
return False;
}
return True;
}
static function getInstance() {
if (self::$instance == NULL) {
self::$instance = new CodeCoverage();
self::$instance->readSettings();
}
return self::$instance;
}
}
?>

View File

@ -0,0 +1,98 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**
* @package SimpleTest
* @subpackage Extensions
*/
class CoverageCalculator {
function coverageByFileVariables($file, $coverage) {
$hnd = fopen($file, 'r');
if ($hnd == null) {
throw new Exception("File $file is missing");
}
$lines = array();
for ($i = 1; !feof($hnd); $i++) {
$line = fgets($hnd);
$lineCoverage = $this->lineCoverageCodeToStyleClass($coverage, $i);
$lines[$i] = array('lineCoverage' => $lineCoverage, 'code' => $line);
}
fclose($hnd);
$var = compact('file', 'lines', 'coverage');
return $var;
}
function lineCoverageCodeToStyleClass($coverage, $line) {
if (!array_key_exists($line, $coverage)) {
return "comment";
}
$code = $coverage[$line];
if (empty($code)) {
return "comment";
}
switch ($code) {
case -1:
return "missed";
case -2:
return "dead";
}
return "covered";
}
function totalLoc($total, $coverage) {
return $total + sizeof($coverage);
}
function lineCoverage($total, $line) {
# NOTE: counting dead code as covered, as it's almost always an executable line
# strange artifact of xdebug or underlying system
return $total + ($line > 0 || $line == -2 ? 1 : 0);
}
function totalCoverage($total, $coverage) {
return $total + array_reduce($coverage, array(&$this, "lineCoverage"));
}
static function reportFilename($filename) {
return preg_replace('|[/\\\\]|', '_', $filename) . '.html';
}
function percentCoverageByFile($coverage, $file, &$results) {
$byFileReport = self::reportFilename($file);
$loc = sizeof($coverage);
if ($loc == 0)
return 0;
$lineCoverage = array_reduce($coverage, array(&$this, "lineCoverage"));
$percentage = 100 * ($lineCoverage / $loc);
$results[0][$file] = array('byFileReport' => $byFileReport, 'percentage' => $percentage);
}
function variables($coverage, $untouched) {
$coverageByFile = array();
array_walk($coverage, array(&$this, "percentCoverageByFile"), array(&$coverageByFile));
$totalLoc = array_reduce($coverage, array(&$this, "totalLoc"));
if ($totalLoc > 0) {
$totalLinesOfCoverage = array_reduce($coverage, array(&$this, "totalCoverage"));
$totalPercentCoverage = 100 * ($totalLinesOfCoverage / $totalLoc);
}
$untouchedPercentageDenominator = sizeof($coverage) + sizeof($untouched);
if ($untouchedPercentageDenominator > 0) {
$filesTouchedPercentage = 100 * sizeof($coverage) / $untouchedPercentageDenominator;
}
$var = compact('coverageByFile', 'totalPercentCoverage', 'totalLoc', 'totalLinesOfCoverage', 'filesTouchedPercentage');
$var['untouched'] = $untouched;
return $var;
}
}
?>

View File

@ -0,0 +1,125 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**
* @todo which db abstraction layer is this?
*/
require_once 'DB/sqlite.php';
/**
* Persists code coverage data into SQLite database and aggregate data for convienent
* interpretation in report generator. Be sure to not to keep an instance longer
* than you have, otherwise you risk overwriting database edits from another process
* also trying to make updates.
* @package SimpleTest
* @subpackage Extensions
*/
class CoverageDataHandler {
var $db;
function __construct($filename) {
$this->filename = $filename;
$this->db = new SQLiteDatabase($filename);
if (empty($this->db)) {
throw new Exception("Could not create sqlite db ". $filename);
}
}
function createSchema() {
$this->db->queryExec("create table untouched (filename text)");
$this->db->queryExec("create table coverage (name text, coverage text)");
}
function &getFilenames() {
$filenames = array();
$cursor = $this->db->unbufferedQuery("select distinct name from coverage");
while ($row = $cursor->fetch()) {
$filenames[] = $row[0];
}
return $filenames;
}
function write($coverage) {
foreach ($coverage as $file => $lines) {
$coverageStr = serialize($lines);
$relativeFilename = self::ltrim(getcwd() . '/', $file);
$sql = "insert into coverage (name, coverage) values ('$relativeFilename', '$coverageStr')";
# if this fails, check you have write permission
$this->db->queryExec($sql);
}
}
function read() {
$coverage = array_flip($this->getFilenames());
foreach($coverage as $file => $garbage) {
$coverage[$file] = $this->readFile($file);
}
return $coverage;
}
function &readFile($file) {
$sql = "select coverage from coverage where name = '$file'";
$aggregate = array();
$result = $this->db->query($sql);
while ($result->valid()) {
$row = $result->current();
$this->aggregateCoverage($aggregate, unserialize($row[0]));
$result->next();
}
return $aggregate;
}
function aggregateCoverage(&$total, $next) {
foreach ($next as $lineno => $code) {
if (!isset($total[$lineno])) {
$total[$lineno] = $code;
} else {
$total[$lineno] = $this->aggregateCoverageCode($total[$lineno], $code);
}
}
}
function aggregateCoverageCode($code1, $code2) {
switch($code1) {
case -2: return -2;
case -1: return $code2;
default:
switch ($code2) {
case -2: return -2;
case -1: return $code1;
}
}
return $code1 + $code2;
}
static function ltrim($cruft, $pristine) {
if(stripos($pristine, $cruft) === 0) {
return substr($pristine, strlen($cruft));
}
return $pristine;
}
function writeUntouchedFile($file) {
$relativeFile = CoverageDataHandler::ltrim('./', $file);
$sql = "insert into untouched values ('$relativeFile')";
$this->db->queryExec($sql);
}
function &readUntouchedFiles() {
$untouched = array();
$result = $this->db->query("select filename from untouched order by filename");
while ($result->valid()) {
$row = $result->current();
$untouched[] = $row[0];
$result->next();
}
return $untouched;
}
}
?>

View File

@ -0,0 +1,68 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**#@+
* include additional coverage files
*/
require_once dirname(__FILE__) .'/coverage_calculator.php';
require_once dirname(__FILE__) .'/coverage_utils.php';
require_once dirname(__FILE__) .'/simple_coverage_writer.php';
/**#@-*/
/**
* Take aggregated coverage data and generate reports from it using smarty
* templates
* @package SimpleTest
* @subpackage Extensions
*/
class CoverageReporter {
var $coverage;
var $untouched;
var $reportDir;
var $title = 'Coverage';
var $writer;
var $calculator;
function __construct() {
$this->writer = new SimpleCoverageWriter();
$this->calculator = new CoverageCalculator();
}
function generateSummaryReport($out) {
$variables = $this->calculator->variables($this->coverage, $this->untouched);
$variables['title'] = $this->title;
$report = $this->writer->writeSummary($out, $variables);
fwrite($out, $report);
}
function generate() {
CoverageUtils::mkdir($this->reportDir);
$index = $this->reportDir .'/index.html';
$hnd = fopen($index, 'w');
$this->generateSummaryReport($hnd);
fclose($hnd);
foreach ($this->coverage as $file => $cov) {
$byFile = $this->reportDir .'/'. self::reportFilename($file);
$byFileHnd = fopen($byFile, 'w');
$this->generateCoverageByFile($byFileHnd, $file, $cov);
fclose($byFileHnd);
}
echo "generated report $index\n";
}
function generateCoverageByFile($out, $file, $cov) {
$variables = $this->calculator->coverageByFileVariables($file, $cov);
$variables['title'] = $this->title .' - '. $file;
$this->writer->writeByFile($out, $variables);
}
static function reportFilename($filename) {
return preg_replace('|[/\\\\]|', '_', $filename) . '.html';
}
}
?>

View File

@ -0,0 +1,114 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**
* @package SimpleTest
* @subpackage Extensions
*/
class CoverageUtils {
static function mkdir($dir) {
if (!file_exists($dir)) {
mkdir($dir, 0777, True);
} else {
if (!is_dir($dir)) {
throw new Exception($dir .' exists as a file, not a directory');
}
}
}
static function requireSqlite() {
if (!self::isPackageClassAvailable('DB/sqlite.php', 'SQLiteDatabase')) {
echo "sqlite library is required to be installed and available in include_path";
exit(1);
}
}
static function isPackageClassAvailable($includeFile, $class) {
@include_once($includeFile);
return class_exists($class);
}
/**
* Parses simple parameters from CLI.
*
* Puts trailing parameters into string array in 'extraArguments'
*
* Example:
* $args = CoverageUtil::parseArguments($_SERVER['argv']);
* if ($args['verbose']) echo "Verbose Mode On\n";
* $files = $args['extraArguments'];
*
* Example CLI:
* --foo=blah -x -h some trailing arguments
*
* if multiValueMode is true
* Example CLI:
* --include=a --include=b --exclude=c
* Then
* $args = CoverageUtil::parseArguments($_SERVER['argv']);
* $args['include[]'] will equal array('a', 'b')
* $args['exclude[]'] will equal array('c')
* $args['exclude'] will equal c
* $args['include'] will equal b NOTE: only keeps last value
*
* @param unknown_type $argv
* @param supportMutliValue - will store 2nd copy of value in an array with key "foo[]"
* @return unknown
*/
static public function parseArguments($argv, $mutliValueMode = False) {
$args = array();
$args['extraArguments'] = array();
array_shift($argv); // scriptname
foreach ($argv as $arg) {
if (ereg('^--([^=]+)=(.*)', $arg, $reg)) {
$args[$reg[1]] = $reg[2];
if ($mutliValueMode) {
self::addItemAsArray($args, $reg[1], $reg[2]);
}
} elseif (ereg('^[-]{1,2}([^[:blank:]]+)', $arg, $reg)) {
$nonnull = '';
$args[$reg[1]] = $nonnull;
if ($mutliValueMode) {
self::addItemAsArray($args, $reg[1], $nonnull);
}
} else {
$args['extraArguments'][] = $arg;
}
}
return $args;
}
/**
* Adds a value as an array of one, or appends to an existing array elements
*
* @param unknown_type $array
* @param unknown_type $item
*/
static function addItemAsArray(&$array, $key, $item) {
$array_key = $key .'[]';
if (array_key_exists($array_key, $array)) {
$array[$array_key][] = $item;
} else {
$array[$array_key] = array($item);
}
}
/**
* isset function with default value
*
* Example: $z = CoverageUtils::issetOr($array[$key], 'no value given')
*
* @param unknown_type $val
* @param unknown_type $default
* @return first value unless value is not set then returns 2nd arg or null if no 2nd arg
*/
static public function issetOr(&$val, $default = null)
{
return isset($val) ? $val : $default;
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
/**
* @package SimpleTest
* @subpackage Extensions
*/
/**
* @package SimpleTest
* @subpackage Extensions
*/
interface CoverageWriter {
function writeSummary($out, $variables);
function writeByFile($out, $variables);
}
?>

View File

@ -0,0 +1,39 @@
<?php
/**
* SimpleCoverageWriter class file
* @package SimpleTest
* @subpackage UnitTester
* @version $Id: unit_tester.php 1882 2009-07-01 14:30:05Z lastcraft $
*/
/**
* base coverage writer class
*/
require_once dirname(__FILE__) .'/coverage_writer.php';
/**
* SimpleCoverageWriter class
* @package SimpleTest
* @subpackage UnitTester
*/
class SimpleCoverageWriter implements CoverageWriter {
function writeSummary($out, $variables) {
extract($variables);
$now = date("F j, Y, g:i a");
ob_start();
include dirname(__FILE__) . '/templates/index.php';
$contents = ob_get_contents();
fwrite ($out, $contents);
ob_end_clean();
}
function writeByFile($out, $variables) {
extract($variables);
ob_start();
include dirname(__FILE__) . '/templates/file.php';
$contents = ob_get_contents();
fwrite ($out, $contents);
ob_end_clean();
}
}
?>

View File

@ -0,0 +1,60 @@
<html>
<head>
<title><?php echo $title ?></title>
</head>
<style type="text/css">
body {
font-family: "Gill Sans MT", "Gill Sans", GillSans, Arial, Helvetica, sans-serif;
}
h1 {
font-size: medium;
}
#code {
border-spacing: 0;
}
.lineNo {
color: #ccc;
}
.code, .lineNo {
white-space: pre;
font-family: monospace;
}
.covered {
color: #090;
}
.missed {
color: #f00;
}
.dead {
color: #00f;
}
.comment {
color: #333;
}
</style>
<body>
<h1 id="title"><?php echo $title ?></h1>
<table id="code">
<tbody>
<?php foreach ($lines as $lineNo => $line) { ?>
<tr>
<td><span class="lineNo"><?php echo $lineNo ?></span></td>
<td><span class="<?php echo $line['lineCoverage'] ?> code"><?php echo htmlentities($line['code']) ?></span></td>
</tr>
<?php } ?>
</tbody>
</table>
<h2>Legend</h2>
<dl>
<dt><span class="missed">Missed</span></dt>
<dd>lines code that <strong>were not</strong> excersized during program execution.</dd>
<dt><span class="covered">Covered</span></dt>
<dd>lines code <strong>were</strong> excersized during program execution.</dd>
<dt><span class="comment">Comment/non executable</span></dt>
<dd>Comment or non-executable line of code.</dd>
<dt><span class="dead">Dead</span></dt>
<dd>lines of code that according to xdebug could not be executed. This is counted as coverage code because
in almost all cases it is code that runnable.</dd>
</dl>
</body>
</html>

View File

@ -0,0 +1,106 @@
<html>
<head>
<title><?php echo $title ?></title>
</head>
<style type="text/css">
h1 {
font-size: medium;
}
body {
font-family: "Gill Sans MT", "Gill Sans", GillSans, Arial, Helvetica,
sans-serif;
}
td.percentage {
text-align: right;
}
caption {
border-bottom: thin solid;
font-weight: bolder;
}
dt {
font-weight: bolder;
}
table {
margin: 1em;
}
</style>
<body>
<h1 id="title"><?php echo $title ?></h1>
<table>
<caption>Summary</caption>
<tbody>
<tr>
<td>Total Coverage (<a href="#total-coverage">?</a>) :</td>
<td class="percentage"><span class="totalPercentCoverage"><?php echo number_format($totalPercentCoverage, 0) ?>%</span></td>
</tr>
<tr>
<td>Total Files Covered (<a href="#total-files-covered">?</a>) :</td>
<td class="percentage"><span class="filesTouchedPercentage"><?php echo number_format($filesTouchedPercentage, 0) ?>%</span></td>
</tr>
<tr>
<td>Report Generation Date :</td>
<td><?php echo $now ?></td>
</tr>
</tbody>
</table>
<table id="covered-files">
<caption>Coverage (<a href="#coverage">?</a>)</caption>
<thead>
<tr>
<th>File</th>
<th>Coverage</th>
</tr>
</thead>
<tbody>
<?php foreach ($coverageByFile as $file => $coverage) { ?>
<tr>
<td><a class="byFileReportLink" href="<?php echo $coverage['byFileReport'] ?>"><?php echo $file ?></a></td>
<td class="percentage"><span class="percentCoverage"><?php echo number_format($coverage['percentage'], 0) ?>%</span></td>
</tr>
<?php } ?>
</tbody>
</table>
<table>
<caption>Files Not Covered (<a href="#untouched">?</a>)</caption>
<tbody>
<?php foreach ($untouched as $key => $file) { ?>
<tr>
<td><span class="untouchedFile"><?php echo $file ?></span></td>
</tr>
<?php } ?>
</tbody>
</table>
<h2>Glossary</h2>
<dl>
<dt><a name="total-coverage">Total Coverage</a></dt>
<dd>Ratio of all the lines of executable code that were executed to the
lines of code that were not executed. This does not include the files
that were not covered at all.</dd>
<dt><a name="total-files-covered">Total Files Covered</a></dt>
<dd>This is the ratio of the number of files tested, to the number of
files not tested at all.</dd>
<dt><a name="coverage">Coverage</a></dt>
<dd>These files were parsed and loaded by the php interpreter while
running the tests. Percentage is determined by the ratio of number of
lines of code executed to the number of possible executable lines of
code. "dead" lines of code, or code that could not be executed
according to xdebug, are counted as covered because in almost all cases
it is the end of a logical loop.</dd>
<dt><a name="untouched">Files Not Covered</a></dt>
<dd>These files were not loaded by the php interpreter at anytime
during a unit test. You could consider these files having 0% coverage,
but because it is difficult to determine the total coverage unless you
could count the lines for executable code, this is not reflected in the
Total Coverage calculation.</dd>
</dl>
<p>Code coverage generated by <a href="http://www.simpletest.org">SimpleTest</a></p>
</body>
</html>

View File

@ -0,0 +1,65 @@
<?php
require_once(dirname(__FILE__) . '/../../../autorun.php');
class CoverageCalculatorTest extends UnitTestCase {
function skip() {
$this->skipIf(
!file_exists('DB/sqlite.php'),
'The Coverage extension needs to have PEAR installed');
}
function setUp() {
require_once dirname(__FILE__) .'/../coverage_calculator.php';
$this->calc = new CoverageCalculator();
}
function testVariables() {
$coverage = array('file' => array(1,1,1,1));
$untouched = array('missed-file');
$variables = $this->calc->variables($coverage, $untouched);
$this->assertEqual(4, $variables['totalLoc']);
$this->assertEqual(100, $variables['totalPercentCoverage']);
$this->assertEqual(4, $variables['totalLinesOfCoverage']);
$expected = array('file' => array('byFileReport' => 'file.html', 'percentage' => 100));
$this->assertEqual($expected, $variables['coverageByFile']);
$this->assertEqual(50, $variables['filesTouchedPercentage']);
$this->assertEqual($untouched, $variables['untouched']);
}
function testPercentageCoverageByFile() {
$coverage = array(0,0,0,1,1,1);
$results = array();
$this->calc->percentCoverageByFile($coverage, 'file', $results);
$pct = $results[0];
$this->assertEqual(50, $pct['file']['percentage']);
$this->assertEqual('file.html', $pct['file']['byFileReport']);
}
function testTotalLoc() {
$this->assertEqual(13, $this->calc->totalLoc(10, array(1,2,3)));
}
function testLineCoverage() {
$this->assertEqual(10, $this->calc->lineCoverage(10, -1));
$this->assertEqual(10, $this->calc->lineCoverage(10, 0));
$this->assertEqual(11, $this->calc->lineCoverage(10, 1));
}
function testTotalCoverage() {
$this->assertEqual(11, $this->calc->totalCoverage(10, array(-1,1)));
}
static function getAttribute($element, $attribute) {
$a = $element->attributes();
return $a[$attribute];
}
static function dom($stream) {
rewind($stream);
$actual = stream_get_contents($stream);
$html = DOMDocument::loadHTML($actual);
return simplexml_import_dom($html);
}
}
?>

View File

@ -0,0 +1,83 @@
<?php
require_once(dirname(__FILE__) . '/../../../autorun.php');
class CoverageDataHandlerTest extends UnitTestCase {
function skip() {
$this->skipIf(
!file_exists('DB/sqlite.php'),
'The Coverage extension needs to have PEAR installed');
}
function setUp() {
require_once dirname(__FILE__) .'/../coverage_data_handler.php';
}
function testAggregateCoverageCode() {
$handler = new CoverageDataHandler($this->tempdb());
$this->assertEqual(-2, $handler->aggregateCoverageCode(-2, -2));
$this->assertEqual(-2, $handler->aggregateCoverageCode(-2, 10));
$this->assertEqual(-2, $handler->aggregateCoverageCode(10, -2));
$this->assertEqual(-1, $handler->aggregateCoverageCode(-1, -1));
$this->assertEqual(10, $handler->aggregateCoverageCode(-1, 10));
$this->assertEqual(10, $handler->aggregateCoverageCode(10, -1));
$this->assertEqual(20, $handler->aggregateCoverageCode(10, 10));
}
function testSimpleWriteRead() {
$handler = new CoverageDataHandler($this->tempdb());
$handler->createSchema();
$coverage = array(10 => -2, 20 => -1, 30 => 0, 40 => 1);
$handler->write(array('file' => $coverage));
$actual = $handler->readFile('file');
$expected = array(10 => -2, 20 => -1, 30 => 0, 40 => 1);
$this->assertEqual($expected, $actual);
}
function testMultiFileWriteRead() {
$handler = new CoverageDataHandler($this->tempdb());
$handler->createSchema();
$handler->write(array(
'file1' => array(-2, -1, 1),
'file2' => array(-2, -1, 1)
));
$handler->write(array(
'file1' => array(-2, -1, 1)
));
$expected = array(
'file1' => array(-2, -1, 2),
'file2' => array(-2, -1, 1)
);
$actual = $handler->read();
$this->assertEqual($expected, $actual);
}
function testGetfilenames() {
$handler = new CoverageDataHandler($this->tempdb());
$handler->createSchema();
$rawCoverage = array('file0' => array(), 'file1' => array());
$handler->write($rawCoverage);
$actual = $handler->getFilenames();
$this->assertEqual(array('file0', 'file1'), $actual);
}
function testWriteUntouchedFiles() {
$handler = new CoverageDataHandler($this->tempdb());
$handler->createSchema();
$handler->writeUntouchedFile('bluejay');
$handler->writeUntouchedFile('robin');
$this->assertEqual(array('bluejay', 'robin'), $handler->readUntouchedFiles());
}
function testLtrim() {
$this->assertEqual('ber', CoverageDataHandler::ltrim('goo', 'goober'));
$this->assertEqual('some/file', CoverageDataHandler::ltrim('./', './some/file'));
$this->assertEqual('/x/y/z/a/b/c', CoverageDataHandler::ltrim('/a/b/', '/x/y/z/a/b/c'));
}
function tempdb() {
return tempnam(NULL, 'coverage.test.db');
}
}
?>

View File

@ -0,0 +1,22 @@
<?php
require_once(dirname(__FILE__) . '/../../../autorun.php');
class CoverageReporterTest extends UnitTestCase {
function skip() {
$this->skipIf(
!file_exists('DB/sqlite.php'),
'The Coverage extension needs to have PEAR installed');
}
function setUp() {
require_once dirname(__FILE__) .'/../coverage_reporter.php';
new CoverageReporter();
}
function testreportFilename() {
$this->assertEqual("parula.php.html", CoverageReporter::reportFilename("parula.php"));
$this->assertEqual("warbler_parula.php.html", CoverageReporter::reportFilename("warbler/parula.php"));
$this->assertEqual("warbler_parula.php.html", CoverageReporter::reportFilename("warbler\\parula.php"));
}
}
?>

View File

@ -0,0 +1,109 @@
<?php
require_once(dirname(__FILE__) . '/../../../autorun.php');
require_once(dirname(__FILE__) . '/../../../mock_objects.php');
class CodeCoverageTest extends UnitTestCase {
function skip() {
$this->skipIf(
!file_exists('DB/sqlite.php'),
'The Coverage extension needs to have PEAR installed');
}
function setUp() {
require_once dirname(__FILE__) .'/../coverage.php';
}
function testIsFileIncluded() {
$coverage = new CodeCoverage();
$this->assertTrue($coverage->isFileIncluded('aaa'));
$coverage->includes = array('a');
$this->assertTrue($coverage->isFileIncluded('aaa'));
$coverage->includes = array('x');
$this->assertFalse($coverage->isFileIncluded('aaa'));
$coverage->excludes = array('aa');
$this->assertFalse($coverage->isFileIncluded('aaa'));
}
function testIsFileIncludedRegexp() {
$coverage = new CodeCoverage();
$coverage->includes = array('modules/.*\.php$');
$coverage->excludes = array('bad-bunny.php');
$this->assertFalse($coverage->isFileIncluded('modules/a.test'));
$this->assertFalse($coverage->isFileIncluded('modules/bad-bunny.test'));
$this->assertTrue($coverage->isFileIncluded('modules/test.php'));
$this->assertFalse($coverage->isFileIncluded('module-bad/good-bunny.php'));
$this->assertTrue($coverage->isFileIncluded('modules/good-bunny.php'));
}
function testIsDirectoryIncludedPastMaxDepth() {
$coverage = new CodeCoverage();
$coverage->maxDirectoryDepth = 5;
$this->assertTrue($coverage->isDirectoryIncluded('aaa', 1));
$this->assertFalse($coverage->isDirectoryIncluded('aaa', 5));
}
function testIsDirectoryIncluded() {
$coverage = new CodeCoverage();
$this->assertTrue($coverage->isDirectoryIncluded('aaa', 0));
$coverage->excludes = array('b$');
$this->assertTrue($coverage->isDirectoryIncluded('aaa', 0));
$coverage->includes = array('a$'); // includes are ignore, all dirs are included unless excluded
$this->assertTrue($coverage->isDirectoryIncluded('aaa', 0));
$coverage->excludes = array('.*a$');
$this->assertFalse($coverage->isDirectoryIncluded('aaa', 0));
}
function testFilter() {
$coverage = new CodeCoverage();
$data = array('a' => 0, 'b' => 0, 'c' => 0);
$coverage->includes = array('b');
$coverage->filter($data);
$this->assertEqual(array('b' => 0), $data);
}
function testUntouchedFiles() {
$coverage = new CodeCoverage();
$touched = array_flip(array("test/coverage_test.php"));
$actual = array();
$coverage->includes = array('coverage_test\.php$');
$parentDir = realpath(dirname(__FILE__));
$coverage->getUntouchedFiles($actual, $touched, $parentDir, $parentDir);
$this->assertEqual(array("coverage_test.php"), $actual);
}
function testResetLog() {
$coverage = new CodeCoverage();
$coverage->log = tempnam(NULL, 'php.xdebug.coverage.test.');
$coverage->resetLog();
$this->assertTrue(file_exists($coverage->log));
}
function testSettingsSerialization() {
$coverage = new CodeCoverage();
$coverage->log = '/banana/boat';
$coverage->includes = array('apple', 'orange');
$coverage->excludes = array('tomato', 'pea');
$data = $coverage->getSettings();
$this->assertNotNull($data);
$actual = new CodeCoverage();
$actual->setSettings($data);
$this->assertEqual('/banana/boat', $actual->log);
$this->assertEqual(array('apple', 'orange'), $actual->includes);
$this->assertEqual(array('tomato', 'pea'), $actual->excludes);
}
function testSettingsCanBeReadWrittenToDisk() {
$settings_file = 'banana-boat-coverage-settings-test.dat';
$coverage = new CodeCoverage();
$coverage->log = '/banana/boat';
$coverage->settingsFile = $settings_file;
$coverage->writeSettings();
$actual = new CodeCoverage();
$actual->settingsFile = $settings_file;
$actual->readSettings();
$this->assertEqual('/banana/boat', $actual->log);
}
}
?>

View File

@ -0,0 +1,70 @@
<?php
require_once dirname(__FILE__) . '/../../../autorun.php';
class CoverageUtilsTest extends UnitTestCase {
function skip() {
$this->skipIf(
!file_exists('DB/sqlite.php'),
'The Coverage extension needs to have PEAR installed');
}
function setUp() {
require_once dirname(__FILE__) .'/../coverage_utils.php';
}
function testMkdir() {
CoverageUtils::mkdir(dirname(__FILE__));
try {
CoverageUtils::mkdir(__FILE__);
$this->fail("Should give error about cannot create dir of a file");
} catch (Exception $expected) {
}
}
function testIsPackageClassAvailable() {
$coverageSource = dirname(__FILE__) .'/../coverage_calculator.php';
$this->assertTrue(CoverageUtils::isPackageClassAvailable($coverageSource, 'CoverageCalculator'));
$this->assertFalse(CoverageUtils::isPackageClassAvailable($coverageSource, 'BogusCoverage'));
$this->assertFalse(CoverageUtils::isPackageClassAvailable('bogus-file', 'BogusCoverage'));
$this->assertTrue(CoverageUtils::isPackageClassAvailable('bogus-file', 'CoverageUtils'));
}
function testParseArgumentsMultiValue() {
$actual = CoverageUtils::parseArguments(array('scriptname', '--a=b', '--a=c'), True);
$expected = array('extraArguments' => array(), 'a' => 'c', 'a[]' => array('b', 'c'));
$this->assertEqual($expected, $actual);
}
function testParseArguments() {
$actual = CoverageUtils::parseArguments(array('scriptname', '--a=b', '-c', 'xxx'));
$expected = array('a' => 'b', 'c' => '', 'extraArguments' => array('xxx'));
$this->assertEqual($expected, $actual);
}
function testParseDoubleDashNoArguments() {
$actual = CoverageUtils::parseArguments(array('scriptname', '--aa'));
$this->assertTrue(isset($actual['aa']));
}
function testParseHyphenedExtraArguments() {
$actual = CoverageUtils::parseArguments(array('scriptname', '--alpha-beta=b', 'gamma-lambda'));
$expected = array('alpha-beta' => 'b', 'extraArguments' => array('gamma-lambda'));
$this->assertEqual($expected, $actual);
}
function testAddItemAsArray() {
$actual = array();
CoverageUtils::addItemAsArray($actual, 'bird', 'duck');
$this->assertEqual(array('bird[]' => array('duck')), $actual);
CoverageUtils::addItemAsArray(&$actual, 'bird', 'pigeon');
$this->assertEqual(array('bird[]' => array('duck', 'pigeon')), $actual);
}
function testIssetOr() {
$data = array('bird' => 'gull');
$this->assertEqual('lab', CoverageUtils::issetOr($data['dog'], 'lab'));
$this->assertEqual('gull', CoverageUtils::issetOr($data['bird'], 'sparrow'));
}
}
?>

View File

@ -0,0 +1,4 @@
<?php
// sample code
$x = 1 + 2;
if (false) echo "dead";

View File

@ -0,0 +1,69 @@
<?php
require_once(dirname(__FILE__) . '/../../../autorun.php');
class SimpleCoverageWriterTest extends UnitTestCase {
function skip() {
$this->skipIf(
!file_exists('DB/sqlite.php'),
'The Coverage extension needs to have PEAR installed');
}
function setUp() {
require_once dirname(__FILE__) .'/../simple_coverage_writer.php';
require_once dirname(__FILE__) .'/../coverage_calculator.php';
}
function testGenerateSummaryReport() {
$writer = new SimpleCoverageWriter();
$coverage = array('file' => array(0, 1));
$untouched = array('missed-file');
$calc = new CoverageCalculator();
$variables = $calc->variables($coverage, $untouched);
$variables['title'] = 'coverage';
$out = fopen("php://memory", 'w');
$writer->writeSummary($out, $variables);
$dom = self::dom($out);
$totalPercentCoverage = $dom->elements->xpath("//span[@class='totalPercentCoverage']");
$this->assertEqual('50%', (string)$totalPercentCoverage[0]);
$fileLinks = $dom->elements->xpath("//a[@class='byFileReportLink']");
$fileLinkAttr = $fileLinks[0]->attributes();
$this->assertEqual('file.html', $fileLinkAttr['href']);
$this->assertEqual('file', (string)($fileLinks[0]));
$untouchedFile = $dom->elements->xpath("//span[@class='untouchedFile']");
$this->assertEqual('missed-file', (string)$untouchedFile[0]);
}
function testGenerateCoverageByFile() {
$writer = new SimpleCoverageWriter();
$cov = array(3 => 1, 4 => -2); // 2 comments, 1 code, 1 dead (1-based indexes)
$out = fopen("php://memory", 'w');
$file = dirname(__FILE__) .'/sample/code.php';
$calc = new CoverageCalculator();
$variables = $calc->coverageByFileVariables($file, $cov);
$variables['title'] = 'coverage';
$writer->writeByFile($out, $variables);
$dom = self::dom($out);
$cells = $dom->elements->xpath("//table[@id='code']/tbody/tr/td/span");
$this->assertEqual("comment code", self::getAttribute($cells[1], 'class'));
$this->assertEqual("comment code", self::getAttribute($cells[3], 'class'));
$this->assertEqual("covered code", self::getAttribute($cells[5], 'class'));
$this->assertEqual("dead code", self::getAttribute($cells[7], 'class'));
}
static function getAttribute($element, $attribute) {
$a = $element->attributes();
return $a[$attribute];
}
static function dom($stream) {
rewind($stream);
$actual = stream_get_contents($stream);
$html = DOMDocument::loadHTML($actual);
return simplexml_import_dom($html);
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
// $Id: $
require_once(dirname(__FILE__) . '/../../../autorun.php');
class CoverageUnitTests extends TestSuite {
function CoverageUnitTests() {
$this->TestSuite('Coverage Unit tests');
$path = dirname(__FILE__) . '/*_test.php';
foreach(glob($path) as $test) {
$this->addFile($test);
}
}
}
?>

8
README
View File

@ -5,9 +5,9 @@ http://ownCloud.org
Installation instructions: http://owncloud.org/support
Source code: http://gitorious.org/owncloud
Mailing list: http://mail.kde.org/mailman/listinfo/owncloud
IRC channel: http://webchat.freenode.net/?channels=owncloud
Source code: https://github.com/owncloud
Mailing list: https://mail.kde.org/mailman/listinfo/owncloud
IRC channel: https://webchat.freenode.net/?channels=owncloud
Diaspora: https://joindiaspora.com/u/owncloud
Identi.ca: http://identi.ca/owncloud
Identi.ca: https://identi.ca/owncloud

View File

@ -1,21 +0,0 @@
<?php
OC::$CLASSPATH['OC_Admin_Audit_Hooks_Handlers'] = 'apps/admin_audit/lib/hooks_handlers.php';
OCP\Util::connectHook('OCP\User', 'pre_login', 'OC_Admin_Audit_Hooks_Handlers', 'pre_login');
OCP\Util::connectHook('OCP\User', 'post_login', 'OC_Admin_Audit_Hooks_Handlers', 'post_login');
OCP\Util::connectHook('OCP\User', 'logout', 'OC_Admin_Audit_Hooks_Handlers', 'logout');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename, 'OC_Admin_Audit_Hooks_Handlers', 'rename');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, 'OC_Admin_Audit_Hooks_Handlers', 'create');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_copy, 'OC_Admin_Audit_Hooks_Handlers', 'copy');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, 'OC_Admin_Audit_Hooks_Handlers', 'write');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_read, 'OC_Admin_Audit_Hooks_Handlers', 'read');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, 'OC_Admin_Audit_Hooks_Handlers', 'delete');
//FIXME OC_Share does no longer exist
/*
OCP\Util::connectHook('OC_Share', 'public', 'OC_Admin_Audit_Hooks_Handlers', 'share_public');
OCP\Util::connectHook('OC_Share', 'public-download', 'OC_Admin_Audit_Hooks_Handlers', 'share_public_download');
OCP\Util::connectHook('OC_Share', 'user', 'OC_Admin_Audit_Hooks_Handlers', 'share_user');
*/

View File

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<info>
<id>admin_audit</id>
<name>Log audit info</name>
<version>0.1</version>
<licence>AGPL</licence>
<author>Bart Visscher</author>
<require>4</require>
<description>Audit user actions in Owncloud</description>
<shipped>true</shipped>
</info>

View File

@ -1,73 +0,0 @@
<?php
class OC_Admin_Audit_Hooks_Handlers {
static public function pre_login($params) {
$path = $params['uid'];
self::log('Trying login '.$user);
}
static public function post_login($params) {
$path = $params['uid'];
self::log('Login '.$user);
}
static public function logout($params) {
$user = OCP\User::getUser();
self::log('Logout '.$user);
}
static public function rename($params) {
$oldpath = $params[OC_Filesystem::signal_param_oldpath];
$newpath = $params[OC_Filesystem::signal_param_newpath];
$user = OCP\User::getUser();
self::log('Rename "'.$oldpath.'" to "'.$newpath.'" by '.$user);
}
static public function create($params) {
$path = $params[OC_Filesystem::signal_param_path];
$user = OCP\User::getUser();
self::log('Create "'.$path.'" by '.$user);
}
static public function copy($params) {
$oldpath = $params[OC_Filesystem::signal_param_oldpath];
$newpath = $params[OC_Filesystem::signal_param_newpath];
$user = OCP\User::getUser();
self::log('Copy "'.$oldpath.'" to "'.$newpath.'" by '.$user);
}
static public function write($params) {
$path = $params[OC_Filesystem::signal_param_path];
$user = OCP\User::getUser();
self::log('Write "'.$path.'" by '.$user);
}
static public function read($params) {
$path = $params[OC_Filesystem::signal_param_path];
$user = OCP\User::getUser();
self::log('Read "'.$path.'" by '.$user);
}
static public function delete($params) {
$path = $params[OC_Filesystem::signal_param_path];
$user = OCP\User::getUser();
self::log('Delete "'.$path.'" by '.$user);
}
static public function share_public($params) {
$path = $params['source'];
$token = $params['token'];
$user = OCP\User::getUser();
self::log('Shared "'.$path.'" with public, token="'.$token.'" by '.$user);
}
static public function share_public_download($params) {
$path = $params['source'];
$token = $params['token'];
$user = $_SERVER['REMOTE_ADDR'];
self::log('Download of shared "'.$path.'" token="'.$token.'" by '.$user);
}
static public function share_user($params) {
$path = $params['source'];
$permissions = $params['permissions'];
$with = $params['with'];
$user = OCP\User::getUser();
//$rw = $permissions & OC_Share::WRITE ? 'w' : 'o'; //FIXME OC_Share no longer exists, hack to check permissions
$rw = $permissions & 1 ? 'w' : 'o';
self::log('Shared "'.$path.'" (r'.$rw.') with user "'.$with.'" by '.$user);
}
static protected function log($msg) {
OCP\Util::writeLog('admin_audit', $msg, OCP\Util::INFO);
}
}

View File

@ -1,4 +0,0 @@
<?php
$l=OC_L10N::get('admin_dependencies_chk');
OCP\App::registerAdmin('admin_dependencies_chk','settings');

View File

@ -1,10 +0,0 @@
<?xml version="1.0"?>
<info>
<id>admin_dependencies_chk</id>
<name>ownCloud dependencies info</name>
<licence>AGPL</licence>
<author>Brice Maron (eMerzh)</author>
<require>4</require>
<shipped>true</shipped>
<description>Display OwnCloud's dependencies informations (missings modules, ...)</description>
</info>

View File

@ -1 +0,0 @@
0.01

View File

@ -1,9 +0,0 @@
#status_list legend { font-weight: bold; color: #888888; }
.state > li { margin-bottom: 3px; padding-left: 0.5em; list-style-type: circle; }
.state .state_module { font-weight:bold; text-shadow: 0 1px 0 #DDD; cursor:help;}
.state_used ul, .state_used li { display:inline; }
.state_ok .state_module { color: #009700; }
.state_warning .state_module { color: #FF9B29; }
.state_error .state_module { color: #FF3B3B; }

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "El mòdul php-json és necessari per moltes aplicacions per comunicacions internes",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "El mòdul php-curl és necessari per mostrar el títol de la pàgina quan s'afegeixen adreces d'interès",
"The php-gd module is needed to create thumbnails of your images" => "El mòdul php-gd és necessari per generar miniatures d'imatges",
"The php-ldap module is needed connect to your ldap server" => "El mòdul php-ldap és necessari per connectar amb el servidor ldap",
"The php-zip module is needed download multiple files at once" => "El mòdul php-zip és necessari per baixar múltiples fitxers de cop",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "El mòdul php-mb_multibyte és necessari per gestionar correctament la codificació.",
"The php-ctype module is needed validate data." => "El mòdul php-ctype és necessari per validar dades.",
"The php-xml module is needed to share files with webdav." => "El mòdul php-xml és necessari per compatir els fitxers amb webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "La directiva allow_url_fopen de php.ini hauria d'establir-se en 1 per accedir a la base de coneixements dels servidors OCS",
"The php-pdo module is needed to store owncloud data into a database." => "El mòdul php-pdo és necessari per desar les dades d'ownCloud en una base de dades.",
"Dependencies status" => "Estat de dependències",
"Used by :" => "Usat per:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Modul php-json je třeba pro vzájemnou komunikaci mnoha aplikací",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Modul php-curl je třeba pro zobrazení titulu strany v okamžiku přidání záložky",
"The php-gd module is needed to create thumbnails of your images" => "Modul php-gd je třeba pro tvorbu náhledů Vašich obrázků",
"The php-ldap module is needed connect to your ldap server" => "Modul php-ldap je třeba pro připojení na Váš ldap server",
"The php-zip module is needed download multiple files at once" => "Modul php-zip je třeba pro souběžné stahování souborů",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Modul php-mb_multibyte je třeba pro správnou funkci kódování.",
"The php-ctype module is needed validate data." => "Modul php-ctype je třeba k ověřování dat.",
"The php-xml module is needed to share files with webdav." => "Modul php-xml je třeba ke sdílení souborů prostřednictvím WebDAV.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Příkaz allow_url_fopen ve Vašem php.ini souboru by měl být nastaven na 1 kvůli získávání informací z OCS serverů",
"The php-pdo module is needed to store owncloud data into a database." => "Modul php-pdo je třeba pro ukládání dat ownCloud do databáze",
"Dependencies status" => "Status závislostí",
"Used by :" => "Používáno:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Das Modul php-json wird von vielen Anwendungen zur internen Kommunikation benötigt.",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Das Modul php-curl wird benötigt, um den Titel der Seite für die Lesezeichen hinzuzufügen.",
"The php-gd module is needed to create thumbnails of your images" => "Das Modul php-gd wird für die Erzeugung der Vorschaubilder benötigt.",
"The php-ldap module is needed connect to your ldap server" => "Das Modul php-ldap wird für die Verbindung mit dem LDAP-Server benötigt.",
"The php-zip module is needed download multiple files at once" => "Das Modul php-zip wird für den gleichzeitigen Download mehrerer Dateien benötigt.",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Das Modul php_mb_multibyte wird benötigt, um das Encoding richtig zu handhaben.",
"The php-ctype module is needed validate data." => "Das Modul php-ctype wird benötigt, um Daten zu prüfen.",
"The php-xml module is needed to share files with webdav." => "Das Modul php-xml wird benötigt, um Dateien über WebDAV zu teilen.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Die Richtlinie allow_url_fopen in Ihrer php.ini sollte auf 1 gesetzt werden, um die Wissensbasis vom OCS-Server abrufen.",
"The php-pdo module is needed to store owncloud data into a database." => "Das Modul php-pdo wird benötigt, um Daten in der Datenbank zu speichern.",
"Dependencies status" => "Status der Abhängigkeiten",
"Used by :" => "Benutzt von:"
);

View File

@ -1,4 +0,0 @@
<?php $TRANSLATIONS = array(
"Dependencies status" => "Κατάσταση εξαρτήσεων",
"Used by :" => "Χρησιμοποιήθηκε από:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "La modulo php-json necesas por komuniko inter la multaj aplikaĵoj",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "La modulo php-curl necesas por venigi la paĝotitolon dum aldono de legosigno",
"The php-gd module is needed to create thumbnails of your images" => "La modulo php-gd necesas por krei bildetojn.",
"The php-ldap module is needed connect to your ldap server" => "La modulo php-ldap necesas por konekti al via LDAP-servilo.",
"The php-zip module is needed download multiple files at once" => "La modulo php-zip necesas por elŝuti plurajn dosierojn per unu fojo.",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "La modulo php-mb_multibyte necesas por ĝuste administri la kodprezenton.",
"The php-ctype module is needed validate data." => "La modulo php-ctype necesas por validkontroli datumojn.",
"The php-xml module is needed to share files with webdav." => "La modulo php-xml necesas por kunhavigi dosierojn per WebDAV.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "La ordono allow_url_fopen de via php.ini devus valori 1 por ricevi scibazon el OCS-serviloj",
"The php-pdo module is needed to store owncloud data into a database." => "La modulo php-pdo necesas por konservi datumojn de ownCloud en datumbazo.",
"Dependencies status" => "Stato de dependoj",
"Used by :" => "Uzata de:"
);

View File

@ -1,4 +0,0 @@
<?php $TRANSLATIONS = array(
"Dependencies status" => "Estado de las dependencias",
"Used by :" => "Usado por:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "php-json moodul on vajalik paljude rakenduse poolt omvahelise suhtlemise jaoks",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "php-curl moodul on vajalik lehe pealkirja tõmbamiseks järjehoidja lisamisel",
"The php-gd module is needed to create thumbnails of your images" => "php-gd moodul on vajalik sinu piltidest pisipiltide loomiseks",
"The php-ldap module is needed connect to your ldap server" => "php-ldap moodul on vajalik sinu ldap serveriga ühendumiseks",
"The php-zip module is needed download multiple files at once" => "php-zip moodul on vajalik mitme faili korraga alla laadimiseks",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "php-mb_multibyte moodul on vajalik kodeerimise korrektseks haldamiseks.",
"The php-ctype module is needed validate data." => "php-ctype moodul on vajalik andmete kontrollimiseks.",
"The php-xml module is needed to share files with webdav." => "php-xml moodul on vajalik failide jagamiseks webdav-iga.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Sinu php.ini failis oleva direktiivi allow_url_fopen väärtuseks peaks määrama 1, et saaks tõmmata teadmistebaasi OCS-i serveritest",
"The php-pdo module is needed to store owncloud data into a database." => "php-pdo moodul on vajalik owncloudi andmete salvestamiseks andmebaasi.",
"Dependencies status" => "Sõltuvuse staatus",
"Used by :" => "Kasutab :"
);

View File

@ -1,9 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-gd module is needed to create thumbnails of your images" => "php-gd-moduuli vaaditaan, jotta kuvista on mahdollista luoda esikatselukuvia",
"The php-ldap module is needed connect to your ldap server" => "php-ldap-moduuli vaaditaan, jotta yhteys ldap-palvelimeen on mahdollista",
"The php-zip module is needed download multiple files at once" => "php-zip-moduuli vaaditaan, jotta useiden tiedostojen samanaikainen lataus on mahdollista",
"The php-xml module is needed to share files with webdav." => "php-xml-moduuli vaaditaan, jotta tiedostojen jako webdavia käyttäen on mahdollista",
"The php-pdo module is needed to store owncloud data into a database." => "php-pdo-moduuli tarvitaan, jotta ownCloud-tietojen tallennus tietokantaan on mahdollista",
"Dependencies status" => "Riippuvuuksien tila",
"Used by :" => "Käyttökohde:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Le module php-json est requis pour l'inter-communication de nombreux modules.",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Le module php-curl est requis afin de rapatrier le titre des pages lorsque vous ajoutez un marque-pages.",
"The php-gd module is needed to create thumbnails of your images" => "Le module php-gd est requis afin de permettre la création d'aperçus pour vos images.",
"The php-ldap module is needed connect to your ldap server" => "Le module php-ldap est requis afin de permettre la connexion à votre serveur ldap.",
"The php-zip module is needed download multiple files at once" => "Le module php-zip est requis pour le téléchargement simultané de plusieurs fichiers.",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Le module php-mb_multibyte est requis pour une gestion correcte des encodages.",
"The php-ctype module is needed validate data." => "Le module php-ctype est requis pour la validation des données.",
"The php-xml module is needed to share files with webdav." => "Le module php-xml est requis pour le partage de fichiers via webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "La directive allow_url_fopen de votre fichier php.ini doit être à la valeur 1 afin de permettre le rapatriement de la base de connaissance depuis les serveurs OCS.",
"The php-pdo module is needed to store owncloud data into a database." => "le module php-pdo est requis pour le stockage des données ownCloud en base de données.",
"Dependencies status" => "Statut des dépendances",
"Used by :" => "Utilisé par :"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Il modulo php-json è richiesto per l'intercomunicazione di diverse applicazioni",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Il modulo php-curl è richiesto per scaricare il titolo della pagina quando si aggiunge un segnalibro",
"The php-gd module is needed to create thumbnails of your images" => "Il modulo php-gd è richiesto per creare miniature delle tue immagini",
"The php-ldap module is needed connect to your ldap server" => "Il modulo php-ldap è richiesto per collegarsi a un server ldap",
"The php-zip module is needed download multiple files at once" => "Il modulo php-zip è richiesto per scaricare diversi file contemporaneamente",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Il modulo php-mb_multibyte è richiesto per gestire correttamente la codifica.",
"The php-ctype module is needed validate data." => "Il modulo php-ctype è richiesto per la validazione dei dati.",
"The php-xml module is needed to share files with webdav." => "Il modulo php-xml è richiesto per condividere i file con webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "La direttiva allow_url_fopen del tuo php.ini deve essere impostata a 1 per recuperare la base di conoscenza dai server di OCS",
"The php-pdo module is needed to store owncloud data into a database." => "Il modulo php-pdo è richiesto per archiviare i dati di ownCloud in un database.",
"Dependencies status" => "Stato delle dipendenze",
"Used by :" => "Usato da:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "php-jsonモジュールはアプリケーション間の内部通信に必要です",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "php-curlモジュールはブックマーク追加時のページタイトル取得に必要です",
"The php-gd module is needed to create thumbnails of your images" => "php-gdモジュールはサムネイル画像の生成に必要です",
"The php-ldap module is needed connect to your ldap server" => "php-ldapモジュールはLDAPサーバへの接続に必要です",
"The php-zip module is needed download multiple files at once" => "php-zipモジュールは複数ファイルの同時ダウンロードに必要です",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "php-mb_multibyteモジュールはエンコードを正しく扱うために必要です",
"The php-ctype module is needed validate data." => "php-ctypeモジュールはデータのバリデーションに必要です",
"The php-xml module is needed to share files with webdav." => "php-xmlモジュールはWebDAVでのファイル共有に必要です",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "php.iniのallow_url_fopenはOCSサーバから知識ベースを取得するために1に設定しなくてはなりません",
"The php-pdo module is needed to store owncloud data into a database." => "php-pdoモジュールはデータベースにownCloudのデータを格納するために必要です",
"Dependencies status" => "依存関係の状況",
"Used by :" => "利用先 :"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Php-json modulis yra reikalingas duomenų keitimuisi tarp programų",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Php-curl modulis automatiškai nuskaito tinklapio pavadinimą kuomet išsaugoma žymelė.",
"The php-gd module is needed to create thumbnails of your images" => "Php-gd modulis yra naudojamas paveikslėlių miniatiūroms kurti.",
"The php-ldap module is needed connect to your ldap server" => "Php-ldap modulis yra reikalingas prisijungimui prie jūsų ldap serverio",
"The php-zip module is needed download multiple files at once" => "Php-zip modulis yra reikalingas kelių failų atsiuntimui iš karto.",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Php-mb_multibyte modulis yra naudojamas apdoroti įvairius teksto kodavimo formatus.",
"The php-ctype module is needed validate data." => "Php-ctype modulis yra reikalingas duomenų tikrinimui.",
"The php-xml module is needed to share files with webdav." => "Php-xml modulis yra reikalingas failų dalinimuisi naudojant webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "allow_url_fopen direktyva turėtų būti nustatyta į \"1\" jei norite automatiškai gauti žinių bazės informaciją iš OCS serverių.",
"The php-pdo module is needed to store owncloud data into a database." => "Php-pdo modulis yra reikalingas duomenų saugojimui į owncloud duomenų bazę.",
"Dependencies status" => "Priklausomybės",
"Used by :" => "Naudojama:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Moduł php-json jest wymagane przez wiele aplikacji do wewnętrznej łączności",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Modude php-curl jest wymagany do pobrania tytułu strony podczas dodawania zakładki",
"The php-gd module is needed to create thumbnails of your images" => "Moduł php-gd jest wymagany do tworzenia miniatury obrazów",
"The php-ldap module is needed connect to your ldap server" => "Moduł php-ldap jest wymagany aby połączyć się z serwerem ldap",
"The php-zip module is needed download multiple files at once" => "Moduł php-zip jest wymagany aby pobrać wiele plików na raz",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Moduł php-mb_multibyte jest wymagany do poprawnego zarządzania kodowaniem.",
"The php-ctype module is needed validate data." => "Moduł php-ctype jest wymagany do sprawdzania poprawności danych.",
"The php-xml module is needed to share files with webdav." => "Moduł php-xml jest wymagany do udostępniania plików przy użyciu protokołu webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Dyrektywy allow_url_fopen użytkownika php.ini powinna być ustawiona na 1 do pobierania bazy wiedzy z serwerów OCS",
"The php-pdo module is needed to store owncloud data into a database." => "Moduł php-pdo jest wymagany do przechowywania danych owncloud w bazie danych.",
"Dependencies status" => "Stan zależności",
"Used by :" => "Używane przez:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Модуль php-json необходим многим приложениям для внутренних связей",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Модуль php-curl необходим для получения заголовка страницы при добавлении закладок",
"The php-gd module is needed to create thumbnails of your images" => "Модуль php-gd необходим для создания уменьшенной копии для предпросмотра ваших картинок.",
"The php-ldap module is needed connect to your ldap server" => "Модуль php-ldap необходим для соединения с вашим ldap сервером",
"The php-zip module is needed download multiple files at once" => "Модуль php-zip необходим для загрузки нескольких файлов за раз",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Модуль php-mb_multibyte необходим для корректного управления кодировками.",
"The php-ctype module is needed validate data." => "Модуль php-ctype необходим для проверки данных.",
"The php-xml module is needed to share files with webdav." => "Модуль php-xml необходим для открытия файлов через webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Директива allow_url_fopen в файле php.ini должна быть установлена в 1 для получения базы знаний с серверов OCS",
"The php-pdo module is needed to store owncloud data into a database." => "Модуль php-pdo необходим для хранения данных ownСloud в базе данных.",
"Dependencies status" => "Статус зависимостей",
"Used by :" => "Используется:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Modul php-json je potreben za medsebojno komunikacijo veliko aplikacij.",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Modul php-curl je potreben za pridobivanje naslova strani pri dodajanju zaznamkov.",
"The php-gd module is needed to create thumbnails of your images" => "Modul php-gd je potreben za ustvarjanje sličic za predogled.",
"The php-ldap module is needed connect to your ldap server" => "Modul php-ldap je potreben za povezavo z vašim ldap strežnikom.",
"The php-zip module is needed download multiple files at once" => "Modul php-zip je potreben za prenašanje večih datotek hkrati.",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Modul php-mb_multibyte je potreben za pravilno upravljanje kodiranja.",
"The php-ctype module is needed validate data." => "Modul php-ctype je potreben za preverjanje veljavnosti podatkov.",
"The php-xml module is needed to share files with webdav." => "Modul php-xml je potreben za izmenjavo datotek preko protokola WebDAV.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Direktiva allow_url_fopen v vaši php.ini datoteki mora biti nastavljena na 1, če želite omogočiti dostop do zbirke znanja na strežnikih OCS.",
"The php-pdo module is needed to store owncloud data into a database." => "Modul php-pdo je potreben za shranjevanje ownCloud podatkov v podatkovno zbirko.",
"Dependencies status" => "Stanje odvisnosti",
"Used by :" => "Uporablja:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "Modulen php-json behövs av många applikationer som interagerar.",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "Modulen php-curl behövs för att hämta sidans titel när du lägger till bokmärken.",
"The php-gd module is needed to create thumbnails of your images" => "Modulen php-gd behövs för att skapa miniatyrer av dina bilder.",
"The php-ldap module is needed connect to your ldap server" => "Modulen php-ldap behövs för att ansluta mot din ldapserver.",
"The php-zip module is needed download multiple files at once" => "Modulen php-zip behövs för att kunna ladda ner flera filer på en gång.",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "Modulen php-mb_multibyte behövs för att hantera korrekt teckenkodning.",
"The php-ctype module is needed validate data." => "Modulen php-ctype behövs för att validera data.",
"The php-xml module is needed to share files with webdav." => "Modulen php-xml behövs för att kunna dela filer med webdav.",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "Direktivet allow_url_fopen i php.ini bör sättas till 1 för att kunna hämta kunskapsbasen från OCS-servrar.",
"The php-pdo module is needed to store owncloud data into a database." => "Modulen php-pdo behövs för att kunna lagra ownCloud data i en databas.",
"Dependencies status" => "Beroenden status",
"Used by :" => "Används av:"
);

View File

@ -1,14 +0,0 @@
<?php $TRANSLATIONS = array(
"The php-json module is needed by the many applications for inter communications" => "โมดูล php-json จำเป็นต้องใช้สำหรับแอพพลิเคชั่นหลายๆตัวเพื่อการเชื่อมต่อสากล",
"The php-curl modude is needed to fetch the page title when adding a bookmarks" => "โมดูล php-curl จำเป็นต้องใช้สำหรับดึงข้อมูลชื่อหัวเว็บเมื่อเพิ่มเข้าไปยังรายการโปรด",
"The php-gd module is needed to create thumbnails of your images" => "โมดูล php-gd จำเป็นต้องใช้สำหรับสร้างรูปภาพขนาดย่อของรูปภาพของคุณ",
"The php-ldap module is needed connect to your ldap server" => "โมดูล php-ldap จำเป็นต้องใช้สำหรับการเชื่อมต่อกับเซิร์ฟเวอร์ ldap ของคุณ",
"The php-zip module is needed download multiple files at once" => "โมดูล php-zip จำเป็นต้องใช้สำหรับดาวน์โหลดไฟล์พร้อมกันหลายๆไฟล์ในครั้งเดียว",
"The php-mb_multibyte module is needed to manage correctly the encoding." => "โมดูล php-mb_multibyte จำเป็นต้องใช้สำหรับการจัดการการแปลงรหัสไฟล์อย่างถูกต้อง",
"The php-ctype module is needed validate data." => "โมดูล php-ctype จำเป็นต้องใช้สำหรับตรวจสอบความถูกต้องของข้อมูล",
"The php-xml module is needed to share files with webdav." => "โมดูล php-xml จำเป็นต้องใช้สำหรับแชร์ไฟล์ด้วย webdav",
"The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers" => "คำสั่ง allow_url_fopen ที่อยู่ในไฟล์ php.ini ของคุณ ควรกำหนดเป็น 1 เพื่อดึงข้อมูลของฐานความรู้ต่างๆจากเซิร์ฟเวอร์ของ OCS",
"The php-pdo module is needed to store owncloud data into a database." => "โมดูล php-pdo จำเป็นต้องใช้สำหรับจัดเก็บข้อมูลใน owncloud เข้าไปไว้ยังฐานข้อมูล",
"Dependencies status" => "สถานะการอ้างอิง",
"Used by :" => "ใช้งานโดย:"
);

View File

@ -1,102 +0,0 @@
<?php
/**
* ownCloud - user_ldap
*
* @author Brice Maron
* @copyright 2011 Brice Maron brice __from__ bmaron _DOT_ net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$l=OC_L10N::get('admin_dependencies_chk');
$tmpl = new OCP\Template( 'admin_dependencies_chk', 'settings');
$modules = array();
//Possible status are : ok, error, warning
$modules[] =array(
'status' => function_exists('json_encode') ? 'ok' : 'error',
'part'=> 'php-json',
'modules'=> array('core'),
'message'=> $l->t('The php-json module is needed by the many applications for inter communications'));
$modules[] =array(
'status' => function_exists('curl_init') ? 'ok' : 'error',
'part'=> 'php-curl',
'modules'=> array('bookmarks'),
'message'=> $l->t('The php-curl modude is needed to fetch the page title when adding a bookmarks'));
$modules[] =array(
'status' => function_exists('imagepng') ? 'ok' : 'error',
'part'=> 'php-gd',
'modules'=> array('gallery'),
'message'=> $l->t('The php-gd module is needed to create thumbnails of your images'));
$modules[] =array(
'status' => function_exists("ldap_bind") ? 'ok' : 'error',
'part'=> 'php-ldap',
'modules'=> array('user_ldap'),
'message'=> $l->t('The php-ldap module is needed connect to your ldap server'));
$modules[] =array(
'status' => class_exists('ZipArchive') ? 'ok' : 'warning',
'part'=> 'php-zip',
'modules'=> array('admin_export','core'),
'message'=> $l->t('The php-zip module is needed download multiple files at once'));
$modules[] =array(
'status' => function_exists('mb_detect_encoding') ? 'ok' : 'error',
'part'=> 'php-mb_multibyte ',
'modules'=> array('core'),
'message'=> $l->t('The php-mb_multibyte module is needed to manage correctly the encoding.'));
$modules[] =array(
'status' => function_exists('ctype_digit') ? 'ok' : 'error',
'part'=> 'php-ctype',
'modules'=> array('core'),
'message'=> $l->t('The php-ctype module is needed validate data.'));
$modules[] =array(
'status' => class_exists('DOMDocument') ? 'ok' : 'error',
'part'=> 'php-xml',
'modules'=> array('core'),
'message'=> $l->t('The php-xml module is needed to share files with webdav.'));
$modules[] =array(
'status' => ini_get('allow_url_fopen') == '1' ? 'ok' : 'error',
'part'=> 'allow_url_fopen',
'modules'=> array('core'),
'message'=> $l->t('The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers'));
$modules[] =array(
'status' => class_exists('PDO') ? 'ok' : 'warning',
'part'=> 'php-pdo',
'modules'=> array('core'),
'message'=> $l->t('The php-pdo module is needed to store owncloud data into a database.'));
foreach($modules as $key => $module) {
$enabled = false ;
foreach($module['modules'] as $app) {
if(OCP\App::isEnabled($app) || $app=='core'){
$enabled = true;
}
}
if($enabled == false) unset($modules[$key]);
}
OCP\UTIL::addStyle('admin_dependencies_chk', 'style');
$tmpl->assign( 'items', $modules );
return $tmpl->fetchPage();

View File

@ -1,16 +0,0 @@
<fieldset id="status_list" class="personalblock">
<legend><?php echo $l->t('Dependencies status');?></legend>
<ul class="state">
<?php foreach($_['items'] as $item):?>
<li class="state_<?php echo $item['status'];?>">
<span class="state_module" title="<?php echo $item['message'];?>"><?php echo $item['part'];?></span>
<div class="state_used"><?php echo $l->t('Used by :');?>
<ul>
<?php foreach($item['modules'] as $module):?>
<li><?php echo $module;?></li>
<?php endforeach;?>
</ul>
</li>
<?php endforeach;?>
</ul>
</fieldset>

View File

@ -1,33 +0,0 @@
<?php
/**
* ownCloud - admin_migrate
*
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\App::registerAdmin('admin_migrate','settings');
// add settings page to navigation
$entry = array(
'id' => "admin_migrate_settings",
'order'=>1,
'href' => OCP\Util::linkTo( "admin_migrate", "settings.php" ),
'name' => 'Export'
);

View File

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<info>
<id>admin_migrate</id>
<name>ownCloud Instance Migration</name>
<description>Import/Export your owncloud instance</description>
<licence>AGPL</licence>
<author>Thomas Schmidt and Tom Needham</author>
<require>4</require>
<shipped>true</shipped>
<default_enable/>
</info>

View File

@ -1 +0,0 @@
0.1

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Exporta aquesta instància de ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Això crearà un fitxer comprimit amb les dades d'aquesta instància ownCloud.\n Escolliu el tipus d'exportació:",
"Export" => "Exporta"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Export této instance ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Bude vytvořen komprimovaný soubor obsahující data této instance ownCloud.⏎ Zvolte typ exportu:",
"Export" => "Export"
);

View File

@ -1,4 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Eksporter ownCloud instans",
"Export" => "Eksporter"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Diese ownCloud-Instanz exportieren.",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Dies wird eine komprimierte Datei erzeugen, welche die Daten dieser ownCloud-Instanz enthält.\n Bitte wählen Sie den Exporttyp:",
"Export" => "Exportieren"
);

View File

@ -1,4 +0,0 @@
<?php $TRANSLATIONS = array(
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Αυτό θα δημιουργήσει ένα συμπιεσμένο αρχείο που θα περιέχει τα δεδομένα από αυτό το ownCloud.\n Παρακαλώ επιλέξτε τον τύπο εξαγωγής:",
"Export" => "Εξαγωγή"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Malenporti ĉi tiun aperon de ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Ĉi tio kreos densigitan dosieron, kiu enhavos la datumojn de ĉi tiu apero de ownCloud.\nBonvolu elekti la tipon de malenportado:",
"Export" => "Malenporti"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Exportar esta instancia de ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Se creará un archivo comprimido que contendrá los datos de esta instancia de owncloud.\n Por favor elegir el tipo de exportación:",
"Export" => "Exportar"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Ekspordi see ownCloudi paigaldus",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "See loob pakitud faili, milles on sinu owncloudi paigalduse andmed.\n Palun vali eksporditava faili tüüp:",
"Export" => "Ekspordi"
);

View File

@ -1,4 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Vie tämä ownCloud-istanssi",
"Export" => "Vie"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Exporter cette instance ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Ceci va créer une archive compressée contenant les données de cette instance ownCloud.\n Veuillez choisir le type d'export :",
"Export" => "Exporter"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Exporta esta instancia de ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Esto creará un ficheiro comprimido que contén os datos de esta instancia de ownCloud.\nPor favor escolla o modo de exportación:",
"Export" => "Exportar"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Esporta questa istanza di ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Questa operazione creerà un file compresso che contiene i dati dell'istanza di ownCloud. Scegli il tipo di esportazione:",
"Export" => "Esporta"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "ownCloudをエクスポート",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "このownCloudのデータを含む圧縮ファイルを生成します。\nエクスポートの種類を選択してください:",
"Export" => "エクスポート"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Eksportuoti šią ownCloud instaliaciją",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Bus sukurtas archyvas su visais owncloud duomenimis ir failais.\n Pasirinkite eksportavimo tipą:",
"Export" => "Eksportuoti"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Eksporter denne ownCloud forekomsten",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Dette vil opprette en komprimert fil som inneholder dataene fra denne ownCloud forekomsten.⏎ Vennligst velg eksporttype:",
"Export" => "Eksport"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Exporteer deze ownCloud instantie",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Dit maakt een gecomprimeerd bestand, met de inhoud van deze ownCloud instantie. Kies het export type:",
"Export" => "Exporteer"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Eksportuj instancję ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Spowoduje to utworzenie pliku skompresowanego, który zawiera dane tej instancji ownCloud.⏎ proszę wybrać typ eksportu:",
"Export" => "Eksport"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Экспортировать этот экземпляр ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Будет создан сжатый файл, содержащий данные этого экземпляра owncloud.\n Выберите тип экспорта:",
"Export" => "Экспорт"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Izvozi to ownCloud namestitev",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Ustvarjena bo stisnjena datoteka s podatki te ownCloud namestitve.\n Prosimo, če izberete vrsto izvoza:",
"Export" => "Izvozi"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "Exportera denna instans av ownCloud",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "Detta kommer att skapa en komprimerad fil som innehåller all data från denna instans av ownCloud.\n Välj exporttyp:",
"Export" => "Exportera"
);

View File

@ -1,5 +0,0 @@
<?php $TRANSLATIONS = array(
"Export this ownCloud instance" => "ส่งออกข้อมูลค่าสมมุติของ ownCloud นี้",
"This will create a compressed file that contains the data of this owncloud instance.\n Please choose the export type:" => "ส่วนนี้จะเป็นการสร้างไฟล์บีบอัดที่บรรจุข้อมูลค่าสมมุติของ ownCloud.\n กรุณาเลือกชนิดของการส่งออกข้อมูล:",
"Export" => "ส่งออก"
);

View File

@ -1,57 +0,0 @@
<?php
/**
* ownCloud - admin_migrate
*
* @author Thomas Schmidt
* @copyright 2011 Thomas Schmidt tom@opensuse.org
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\User::checkAdminUser();
OCP\App::checkAppEnabled('admin_migrate');
// Export?
if (isset($_POST['admin_export'])) {
// Create the export zip
$response = json_decode( OC_Migrate::export( null, $_POST['export_type'] ) );
if( !$response->success ){
// Error
die('error');
} else {
$path = $response->data;
// Download it
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($path));
header("Content-Length: " . filesize($path));
@ob_end_clean();
readfile( $path );
unlink( $path );
}
// Import?
} else if( isset($_POST['admin_import']) ){
$from = $_FILES['owncloud_import']['tmp_name'];
if( !OC_Migrate::import( $from, 'instance' ) ){
die('failed');
}
} else {
// fill template
$tmpl = new OCP\Template('admin_migrate', 'settings');
return $tmpl->fetchPage();
}

View File

@ -1,31 +0,0 @@
<form id="export" action="#" method="post">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('Export this ownCloud instance');?></strong></legend>
<p><?php echo $l->t('This will create a compressed file that contains the data of this owncloud instance.
Please choose the export type:');?>
</p>
<h3>What would you like to export?</h3>
<p>
<input type="radio" name="export_type" value="instance" style="width:20px;" /> ownCloud instance (suitable for import )<br />
<input type="radio" name="export_type" value="system" style="width:20px;" /> ownCloud system files<br />
<input type="radio" name="export_type" value="userfiles" style="width:20px;" /> Just user files<br />
<input type="submit" name="admin_export" value="<?php echo $l->t('Export'); ?>" />
</fieldset>
</form>
<?php
/*
* EXPERIMENTAL
?>
<form id="import" action="#" method="post" enctype="multipart/form-data">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('Import an ownCloud instance. THIS WILL DELETE ALL CURRENT OWNCLOUD DATA');?></strong></legend>
<p><?php echo $l->t('All current ownCloud data will be replaced by the ownCloud instance that is uploaded.');?>
</p>
<p><input type="file" id="owncloud_import" name="owncloud_import"><label for="owncloud_import"><?php echo $l->t('ownCloud Export Zip File');?></label>
</p>
<input type="submit" name="admin_import" value="<?php echo $l->t('Import'); ?>" />
</fieldset>
</form>
<?php
*/
?>

View File

@ -1,33 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('bookmarks');
require_once('bookmarksHelper.php');
addBookmark($_GET['url'], '', 'Read-Later');
include 'templates/addBm.php';

View File

@ -1,37 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
//no apps or filesystem
$RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php');
$id = addBookmark($_POST['url'], $_POST['title'], $_POST['tags']);
OCP\JSON::success(array('data' => $id));

View File

@ -1,37 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('bookmarks');
OCP\JSON::callCheck();
$id = $_POST['id'];
if (!OC_Bookmarks_Bookmarks::deleteUrl($id)){
OC_JSON::error();
exit();
}
OCP\JSON::success();

View File

@ -1,90 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin - edit bookmark script
*
* @author Golnaz Nilieh
* @copyright 2011 Golnaz Nilieh <golnaz.nilieh@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
$_ut = "strftime('%s','now')";
} elseif($CONFIG_DBTYPE == 'pgsql') {
$_ut = 'date_part(\'epoch\',now())::integer';
} elseif($CONFIG_DBTYPE == 'oci') {
$_ut = '(oracletime - to_date(\'19700101\',\'YYYYMMDD\')) * 86400';
} else {
$_ut = "UNIX_TIMESTAMP()";
}
$bookmark_id = (int)$_POST["id"];
$user_id = OCP\USER::getUser();
//TODO check using CURRENT_TIMESTAMP? prepare already does magic when using now()
$query = OCP\DB::prepare('
UPDATE `*PREFIX*bookmarks`
SET `url` = ?, `title` = ?, `lastmodified` = '.$_ut.'
WHERE `id` = ?
AND `user_id` = ?
');
$params=array(
htmlspecialchars_decode($_POST["url"]),
htmlspecialchars_decode($_POST["title"]),
$bookmark_id,
$user_id,
);
$result = $query->execute($params);
# Abort the operation if bookmark couldn't be set (probably because the user is not allowed to edit this bookmark)
if ($result->numRows() == 0) exit();
# Remove old tags and insert new ones.
$query = OCP\DB::prepare('
DELETE FROM `*PREFIX*bookmarks_tags`
WHERE `bookmark_id` = ?
');
$params=array(
$bookmark_id
);
$query->execute($params);
$query = OCP\DB::prepare('
INSERT INTO `*PREFIX*bookmarks_tags`
(`bookmark_id`, `tag`)
VALUES (?, ?)
');
$tags = explode(' ', urldecode($_POST["tags"]));
foreach ($tags as $tag) {
if(empty($tag)) {
//avoid saving blankspaces
continue;
}
$params = array($bookmark_id, trim($tag));
$query->execute($params);
}

View File

@ -1,39 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
$query = OCP\DB::prepare('
UPDATE `*PREFIX*bookmarks`
SET `clickcount` = `clickcount` + 1
WHERE `user_id` = ?
AND `url` LIKE ?
');
$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_POST["url"]));
$bookmarks = $query->execute($params);
header( "HTTP/1.1 204 No Content" );

View File

@ -1,45 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
* @copyright 2012 David Iwanowitsch <david at unclouded dot de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
//Filter for tag?
$filterTag = isset($_POST['tag']) ? htmlspecialchars_decode($_POST['tag']) : false;
$offset = isset($_POST['page']) ? intval($_POST['page']) * 10 : 0;
$sort = isset($_POST['sort']) ? ($_POST['sort']) : 'bookmarks_sorting_recent';
if($sort == 'bookmarks_sorting_clicks') {
$sqlSortColumn = 'clickcount';
} else {
$sqlSortColumn = 'id';
}
$bookmarks = OC_Bookmarks_Bookmarks::findBookmarks($offset, $sqlSortColumn, $filterTag, true);
OCP\JSON::success(array('data' => $bookmarks));

View File

@ -1,19 +0,0 @@
<?php
/**
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php';
OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php';
$l = new OC_l10n('bookmarks');
OCP\App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OCP\Util::linkTo( 'bookmarks', 'index.php' ), 'icon' => OCP\Util::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks')));
OCP\App::registerPersonal('bookmarks', 'settings');
OCP\Util::addscript('bookmarks','bookmarksearch');
OC_Search::registerProvider('OC_Search_Provider_Bookmarks');

View File

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
<charset>utf8</charset>
<table>
<name>*dbprefix*bookmarks</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<autoincrement>1</autoincrement>
<default>0</default>
<notnull>true</notnull>
<length>4</length>
</field>
<field>
<name>url</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>4096</length>
</field>
<field>
<name>title</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>140</length>
</field>
<field>
<name>user_id</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>public</name>
<type>integer</type>
<default>0</default>
<length>1</length>
</field>
<field>
<name>added</name>
<type>integer</type>
<default></default>
<notnull>false</notnull>
<unsigned>true</unsigned>
<length>4</length>
</field>
<field>
<name>lastmodified</name>
<type>integer</type>
<default></default>
<notnull>false</notnull>
<unsigned>true</unsigned>
<length>4</length>
</field>
<field>
<name>clickcount</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
<length>4</length>
</field>
<index>
<name>id</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>descending</sorting>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*bookmarks_tags</name>
<declaration>
<field>
<name>bookmark_id</name>
<type>integer</type>
<length>64</length>
</field>
<field>
<name>tag</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>255</length>
</field>
<index>
<name>bookmark_tag</name>
<unique>true</unique>
<field>
<name>bookmark_id</name>
<sorting>ascending</sorting>
</field>
<field>
<name>tag</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
</database>

View File

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<info>
<id>bookmarks</id>
<name>Bookmarks</name>
<description>Bookmark manager for ownCloud</description>
<licence>AGPL</licence>
<author>Arthur Schiwon, Marvin Thomas Rabe</author>
<standalone/>
<require>4</require>
<shipped>true</shipped>
</info>

View File

@ -1,68 +0,0 @@
<?php
class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{
// Create the xml for the user supplied
function export( ){
$options = array(
'table'=>'bookmarks',
'matchcol'=>'user_id',
'matchval'=>$this->uid,
'idcol'=>'id'
);
$ids = $this->content->copyRows( $options );
$options = array(
'table'=>'bookmarks_tags',
'matchcol'=>'bookmark_id',
'matchval'=>$ids
);
// Export tags
$ids2 = $this->content->copyRows( $options );
// If both returned some ids then they worked
if( is_array( $ids ) && is_array( $ids2 ) )
{
return true;
} else {
return false;
}
}
// Import function for bookmarks
function import( ){
switch( $this->appinfo->version ){
default:
// All versions of the app have had the same db structure, so all can use the same import function
$query = $this->content->prepare( "SELECT * FROM `bookmarks` WHERE `user_id` LIKE ?" );
$results = $query->execute( array( $this->olduid ) );
$idmap = array();
while( $row = $results->fetchRow() ){
// Import each bookmark, saving its id into the map
$query = OCP\DB::prepare( "INSERT INTO `*PREFIX*bookmarks`(`url`, `title`, `user_id`, `public`, `added`, `lastmodified`) VALUES (?, ?, ?, ?, ?, ?)" );
$query->execute( array( $row['url'], $row['title'], $this->uid, $row['public'], $row['added'], $row['lastmodified'] ) );
// Map the id
$idmap[$row['id']] = OCP\DB::insertid();
}
// Now tags
foreach($idmap as $oldid => $newid){
$query = $this->content->prepare( "SELECT * FROM `bookmarks_tags` WHERE `bookmark_id` LIKE ?" );
$results = $query->execute( array( $oldid ) );
while( $row = $results->fetchRow() ){
// Import the tags for this bookmark, using the new bookmark id
$query = OCP\DB::prepare( "INSERT INTO `*PREFIX*bookmarks_tags`(`bookmark_id`, `tag`) VALUES (?, ?)" );
$query->execute( array( $newid, $row['tag'] ) );
}
}
// All done!
break;
}
return true;
}
}
// Load the provider
new OC_Migration_Provider_Bookmarks( 'bookmarks' );

View File

@ -1 +0,0 @@
0.2

View File

@ -1,130 +0,0 @@
<?php
// Source: http://www.php.net/manual/de/function.curl-setopt.php#102121
// This works around a safe_mode/open_basedir restriction
function curl_exec_follow(/*resource*/ $ch, /*int*/ &$maxredirect = null) {
$mr = $maxredirect === null ? 5 : intval($maxredirect);
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, $mr);
} else {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
if ($mr > 0) {
$newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$rch = curl_copy_handle($ch);
curl_setopt($rch, CURLOPT_HEADER, true);
curl_setopt($rch, CURLOPT_NOBODY, true);
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
curl_setopt($rch, CURLOPT_RETURNTRANSFER, true);
do {
curl_setopt($rch, CURLOPT_URL, $newurl);
$header = curl_exec($rch);
if (curl_errno($rch)) {
$code = 0;
} else {
$code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
if ($code == 301 || $code == 302) {
preg_match('/Location:(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
} else {
$code = 0;
}
}
} while ($code && --$mr);
curl_close($rch);
if (!$mr) {
if ($maxredirect === null) {
trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING);
} else {
$maxredirect = 0;
}
return false;
}
curl_setopt($ch, CURLOPT_URL, $newurl);
}
}
return curl_exec($ch);
}
function getURLMetadata($url) {
//allow only http(s) and (s)ftp
$protocols = '/^[hs]{0,1}[tf]{0,1}tp[s]{0,1}\:\/\//i';
//if not (allowed) protocol is given, assume http
if(preg_match($protocols, $url) == 0) {
$url = 'http://' . $url;
}
$metadata['url'] = $url;
if (!function_exists('curl_init')){
return $metadata;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec_follow($ch);
curl_close($ch);
@preg_match( "/<title>(.*)<\/title>/si", $page, $match );
$metadata['title'] = htmlspecialchars_decode(@$match[1]);
return $metadata;
}
function addBookmark($url, $title, $tags='') {
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
$_ut = "strftime('%s','now')";
} elseif($CONFIG_DBTYPE == 'pgsql') {
$_ut = 'date_part(\'epoch\',now())::integer';
} else {
$_ut = "UNIX_TIMESTAMP()";
}
//FIXME: Detect when user adds a known URL
$query = OCP\DB::prepare("
INSERT INTO `*PREFIX*bookmarks`
(`url`, `title`, `user_id`, `public`, `added`, `lastmodified`)
VALUES (?, ?, ?, 0, $_ut, $_ut)
");
if(empty($title)) {
$metadata = getURLMetadata($url);
if(isset($metadata['title'])) // Check for problems fetching the title
$title = $metadata['title'];
}
if(empty($title)) {
$l = OC_L10N::get('bookmarks');
$title = $l->t('unnamed');
}
$params=array(
htmlspecialchars_decode($url),
htmlspecialchars_decode($title),
OCP\USER::getUser()
);
$query->execute($params);
$b_id = OCP\DB::insertid('*PREFIX*bookmarks');
if($b_id !== false) {
$query = OCP\DB::prepare("
INSERT INTO `*PREFIX*bookmarks_tags`
(`bookmark_id`, `tag`)
VALUES (?, ?)
");
$tags = explode(' ', urldecode($tags));
foreach ($tags as $tag) {
if(empty($tag)) {
//avoid saving blankspaces
continue;
}
$params = array($b_id, trim($tag));
$query->execute($params);
}
return $b_id;
}
}

View File

@ -1,87 +0,0 @@
#content { overflow: auto; height: 100%; }
#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777; position: relative;}
#firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; }
#firstrun .button { font-size: 0.7em; }
#firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; }
.bookmarks_headline {
font-size: large;
font-weight: bold;
margin-left: 2em;
padding: 2.5ex 0.5ex;
}
.bookmarks_menu {
margin-left: 1.5em;
padding: 0.5ex;
}
.bookmarks_list {
overflow: auto;
position: fixed;
top: 6.5em;
}
.bookmarks_addBml {
text-decoration: underline;
}
.bookmarks_label {
width: 7em;
display: inline-block;
text-align: right;
}
.bookmarks_input {
width: 8em;
}
.bookmark_actions {
position: absolute;
right: 1em;
top: 0.7em;
display: none;
}
.bookmark_actions span { margin: 0 0.4em; }
.bookmark_actions img { opacity: 0.3; }
.bookmark_actions img:hover { opacity: 1; cursor: pointer; }
.bookmark_single {
position: relative;
padding: 0.5em 1em;
border-bottom: 1px solid #DDD;
-webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms;
}
.bookmark_single:hover {
background-color:#f8f8f8
}
.bookmark_single:hover .bookmark_actions {
display: block;
}
.bookmark_title { font-weight: bold; display: inline-block; margin-right: 0.8em; }
.bookmark_url { display: none; color: #999; }
.bookmark_single:hover .bookmark_url { display: inline; }
.bookmark_tags {
position: absolute;
top: 0.5em;
right: 6em;
text-align: right;
}
.bookmark_tag {
display: inline-block;
color: white;
margin: 0 0.2em;
padding: 0 0.4em;
background-color: #1D2D44;
border-radius: 0.4em;
opacity: 0.2;
}
.bookmark_tag:hover { opacity: 0.5; }
.loading_meta {
display: none;
margin-left: 5px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

View File

@ -1,37 +0,0 @@
<?php
/**
* ownCloud - bookmarks plugin
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('bookmarks');
OCP\App::setActiveNavigationEntry( 'bookmarks_index' );
OCP\Util::addscript('bookmarks','bookmarks');
OCP\Util::addStyle('bookmarks', 'bookmarks');
$tmpl = new OCP\Template( 'bookmarks', 'list', 'user' );
$tmpl->printPage();

View File

@ -1,16 +0,0 @@
$(document).ready(function() {
$('#bookmark_add_submit').click(addBookmark);
});
function addBookmark(event) {
var url = $('#bookmark_add_url').val();
var tags = $('#bookmark_add_tags').val();
$.ajax({
type: 'POST',
url: 'ajax/addBookmark.php',
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
success: function(data){
window.close();
}
});
}

View File

@ -1,201 +0,0 @@
var bookmarks_page = 0;
var bookmarks_loading = false;
var bookmarks_sorting = 'bookmarks_sorting_recent';
$(document).ready(function() {
$('#bookmark_add_submit').click(addOrEditBookmark);
$(window).resize(function () {
fillWindow($('.bookmarks_list'));
});
$(window).resize();
$('.bookmarks_list').scroll(updateOnBottom).empty().width($('#content').width());
getBookmarks();
});
function getBookmarks() {
if(bookmarks_loading) {
//have patience :)
return;
}
$.ajax({
type: 'POST',
url: OC.filePath('bookmarks', 'ajax', 'updateList.php'),
data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
success: function(bookmarks){
if (bookmarks.data.length) {
bookmarks_page += 1;
}
$('.bookmark_link').unbind('click', recordClick);
$('.bookmark_delete').unbind('click', delBookmark);
$('.bookmark_edit').unbind('click', showBookmark);
for(var i in bookmarks.data) {
updateBookmarksList(bookmarks.data[i]);
$("#firstrun").hide();
}
if($('.bookmarks_list').is(':empty')) {
$("#firstrun").show();
}
$('.bookmark_link').click(recordClick);
$('.bookmark_delete').click(delBookmark);
$('.bookmark_edit').click(showBookmark);
bookmarks_loading = false;
if (bookmarks.data.length) {
updateOnBottom()
}
}
});
}
// function addBookmark() {
// Instead of creating editBookmark() function, Converted the one above to
// addOrEditBookmark() to make .js file more compact.
function addOrEditBookmark(event) {
var id = $('#bookmark_add_id').val();
var url = encodeEntities($('#bookmark_add_url').val());
var title = encodeEntities($('#bookmark_add_title').val());
var tags = encodeEntities($('#bookmark_add_tags').val());
$("#firstrun").hide();
if($.trim(url) == '') {
OC.dialogs.alert('A valid bookmark url must be provided', 'Error creating bookmark');
return false;
}
if($.trim(title) == '') {
OC.dialogs.alert('A valid bookmark title must be provided', 'Error creating bookmark');
return false;
}
if (id == 0) {
$.ajax({
type: 'POST',
url: OC.filePath('bookmarks', 'ajax', 'addBookmark.php'),
data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
success: function(response){
$('.bookmarks_input').val('');
$('.bookmarks_list').empty();
bookmarks_page = 0;
getBookmarks();
}
});
}
else {
$.ajax({
type: 'POST',
url: OC.filePath('bookmarks', 'ajax', 'editBookmark.php'),
data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
success: function(){
$('.bookmarks_input').val('');
$('#bookmark_add_id').val('0');
$('.bookmarks_list').empty();
bookmarks_page = 0;
getBookmarks();
}
});
}
}
function delBookmark(event) {
var record = $(this).parent().parent();
$.ajax({
type: 'POST',
url: OC.filePath('bookmarks', 'ajax', 'delBookmark.php'),
data: 'id=' + record.data('id'),
success: function(data){
if (data.status == 'success') {
record.remove();
if($('.bookmarks_list').is(':empty')) {
$("#firstrun").show();
}
}
}
});
}
function showBookmark(event) {
var record = $(this).parent().parent();
$('#bookmark_add_id').val(record.attr('data-id'));
$('#bookmark_add_url').val(record.children('.bookmark_url:first').text());
$('#bookmark_add_title').val(record.children('.bookmark_title:first').text());
$('#bookmark_add_tags').val(record.children('.bookmark_tags:first').text());
if ($('.bookmarks_add').css('display') == 'none') {
$('.bookmarks_add').slideToggle();
}
}
function replaceQueryString(url,param,value) {
var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
if (url.match(re))
return url.replace(re,'$1' + param + "=" + value + '$2');
else
return url + '&' + param + "=" + value;
}
function updateBookmarksList(bookmark) {
var tags = encodeEntities(bookmark.tags).split(' ');
var taglist = '';
for ( var i=0, len=tags.length; i<len; ++i ){
if(tags[i] != '')
taglist = taglist + '<a class="bookmark_tag" href="'+replaceQueryString( String(window.location), 'tag', encodeURIComponent(tags[i])) + '">' + tags[i] + '</a> ';
}
if(!hasProtocol(bookmark.url)) {
bookmark.url = 'http://' + bookmark.url;
}
if(bookmark.title == '') bookmark.title = bookmark.url;
$('.bookmarks_list').append(
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
'<p class="bookmark_actions">' +
'<span class="bookmark_edit">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
'</span>' +
'<span class="bookmark_delete">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
'</span>&nbsp;' +
'</p>' +
'<p class="bookmark_title">'+
'<a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a>' +
'</p>' +
'<p class="bookmark_url"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.url) + '</a></p>' +
'</div>'
);
if(taglist != '') {
$('div[data-id="'+ bookmark.id +'"]').append('<p class="bookmark_tags">' + taglist + '</p>');
}
}
function updateOnBottom() {
//check wether user is on bottom of the page
var top = $('.bookmarks_list>:last-child').position().top;
var height = $('.bookmarks_list').height();
// use a bit of margin to begin loading before we are really at the
// bottom
if (top < height * 1.2) {
getBookmarks();
}
}
function recordClick(event) {
$.ajax({
type: 'POST',
url: OC.filePath('bookmarks', 'ajax', 'recordClick.php'),
data: 'url=' + encodeURIComponent($(this).attr('href')),
});
}
function encodeEntities(s){
try {
return $('<div/>').text(s).html();
} catch (ex) {
return "";
}
}
function hasProtocol(url) {
var regexp = /(ftp|http|https|sftp)/;
return regexp.test(url);
}

View File

@ -1,23 +0,0 @@
/**
* Copyright (c) 2012 David Iwanowitsch <david at unclouded dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$(document).ready(function(){
OC.search.customResults['Bookm.'] = function(row,item){
var a=row.find('a');
a.attr('target','_blank');
a.click(recordClick);
}
});
function recordClick(event) {
var jsFileLocation = $('script[src*=bookmarksearch]').attr('src');
jsFileLocation = jsFileLocation.replace('js/bookmarksearch.js', '');
$.ajax({
type: 'POST',
url: jsFileLocation + 'ajax/recordClick.php',
data: 'url=' + encodeURI($(this).attr('href')),
});
}

View File

@ -1,12 +0,0 @@
<?php $TRANSLATIONS = array(
"Bookmarks" => "Отметки",
"unnamed" => "неозаглавено",
"Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:" => "Завлачете това в лентата с отметки на браузъра си и го натискайте, когато искате да отметнете бързо някоя страница:",
"Read later" => "Отмятане",
"Address" => "Адрес",
"Title" => "Заглавие",
"Tags" => "Етикети",
"Save bookmark" => "Запис на отметката",
"You have no bookmarks" => "Нямате отметки",
"Bookmarklet <br />" => "Бутон за отметки <br />"
);

View File

@ -1,12 +0,0 @@
<?php $TRANSLATIONS = array(
"Bookmarks" => "Adreces d'interès",
"unnamed" => "sense nom",
"Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:" => "Arrossegueu-ho al navegador i feu-hi un clic quan volgueu marcar ràpidament una adreça d'interès:",
"Read later" => "Llegeix més tard",
"Address" => "Adreça",
"Title" => "Títol",
"Tags" => "Etiquetes",
"Save bookmark" => "Desa l'adreça d'interès",
"You have no bookmarks" => "No teniu adreces d'interès",
"Bookmarklet <br />" => "Bookmarklet <br />"
);

View File

@ -1,12 +0,0 @@
<?php $TRANSLATIONS = array(
"Bookmarks" => "Záložky",
"unnamed" => "nepojmenovaný",
"Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:" => "Přetáhněte do Vašeho prohlížeče a kliněte, pokud si přejete rychle uložit stranu do záložek:",
"Read later" => "Přečíst později",
"Address" => "Adresa",
"Title" => "Název",
"Tags" => "Tagy",
"Save bookmark" => "Uložit záložku",
"You have no bookmarks" => "Nemáte žádné záložky",
"Bookmarklet <br />" => "Záložky <br />"
);

Some files were not shown because too many files have changed in this diff Show More