-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix CSS Dependency check for MySQL
- Loading branch information
Patt92
committed
Feb 11, 2016
1 parent
f1623ef
commit d8700d1
Showing
49 changed files
with
2,146 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace OCA\files_w2g; | ||
|
||
\OCP\User::checkAdminUser(); | ||
|
||
$tem = new \OCP\Template(app::name, 'admin'); | ||
return $tem->fetchPage(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace OCA\files_w2g; | ||
|
||
\OCP\JSON::checkLoggedIn(); | ||
\OCP\JSON::callCheck(); | ||
|
||
switch($_POST['action']) | ||
{ | ||
case 'clearall': | ||
\OCP\DB::prepare("TRUNCATE *PREFIX*".app::table)->execute(); | ||
echo "clear"; | ||
break; | ||
|
||
case 'clearthis': | ||
\OCP\DB::prepare("DELETE FROM *PREFIX*".app::table." WHERE name=?")->execute(array($_POST['lock'])); | ||
echo "clear"; | ||
break; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
\OCP\JSON::checkLoggedIn(); | ||
\OCP\JSON::callCheck(); | ||
|
||
$query = @OCP\DB::prepare("SELECT * FROM *PREFIX*appconfig where configkey=? and appid='files_w2g' LIMIT 1"); | ||
$result = @$query->execute(array($_POST['type']))->fetchAll(); | ||
|
||
if(count($result)>=1) echo $result[0]['configvalue']; | ||
|
||
else echo ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace OCA\files_w2g; | ||
|
||
\OCP\JSON::checkLoggedIn(); | ||
\OCP\JSON::callCheck(); | ||
|
||
$mode = ""; | ||
$value = ""; | ||
|
||
try{ | ||
$mode = $_POST['mode']; | ||
$value = $_POST['value']; | ||
} | ||
catch(Exception $e) | ||
{ echo "Ajax modification detected";return; } | ||
|
||
$l = \OCP\Util::getL10N(app::name); | ||
$query = \OCP\DB::prepare("SELECT * FROM *PREFIX*appconfig where configkey=? and appid='files_w2g' LIMIT 1"); | ||
$result = $query->execute(array($mode))->fetchAll(); | ||
|
||
if(count($result)<1)//Value already set? | ||
{ | ||
$query = \OCP\DB::prepare("INSERT INTO *PREFIX*appconfig(appid,configkey,configvalue) value('files_w2g',?,?)"); | ||
$result = $query->execute(array($mode,$value)); | ||
echo $l->t($mode)." ".$l->t("has been set!"); | ||
} | ||
else | ||
{ | ||
$query = \OCP\DB::prepare("UPDATE *PREFIX*appconfig set configvalue=? WHERE appid='files_w2g' and configkey=?"); | ||
$result = $query->execute(array($value,$mode)); | ||
echo $l->t("Updated successfully!"); | ||
|
||
|
||
} |
151 changes: 151 additions & 0 deletions
151
Old Releases/Owncloud 8.2.2/files_w2g/ajax/workin2gether.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<?php | ||
|
||
namespace OCA\files_w2g; | ||
|
||
//Init translations | ||
\OCP\Util::addTranslations('files_w2g'); | ||
$l = \OCP\Util::getL10N('files_w2g'); | ||
|
||
//Requirements check | ||
\OCP\JSON::checkLoggedIn(); | ||
\OCP\JSON::checkAppEnabled('files_w2g'); | ||
\OCP\JSON::callCheck(); | ||
|
||
//////////////////////////////////////////////////// | ||
//// variables for lock management //// | ||
/**/ $path = stripslashes($_POST['path']) ; /**/ | ||
/**/ $safe = null; /**/ | ||
/**/ $owner = null; /**/ | ||
/**/ $id = null; /**/ | ||
//////////////////////////////////////////////////// | ||
|
||
//Naming = Showing the name, who locked the File | ||
//Implemented: rule_username|rule_displayname | ||
$naming = "rule_username"; | ||
db_fetcher($naming, 'suffix' ); | ||
|
||
$extended = "0"; | ||
db_fetcher($extended, 'extended'); | ||
|
||
//Get all POST type variables | ||
if (isset($_POST['safe'])) { | ||
$safe = $_POST['safe']; | ||
} | ||
|
||
if (isset($_POST['owner'])) { | ||
$owner = $_POST['owner']; | ||
} | ||
|
||
if (isset($_POST['id'])) { | ||
$id = $_POST['id']; | ||
} | ||
//<- End POST type variables section | ||
|
||
$ppath = lockname($path); | ||
|
||
//Grab the share data | ||
if (!is_null($owner) && $owner !== '') { | ||
$query = \OCP\DB::prepare("SELECT X.path, Y.id FROM *PREFIX*filecache X INNER JOIN *PREFIX*storages Y ON X.storage = Y.numeric_id where X.fileid = ? LIMIT 1"); | ||
$result = $query->execute(array($id))->fetchAll(); | ||
|
||
$original_path = $result[0]['path']; | ||
$storage_id = str_replace("home::", "", $result[0]['id']) . '/'; | ||
|
||
$lockpath = $storage_id.$original_path; | ||
} | ||
else $lockpath = \OCP\USER::getUser()."/files".cleanPath($path); | ||
|
||
//Lock DB entry | ||
$lockfile = lockname($lockpath); | ||
$db_lock_state = \OCP\DB::prepare("SELECT * FROM *PREFIX*" . app::table . " WHERE name = ?")->execute(array($lockfile))->fetchAll(); | ||
|
||
//If lock exist, unlock it, but check the safemode | ||
if ($db_lock_state!=null) { | ||
if($safe=="false") { | ||
$lockedby_name = $db_lock_state[0]['locked_by']; | ||
ShowUserName($lockedby_name); | ||
|
||
if( extended_precheck( $extended, $lockedby_name ) != 0 ){ | ||
echo $l->t("No permission"); | ||
return; | ||
} | ||
|
||
\OCP\DB::prepare("DELETE FROM *PREFIX*" . app::table . " WHERE name=?")->execute(array($lockfile)); | ||
echo $l->t("File not locked"); | ||
} | ||
else{ | ||
$lockedby_name = $db_lock_state[0]['locked_by']; | ||
ShowDisplayName($lockedby_name); | ||
echo $l->t("Status: locked")." ".$l->t("by")." ".$lockedby_name; | ||
} | ||
} | ||
//If not locked, lock it, but check the safemode | ||
else { | ||
if($safe=="false") { | ||
$lockedby_name = \OCP\User::getUser(); | ||
if($naming=="rule_displayname") { | ||
$lockedby_name = \OCP\User::getDisplayName(); | ||
$lockedby_name .= "|".\OCP\User::getUser(); | ||
} | ||
|
||
\OCP\DB::prepare("INSERT INTO *PREFIX*".app::table."(name,locked_by) VALUES(?,?)")->execute(array($lockfile,$lockedby_name)); | ||
|
||
//For Compatibiliy reasons, support old Lockedby type <0.8 | ||
|
||
ShowDisplayName($lockedby_name); //Korrektur bei DisplayName | ||
echo $l->t("File is locked")." ".$l->t("by")." ".$lockedby_name; | ||
} | ||
else echo $l->t("Status: not locked"); | ||
} | ||
|
||
//Functions | ||
|
||
function lockname($path){ | ||
//Replace all '/' with $ for a filename for the lock file | ||
$ppath = str_replace("/","$",cleanPath($path))."$"; | ||
$ppath = str_replace(":","#",$ppath); | ||
|
||
//Remove double dollar char when exist | ||
if ($ppath[0] == "$" and $ppath[1] == "$") $ppath = substr($ppath,1); | ||
|
||
return preg_replace('/\\\/','$',$ppath); | ||
} | ||
|
||
function cleanPath($path){ | ||
return preg_replace('{(/)\1+}', "/", urldecode(rtrim($path, "/"))); | ||
} | ||
|
||
function db_fetcher( &$configkey, $configtype ){ | ||
$type = \OCP\DB::prepare("SELECT * FROM *PREFIX*appconfig where configkey=? and appid='files_w2g' LIMIT 1")->execute(array($configtype))->fetchAll(); | ||
|
||
if (count($type) >= 1) | ||
$configkey = $type[0]['configvalue']; | ||
} | ||
|
||
function extended_precheck( $extended, $owner ){ | ||
//Return 0 = allowed | Return 1 = Forbidden | ||
if ( $extended == "0" ) | ||
return 0; | ||
elseif ( $extended == "1" ) | ||
{ | ||
if( $owner == \OCP\User::getUser() ) | ||
return 0; | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
function ShowDisplayName(&$lockedby_name){ | ||
if(strstr($lockedby_name,"|")){ | ||
$temp_ln = explode("|",$lockedby_name); | ||
$lockedby_name = $temp_ln[0]; | ||
} | ||
} | ||
|
||
function ShowUserName(&$lockedby_name){ | ||
if(strstr($lockedby_name,"|")){ | ||
$temp_ln = explode("|",$lockedby_name); | ||
$lockedby_name = $temp_ln[1]; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace OCA\files_w2g; | ||
|
||
\OCP\Util::addTranslations('files_w2g'); | ||
|
||
$l = \OCP\Util::getL10N('files_w2g'); | ||
|
||
class app{ | ||
|
||
const name = 'files_w2g'; | ||
|
||
const table = 'locks_w2g'; | ||
|
||
const charset = 'DEFAULT CHARACTER SET=utf8 DEFAULT COLLATE=utf8_bin'; | ||
|
||
public static function launch() | ||
{ | ||
|
||
\OCP\Util::addScript( self::name, 'workin2gether'); | ||
|
||
\OCP\Util::addstyle( self::name, 'styles'); | ||
|
||
\OCP\App::registerAdmin(self::name, 'admin'); | ||
|
||
} | ||
|
||
} | ||
|
||
if (\OCP\App::isEnabled(app::name)) { | ||
|
||
//Check if DB exist | ||
$db_exist = \OCP\DB::prepare("SHOW TABLES LIKE '*PREFIX*".app::table."'")->execute()->fetchAll(); | ||
|
||
if($db_exist==null){ | ||
@$db_exist = \OCP\DB::prepare("CREATE table *PREFIX*" . app::table . "(name varchar(255) PRIMARY KEY,created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,locked_by varchar(255)) " . app::charset); | ||
@$db_exist->execute(); | ||
} | ||
|
||
app::launch(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0"?> | ||
<info> | ||
<id>files_w2g</id> | ||
<name>Workin2gether</name> | ||
<description> | ||
Pseudo multiaccess-management feature for Owncloud. | ||
You can lock files and disable the fileactions, leaving only the fileaction of unlocking a file. | ||
Please leave your feedback and rate this app, if you like it! | ||
</description> | ||
<default_enable/> | ||
<licence>AGPL</licence> | ||
<author>Patrick Hoffmann</author> | ||
<require>8.00</require> | ||
<types> | ||
<filesystem/> | ||
</types> | ||
<ocsid>164016</ocsid> | ||
<dependencies> | ||
<database>mysql</database> | ||
</dependencies> | ||
</info> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace OCA\files_w2g\AppInfo; | ||
|
||
|
||
$this->create('files_w2g_ajax_getcolor', 'ajax/getcolor.php') | ||
->actionInclude('files_w2g/ajax/getcolor.php'); | ||
|
||
$this->create('files_w2g_ajax_core', 'ajax/workin2gether.php') | ||
->actionInclude('files_w2g/ajax/workin2gether.php'); | ||
|
||
$this->create('files_w2g_ajax_update', 'ajax/update.php') | ||
->actionInclude('files_w2g/ajax/update.php'); | ||
|
||
$this->create('files_w2g_ajax_admin_db', 'ajax/admin_db.php') | ||
->actionInclude('files_w2g/ajax/admin_db.php'); | ||
|
||
$this->create('files_w2g_admin', 'admin.php') | ||
->actionInclude('files_w2g/admin.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.8.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
a.action.locked{ display:none !important; } | ||
|
||
a.action-getstate_w2g.locked{ display:inline !important; } | ||
|
||
a.statelock a.action[data-action!=getstate_dir&&data-action!=getstate_file]{ | ||
pointer-events:none; | ||
} | ||
a.namelock | ||
{ | ||
line-height: 50px; | ||
padding: 0; | ||
} | ||
a.namelock .nametext{position:absolute !important;left:105px !important;} | ||
|
||
td.statelock:focus{pointer-events:none;} | ||
|
||
a.action-getstate_w2g{ cursor:pointer !important;} | ||
|
||
a.name.statelock a.action{ color:#eee; opacity:1 !important; } | ||
|
||
a.name.statelock a.action:hover, a.name.statelock span.extension{ color:#fff; } | ||
|
||
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled{ opacity:1.0;} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.