diff --git a/core/src/plugins/action.share/class.ShareCenter.js b/core/src/plugins/action.share/class.ShareCenter.js index 6248454afd..99f6b49b80 100644 --- a/core/src/plugins/action.share/class.ShareCenter.js +++ b/core/src/plugins/action.share/class.ShareCenter.js @@ -263,6 +263,8 @@ Class.create("ShareCenter", { oForm.removeClassName('share_leaf'); oForm.removeClassName('readonly_mode'); oForm.removeClassName('type-ws'); + oForm.removeClassName('share_expired'); + oForm.removeClassName("share_edit"); var pluginConfigs = ajaxplorer.getPluginConfigs("action.share"); if(this.currentNode.isLeaf()) oForm.addClassName('share_leaf'); if(this.readonlyMode) oForm.addClassName('readonly_mode'); @@ -342,7 +344,6 @@ Class.create("ShareCenter", { var nodeMeta = this.currentNode.getMetadata(); - oForm.removeClassName("share_edit"); if(nodeMeta.get("ajxp_shared")) oForm.addClassName("share_edit"); oForm.down("div#target_repository_toggle").select("a").invoke( "observe", "click", function(){ oForm.toggleClassName("edit_parameters"); @@ -432,6 +433,9 @@ Class.create("ShareCenter", { container.insert(chooser); chooser.setValue(json['minisite_layout']); } + if(json['is_expired']){ + oForm.addClassName('share_expired'); + } }catch(e){} oForm.down('#complete_indicator').hide(); if(json.minisite){ @@ -638,7 +642,11 @@ Class.create("ShareCenter", { actions.insert({top:new Element('span', {className:'icon-key simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.85"]}).update(' '+MessageHash["share_center.84"])}); } if(linkData["expire_time"]){ - actions.insert({top:new Element('span', {className:'icon-calendar simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.87"]}).update(' '+linkData["expire_time"])}); + if(linkData['is_expired'] && linkData['expire_after'] === 0 && (linkData['download_limit'] && linkData['download_limit'] != linkData['download_counter'])){ + actions.insert({top:new Element('span', {className:'icon-calendar simple_tooltip_observer SF_horizontal_action_destructive',"data-tooltipTitle":MessageHash["share_center.169"]}).update(' '+linkData["expire_time"])}); + }else{ + actions.insert({top:new Element('span', {className:'icon-calendar simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.87"]}).update(' '+linkData["expire_time"])}); + } } var dlC = new Element('span', {className:'icon-download-alt simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.89"]}).update(' '+MessageHash["share_center.88"]+' '+linkData['download_counter']+'/'+linkData['download_limit']); actions.insert({top:dlC}); @@ -833,39 +841,33 @@ Class.create("ShareCenter", { if(node.isLeaf()){ // LEAF SHARE - mainCont.update('
'+MessageHash["share_center.140"]+'
'); + mainCont.update('
'+MessageHash["share_center.140"+(jsonData['is_expired']?'b':'')]+'
'); mainCont.insert('
\
'+MessageHash['share_center.121']+'
\ -
\ +
\
\ '); }else if(jsonData.minisite){ // MINISITE FOLDER SHARE - mainCont.update('
'+MessageHash["share_center.138"]+'
'); - // Label - /* - mainCont.insert('\ -
\ -
'+MessageHash['share_center.35']+'
\ -
'+ jsonData.label +'
\ -
'); - */ + mainCont.update('
'+MessageHash["share_center.138"+(jsonData['is_expired']?'b':'')]+'
'); // Links textearea mainCont.insert('\
\
'+MessageHash['share_center.62']+'
\ -
\ -
\ -
\ +
\ +
'); + if(!jsonData['is_expired']){ + mainCont.insert( + '
\
'+MessageHash['share_center.61']+'
\
\ -
\ - '); + '); + } mainCont.down("#embed_code").setValue(""); }else{ // WORKSPACE FOLDER - mainCont.update('
'+MessageHash["share_center.139"]+'
'); + mainCont.update('
'+MessageHash["share_center.139"+(jsonData['is_expired']?'b':'')]+'
'); mainCont.insert('
\
'+MessageHash['share_center.54']+'
\
'+ entries.join(', ') +'
\ @@ -1158,7 +1160,14 @@ Class.create("ShareCenter", { // DOWNLOAD COUNTER BUTTON if(jsonData && jsonData["download_limit"]){ - var dlC = new Element('span', {className:'simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.89"]}).update(' '+MessageHash["share_center.88"]+' '+jsonData['download_counter']+'/'+jsonData['download_limit']); + var dlC; + if(jsonData['is_expired'] && jsonData['download_limit'] && jsonData['download_limit'] == jsonData['download_counter']){ + dlC = new Element('span', {className:'simple_tooltip_observer SF_horizontal_action_destructive',"data-tooltipTitle":MessageHash["share_center.168"]}).update(' '+MessageHash["share_center.88"]+' '+jsonData['download_counter']+'/'+jsonData['download_limit']); + }else{ + dlC = new Element('span', {className:'simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.89"]}).update(' '+MessageHash["share_center.88"]+' '+jsonData['download_counter']+'/'+jsonData['download_limit']); + } + + dialogButtonsOrRow.down('.SF_horizontal_actions').insert({bottom:dlC}); dlC.observe("click", function(){ if(window.confirm(MessageHash['share_center.106'])){ @@ -1177,7 +1186,11 @@ Class.create("ShareCenter", { // EXPIRATION TIME if(jsonData && jsonData["expire_time"]){ - dialogButtonsOrRow.down('.SF_horizontal_actions').insert({top:new Element('span', {className:'simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.87"]}).update(' '+jsonData["expire_time"])}); + if(jsonData['is_expired'] && jsonData['expire_after'] === 0 && (jsonData['download_limit'] && jsonData['download_limit'] != jsonData['download_counter'])){ + dialogButtonsOrRow.down('.SF_horizontal_actions').insert({top:new Element('span', {className:'simple_tooltip_observer SF_horizontal_action_destructive',"data-tooltipTitle":MessageHash["share_center.169"]}).update(' '+ jsonData["expire_time"])}); + }else{ + dialogButtonsOrRow.down('.SF_horizontal_actions').insert({top:new Element('span', {className:'simple_tooltip_observer',"data-tooltipTitle":MessageHash["share_center.87"]}).update(' '+jsonData["expire_time"])}); + } } if(updateFunc){ diff --git a/core/src/plugins/action.share/class.ShareCenter.php b/core/src/plugins/action.share/class.ShareCenter.php index 8e63200923..1bea65dc21 100644 --- a/core/src/plugins/action.share/class.ShareCenter.php +++ b/core/src/plugins/action.share/class.ShareCenter.php @@ -950,11 +950,11 @@ public function initPublicFolder($downloadFolder) } - public static function loadMinisite($data, $hash = '') + public static function loadMinisite($data, $hash = '', $error = null) { if(isset($data["SECURITY_MODIFIED"]) && $data["SECURITY_MODIFIED"] === true){ - header("HTTP/1.0 401 Not allowed, script was modified"); - die("Not allowed"); + $mess = ConfService::getMessages(); + $error = $mess['share_center.164']; } $repository = $data["REPOSITORY"]; AJXP_PluginsService::getInstance()->initActivePlugins(); @@ -980,8 +980,11 @@ public static function loadMinisite($data, $hash = '') $html = str_replace("AJXP_MINISITE_LOGO", $minisiteLogo, $html); $html = str_replace("AJXP_APPLICATION_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $html); $html = str_replace("PYDIO_APP_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $html); - $html = str_replace("AJXP_START_REPOSITORY", $repository, $html); - $html = str_replace("AJXP_REPOSITORY_LABEL", ConfService::getRepositoryById($repository)->getDisplay(), $html); + if(isSet($repository)){ + $html = str_replace("AJXP_START_REPOSITORY", $repository, $html); + $html = str_replace("AJXP_REPOSITORY_LABEL", ConfService::getRepositoryById($repository)->getDisplay(), $html); + } + $html = str_replace('AJXP_HASH_LOAD_ERROR', isSet($error)?$error:'', $html); $html = str_replace("AJXP_TEMPLATE_NAME", $templateName, $html); $html = str_replace("AJXP_LINK_HASH", $hash, $html); $guiConfigs = AJXP_PluginsService::findPluginById("gui.ajax")->getConfigs(); @@ -1015,6 +1018,7 @@ public static function loadMinisite($data, $hash = '') AJXP_PluginsService::deferBuildingRegistry(); AJXP_PluginsService::getInstance()->initActivePlugins(); AJXP_PluginsService::flushDeferredRegistryBuilding(); + $errMessage = null; try { $params = $_GET; $ACTION = "download"; @@ -1038,9 +1042,10 @@ public static function loadMinisite($data, $hash = '') AJXP_Controller::registryReset(); AJXP_Controller::findActionAndApply($ACTION, $params, null); } catch (Exception $e) { - die($e->getMessage()); + $errMessage = $e->getMessage(); } - return; + if($errMessage == null) return; + $html = str_replace('AJXP_HASH_LOAD_ERROR', $errMessage, $html); } if (isSet($_GET["lang"])) { @@ -1074,13 +1079,16 @@ public static function loadShareByHash($hash){ AJXP_PluginsService::getInstance()->initActivePlugins(); $shareCenter = self::getShareCenter(); $data = $shareCenter->loadPublicletData($hash); + $mess = ConfService::getMessages(); if($shareCenter->getShareStore()->isShareExpired($hash, $data)){ - // Remove the publiclet, it's done + /* if (strstr(realpath($_SERVER["SCRIPT_FILENAME"]),realpath(ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER"))) !== FALSE) { $shareCenter->deleteExpiredPubliclet($hash, $data); - AuthService::disconnect(); } - die('Link expired!'); + */ + AuthService::disconnect(); + self::loadMinisite(array(), $hash, $mess["share_center.165"]); + return; } if(!empty($data) && is_array($data)){ if(isSet($data["SECURITY_MODIFIED"]) && $data["SECURITY_MODIFIED"] === true){ @@ -1093,7 +1101,7 @@ public static function loadShareByHash($hash){ self::loadPubliclet($data); } }else{ - echo 'Cannot find link'; + self::loadMinisite(array(), $hash, $mess["share_center.166"]); } } @@ -1123,8 +1131,8 @@ private function deleteExpiredPubliclet($elementId, $data){ public static function loadPubliclet($data) { if(isset($data["SECURITY_MODIFIED"]) && $data["SECURITY_MODIFIED"] === true){ - header("HTTP/1.0 401 Not allowed, script was modified"); - die("Not allowed"); + self::loadMinisite($data, "false"); + return; } // create driver from $data $className = $data["DRIVER"]."AccessDriver"; @@ -1218,7 +1226,7 @@ public static function loadPubliclet($data) } $filePath = AJXP_INSTALL_PATH."/plugins/access.".$data["DRIVER"]."/class.".$className.".php"; if (!is_file($filePath)) { - die("Warning, cannot find driver for conf storage! ($className, $filePath)"); + die("Warning, cannot find driver for conf storage! ($className, $filePath)"); } require_once($filePath); $driver = new $className($data["PLUGIN_ID"], $data["BASE_DIR"]); @@ -2304,6 +2312,7 @@ public function shareToJson($shareId, $shareData, $node = null){ }else{ $jsonData["expire_after"] = 0; } + $jsonData["is_expired"] = $this->shareStore->isShareExpired($shareId, $minisiteData); if(isSet($minisiteData["AJXP_TEMPLATE_NAME"])){ $jsonData["minisite_layout"] = $minisiteData["AJXP_TEMPLATE_NAME"]; } diff --git a/core/src/plugins/action.share/manifest.xml b/core/src/plugins/action.share/manifest.xml index 886c2cbf88..d14a2309f3 100644 --- a/core/src/plugins/action.share/manifest.xml +++ b/core/src/plugins/action.share/manifest.xml @@ -107,6 +107,7 @@
AJXP_MESSAGE[share_center.143]
+
diff --git a/core/src/plugins/action.share/res/i18n/ca.php b/core/src/plugins/action.share/res/i18n/ca.php index ffc9bad0c8..82c2ce5157 100644 --- a/core/src/plugins/action.share/res/i18n/ca.php +++ b/core/src/plugins/action.share/res/i18n/ca.php @@ -171,6 +171,15 @@ "160" => "You are not allowed to delete this shared item", "161" => "Deprecated Link", "162" => "You have one or more legacy link on this file. Please replace this with a new share link by stopping this share and recreating a new one. Copy the share 'hash' (the last part of the link, e.g. http://yourpydio.com/data/public/206a51.php) and use it in the new sharing dialog to make sure the link will still be active after migration.", -"163" => "Drop Files Here (for upload-enabled minisites)" +"163" => "Drop Files Here (for upload-enabled minisites)", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", ); \ No newline at end of file diff --git a/core/src/plugins/action.share/res/i18n/de.php b/core/src/plugins/action.share/res/i18n/de.php index 122d65f961..07af09395b 100644 --- a/core/src/plugins/action.share/res/i18n/de.php +++ b/core/src/plugins/action.share/res/i18n/de.php @@ -170,6 +170,15 @@ "160" => "Es ist Ihnen nicht erlaubt dieses geteilte Item zu löschen.", "161" => "Deprecated Link", "162" => "You have one or more legacy link on this file. Please replace this with a new share link by stopping this share and recreating a new one. Copy the share 'hash' (the last part of the link, e.g. http://yourpydio.com/data/public/206a51.php) and use it in the new sharing dialog to make sure the link will still be active after migration.", -"163" => "Drag'n'Drop (Für Miniseiten mit aktivierten Upload)" +"163" => "Drag'n'Drop (Für Miniseiten mit aktivierten Upload)", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", ); \ No newline at end of file diff --git a/core/src/plugins/action.share/res/i18n/en.php b/core/src/plugins/action.share/res/i18n/en.php index 9443c2fcfb..cfc6868fde 100644 --- a/core/src/plugins/action.share/res/i18n/en.php +++ b/core/src/plugins/action.share/res/i18n/en.php @@ -172,5 +172,14 @@ "160" => "You are not allowed to delete this shared item", "161" => "Deprecated Link", "162" => "You have one or more legacy link on this file. Links are still active, but you can replace them with a new share link by stopping this share and recreating a new one. Copy the share 'hash' (the last part of the link, e.g. http://yourpydio.com/data/public/206a51.php) and apply it to the new link using the 'Change Parameters' form.", - "163" => "Drop Files Here (for upload-enabled minisites)" + "163" => "Drop Files Here (for upload-enabled minisites)", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", ); diff --git a/core/src/plugins/action.share/res/i18n/es.php b/core/src/plugins/action.share/res/i18n/es.php index f1d37c9002..94e2cfc5d5 100644 --- a/core/src/plugins/action.share/res/i18n/es.php +++ b/core/src/plugins/action.share/res/i18n/es.php @@ -171,6 +171,16 @@ "160" => "You are not allowed to delete this shared item", "161" => "Deprecated Link", "162" => "You have one or more legacy link on this file. Please replace this with a new share link by stopping this share and recreating a new one. Copy the share 'hash' (the last part of the link, e.g. http://yourpydio.com/data/public/206a51.php) and use it in the new sharing dialog to make sure the link will still be active after migration.", -"163" => "Drop Files Here (for upload-enabled minisites)" +"163" => "Drop Files Here (for upload-enabled minisites)", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", + ); \ No newline at end of file diff --git a/core/src/plugins/action.share/res/i18n/fr.php b/core/src/plugins/action.share/res/i18n/fr.php index 47700f8125..a70a3feb7a 100644 --- a/core/src/plugins/action.share/res/i18n/fr.php +++ b/core/src/plugins/action.share/res/i18n/fr.php @@ -171,5 +171,15 @@ "160" => "Vous n'êtes pas autorisé à supprimer cet élément partagé", "161" => "Lien obsolète", "162" => "Ce partage a été généré par une ancienne version de l'application. Veuillez le remplacer en le stoppant puis en le recréant. Vous pouvez copier le 'hash' (la dernière partie du lien, soit par exemple http://votrepydio.com/data/public/206a51.php) et l'utiliser pour regénérer un nouveau partage qui aura donc toujours la même addresse.", - "163" => "Déposer vos fichiers ici (pour les minisites permetant l'envois)" + "163" => "Déposer vos fichiers ici (pour les minisites permetant l'envois)", + "138b" => "Vous avez partagé ce dossier via un lien public, mais il est actuellement inactif (expiré).", + "139b" => "Vous avez partagé ce dossier comme un dépôt, , mais il est actuellement inactif (expiré).", + "140b" => "Vous avez partagé ce fichier via un lien public, mais il est actuellement inactif (expiré).", + "164" => "Accès refusé: le script a été modifié!", + "165" => "Désolé, ce lien a expiré!", + "166" => "Impossible de trouver le lien!", + "167" => "Le lien est expiré!", + "168" => "Le nombre de téléchargements autorisés a été atteint. Cliquer pour remettre à zéro et réactiver le lien.", + "169" => "La date d'expiration est passée. Changez les paramètres du lien pour le réactiver.", + ); \ No newline at end of file diff --git a/core/src/plugins/action.share/res/i18n/it.php b/core/src/plugins/action.share/res/i18n/it.php index 4a18e33a9a..1611dd9ba2 100644 --- a/core/src/plugins/action.share/res/i18n/it.php +++ b/core/src/plugins/action.share/res/i18n/it.php @@ -168,6 +168,16 @@ "160" => "You are not allowed to delete this shared item", "161" => "Deprecated Link", "162" => "You have one or more legacy link on this file. Please replace this with a new share link by stopping this share and recreating a new one. Copy the share 'hash' (the last part of the link, e.g. http://yourpydio.com/data/public/206a51.php) and use it in the new sharing dialog to make sure the link will still be active after migration.", - "163" => "Drop Files Here (for upload-enabled minisites)" + "163" => "Drop Files Here (for upload-enabled minisites)", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", + ); diff --git a/core/src/plugins/action.share/res/i18n/pt.php b/core/src/plugins/action.share/res/i18n/pt.php index d5f4490fa0..eb31e5e283 100644 --- a/core/src/plugins/action.share/res/i18n/pt.php +++ b/core/src/plugins/action.share/res/i18n/pt.php @@ -171,6 +171,16 @@ "160" => "You are not allowed to delete this shared item", "161" => "Deprecated Link", "162" => "You have one or more legacy link on this file. Please replace this with a new share link by stopping this share and recreating a new one. Copy the share 'hash' (the last part of the link, e.g. http://yourpydio.com/data/public/206a51.php) and use it in the new sharing dialog to make sure the link will still be active after migration.", -"163" => "Drop Files Here (for upload-enabled minisites)" +"163" => "Drop Files Here (for upload-enabled minisites)", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", + // will be replaced by the filename to download ); \ No newline at end of file diff --git a/core/src/plugins/action.share/res/i18n/ru.php b/core/src/plugins/action.share/res/i18n/ru.php index 89e74a0972..9e9344f769 100644 --- a/core/src/plugins/action.share/res/i18n/ru.php +++ b/core/src/plugins/action.share/res/i18n/ru.php @@ -167,5 +167,14 @@ "155" => "Embedded (smaller header, for widgets)", "156" => "Successfully published link %s", "157" => "This folder is currently shared. If you delete it, associated share will be disabled.", - "158" => "This file is currently shared. If you delete it, associated share will be disabled. " + "158" => "This file is currently shared. If you delete it, associated share will be disabled. ", + "138b" => "You have shared this folder as a public link, but it is currently inactive (expired).", + "139b" => "You have shared this folder as a workspace with application users, but it is currently inactive (expired).", + "140b" => "You have shared this file via a public link, but it is currently inactive (expired).", + "164" => "Not allowed: script was modified!", + "165" => "Sorry, this link is expired!", + "166" => "Cannot find specified link!", + "167" => "Link is expired!", + "168" => "The number of authorized downloads have been reached. Click to reset the counter and reactivate the link.", + "169" => "The expiration date was reached. Change the parameters with a new date if you want to reactivate the link.", ); diff --git a/core/src/plugins/action.share/res/minisite.php b/core/src/plugins/action.share/res/minisite.php index a7b24212d7..d607eb1614 100644 --- a/core/src/plugins/action.share/res/minisite.php +++ b/core/src/plugins/action.share/res/minisite.php @@ -12,7 +12,6 @@