Wizard.pm 0000644 0001752 0000153 00000003611 10071040215 013123 0 ustar linkssql linkssql # ==================================================================
# Auto Generated Plugin Configuration - Needed for Web Based Creator.
#
# Plugins::AllPosters_Import
# Author : Andy Newby (UltraNerds)
# Version : 1
# Updated : Thu Jul 1 10:11:03 2004
#
# ==================================================================
#
package Plugins::AllPosters_Import;
# ==================================================================
use strict;
use vars qw/$WIZARD/;
$WIZARD = {
'install' => 'Set this to your ID number (if you don\'t have one yet, please leave mine there :p). You can signup here: CLICK
This plugin is FREE to those who are signed up under my username, and $30 for those who are not (it was a horrible plugin to write :\'( ).',
'menu' => [
[
'Readme',
'admin.cgi?do=plugin&plugin=AllPosters_Import&func=Readme'
],
[
'Setup',
'admin.cgi?do=page&page=plugin_manager.html&plugin_man_do=edit_installed&plugin_name=AllPosters_Import'
]
],
'files' => [],
'install_code' => '',
'uninstall' => 'Sorry to see you are uninstalling :(',
'user' => [
[
'AffiliateID',
'1802204885',
'Set this to your ID number.',
'TEXT',
[],
[]
]
],
'uninstall_code' => '',
'name' => 'AllPosters_Import',
'meta' => {
'prog_ver' => '2.1.2',
'description' => 'This plugin will import the data from AllPosters.com; one of the biggest Poster stores online!',
'license' => 'Commercial',
'url' => 'http://www.ultranerds.com',
'author' => 'Andy Newby (UltraNerds)',
'version' => '1'
},
'hooks' => []
};
1;
Install.pm 0000644 0001752 0000153 00000034524 10071042647 013313 0 ustar linkssql linkssql # ==================================================================
# Plugins::AllPosters_Import - Auto Generated Install Module
#
# Plugins::AllPosters_Import
# Author : Andy Newby (UltraNerds)
# Version : 1.2
# Updated : Sat Sept 25th 2004
#
# ==================================================================
#
package Plugins::AllPosters_Import;
# ==================================================================
use strict;
use vars qw/$VERSION $DEBUG $NAME $META/;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/$CFG $IN $DB/;
$VERSION = '1.2';
$DEBUG = 0;
$NAME = 'AllPosters_Import';
# Inhert from base class for debug and error methods
@Plugins::AllPosters_Import::ISA = qw(GT::Base);
$META = {
'prog_ver' => '2.1.2',
'description' => 'This plugin will import the data from AllPosters.com; one of the biggest Poster stores online!',
'license' => 'Commercial',
'url' => 'http://www.ultranerds.com',
'author' => 'Andy Newby (UltraNerds)',
'version' => '1.2'
};
sub pre_install {
# -------------------------------------------------------------------
# This function displays an HTML formatted message that will display
# to the user any instructions/information before they install
# the plugin.
#
my $inst_msg = 'Set this to your ID number (if you don\'t have one yet, please leave mine there :p). You can signup here: CLICK
This plugin is FREE to those who are signed up under my username, and $30 for those who are not (it was a horrible plugin to write :\'( ).';
return $inst_msg;
}
sub pre_uninstall {
# -------------------------------------------------------------------
# This function displays an HTML formatted message that will display
# to the user any instructions/information before they remove the
# plugin.
#
my $uninst_msg = 'Sorry to see you are uninstalling :(';
return $uninst_msg;
}
sub install {
# -------------------------------------------------------------------
# This function does the actual installation. It's first argument is
# a plugin manager which you can use to register hooks, install files,
# add menu options, etc. The second argument is a GT::Tar object which
# you can use to access any files in your plugin module.
#
# You should return an HTML formatted string that will be displayed
# to the user.
#
# If there is an error, return undef, and set the error message in
# $Plugins::AllPosters_Import::error
#
my ($mgr, $tar) = @_;
my $file;
# Silence warnings
$GT::Tar::error ||= '';
# Make the directory, if it doesn't already exist...
mkdir("$CFG->{admin_root_path}/ALLPOSTERS",0755);
# Copying allposters.cgi to $CFG->{admin_root_path}/.. directory.
$file = $tar->get_file ('allposters.cgi');
# Get the entire code as a string.
my $code = $file->body_as_string;
# Do some substitutions.
$code =~ s/^#!(.*)/#!$CFG->{path_to_perl}/;
$code =~ s/use lib '';/use lib '$CFG->{admin_root_path}';/;
$code =~ s,Links::init\(\),Links::init('$CFG->{admin_root_path}'),;
$code =~ s,chdir\(\),chdir('$CFG->{admin_root_path}/ALLPOSTERS'),;
# Update the file to the new body.
$file->body ($code);
$file->name("$CFG->{admin_root_path}/ALLPOSTERS/allposters.cgi");
# Chmod the cgi-bin to 777 so we can write to it.
if (-e "$CFG->{admin_root_path}/ALLPOSTERS/allposters.cgi") {
chmod(0666, "$CFG->{admin_root_path}/ALLPOSTERS/allposters.cgi");
}
chmod(0777, "$CFG->{admin_root_path}/ALLPOSTERS/");
$file->write or return Plugins::Ace_PPC->error("Unable to extract file: '$CFG->{admin_root_path}/ALLPOSTERS/allposters.cgi' ($GT::Tar::error)", 'WARN');
chmod(0755, "$CFG->{admin_root_path}/ALLPOSTERS/allposters.cgi");
chmod(0755, "$CFG->{admin_root_path}/ALLPOSTERS/"); # set back to 755, otherwise some servers get 500 errors!
###############
my @file_list;
$file_list[0] = 'link_allposters.html';
#$file_list[1] = '';
foreach (@file_list) {
# Copying the images
$file = $tar->get_file ($_);
$file->name("$CFG->{admin_root_path}/templates/$CFG->{build_default_tpl}/$_");
$file->write or return Plugins::AllPosters_Import->error("Unable to extract file: '$CFG->{admin_root_path}/templates/$CFG->{build_default_tpl}/$_' ($GT::Tar::error)", 'WARN');
}
##############
unless (exists $DB->table('Category')->cols->{'ALLPOSTERS_ID'}) {
my $editor = $DB->editor ('Category');
$editor->add_col ('ALLPOSTERS_ID', {
type => 'INT',
display => '12',
form_display => 'ALLPOSTERS_ID:',
}) or die "Cant add 'ALLPOSTERS_ID' SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'Artist'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('Artist', {
type => 'TEXT',
display => '12',
form_display => 'Poster Artists Name:',
}) or die "Cant add 'Artist' SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'CanBeFramed'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('CanBeFramed', {
type => 'TEXT',
display => '12',
form_display => 'Can Be Frames?',
form_type => 'SELECT',
form_values => [ 'Yes','No' ],
form_names => [ 'Y','N' ]
}) or die "Cant add 'CanBeFramed' SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'CanBeMounted'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('CanBeMounted', {
type => 'TEXT',
display => '12',
form_display => 'Can Be Mounted?',
form_type => 'SELECT',
form_values => [ 'Yes','No' ],
form_names => [ 'Y','N' ]
}) or die "Cant add 'CanBeMounted' SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'QuickFrameable'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('QuickFrameable', {
type => 'TEXT',
display => '12',
form_display => 'Quick Framable?',
form_type => 'SELECT',
form_values => [ 'Yes','No' ],
form_names => [ 'Y','N' ]
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ImageHeight'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ImageHeight', {
type => 'TEXT',
display => '12',
form_display => 'Image Height:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ImageWidth'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ImageWidth', {
type => 'TEXT',
display => '12',
form_display => 'Image Width:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ImageURL'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ImageURL', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'Thumb Image URL:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ListPrice'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ListPrice', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'List Price:',
decimal => '2',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'OurPrice'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('OurPrice', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'Our Price:',
decimal => '2',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ProductHeight'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ProductHeight', {
pos => 2,
type => 'INT',
display => '12',
form_display => 'Product Height:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ProductWidth'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ProductWidth', {
pos => 2,
type => 'INT',
display => '12',
form_display => 'Product Width:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ProductLink'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ProductLink', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'Product Buy URL:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ProductType'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ProductType', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'Product Type:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ThumbnailHeight'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ThumbnailHeight', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'Thumbnail Height:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ThumbnailWidth'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ThumbnailWidth', {
pos => 2,
type => 'TEXT',
display => '12',
form_display => 'Thumbnail Width:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
unless (exists $DB->table('Links')->cols->{'ProductNumber'}) {
my $editor = $DB->editor ('Links');
$editor->add_col ('ProductNumber', {
pos => 2,
type => 'INT',
display => '12',
form_display => 'Product Number:',
}) or die "Cant add SQL field. Reason: $GT::SQL::error";
}
$mgr->install_menu ( 'AllPosters_Import', [ ['Readme', 'admin.cgi?do=plugin&plugin=AllPosters_Import&func=Readme'] ] );
$mgr->install_menu ( 'AllPosters_Import', [ ['Setup', 'admin.cgi?do=page&page=plugin_manager.html&plugin_man_do=edit_installed&plugin_name=AllPosters_Import'] ] );
$mgr->install_options ( 'AllPosters_Import', [ ['AffiliateID', '1802204885', 'Set this to your ID number.', 'TEXT', [], [], '' ] ] );
;
return "The plugin has been successfully installed!";
}
sub uninstall {
# -------------------------------------------------------------------
# This function removes the plugin. It's first argument is
# also a plugin manager which you can use to register hooks, install files,
# add menu options, etc. You should return an HTML formatted string
# that will be displayed to the user.
#
# If there is an error, return undef, and set the error message in
# $Plugins::AllPosters_Import::error
#
my $mgr = shift;
$mgr->uninstall_menu ( 'AllPosters_Import', [ ['Readme', 'admin.cgi?do=plugin&plugin=AllPosters_Import&func=Readme'] ] );
$mgr->uninstall_menu ( 'AllPosters_Import', [ ['Setup', 'admin.cgi?do=page&page=plugin_manager.html&plugin_man_do=edit_installed&plugin_name=AllPosters_Import'] ] );
$mgr->uninstall_options ( 'AllPosters_Import', [ ['AffiliateID', '1802204885', 'Set this to your ID number.', 'TEXT', [], [], '' ] ] );
;
return "The plugin has been successfully removed!";
}
1;
AllPosters_Import.pm 0000644 0001752 0000153 00000015454 10071042647 015330 0 ustar linkssql linkssql # ==================================================================
# Plugins::AllPosters_Import - Auto Generated Program Module
#
# Plugins::AllPosters_Import
# Author : Andy Newby (UltraNerds)
# Version : 1.2
# Updated : Sat Sept 25th 2004
#
# ==================================================================
#
package Plugins::AllPosters_Import;
# ==================================================================
use strict;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/$CFG $IN $DB/;
# Inherit from base class for debug and error methods
@Plugins::AllPosters_Import::ISA = qw(GT::Base);
# Your code begins here! Good Luck!
# ADMIN MENU OPTIONS
# ===================================================================
sub Readme {
# -------------------------------------------------------------------
# This subroutine will get called whenever the user clicks
# on 'Readme' in the admin menu. Remember, you need to print
# your own content-type headers; you should use
#
print $IN->header();
print q{
AllPosters_Import
Readme
installing || customization || support
Author: Andy Newby
WWW:
http://www.ultranerds.com
>> IMPORTANT NOTE <<
This plugin was *NOT* easy to write. I've spent several days getting this to work. If you signed up with me as a referral ( CLICK ), then this plugin is free. However, if you didn't...please send $30 to andy@ultranerds.com. Failing to do either of the mentioned will cause me to NOT bother writing any more free plugins .. which I don't think anyone wants :/
INSTALLING
There isn't really that much to installing this plugin. If you are reading this, then I guess it all went ok :) You now need to click on "Setup", on the left frame. This will give you somewhere to set your ALLPOSTERS ID number. Please be sure to set this (although, if you don't want to...I don't mind you leaving my ID number in there :p).
That's about it. Please read the below section too though.
HOW TO RUN
There isn't a huge amount to learn here. You just need to run the "import" command(s) from Telnet/SSH.
Some sample calls, are;
perl allposters.cgi --file=ftp://datafeed:9h5Zj6vOe0@ftp.allposters.com/AllPosters_CompleteDatafeed_TXT.zip -category=Art -clean=yes -dograb=no
perl allposters.cgi --file=ftp://datafeed:9h5Zj6vOe0@ftp.allposters.com/AllPosters_CompleteDatafeed_TXT.zip -category=Entertainment -clean=no -dograb=no
perl allposters.cgi --file=ftp://datafeed:9h5Zj6vOe0@ftp.allposters.com/AllPosters_CompleteDatafeed_TXT.zip -category=Specialty~~Products -clean=no -dograb=no
The options are explained below;
-category=(Arts|Entertainment|Specialty~~Products) ====> This decides which section of the datafeed you want to import.
-clean=(yes|no) ===> This part decides if you want to empty your database first, or not.
-dograb=(yes|no) ====> This option lets you decide if you want to re-download the .zip file from AllPosters.
-file=URL_TO_ZIP_FILE ====> This is the URL that the datafeed is coming from. Due to the way that AllPosters organize their datafeeds, you require a username and password to download the file. This changes on a weekly basis. Example: ftp://datafeed:9h5Zj6vOe0@ftp.allposters.com/AllPosters_CompleteDatafeed_TXT.zip
CUSTOMIZATION
About the only customization you need to do, is edit link.html;
<%if LinkOwner
eq 'ALLPOSTERS'%>
<%include link_allposters.html%>
<%else%>
...your normal link stuff here...
<%endif%>
A new template has also been setup with this plugin (link_allposters.html), which is pre-setup to work "out-of-the-box"
To see a full list of the variables that are available to you, the <%GT::Template::dump%> tag will show you a complete list.
SUPPORT
This is a pretty simple to plugin to setup/customize, but if you have any problems with it, please feel free to contact me via any of the below methods;
Email:
andy@ultranerds.com
WWW: http://www.ultranerds.com/forum
GT Forum:
http://www.gossamer-threads.com/forum