[Spidertree-cvs] spidertree/classes SAlbum.php,1.8,1.9 SImage.php,1.5,1.6 SUserBase.php,1.4,1.5
Status: Pre-Alpha
Brought to you by:
spiderr
|
From: <sp...@us...> - 2004-04-21 20:20:13
|
Update of /cvsroot/spidertree/spidertree/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6308/classes Modified Files: SAlbum.php SImage.php SUserBase.php Log Message: updates for TikiPro -Bonnie- Index: SAlbum.php =================================================================== RCS file: /cvsroot/spidertree/spidertree/classes/SAlbum.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SAlbum.php 13 Feb 2004 06:54:55 -0000 1.8 +++ SAlbum.php 21 Apr 2004 20:18:44 -0000 1.9 @@ -1,18 +1,18 @@ <?php // +----------------------------------------------------------------------+ -// | PHP version 4.?? +// | PHP version 4.?? // +----------------------------------------------------------------------+ -// | Copyright (c) 2003 tikwiki.org +// | Copyright (c) 2003 tikwiki.org // +----------------------------------------------------------------------+ // | Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // | All Rights Reserved. See copyright.txt for details and a complete list of authors. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -// | -// | For comments, please use PEAR documentation standards!!! +// | +// | For comments, please use PEAR documentation standards!!! // | -> see http://pear.php.net/manual/en/standards.comments.php -// | and http://www.phpdoc.org/ +// | and http://www.phpdoc.org/ // +----------------------------------------------------------------------+ -// | Authors: spider <sp...@st...> +// | Authors: spider <sp...@st...> // +----------------------------------------------------------------------+ // // $Id$ @@ -40,14 +40,14 @@ class SAlbum extends TikiBase { // {{{ properties - + /** The album id **/ var $mALID; /** The acct id that owns this album **/ var $mUID; /** Array of images for this album, hash indexed my image_id **/ var $mImages; - + // }}} // {{{ SAlbum constructor @@ -65,8 +65,8 @@ TikiBase::TikiBase(); } // }}} - - + + // {{{ load /** * Define and load Smarty components @@ -113,8 +113,8 @@ return( count( $this->mErrors ) == 0 ); } // }}} - - + + // {{{ verify /** * This verifies data integrity. NOTE: pass by reference is crucial, because some modifications @@ -129,7 +129,7 @@ foreach( array_keys($pParams) as $key ) { $pParams[$key] = trim( $pParams[$key] ); } - + // url name was not passed in, we can try to make one... if( empty( $pParams['url'] ) ) { if( isset( $pParams['title'] ) ) { @@ -162,7 +162,7 @@ // {{{ store /** - * this method stores the data. + * this method stores the data. * * @param inParams hash of values to store in database * @return TRUE if successful, FALSE if not. mErrors will hold error strings @@ -188,7 +188,7 @@ return( count( $this->mErrors ) == 0 ); } // }}} - + // {{{ expunge /** * this method removes a "row" from the database @@ -252,9 +252,22 @@ } // }}} + function getAlbums( $pUserId ) { + $ret = NULL; + if( $this->mUID ) { + $ret = array(); + $sql = "SELECT * FROM album WHERE user_id=? ORDER BY path"; + $rs = $this->db->Execute($sql, array( $pUserId ) ); + while( !$rs->EOF ) { + array_push( $ret, $rs->fields ); + $rs->MoveNext(); + } + } + return $ret; + } } - + ?> Index: SImage.php =================================================================== RCS file: /cvsroot/spidertree/spidertree/classes/SImage.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SImage.php 13 Feb 2004 06:54:55 -0000 1.5 +++ SImage.php 21 Apr 2004 20:18:45 -0000 1.6 @@ -1,18 +1,18 @@ <?php // +----------------------------------------------------------------------+ -// | PHP version 4.?? +// | PHP version 4.?? // +----------------------------------------------------------------------+ -// | Copyright (c) 2003 tikwiki.org +// | Copyright (c) 2003 tikwiki.org // +----------------------------------------------------------------------+ // | Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // | All Rights Reserved. See copyright.txt for details and a complete list of authors. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -// | -// | For comments, please use PEAR documentation standards!!! +// | +// | For comments, please use PEAR documentation standards!!! // | -> see http://pear.php.net/manual/en/standards.comments.php -// | and http://www.phpdoc.org/ +// | and http://www.phpdoc.org/ // +----------------------------------------------------------------------+ -// | Authors: spider <sp...@st...> +// | Authors: spider <sp...@st...> // +----------------------------------------------------------------------+ // // $Id$ @@ -45,12 +45,12 @@ class SImage extends TikiBase { // {{{ properties - + /** The image id **/ var $mIMID; /** The acct id that owns this image **/ var $mUID; - + // }}} // {{{ SImage constructor @@ -68,8 +68,8 @@ TikiBase::TikiBase(); } // }}} - - + + // {{{ load /** * Define and load Smarty components @@ -82,7 +82,7 @@ global $gSpidertree; //debug(); if( !empty( $this->mIMID ) ) { - $sql = "SELECT i.*, i.image_id AS imid + $sql = "SELECT i.*, i.image_id AS imid FROM ".STREE_DB_PREFIX."image i WHERE i.image_id=?"; $rs = $this->mDB->Execute($sql, array( $this->mIMID ) ); if( empty($rs) || empty( $rs->fields['image_id'] ) ) { @@ -115,7 +115,7 @@ $this->mErrors['user'] = 'You must be logged in to create an image.'; } else { // move the uploaded file - if( empty($this->IMID ) ) { + if( empty($this->IMID ) ) { $pParams['new_image_id'] = $this->mDB->GenID( 'image_id_seq' ); $pParams['file_name'] = $pParams['new_image_id'].'.'.substr( $pParams['dest_name'], 0, (255-($pParams['new_image_id'] % 10) ) ); if( move_uploaded_file( $pParams['tmp_loc'], getUploadPath( $this->mUID ).$pParams['file_name'] ) ) { @@ -126,8 +126,8 @@ $this->mErrors['upload'] = 'Could not store uploaded file '.basename( $pParams['dest_loc'] ).'.'; } } - - + + if( empty( $pParams['ALID'] ) || !is_numeric( $pParams['ALID'] ) ) { // need to select user's root album $pParams['ALID'] = $this->getRootAlbum( $this->mUID ); @@ -147,7 +147,7 @@ // {{{ store /** - * this method stores the data. + * this method stores the data. * * @param inParams hash of values to store in database * @return TRUE if successful, FALSE if not. mErrors will hold error strings @@ -175,19 +175,19 @@ //pvd( $pParams ); //print "sql $sql"; $rs = $this->mDB->Execute($sql, $bindVars ); - + if( $new ) { // insert into thumbnail queue $sql2 = "INSERT INTO ".STREE_DB_PREFIX."thumbnail_queue ( image_id ) VALUES ( ? )"; $rs = $this->mDB->Execute($sql2, array( $pParams['IMID'] ) ); } - + $this->mDB->CompleteTrans(); } return( count( $this->mErrors ) == 0 ); } // }}} - + // {{{ expunge /** * this method removes a "row" from the database @@ -232,13 +232,13 @@ } else { $ret = $rs->fields['album_id']; } - + } return( count( $this->mErrors ) == 0 ); } // }}} - - + + function getFileInfo () { if( isset( $this->mRow['file_path'] ) ) { } @@ -259,7 +259,7 @@ $this->mDB->CompleteTrans(); } } - + } @@ -303,7 +303,7 @@ } else { $ret = SPIDERTREE_PKG_URL.'images/generating_thumbnails.gif'; } - + return $ret; } @@ -312,9 +312,9 @@ // Snagged from Gallery for reference - + function getDimensions($file, $regs=false) { - global $gallery; + global $gallery; if ($regs === false) $regs = getimagesize($file); @@ -323,7 +323,7 @@ else if (isDebugging()) echo "<br>" .sprintf(_("PHP's %s unable to determine dimensions."), "getimagesize()") ."<br>"; - + // Just in case php can't determine dimensions. switch($gallery->app->graphics) @@ -335,8 +335,8 @@ NetPBM("pnmfile", "--allimages")); break; case "ImageMagick": - // This fails under windows, IM isn't returning parsable status output. - list($lines, $status) = + // This fails under windows, IM isn't returning parsable status output. + list($lines, $status) = exec_internal(ImCmd("identify", fs_import_filename($file))); break; default: @@ -369,7 +369,7 @@ } function resize_image($src, $dest, $target=0, $target_fs=0, $keepProfiles=0) { - global $gallery; + global $gallery; if (!strcmp($src,$dest)) { $useTemp = true; @@ -387,8 +387,8 @@ if ($target === 'off') { $target = 0; } - - // Check for images smaller then target size, don't blow them up. + + // Check for images smaller then target size, don't blow them up. $regs = getDimensions($src, $regs); if ((empty($target) || ($regs[0] <= $target && $regs[1] <= $target)) && (empty($target_fs) || ((int) fs_filesize($src) >> 10) <= $target_fs)) { @@ -411,14 +411,14 @@ if (!isset($quality)) { $quality=$gallery->album->fields['last_quality']; } - processingMsg(" ". sprintf(_("target file size %d kbytes"), + processingMsg(" ". sprintf(_("target file size %d kbytes"), $target_fs)."\n"); do { compress_image($src, $out, $target, $quality, $keepProfiles); $prev_quality=$quality; printf(_("-> file size %d kbytes"), round($filesize)); - processingMsg(" " . sprintf(_("trying quality %d%%"), + processingMsg(" " . sprintf(_("trying quality %d%%"), $quality)); clearstatcache(); $filesize= (int) fs_filesize($out) >> 10; @@ -443,7 +443,7 @@ $quality++; } } - } while ($max_quality-$min_quality > 2 && + } while ($max_quality-$min_quality > 2 && abs(($filesize-$target_fs)/$target_fs) > .02 ); $gallery->album->fields['last_quality']=$prev_quality; @@ -520,7 +520,7 @@ $args = '-xy'; } else if (!strcmp($target, 'tv')) { // Because of NetPBM inconsistencies, the only - // way to do this transformation on *all* + // way to do this transformation on *all* // versions of NetPBM is to pipe two separate // operations in sequence. Versions >= 10.13 // have the new -xform flag, and versions <= @@ -532,14 +532,14 @@ $args2 = ' | ' . NetPBM('pnmflip', '-r180'); } else { $args = ''; - } + } $err = exec_wrapper(toPnmCmd($src) . ' | ' . NetPBM('pnmflip', $args) . $args2 . - ' | ' . fromPnmCmd($out)); + ' | ' . fromPnmCmd($out)); - // copy exif headers from original image to rotated image + // copy exif headers from original image to rotated image if (isset($gallery->app->use_exif)) { $path = $gallery->app->use_exif; exec_internal(fs_import_filename($path, 1) . " -te $srcFile $outFile"); @@ -547,7 +547,7 @@ break; case "ImageMagick": if (!strcmp($target, '-90')) { - $im_cmd = '-rotate 90'; + $im_cmd = '-rotate 90'; } else if (!strcmp($target, '180')) { $im_cmd = '-rotate 180'; } else if (!strcmp($target, '90')) { @@ -563,8 +563,8 @@ } else { $im_cmd = ''; } - - + + $src = fs_import_filename($src); $out = fs_import_filename($out); $err = exec_wrapper(ImCmd('convert', "$im_cmd $srcFile $outFile")); @@ -574,7 +574,7 @@ echo "<br>". _("You have no graphics package configured for use!") ."<br>"; return 0; break; - } + } } if (fs_file_exists("$out") && fs_filesize("$out") > 0) { @@ -591,7 +591,7 @@ function cut_image($src, $dest, $x, $y, $width, $height) { - global $gallery; + global $gallery; if (!strcmp($src,$dest)) { $useTemp = true; $out = "$dest.tmp"; @@ -665,7 +665,7 @@ // Preserve comment, EXIF data if a JPEG if $keepProfiles is set. $err = exec_wrapper(ImCmd('convert', "-quality $quality " . ($target ? "-size ${target}x${target} " : '') - . ($keepProfiles ? ' ' : ' +profile \'*\' ') + . ($keepProfiles ? ' ' : ' +profile \'*\' ') . $src . ($target ? " -geometry ${target}x${target} " : '') . $out)); @@ -827,7 +827,7 @@ $filename = "\"$filename\""; } } - + return $filename; } @@ -838,4 +838,5 @@ + ?> Index: SUserBase.php =================================================================== RCS file: /cvsroot/spidertree/spidertree/classes/SUserBase.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SUserBase.php 9 Feb 2004 06:23:02 -0000 1.4 +++ SUserBase.php 21 Apr 2004 20:18:45 -0000 1.5 @@ -1,18 +1,18 @@ <?php // +----------------------------------------------------------------------+ -// | PHP version 4.?? +// | PHP version 4.?? // +----------------------------------------------------------------------+ -// | Copyright (c) 2003 tikwiki.org +// | Copyright (c) 2003 tikwiki.org // +----------------------------------------------------------------------+ // | Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // | All Rights Reserved. See copyright.txt for details and a complete list of authors. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -// | -// | For comments, please use PEAR documentation standards!!! +// | +// | For comments, please use PEAR documentation standards!!! // | -> see http://pear.php.net/manual/en/standards.comments.php -// | and http://www.phpdoc.org/ +// | and http://www.phpdoc.org/ // +----------------------------------------------------------------------+ -// | Authors: spider <sp...@st...> +// | Authors: spider <sp...@st...> // +----------------------------------------------------------------------+ // // $Id$ @@ -32,15 +32,9 @@ require_once( STREE_BASE_CLASS ); -class SUserBase extends TikiBase { +class SUser extends TikiUser { // {{{ properties - - /** The user id **/ - var $mUID; - - /** A "row" of data for this user, in associative has format **/ - var $mRow; - + // }}} // {{{ SUserBase constructor @@ -71,9 +65,9 @@ } return $ret; } - + } - + function mkdir_p($target){ if(file_exists($target) || is_dir($target)) return 0; @@ -93,6 +87,6 @@ else { return 0; } -} +} ?> |