Skip to content

Commit

Permalink
Item373: Renaming plugin, generelizing use to export any cookie by name
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/ExportCookiePlugin@1238 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
EugenMayer authored and EugenMayer committed Dec 9, 2008
1 parent 4bf54e5 commit 9ca0e9e
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 67 deletions.
45 changes: 0 additions & 45 deletions data/System/DrupalConSidExportPlugin.txt

This file was deleted.

32 changes: 32 additions & 0 deletions data/System/ExportCookiePlugin.txt
@@ -0,0 +1,32 @@
---+!! <nop>%TOPIC%

Exports the value of a Cookie into the Foswiki variable <verbatim>%EXPORTCOOKIE%</verbatim>

%TOC%

---++ USAGE
Use the macro <verbatim>%EXPORTCOOKIE%</verbatim> to display the value. You can use this in links or further pugins.

---++ Plugin Settings
* you need to set the CookieName in the Foswiki configure-system

---++ Plugin Installation Instructions
* just use the installer attached to the topic or even easier, use the configure-system/Extension to easy install it trough an user-interface
---++ Plugin Info

| Plugin Author: | Foswiki:Main.MayerEugen |
| Copyright: | &copy; 2006, Impressive.media |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Plugin Version: | 09 Dez 2008 (V0.2) |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 09 Dez 2008: | Renamed plugin to ExportCookiePlugin to generelize the use |
| 01 Dez 2008: | Initial version |
| Foswiki Dependency: | |
| CPAN Dependencies: | HTTP::Cookies::Find |
| Other Dependencies: | |
| Perl Version: | 5.005 |
| Add-on Home: | http://foswiki.org/Extensions/%TOPIC% |
| Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev |
| Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal |

__Related Topics:__
7 changes: 0 additions & 7 deletions lib/Foswiki/Plugins/DrupalConSidExportPlugin/Config.spec

This file was deleted.

3 changes: 0 additions & 3 deletions lib/Foswiki/Plugins/DrupalConSidExportPlugin/MANIFEST

This file was deleted.

6 changes: 6 additions & 0 deletions lib/Foswiki/Plugins/ExportCookiePlugin/Config.spec
@@ -0,0 +1,6 @@
# ---+ ExportCookie
# <h2>General Settings</h2>

# **STRING**
# Name of the cookie to export
$Foswiki::cfg{Plugins}{ExportCookie}{CookieName}="";
4 changes: 4 additions & 0 deletions lib/Foswiki/Plugins/ExportCookiePlugin/MANIFEST
@@ -0,0 +1,4 @@
data/System/ExportCookiePlugin.txt Plugin topic
lib/Foswiki/Plugins/ExportCookiePlugin.pm Plugin Perl module
lib/Foswiki/Plugins/ExportCookiePlugin/Config.spec 0644

Expand Up @@ -8,6 +8,6 @@ BEGIN

use Foswiki::Contrib::Build;

$build = new Foswiki::Contrib::Build( "DrupalConSidExportPlugin" );
$build = new Foswiki::Contrib::Build( "ExportCookiePlugin" );
$build->build($build->{target});

Expand Up @@ -13,7 +13,7 @@
# GNU General Public License for more details, published at
# http://www.gnu.org/copyleft/gpl.html

package Foswiki::Plugins::DrupalConSidExportPlugin;
package Foswiki::Plugins::ExportCookiePlugin;

use strict;

Expand All @@ -25,10 +25,10 @@ $VERSION = '$Rev: 12445$';

$RELEASE = 'Dakar';

$SHORTDESCRIPTION = 'Saves the current PHPsid generated by drupal and makes it available';
$SHORTDESCRIPTION = 'Exports the value of a cookie into the Foswiki variable %EXPORTCOOKIE%';
$NO_PREFS_IN_TOPIC = 1;

$pluginName = 'DrupalConSidExportPlugin';
$pluginName = 'ExportCookiePlugin';

sub initPlugin {
my( $topic, $web, $user, $installWeb ) = @_;
Expand All @@ -41,24 +41,23 @@ sub initPlugin {

$debug = $Foswiki::cfg{Plugins}{PHPsidPlugin}{Debug} || 0;

Foswiki::Func::registerTagHandler( 'DRUPALSID', \&_DRUPALSID );
Foswiki::Func::registerTagHandler( 'EXPORTCOOKIE', \&_GETCOOKIE );
return 1;
}

sub _DRUPALSID {
sub _GETCOOKIEVALUE {
my($this, $params, $theTopic, $theWeb) = @_;
my $twiki = $this->{twiki};
my $query = Foswiki::Func::getCgiQuery();
my $sid = "";
my $drupalSessionHash = $Foswiki::cfg{Plugins}{Drupal}{SessionHash};
my $value = "";
my $CookieName = $Foswiki::cfg{Plugins}{ExportCookie}{CookieName};

foreach my $name ($query->cookie()) {
if($name eq $drupalSessionHash)
if($name eq $CookieName)
{
$sid = $query->cookie('-name'=>$name);
$value = $query->cookie('-name'=>$name);
}
}

return $sid;
return $value;
}
1;

0 comments on commit 9ca0e9e

Please sign in to comment.