Skip to content

Commit

Permalink
Mise au format d'une App Owncloud
Browse files Browse the repository at this point in the history
suppress of files outside App. Use of /public.php?version=pics
  • Loading branch information
unknown authored and unknown committed Dec 20, 2012
1 parent dea0a98 commit 4c0de09
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 436 deletions.
12 changes: 6 additions & 6 deletions oc454/apps/files_sharing_widget/js/widget.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if (window.jQuery === undefined || window.jQuery.fn.jquery !== "1.8.2") {
var script_tag = document.createElement("script");
script_tag.setAttribute("type", "text/javascript");
script_tag.setAttribute("src",ownWidgetOptions.path + ownWidgetOptions.appspath+ "/files_sharing_widget/js/jquery-pack.min.js");
script_tag.setAttribute("src",ownWidgetOptions.appspath+ "/js/jquery-pack.min.js");
if (script_tag.readyState) {

script_tag.onreadystatechange = function() {
Expand Down Expand Up @@ -60,7 +60,7 @@ var OwnWidget={
var defaults={
crypt:'',
path:'',
appspath:'apps',
appspath:'', //<?php echo OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath("files_sharing_widget")); ?>
display:'',
fbAppid:'',
modal:true,
Expand Down Expand Up @@ -88,7 +88,7 @@ var OwnWidget={

loadCssFile:function(){
if(jQuery('#ownWidgetCss').length<1){
jQuery("<link>", {id:'ownWidgetCss',rel : "stylesheet",type : "text/css",href :this.options.path + this.options.appspath+ "/files_sharing_widget/css/widget.css"}).appendTo("head");
jQuery("<link>", {id:'ownWidgetCss',rel : "stylesheet",type : "text/css",href :this.options.appspath + "/css/widget.css"}).appendTo("head");
}
},

Expand Down Expand Up @@ -209,7 +209,7 @@ var OwnWidget={
jQuery.ajax({
dataType : "jsonp",
jsonp : "jsonp_callback",
url : self.options.path + "widget.php?iToken=" + rawurlencode(self.options.crypt) + self.loadPage,
url : self.options.path + "/public.php?service=pics&iToken=" + rawurlencode(self.options.crypt) + self.loadPage,

success : function(data) {

Expand Down Expand Up @@ -289,7 +289,7 @@ var OwnWidget={
progress_delay : false,
thumb_page : false,
thumb_interval : false,
image_path : this.options.path + this.options.appspath+ "/files_sharing_widget/img/",
image_path : this.options.appspath+ "/img/",
play_button : "#pauseplay",
next_slide : "#nextslide",
prev_slide : "#prevslide",
Expand All @@ -310,7 +310,7 @@ var OwnWidget={
},
initSupersized:function() {
var self=this;
var htmlString = '<div id="slideshow-content" style="display:none;z-index:201;"><div id="closeSlideShow">X</div><div id="prevthumb"></div><div id="nextthumb"></div> <a id="prevslide" class="load-item"></a> <a id="nextslide" class="load-item"></a> <div id="thumb-tray" class="load-item"><div id="thumb-back"></div><div id="thumb-forward"></div></div> <div id="progress-back" class="load-item"><div id="progress-bar"></div></div><div id="controls-wrapper" class="load-item"><div id="controls"><a id="play-button"><img id="pauseplay" src="'+ this.options.path + this.options.appspath + '/files_sharing_widget/img/pause.png" /></a><div id="slidecounter"><span class="slidenumber"></span><span class="totalslides"></span></div><div id="slidecaption"></div><a id="tray-button"><img id="tray-arrow" src="' + this.options.path + this.options.appspath + '/files_sharing_widget/img/button-tray-up.png" /></a><ul id="slide-list"></ul></div></div></div>';
var htmlString = '<div id="slideshow-content" style="display:none;z-index:201;"><div id="closeSlideShow">X</div><div id="prevthumb"></div><div id="nextthumb"></div> <a id="prevslide" class="load-item"></a> <a id="nextslide" class="load-item"></a> <div id="thumb-tray" class="load-item"><div id="thumb-back"></div><div id="thumb-forward"></div></div> <div id="progress-back" class="load-item"><div id="progress-bar"></div></div><div id="controls-wrapper" class="load-item"><div id="controls"><a id="play-button"><img id="pauseplay" src="'+ this.options.appspath + '/img/pause.png" /></a><div id="slidecounter"><span class="slidenumber"></span><span class="totalslides"></span></div><div id="slidecaption"></div><a id="tray-button"><img id="tray-arrow" src="' + this.options.appspath + '/img/button-tray-up.png" /></a><ul id="slide-list"></ul></div></div></div>';
jQuery(htmlString).appendTo("body");
jQuery("#closeSlideShow").click(function() {
if (jQuery.supersized.vars.slideshow_interval) {
Expand Down
48 changes: 35 additions & 13 deletions oc454/apps/files_sharing_widget/lib/widgethelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OC_Widget_Helper {
* Returns a absolute url to the given service.
*/
public static function linkToWidget($service, $add_slash = false) {
return OC_Helper::linkToAbsolute( '', 'widget.php') . '?action=' . $service . (($add_slash && $service[strlen($service)-1]!='/')?'/':'');
return OC_Helper::linkToAbsolute( '', 'public.php') . '?service=pics&action=' . $service . (($add_slash && $service[strlen($service)-1]!='/')?'/':'');
}


Expand Down Expand Up @@ -73,15 +73,15 @@ public static function makeNormPic($path,$bWatermark=true,$sWatermarkTxt='(c) ze
$image -> show();
}
}

/**
* @load Template for real view
* @param int width of the widget
* @param int height of the widget
* @return return the template
*
*/
public static function getRelativeAppWebPath() {
/* public static function getRelativeAppWebPath() {
foreach(OC::$APPSROOTS as $dir) {
if(file_exists($dir['path'].'/files_sharing_widget')) {
Expand All @@ -90,19 +90,16 @@ public static function getRelativeAppWebPath() {
}
return false;
}

*/
public static function loadTemplateReal($WIDTH="770",$HEIGHT="570",$TITLE='Zeus-Cloud Picture Widget') {

$getRelativeAppsPath=OC_Widget_Helper::getRelativeAppWebPath();
if(strripos(OC::$WEBROOT,'/')) $getRelativeAppsPath=substr($getRelativeAppsPath,1,strlen($getRelativeAppsPath)-1);


$tpl="<!DOCTYPE html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de-DE\" lang=\"de-DE\">\n<head>\n<title>".htmlentities(utf8_decode($TITLE))."</title>
\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><meta content=\"yes\" name=\"apple-mobile-web-app-capable\" />
\n<meta content=\"minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no\" name=\"viewport\" />
\n<link href=\"".OC_HELPER::makeURLAbsolute(OC::$WEBROOT).$getRelativeAppsPath."/files_sharing_widget/img/startup.png\" rel=\"apple-touch-startup-image\" />
\n<link href=\"".OC_HELPER::makeURLAbsolute(OC::$WEBROOT).$getRelativeAppsPath."/files_sharing_widget/img/homescreen.png\" rel=\"apple-touch-icon\" />
\n<script>var ownWidgetOptions = {crypt:'".$_GET['iToken']."',path:'".OC_HELPER::makeURLAbsolute(OC::$WEBROOT)."',appspath:'".$getRelativeAppsPath."',cssAddWidget:{'width':'".$WIDTH."','height':'".$HEIGHT."'}};</script>
\n<script src=\"".OC_HELPER::makeURLAbsolute(OC::$WEBROOT)."widgetloader.php\" type=\"text/javascript\"></script>\n
\n<link href=\"".OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath('files_sharing_widget'))."/img/startup.png\" rel=\"apple-touch-startup-image\" />
\n<link href=\"".OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath('files_sharing_widget'))."/img/homescreen.png\" rel=\"apple-touch-icon\" />
\n<script>var ownWidgetOptions = {crypt:'".$_GET['iToken']."',path:'".OC_HELPER::makeURLAbsolute(OC::$WEBROOT)."',appspath:'".OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath('files_sharing_widget'))."',cssAddWidget:{'width':'".$WIDTH."','height':'".$HEIGHT."'}};</script>
\n<script src=\"".OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath('files_sharing_widget'))."/js/widget.full.js\" type=\"text/javascript\"></script>\n
\n</head>
\n<body class=\"widgetbg\">
\n<div id=\"ownWidget-container\"></div>
Expand Down Expand Up @@ -138,7 +135,31 @@ public static function encrypt($sValue, $sSecretKey) {
)
,"\0\3");
}
/**
* @decrypt string
* @param string Value to decrypt
* @param string Secret Key
* @return decrypted string
*
*/

public static function decrypt($sValue, $sSecretKey) {
return rtrim(
mcrypt_decrypt(
MCRYPT_RIJNDAEL_256,
$sSecretKey,
base64_decode($sValue),
MCRYPT_MODE_ECB,
mcrypt_create_iv(
mcrypt_get_iv_size(
MCRYPT_RIJNDAEL_256,
MCRYPT_MODE_ECB
),
MCRYPT_RAND
)
)
,"\0\3");
}

/**
* @get Count Pics of Directory and one image for Preview
Expand Down Expand Up @@ -192,7 +213,7 @@ public static function getAllSharesUser($SECRET){
if($share['item_type']=='folder') $itemTypeChoose='dir';
$expDate = new \DateTime($share['expiration'], new \DateTimeZone($tz));
$EXPDATE=$expDate->format('d.m.Y H:i');

/*
if($share['share_type']==0){
$output[]=array(
'id'=>$share['id'],
Expand All @@ -215,6 +236,7 @@ public static function getAllSharesUser($SECRET){
'iToken'=>''
);
}
*/
if($share['share_type']==3){
$addPassImg='';
$tokenLink='&'.$itemTypeChoose.'='.$share['path'];
Expand Down
15 changes: 13 additions & 2 deletions oc454/apps/files_sharing_widget/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@
OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
OC::$CLASSPATH['OC_Filestorage_Shared'] = "files_sharing/lib/sharedstorage.php";
OCP\Util::connectHook('OC_Filesystem', 'setup', 'OC_Filestorage_Shared', 'setup');
OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
//OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
//OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');

//
$SESSIONPREFIX = OC_Config::getValue('SESSIONPREFIX');

$shareSecret=OCP\Config::getSystemValue('secretword');
if($shareSecret=='') $shareSecret='mySecretWord';
$getSchluessel= OC_Widget_Helper::decrypt(rawurldecode($_GET['iToken']),$shareSecret);

$_GET['dir']=$getSchluessel;
//$_GET['service']='pics';
//

$bReal=false;
if (isset($_GET['action']) && $_GET['action']=='real') {
Expand Down
21 changes: 14 additions & 7 deletions oc454/apps/files_sharing_widget/templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
?>
<fieldset class="personalblock">
<legend>Geteilte Dateien und Ordner</legend>
<legend>Shared files and folders with link</legend>
<ul class="shareSettings">
<li class="shareHeading">
<span style="width:10%; float:left;display:block;">ShareType </span>
Expand All @@ -27,10 +27,8 @@
<span style="width:15%;float:left;display:block;"><?php echo $shareInfo['shareName']; ?></span>
<span style="width:15%;float:left;display:block;"><a href="<?php echo $shareInfo['link']; ?>" target="_blank"><?php echo $shareInfo['name']; ?></a></span>
<span style="width:20%;float:left;display:block;"><?php echo $shareInfo['date']; ?></span>
<span style="width:38%;display:block;float:left;"><a id="widgetlink-<?php echo $shareInfo['id'] ?>" href="<?php echo OC_HELPER::makeURLAbsolute(OC::$WEBROOT); ?>/widget.php?action=real&iToken=<?php echo $shareInfo['iToken']; ?>" target="_blank"><?php echo $shareInfo['iToken']; ?></a></span><br style="clear:both;" /></li>
<span style="width:38%;display:block;float:left;"><a id="widgetlink-<?php echo $shareInfo['id'] ?>" href="<?php echo OC_HELPER::makeURLAbsolute(OC::$WEBROOT); ?>/public.php?service=pics&action=real&iToken=<?php echo $shareInfo['iToken']; ?>" target="_blank"><?php echo $shareInfo['iToken']; ?></a></span><br style="clear:both;" /></li>
<?php endforeach;}
$getRelativeAppsPath=OC_Widget_Helper::getRelativeAppWebPath();
$getRelativeAppsPath=substr($getRelativeAppsPath,1,strlen($getRelativeAppsPath)-1);
?>
</ul><br />
<b>Configurationparameters:</b><br />
Expand All @@ -47,15 +45,24 @@
<br /><br />
Use as Widget: (For Integration Homepage, Facebook)<br />
<textarea style="width:60%;height:120px;" readonly>
<!DOCTYPE html>
<html>
<head>
<title>Galerie Widget by Libasys</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
var ownWidgetOptions = {
crypt:'thecryptoken', //e.g.os3Nz8rhqNnV1cfUotvc2M3H0w==
path:'<?php echo OC_Helper::makeURLAbsolute(OC::$WEBROOT . '/'); ?>',
appspath:'<?php echo $getRelativeAppsPath; ?>',
appspath:'<?php echo OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath('files_sharing_widget')); ?>',
cssAddWidget:{'width':670,'height':400}
}
};
</script>
<script src="<?php echo OC_HELPER::makeURLAbsolute(OC::$WEBROOT); ?>/widgetloader.php" type="text/javascript"></script></textarea>
<script src="<?php echo OC_HELPER::makeURLAbsolute(OC_App::getAppWebPath('files_sharing_widget')); ?>/js/widget.full.js" type="text/javascript"></script>
</head>
<body class="widgetbg"><div id="ownWidget-container"></div></body>
</html>
</textarea>

</fieldset>
<!-- Dialogs -->
Expand Down
Loading

0 comments on commit 4c0de09

Please sign in to comment.