This repository has been archived by the owner on Mar 6, 2020. It is now read-only.
forked from T-a-z/sharerenamer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dreamy
committed
Feb 14, 2018
1 parent
47476f0
commit 5f5d9eb
Showing
10 changed files
with
215 additions
and
217 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Authors | ||
|
||
* Fallon Turner <[email protected]> | ||
* Dreamy <[email protected]> |
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
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
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
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<info> | ||
<id>sharerenamer</id> | ||
<name>Files Share Link Renamer</name> | ||
<description>This is an add-in to the Files app, which allows you to customize your share tokens, so your links can be https://cloud.ex/s/bachelorparty instead of https://cloud.ex/s/qPv1SwbU5M2YEoJZ. Just share a file or folder (or click an already shared one) and a new button will appear below the share link URL in the sidebar of the Files app. | ||
</description> | ||
<licence>AGPL</licence> | ||
<author>Fallon Turner</author> | ||
<version>1.3</version> | ||
<namespace>ShareRenamer</namespace> | ||
<category>Tool</category> | ||
<dependencies> | ||
<owncloud min-version="8.0" max-version="11.0"/> | ||
<nextcloud min-version="9.0" max-version="11.0"/> | ||
</dependencies> | ||
<id>sharerenamer</id> | ||
<name>Files Share Link Renamer</name> | ||
<description>This is an add-in to the Files app, which allows you to customize your share tokens, so your links can be https://cloud.ex/s/bachelorparty instead of https://cloud.ex/s/qPv1SwbU5M2YEoJZ. Just share a file or folder (or click an already shared one) and a new button will appear below the share link URL in the sidebar of the Files app. | ||
</description> | ||
<licence>AGPL</licence> | ||
<author>Fallon Turner</author> | ||
<version>1.4</version> | ||
<namespace>ShareRenamer</namespace> | ||
<category>Tool</category> | ||
<dependencies> | ||
<owncloud min-version="9.0" max-version="11.0"/> | ||
<nextcloud min-version="9.0" max-version="13.0"/> | ||
</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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<?php | ||
return [ | ||
'resources' => [ | ||
'sharerenamer' => ['url' => '/sharerenamer'] | ||
], | ||
'routes' => [ | ||
['name' => 'sharerenamer#rename', 'url' => '/rename', 'verb' => 'POST'] | ||
] | ||
'resources' => [ | ||
'sharerenamer' => ['url' => '/sharerenamer'] | ||
], | ||
'routes' => [ | ||
['name' => 'sharerenamer#rename', 'url' => '/rename', 'verb' => 'POST'] | ||
] | ||
]; |
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
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
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<?php | ||
namespace OCA\ShareRenamer\Db; | ||
|
||
use \OCP\IDb; | ||
use \OCP\IDBConnection; | ||
use \OCP\AppFramework\Db\Mapper; | ||
|
||
class ShareRenamerMapper extends Mapper { | ||
|
||
public function __construct(IDb $db) { | ||
parent::__construct($db, 'share', '\OCA\ShareRenamer\Db\ShareRenamer'); | ||
} | ||
public function __construct(IDBConnection $db) { | ||
parent::__construct($db, 'share', '\OCA\ShareRenamer\Db\ShareRenamer'); | ||
} | ||
|
||
public function trytokeninsert($oldtoken, $newtoken) { | ||
// check if new token already exists | ||
$sql = 'SELECT COUNT(*) AS n FROM *PREFIX*share WHERE token = ?'; | ||
$sql = $this->db->prepare($sql); | ||
$sql->bindParam(1, $newtoken, \PDO::PARAM_STR); | ||
$sql->execute(); | ||
$row = $sql->fetch(); | ||
$sql->closeCursor(); | ||
$alreadyexists = $row['n']; // returns 0 or 1 | ||
public function trytokeninsert($oldtoken, $newtoken) { | ||
// check if new token already exists | ||
$sql = 'SELECT COUNT(*) AS n FROM *PREFIX*share WHERE token = ?'; | ||
$sql = $this->db->prepare($sql); | ||
$sql->bindParam(1, $newtoken, \PDO::PARAM_STR); | ||
$sql->execute(); | ||
$row = $sql->fetch(); | ||
$sql->closeCursor(); | ||
$alreadyexists = $row['n']; // returns 0 or 1 | ||
|
||
if ($alreadyexists == '1') { | ||
return 'exists'; | ||
} | ||
if ($alreadyexists == '1') { | ||
return 'exists'; | ||
} | ||
|
||
// now change token in database | ||
$sql2 = 'UPDATE *PREFIX*share SET token = ? WHERE token = ?'; | ||
$sql2 = $this->db->prepare($sql2); | ||
$sql2->bindParam(1, $newtoken, \PDO::PARAM_STR); | ||
$sql2->bindParam(2, $oldtoken, \PDO::PARAM_STR); | ||
$sql2->execute(); | ||
// now change token in database | ||
$sql2 = 'UPDATE *PREFIX*share SET token = ? WHERE token = ?'; | ||
$sql2 = $this->db->prepare($sql2); | ||
$sql2->bindParam(1, $newtoken, \PDO::PARAM_STR); | ||
$sql2->bindParam(2, $oldtoken, \PDO::PARAM_STR); | ||
$sql2->execute(); | ||
|
||
return 'pass'; | ||
} | ||
return 'pass'; | ||
} | ||
} |
Oops, something went wrong.