Commit a4352a39 authored by redflo's avatar redflo

tikilib factorization - imagegallib

parent b961b1f1
This diff is collapsed.
This diff is collapsed.
<?php # $Header: /cvsroot/tikiwiki/tiki/show_image.php,v 1.4 2003-03-04 22:53:42 redflo Exp $
<?php # $Header: /cvsroot/tikiwiki/tiki/show_image.php,v 1.5 2003-03-23 12:59:40 redflo Exp $
if (!isset($_REQUEST["nocache"]))
session_cache_limiter('private_no_expire');
include_once("tiki-setup_base.php");
include_once("lib/imagegals/imagegallib.php");
// show_image.php
// application to display an image from the database with
// option to resize the image dynamically creating a thumbnail on the fly.
......@@ -29,7 +30,7 @@ else {
$itype='o';
}
$data = $tikilib->get_image($_REQUEST["id"],$itype,$sxsize,$sysize);
$data = $imagegallib->get_image($_REQUEST["id"],$itype,$sxsize,$sysize);
$galleryId=$data["galleryId"];
$smarty->assign('individual','n');
......@@ -56,7 +57,7 @@ if(!isset($tiki_p_view_image_gallery)) {
}
if(!isset($_REQUEST["thumb"])) {
$tikilib->add_image_hit($_REQUEST["id"]);
$imagegallib->add_image_hit($_REQUEST["id"]);
}
$type=$data["filetype"];
......
<?php
// Initialization
require_once('tiki-setup.php');
include_once("lib/imagegals/imagegallib.php");
if($feature_galleries != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
......@@ -57,7 +58,7 @@ if($tiki_p_view_image_gallery != 'y') {
if($_REQUEST["galleryId"]!=0) {
// To browse the gallery the user has to be admin, the owner or the gallery has to be public
$gal_info = $tikilib->get_gallery($_REQUEST["galleryId"]);
$gal_info = $imagegallib->get_gallery($_REQUEST["galleryId"]);
//$smarty->assign_by_ref('theme',$gal_info["theme"]);
//$smarty->assign('use_theme','y');
/*
......@@ -79,7 +80,7 @@ $smarty->assign_by_ref('owner',$gal_info["user"]);
$smarty->assign_by_ref('public',$gal_info["public"]);
$smarty->assign_by_ref('galleryId',$_REQUEST["galleryId"]);
$tikilib->add_gallery_hit($_REQUEST["galleryId"]);
$imagegallib->add_gallery_hit($_REQUEST["galleryId"]);
if(isset($_REQUEST["remove"])) {
// To remove an image the user must be the owner or admin
......@@ -88,7 +89,7 @@ if(isset($_REQUEST["remove"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->remove_image($_REQUEST["remove"]);
$imagegallib->remove_image($_REQUEST["remove"]);
}
if(isset($_REQUEST["rebuild"])) {
......@@ -98,7 +99,7 @@ if(isset($_REQUEST["rebuild"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->rebuild_thumbnails($_REQUEST["rebuild"]);
$imagegallib->rebuild_thumbnails($_REQUEST["rebuild"]);
}
if(isset($_REQUEST["rotateright"])) {
......@@ -108,7 +109,7 @@ if(isset($_REQUEST["rotateright"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->rotate_right_image($_REQUEST["rotateright"]);
$imagegallib->rotate_right_image($_REQUEST["rotateright"]);
}
if(isset($_REQUEST["rotateleft"])) {
......@@ -118,7 +119,7 @@ if(isset($_REQUEST["rotateleft"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->rotate_left_image($_REQUEST["rotateleft"]);
$imagegallib->rotate_left_image($_REQUEST["rotateleft"]);
}
$smarty->assign('system','n');
......@@ -132,8 +133,8 @@ if($_REQUEST["galleryId"]==0) {
$info["description"]='System Gallery';
$smarty->assign('system','y');
} else {
$info = $tikilib->get_gallery($_REQUEST["galleryId"]);
$nextscaleinfo = $tikilib->get_gallery_next_scale($_REQUEST["galleryId"]);
$info = $imagegallib->get_gallery($_REQUEST["galleryId"]);
$nextscaleinfo = $imagegallib->get_gallery_next_scale($_REQUEST["galleryId"]);
}
if(!isset($info["maxRows"])) $info["maxRows"]=10;
......@@ -190,7 +191,7 @@ if(isset($_REQUEST["find"])) {
$_REQUEST["find"] = '';
}
$images = $tikilib->get_images($offset,$maxRecords,$sort_mode,$find,$_REQUEST["galleryId"]);
$images = $imagegallib->get_images($offset,$maxRecords,$sort_mode,$find,$_REQUEST["galleryId"]);
$cant_pages = ceil($images["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages',$cant_pages);
$smarty->assign('actual_page',1+($offset/$maxRecords));
......
<?php
// Initialization
require_once('tiki-setup.php');
include_once("lib/imagegals/imagegallib.php");
if($feature_galleries != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
......@@ -16,7 +17,7 @@ if(!isset($_REQUEST["imageId"])) {
}
// get info for scaled images
$scaleinfo = $tikilib->get_gallery_scale_info($_REQUEST["galleryId"]);
$scaleinfo = $imagegallib->get_gallery_scale_info($_REQUEST["galleryId"]);
$sxsize=0;
$sysize=0;
if(isset($_REQUEST["xsize"])) $sxsize=$_REQUEST["xsize"];
......@@ -65,8 +66,8 @@ $smarty->assign_by_ref('prevt',$prevt);
$info = $tikilib->get_image_info($_REQUEST["imageId"],$itype,$sxsize,$sysize);
$gal_info = $tikilib->get_gallery($info["galleryId"]);
$info = $imagegallib->get_image_info($_REQUEST["imageId"],$itype,$sxsize,$sysize);
$gal_info = $imagegallib->get_gallery($info["galleryId"]);
$_REQUEST["galleryId"] = $info["galleryId"];
if(!isset($_REQUEST["sort_mode"])) {
......@@ -120,13 +121,13 @@ if(!isset($_REQUEST["offset"])) {
$_REQUEST["offset"]=0;
}
$offset=$_REQUEST["offset"];
$image_prev = $tikilib->get_images($offset+$_REQUEST["desp"]-1,1,$sort_mode,'',$_REQUEST["galleryId"]);
$image_prev = $imagegallib->get_images($offset+$_REQUEST["desp"]-1,1,$sort_mode,'',$_REQUEST["galleryId"]);
if(count($image_prev["data"])==1) {
$smarty->assign('previmg',$image_prev["data"][0]["imageId"]);
} else {
$smarty->assign('previmg','');
}
$image_next = $tikilib->get_images($offset+$_REQUEST["desp"]+1,1,$sort_mode,'',$_REQUEST["galleryId"]);
$image_next = $imagegallib->get_images($offset+$_REQUEST["desp"]+1,1,$sort_mode,'',$_REQUEST["galleryId"]);
if(count($image_next["data"])==1) {
$smarty->assign('nextimg',$image_next["data"][0]["imageId"]);
} else {
......@@ -146,9 +147,9 @@ $smarty->assign('url_browse',httpPrefix().$foo1);
$smarty->assign('url_show',httpPrefix().$foo2);
$tikilib->add_image_hit($_REQUEST["imageId"]);
$info = $tikilib->get_image_info($_REQUEST["imageId"]); //todo: already known???
$gal_info = $tikilib->get_gallery($info["galleryId"]);
$imagegallib->add_image_hit($_REQUEST["imageId"]);
$info = $imagegallib->get_image_info($_REQUEST["imageId"]); //todo: already known???
$gal_info = $imagegallib->get_gallery($info["galleryId"]);
//$smarty->assign_by_ref('theme',$gal_info["theme"]);
//$smarty->assign('use_theme','y');
......@@ -160,7 +161,7 @@ if(isset($_REQUEST["move_image"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->move_image($_REQUEST["imageId"],$_REQUEST["galleryId"]);
$imagegallib->move_image($_REQUEST["imageId"],$_REQUEST["galleryId"]);
}
......@@ -177,7 +178,7 @@ $smarty->assign_by_ref('ysize',$info["ysize"]);
$smarty->assign_by_ref('hits',$info["hits"]);
$smarty->assign_by_ref('image_user',$info["user"]);
$galleries = $tikilib->list_visible_galleries(0,-1,'lastModif_desc', $user,'');
$galleries = $imagegallib->list_visible_galleries(0,-1,'lastModif_desc', $user,'');
$smarty->assign_by_ref('galleries',$galleries["data"]);
$section='galleries';
......
<?php
// Initialization
require_once('tiki-setup.php');
include_once("lib/imagegals/imagegallib.php");
if($feature_galleries != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
......@@ -60,7 +61,7 @@ if (isset($_REQUEST["editimage"])) {
}
$gal_info = $tikilib->get_gallery($_REQUEST["galleryId"]);
$gal_info = $imagegallib->get_gallery($_REQUEST["galleryId"]);
if($gal_info["thumbSizeX"]==0) $gal_info["thumbSizeX"]=80;
if($gal_info["thumbSizeY"]==0) $gal_info["thumbSizeY"]=80;
// Check the user to be admin or owner or the gallery is public
......@@ -71,7 +72,7 @@ if (isset($_REQUEST["editimage"])) {
}
$error_msg='';
if ($tikilib->edit_image($_REQUEST['edit'],$_REQUEST['name'],$_REQUEST['description'])) {
if ($imagegallib->edit_image($_REQUEST['edit'],$_REQUEST['name'],$_REQUEST['description'])) {
$smarty->assign('show','y');
} else {
$smarty->assign('msg',tra("Failed to edit the image"));
......@@ -80,7 +81,7 @@ if (isset($_REQUEST["editimage"])) {
}
}
$info = $tikilib->get_image($_REQUEST["edit"]);
$info = $imagegallib->get_image($_REQUEST["edit"]);
$smarty->assign('show','n');
$smarty->assign_by_ref('imageId',$_REQUEST['edit']);
$smarty->assign_by_ref('galleryId',$info['galleryId']);
......
......@@ -2,6 +2,7 @@
require_once('tiki-setup.php');
require_once('lib/tikilib.php'); # httpScheme()
include_once("lib/imagegals/imagegallib.php");
if($rss_image_gallery != 'y') {
die;
......@@ -19,8 +20,8 @@ $img = httpPrefix().$foo2;
$read = httpPrefix().$foo3;
$now = date("U");
$changes = $tikilib->get_images( 0,$max_rss_image_gallery,'created_desc', '', $_REQUEST["galleryId"]);
$info = $tikilib->get_gallery($_REQUEST["galleryId"]);
$changes = $imagegallib->get_images( 0,$max_rss_image_gallery,'created_desc', '', $_REQUEST["galleryId"]);
$info = $imagegallib->get_gallery($_REQUEST["galleryId"]);
$galleryname = $info["name"];
$gallerydesc = $info["description"];
//print_r($changes);die;
......@@ -53,4 +54,4 @@ print('>');
</rdf:Seq>
</items>
</channel>
</rdf:RDF>
\ No newline at end of file
</rdf:RDF>
<?php
// Initialization
require_once('tiki-setup.php');
include_once("lib/imagegals/imagegallib.php");
if($feature_galleries != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
......@@ -67,7 +68,7 @@ if($tiki_p_upload_images != 'y') {
if($_REQUEST["galleryId"]!=0) {
// To browse the gallery the user has to be admin, the owner or the gallery has to be public
$gal_info = $tikilib->get_gallery($_REQUEST["galleryId"]);
$gal_info = $imagegallib->get_gallery($_REQUEST["galleryId"]);
//$smarty->assign_by_ref('theme',$gal_info["theme"]);
//$smarty->assign('use_theme','y');
/*
......@@ -89,7 +90,7 @@ $smarty->assign_by_ref('owner',$gal_info["user"]);
$smarty->assign_by_ref('public',$gal_info["public"]);
$smarty->assign_by_ref('galleryId',$_REQUEST["galleryId"]);
$tikilib->add_gallery_hit($_REQUEST["galleryId"]);
$imagegallib->add_gallery_hit($_REQUEST["galleryId"]);
if(isset($_REQUEST["remove"])) {
// To remove an image the user must be the owner or admin
......@@ -98,7 +99,7 @@ if(isset($_REQUEST["remove"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->remove_image($_REQUEST["remove"]);
$imagegallib->remove_image($_REQUEST["remove"]);
}
if(isset($_REQUEST["rebuild"])) {
......@@ -108,7 +109,7 @@ if(isset($_REQUEST["rebuild"])) {
$smarty->display("styles/$style_base/error.tpl");
die;
}
$tikilib->rebuild_thumbnails($_REQUEST["rebuild"]);
$imagegallib->rebuild_thumbnails($_REQUEST["rebuild"]);
}
$smarty->assign('system','n');
......@@ -122,7 +123,7 @@ if($_REQUEST["galleryId"]==0) {
$info["description"]='System Gallery';
$smarty->assign('system','y');
} else {
$info = $tikilib->get_gallery($_REQUEST["galleryId"]);
$info = $imagegallib->get_gallery($_REQUEST["galleryId"]);
}
if(!isset($info["maxRows"])) $info["maxRows"]=10;
......@@ -161,7 +162,7 @@ if(isset($_REQUEST["find"])) {
$find = '';
}
$images = $tikilib->get_images($offset,$maxRecords,$sort_mode,$find,$_REQUEST["galleryId"]);
$images = $imagegallib->get_images($offset,$maxRecords,$sort_mode,$find,$_REQUEST["galleryId"]);
$cant_pages = ceil($images["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages',$cant_pages);
$smarty->assign('actual_page',1+($offset/$maxRecords));
......@@ -193,4 +194,4 @@ if($feature_theme_control == 'y') {
// Display the template
$smarty->assign('mid','tiki-list_gallery.tpl');
$smarty->display("styles/$style_base/tiki.tpl");
?>
\ No newline at end of file
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment