------------------------------------------------------------
revno: 862
committer: Jon Phillips <[email protected]>
branch nick: aikiframework
timestamp: Sun 2011-06-19 21:47:17 -0500
message:
Added some more comments, switching the package for docs purpose for the
configs folder to configs, see the updating documentation at:
http://aikiframework.org/doc/
modified:
src/assets/apps/image_viewer.php
src/configs/aiki-defs.inc
src/configs/config.php
src/configs/defs.inc
src/libs/core.php
src/libs/widgets.php
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/assets/apps/image_viewer.php'
--- src/assets/apps/image_viewer.php 2011-06-14 21:09:57 +0000
+++ src/assets/apps/image_viewer.php 2011-06-20 02:47:17 +0000
@@ -15,6 +15,8 @@
* @category Aiki
* @package Apps
* @filesource
+ *
+ * @todo break this code into smaller pieces
*/
error_reporting(0);
@@ -22,25 +24,21 @@
/**
* @global string $id the name of the image
- * @name $id
*/
$id = $_GET['id'];
/**
* @global int $size grabs the size of the file
- * @name $size
*/
$size = $_GET['size'];
-if (isset($_GET['mode'])){
+if (isset($_GET['mode']))
$mode = $_GET['mode'];
-}else{
+else
$mode = '';
-}
/**
* @global string $ext isolates the extension of the filename
- * @name $ext
*/
$ext = substr($id, strrpos($id, '.') + 1);
@@ -49,14 +47,14 @@
*/
$ext = strtolower($ext);
-if ($ext == "jpeg"){
+if ($ext == "jpeg")
$ext = "jpg";
-}
/**
* Compares isolated file extension & generates appropriate content-type
*/
-switch ($ext){
+switch ($ext)
+{
case "svg":
header('Content-Type: image/svg+xml');
break;
@@ -72,21 +70,20 @@
default:
header('content-type: image/jpeg');
break;
-
}
/**
* Case to check if file is displayable, by default, or if additional processing is needed
*/
-switch ($mode){
+switch ($mode)
+{
case "svg_to_png":
$ext = "svg";
break;
default:
- if ($mode){
+ if ($mode)
$hard_full_path = $mode;
- }
break;
}
@@ -107,20 +104,25 @@
/**
* If a filename has been pulled, process it
*/
-if ($id){
-
- if (!isset($hard_full_path)){
+if ($id)
+{
+ if (!isset($hard_full_path))
+ {
/**
* Ensure the extension is a displayable file type
+ *
+ * @todo extract hardcoded default to the top of the document
*/
- if (!preg_match('/jpg|jpeg|gif|png|svg|JPG|JPEG|GIF|PNG|SVG/i', $id)){
+ if (!preg_match('/jpg|jpeg|gif|png|svg|JPG|JPEG|GIF|PNG|SVG/i', $id))
+ {
$image = $db->get_row("SELECT filename, full_path, available_sizes, no_watermark_under, watermark FROM $default_photo_module where id='$id'");
$id = $image->filename;
- }else{
+ } else {
$file = $id;
- switch ($mode){
+ switch ($mode)
+ {
case "svg_to_png":
$file = str_replace(".png", ".svg", $file);
break;
@@ -129,12 +131,11 @@
$image = $db->get_row("SELECT id, full_path, available_sizes, no_watermark_under, watermark FROM $default_photo_module where filename='$file'");
}
- }else{
+ } else {
$image = new stdClass();
- if (!isset($hard_full_path) or !$hard_full_path){
+ if (!isset($hard_full_path) or !$hard_full_path)
$hard_full_path = '';
- }
$image->full_path = $hard_full_path."/";
$image->filename = $id;
@@ -142,13 +143,13 @@
$image->watermark = '';
$image->available_sizes = '';
$hard_image = true;
-
}
/**
* If a row has been pulled from the db describing an image, handle it
*/
- if ($image){
+ if ($image)
+ {
/**
* Begin constructing the URL
*/
@@ -159,32 +160,31 @@
/**
* Sets default size, if no size specified
*/
- if ($config['max_res'] and !$size){
+ if ($config['max_res'] and !$size)
$size = $config['max_res'];
- }
- if ($size == '_'){
+ if ($size == '_')
$size = '';
- }
/**
* If file is svg, rename to png
*/
- if ($ext == "svg"){
-
- switch ($mode){
+ if ($ext == "svg")
+ {
+ switch ($mode)
+ {
case "svg_to_png":
- $original_filename = str_replace(".png", ".svg", $original_filename );
+ $original_filename =
+ str_replace(".png", ".svg", $original_filename );
break;
}
-
-
- if ($size){
+ if ($size)
+ {
$size = str_replace('px', '', $size);
-
- switch ($mode){
+ switch ($mode)
+ {
case "svg_to_png":
if(file_exists($get_root.$image->full_path."$size"."px-".$id)){
@@ -250,43 +250,38 @@
break;
}
-
-
-
-
-
-
}else{
echo $svgfile;
}
- }else{
+ } else {
$resize_filename = $get_root.$image->full_path.$size."px-".$id;
-
-
- if ($image->watermark and !$size and file_exists($original_filename)){
-
- $original_filename = $aiki->image->display_watermarked_image($original_filename, $image->watermark, $image->no_watermark_under);
-
- }elseif ($image->watermark and $size and file_exists($resize_filename)){
-
- $original_filename = $aiki->image->display_watermarked_image($resize_filename, $image->watermark, $image->no_watermark_under);
-
+ if ($image->watermark and
+ !$size and
+ file_exists($original_filename))
+ {
+ $original_filename =
+ $aiki->image->display_watermarked_image($original_filename,
+ $image->watermark, $image->no_watermark_under);
+
+ } elseif ($image->watermark and $size and
+ file_exists($resize_filename))
+ {
+ $original_filename =
+ $aiki->image->display_watermarked_image($resize_filename,
+ $image->watermark, $image->no_watermark_under);
}
- if ($size){
+ if ($size)
$req_filename = $resize_filename;
- }else{
+ else
$req_filename = $original_filename;
- }
-
-
-
- if (file_exists($req_filename)){
-
- switch ($ext){
-
+
+ if (file_exists($req_filename))
+ {
+ switch ($ext)
+ {
case "png":
$final_image = imagecreatefrompng($req_filename);
@@ -294,7 +289,6 @@
imagealphablending($final_image, false);
imagesavealpha($final_image, true);
-
imagepng($final_image);
imagedestroy($final_image);
@@ -305,24 +299,24 @@
imagejpeg($final_image);
imagedestroy($final_image);
break;
-
-
}
- }elseif(file_exists($original_filename)){
-
+ } elseif(file_exists($original_filename))
+ {
$aiki->image->imageresize($get_root.$image->full_path,$id,$size,$size."px-");
- if (file_exists($req_filename)){
-
+ if (file_exists($req_filename))
+ {
$image->available_sizes = $image->available_sizes."$size".'px|';
- if (!isset($hard_image)){
+ if (!isset($hard_image))
+ {
$update_sizes = $db->query("UPDATE $default_photo_module set available_sizes = '$image->available_sizes' where id = '$image->id'");
}
- switch ($ext){
+ switch ($ext)
+ {
case "png":
$final_image = imagecreatefrompng($req_filename);
imagealphablending($final_image, false);
@@ -336,11 +330,8 @@
imagejpeg($final_image);
imagedestroy($final_image);
break;
-
}
-
-
}
}
}
=== modified file 'src/configs/aiki-defs.inc'
--- src/configs/aiki-defs.inc 2011-06-13 00:09:41 +0000
+++ src/configs/aiki-defs.inc 2011-06-20 02:47:17 +0000
@@ -21,7 +21,7 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* @link @PACKAGE_URL@
* @category Aiki
- * @package Aiki
+ * @package Configs
* @version @VERSION@.@REVISION@
* @filesource */
@@ -51,4 +51,4 @@
define("AIKI_SITE_URL", "@AIKI_SITE_URL@");
/** Aiki Rewrite Base (for htaccess) */
-define("AIKI_REWRITE_BASE", "@AIKI_REWRITE_BASE@");
\ No newline at end of file
+define("AIKI_REWRITE_BASE", "@AIKI_REWRITE_BASE@");
=== modified file 'src/configs/config.php'
--- src/configs/config.php 2011-06-18 00:53:41 +0000
+++ src/configs/config.php 2011-06-20 02:47:17 +0000
@@ -14,7 +14,7 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* @link http://aikiframework.org
* @category Aiki
- * @package Aiki
+ * @package Configs
* @filesource */
/** @see defs.php */
=== modified file 'src/configs/defs.inc'
--- src/configs/defs.inc 2011-06-18 00:53:41 +0000
+++ src/configs/defs.inc 2011-06-20 02:47:17 +0000
@@ -23,7 +23,7 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* @link @PACKAGE_URL@
* @category Aiki
- * @package Aiki
+ * @package Configs
* @version @VERSION@.@REVISION@
* @filesource */
@@ -99,4 +99,4 @@
if (!defined("E_USER_DEPRECATED")) {
/** Define E_USER_DEPRECATED if not defined */
define("E_USER_DEPRECATED", 16384);
-}
\ No newline at end of file
+}
=== modified file 'src/libs/core.php'
--- src/libs/core.php 2011-06-15 02:54:01 +0000
+++ src/libs/core.php 2011-06-20 02:47:17 +0000
@@ -13,7 +13,7 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* @link http://www.aikiframework.org
* @category Aiki
- * @package System
+ * @package Library
* @filesource
*/
=== modified file 'src/libs/widgets.php'
--- src/libs/widgets.php 2011-06-18 22:20:42 +0000
+++ src/libs/widgets.php 2011-06-20 02:47:17 +0000
@@ -13,7 +13,7 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* @link http://www.aikiframework.org
* @category Aiki
- * @package System
+ * @package Library
* @filesource
*/
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp