Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • composerify
  • email-4
  • master
3 results

Target

Select target project
  • erasmussen2/UNL_WDN_Emailer
  • s-mfairch4/UNL_WDN_Emailer
  • dxg/UNL_WDN_Emailer
3 results
Select Git revision
  • email-4
  • master
2 results
Show changes
Commits on Source (5)
Showing
with 123 additions and 1450 deletions
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>
/UNL_WDN_Mailer.sublime-project /.project
/UNL_WDN_Mailer.sublime-workspace /*.sublime-*
\ No newline at end of file /composer.lock
/vendor
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>UNL_WDN_Emailer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
</projectDescription>
#Thu Jul 22 11:43:57 CDT 2010
eclipse.preferences.version=1
include_path=0;/UNL_WDN_Emailer
;; put your info here
Brett Bieber [saltybeagle] <brett.bieber@gmail.com> (lead)
Package UNL_WDN_Email release notes for version 0.1.0.
Basic functionality is available.
{
"autoload": {
"psr-0": {
"UNL": "src/"
}
},
"require": {
"swiftmailer/swiftmailer": "^5.4",
"saltybeagle/savvy": "^0.9.0"
}
}
<?php <?php
function autoload($class)
{
$class = str_replace('_', '/', $class);
include $class . '.php';
}
spl_autoload_register("autoload");
set_include_path(dirname(__FILE__).'/src'.PATH_SEPARATOR.dirname(__FILE__).'/lib/php');
ini_set('display_errors', true); ini_set('display_errors', true);
error_reporting(E_ALL); error_reporting(E_ALL);
require __DIR__ . '/vendor/autoload.php';
<?php /* @var $context UNL_WDN_Emailer_Main */ ?> <?php /* @var $context UNL_WDN_Emailer_Main */ ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head> <html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title><?php echo $context->subject ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>UNL Marketplace Email</title>
<style type="text/css"> <style type="text/css">
#outlook a{padding:0;}
.ReadMsgBody {width: 100%;}
.ExternalClass {width: 100%;} .ExternalClass {width: 100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
body, table, td, a{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;} body {-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;}
table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;}
img{-ms-interpolation-mode:bicubic;}
body {margin:0; padding:0;} body {margin:0; padding:0;}
img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;} table td {border-collapse:collapse}
table{border-collapse:collapse !important;}
body{height:100% !important; margin:0; padding:0; width:100% !important;}
.appleBody a {color:#999999; text-decoration: none;}
.appleFooter a {color:#ffffff;}
.appleEvents a {color: #abadb3; font-weight:bold; text-decoration: none;}
.appleEventsBody a {color: #81261d;; text-decoration: none;}
blockquote .original-only, .WordSection1 .original-only {display: none !important;}
blockquote table.forwarded-only, .WordSection1 table.forwarded-only {display: block !important;}
@media screen and (max-width: 650px) { @media screen and (max-width: 650px) {
table[class="wrapper"]{ body[yahoo] .wrapper{
width:100% !important;} width:100% !important;}
td[class="mobile-hide"]{ body[yahoo] .mobile-hide{
display:none;} display:none;}
td[class="mobile-show"]{ body[yahoo] .mobile-show{
display:block!important;} display:block!important;}
td[class="mobile-logo"] img{ body[yahoo] .wdn-header-top img{
height:54px!important; height:30px!important;
width:54px!important;} width:auto!important;
td[class="mobile-unl"]{ }
height:23px;} body[yahoo] .wdn-logo{
td[class="mobile-unl"] img{ width:66px!important;
height:23px!important; }
width:266px!important;} body[yahoo] .wdn-logo img{
td[class="mobile-header"]{ height:71px!important;
vertical-align: top; width:auto!important;
font-size: 23px!important; }
line-height: 1.1!important;} body[yahoo] .wdn-logo-lockup img{
td[class="head1"]{ height:71px!important;
font-size: 30px!important; width:auto!important;
padding: 0 10px 20px!important;} }
td[class="head2"]{ body[yahoo] table.button{
font-size: 16px!important;
padding: 25px 20px 20px 20px!important;}
td[class="head3"]{
font-size: 15px!important;
padding: 0 0 25px 0!important;}
td[class="head4"]{
padding: 0 20px 25px 20px !important;}
table[class="button"]{
width:85%!important; width:85%!important;
height:auto} height:auto}
td[class="button"]{ body[yahoo] td.button {
font-size: 20px!important; font-size: 20px!important;
padding: 10px!important;} padding: 10px!important;}
img[class="img-full"]{ body[yahoo] .img-full{
width:100% !important; width:100% !important;
max-width: 100%; max-width: 100%;
height:auto;} height:auto;}
table[class="responsive-table"]{ body[yahoo] .responsive-table{
float: none!important; float: none!important;
width:100%!important;} width:100%!important;}
td[class="padding"]{ body[yahoo] .padding {
padding: 10px 8% 10px 8% !important; padding: 10px 8% 10px 8% !important;
text-align: center !important;} text-align: center !important;}
td[class="section-padding"]{ body[yahoo] .section-padding{
padding: 50px 15px 50px 15px !important;} padding: 50px 15px 50px 15px !important;}
} }
</style> </style>
</head> </head>
<body style="margin: 0; padding: 0; line-height: 0"> <body yahoo="fix" style="margin: 0; padding: 0; color:#5b5b5a; font-size:16px; line-height:1.777; font-family:Georgia, serif;" bgcolor="#fefdfa" link="#d00000">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="line-height: normal;"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr> <td>
<td style="border-bottom: 1px solid #ECDEC5;">
<table border="0" cellpadding="0" cellspacing="0" width="100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr> <tr>
<td bgcolor="#F2EEE4" class="mobile-hide"> <td bgcolor="#FEFDFA" class="wdn-header-top">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="650" class="responsive-table"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="650" class="responsive-table">
<tr> <tr>
<td><a href="http://www.unl.edu/" target="_blank"><img src="<?php echo $context->imgHost ?>header_01.gif" alt="" height="41" width="650" border="0" align="left" style="display: block;"></a></td> <td><a href="http://www.unl.edu/" target="_blank" style="text-decoration: none; color: #d00000;"><img src="<?php echo $context->imgHost ?>41_01.gif" width="320" height="36" alt="" border="0" align="left" style="display: block;"></a></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr>
<td bgcolor="#F8F5EC" class="mobile-hide">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="650" class="responsive-table">
<tr>
<td><a href="http://www.unl.edu/" target="_blank"><img src="<?php echo $context->imgHost ?>header_02.gif" alt="" height="30" width="650" border="0" align="left" style="display: block;"></a></td>
</tr>
<tr>
<td align="center" style="font-size: 30px; line-height: 1.5; font-family: Georgia, serif;"><a href="<?php echo $context->main_uri ?>" target="_blank" style="text-decoration: none; color:#444341"><?php echo $context->html_header ?></a></td>
</tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgcolor="#F8F5EC" style="display: none;" class="mobile-show"> <td style="border-top:1px solid #EAE9E6">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="650" class="responsive-table"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr> <tr>
<td class="mobile-logo" rowspan="2" width="54"><a href="http://www.unl.edu/" target="_blank"><img src="<?php echo $context->imgHost ?>header_05.gif" width="1" height="1" alt="" border="0" align="left" style="display: block; width: 0px; height: 0px;"></a></td> <td bgcolor="#FEFDFA">
<td class="mobile-unl"><img src="<?php echo $context->imgHost ?>header_06.gif" width="1" height="1" alt="" border="0" align="left" style="display: block; width: 0px; height: 0px;"></td> <table align="center" border="0" cellpadding="0" cellspacing="0" width="650" class="responsive-table">
</tr>
<tr> <tr>
<td class="mobile-header" style="font-size: 0px; line-height: 0; font-family: Georgia, serif;"><a href="<?php echo $context->main_uri ?>" target="_blank" style="text-decoration: none; color: #444341;"><?php echo isset($context->html_header_short) ? $context->html_header_short : $context->html_header ?></a></td> <td width="77" class="wdn-logo"><a href="http://www.unl.edu/" target="_blank"><img src="<?php echo $context->imgHost ?>41_02.gif" width="77" height="83" alt="" border="0" align="left" style="display: block;"></a></td>
<td valign="middle" class="wdn-logo-lockup" style="font-size:38px; line-height:1; font-family: 'Arial Narrow', Arial, sans-serif; text-transform:uppercase; white-space:nowrap"><a href="<?php echo $context->main_uri ?>" target="_blank" style="text-decoration: none; color:#474746"><?php echo $context->html_header ?></a></td>
</tr> </tr>
</table> </table>
</td> </td>
...@@ -122,16 +92,16 @@ ...@@ -122,16 +92,16 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="line-height: normal;"> <table border="0" cellpadding="0" cellspacing="0" width="100%" style="line-height: normal;">
<tr> <tr>
<td bgcolor="#525151" align="center"> <td bgcolor="#333332" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> <tr>
<td style="padding: 20px 20px 20px 20px;"> <td style="padding: 20px 20px 20px 20px;">
<table width="610" border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table"> <table width="610" border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
<tr> <tr>
<td align="left" valign="middle" style="font-size: 10px; line-height: 16px; font-family: Helvetica, Arial, sans-serif; color:#cfcfcf; -webkit-text-size-adjust: none"><span class="appleFooter" style="color:#cfcfcf; -webkit-text-size-adjust: none"> <td align="left" valign="middle" style="font-size: 10px; line-height: 16px; font-family: Verdana, sans-serif; color:#adacaa; -webkit-text-size-adjust: none"><span class="appleFooter" style="color:#adacaa; -webkit-text-size-adjust: none">
<?php echo $context->html_footer ?> <?php echo $context->html_footer ?>
</span></td> </span></td>
<td width="111" valign="top" class="mobile-hide" style="padding-left:20px"><a href="http://www.unl.edu/" target="_blank" style="font-family: Arial; color: #ffffff; font-size: 14px;"><img alt="University of Nebraska-Lincoln" src="<?php echo $context->imgHost ?>wordmark.gif" width="111" height="43" style="display: block;" border="0"></a></td> <td width="111" valign="top" class="mobile-hide" style="padding-left:20px"><a href="http://www.unl.edu/" target="_blank" style="font-family: Verdana; color: #ffffff; font-size: 14px;"><img alt="University of Nebraska-Lincoln" src="<?php echo $context->imgHost ?>wordmark.gif" width="111" height="43" style="display: block;" border="0"></a></td>
</tr> </tr>
</table> </table>
</td> </td>
...@@ -139,6 +109,5 @@ ...@@ -139,6 +109,5 @@
</table> </table>
</td> </td>
</tr> </tr>
</table> </table></body>
</body>
</html> </html>
<?php /* @var $context UNL_WDN_Emailer_Template_Band */ ?> <?php /* @var $context UNL_WDN_Emailer_Template_Band */ ?>
<?php $color = isset($context->foreground) ? $context->foreground : '#444431'; ?> <?php $color = isset($context->foreground) ? $context->foreground : '#474746'; ?>
<?php $bgcolor = isset($context->background) ? $context->background : '#F8F5EC'; ?> <?php $bgcolor = isset($context->background) ? $context->background : '#FEFDFA'; ?>
<?php $hcolor = isset($context->headlineColor) ? $context->headlineColor : $color; ?> <?php $hcolor = isset($context->headlineColor) ? $context->headlineColor : $color; ?>
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="line-height: normal;"> <table border="0" cellpadding="0" cellspacing="0" width="100%" style="line-height: normal;">
<tr> <tr>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php if (isset($context->headline)): ?> <?php if (isset($context->headline)): ?>
<tr> <tr>
<td align="left" style="font-size: 25px; font-family: Helvetica, Arial, sans-serif; color: <?php echo $hcolor ?>; padding-bottom:20px;"> <td align="left" style="font-size: 25px; font-family: 'Arial Narrow', Arial, sans-serif; color: <?php echo $hcolor ?>; padding-bottom:20px;">
<?php echo $context->headline ?> <?php echo $context->headline ?>
</td> </td>
</tr> </tr>
......
<?php /* @var $context UNL_WDN_Emailer_Template_Link */ ?> <?php /* @var $context UNL_WDN_Emailer_Template_Link */ ?>
<a href="<?php echo $context->href ?>" style="text-decoration:none; border-bottom:1px dotted #cc0000; color: #cc0000;"><?php echo $context->label ?></a> <a href="<?php echo $context->href ?>" style="text-decoration:none; border-bottom:1px dotted #d00000; color: #d00000;"><?php echo $context->label ?></a>
\ No newline at end of file \ No newline at end of file
<?php /* @var $context UNL_WDN_Emailer_Main */ ?> <?php /* @var $context UNL_WDN_Emailer_Main */ ?>
DDDDDDDDDDDD ?DDDDDDDDDDDDDDDD UNIVERSITY OF NEBRASKA–LINCOLN
DDDNNNNNNNDDZ ?DDNNNNNNNNNNNDDD ------------------------------------------------------------------------------------------
DDN7= $NDD~ ?DDDZZ7 ,IZZNDD <?php echo strip_tags($context->html_header) . "\n" ?>
DDDDDN :NDD. ?DDDDDDZ MDDDDDD __ __ __ ___ __ __ <?php echo $context->main_uri . "\n" ?>
888DDD? .NDDD ?8888DDD NDD888D / \|\ ||\ /|_ |__)(_ | | \_/ / \|_
?DD? :DDDO. .DDD NDD, \__/| \|| \/ |__| \ __)| | | \__/|
?DD? +M $NDD= .DDD NDD,
?DD? +ND: :NDD. .DDD NDD, __ __ __ __
?DD? +NDDI $DDD .DDD NDD, |\ ||_ |__)|__) /\ (_ |_/ /\
?DD? +NDDN: DDDZ,DDD NDD, | \||__|__)| \ /--\__)| \/--\
?DD? +NDDDDN $NDDDDD NDD,
?DD? +NDDZDDD: :NDDDD NDD, __ __
?DD? +NDD IDDDI $DDD NDD, | ||\ |/ / \| |\ |
?DD? +NDD ,DDND DND NDD, |__|| \|\__\__/|__| \|
?DD? +NDD IDDN N NDD,
?DD? +NDD ODDD: : NDD, http://www.unl.edu/
DDDDDD? +NDDDDDD: DDDI NDDDDDD
DDDDDD+ =NDDDDDD: .DDND MDDDDDD
DDN77~ I7ZDDD: ?DDNI =7NDD
DDNOOOOOOOOO8DDD: ODDNOOOOOOONDD
DDDDDDDDDDDDDDDD: DDDDDDDDDDDD <?php echo strip_tags($context->html_header) . "\n" ?>
8888888888888888, ,Z8888888888 <?php echo $context->main_uri . "\n" ?>
========================================================================================== ==========================================================================================
......
<!--
$Id: package.dtd,v 1.38 2005-11-12 02:23:07 cellog Exp $
This is the PEAR package description, version 1.0.
It should be used with the informal public identifier:
"-//PHP Group//DTD PEAR Package 1.0//EN//XML"
Copyright (c) 1997-2005 The PHP Group
This source file is subject to version 3.00 of the PHP license,
that is bundled with this package in the file LICENSE, and is
available at through the world-wide-web at
http://www.php.net/license/3_0.txt.
If you did not receive a copy of the PHP license and are unable to
obtain it through the world-wide-web, please send a note to
license@php.net so we can mail you a copy immediately.
Authors:
Stig S. Bakken <ssb@fast.no>
Gregory Beaver <cellog@php.net>
-->
<!ENTITY % NUMBER "CDATA">
<!ELEMENT package (name,summary,description,license?,maintainers,release,changelog?)>
<!ATTLIST package type (source|binary|empty) "empty"
version CDATA #REQUIRED
packagerversion CDATA #IMPLIED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT summary (#PCDATA)>
<!ELEMENT license (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT maintainers (maintainer)+>
<!ELEMENT maintainer (user|role|name|email)+>
<!ELEMENT user (#PCDATA)>
<!ELEMENT role (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT changelog (release)+>
<!ELEMENT release (version,date,license,state,notes,warnings?,provides*,deps?,configureoptions?,filelist?)>
<!ELEMENT version (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT notes (#PCDATA)>
<!ELEMENT warnings (#PCDATA)>
<!ELEMENT deps (dep*)>
<!ELEMENT dep (#PCDATA)>
<!ATTLIST dep type (pkg|ext|php) #REQUIRED
rel (has|eq|lt|le|gt|ge) #IMPLIED
version CDATA #IMPLIED
optional (yes|no) 'no'>
<!ELEMENT configureoptions (configureoption)+>
<!ELEMENT configureoption EMPTY>
<!ATTLIST configureoption name CDATA #REQUIRED
default CDATA #IMPLIED
prompt CDATA #REQUIRED>
<!ELEMENT provides EMPTY>
<!ATTLIST provides type (ext|prog|class|function|feature|api) #REQUIRED
name CDATA #REQUIRED
extends CDATA #IMPLIED>
<!ELEMENT filelist (dir|file)+>
<!ELEMENT dir (dir|file)+>
<!ATTLIST dir name CDATA #REQUIRED
role (php|ext|src|test|doc|data|script) 'php'
baseinstalldir CDATA #IMPLIED>
<!ELEMENT file (replace*)>
<!ATTLIST file role (php|ext|src|test|doc|data|script) 'php'
debug (na|on|off) 'na'
format CDATA #IMPLIED
baseinstalldir CDATA #IMPLIED
platform CDATA #IMPLIED
md5sum CDATA #IMPLIED
name CDATA #REQUIRED
install-as CDATA #IMPLIED>
<!ELEMENT replace EMPTY>
<!ATTLIST replace type (php-const|pear-config|package-info) #REQUIRED
from CDATA #REQUIRED
to CDATA #REQUIRED>
Summary: PEAR: @summary@
Name: @rpm_package@
Version: @version@
Release: 1
License: @release_license@
Group: Development/Libraries
Source: http://@master_server@/get/@package@-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-root
URL: http://@master_server@/package/@package@
Prefix: %{_prefix}
BuildArchitectures: @arch@
@extra_headers@
%description
@description@
%prep
rm -rf %{buildroot}/*
%setup -c -T
# XXX Source files location is missing here in pear cmd
pear -v -c %{buildroot}/pearrc \
-d php_dir=%{_libdir}/php/pear \
-d doc_dir=/docs \
-d bin_dir=%{_bindir} \
-d data_dir=%{_libdir}/php/pear/data \
-d test_dir=%{_libdir}/php/pear/tests \
-d ext_dir=%{_libdir} \@extra_config@
-s
%build
echo BuildRoot=%{buildroot}
%postun
# if refcount = 0 then package has been removed (not upgraded)
if [ "$1" -eq "0" ]; then
pear uninstall --nodeps -r @possible_channel@@package@
rm @rpm_xml_dir@/@package@.xml
fi
%post
# if refcount = 2 then package has been upgraded
if [ "$1" -ge "2" ]; then
pear upgrade --nodeps -r @rpm_xml_dir@/@package@.xml
else
pear install --nodeps -r @rpm_xml_dir@/@package@.xml
fi
%install
pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \
$RPM_SOURCE_DIR/@package@-%{version}.tgz
rm %{buildroot}/pearrc
rm %{buildroot}/%{_libdir}/php/pear/.filemap
rm %{buildroot}/%{_libdir}/php/pear/.lock
rm -rf %{buildroot}/%{_libdir}/php/pear/.registry
if [ "@doc_files@" != "" ]; then
mv %{buildroot}/docs/@package@/* .
rm -rf %{buildroot}/docs
fi
mkdir -p %{buildroot}@rpm_xml_dir@
tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package@package2xml@.xml
cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml
#rm -rf %{buildroot}/*
#pear -q install -R %{buildroot} -n package@package2xml@.xml
#mkdir -p %{buildroot}@rpm_xml_dir@
#cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml
%files
%defattr(-,root,root)
%doc @doc_files@
/
This diff is collapsed.
Documentation for class Archive_Tar
===================================
Last update : 2001-08-15
Overview :
----------
The Archive_Tar class helps in creating and managing GNU TAR format
files compressed by GNU ZIP or not.
The class offers basic functions like creating an archive, adding
files in the archive, extracting files from the archive and listing
the archive content.
It also provide advanced functions that allow the adding and
extraction of files with path manipulation.
Sample :
--------
// ----- Creating the object (uncompressed archive)
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT);
// ----- Creating the archive
$v_list[0]="file.txt";
$v_list[1]="data/";
$v_list[2]="file.log";
$tar_object->create($v_list);
// ----- Adding files
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/";
$v_list[2]="log/file.log";
$tar_object->add($v_list);
// ----- Adding more files
$tar_object->add("release/newfile.log release/readme.txt");
// ----- Listing the content
if (($v_list = $tar_object->listContent()) != 0)
for ($i=0; $i<sizeof($v_list); $i++)
{
echo "Filename :'".$v_list[$i][filename]."'<br>";
echo " .size :'".$v_list[$i][size]."'<br>";
echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
echo " .mode :'".$v_list[$i][mode]."'<br>";
echo " .uid :'".$v_list[$i][uid]."'<br>";
echo " .gid :'".$v_list[$i][gid]."'<br>";
echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
}
// ----- Extracting the archive in directory "install"
$tar_object->extract("install");
Public arguments :
------------------
None
Public Methods :
----------------
Method : Archive_Tar($p_tarname, $compress = null)
Description :
Archive_Tar Class constructor. This flavour of the constructor only
declare a new Archive_Tar object, identifying it by the name of the
tar file.
If the compress argument is set the tar will be read or created as a
gzip or bz2 compressed TAR file.
Arguments :
$p_tarname : A valid filename for the tar archive file.
$p_compress : can be null, 'gz' or 'bz2'. For
compatibility reason it can also be true. This
parameter indicates if gzip or bz2 compression
is required.
Return value :
The Archive_Tar object.
Sample :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object_compressed = new Archive_Tar("tarname.tgz", true);
How it works :
Initialize the object.
Method : create($p_filelist)
Description :
This method creates the archive file and add the files / directories
that are listed in $p_filelist.
If the file already exists and is writable, it is replaced by the
new tar. It is a create and not an add. If the file exists and is
read-only or is a directory it is not replaced. The method return
false and a PEAR error text.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
See also createModify() method for more details.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
Return value :
true on success, false on error.
Sample 1 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$v_list[0]="file.txt";
$v_list[1]="data/"; (Optional '/' at the end)
$v_list[2]="file.log";
$tar_object->create($v_list);
Sample 2 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$tar_object->create("file.txt data/ file.log");
How it works :
Just calling the createModify() method with the right parameters.
Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
Description :
This method creates the archive file and add the files / directories
that are listed in $p_filelist.
If the file already exists and is writable, it is replaced by the
new tar. It is a create and not an add. If the file exists and is
read-only or is a directory it is not replaced. The method return
false and a PEAR error text.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
The path indicated in $p_remove_dir will be removed from the
memorized path of each file / directory listed when this path
exists. By default nothing is removed (empty path "")
The path indicated in $p_add_dir will be added at the beginning of
the memorized path of each file / directory listed. However it can
be set to empty "". The adding of a path is done after the removing
of path.
The path add/remove ability enables the user to prepare an archive
for extraction in a different path than the origin files are.
See also addModify() method for file adding properties.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
$p_add_dir : A string which contains a path to be added to the
memorized path of each element in the list.
$p_remove_dir : A string which contains a path to be removed from
the memorized path of each element in the list, when
relevant.
Return value :
true on success, false on error.
Sample 1 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$v_list[0]="file.txt";
$v_list[1]="data/"; (Optional '/' at the end)
$v_list[2]="file.log";
$tar_object->createModify($v_list, "install");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/file.log
Sample 2 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/"; (Optional '/' at the end)
$v_list[2]="log/file.log";
$tar_object->createModify($v_list, "install", "dev");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/log/file.log
How it works :
Open the file in write mode (erasing the existing one if one),
call the _addList() method for adding the files in an empty archive,
add the tar footer (512 bytes block), close the tar file.
Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
Description :
This method add the files / directories listed in $p_filelist at the
end of the existing archive. If the archive does not yet exists it
is created.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
The path indicated in $p_remove_dir will be removed from the
memorized path of each file / directory listed when this path
exists. By default nothing is removed (empty path "")
The path indicated in $p_add_dir will be added at the beginning of
the memorized path of each file / directory listed. However it can
be set to empty "". The adding of a path is done after the removing
of path.
The path add/remove ability enables the user to prepare an archive
for extraction in a different path than the origin files are.
If a file/dir is already in the archive it will only be added at the
end of the archive. There is no update of the existing archived
file/dir. However while extracting the archive, the last file will
replace the first one. This results in a none optimization of the
archive size.
If a file/dir does not exist the file/dir is ignored. However an
error text is send to PEAR error.
If a file/dir is not readable the file/dir is ignored. However an
error text is send to PEAR error.
If the resulting filename/dirname (after the add/remove option or
not) string is greater than 99 char, the file/dir is
ignored. However an error text is send to PEAR error.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
$p_add_dir : A string which contains a path to be added to the
memorized path of each element in the list.
$p_remove_dir : A string which contains a path to be removed from
the memorized path of each element in the list, when
relevant.
Return value :
true on success, false on error.
Sample 1 :
$tar_object = new Archive_Tar("tarname.tar");
[...]
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/"; (Optional '/' at the end)
$v_list[2]="log/file.log";
$tar_object->addModify($v_list, "install");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/file.log
Sample 2 :
$tar_object = new Archive_Tar("tarname.tar");
[...]
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/"; (Optional '/' at the end)
$v_list[2]="log/file.log";
$tar_object->addModify($v_list, "install", "dev");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/log/file.log
How it works :
If the archive does not exists it create it and add the files.
If the archive does exists and is not compressed, it open it, jump
before the last empty 512 bytes block (tar footer) and add the files
at this point.
If the archive does exists and is compressed, a temporary copy file
is created. This temporary file is then 'gzip' read block by block
until the last empty block. The new files are then added in the
compressed file.
The adding of files is done by going through the file/dir list,
adding files per files, in a recursive way through the
directory. Each time a path need to be added/removed it is done
before writing the file header in the archive.
Method : add($p_filelist)
Description :
This method add the files / directories listed in $p_filelist at the
end of the existing archive. If the archive does not yet exists it
is created.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
See addModify() method for details and limitations.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
Return value :
true on success, false on error.
Sample 1 :
$tar_object = new Archive_Tar("tarname.tar");
[...]
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/"; (Optional '/' at the end)
$v_list[2]="log/file.log";
$tar_object->add($v_list);
Sample 2 :
$tar_object = new Archive_Tar("tarname.tgz", true);
[...]
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/"; (Optional '/' at the end)
$v_list[2]="log/file.log";
$tar_object->add($v_list);
How it works :
Simply call the addModify() method with the right parameters.
Method : addString($p_filename, $p_string)
Description :
This method add a single string as a file at the
end of the existing archive. If the archive does not yet exists it
is created.
Arguments :
$p_filename : A string which contains the full filename path
that will be associated with the string.
$p_string : The content of the file added in the archive.
Return value :
true on success, false on error.
Sample 1 :
$v_archive = & new Archive_Tar($p_filename);
$v_archive->setErrorHandling(PEAR_ERROR_PRINT);
$v_result = $v_archive->addString('data/test.txt', 'This is the text of the string');
Method : extract($p_path = "")
Description :
This method extract all the content of the archive in the directory
indicated by $p_path.If $p_path is optional, if not set the archive
is extracted in the current directory.
While extracting a file, if the directory path does not exists it is
created.
See extractModify() for details and limitations.
Arguments :
$p_path : Optional path where the files/dir need to by extracted.
Return value :
true on success, false on error.
Sample :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->extract();
How it works :
Simply call the extractModify() method with appropriate parameters.
Method : extractModify($p_path, $p_remove_path)
Description :
This method extract all the content of the archive in the directory
indicated by $p_path. When relevant the memorized path of the
files/dir can be modified by removing the $p_remove_path path at the
beginning of the file/dir path.
While extracting a file, if the directory path does not exists it is
created.
While extracting a file, if the file already exists it is replaced
without looking for last modification date.
While extracting a file, if the file already exists and is write
protected, the extraction is aborted.
While extracting a file, if a directory with the same name already
exists, the extraction is aborted.
While extracting a directory, if a file with the same name already
exists, the extraction is aborted.
While extracting a file/directory if the destination directory exist
and is write protected, or does not exist but can not be created,
the extraction is aborted.
If after extraction an extracted file does not show the correct
stored file size, the extraction is aborted.
When the extraction is aborted, a PEAR error text is set and false
is returned. However the result can be a partial extraction that may
need to be manually cleaned.
Arguments :
$p_path : The path of the directory where the files/dir need to by
extracted.
$p_remove_path : Part of the memorized path that can be removed if
present at the beginning of the file/dir path.
Return value :
true on success, false on error.
Sample :
// Imagine tarname.tar with files :
// dev/data/file.txt
// dev/data/log.txt
// readme.txt
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->extractModify("install", "dev");
// Files will be extracted there :
// install/data/file.txt
// install/data/log.txt
// install/readme.txt
How it works :
Open the archive and call a more generic function that can extract
only a part of the archive or all the archive.
See extractList() method for more details.
Method : extractInString($p_filename)
Description :
This method extract from the archive one file identified by $p_filename.
The return value is a string with the file content, or NULL on error.
Arguments :
$p_filename : The path of the file to extract in a string.
Return value :
a string with the file content or NULL.
Sample :
// Imagine tarname.tar with files :
// dev/data/file.txt
// dev/data/log.txt
// dev/readme.txt
$v_archive = & new Archive_Tar('tarname.tar');
$v_archive->setErrorHandling(PEAR_ERROR_PRINT);
$v_string = $v_archive->extractInString('dev/readme.txt');
echo $v_string;
Method : listContent()
Description :
This method returns an array of arrays that describe each
file/directory present in the archive.
The array is not sorted, so it show the position of the file in the
archive.
The file informations are :
$file[filename] : Name and path of the file/dir.
$file[mode] : File permissions (result of fileperms())
$file[uid] : user id
$file[gid] : group id
$file[size] : filesize
$file[mtime] : Last modification time (result of filemtime())
$file[typeflag] : "" for file, "5" for directory
Arguments :
Return value :
An array of arrays or 0 on error.
Sample :
$tar_object = new Archive_Tar("tarname.tar");
if (($v_list = $tar_object->listContent()) != 0)
for ($i=0; $i<sizeof($v_list); $i++)
{
echo "Filename :'".$v_list[$i][filename]."'<br>";
echo " .size :'".$v_list[$i][size]."'<br>";
echo " .mtime :'".$v_list[$i][mtime]."' (".
date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
echo " .mode :'".$v_list[$i][mode]."'<br>";
echo " .uid :'".$v_list[$i][uid]."'<br>";
echo " .gid :'".$v_list[$i][gid]."'<br>";
echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
}
How it works :
Call the same function as an extract however with a flag to only go
through the archive without extracting the files.
Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
Description :
This method extract from the archive only the files indicated in the
$p_filelist. These files are extracted in the current directory or
in the directory indicated by the optional $p_path parameter.
If indicated the $p_remove_path can be used in the same way as it is
used in extractModify() method.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
$p_path : The path of the directory where the files/dir need to by
extracted.
$p_remove_path : Part of the memorized path that can be removed if
present at the beginning of the file/dir path.
Return value :
true on success, false on error.
Sample :
// Imagine tarname.tar with files :
// dev/data/file.txt
// dev/data/log.txt
// readme.txt
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->extractList("dev/data/file.txt readme.txt", "install",
"dev");
// Files will be extracted there :
// install/data/file.txt
// install/readme.txt
How it works :
Go through the archive and extract only the files present in the
list.
<?php
/**
* Usage example for HTTP_Request2 package: uploading a file to rapidshare.com
*
* Inspired by Perl usage example: http://images.rapidshare.com/software/rsapi.pl
* Rapidshare API description: http://rapidshare.com/dev.html
*
* $Id: upload-rapidshare.php 287307 2009-08-14 15:40:22Z avb $
*/
require_once 'HTTP/Request2.php';
// You'll probably want to change this
$filename = '/etc/passwd';
try {
// First step: get an available upload server
$request = new HTTP_Request2(
'http://rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver_v1'
);
$server = $request->send()->getBody();
if (!preg_match('/^(\\d+)$/', $server)) {
throw new Exception("Invalid upload server: {$server}");
}
// Calculate file hash, we'll use it later to check upload
if (false === ($hash = @md5_file($filename))) {
throw new Exception("Cannot calculate MD5 hash of '{$filename}'");
}
// Second step: upload a file to the available server
$uploader = new HTTP_Request2(
"http://rs{$server}l3.rapidshare.com/cgi-bin/upload.cgi",
HTTP_Request2::METHOD_POST
);
// Adding the file
$uploader->addUpload('filecontent', $filename);
// This will tell server to return program-friendly output
$uploader->addPostParameter('rsapi_v1', '1');
$response = $uploader->send()->getBody();
if (!preg_match_all('/^(File[^=]+)=(.+)$/m', $response, $m, PREG_SET_ORDER)) {
throw new Exception("Invalid response: {$response}");
}
$rspAry = array();
foreach ($m as $item) {
$rspAry[$item[1]] = $item[2];
}
// Check that uploaded file has the same hash
if (empty($rspAry['File1.4'])) {
throw new Exception("MD5 hash data not found in response");
} elseif ($hash != strtolower($rspAry['File1.4'])) {
throw new Exception("Upload failed, local MD5 is {$hash}, uploaded MD5 is {$rspAry['File1.4']}");
}
echo "Upload succeeded\nDownload link: {$rspAry['File1.1']}\nDelete link: {$rspAry['File1.2']}\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
?>
#!@prefix@/bin/php -Cq
<?php
/**
* PHAIL - stands for PHP Mail
* @author Tomas V.V.Cox <cox@idecnet.com>
*/
require_once 'Mail.php';
require_once 'Mail/mime.php';
require_once 'Console/Getopt.php';
$argv = Console_Getopt::readPHPArgv();
$opts = Console_Getopt::getOpt($argv, 'f:c:s:t:a:b:');
if (PEAR::isError($opts)) {
usage($opts->getMessage());
}
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$mime = &new Mail_Mime;
foreach ($opts[0] as $opt) {
$param = $opt[1];
switch ($opt[0]) {
case 'f':
$headers['From'] = $param; break;
case 'c':
$headers['Cc'] = $param; break;
case 's':
$headers['Subject'] = $param; break;
case 't':
$to = $param; break;
case 'a':
$mime->addAttachment($param); break;
case 'b':
$isfile = @is_file($param) ? true : false;
$mime->setTXTBody($param, $isfile); break;
}
}
$mbody = $mime->get();
$headers = $mime->headers($headers);
$mail =& Mail::factory('mail');
$mail->send($to, $headers, $mbody);
function usage($error)
{
die($error);
}
?>
\ No newline at end of file