|
From: <be...@us...> - 2014-04-25 11:29:27
|
Revision: 12473
http://sourceforge.net/p/xoops/svn/12473
Author: beckmi
Date: 2014-04-25 11:29:22 +0000 (Fri, 25 Apr 2014)
Log Message:
-----------
XOOPS 2.5.7 Module Pack update: Avaman
Modified Paths:
--------------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/about.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_footer.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_header.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/avatars.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/index.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/menu.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/smilies.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/docs/changelog.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/include/Archive_Zip.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/include/gtickets.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/english/admin.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/english/modinfo.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/xoops_version.php
Added Paths:
-----------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/avaman_slogo.png
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/index.html
Removed Paths:
-------------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/images/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/italian/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/japanese/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/persian/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/polish/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/language/spanish/
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/about.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/about.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/about.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -29,4 +29,4 @@
echo $aboutAdmin->addNavigation('about.php');
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
-include_once 'admin_footer.php';
\ No newline at end of file
+include_once 'admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_footer.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_footer.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_footer.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -27,4 +27,4 @@
." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
."</div>";
-xoops_cp_footer();
\ No newline at end of file
+xoops_cp_footer();
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_header.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_header.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/admin_header.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -39,8 +39,8 @@
$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
-if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){
+if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) {
include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php');
- }else{
+ } else {
redirect_header("../../../admin.php", 5, _AM_AVAMAN_MODULEADMIN_MISSING, false);
- }
\ No newline at end of file
+ }
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/avatars.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/avatars.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/avatars.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -21,17 +21,16 @@
*/
$avaman_allowed_exts = array(
- 'gif' => 'image/gif' ,
- 'jpg' => 'image/jpeg' ,
- 'jpeg' => 'image/jpeg' ,
- 'png' => 'image/png' ,
+ 'gif' => 'image/gif' ,
+ 'jpg' => 'image/jpeg' ,
+ 'jpeg' => 'image/jpeg' ,
+ 'png' => 'image/png' ,
) ;
$realmyname = 'avatars.php' ;
+include_once '../../../include/cp_header.php' ;
-include_once( '../../../include/cp_header.php' ) ;
-
-include_once "../include/gtickets.php" ;
+include_once '../include/gtickets.php';
include_once 'admin_header.php';
$indexAdmin = new ModuleAdmin();
@@ -42,136 +41,124 @@
// POST Stage
//
-if( ! empty( $_POST['modify_avatars'] ) ) {
+if ( ! empty( $_POST['modify_avatars'] ) ) {
- // Ticket Check
- if ( ! $xoopsGTicket->check() ) {
- redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors());
- }
+ // Ticket Check
+ if ( ! $xoopsGTicket->check() ) {
+ redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors());
+ }
- // rename
- $avatar_ids = array() ;
- if( is_array( @$_POST['avatar_names'] ) ) {
- foreach( $_POST['avatar_names'] as $avatar_id => $avatar_name ) {
- $avatar_id = intval( $avatar_id ) ;
- $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_name='".$myts->addSlashes($avatar_name)."' WHERE avatar_id=".intval($avatar_id) ) ;
- $avatar_ids[] = $avatar_id ;
- }
- }
+ // rename
+ $avatar_ids = array() ;
+ if ( is_array( @$_POST['avatar_names'] ) ) {
+ foreach ($_POST['avatar_names'] as $avatar_id => $avatar_name) {
+ $avatar_id = intval( $avatar_id ) ;
+ $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_name='".$myts->addSlashes($avatar_name)."' WHERE avatar_id=".intval($avatar_id) ) ;
+ $avatar_ids[] = $avatar_id ;
+ }
+ }
- // display
- foreach( $avatar_ids as $avatar_id ) {
- if( empty( $_POST['avatar_displays'][$avatar_id] ) ) {
- $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_display=0 WHERE avatar_id=$avatar_id" ) ;
- } else {
- $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_display=1 WHERE avatar_id=$avatar_id" ) ;
- }
- }
+ // display
+ foreach ($avatar_ids as $avatar_id) {
+ if ( empty( $_POST['avatar_displays'][$avatar_id] ) ) {
+ $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_display=0 WHERE avatar_id=$avatar_id" ) ;
+ } else {
+ $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_display=1 WHERE avatar_id=$avatar_id" ) ;
+ }
+ }
- // weight
- foreach( $avatar_ids as $avatar_id ) {
- $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_weight='".intval(@$_POST['avatar_weights'][$avatar_id])."' WHERE avatar_id=$avatar_id" ) ;
- }
+ // weight
+ foreach ($avatar_ids as $avatar_id) {
+ $db->query( "UPDATE ".$db->prefix("avatar")." SET avatar_weight='".intval(@$_POST['avatar_weights'][$avatar_id])."' WHERE avatar_id=$avatar_id" ) ;
+ }
- // delete
- foreach( $avatar_ids as $avatar_id ) {
- if( ! empty( $_POST['avatar_deletes'][$avatar_id] ) ) {
- $result = $db->query( "SELECT a.avatar_file,COUNT(l.user_id) FROM ".$db->prefix("avatar")." a NATURAL LEFT JOIN ".$db->prefix("avatar_user_link")." l WHERE a.avatar_id=$avatar_id GROUP BY a.avatar_id" ) ;
- if( $result ) {
- list( $file , $users ) = $db->fetchRow( $result ) ;
- if( $users > 0 ) continue ;
- if( strstr( $file , '..' ) ) die( '.. found.' ) ;
- @unlink( XOOPS_UPLOAD_PATH . '/' . $file ) ;
- $db->query( "DELETE FROM ".$db->prefix("avatar")." WHERE avatar_id=$avatar_id" ) ;
- }
- }
- }
+ // delete
+ foreach ($avatar_ids as $avatar_id) {
+ if ( ! empty( $_POST['avatar_deletes'][$avatar_id] ) ) {
+ $result = $db->query( "SELECT a.avatar_file,COUNT(l.user_id) FROM ".$db->prefix("avatar")." a NATURAL LEFT JOIN ".$db->prefix("avatar_user_link")." l WHERE a.avatar_id=$avatar_id GROUP BY a.avatar_id" ) ;
+ if ($result) {
+ list( $file , $users ) = $db->fetchRow( $result ) ;
+ if( $users > 0 ) continue ;
+ if( strstr( $file , '..' ) ) die( '.. found.' ) ;
+ @unlink( XOOPS_UPLOAD_PATH . '/' . $file ) ;
+ $db->query( "DELETE FROM ".$db->prefix("avatar")." WHERE avatar_id=$avatar_id" ) ;
+ }
+ }
+ }
- redirect_header( $realmyname , 2 , _AM_AVAMAN_DBUPDATED ) ;
- exit ;
+ redirect_header( $realmyname , 2 , _AM_AVAMAN_DBUPDATED ) ;
+ exit ;
}
-
// ARCHIVE UPLOAD
-if( ! empty( $_FILES['upload_archive']['tmp_name'] ) && is_uploaded_file( $_FILES['upload_archive']['tmp_name'] ) ) {
+if ( ! empty( $_FILES['upload_archive']['tmp_name'] ) && is_uploaded_file( $_FILES['upload_archive']['tmp_name'] ) ) {
- // extract stage
- $orig_filename4check = strtolower( $_FILES['upload_archive']['name'] ) ;
- $orig_ext4check = substr( $orig_filename4check , strrpos( $orig_filename4check , '.' ) + 1 ) ;
- if( $orig_ext4check == 'zip' ) {
-
- // zip
- include_once dirname(dirname(__FILE__)).'/include/Archive_Zip.php' ;
- $reader = new Archive_Zip( $_FILES['upload_archive']['tmp_name'] ) ;
- $files = $reader->extract( array( 'extract_as_string' => true ) ) ;
- if( ! is_array( @$files ) ) die( $reader->errorName() ) ;
-
- } else if( $orig_ext4check == 'tar' || $orig_ext4check == 'tgz' || $orig_ext4check == 'gz' ) {
-
- // tar or tgz or tar.gz
- include_once XOOPS_ROOT_PATH.'/class/class.tar.php' ;
- $tar = new tar() ;
- $tar->openTar( $_FILES['upload_archive']['tmp_name'] ) ;
- $files = array() ;
- foreach( $tar->files as $id => $info ) {
- $files[] = array(
- 'filename' => $info['name'] ,
- 'mtime' => $info['time'] ,
- 'content' => $info['file'] ,
- ) ;
- }
- if( empty( $files ) ) die( _AM_AVAMAN_ERR_INVALIDARCHIVE ) ;
+ // extract stage
+ $orig_filename4check = strtolower( $_FILES['upload_archive']['name'] ) ;
+ $orig_ext4check = substr( $orig_filename4check , strrpos( $orig_filename4check , '.' ) + 1 ) ;
+ if ($orig_ext4check == 'zip') {
- } else if( ! empty( $avaman_allowed_exts[$orig_ext4check] ) ) {
-
- // a single image file
- $files = array() ;
- $files[] = array(
- 'filename' => $_FILES['upload_archive']['name'] ,
- 'mtime' => time() ,
- 'content' => function_exists( 'file_get_contents' ) ? file_get_contents( $_FILES['upload_archive']['tmp_name'] ) : implode( file( $_FILES['upload_archive']['tmp_name'] ) ) ,
- ) ;
- } else {
- die( _AM_AVAMAN_INVALIDEXT ) ;
- }
+ // zip
+ include_once dirname(dirname(__FILE__)).'/include/Archive_Zip.php' ;
+ $reader = new Archive_Zip( $_FILES['upload_archive']['tmp_name'] ) ;
+ $files = $reader->extract( array( 'extract_as_string' => true ) ) ;
+ if( ! is_array( @$files ) ) die( $reader->errorName() ) ;
- // import stage
- $imported = 0 ;
- foreach( $files as $file ) {
-
- if( ! empty( $file['folder'] ) ) continue ;
- $file_pos = strrpos( $file['filename'] , '/' ) ;
- $file_name = $file_pos === false ? $file['filename'] : substr( $file['filename'] , $file_pos + 1 ) ;
- $ext_pos = strrpos( $file_name , '.' ) ;
- if( $ext_pos === false ) continue ;
- $ext = strtolower( substr( $file_name , $ext_pos + 1 ) ) ;
- if( empty( $avaman_allowed_exts[$ext] ) ) continue ;
- $file_node = substr( $file_name , 0 , $ext_pos ) ;
- $save_file_name = uniqid( 'savt' ) . '.' . $ext ;
- $fw = fopen( XOOPS_UPLOAD_PATH.'/'.$save_file_name , "w" ) ;
- if( ! $fw ) continue ;
- @fwrite( $fw , $file['content'] ) ;
- @fclose( $fw ) ;
- $db->query( "INSERT INTO ".$db->prefix("avatar")." SET avatar_file='".addslashes($save_file_name)."', avatar_name='".addslashes($file_node)."', avatar_mimetype='".addslashes(@$avaman_allowed_exts[$ext])."', avatar_created=UNIX_TIMESTAMP(), avatar_display=1, avatar_weight=0, avatar_type='S'" ) ;
+ } elseif ($orig_ext4check == 'tar' || $orig_ext4check == 'tgz' || $orig_ext4check == 'gz') {
- $imported ++ ;
- }
-
- redirect_header( $realmyname , 3 , sprintf( _AM_AVAMAN_FILEUPLOADED , $imported ) ) ;
- exit ;
-}
+ // tar or tgz or tar.gz
+ include_once XOOPS_ROOT_PATH.'/class/class.tar.php' ;
+ $tar = new tar() ;
+ $tar->openTar( $_FILES['upload_archive']['tmp_name'] ) ;
+ $files = array() ;
+ foreach ($tar->files as $id => $info) {
+ $files[] = array(
+ 'filename' => $info['name'] ,
+ 'mtime' => $info['time'] ,
+ 'content' => $info['file'] ,
+ ) ;
+ }
+ if( empty( $files ) ) die( _AM_AVAMAN_ERR_INVALIDARCHIVE ) ;
+ } elseif ( ! empty( $avaman_allowed_exts[$orig_ext4check] ) ) {
+ // a single image file
+ $files = array() ;
+ $files[] = array(
+ 'filename' => $_FILES['upload_archive']['name'] ,
+ 'mtime' => time() ,
+ 'content' => function_exists( 'file_get_contents' ) ? file_get_contents( $_FILES['upload_archive']['tmp_name'] ) : implode( file( $_FILES['upload_archive']['tmp_name'] ) ) ,
+ ) ;
+ } else {
+ die( _AM_AVAMAN_INVALIDEXT ) ;
+ }
+ // import stage
+ $imported = 0 ;
+ foreach ($files as $file) {
+ if( ! empty( $file['folder'] ) ) continue ;
+ $file_pos = strrpos( $file['filename'] , '/' ) ;
+ $file_name = $file_pos === false ? $file['filename'] : substr( $file['filename'] , $file_pos + 1 ) ;
+ $ext_pos = strrpos( $file_name , '.' ) ;
+ if( $ext_pos === false ) continue ;
+ $ext = strtolower( substr( $file_name , $ext_pos + 1 ) ) ;
+ if( empty( $avaman_allowed_exts[$ext] ) ) continue ;
+ $file_node = substr( $file_name , 0 , $ext_pos ) ;
+ $save_file_name = uniqid( 'savt' ) . '.' . $ext ;
+ $fw = fopen( XOOPS_UPLOAD_PATH.'/'.$save_file_name , "w" ) ;
+ if( ! $fw ) continue ;
+ @fwrite( $fw , $file['content'] ) ;
+ @fclose( $fw ) ;
+ $db->query( "INSERT INTO ".$db->prefix("avatar")." SET avatar_file='".addslashes($save_file_name)."', avatar_name='".addslashes($file_node)."', avatar_mimetype='".addslashes(@$avaman_allowed_exts[$ext])."', avatar_created=UNIX_TIMESTAMP(), avatar_display=1, avatar_weight=0, avatar_type='S'" ) ;
+ $imported ++ ;
+ }
+ redirect_header( $realmyname , 3 , sprintf( _AM_AVAMAN_FILEUPLOADED , $imported ) ) ;
+ exit ;
+}
-
-
-
-
-
// Form Stage
xoops_cp_header() ;
@@ -182,39 +169,39 @@
echo "
<form action='$realmyname' id='avaman_upload' method='post' enctype='multipart/form-data' class='odd'>
- <label for='upload_archive'>"._AM_AVAMAN_UPLOAD."</label>
- <br />
- <input type='file' id='upload_archive' name='upload_archive' size='60' />
- <input type='submit' value='"._SUBMIT."' />
+ <label for='upload_archive'>"._AM_AVAMAN_UPLOAD."</label>
+ <br />
+ <input type='file' id='upload_archive' name='upload_archive' size='60' />
+ <input type='submit' value='"._SUBMIT."' />
</form>
<form action='$realmyname' name='avaman_list' id='avaman_list' method='post'>
<table class='outer' id='avaman_main'>
- <tr>
- <th>"._AM_AVAMAN_TH_ID."</th>
- <th>"._AM_AVAMAN_TH_FILE."</th>
- <th>"._AM_AVAMAN_TH_AVATARNAME."</th>
- <th>"._AM_AVAMAN_TH_CREATED."</th>
- <th>"._AM_AVAMAN_TH_DISPLAY."</th>
- <th>"._AM_AVAMAN_TH_WEIGHT."</th>
- <th>"._AM_AVAMAN_TH_USERS."</th>
- <th>"._AM_AVAMAN_TH_DELETE."<input type='checkbox' name='selectall' onclick=\"with(document.avaman_list){for(i=0;i<length;i++){if(elements[i].type=='checkbox'&&elements[i].disabled==false&&elements[i].name.indexOf('deletes')>=0){elements[i].checked=this.checked;}}}\" title='"._AM_AVAMAN_CB_SELECTALL."' /></th>
- </tr>\n" ;
+ <tr>
+ <th>"._AM_AVAMAN_TH_ID."</th>
+ <th>"._AM_AVAMAN_TH_FILE."</th>
+ <th>"._AM_AVAMAN_TH_AVATARNAME."</th>
+ <th>"._AM_AVAMAN_TH_CREATED."</th>
+ <th>"._AM_AVAMAN_TH_DISPLAY."</th>
+ <th>"._AM_AVAMAN_TH_WEIGHT."</th>
+ <th>"._AM_AVAMAN_TH_USERS."</th>
+ <th>"._AM_AVAMAN_TH_DELETE."<input type='checkbox' name='selectall' onclick=\"with(document.avaman_list){for (i=0;i<length;i++) {if(elements[i].type=='checkbox'&&elements[i].disabled==false&&elements[i].name.indexOf('deletes')>=0) {elements[i].checked=this.checked;}}}\" title='"._AM_AVAMAN_CB_SELECTALL."' /></th>
+ </tr>\n" ;
-while( list( $avatar_id , $avatar_file , $avatar_name , $avatar_created , $avatar_display , $avatar_weight , $avatar_users ) = $db->fetchRow( $result ) ) {
- $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ;
- $delete_disabled = $avatar_users > 0 ? "disabled='disabled'" : "" ;
+while ( list( $avatar_id , $avatar_file , $avatar_name , $avatar_created , $avatar_display , $avatar_weight , $avatar_users ) = $db->fetchRow( $result ) ) {
+ $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ;
+ $delete_disabled = $avatar_users > 0 ? "disabled='disabled'" : "" ;
- echo "
- <tr>
- <td class='$evenodd' align='center'>$avatar_id</td>
- <td class='$evenodd' align='center'><img src='".XOOPS_UPLOAD_URL.'/'.urlencode($avatar_file)."' alt='' /></td>
- <td class='$evenodd' align='center'><input type='text' size='24' name='avatar_names[$avatar_id]' value='".htmlspecialchars($avatar_name,ENT_QUOTES)."' /></td>
- <td class='$evenodd' align='center'> ".formatTimestamp($avatar_created)."</td>
- <td class='$evenodd' align='center'><input type='checkbox' name='avatar_displays[$avatar_id]' ".($avatar_display?"checked='checked'":"")." /></td>
- <td class='$evenodd' align='center'><input type='text' size='4' name='avatar_weights[$avatar_id]' value='$avatar_weight' style='text-align:right;' /></td>
- <td class='$evenodd' align='center'>".intval($avatar_users)."</td>
- <td class='$evenodd' align='center'><input type='checkbox' name='avatar_deletes[$avatar_id]' $delete_disabled /></td>
- </tr>\n" ;
+ echo "
+ <tr>
+ <td class='$evenodd' align='center'>$avatar_id</td>
+ <td class='$evenodd' align='center'><img src='".XOOPS_UPLOAD_URL.'/'.urlencode($avatar_file)."' alt='' /></td>
+ <td class='$evenodd' align='center'><input type='text' size='24' name='avatar_names[$avatar_id]' value='".htmlspecialchars($avatar_name,ENT_QUOTES)."' /></td>
+ <td class='$evenodd' align='center'> ".formatTimestamp($avatar_created)."</td>
+ <td class='$evenodd' align='center'><input type='checkbox' name='avatar_displays[$avatar_id]' ".($avatar_display?"checked='checked'":"")." /></td>
+ <td class='$evenodd' align='center'><input type='text' size='4' name='avatar_weights[$avatar_id]' value='$avatar_weight' style='text-align:right;' /></td>
+ <td class='$evenodd' align='center'>".intval($avatar_users)."</td>
+ <td class='$evenodd' align='center'><input type='checkbox' name='avatar_deletes[$avatar_id]' $delete_disabled /></td>
+ </tr>\n" ;
}
echo "
</table>
@@ -223,4 +210,4 @@
</form>
" ;
-include "admin_footer.php";
\ No newline at end of file
+include 'admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/index.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/index.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/index.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -24,9 +24,9 @@
include 'admin_header.php';
xoops_cp_header();
- $indexAdmin = new ModuleAdmin();
+ $indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation('index.php');
echo $indexAdmin->renderIndex();
-include "admin_footer.php";
\ No newline at end of file
+include 'admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/menu.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/menu.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/menu.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -20,7 +20,6 @@
* @version $Id $
*/
-
defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined");
$path = dirname(dirname(dirname(dirname(__FILE__))));
@@ -33,7 +32,6 @@
$pathModuleAdmin = $module->getInfo('dirmoduleadmin');
$pathLanguage = $path . $pathModuleAdmin;
-
if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) {
$fileinc = $pathLanguage . '/language/english/main.php';
}
@@ -48,17 +46,17 @@
$adminmenu[$i]["link"] = 'admin/index.php';
$adminmenu[$i]["icon"] = $pathIcon32 . '/home.png';
-$i++;
+++$i;
$adminmenu[$i]["title"] = _MI_AVAMAN_AVATARMANAGER;
$adminmenu[$i]["link"] = 'admin/avatars.php';
$adminmenu[$i]["icon"] = $pathIcon32.'/penguin.png';
-$i++;
+++$i;
$adminmenu[$i]["title"] = _MI_AVAMAN_SMILIESMANAGER;
$adminmenu[$i]["link"] = 'admin/smilies.php';
$adminmenu[$i]["icon"] = $pathIcon32.'/face-smile.png';
-$i++;
+++$i;
$adminmenu[$i]['title'] = _AM_MODULEADMIN_ABOUT;
$adminmenu[$i]["link"] = 'admin/about.php';
-$adminmenu[$i]["icon"] = $pathIcon32 . '/about.png';
\ No newline at end of file
+$adminmenu[$i]["icon"] = $pathIcon32 . '/about.png';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/smilies.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/smilies.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/admin/smilies.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -21,20 +21,18 @@
*/
$avaman_allowed_exts = array(
- 'gif' => 'image/gif' ,
- 'jpg' => 'image/jpeg' ,
- 'jpeg' => 'image/jpeg' ,
- 'png' => 'image/png' ,
+ 'gif' => 'image/gif' ,
+ 'jpg' => 'image/jpeg' ,
+ 'jpeg' => 'image/jpeg' ,
+ 'png' => 'image/png' ,
) ;
$realmyname = 'smilies.php' ;
-
-include_once( '../../../include/cp_header.php' ) ;
-include_once "../include/gtickets.php" ;
+include_once '../../../include/cp_header.php' ;
+include_once '../include/gtickets.php';
include_once 'admin_header.php';
$indexAdmin = new ModuleAdmin();
-
$db =& XoopsDatabaseFactory::getDatabaseConnection();
$myts =& MyTextSanitizer::getInstance() ;
@@ -42,135 +40,123 @@
// POST Stage
//
-if( ! empty( $_POST['modify_smilies'] ) ) {
+if ( ! empty( $_POST['modify_smilies'] ) ) {
- // Ticket Check
- if ( ! $xoopsGTicket->check() ) {
- redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors());
- }
+ // Ticket Check
+ if ( ! $xoopsGTicket->check() ) {
+ redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors());
+ }
- // rename emotion
- $smiles_ids = array() ;
- if( is_array( @$_POST['emotions'] ) ) {
- foreach( $_POST['emotions'] as $smiles_id => $emotion ) {
- $smiles_id = intval( $smiles_id ) ;
- $db->query( "UPDATE ".$db->prefix("smiles")." SET emotion='".$myts->addSlashes($emotion)."' WHERE id=".intval($smiles_id) ) ;
- $smiles_ids[] = $smiles_id ;
- }
- }
+ // rename emotion
+ $smiles_ids = array() ;
+ if ( is_array( @$_POST['emotions'] ) ) {
+ foreach ($_POST['emotions'] as $smiles_id => $emotion) {
+ $smiles_id = intval( $smiles_id ) ;
+ $db->query( "UPDATE ".$db->prefix("smiles")." SET emotion='".$myts->addSlashes($emotion)."' WHERE id=".intval($smiles_id) ) ;
+ $smiles_ids[] = $smiles_id ;
+ }
+ }
- // code
- foreach( $smiles_ids as $smiles_id ) {
- $db->query( "UPDATE ".$db->prefix("smiles")." SET code='".$myts->addSlashes(@$_POST['codes'][$smiles_id])."' WHERE id=$smiles_id" ) ;
- }
+ // code
+ foreach ($smiles_ids as $smiles_id) {
+ $db->query( "UPDATE ".$db->prefix("smiles")." SET code='".$myts->addSlashes(@$_POST['codes'][$smiles_id])."' WHERE id=$smiles_id" ) ;
+ }
- // display
- foreach( $smiles_ids as $smiles_id ) {
- if( empty( $_POST['displays'][$smiles_id] ) ) {
- $db->query( "UPDATE ".$db->prefix("smiles")." SET display=0 WHERE id=$smiles_id" ) ;
- } else {
- $db->query( "UPDATE ".$db->prefix("smiles")." SET display=1 WHERE id=$smiles_id" ) ;
- }
- }
+ // display
+ foreach ($smiles_ids as $smiles_id) {
+ if ( empty( $_POST['displays'][$smiles_id] ) ) {
+ $db->query( "UPDATE ".$db->prefix("smiles")." SET display=0 WHERE id=$smiles_id" ) ;
+ } else {
+ $db->query( "UPDATE ".$db->prefix("smiles")." SET display=1 WHERE id=$smiles_id" ) ;
+ }
+ }
- // delete
- foreach( $smiles_ids as $smiles_id ) {
- if( ! empty( $_POST['deletes'][$smiles_id] ) ) {
- $result = $db->query( "SELECT smile_url FROM ".$db->prefix("smiles")." WHERE id=$smiles_id" ) ;
- if( $result ) {
- list( $file ) = $db->fetchRow( $result ) ;
- if( strstr( $file , '..' ) ) die( '.. found.' ) ;
- @unlink( XOOPS_UPLOAD_PATH . '/' . $file ) ;
- $db->query( "DELETE FROM ".$db->prefix("smiles")." WHERE id=$smiles_id" ) ;
- }
- }
- }
+ // delete
+ foreach ($smiles_ids as $smiles_id) {
+ if ( ! empty( $_POST['deletes'][$smiles_id] ) ) {
+ $result = $db->query( "SELECT smile_url FROM ".$db->prefix("smiles")." WHERE id=$smiles_id" ) ;
+ if ($result) {
+ list( $file ) = $db->fetchRow( $result ) ;
+ if( strstr( $file , '..' ) ) die( '.. found.' ) ;
+ @unlink( XOOPS_UPLOAD_PATH . '/' . $file ) ;
+ $db->query( "DELETE FROM ".$db->prefix("smiles")." WHERE id=$smiles_id" ) ;
+ }
+ }
+ }
- redirect_header( $realmyname , 2 , _AM_AVAMAN_DBUPDATED ) ;
- exit ;
+ redirect_header( $realmyname , 2 , _AM_AVAMAN_DBUPDATED ) ;
+ exit ;
}
-
// ARCHIVE UPLOAD
-if( ! empty( $_FILES['upload_archive']['tmp_name'] ) && is_uploaded_file( $_FILES['upload_archive']['tmp_name'] ) ) {
+if ( ! empty( $_FILES['upload_archive']['tmp_name'] ) && is_uploaded_file( $_FILES['upload_archive']['tmp_name'] ) ) {
- // extract stage
- $orig_filename4check = strtolower( $_FILES['upload_archive']['name'] ) ;
- $orig_ext4check = substr( $orig_filename4check , strrpos( $orig_filename4check , '.' ) + 1 ) ;
- if( $orig_ext4check == 'zip' ) {
-
- // zip
- include_once dirname(dirname(__FILE__)).'/include/Archive_Zip.php' ;
- $reader = new Archive_Zip( $_FILES['upload_archive']['tmp_name'] ) ;
- $files = $reader->extract( array( 'extract_as_string' => true ) ) ;
- if( ! is_array( @$files ) ) die( $reader->errorName() ) ;
-
- } else if( $orig_ext4check == 'tar' || $orig_ext4check == 'tgz' || $orig_ext4check == 'gz' ) {
-
- // tar or tgz or tar.gz
- include_once XOOPS_ROOT_PATH.'/class/class.tar.php' ;
- $tar = new tar() ;
- $tar->openTar( $_FILES['upload_archive']['tmp_name'] ) ;
- $files = array() ;
- foreach( $tar->files as $id => $info ) {
- $files[] = array(
- 'filename' => $info['name'] ,
- 'mtime' => $info['time'] ,
- 'content' => $info['file'] ,
- ) ;
- }
- if( empty( $files ) ) die( _AM_AVAMAN_ERR_INVALIDARCHIVE ) ;
+ // extract stage
+ $orig_filename4check = strtolower( $_FILES['upload_archive']['name'] ) ;
+ $orig_ext4check = substr( $orig_filename4check , strrpos( $orig_filename4check , '.' ) + 1 ) ;
+ if ($orig_ext4check == 'zip') {
- } else if( ! empty( $avaman_allowed_exts[$orig_ext4check] ) ) {
-
- // a single image file
- $files = array() ;
- $files[] = array(
- 'filename' => $_FILES['upload_archive']['name'] ,
- 'mtime' => time() ,
- 'content' => function_exists( 'file_get_contents' ) ? file_get_contents( $_FILES['upload_archive']['tmp_name'] ) : implode( file( $_FILES['upload_archive']['tmp_name'] ) ) ,
- ) ;
- } else {
- die( _AM_AVAMAN_INVALIDEXT ) ;
- }
+ // zip
+ include_once dirname(dirname(__FILE__)).'/include/Archive_Zip.php' ;
+ $reader = new Archive_Zip( $_FILES['upload_archive']['tmp_name'] ) ;
+ $files = $reader->extract( array( 'extract_as_string' => true ) ) ;
+ if( ! is_array( @$files ) ) die( $reader->errorName() ) ;
- // import stage
- $imported = 0 ;
- foreach( $files as $file ) {
-
- if( ! empty( $file['folder'] ) ) continue ;
- $file_pos = strrpos( $file['filename'] , '/' ) ;
- $file_name = $file_pos === false ? $file['filename'] : substr( $file['filename'] , $file_pos + 1 ) ;
- $ext_pos = strrpos( $file_name , '.' ) ;
- if( $ext_pos === false ) continue ;
- $ext = strtolower( substr( $file_name , $ext_pos + 1 ) ) ;
- if( empty( $avaman_allowed_exts[$ext] ) ) continue ;
- $file_node = substr( $file_name , 0 , $ext_pos ) ;
- $save_file_name = uniqid( 'smil' ) . '.' . $ext ;
- $fw = fopen( XOOPS_UPLOAD_PATH.'/'.$save_file_name , "w" ) ;
- if( ! $fw ) continue ;
- @fwrite( $fw , $file['content'] ) ;
- @fclose( $fw ) ;
- $db->query( "INSERT INTO ".$db->prefix("smiles")." SET smile_url='".addslashes($save_file_name)."', code='".addslashes(rawurldecode($file_node))."', display=0, emotion=''" ) ;
+ } elseif ($orig_ext4check == 'tar' || $orig_ext4check == 'tgz' || $orig_ext4check == 'gz') {
- $imported ++ ;
- }
-
- redirect_header( $realmyname , 3 , sprintf( _AM_AVAMAN_FILEUPLOADED , $imported ) ) ;
- exit ;
-}
+ // tar or tgz or tar.gz
+ include_once XOOPS_ROOT_PATH.'/class/class.tar.php' ;
+ $tar = new tar() ;
+ $tar->openTar( $_FILES['upload_archive']['tmp_name'] ) ;
+ $files = array() ;
+ foreach ($tar->files as $id => $info) {
+ $files[] = array(
+ 'filename' => $info['name'] ,
+ 'mtime' => $info['time'] ,
+ 'content' => $info['file'] ,
+ ) ;
+ }
+ if( empty( $files ) ) die( _AM_AVAMAN_ERR_INVALIDARCHIVE ) ;
+ } elseif ( ! empty( $avaman_allowed_exts[$orig_ext4check] ) ) {
+ // a single image file
+ $files = array() ;
+ $files[] = array(
+ 'filename' => $_FILES['upload_archive']['name'] ,
+ 'mtime' => time() ,
+ 'content' => function_exists( 'file_get_contents' ) ? file_get_contents( $_FILES['upload_archive']['tmp_name'] ) : implode( file( $_FILES['upload_archive']['tmp_name'] ) ) ,
+ ) ;
+ } else {
+ die( _AM_AVAMAN_INVALIDEXT ) ;
+ }
+ // import stage
+ $imported = 0 ;
+ foreach ($files as $file) {
+ if( ! empty( $file['folder'] ) ) continue ;
+ $file_pos = strrpos( $file['filename'] , '/' ) ;
+ $file_name = $file_pos === false ? $file['filename'] : substr( $file['filename'] , $file_pos + 1 ) ;
+ $ext_pos = strrpos( $file_name , '.' ) ;
+ if( $ext_pos === false ) continue ;
+ $ext = strtolower( substr( $file_name , $ext_pos + 1 ) ) ;
+ if( empty( $avaman_allowed_exts[$ext] ) ) continue ;
+ $file_node = substr( $file_name , 0 , $ext_pos ) ;
+ $save_file_name = uniqid( 'smil' ) . '.' . $ext ;
+ $fw = fopen( XOOPS_UPLOAD_PATH.'/'.$save_file_name , "w" ) ;
+ if( ! $fw ) continue ;
+ @fwrite( $fw , $file['content'] ) ;
+ @fclose( $fw ) ;
+ $db->query( "INSERT INTO ".$db->prefix("smiles")." SET smile_url='".addslashes($save_file_name)."', code='".addslashes(rawurldecode($file_node))."', display=0, emotion=''" ) ;
+ $imported ++ ;
+ }
+ redirect_header( $realmyname , 3 , sprintf( _AM_AVAMAN_FILEUPLOADED , $imported ) ) ;
+ exit ;
+}
-
-
-
-
-
// Form Stage
xoops_cp_header() ;
echo $indexAdmin->addNavigation('smilies.php');
@@ -182,34 +168,34 @@
echo "
<form action='$realmyname' id='avaman_upload' method='post' enctype='multipart/form-data' class='odd'>
- <label for='upload_archive'>"._AM_AVAMAN_UPLOAD."</label>
- <br />
- <input type='file' id='upload_archive' name='upload_archive' size='60' />
- <input type='submit' value='"._SUBMIT."' />
+ <label for='upload_archive'>"._AM_AVAMAN_UPLOAD."</label>
+ <br />
+ <input type='file' id='upload_archive' name='upload_archive' size='60' />
+ <input type='submit' value='"._SUBMIT."' />
</form>
<form action='$realmyname' name='avaman_list' id='avaman_list' method='post'>
<table class='outer' id='avaman_main'>
- <tr>
- <th>"._AM_AVAMAN_TH_ID."</th>
- <th>"._AM_AVAMAN_TH_FILE."</th>
- <th>"._AM_AVAMAN_TH_CODE."</th>
- <th>"._AM_AVAMAN_TH_EMOTION."</th>
- <th>"._AM_AVAMAN_TH_SMILEDISPLAY."</th>
- <th>"._AM_AVAMAN_TH_DELETE."<input type='checkbox' name='selectall' onclick=\"with(document.avaman_list){for(i=0;i<length;i++){if(elements[i].type=='checkbox'&&elements[i].disabled==false&&elements[i].name.indexOf('deletes')>=0){elements[i].checked=this.checked;}}}\" title='"._AM_AVAMAN_CB_SELECTALL."' /></th>
- </tr>\n" ;
+ <tr>
+ <th>"._AM_AVAMAN_TH_ID."</th>
+ <th>"._AM_AVAMAN_TH_FILE."</th>
+ <th>"._AM_AVAMAN_TH_CODE."</th>
+ <th>"._AM_AVAMAN_TH_EMOTION."</th>
+ <th>"._AM_AVAMAN_TH_SMILEDISPLAY."</th>
+ <th>"._AM_AVAMAN_TH_DELETE."<input type='checkbox' name='selectall' onclick=\"with(document.avaman_list){for (i=0;i<length;i++) {if(elements[i].type=='checkbox'&&elements[i].disabled==false&&elements[i].name.indexOf('deletes')>=0) {elements[i].checked=this.checked;}}}\" title='"._AM_AVAMAN_CB_SELECTALL."' /></th>
+ </tr>\n" ;
-while( list( $smiles_id , $code , $file , $emotion , $display ) = $db->fetchRow( $result ) ) {
- $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ;
+while ( list( $smiles_id , $code , $file , $emotion , $display ) = $db->fetchRow( $result ) ) {
+ $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ;
- echo "
- <tr>
- <td class='$evenodd' align='center'>$smiles_id</td>
- <td class='$evenodd' align='center'><img src='".XOOPS_UPLOAD_URL.'/'.$file."' alt='' /></td>
- <td class='$evenodd' align='center'><input type='text' size='12' name='codes[$smiles_id]' value='".htmlspecialchars($code,ENT_QUOTES)."' /></td>
- <td class='$evenodd' align='center'><input type='text' size='24' name='emotions[$smiles_id]' value='".htmlspecialchars($emotion,ENT_QUOTES)."' /></td>
- <td class='$evenodd' align='center'><input type='checkbox' name='displays[$smiles_id]' ".($display?"checked='checked'":"")." /></td>
- <td class='$evenodd' align='center'><input type='checkbox' name='deletes[$smiles_id]' /></td>
- </tr>\n" ;
+ echo "
+ <tr>
+ <td class='$evenodd' align='center'>$smiles_id</td>
+ <td class='$evenodd' align='center'><img src='".XOOPS_UPLOAD_URL.'/'.$file."' alt='' /></td>
+ <td class='$evenodd' align='center'><input type='text' size='12' name='codes[$smiles_id]' value='".htmlspecialchars($code,ENT_QUOTES)."' /></td>
+ <td class='$evenodd' align='center'><input type='text' size='24' name='emotions[$smiles_id]' value='".htmlspecialchars($emotion,ENT_QUOTES)."' /></td>
+ <td class='$evenodd' align='center'><input type='checkbox' name='displays[$smiles_id]' ".($display?"checked='checked'":"")." /></td>
+ <td class='$evenodd' align='center'><input type='checkbox' name='deletes[$smiles_id]' /></td>
+ </tr>\n" ;
}
echo "
</table>
@@ -218,4 +204,4 @@
</form>
" ;
-include "admin_footer.php";
\ No newline at end of file
+include 'admin_footer.php';
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/avaman_slogo.png
===================================================================
(Binary files differ)
Index: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/avaman_slogo.png
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/avaman_slogo.png 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/avaman_slogo.png 2014-04-25 11:29:22 UTC (rev 12473)
Property changes on: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/avaman_slogo.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/index.html (rev 0)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/images/index.html 2014-04-25 11:29:22 UTC (rev 12473)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/index.html (rev 0)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/assets/index.html 2014-04-25 11:29:22 UTC (rev 12473)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/docs/changelog.txt
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/docs/changelog.txt 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/docs/changelog.txt 2014-04-25 11:29:22 UTC (rev 12473)
@@ -1,29 +1,34 @@
-CHANGELOG:
-==================
+0.24 Beta 1 2014-04-23
+=================================
+- moved all images, CSS, and JS files to /assets (mamba)
+0.23 2012/05/22:
+=================================
+- some PSR-2 code formatting (mamba)
+
0.22 2012/05/22:
-=================
+=================================
- converted to XOOPS ModuleAdmin GUI (mamba)
-0.21 (2006-04-06 )
-=================
+0.21 2006-04-06
+=================================
- added select/deselect all
- added polish (thx kurakbu) 0.21a
- added italian (thx Defkon1) 0.21b
- added persian (thx irmtfan) 0.21c
- added spanish (thx debianus) 0.21d
-0.20 (2006-04-05)
-=================
+0.20 2006-04-05
+=================================
- added smilies manager
-0.11 (2006-04-05)
-=================
+0.11 2006-04-05
+=================================
- modified language constants
- added a column of users
- fixed a bug used avatar can be deleted
- added submenu for 2.2.x (thx McDonald)
-0.10 (2006-04-04)
-=================
--the 1st implementation
\ No newline at end of file
+0.10 2006-04-04
+=================================
+- original release
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/include/Archive_Zip.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/include/Archive_Zip.php 2014-04-25 05:09:29 UTC (rev 12472)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/avaman/include/Archive_Zip.php 2014-04-25 11:29:22 UTC (rev 12473)
@@ -85,8 +85,6 @@
define('ARCHIVE_ZIP_PARAM_PRE_ADD', 'callback_pre_add' );
define('ARCHIVE_ZIP_PARAM_POST_ADD', 'callback_post_add' );
-
-
/**
* Class for manipulating zip archive files
*
@@ -145,6 +143,7 @@
die("The extension 'zlib' couldn't be found.\n".
"Please make sure your version of PHP was built ".
"with 'zlib' support.\n");
+
return false;
}
@@ -159,10 +158,10 @@
// {{{ create()
/**
* This method creates a Zip Archive with the filename set with
- * the constructor.
- * The files and directories indicated in $p_filelist
+ * the constructor.
+ * The files and directories indicated in $p_filelist
* are added in the archive.
- * When a directory is in the list, the directory and its content is added
+ * When a directory is in the list, the directory and its content is added
* in the archive.
* The methods takes a variable list of parameters in $p_params.
* The supported parameters for this method are :
@@ -177,7 +176,7 @@
* by a comma, or an array of filenames.
* @param mixed $p_params An array of variable parameters and values.
* @return mixed An array of file description on success,
- * an error code on error
+ * an error code on error
*/
function create($p_filelist, $p_params=0)
{
@@ -185,15 +184,15 @@
// ----- Set default values
if ($p_params === 0) {
- $p_params = array();
+ $p_params = array();
}
if ($this->_check_parameters($p_params,
- array('no_compression' => false,
- 'add_path' => "",
- 'remove_path' => "",
- 'remove_all_path' => false)) != 1) {
- return 0;
- }
+ array('no_compression' => false,
+ 'add_path' => "",
+ 'remove_path' => "",
+ 'remove_all_path' => false)) != 1) {
+ return 0;
+ }
// ----- Look if the $p_filelist is really an array
$p_result_list = array();
@@ -212,7 +211,7 @@
// ----- Invalid variable
else {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
- 'Invalid variable type p_filelist');
+ 'Invalid variable type p_filelist');
$v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER;
}
@@ -228,8 +227,8 @@
/**
* This method add files or directory in an existing Zip Archive.
* If the Zip Archive does not exist it is created.
- * The files and directories to add are indicated in $p_filelist.
- * When a directory is in the list, the directory and its content is added
+ * The files and directories to add are indicated in $p_filelist.
+ * When a directory is in the list, the directory and its content is added
* in the archive.
* The methods takes a variable list of parameters in $p_params.
* The supported parameters for this method are :
@@ -248,7 +247,7 @@
* by a comma, or an array of filenames.
* @param mixed $p_params An array of variable parameters and values.
* @return mixed An array of file description on success,
- * 0 on an unrecoverable failure, an error code is logged.
+ * 0 on an unrecoverable failure, an error code is logged.
*/
function add($p_filelist, $p_params=0)
{
@@ -256,17 +255,17 @@
// ----- Set default values
if ($p_params === 0) {
- $p_params = array();
+ $p_params = array();
}
if ($this->_check_parameters($p_params,
- array ('no_compression' => false,
- 'add_path' => '',
- 'remove_path' => '',
- 'remove_all_path' => false,
- 'callback_pre_add' => '',
- 'callback_post_add' => '')) != 1) {
- return 0;
- }
+ array ('no_compression' => false,
+ 'add_path' => '',
+ 'remove_path' => '',
+ 'remove_all_path' => false,
+ 'callback_pre_add' => '',
+ 'callback_post_add' => '')) != 1) {
+ return 0;
+ }
// ----- Look if the $p_filelist is really an array
$p_result_list = array();
@@ -287,7 +286,7 @@
// ----- Invalid variable
else {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
- "add() : Invalid variable type p_filelist");
+ "add() : Invalid variable type p_filelist");
$v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER;
}
@@ -303,11 +302,11 @@
// {{{ listContent()
/**
* This method gives the names and properties of the files and directories
- * which are present in the zip archive.
+ * which are present in the zip archive.
* The properties of each entries in the list are :
* filename : Name of the file.
- * For create() or add() it's the filename given by the user.
- * For an extract() it's the filename of the extracted file.
+ * For create() or add() it's the filename given by the user.
+ * For an extract() it's the filename of the extracted file.
* stored_filename : Name of the file / directory stored in the archive.
* size : Size of the stored file.
* compressed_size : Size of the file's data compressed in the archive
@@ -322,27 +321,27 @@
* filtered : the file/dir was not extracted (filtered by user)
* already_a_directory : the file can't be extracted because a
* directory with the same name already
- * exists
+ * exists
* write_protected : the file can't be extracted because a file
* with the same name already exists and is
* write protected
* newer_exist : the file was not extracted because a newer
- * file already exists
+ * file already exists
* path_creation_fail : the file is not extracted because the
- * folder does not exists and can't be
- * created
+ * folder does not exists and can't be
+ * created
* write_error : the file was not extracted because there was a
* error while writing the file
* read_error : the file was not extracted because there was a
- * error while reading the file
+ * error while reading the file
* invalid_header : the file was not extracted because of an
- * archive format error (bad file header)
+ * archive format error (bad file header)
* Note that each time a method can continue operating when there
* is an error on a single file, the error is only logged in the file status.
*
* @access public
* @return mixed An array of file description on success,
- * 0 on an unrecoverable failure, an error code is logged.
+ * 0 on an unrecoverable failure, an error code is logged.
*/
function listContent()
{
@@ -356,6 +355,7 @@
$v_list = array();
if ($this->_list($v_list) != 1) {
unset($v_list);
+
return(0);
}
@@ -370,11 +370,11 @@
* feature (extract by name, by index, by ereg, by preg). The extraction
* can occur in the current path or an other path.
* All the advanced features are activated by the use of variable
- * parameters.
- * The return value is an array of entry descriptions which gives
- * information on extracted files (See listContent()).
- * The method may return a success value (an array) even if some files
- * are not correctly extracted (see the file status in listContent()).
+ * parameters.
+ * The return value is an array of entry descriptions which gives
+ * information on extracted files (See listContent()).
+ * The method may return a success value (an array) even if some files
+ * are not correctly extracted (see the file status in listContent()).
* The supported variable parameters for this method are :
* 'add_path' : Path where the files and directories are to be extracted
* 'remove_path' : First part ('root' part) of the memorized path
@@ -399,7 +399,7 @@
* @access public
* @param mixed $p_params An array of variable parameters and values.
* @return mixed An array of file description on success,
- * 0 on an unrecoverable failure, an error code is logged.
+ * 0 on an unrecoverable failure, an error code is logged.
*/
function extract($p_params=0)
{
@@ -413,27 +413,28 @@
// ----- Set default values
if ($p_params === 0) {
- $p_params = array();
+ $p_params = array();
}
if ($this->_check_parameters($p_params,
- array ('extract_as_string' => false,
- 'add_path' => '',
- 'remove_path' => '',
- 'remove_all_path' => false,
- 'callback_pre_extract' => '',
- 'callback_post_extract' => '',
- 'set_chmod' => 0,
- 'by_name' => '',
- 'by_index' => '',
- 'by_ereg' => '',
- 'by_preg' => '') ) != 1) {
- return 0;
- }
+ array ('extract_as_string' => false,
+ 'add_path' => '',
+ 'remove_path' => '',
+ 'remove_all_path' => false,
+ 'callback_pre_extract' => '',
+ 'callback_post_extract' => '',
+ 'set_chmod' => 0,
+ 'by_name' => '',
+ 'by_index' => '',
+ 'by_ereg' => '',
+ 'by_preg' => '') ) != 1) {
+ return 0;
+ }
// ----- Call the extracting fct
$v_list = array();
if ($this->_extractByRule($v_list, $p_params) != 1) {
unset($v_list);
+
return(0);
}
@@ -441,7 +442,6 @@
}
// }}}
-
// {{{ delete()
/**
* This methods delete archive entries in the zip archive.
@@ -462,7 +462,7 @@
* @access public
* @param mixed $p_params An array of variable parameters and values.
* @return mixed An array of file description on success,
- * 0 on an unrecoverable failure, an error code is logged.
+ * 0 on an unrecoverable failure, an error code is logged.
*/
function delete($p_params)
{
@@ -475,12 +475,12 @@
// ----- Set default values
if ($this->_check_parameters($p_params,
- array ('by_name' => '',
- 'by_index' => '',
- 'by_ereg' => '',
- 'by_preg' => '') ) != 1) {
- return 0;
- }
+ array ('by_name' => '',
+ 'by_index' => '',
+ 'by_ereg' => '',
+ 'by_preg' => '') ) != 1) {
+ return 0;
+ }
// ----- Check that at least one rule is set
if ( ($p_params['by_name'] == '')
@@ -488,8 +488,9 @@
&& ($p_params['by_ereg'] == '')
&& ($p_params['by_preg'] == '')) {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
- 'At least one filtering rule must'
- .' be set as parameter');
+ 'At least one filtering rule must'
+ .' be set as parameter');
+
return 0;
}
@@ -497,6 +498,7 @@
$v_list = array();
if ($this->_deleteByRule($v_list, $p_params) != 1) {
unset($v_list);
+
return(0);
}
@@ -536,8 +538,9 @@
// ----- Open the zip file
if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) {
$this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
- 'Unable to open archive \''.$this->_zipname
- .'\' in binary read mode');
+ 'Unable to open archive \''.$this->_zipname
+ .'\' in binary read mode');
+
return 0;
}
@@ -559,16 +562,15 @@
}
// }}}
-
// {{{ duplicate()
/**
* This method creates an archive by copying the content of an other one.
- * If the archive already exist, it is replaced by the new one without
- * any warning.
+ * If the archive already exist, it is replaced by the new one without
+ * any warning.
*
* @access public
* @param mixed $p_archive It can be a valid Archive_Zip object or
- * the filename of a valid zip archive.
+ * the filename of a valid zip archive.
* @return integer 1 on success, 0 on failure.
*/
function duplicate($p_archive)
@@ -577,7 +579,7 @@
// ----- Look if the $p_archive is a Archive_Zip object
if ( (is_object($p_archive))
- && (strtolower(get_class($p_archive)) == 'archive_zip')) {
+ && (strtolower(get_class($p_archive)) == 'archive_zip')) {
$v_result = $this->_duplicate($p_archive->_zipname);
}
@@ -587,10 +589,9 @@
// TBC : Should also check the archive format
if (!is_file($p_archive)) {
$this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
- "No file with filename '".$p_archive."'");
+ "No file with filename '".$p_archive."'");
$v_result = ARCHIVE_ZIP_ERR_MISSING_FILE;
- }
- else {
+ } else {
$v_result = $this->_duplicate($p_archive);
}
}
@@ -598,7 +599,7 @@
// ----- Invalid variable
else {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
- "Invalid variable type p_archive_to_add");
+ "Invalid variable type p_archive_to_add");
$v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER;
}
@@ -609,13 +610,13 @@
// {{{ merge()
/**
* This method merge a valid zip archive at the end of the
- * archive identified by the Archive_Zip object.
+ * archive identified by the Archive_Zip object.
* If the archive ($this) does not exist, the merge becomes a duplicate.
* If the archive to add does not exist, the merge is a success.
*
* @access public
* @param mixed $p_archive_to_add It can be a valid Archive_Zip object or
- * the filename of a valid zip archive.
+ * the filename of a valid zip archive.
* @return integer 1 on success, 0 on failure.
*/
function merge($p_archive_to_add)
@@ -630,7 +631,7 @@
// ----- Look if the $p_archive_to_add is a Archive_Zip object
if ( (is_object($p_archive_to_add))
- && (strtolower(get_class($p_archive_to_add)) == 'archive_zip')) {
+ && (strtolower(get_class($p_archive_to_add)) == 'archive_zip')) {
$v_result = $this->_merge($p_archive_to_add);
}
@@ -646,7 +647,7 @@
// ----- Invalid variable
else {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
- "Invalid variable type p_archive_to_add");
+ "Invalid variable type p_archive_to_add");
$v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER;
}
@@ -678,29 +679,27 @@
function errorName($p_with_code=false)
{
$v_const_list = get_defined_constants();
-
- // ----- Extract error constants from all const.
+
+ // ----- Extract error constants from all const.
for (reset($v_const_list);
- list($v_key, $v_value) = each($v_const_list);) {
- if (substr($v_key, 0, strlen('ARCHIVE_ZIP_ERR_'))
- =='ARCHIVE_ZIP_ERR_') {
- $v_error_list[$v_key] = $v_value;
- }
+ list($v_key, $v_value) = each($v_const_list);) {
+ if (substr($v_key, 0, strlen('ARCHIVE_ZIP_ERR_'))
+ =='ARCHIVE_ZIP_ERR_') {
+ $v_error_list[$v_key] = $v_value;
+ }
}
-
+
// ----- Search the name form the code value
$v_key=array_search($this->_error_code, $v_error_list, true);
- if ($v_key!=false) {
+ if ($v_key!=false) {
$v_value = $v_key;
- }
- else {
+ } else {
$v_value = 'NoName';
- }
-
+ }
+
if ($p_with_code) {
return($v_value.' ('.$this->_error_code.')');
- }
- else {
+ } else {
return($v_value);
}
}
@@ -721,14 +720,12 @@
{
if ($p_full) {
return($this->errorName(true)." : ".$this->_error_string);
- }
- else {
+ } else {
return($this->_error_string." [code ".$this->_error_code."]");
}
}
// }}}
-
// -----------------------------------------------------------------------------
// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
// ***** *****
@@ -767,7 +764,8 @@
if (!is_file($this->_zipname)) {
// ----- Error log
$this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
- "Missing archive file '".$this->_zipname."'");
+ "Missing archive file '".$this->_zipname."'");
+
return(false);
}
@@ -775,7 +773,8 @@
if (!is_readable($this->_zipname)) {
// ----- Error log
$this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
- "Unable to read archive '".$this->_zipname."'");
+ "Unable to read archive '".$this->_zipname."'");
+
return(false);
}
@@ -810,13 +809,12 @@
$v_result=1;
$v_list_detail = array();
- $p_add_dir = $p_params['add_path'];
- $p_remove_dir = $p_params['remove_path'];
- $p_remove_all_dir = $p_params['remove_all_path'];
+ $p_add_dir = $p_params['add_path'];
+ $p_remove_dir = $p_params['remove_path'];
+ $p_remove_all_dir = $p_params['remove_all_path'];
// ----- Open the file in write mode
- if (($v_result = $this->_openFd('wb')) != 1)
- {
+ if (($v_result = $this->_openFd('wb')) != 1) {
// ----- Return
return $v_result;
}
@@ -849,13 +847,14 @@
$v_result=1;
$v_list_detail = array();
- $p_add_dir = $p_params['add_path'];
- $p_remove_dir = $p_params['remove_path'];
- $p_remove_all_dir = $p_params['remove_all_path'];
+ $p_add_dir = $p_params['add_path'];
+ $p_remove_dir = $p_params['remove_path'];
+ $p_remove_all_dir = $p_params['remove_all_path'];
// ----- Look if the archive exists or is empty and need to b...
[truncated message content] |