Thread: [Linpha-cvs] SF.net SVN: linpha: [4452] trunk/linpha2 (Page 2)
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-03-29 14:29:37
|
Revision: 4452 Author: fangehrn Date: 2006-03-29 06:29:25 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4452&view=rev Log Message: ----------- * thumbnails are now cropped -> they are all squares now makes things a lot easier, and looks nice Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/syslog.js trunk/linpha2/templates/default/css/global.css trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/global.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-29 13:11:38 UTC (rev 4451) +++ trunk/linpha2/ChangeLog 2006-03-29 14:29:25 UTC (rev 4452) @@ -1,5 +1,7 @@ 2006-03-29 flo * rearanged templates + * thumbnails are now cropped -> they are all squares now + makes things a lot easier, and looks nice 2006-03-26 flo * applying bastian's theme Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-29 13:11:38 UTC (rev 4451) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-29 14:29:25 UTC (rev 4452) @@ -176,7 +176,9 @@ */ if( linIdentify::isVideo( $org_type ) ) { - //$tmp_file = create_video_thumbnail($src_file); + /** + * @todo $tmp_file = create_video_thumbnail($src_file); + */ $output = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; } @@ -189,27 +191,57 @@ * read thumbsize */ $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_tn_size']; - $max_width = $thumbsize; + $q = 75; + + + /*$max_width = $thumbsize; $max_height = $thumbsize; + $w = $thumbsize; + $h = $thumbsize;*/ - /** * set parameters */ - $array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); + /*$array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); $w = $array['w']; - $h = $array['h']; - $q = 75; - + $h = $array['h'];*/ + + + /** + * crop image + */ + $ratio = $org_width/$org_height; + if($ratio==1) + { + $x = 0; + $y = 0; + $w = $thumbsize; + $h = $thumbsize; + } + elseif($ratio>1) + { + $x = ( ($thumbsize*$ratio) - $thumbsize )/2; + $y = 0; + $w = ''; + $h = $thumbsize; + } + elseif($ratio<1) + { + $y = ( $thumbsize - ($thumbsize*$ratio) )/2; + $x = 0; + $w = $thumbsize; + $h = ''; + } + $convert_str = 'convert'. ' -quality '.$q. - ' -size "'.$w.'x'.$h.'"'. // new size + ' -size '.$w.'x'.$h. // new size + ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop ' '.lin_escape_string( $src_file ).'[0]'. // [0] -> take only first frame!!! - ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles - //' +profile "*"'. // delete all profiles + ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images ' '.lin_escape_string( $output ); - + exec( $convert_str ); } } Modified: trunk/linpha2/lib/classes/syslog.js =================================================================== --- trunk/linpha2/lib/classes/syslog.js 2006-03-29 13:11:38 UTC (rev 4451) +++ trunk/linpha2/lib/classes/syslog.js 2006-03-29 14:29:25 UTC (rev 4452) @@ -0,0 +1,24 @@ +var window_is_open = false; +function toggleWindow() +{ + if( window_is_open ) + { + window_is_open = false; + + document.getElementById('sys_log').style.width = '20px'; + document.getElementById('sys_log').style.height = '20px'; + + document.getElementById('sys_log_text').style.visibility = 'hidden'; + } + else + { + window_is_open = true; + + document.getElementById('sys_log').style.width = 'auto'; + document.getElementById('sys_log').style.height = 'auto'; + + document.getElementById('sys_log_text').style.visibility = ''; + } +} + +toggleWindow(); \ No newline at end of file Modified: trunk/linpha2/templates/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/css/global.css 2006-03-29 13:11:38 UTC (rev 4451) +++ trunk/linpha2/templates/default/css/global.css 2006-03-29 14:29:25 UTC (rev 4452) @@ -97,60 +97,65 @@ * menu */ #divmenu { - /* background-color: #ffd5ee;*/ - /* border: 1px solid #f09;*/ - - z-index: 400; - height: 30px; } #menu { position: absolute; left: 50%; - width: 600px; + width: 800px; height: 40px; - margin-left: -300px; /* should be the half of 'width' */ + margin-left: -400px; /* half of 'width' */ + } - /*width: 100%;*/ + /** + * icons + */ + #menu div { + margin: 0; + margin-left: 5px; + margin-right: 5px; + padding: 0; float: left; } - + + /** + * hover + */ + #menu a:hover, #menu span:hover { + background: #bbbbbb; + } + + /** + * first level elements + */ #menu ul { list-style: none; margin: 0; + margin-left: 5px; + margin-right: 5px; padding: 0; - width: 7em; float: left; white-space: nowrap; + + border-top: 1px solid #000000; } - + /** - * all elements + * first level elements */ - #menu a, #menu span { + #menu ul a, #menu ul span { display: block; margin: 0; - padding: 2px 3px; + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + padding-bottom: 2px; -/* border-width: 1px; - border-style: solid; - border-color: #ccc #888 #555 #bbb; - color: #fff; - background: #036;*/ - } - - /** - * only first level elements - */ - #menu ul a, #menu ul span { - margin-left: 10px; - margin-right: 10px; - text-align: center; text-decoration: none; - border-top: 1px solid #000000; + color: #000000; background: #FFFFFF; } @@ -158,9 +163,26 @@ /** * only two or more level elements */ + #menu ul ul { + position: absolute; + z-index: 500; + + /** + * relativ to parent element! be careful + */ + font-size: 1em; + margin: 0; + padding: 0; + } #menu ul ul a, #menu ul ul span { - margin: 0px; + display: block; + margin: 0; + padding-left: 5px; + padding-right: 5px; + padding-top: 2px; + padding-bottom: 2px; + text-align: left; text-decoration: none; @@ -168,42 +190,43 @@ border-top-width: 0px; background: #eeeeee; } - - #menu a:hover, #menu span:hover { -/* color: #fff;*/ - background: #bbbbbb; - } + + /** + * the most important thing + * enable/disable submenus + */ #menu li { position: relative; } - - #menu ul ul { - position: absolute; - z-index: 500; - font-size: 1em; /* relativ to parent element */ - width: auto; - min-width: 7em; -/* white-space: nowrap;*/ - } - - #menu ul ul ul { - position: absolute; - top: 0; - left: 100%; - } - + div#menu ul ul, div#menu ul li:hover ul ul, div#menu ul ul li:hover ul ul - {display: none;} - + { + display: none; + } div#menu ul li:hover ul, div#menu ul ul li:hover ul, div#menu ul ul ul li:hover ul - {display: block;} + { + display: block; + } + /** + * third stage, switch to horizontal menu entries + */ + #menu ul ul ul { + position: absolute; + top: 0; + left: 100%; + } /** + * end menu + */ + + +/** * rounded corner stuff */ #divmain { Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-03-29 13:11:38 UTC (rev 4451) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-03-29 14:29:25 UTC (rev 4452) @@ -1,5 +1,5 @@ #main { - min-height: 500px; @todo floated divs in thumb view without javascript doesnt count to the main div height */ + min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ } /** Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-03-29 13:11:38 UTC (rev 4451) +++ trunk/linpha2/templates/default/global.html.php 2006-03-29 14:29:25 UTC (rev 4452) @@ -27,7 +27,7 @@ <?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> <!-- syslog --> <div id="sys_log"> - <div class="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> + <div id="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> <div id="sys_log_text"> <?php echo i18n("Linpha Syslog"); ?>:<br /> <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> @@ -54,9 +54,6 @@ <li><a href="./"><?php echo i18n("Home"); ?></a></li> </ul> <ul> - <li><a href="./admin/"><?php echo i18n("Admin"); ?></a></li> - </ul> - <ul> <li><span><?php echo i18n("Search"); ?> v</span> <ul> <li><a href="./?cat=search"><?php echo i18n("Extended Search"); ?></a></li> @@ -91,6 +88,17 @@ $GLOBALS['linpha']->template->printMenu('more'); } ?> + <div> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/download.png'; ?>" /> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/print.png'; ?>" /> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/slideshow.png'; ?>" /> + </div> + <ul> + <li><a href="./admin/"><?php echo i18n("My Settings"); ?></a></li> + </ul> + <ul> + <li><a href="./admin/"><?php echo i18n("Admin"); ?></a></li> + </ul> </div> </div> <!-- end menu --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-29 16:36:04
|
Revision: 4453 Author: fangehrn Date: 2006-03-29 08:35:34 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4453&view=rev Log Message: ----------- * added ie hack for the menu, all should work now, but it will never look that nice Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/templates/default/css/global.css trunk/linpha2/templates/default/css/view_img.css trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/global.html.php Added Paths: ----------- trunk/linpha2/templates/default/css/csshover.htc Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-29 14:29:25 UTC (rev 4452) +++ trunk/linpha2/ChangeLog 2006-03-29 16:35:34 UTC (rev 4453) @@ -2,6 +2,8 @@ * rearanged templates * thumbnails are now cropped -> they are all squares now makes things a lot easier, and looks nice + * added ie hack for the menu, all should work now, but it + will never look that nice 2006-03-26 flo * applying bastian's theme Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-29 14:29:25 UTC (rev 4452) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-29 16:35:34 UTC (rev 4453) @@ -75,20 +75,20 @@ function set_navigation_line( $id ) { $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); - $str = '<a href="'.LINPHA_DIR.'/?cat=alb&id=0">top</a> / '; + $str = '<a href="'.LINPHA_DIR.'/?cat=alb&id=0">></a> '; foreach($array_files AS $key=>$value) { if($value != "") { - $str .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$key.'">'.$value.'</a> / '; + $str .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$key.'">'.$value.'</a> > '; } } /** - * remove last 3 signs (the comma and the spaces) + * remove last spacer signs */ - $str = substr($str,0,strlen($str)-3); + $str = substr($str,0,strlen($str)-6); return $str; Added: trunk/linpha2/templates/default/css/csshover.htc =================================================================== --- trunk/linpha2/templates/default/css/csshover.htc (rev 0) +++ trunk/linpha2/templates/default/css/csshover.htc 2006-03-29 16:35:34 UTC (rev 4453) @@ -0,0 +1,115 @@ +<attach event="ondocumentready" handler="parseStylesheets" /> +<script> +/** + * Whatever:hover - V1.41.050927 - hover & active + * ------------------------------------------------------------ + * (c) 2005 - Peter Nederlof + * Peterned - http://www.xs4all.nl/~peterned/ + * License - http://creativecommons.org/licenses/LGPL/2.1/ + * + * Whatever:hover is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Whatever:hover is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Credits and thanks to: + * Arnoud Berendsen, Martin Reurings, Robert Hanson + * + * howto: body { behavior:url("csshover.htc"); } + * ------------------------------------------------------------ + */ + +var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i, +currentSheet, doc = window.document, hoverEvents = [], activators = { + onhover:{on:'onmouseover', off:'onmouseout'}, + onactive:{on:'onmousedown', off:'onmouseup'} +} + +function parseStylesheets() { + if(!/MSIE (5|6)/.test(navigator.userAgent)) return; + window.attachEvent('onunload', unhookHoverEvents); + var sheets = doc.styleSheets, l = sheets.length; + for(var i=0; i<l; i++) + parseStylesheet(sheets[i]); +} + function parseStylesheet(sheet) { + if(sheet.imports) { + try { + var imports = sheet.imports, l = imports.length; + for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]); + } catch(securityException){} + } + + try { + var rules = (currentSheet = sheet).rules, l = rules.length; + for(var j=0; j<l; j++) parseCSSRule(rules[j]); + } catch(securityException){} + } + + function parseCSSRule(rule) { + var select = rule.selectorText, style = rule.style.cssText; + if(!csshoverReg.test(select) || !style) return; + + var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1'); + var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo); + var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1]; + var affected = select.replace(/:(hover|active).*$/, ''); + var elements = getElementsBySelect(affected); + if(elements.length == 0) return; + + currentSheet.addRule(newSelect, style); + for(var i=0; i<elements.length; i++) + new HoverElement(elements[i], className, activators[pseudo]); + } + +function HoverElement(node, className, events) { + if(!node.hovers) node.hovers = {}; + if(node.hovers[className]) return; + node.hovers[className] = true; + hookHoverEvent(node, events.on, function() { node.className += ' ' + className; }); + hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); }); +} + function hookHoverEvent(node, type, handler) { + node.attachEvent(type, handler); + hoverEvents[hoverEvents.length] = { + node:node, type:type, handler:handler + }; + } + + function unhookHoverEvents() { + for(var e,i=0; i<hoverEvents.length; i++) { + e = hoverEvents[i]; + e.node.detachEvent(e.type, e.handler); + } + } + +function getElementsBySelect(rule) { + var parts, nodes = [doc]; + parts = rule.split(' '); + for(var i=0; i<parts.length; i++) { + nodes = getSelectedNodes(parts[i], nodes); + } return nodes; +} + function getSelectedNodes(select, elements) { + var result, node, nodes = []; + var identify = (/\#([a-z0-9_-]+)/i).exec(select); + if(identify) return [doc.getElementById(identify[1])]; + + var classname = (/\.([a-z0-9_-]+)/i).exec(select); + var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, ''); + var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false; + for(var i=0; i<elements.length; i++) { + result = tagName? elements[i].all.tags(tagName):elements[i].all; + for(var j=0; j<result.length; j++) { + node = result[j]; + if(classReg && !classReg.test(node.className)) continue; + nodes[nodes.length] = node; + } + } return nodes; + } +</script> \ No newline at end of file Modified: trunk/linpha2/templates/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/css/global.css 2006-03-29 14:29:25 UTC (rev 4452) +++ trunk/linpha2/templates/default/css/global.css 2006-03-29 16:35:34 UTC (rev 4453) @@ -23,42 +23,29 @@ /** * title */ - #divtitle { + #title + { margin-top: 10px; margin-bottom: 20px; - height: 40px; - } - #title { - /* background-color: #d5fcf4;*/ - /* border: 1px solid #0c9;*/ + margin-left: 100px; - position: absolute; - left: 50%; - width: 600px; - height: 40px; - margin-left: -300px; /* should be the half of 'width' */ - white-space: nowrap; - - /* padding: 0;*/ - /* margin: 10px 10px 10px 10px;*/ - font-size: 25pt; } - #title a:link, #title a:visited, #title a:hover { + #title a:link, #title a:visited, #title a:hover + { color: #444444; text-decoration: none; } - #title a:hover { + #title a:hover + { text-decoration: underline; } /** * left */ - #left { - /* background-color: #ffd5ee;*/ - /* border: 1px solid #f09;*/ - + #left + { position: absolute; top: 160px; left: 10px; @@ -73,9 +60,8 @@ /** * navigation */ - #navigation { - /* background-color: #d5fcf4;*/ - /* border: 1px solid #0c9;*/ + #navigation + { padding: 0; margin: 10px 10px 10px 10px; } @@ -97,15 +83,11 @@ * menu */ #divmenu { - height: 30px; + height: 40px; } #menu { - position: absolute; - left: 50%; - width: 800px; - height: 40px; - margin-left: -400px; /* half of 'width' */ + margin-left: 50px; } /** Modified: trunk/linpha2/templates/default/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/css/view_img.css 2006-03-29 14:29:25 UTC (rev 4452) +++ trunk/linpha2/templates/default/css/view_img.css 2006-03-29 16:35:34 UTC (rev 4453) @@ -45,7 +45,6 @@ text-align: center; font-size: 0.5em; - } .div_all_prevthumb { Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-03-29 14:29:25 UTC (rev 4452) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-03-29 16:35:34 UTC (rev 4453) @@ -1,13 +1,14 @@ #main { - min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ +/* min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ } /** * need this to calculate heigh of main div * if you're gettings scrollbars, adjust the height! + * height: 12.52em; dosent work, it increases to much if we adjust browsers font-size */ #spacer_height { - height: 200px; + height: 208px; position: absolute; visibility: hidden; } Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-03-29 14:29:25 UTC (rev 4452) +++ trunk/linpha2/templates/default/global.html.php 2006-03-29 16:35:34 UTC (rev 4453) @@ -12,6 +12,29 @@ <!-- css includes --> <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/global.css'; ?>' type='text/css'> <link rel='stylesheet' href='<?php $GLOBALS['linpha']->template->includeFile('css'); ?>' type='text/css'> + <!-- IE hack for the menu--> + <!--[if IE]> + <style type="text/css" media="screen"> + #menu a, #menu span + { + width: 50px; + } + </style> + <![endif]--> + <!--[if lt IE 7]> + <style type="text/css" media="screen"> + body { + behavior: url(templates/default/css/csshover.htc); + font-size: 100%; + } + + #menu ul li a {height: 1%;} + + #menu a, #menu span { + font: bold 0.7em/1.4em arial, helvetica, sans-serif; + } + </style> + <![endif]--> <?php if( isset($GLOBALS['linpha']->template->output['sys_log'])) { ?> <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/syslog.css'; ?>' type='text/css'> @@ -37,11 +60,9 @@ <?php } ?> <!-- title/navigation --> -<div id="divtitle"> <div id="title"> <?php echo $GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']; ?> </div> -</div> <!-- menu --> <!-- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-29 16:52:46
|
Revision: 4454 Author: fangehrn Date: 2006-03-29 08:52:29 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4454&view=rev Log Message: ----------- * updated installer script, but not yet tested @todo db_data.sql -> sql.data.php Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php Removed Paths: ------------- trunk/linpha2/db_mysql.sql trunk/linpha2/db_pgsql.sql Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-29 16:35:34 UTC (rev 4453) +++ trunk/linpha2/ChangeLog 2006-03-29 16:52:29 UTC (rev 4454) @@ -4,6 +4,8 @@ makes things a lot easier, and looks nice * added ie hack for the menu, all should work now, but it will never look that nice + * updated installer script, but not yet tested + @todo db_data.sql -> sql.data.php 2006-03-26 flo * applying bastian's theme Deleted: trunk/linpha2/db_mysql.sql =================================================================== --- trunk/linpha2/db_mysql.sql 2006-03-29 16:35:34 UTC (rev 4453) +++ trunk/linpha2/db_mysql.sql 2006-03-29 16:52:29 UTC (rev 4454) @@ -1,165 +0,0 @@ --- phpMyAdmin SQL Dump --- version 2.7.0-pl1 --- http://www.phpmyadmin.net --- --- Host: localhost --- Erstellungszeit: 21. Februar 2006 um 21:26 --- Server Version: 4.1.14 --- PHP-Version: 5.0.5-pl5-gentoo --- --- Datenbank: `eclipse` --- - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_config` --- - -use linpha2; - -DROP TABLE IF EXISTS `linpha_config`; -CREATE TABLE `linpha_config` ( - `ID` smallint(5) unsigned NOT NULL auto_increment, - `option_name` varchar(50) NOT NULL default '', - `option_value` varchar(100) NOT NULL default '', - `userid` mediumint(8) unsigned default '0', - PRIMARY KEY (`ID`), - UNIQUE KEY `option_name_2` (`option_name`), - KEY `option_name` (`option_name`), - KEY `option_value` (`option_value`) -); - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_groups` --- - -DROP TABLE IF EXISTS `linpha_groups`; -CREATE TABLE `linpha_groups` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - PRIMARY KEY (`id`) -); - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_permissions` --- - -DROP TABLE IF EXISTS `linpha_permissions`; -CREATE TABLE `linpha_permissions` ( - `id` int(11) NOT NULL auto_increment, - `photos_id` int(11) NOT NULL default '0', - `perm_type` varchar(255) NOT NULL default '0', - `permission` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`) -); - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_photos` --- - -DROP TABLE IF EXISTS `linpha_photos`; -CREATE TABLE `linpha_photos` ( - `id` int(11) NOT NULL auto_increment, - `parent_id` int(11) NOT NULL default '0', - `img_type` int(11) NOT NULL default '0', - `name` text NOT NULL, - `md5sum` varchar(40) NOT NULL default '', - `time_add` int(11) NOT NULL default '0', - `time_mod` int(11) NOT NULL default '0', - `time_exif` int(11) NOT NULL default '0', - `stats_numbers` int(11) NOT NULL default '0', - `stats_views` int(11) NOT NULL default '0', - `stats_downloads` int(11) NOT NULL default '0', - PRIMARY KEY (`id`) -); - - -DROP TABLE IF EXISTS `linpha_meta_fields`; -CREATE TABLE IF NOT EXISTS linpha_meta_fields ( - id int(11) NOT NULL auto_increment, - name varchar(255) NOT NULL default '', - field_type int(11) NOT NULL default '0', - flags int(11) NOT NULL default '0', - PRIMARY KEY (id) -); - - -DROP TABLE IF EXISTS `linpha_meta_category`; -CREATE TABLE linpha_meta_category ( - id int(11) NOT NULL auto_increment, - field_id int(11) NOT NULL default '0', - name varchar(255) NOT NULL default '', - isprivate int(11) default NULL, - PRIMARY KEY (id) -); - --- --- Tabellenstruktur f?r Tabelle `linpha_meta_exif` --- - -DROP TABLE IF EXISTS linpha_meta_exif; -CREATE TABLE IF NOT EXISTS linpha_meta_exif ( - md5sum varchar(32) NOT NULL default '', - datetimeoriginal varchar(255) default NULL, - make varchar(255) default NULL, - model varchar(255) default NULL, - artist varchar(255) default NULL, - copyright varchar(255) default NULL, - aperturevalue varchar(255) default NULL, - shutterspeedvalue varchar(255) default NULL, - exposuretime varchar(255) default NULL, - isospeedratings varchar(255) default NULL, - flash varchar(255) default NULL, - focallength varchar(255) default NULL, - fnumber varchar(255) default NULL, - PRIMARY KEY (md5sum), - KEY md5sum (md5sum) -); - --- --- Tabellenstruktur f?r Tabelle `linpha_meta_iptc` --- - -DROP TABLE IF EXISTS linpha_meta_iptc; -CREATE TABLE IF NOT EXISTS linpha_meta_iptc ( - md5sum varchar(32) NOT NULL default '', - PRIMARY KEY (md5sum), - KEY md5sum (md5sum) -); - - - --- --- Tabellenstruktur f?r Tabelle `linpha_meta_comments` --- - -DROP TABLE IF EXISTS linpha_meta_comments; -CREATE TABLE IF NOT EXISTS linpha_meta_comments ( - id int(11) NOT NULL auto_increment, - `time` int(11) NOT NULL default '0', - md5sum varchar(32) NOT NULL default '', - author varchar(255) NOT NULL default '', - `comment` text NOT NULL, - PRIMARY KEY (id) -); - - --- --- Tabellenstruktur f?r Tabelle `linpha_meta_data` --- - -DROP TABLE IF EXISTS linpha_meta_data; -CREATE TABLE IF NOT EXISTS linpha_meta_data ( - id int(11) NOT NULL auto_increment, - field_id int(11) NOT NULL default '0', - md5sum varchar(32) NOT NULL default '', - meta_data varchar(255) NOT NULL default '', - PRIMARY KEY (id) -); \ No newline at end of file Deleted: trunk/linpha2/db_pgsql.sql =================================================================== --- trunk/linpha2/db_pgsql.sql 2006-03-29 16:35:34 UTC (rev 4453) +++ trunk/linpha2/db_pgsql.sql 2006-03-29 16:52:29 UTC (rev 4454) @@ -1,79 +0,0 @@ --- phpMyAdmin SQL Dump --- version 2.7.0-pl1 --- http://www.phpmyadmin.net --- --- Host: localhost --- Erstellungszeit: 21. Februar 2006 um 21:28 --- Server Version: 4.1.14 --- PHP-Version: 5.0.5-pl5-gentoo --- --- Datenbank: `eclipse` --- - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_config` --- - -DROP TABLE IF EXISTS `linpha_config`; -CREATE TABLE "linpha_config" ( - "ID" smallint(5) unsigned NOT NULL, - "option_name" varchar(50) NOT NULL default '', - "option_value" varchar(100) NOT NULL default '', - "userid" mediumint(8) unsigned default '0', - PRIMARY KEY ("ID"), - UNIQUE KEY "option_name_2" ("option_name"), - KEY "option_name" ("option_name"), - KEY "option_value" ("option_value") -); - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_groups` --- - -DROP TABLE IF EXISTS `linpha_groups`; -CREATE TABLE "linpha_groups" ( - "id" int(11) NOT NULL, - "name" varchar(100) NOT NULL default '', - PRIMARY KEY ("id") -); - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_permissions` --- - -DROP TABLE IF EXISTS `linpha_permissions`; -CREATE TABLE "linpha_permissions" ( - "id" int(11) NOT NULL, - "photos_id" int(11) NOT NULL default '0', - "perm_type" varchar(255) NOT NULL default '0', - "permission" varchar(255) NOT NULL default '', - PRIMARY KEY ("id") -); - --- -------------------------------------------------------- - --- --- Tabellenstruktur f?r Tabelle `linpha_photos` --- - -DROP TABLE IF EXISTS `linpha_photos`; -CREATE TABLE "linpha_photos" ( - "id" int(11) NOT NULL, - "parent_id" int(11) NOT NULL default '0', - "img_type" int(11) NOT NULL default '0', - "name" text NOT NULL, - "md5sum" varchar(40) NOT NULL default '', - "time_add" int(11) NOT NULL default '0', - "time_mod" int(11) NOT NULL default '0', - "time_exif" int(11) NOT NULL default '0', - "stats_numbers" int(11) NOT NULL default '0', - "stats_views" int(11) NOT NULL default '0', - "stats_downloads" int(11) NOT NULL default '0', - PRIMARY KEY ("id") -); Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-03-29 16:35:34 UTC (rev 4453) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-03-29 16:52:29 UTC (rev 4454) @@ -23,231 +23,91 @@ $sql_tables = array( "CREATE TABLE ".$linpha_tables['config']." ( ". - "ID smallint unsigned not null auto_increment, ". - "option_name varchar(50) not null, ". - "option_value varchar(100) not null, ". - "userid mediumint unsigned default 0, ". - "PRIMARY KEY(ID), ". - "KEY(option_name), ". - "KEY(option_value), ". - "UNIQUE(option_name) ". + "`id` smallint(5) unsigned NOT NULL auto_increment, " . + "`option_name` varchar(50) NOT NULL default '', " . + "`option_value` varchar(100) NOT NULL default '', " . + "`userid` mediumint(8) unsigned default '0', " . + "PRIMARY KEY (`id`), " . + "UNIQUE KEY `option_name_2` (`option_name`), " . + "KEY `option_name` (`option_name`), " . + "KEY `option_value` (`option_value`) " . ")", - - "CREATE TABLE ".$linpha_tables['users']." ( ". - "ID mediumint unsigned not null auto_increment, ". - "nickname varchar(20) not null, ". - "password varchar(32) not null, ". - "email varchar(255), ". - "lang varchar(100) default 'English', ". - "level tinyint unsigned, ". - "groups varchar(255), ". - "fullname varchar(50), ". - "PRIMARY KEY(ID) ". - ")", - - "CREATE TABLE ".$linpha_tables['first_lev_album']." ( ". - "ID smallint unsigned not null auto_increment, ". - "date timestamp, ". - "path varchar(255) not null, ". - "name varchar(255) not null, ". - "level tinyint unsigned, ". - "groups varchar(255) DEFAULT ';public;', ". - "photos SMALLINT, ". - "PRIMARY KEY(ID) ". - ")", - - "CREATE TABLE ".$linpha_tables['sec_lev_album']." ( " . - "ID smallint unsigned not null auto_increment, ". - "date timestamp, ". - "path varchar(255) not null, ". - "name varchar(255) not null, ". - "prev_alb_name varchar(255) not null, ". - "level tinyint unsigned, ". - "res varchar(64), ". - "res1 varchar(64), ". - "PRIMARY KEY(ID), ". - "KEY (prev_alb_name) ". - ")", - - "CREATE TABLE ".$linpha_tables['third_lev_album']." ( ". - "ID smallint unsigned not null auto_increment, ". - "date timestamp, ". - "path varchar(255) not null, ". - "name varchar(255) not null, ". - "prev_alb_name varchar(255) not null, ". - "level tinyint unsigned, ". - "res varchar(64), ". - "res1 varchar(64), ". - "PRIMARY KEY(ID), ". - "KEY (prev_alb_name) ". - ")", - - "CREATE TABLE ".$linpha_tables['photos']." ( " . - "ID int unsigned not null auto_increment, ". - "date timestamp, ". - "name varchar(255), ". - "filename varchar(255) not null, ". - "thumbnail mediumblob, ". - "prev_path varchar(255), ". - "level tinyint unsigned, ". - "res INT(5) DEFAULT 0 NOT NULL, ". - "md5sum varchar(40), ". - "downloads mediumint, ". - "fmkey_location varchar(100), ". - "fmkey_type varchar(100), ". - "fmkey_date varchar(100), ". - "PRIMARY KEY(ID), ". - "KEY (date), ". - "KEY (name), ". - "KEY (filename), ". - "KEY (res), ". - "KEY (md5sum), ". - "KEY (prev_path) ". - ")", - - "CREATE TABLE ".$linpha_tables['photo_cache']." ( ". - "filename VARCHAR(255) NOT NULL, ". - "photo_id INT UNSIGNED NOT NULL, ". - "date DATETIME NOT NULL, ". - "used TIMESTAMP, ". - "hits MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL, ". - "size INT UNSIGNED DEFAULT '0' NOT NULL, ". - "convert_time FLOAT DEFAULT '0.0' NOT NULL, ". - "PRIMARY KEY (filename), ". - "KEY (filename) ". - ")", - - "CREATE TABLE ".$linpha_tables['category']." ( " . - "ID smallint unsigned not null auto_increment, ". - "name varchar(255) not null, ". - "isprivate SMALLINT(1), ". - "PRIMARY KEY(ID) ". - ")", - - "CREATE TABLE ".$linpha_tables['counter_stats']." ( ". - "ID int unsigned not null auto_increment, ". - "date timestamp, ". - "ip varchar(32), ". - "res mediumint unsigned, ". - "PRIMARY KEY(ID) ". - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "ID SMALLINT(3) NOT NULL AUTO_INCREMENT, ". - "groups VARCHAR(15) NOT NULL, ". - "res VARCHAR(20) NOT NULL, ". - "PRIMARY KEY ( ID ) ". + "`id` int(11) NOT NULL auto_increment, " . + "`name` varchar(100) NOT NULL default '', " . + "PRIMARY KEY (`id`) " . ")", - - "CREATE TABLE ".$linpha_tables['image_comments']." ( ". - "ID INT NOT NULL AUTO_INCREMENT, ". - "date TIMESTAMP, ". - "md5sum VARCHAR(40), ". - "author VARCHAR(20), ". - "comment TEXT, ". - "description VARCHAR(255), ". - "category VARCHAR(255), ". - "PRIMARY KEY ( ID ), ". - "KEY (md5sum) ". + "CREATE TABLE ".$linpha_tables['permissions']." ( ". + "`id` int(11) NOT NULL auto_increment, " . + "`photos_id` int(11) NOT NULL default '0', " . + "`perm_type` varchar(255) NOT NULL default '0', " . + "`permission` varchar(255) NOT NULL default '', " . + "PRIMARY KEY (`id`) " . ")", - - "CREATE TABLE ".$linpha_tables['album_comments']." ( ". - "ID INT NOT NULL AUTO_INCREMENT, ". - "date TIMESTAMP, ". - "album VARCHAR(255), ". - "author VARCHAR(20), ". - "comment TEXT, ". - "PRIMARY KEY (ID) ". + "CREATE TABLE ".$linpha_tables['photos']." ( ". + "`id` int(11) NOT NULL auto_increment, " . + "`parent_id` int(11) NOT NULL default '0', " . + "`img_type` int(11) NOT NULL default '0', " . + "`name` text NOT NULL, " . + "`md5sum` varchar(40) NOT NULL default '', " . + "`time_add` int(11) NOT NULL default '0', " . + "`time_mod` int(11) NOT NULL default '0', " . + "`time_exif` int(11) NOT NULL default '0', " . + "`stats_numbers` int(11) NOT NULL default '0', " . + "`stats_views` int(11) NOT NULL default '0', " . + "`stats_downloads` int(11) NOT NULL default '0', " . + "PRIMARY KEY (`id`) " . ")", - - "CREATE TABLE ".$linpha_tables['plugins']." ( ". - "ID INT NOT NULL AUTO_INCREMENT, ". - "name VARCHAR(255), ". - "active SMALLINT(1) DEFAULT '0' NOT NULL, ". - "PRIMARY KEY ( ID ) ". + "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". + "id int(11) NOT NULL auto_increment, " . + "name varchar(255) NOT NULL default '', " . + "field_type int(11) NOT NULL default '0', " . + "flags int(11) NOT NULL default '0', " . + "PRIMARY KEY (id) " . ")", - - "CREATE TABLE ".$linpha_tables['guestbook']." ( ". - "id INT (5) UNSIGNED not null AUTO_INCREMENT, ". - "name VARCHAR (50), ". - "email VARCHAR (50), ". - "country VARCHAR (50), ". - "url VARCHAR (150), ". - "comment TEXT not null, ". - "date INT (11), ". - "PRIMARY KEY (id) ". + "CREATE TABLE ".$linpha_tables['meta_category']." ( ". + "id int(11) NOT NULL auto_increment, " . + "field_id int(11) NOT NULL default '0', " . + "name varchar(255) NOT NULL default '', " . + "isprivate int(11) default NULL, " . + "PRIMARY KEY (id) " . ")", - - "CREATE TABLE ".$linpha_tables['mail_list']." ( ". - "ID int(25) NOT NULL auto_increment, ". - "name varchar(100) NOT NULL default '', ". - "email varchar(100) NOT NULL default '', ". - "date int(14) NOT NULL default '0', ". - "active tinyint(1) NOT NULL default '0', ". - "PRIMARY KEY (ID) ". + "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". + "md5sum varchar(32) NOT NULL default '', " . + "datetimeoriginal varchar(255) default NULL, " . + "make varchar(255) default NULL, " . + "model varchar(255) default NULL, " . + "artist varchar(255) default NULL, " . + "copyright varchar(255) default NULL, " . + "aperturevalue varchar(255) default NULL, " . + "shutterspeedvalue varchar(255) default NULL, " . + "exposuretime varchar(255) default NULL, " . + "isospeedratings varchar(255) default NULL, " . + "flash varchar(255) default NULL, " . + "focallength varchar(255) default NULL, " . + "fnumber varchar(255) default NULL, " . + "PRIMARY KEY (md5sum), " . + "KEY md5sum (md5sum) " . ")", - - "CREATE TABLE ".$linpha_tables['permissions']." (". - "id int(11) NOT NULL auto_increment, ". - "type varchar(255) NOT NULL, ". - "who int(1) NOT NULL default '0', ". - "groups_exceptions varchar(255) NOT NULL default '', ". - "groups_additional varchar(255) NOT NULL default '', ". - "and_or int(1) NOT NULL default '0', ". - "alb int(1) NOT NULL default '0', ". - "albums text NOT NULL, ". - "PRIMARY KEY (id) ". - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR(32) NOT NULL, ". - - // caption fields - "caption VARCHAR(255) NOT NULL, ". - "caption_writer VARCHAR(255) NOT NULL, ". - "headline VARCHAR(255) NOT NULL, ". - "instructions VARCHAR(255) NOT NULL, ". - - // keywords fields - "keywords VARCHAR(255) NOT NULL, ". - - // categories fields - "category VARCHAR(3) NOT NULL, ". - "supplemental_categorie VARCHAR(255) NOT NULL, ". - - //credits fields - "copyright VARCHAR(255) NOT NULL, ". - "byline VARCHAR(255) NOT NULL, " . - "byline_title VARCHAR(255) NOT NULL, ". - "credit VARCHAR(255) NOT NULL, ". - "source VARCHAR(255) NOT NULL, ". - - //status fields - "edit_status VARCHAR(255) NOT NULL, ". - "priority VARCHAR(255) NOT NULL, ". - "object_cycle VARCHAR(255) NOT NULL, ". - "job_id VARCHAR(255) NOT NULL, ". - "program VARCHAR(255) NOT NULL, ". - - // origin fields - "object_name VARCHAR(255) NOT NULL, ". - "date_created VARCHAR(255) NOT NULL, " . - "date_released VARCHAR(255) NOT NULL, ". - "time_created VARCHAR(255) NOT NULL, ". - "time_released VARCHAR(255) NOT NULL, ". - "city VARCHAR(255) NOT NULL, ". - "sublocation VARCHAR(255) NOT NULL, ". - "state VARCHAR(255) NOT NULL, ". - "country VARCHAR(255) NOT NULL, ". - "country_code VARCHAR(5) NOT NULL, ". - "trans_reference VARCHAR(255) NOT NULL, ". - "marked_ignored INT(1), ". - "PRIMARY KEY (md5sum) ". - ")", - - "CREATE TABLE ".$linpha_tables['blacklist']." ( ". - "action VARCHAR(20), ". - "value TEXT". + "md5sum varchar(32) NOT NULL default '', " . + "PRIMARY KEY (md5sum), " . + "KEY md5sum (md5sum) " . + ")", + "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". + "id int(11) NOT NULL auto_increment, " . + "`time` int(11) NOT NULL default '0', " . + "md5sum varchar(32) NOT NULL default '', " . + "author varchar(255) NOT NULL default '', " . + "`comment` text NOT NULL, " . + " PRIMARY KEY (id) " . + ")", + "CREATE TABLE ".$linpha_tables['meta_data']." ( ". + "id int(11) NOT NULL auto_increment, " . + "field_id int(11) NOT NULL default '0', " . + "md5sum varchar(32) NOT NULL default '', " . + "meta_data varchar(255) NOT NULL default '', " . + "PRIMARY KEY (id) " . ")" ); Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-03-29 16:35:34 UTC (rev 4453) +++ trunk/linpha2/install/sql/sql.tables.php 2006-03-29 16:52:29 UTC (rev 4454) @@ -23,6 +23,19 @@ $linpha_tables = Array( "config" => "config", + "groups" => "groups", + "permissions" => "permissions", + "photos" => "photos", + "meta_fields" => "meta_fields", + "meta_category" => "meta_category", + "meta_exif" => "meta_exif", + "meta_iptc" => "meta_iptc", + "meta_comments" => "meta_data" +); + +/* +$linpha_tables = Array( + "config" => "config", "users" => "users", "first_lev_album" => "first_lev_album", "sec_lev_album" => "sec_lev_album", @@ -41,6 +54,6 @@ "permissions" => "permissions", "blacklist" => "blacklist", "meta_exif" => "meta_exif" -); +);*/ ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-03-29 16:54:03
|
Revision: 4455 Author: bzrudi Date: 2006-03-29 08:53:38 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4455&view=rev Log Message: ----------- added some phpdoc tags and minor code cleanups Modified Paths: -------------- trunk/linpha2/get_thumb.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/lang/language.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.search.php Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/get_thumb.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,4 +1,28 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Thumb view related methods and functions + * @package Image + */ + if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -20,6 +20,7 @@ /** * This class holds a number of methods for filesys related access + * @package Filesystem */ Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -19,6 +19,11 @@ */ /** + * Just a couple of useful functions + * @package Functions + */ + +/** * Take care of translation * * This simple method takes care of all translation related stuff. Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -21,6 +21,7 @@ /** * This class takes care of image and file identifying due * a couple of possible methods + * @package Image */ class LinIdentify Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -20,6 +20,7 @@ /** * This class provides a couple methods for image manipulation/creation + * @package Image */ class LinImage Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -20,6 +20,7 @@ /** * This class takes care of all different views (thumb view, menus...) + * @package Image */ if(!defined('LINPHA_DIR')) { exit(1); } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -20,8 +20,9 @@ /** * This class takes automagic care of added/deleted images and albums + * @package Image */ -class linImport +class LinImport { /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,11 +1,8 @@ <?php -/** - * This class handles all the EXIF and IPTC stuff used in LinPHA - */ - /* -* Copyright (c) 2002-2005 Heiko Rutenbeck <bz...@tu...> -* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -21,6 +18,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/** + * This class handles all the EXIF and IPTC stuff used in LinPHA + * @package Metadata + */ + if(!defined('LINPHA_DIR')) { exit(1); } class MetaData { Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,7 +1,8 @@ <?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* +* Florian Angehrn +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -17,8 +18,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/** + * This class holds database related methods + * @package Database + */ -class linSql +class LinSql { public $passed; public $config; // sub class $linpha->sql->config @@ -26,7 +31,7 @@ /** * constructor */ -function linSql() +function __construct() { } @@ -401,7 +406,7 @@ * * read all config values in $linpha->sql->config->* */ -function linSqlConfig() +function LinSqlConfig() { $this->reloadConfig(); } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,6 +1,28 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ -class linTemplate +/** + * This class takes care of LinPHAs template layouts + * @package Template + */ +class LinTemplate { public $template_name; public $output; Modified: trunk/linpha2/lib/lang/language.php =================================================================== --- trunk/linpha2/lib/lang/language.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/lang/language.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,7 +1,8 @@ <?php /* -* Copyright (c) 2006 Heiko Rutenbeck <bz...@tu...> -* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -16,6 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/** + * This file takes care of all translation related things. + * Like updates for language files, listing of all currently used phrases and + * the option to let users create new files via webinterface. + * @todo take care of removed entries + * @package Translation + */ + if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } print_xhtml_header(); Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/modules/module.albums.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,4 +1,27 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Albums view related methods and functions + * @package Template + */ if(!defined('LINPHA_DIR')) { exit(1); } /** Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/modules/module.basket.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,4 +1,27 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Basket view related methods and functions + * @package Template + */ if(!defined('LINPHA_DIR')) { exit(1); } /** Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/modules/module.browse.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -1,4 +1,27 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Navigation view related methods and functions + * @package Template + */ if(!defined('LINPHA_DIR')) { exit(1); } /** Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-03-29 16:52:29 UTC (rev 4454) +++ trunk/linpha2/lib/modules/module.search.php 2006-03-29 16:53:38 UTC (rev 4455) @@ -0,0 +1,26 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Albums view related methods and functions + * @package Template + */ + ?> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-30 17:31:10
|
Revision: 4456 Author: fangehrn Date: 2006-03-30 09:30:49 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4456&view=rev Log Message: ----------- * fixing some errors in browse by date view (we got an endless loop if meta_exif is empty) rudi: maybe that solves your problem.. Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/templates/default/home.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-29 16:53:38 UTC (rev 4455) +++ trunk/linpha2/ChangeLog 2006-03-30 17:30:49 UTC (rev 4456) @@ -1,3 +1,8 @@ +2006-03-30 flo + * fixing some errors in browse by date view + (we got an endless loop if meta_exif is empty) + rudi: maybe that solves your problem.. + 2006-03-29 flo * rearanged templates * thumbnails are now cropped -> they are all squares now Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-29 16:53:38 UTC (rev 4455) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-30 17:30:49 UTC (rev 4456) @@ -584,25 +584,28 @@ */ function setBrowseByDate() { + $GLOBALS['linpha']->template->output['browse_by_date'] = ''; + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . "FROM ".PREFIX."meta_exif"); - - /** - * get min and max year - */ - $min_year = substr($data[0],0,4); - $max_year = substr($data[1],0,4); - - /** - * get years between - */ - $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - for($i = $min_year; $i <= $max_year; $i++) + if(isset($data[0]) && isset($data[1]) && !empty($data[0]) && !empty($data[1]) ) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + /** + * get min and max year + */ + $min_year = substr($data[0],0,4); + $max_year = substr($data[1],0,4); + + /** + * get years between + */ + for($i = $min_year; $i <= $max_year; $i++) { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data[0]>0) + { + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } } } } Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-03-29 16:53:38 UTC (rev 4455) +++ trunk/linpha2/templates/default/home.html.php 2006-03-30 17:30:49 UTC (rev 4456) @@ -29,8 +29,12 @@ <hr /> <?php } ?> -<?php echo i18n("Browse by Date").': '.$GLOBALS['linpha']->template->output['browse_by_date']; ?><br /> -<hr /> +<?php +if(!empty($GLOBALS['linpha']->template->output['browse_by_date'])) { + echo i18n("Browse by Date").': '.$GLOBALS['linpha']->template->output['browse_by_date']; + echo "<br /><hr />"; +} +?> <h1><?php echo i18n("Albums"); ?></h1> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-03-31 08:08:04
|
Revision: 4458 Author: bzrudi Date: 2006-03-31 00:07:40 -0800 (Fri, 31 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4458&view=rev Log Message: ----------- at least mysql installation should work now (automatic mode only) - made i18n ready using tr() Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/header.php trunk/linpha2/install/header_html.php trunk/linpha2/install/index.php trunk/linpha2/install/lang/lang.English.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step1_license.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/ChangeLog 2006-03-31 08:07:40 UTC (rev 4458) @@ -1,3 +1,8 @@ +2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> + * Installer: + + at least mysql installation should work now (automatic mode only) + + made i18n ready using tr() + 2006-03-30 flo * fixing some errors in browse by date view (we got an endless loop if meta_exif is empty) Modified: trunk/linpha2/install/header.php =================================================================== --- trunk/linpha2/install/header.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/header.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -96,17 +96,17 @@ ); $title_str[0] = "Welcome"; -$title_str[1] = "Accept the GNU License"; -$title_str[2] = "Checking the requirements"; -$title_str[3] = "Select the database type"; -$title_str[4] = "Select directories"; -$title_str[5] = "Entering SQL login information"; -$title_str[6] = "Selecting database"; -$title_str[7] = "Select prefix"; -$title_str[8] = "Testing"; -$title_str[9] = "Creating tables"; -$title_str[10] = "Post settings"; -$title_str[11] = "Finish installation"; +$title_str[1] = "Accept GPL"; +$title_str[2] = "Requirements Check"; +$title_str[3] = "Database Type"; +$title_str[4] = "Directories"; +$title_str[5] = "Database Login"; +$title_str[6] = "Select Database"; +$title_str[7] = "Select Prefix"; +$title_str[8] = "System Checks"; +$title_str[9] = "Database Tables"; +$title_str[10] = "Post Settings"; +$title_str[11] = "Finalizing"; if(! isset($is_special)) { Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/header_html.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -27,7 +27,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="de"> <head> -<title>LinPHA Web Installer - <?php echo $title_str[$key]; ?></title> +<title><?php echo tr("LinPHA Web Installer"); echo "-". $title_str[$key]; ?></title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="layout.css"> @@ -55,13 +55,13 @@ switch($i) { case 0: - echo "Welcome"; + echo tr("Welcome"); break; case $end: - echo "Finish"; + echo tr("Finish"); break; default: - echo "Step ".$i; + echo tr("$title_str[$i]"); break; } echo "</div>"; @@ -82,7 +82,7 @@ </div> <div class="rightside"> -<h1><?php echo $title_str[$key]; ?></h1> +<h1><?php echo tr("$title_str[$key]"); ?></h1> <br /> <?php Modified: trunk/linpha2/install/index.php =================================================================== --- trunk/linpha2/install/index.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/index.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -41,13 +41,14 @@ include_once(LINPHA_DIR."/install/header.php"); include_once(LINPHA_DIR."/install/header_html.php"); -?> -Welcome to the new LinPHA installer<br /> -<br /><br /> +echo tr("Welcome To LinPHA2 Installation"); -Select your preferred language:<br /> -<select name="language" size="1"> -<?php +echo "<br /><br /><br />"; + +echo tr("Please Select Your Preferred Language:"); + +echo "<br /><select name='language' size='1'>"; + $options = get_available_language_files(); foreach($options AS $value) { Modified: trunk/linpha2/install/lang/lang.English.php =================================================================== --- trunk/linpha2/install/lang/lang.English.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/lang/lang.English.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -10,11 +10,7 @@ $basedir_active_msg2="If possible, please unset \"open_basedir\" in PHP.ini"; $gd_jpg_missing_msg="Your System lacks jpeg support in GD Library!"; $inst_abort_msg="!!! INSTALLATION ABORTED !!!"; -$str_not_enabled_in_php_config="Not enabled in PHP config (php.ini)"; $str_make_dir_writable="Make the directory %s world writeable!"; -$choose_def_quali="Choose default quality of photos"; -$choose_def_quali_warn="Do NOT set to high quality if your CPU is < 1Ghz (heavy CPU load)"; -$inst_thumbsize_header="Choose thumbnail size"; Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/lib.install.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -17,7 +17,58 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/** + * Take care of translation + * + * This simple method takes care of all translation related stuff. + * If option tr_learn is set - all new entries will be autolearned. + * @param string $text phrase/word to translate + */ + function tr($text) + { + global $translate; + $tr_learn = false; //autolearn new language entries + + /** + * translation starts here + */ + if(true == isset($translate[$text])) + { + $str = "$translate[$text]"; + } + else + { + $str = "$text"; + } + /** + * autolearn new language entries defined by tr() function. + */ + if($tr_learn == true) + { + $tmpfile = LINPHA_DIR."/var/tmp/lang.install.temp.txt"; + + if(false == file_exists("$tmpfile")) + { + if(false == touch("$tmpfile")) + { + echo "Unable to create ".$tmpfile." - please check permissions"; + } + } + + $filedata = file("$tmpfile"); + + if(false == in_array($text."\n", $filedata)) + { + $filedata[] = $text."\n"; + natcasesort($filedata); // Sort an array using a case insensitive "natural order" algorithm + file_put_contents($tmpfile, $filedata); + } + } + + return $str; + +} // end tr() /** * don't know where to place this part * other.php is the only one which is also included during the installation @@ -198,9 +249,11 @@ ## language to use ##########################################################*/ - $http_accept_language = trim(@$_SERVER["HTTP_ACCEPT_LANGUAGE"]); + $http_accept_language = trim($_SERVER["HTTP_ACCEPT_LANGUAGE"]); // Accept-Language Header detail, see RFC2616 - $knownlangs = array( "dk" => "Danish", + $knownlangs = array( "" => "" ); + /* + "dk" => "Danish", "nl" => "Dutch", "en" => "English", "de" => "German", @@ -212,42 +265,49 @@ "co" => "Spanish", "fr" => "French", "no" => "Norwegian", - //"pt" => "BrazilianPortuguese", - //"br" => "BrazilianPortuguese", + "pt" => "BrazilianPortuguese", + "br" => "BrazilianPortuguese", "zh" => "zh-tw", "tw" => "zh-tw", "cz" => "Czech", "cs" => "Czech", "ro" => "Romanian", - //"cn" => "zh-cn", + "cn" => "zh-cn", "se" => "Swedish", "sv" => "Swedish", "ru" => "Russian" ); + */ +$accept_lang = 'English'; +$lastquality = 0.0; - $accept_lang = 'English'; - $lastquality = 0.0; +$langtag = '((?:[a-zA-Z]{1,8})(?:-[a-zA-Z]{1,8})*)'; +$qvalue ='(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3}))'; +$eachbit = '^' . $langtag . '(?:;q=' . $qvalue . ')?(?:,\s*)?(.*)$'; - $langtag = '((?:[a-zA-Z]{1,8})(?:-[a-zA-Z]{1,8})*)'; - $qvalue ='(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3}))'; - $eachbit = '^' . $langtag . '(?:;q=' . $qvalue . ')?(?:,\s*)?(.*)$'; +while(strlen($http_accept_language)) +{ + if(preg_match( "/$eachbit/", $http_accept_language, $m)) + { + $tag = $m[1]; + $quality = $m[2]; + + if(strlen($quality) == 0) $quality = 1; + $http_accept_language = $m[3]; - while (strlen($http_accept_language)) { - if (preg_match( "/$eachbit/", $http_accept_language, $m=array())) { - $tag = $m[1]; - $quality = $m[2]; - if (strlen($quality) == 0) $quality = 1; - $http_accept_language = $m[3]; + if(array_key_exists($tag, $knownlangs) && $quality > $lastquality) + { + $accept_lang = $knownlangs[$tag]; + $lastquality = $quality; + } + } + else + { + break; + } +} - if (array_key_exists($tag, $knownlangs) and $quality > $lastquality) { - $accept_lang = $knownlangs[$tag]; - $lastquality = $quality; - } - } else { - break; - } - } - return $accept_lang; +return $accept_lang; } /** Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/sql/sql.data.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -21,82 +21,27 @@ * linpha installer */ - - /** * config table */ $options = array( - 'db_version' => '1', - 'album_dir' => $_SESSION['album_dir'], - 'photo_width' => '512', - 'photo_height' => '384', - 'lang' => $_SESSION['language'], - 'autolang' => '1', - 'photos_row' => '3', - 'photos_col' => '4', - 'filenames' => '1', - 'autoconf' => '1', - 'counterstat' => '1', - 'exifinfo' => '1', - 'exif_level' => 'medium', - 'exif_default' => '0', - 'users' => '0', - 'ip_blocking' => '15', - 'gd_version' => $_SESSION['gd_version'], - 'use_convert' => $_SESSION['use_convert'], - 'convert_path' => $_SESSION['convert_path'], - 'sort_thumbs' => '0', - 'style' => 'aqua', - 'thumb_quality' => '0', - 'slideshow' => '1', - 'mini_img_preview' => 'default', - 'img_rotation' => '0', - 'img_quality' => '75', - 'photo_archive_title' => '', - 'thumb_size' => '120', - 'thumb_border' => '5', - 'thumb_border_color' => '#CCCCCC', - 'autologin' => '1', - 'timer' => '0', - 'gb_max_pages' => '8', - 'gb_anon_posts' => '1', - 'gb_posts_order' => 'DESC', - 'cache_path' => $_SESSION['cache_dir'], - 'cache_size' => '0', // 0 = unlimited, x = max cache size in bytes - 'alb_download_limit' => '0', - 'navigation_view' => '0', - 'mail_block_size' => '30', - 'mail_from_address' => 'noreply@'.$_SERVER["HTTP_HOST"].'', - 'show_comments_in_subfolder' => '1', - 'default_date_format' => "%a %m/%d/%Y", - 'default_time_format'=> "%I:%M:%S %p", - 'showNewImagesFolderDays' => '7', - 'showNewImagesFolder' => '1', - 'tmp_dir' => $_SESSION['tmp_dir'], - 'mail_mode_max_size' => (1024*1024*2), - 'adodb_caching' => '0', - 'adodb_cache_time' => '1440', - 'adodb_cache_path' => $_SESSION['tmp_dir'].'adocache', - 'random_index_image' => '0', - 'random_image_size' => '300', - 'log_email' => 'LinPHA Logger<log@'.$_SERVER["HTTP_HOST"].'>', - 'log_email_headers' => 'From:LinPHA Logger<noreply@'.$_SERVER["HTTP_HOST"].'>', - 'log_email_subject' => 'Linpha Log', - 'log_filename' => $_SESSION['tmp_dir'].'linpha.log', - 'log_method_db' => 'none', - 'log_method_filemanager' => 'none', - 'log_method_login' => 'none', - 'log_method_thumbnail' => 'none', - 'log_method_update' => 'none', - 'update_time' => time(), - 'update_notice' => '1', - 'iptcinfo' => '0', - 'iptc_level' => 'medium', - 'video_thumbnail' => '1', - 'blacklist_comments' => '1', - 'blacklist_guestbook' => '1', - 'im_bracket_support' => $_SESSION['im_bracket_support'] + 'sys_db_version' => '1', + 'sys_im_bracket_support' => $_SESSION['sys_im_bracket_support'], + 'sys_im_convert_path' => $_SESSION['sys_im_convert_path'], + 'sys_im_use_convert' => $_SESSION['sys_im_use_convert'], + 'sys_im_video_thumbnail' => '1', + 'sys_import_autoimport' => '1', + 'sys_image_exif' => '1', + 'sys_image_iptc' => '0', + 'sys_lang' => $_SESSION['language'], + 'sys_lang_autolang' => '1', + 'sys_path_album_dir' => $_SESSION['album_dir'], + 'sys_path_cache_dir' => $_SESSION['cache_dir'], + 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], + 'sys_style_img_quality' => '75', + 'sys_style_template' => 'default', + 'sys_style_tn_size' => '150', + 'sys_user_autologin' => '1' ); /** @@ -104,55 +49,54 @@ */ while( list($name, $value) = each($options) ) { - $sql_queries[] = "INSERT INTO ".PREFIX."config (option_name, option_value) VALUES ('".$name."', '".$value."')"; + $sql_queries[] = "INSERT INTO ".PREFIX."config (option_name, option_value, userid) " . + "VALUES ('".$name."', '".$value."', '0')"; } /** * groups */ -$sql_queries[] = "INSERT INTO ".PREFIX."groups (id, groups) VALUES (1, 'admin')"; // id must be 1 ! -$sql_queries[] = "INSERT INTO ".PREFIX."groups (id, groups) VALUES (2, 'friend')"; -$sql_queries[] = "INSERT INTO ".PREFIX."groups (id, groups) VALUES (3, 'uploader')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (name) VALUES ('group1')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (name) VALUES ('group2')"; /** - * blacklist + * permissions */ -$sql_queries[] = "INSERT INTO ".PREFIX."blacklist (action, value) VALUES ('comment','jack, casino, poker, betting, gambling, sex, blackjack, winning')"; -$sql_queries[] = "INSERT INTO ".PREFIX."blacklist (action, value) VALUES ('guestbook','jack, casino, poker, betting, gambling, sex, blackjack, winning')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (photos_id, perm_type, permission) " . + "VALUES (0, 'read', ';public;')"; - /** - * plugins - */ -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('sql')"; -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('benchmark')"; -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('watermark')"; -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('guestbook')"; -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('cache')"; -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('mail')"; -//$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('facetmap')"; -$sql_queries[] = "INSERT INTO ".PREFIX."plugins (name) VALUES ('log')"; + * metadata + */ +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (1, 'description', 1, 5)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (2, 'category', 2, 5)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (3, 'persons', 2, 5)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (4, 'date', 3, 5)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (6, 'filename', 0, 1)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (7, 'imagesize', 0, 1)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`id`, `name`, `field_type`, `flags`) VALUES (8, 'dimension', 0, 1)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('id_6', 0, 10)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('id_7', 0, 10)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('id_8', 0, 10)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('id_1', 0, 10)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('id_2', 0, 10)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('id_3', 0, 10)"; +$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(`name`, `field_type`, `flags`) VALUES ('exif_datetimeoriginal', 0, 10)"; -/** - * permissions - */ -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('watermark', '1', '', '', 0, 0, '')"; -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('download', '1', '', '', 0, 0, '')"; -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('img_comments', '1', '', '', 0, 0, '')"; -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('basket_print', '1', '', '', 0, 0, '')"; -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('basket_download', '1', '', '', 0, 0, '')"; -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('basket_mail', '1', '', '', 0, 0, '')"; -$sql_queries[] = "INSERT into ".PREFIX."permissions (type, who, groups_exceptions, groups_additional, and_or, alb, albums) VALUES ('img_description', '0', '', ';1;', 0, 0, '')"; +?> - -/** - * watermark - */ -include_once(LINPHA_DIR.'/lib/plugins/watermark/func.watermark.php'); -$arr_config = array_watermark(); -while(list($name,$value) = each($arr_config) ) -{ - $sql_queries[] = "INSERT INTO ".PREFIX."config (option_name, option_value) VALUES ('".$name."','".$value."')"; -} -?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -27,10 +27,7 @@ "`option_name` varchar(50) NOT NULL default '', " . "`option_value` varchar(100) NOT NULL default '', " . "`userid` mediumint(8) unsigned default '0', " . - "PRIMARY KEY (`id`), " . - "UNIQUE KEY `option_name_2` (`option_name`), " . - "KEY `option_name` (`option_name`), " . - "KEY `option_value` (`option_value`) " . + "PRIMARY KEY (`id`) " . ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". "`id` int(11) NOT NULL auto_increment, " . @@ -111,11 +108,14 @@ ")" ); + /** - * create dynamically the linpha_meta_exif table - */ + * @todo do we still need this part ? guess not!? + * create dynamically the linpha_meta_exif table + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); -$sql_tables[] = Metadata::createExifTable(); - -?> \ No newline at end of file +$objMetaData = new Metadata; +$sql_tables[] = $objMetaData->createExifTable(); + */ +?> Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/sql/sql.tables.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -30,30 +30,7 @@ "meta_category" => "meta_category", "meta_exif" => "meta_exif", "meta_iptc" => "meta_iptc", - "meta_comments" => "meta_data" + "meta_comments" => "meta_comments", + "meta_data" => "meta_data" ); - -/* -$linpha_tables = Array( - "config" => "config", - "users" => "users", - "first_lev_album" => "first_lev_album", - "sec_lev_album" => "sec_lev_album", - "third_lev_album" => "third_lev_album", - "photos" => "photos", - "photo_cache" => "photo_cache", - "category" => "category", - "counter_stats" => "counter_stats", - "groups" => "groups", - "image_comments" => "image_comments", - "album_comments" => "album_comments", - "plugins" => "plugins", - "guestbook" => "guestbook", - "mail_list" => "mail_list", - //"facetmap" => "facetmap", - "permissions" => "permissions", - "blacklist" => "blacklist", - "meta_exif" => "meta_exif" -);*/ - -?> \ No newline at end of file +?> Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step10_postsettings.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,8 +23,8 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } -include_once(LINPHA_DIR."/install/header.php"); -include_once(LINPHA_DIR."/install/lib.requirements.php"); +include_once(LINPHA_DIR.'/install/header.php'); +include_once(LINPHA_DIR.'/install/lib.requirements.php'); /** * now, it is too late to go back... @@ -40,14 +40,14 @@ } -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header_html.php'); -echo 'Connect to db using connection file... '; +echo tr("Connected To Database")."... "; unset($_SESSION['installmode1']); include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -$linpha = new linpha(); +$linpha = new Linpha(); $linpha->sql->dbConnect(); echo success_msg(); @@ -55,27 +55,38 @@ /** * add new linpha user */ -echo '<br /><br />'; -echo '<h2>Create your linpha admin user</h2>'; +echo "<br /><br />"; +echo "<h2>".tr("Setup Linpha Admin User").".</h2>"; ?> <div class="boxalign"> -Admin username: <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="admin_name" value="admin"> +<?php echo tr("Admin Username").":"; ?> +<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" + name="admin_name" value="admin"> </div> + <div class="boxalign"> -Admin password: <input class="boxalignelement" type="password" id="check02" onKeyup="checkForm()" name="admin_pass"> +<?php echo tr("Admin Password").":"; ?> +<input class="boxalignelement" type="password" id="check02" + onKeyup="checkForm()" name="admin_pass"> </div> + <div class="boxalign"> -Admin email: <input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" name="admin_email"> +<?php echo tr("Admin eMail").":"; ?> +<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" + name="admin_email"> </div> <br /> <br /> <?php -$query = $linpha->db->Execute("SELECT option_value FROM ".PREFIX."config WHERE option_name='use_convert'"); + +$query = $linpha->db->Execute("SELECT option_value FROM ".PREFIX."config " . + "WHERE option_name='sys_im_use_convert'"); $data = $query->FetchRow(); -if( !$data[0] && get_gd_version() == ">2" ) + +if(false === $data[0]) { - echo '<h2>'.$choose_def_quali.'</h2>'; + echo "<h2>".tr("Please Choose Thumbnail Quality")."</h2>"; ?> <div align="center"> <div class="box2"> @@ -89,31 +100,29 @@ </div> </div> <?php - echo $choose_def_quali_warn; + echo tr("Warning: High Quality Requires CPU > 1 GHz"); } - - ?> <br /><br /> <?php -echo '<h2>'.$inst_thumbsize_header.'</h2>'; +echo "<h2>".tr("Please Choose Default Thumbnail Size")."</h2>"; ?> <div align="center"> <div class="box3"> - <input type='radio' name='thumb_size' value='90'> + <input type='radio' name='sys_style_tn_size' value='90'> 90 pixel<br /> <img src='./graphics/thumb90px.jpg' /> </div> <div class="box3"> - <input type='radio' name='thumb_size' value='120' checked="checked"> + <input type='radio' name='sys_style_tn_size' value='120' checked="checked"> 120 pixel<br /> <img src='./graphics/thumb120px.jpg' /> </div> <div class="box3"> - <input type='radio' name='thumb_size' value='150'> + <input type='radio' name='sys_style_tn_size' value='150'> 150 pixel<br /> <img src='./graphics/thumb150px.jpg' /> </div> Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step11_finish.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -25,9 +25,9 @@ include_once(LINPHA_DIR."/install/header.php"); include_once(LINPHA_DIR."/install/header_html.php"); -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +include_once(LINPHA_DIR."/lib/classes/linpha.class.php"); -$linpha = new linpha(); +$linpha = new Linpha(); $linpha->sql->dbConnect(); /** @@ -45,32 +45,35 @@ if(isset($error_nr)) { - echo "Validate informations... "; + echo tr("Validating Information")."... "; echo failed_msg(); - echo "<br />You must fill out all fields"; + echo "<br />".tr("Please Fill In All Fields").""; echo "</form>"; $show_next_button = false; include_once("./footer.php"); exit(1); } - echo "Adding linpha admin user... "; - $result = $linpha->db->Execute("INSERT INTO ".PREFIX."users (nickname, password, email, lang, level, groups, fullname) " . - "VALUES('".$linpha->sql->linAddslashes($_POST['admin_name'])."','".md5($_POST['admin_pass'])."','".$linpha->sql->linAddslashes($_POST['admin_email'])."','',10, ';1;','')"); + /*echo "Adding linpha admin user... "; + //$result = $linpha->db->Execute("INSERT INTO ".PREFIX."users (nickname, password, email, lang, level, groups, fullname) " . + // "VALUES('".$linpha->sql->linAddslashes($_POST['admin_name'])."','".md5($_POST['admin_pass'])."','".$linpha->sql->linAddslashes($_POST['admin_email'])."','',10, ';1;','')"); if(!$result) { echo failed_msg(); } else { echo success_msg(); } + */ /** - * save thumbnails quality settings + * save thumbnails default size */ -if( isset( $_POST['quality'] ) ) +echo "<br />".tr("Saving Thumbnail Size To Database")."... "; +if( isset( $_POST['sys_style_tn_size'] ) ) { - echo "<br />Setting quality selection... "; - $result = $linpha->db->Execute("UPDATE ".PREFIX."config SET option_value = '".$linpha->sql->linAddslashes($_POST['quality'])."' WHERE option_name = 'thumb_quality'"); + $result = $linpha->db->Execute("UPDATE ".PREFIX."config " . + "SET option_value = '".$linpha->sql->linAddslashes($_POST['sys_style_tn_size'])."' " . + "WHERE option_name = 'sys_style_tn_size'"); if(!$result) { echo failed_msg(); @@ -78,25 +81,10 @@ echo success_msg(); } } - -/** - * save thumbnails quality settings - */ -echo "<br />Setting thumbnail size selection... "; -if( isset( $_POST['thumb_size'] ) ) -{ - $result = $linpha->db->Execute("UPDATE ".PREFIX."config SET option_value = '".$linpha->sql->linAddslashes($_POST['thumb_size'])."' WHERE option_name = 'thumb_size'"); - if(!$result) - { - echo failed_msg(); - } else { - echo success_msg(); - } -} else { echo failed_msg(); - echo '<br />No value specified!'; + echo "<br />".tr("Error - No Value Specified")."!"; $error_nr = 1; } @@ -107,10 +95,11 @@ exit(1); } + +echo "<br /><br /><hr /><br />"; +echo "<h2>".tr("Congratulations")."</h2><br />"; +echo tr("Installation Finished")."!"; ?> -<br /><br /><hr /><br /> -<h2>Congratulations</h2><br /> -Installation finished! <script language="JavaScript" type='text/javascript'> <!-- document.back_form.submit_button.disabled = true; Modified: trunk/linpha2/install/step1_license.php =================================================================== --- trunk/linpha2/install/step1_license.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step1_license.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,16 +23,16 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } -include_once(LINPHA_DIR."/install/header.php"); -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header.php'); +include_once(LINPHA_DIR.'/install/header_html.php'); + ?> <iframe src="gpl.html" class="license" frameborder="0" scrolling="auto"></iframe> - <br /> <input type="hidden" name="language" value="<?php echo isset($_POST['language']) ? $_POST['language'] : ''; ?>"> -<input type="checkbox" id="check01" onChange="checkForm()">I accept the GNU General Public License<br /> +<input type="checkbox" id="check01" onChange="checkForm()"> +<?php echo tr("Please Accept The GNU General Public License")."<br />"; -<?php $array_check = array('check01' => 'checkbox'); $do_javascript_disable_button = true; include_once("./footer.php"); Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step2_requirements.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,9 +23,9 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); -include_once(LINPHA_DIR."/install/lib.requirements.php"); -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header.php'); +include_once(LINPHA_DIR.'/install/lib.requirements.php'); +include_once(LINPHA_DIR.'/install/header_html.php'); ?> <script language="JavaScript" type='text/javascript'> @@ -68,14 +68,14 @@ */ print_line_left("PHP Version"); print_line_middle(PHP_VERSION); - if(version_compare(PHP_VERSION, "4.1.0", ">=")) + if(version_compare(PHP_VERSION, "5.0.0", ">=")) { print_line_right(success_msg()); } else { print_line_right(failed_msg()); - print_line_info("We need at least 4.1.0"); + print_line_info("PHP Version >= 5.0.0 Required"); $error = 1; } @@ -83,7 +83,7 @@ /** * check for supported databases */ - print_line_left("Supported databases (MySQL, PostgreSQL, SQLite)"); + print_line_left("Supported Databases (MySQL, PostgreSQL, SQLite)"); if(function_exists('mysql_connect')) { $supported_db['mysql'] = 1; } @@ -98,12 +98,13 @@ { print_line_middle("NONE"); print_line_right(failed_msg()); - print_line_info("Enable at least one database in your php configuration (php.ini)"); + print_line_info("Enable at least support for one Database in your " . + "PHP configuration (php.ini)"); $error = 1; } else { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(success_msg()); $str = ""; @@ -111,7 +112,7 @@ { $str .= $key.' '; } - print_line_info("Supported databases: ".$str); + print_line_info("Supported Databases: ".$str); } /** @@ -185,20 +186,21 @@ */ if(version_compare($convert_version, "6.1.4", ">=")) { - $bracket_support = 1; + $sys_im_bracket_support = 1; } else { - $bracket_support = 0; + $sys_im_bracket_support = 0; } - echo "\t".'<input type="hidden" name="im_bracket_support" value="'.$bracket_support.'">'."\n"; + echo "\t".'<input type="hidden" name="sys_im_bracket_support" value="'.$sys_im_bracket_support.'">'."\n"; - echo "\t".'<input type="hidden" name="use_convert" value="1">'."\n"; - echo "\t".'<input type="hidden" name="convert_path" value="'.$convert_path.'">'."\n"; + echo "\t".'<input type="hidden" name="sys_im_use_convert" value="1">'."\n"; + echo "\t".'<input type="hidden" name="sys_im_convert_path" value="'.$convert_path.'">'."\n"; } } else { print_line_right(warning_msg()); - print_line_info($convert_sum_miss_msg); + print_line_info("ImageMagick was NOT found on this server. " . + "This will result in lower quality thumbnails"); } @@ -211,20 +213,20 @@ print_line_left("GD Library"); if(extension_loaded('gd')) { - print_line_middle("installed"); + print_line_middle("Installed"); print_line_right(success_msg()); } else { - print_line_middle("not found"); + print_line_middle("Not Found"); print_line_right(failed_msg()); $error = 1; } - print_line_left("GD jpeg support"); + print_line_left("GD JPEG Support"); if(!function_exists('imagecreatefromjpeg') || !function_exists('imagejpeg')) { - print_line_middle("no"); + print_line_middle("No"); print_line_right(failed_msg()); print_line_info($gd_jpg_missing_msg."<br />".$inst_linpha_not_work_correctly); @@ -232,12 +234,9 @@ } else { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(success_msg()); } - - $gd_version = get_gd_version(); - echo "\t".'<input type="hidden" name="gd_version" value="'.$gd_version.'">'."\n"; } /** @@ -246,51 +245,51 @@ */ if(installGetOS() != "win") { - print_line_left("Posix extension"); + print_line_left("Posix Extension"); if(check_posix()) { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(success_msg()); } else { - print_line_middle("no"); + print_line_middle("No"); print_line_right(warning_msg()); - print_line_info($posix_sum_miss_msg); + print_line_info("Missing POSIX Extension"); } } /** * checking safe mode */ - print_line_left("Safe mode activated"); + print_line_left("Safe Mode Activated"); if(! ini_get('safe_mode')) { - print_line_middle("no"); + print_line_middle("No"); print_line_right(success_msg()); } else { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(warning_msg()); - print_line_info($safemode_active_msg."<br />".$inst_linpha_not_work_correctly."<br />".$safemode_active_msg2); + print_line_info("Save Mode Is Active - Bad Fun"); } /** * checking open basedir */ - print_line_left("Open basedir activated"); + print_line_left("Open Basedir Activated"); $basedir_name=ini_get("open_basedir"); if(empty($basedir_name)) { - print_line_middle("no"); + print_line_middle("No"); print_line_right(success_msg()); } else { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(warning_msg()); - print_line_info($basedir_active_msg."<br />".$inst_linpha_not_work_correctly."<br />".$basedir_active_msg2); + print_line_info("Open Basedir Restrictions Set"); } @@ -301,7 +300,7 @@ $limit = get_mem_limit(); if($limit === false) { - print_line_middle("unlimited"); + print_line_middle("Unlimited"); print_line_right(success_msg()); } elseif($limit <= 16) @@ -319,34 +318,33 @@ /** * checking session variables */ - print_line_left("Session save path set correctly"); + print_line_left("Session Save Path Set Correctly"); $session_path=session_save_path(); if(!empty($session_path)) { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(success_msg()); - print_line_info("Session save path is set in php.ini to: ".$session_path); + print_line_info("Session Save Path Is Set To: ".$session_path); } else { - print_line_middle("no"); + print_line_middle("No"); print_line_right(warning_msg()); - print_line_info("NO value found for session_save_path.<br />". - "Open your php.ini, and change the session.save_path to a writable directory, for example: \"/tmp\""); + print_line_info("NO Value Found For session_save_path."); } - print_line_left("Session save handler set correctly"); + print_line_left("Session Save Handler Set Correctly"); $session_save_handler = strtolower(ini_get('session.save_handler')); if($session_save_handler == 'files') { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(success_msg()); } else { - print_line_middle("no"); + print_line_middle("No"); print_line_right(failed_msg()); print_line_info("Session save handler NOT correctly set.<br />". "Open your php.ini, and change the session.save_handler to \"files\""); @@ -354,16 +352,16 @@ /** * checking file permissions */ - print_line_left("File permissions set correctly"); + print_line_left("File Permissions Set Correctly"); if( is_writable(LINPHA_DIR.'/var') ) { - print_line_middle("yes"); + print_line_middle("Yes"); print_line_right(success_msg()); } else { - print_line_middle("no"); + print_line_middle("No"); print_line_right(failed_msg()); print_line_info(sprintf($str_make_dir_writable,""<b>linpha/var</b>"")); @@ -376,10 +374,12 @@ */ print_foot(); +echo "<br />"; +echo tr("For More Detailed Info - Click On The Status Text<br />"); + ?> -<br /> -For more detailled info, click on the status text<br /> -(<a href="#" onclick="show_hide_tables('',<?php echo $table_lines; ?>)">Show all infos</a>). +<a href="#" onclick="show_hide_tables('',<?php echo $table_lines; ?>)"> +(<?php echo tr("Show All Information"); ?></a>). <script language="JavaScript" type='text/javascript'> <!-- @@ -410,8 +410,8 @@ <table width="95%"> <tr> <td> </td> - <td>Version</td> - <td>Status</td> + <td><?php echo tr("Result"); ?></td> + <td><?php echo tr("Status"); ?></td> </tr> <?php } @@ -421,14 +421,14 @@ $GLOBALS['table_lines']++; ?> <tr> - <td style="text-align: left;"><?php echo $str; ?></td> + <td style="text-align: left;"><?php echo tr("$str"); ?></td> <?php } function print_line_middle($str) { ?> - <td width="50"><?php echo $str; ?></td> + <td width="50"><?php echo tr("$str"); ?></td> <?php } @@ -436,7 +436,7 @@ { ?> <td width="50"><a href="#" onclick="switch_visibility(<?php echo $GLOBALS['table_lines']; ?>)"><?php - echo $str; ?></a></td> + echo tr("$str"); ?></a></td> </tr> <?php } @@ -445,7 +445,8 @@ { ?> <tr id="table_line_<?php echo $GLOBALS['table_lines']; ?>" style="display:"> - <td colspan="3" style="text-align: left; border-left: none; border-right: none; border-bottom: none; "><?php echo $str; ?><br /><br /></td> + <td colspan="3" style="text-align: left; border-left: none; border-right: none; border-bottom: none; "> + <?php echo tr("$str"); ?><br /><br /></td> </tr> <?php } Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step3_dbtype.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,7 +23,7 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); +include_once(LINPHA_DIR.'/install/header.php'); /** * save settings from previous page @@ -33,7 +33,7 @@ $_SESSION['language'] = $_POST['language']; } -$array = array('im_bracket_support','gd_version','use_convert','convert_path'); +$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path'); foreach($array AS $value) { if(isset($_POST[$value])) @@ -47,7 +47,7 @@ } -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header_html.php'); /** @@ -102,42 +102,44 @@ $checked_mysql = ' checked="checked"'; } ?> -<input type='radio' name='sql_dbtype' value='mysql'<?php echo $disabled_mysql; ?><?php echo $checked_mysql; ?>> -MySQL<br /> +<input type='radio' name='sql_dbtype' value='mysql'<?php echo $disabled_mysql; ?> +<?php echo $checked_mysql; ?>>MySQL<br /> <?php if(!isset($supported_db['mysql'])) { - echo '<b>'.$str_not_enabled_in_php_config.'</b><br />'; + echo '<b>'.tr("No Support In PHP Config (php.ini)");'</b><br />'; } ?> <br /> -<input type='radio' name='sql_dbtype' value='postgres'<?php echo $disabled_postgres; ?><?php echo $checked_postgres; ?>> -Postgresql<br /> +<input type='radio' name='sql_dbtype' value='postgres'<?php echo $disabled_postgres; ?> +<?php echo $checked_postgres; ?>>Postgresql<br /> <?php if(!isset($supported_db['postgres'])) { - echo '<b>'.$str_not_enabled_in_php_config.'</b><br />'; + echo '<b>'.tr("No Support In PHP Config (php.ini)");'</b><br />'; } ?> <br /> -<input type='radio' name='sql_dbtype' value='sqlite'<?php echo $disabled_sqlite; ?><?php echo $checked_sqlite; ?>> -SQLite<br /> +<input type='radio' name='sql_dbtype' value='sqlite'<?php echo $disabled_sqlite; ?> +<?php echo $checked_sqlite; ?>>SQLite<br /> <?php if(!isset($supported_db['sqlite'])) { - echo '<b>'.$str_not_enabled_in_php_config.'</b><br />'; + echo '<b>'.tr("No Support In PHP Config (php.ini)");'</b><br />'; } ?> <br /><br /> -<h1>Select installation mode</h1> +<h1><?php echo tr("Select Installation Mode"); ?></h1> <br /> -<input type='radio' name='install_mode' value='automatic' checked="checked">Automatic mode +<input type='radio' name='install_mode' value='automatic' checked="checked"> +<?php echo tr("Automatic mode"); ?> <br /><br /> -<input type='radio' name='install_mode' value='manual'>Manual mode (only for experts) +<input type='radio' name='install_mode' value='manual'> +<?php echo tr("Manual Mode (Experts Only)"); ?> <?php include_once("./footer.php"); Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,7 +23,7 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); +include_once(LINPHA_DIR.'/install/header.php'); /** * save settings from previous page @@ -55,40 +55,45 @@ -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header_html.php'); $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); $sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir_parent'] : 'var/'); $cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir_parent'] : 'var/'); $tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir_parent'] : 'var/'); ?> + <div class="boxalign"> -Album directory: -<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> +<?php echo tr("Album Directory:"); ?> +<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" + name="album_dir" size="30" value="<?php echo $album_dir; ?>"> </div> (-> <?php echo realpath(LINPHA_DIR.'/'.$album_dir); ?>) <br /><br /> -<h2>Warning: all the following subdirectories will be deleted</h2> +<h2><?php echo tr("Warning: All Subdirectories Will Be Deleted"); ?></h2> <br /> <div class="boxalign"> -Sql directory: -<input class="boxalignelement" type="text" id="check02" onKeyup="checkForm()" name="sql_dir" size="30" value="<?php echo $sql_dir; ?>"> +<?php echo tr("Sql Directory:"); ?> +<input class="boxalignelement" type="text" id="check02" onKeyup="checkForm()" + name="sql_dir" size="30" value="<?php echo $sql_dir; ?>"> </div> (-> <?php echo realpath(LINPHA_DIR.'/'.$sql_dir); ?>/sql) <br /><br /> <div class="boxalign"> -Cache directory: -<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" name="cache_dir" size="30" value="<?php echo $cache_dir; ?>"> +<?php echo tr("Cache Directory:"); ?> +<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" + name="cache_dir" size="30" value="<?php echo $cache_dir; ?>"> </div> (-> <?php echo realpath(LINPHA_DIR.'/'.$cache_dir); ?>/cache) <br /><br /> <div class="boxalign"> -Tmp directory: -<input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" name="tmp_dir" size="30" value="<?php echo $tmp_dir; ?>"> +<?php echo tr("Temp Directory:"); ?> +<input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" + name="tmp_dir" size="30" value="<?php echo $tmp_dir; ?>"> </div> (-> <?php echo realpath(LINPHA_DIR.'/'.$tmp_dir); ?>/tmp) <br /><br /> Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step5_getlogin.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,7 +23,7 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); +include_once(LINPHA_DIR.'/install/header.php'); /** * save settings from previous page @@ -77,14 +77,14 @@ } -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header_html.php'); /** * validate writable directories */ - echo "<h2>Checking permissions of directories</h2><br />"; + echo "<h2>".tr("Checking Directory Permissions")."</h2><br />"; - echo "Album directory... "; + echo tr("Album Directory")."... "; if( is_dir( $dirs['album'] ) ) { if( is_writable( $dirs['album'] ) ) @@ -96,20 +96,20 @@ { echo warning_msg(); echo '<br /> ('.$_SESSION['album_dir'].' => '.realpath( $dirs['album'] ).')'; - echo "<br />Your album directory isn't writable. Some functions may not be used: rotate images, manage images with the integrated filemanager, ...<br />"; + echo "<br />".tr("Album Directory Not Writable. Some Features May Not Work")."<br />"; } } else { echo failed_msg(); echo '<br /> ('.$_SESSION['album_dir'].')'; - echo '<br />No valid directory found!'; + echo "<br />".tr("No Valid Directory Found")."!"; } $array = array('sql','cache','tmp'); foreach($array AS $value) { - echo "<br /><br />Checking ".$value." directory... "; + echo "<br /><br />Checking ".$value." Directory... "; if( is_dir( $dirs[$value.'_parent'] ) ) { if( is_writable( $dirs[$value.'_parent'] ) ) @@ -117,7 +117,7 @@ if( file_exists( $dirs[$value] ) ) { echo warning_msg(); - echo "<br />Directory already exists, trying to delete folder... "; + echo "<br />".tr("Directory Already Exists - Trying To Delete")."... "; if( rm_rf( $dirs[$value] ) ) { echo success_msg(); @@ -125,7 +125,7 @@ else { echo failed_msg(); - echo "<br />Try to delete the folder yourself."; + echo "<br />".tr("Please Delete Folder Manually").""; $error_nr = 2; } } @@ -138,7 +138,7 @@ else { echo failed_msg(); - echo "<br />Missing write permission to this directory. Please change permissions or use another directory!"; + echo "<br />".tr("No Write Permissions. Please Change Permissions Or Choose Another Directory")."!"; echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; $error_nr = 1; } @@ -146,7 +146,7 @@ else { echo failed_msg(); - echo "<br />Directory doesn't exists!"; + echo "<br />".tr("Directory Doesn't Exist")."!"; echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.$dirs[$value.'_parent'].'/'.$value.')'; // no realpath() because if dir does not exists realpath will show something strange... $error_nr = 1; } @@ -163,24 +163,28 @@ } ?> <hr /> -<h1><?php echo $title_str[$key]; ?></h1> +<h1><?php echo tr("$title_str[$key]"); ?></h1> <br /> <div class="boxalign"> -Username: -<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="sql_username" value="<?php echo isset($_SESSION['sql_username']) ? $_SESSION['sql_username'] : 'root' ; ?>"> +<?php echo tr("Username").":"; ?> +<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" + name="sql_username" value="<?php echo isset($_SESSION['sql_username']) ? $_SESSION['sql_username'] : 'root' ; ?>"> <br /> </div> <div class="boxalign"> -Password: -<input class="boxalignelement" type="password" id="check02" onKeyup="checkForm()" name="sql_password"> +<?php echo tr("Password").":"; ?> +<input class="boxalignelement" type="password" id="check02" + onKeyup="checkForm()" name="sql_password"> <br /> </div> <div class="boxalign"> -Host name: -<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" name="sql_hostname" value="<?php echo isset($_SESSION['sql_hostname']) ? $_SESSION['sql_hostname'] : 'localhost' ; ?>"> +<?php echo tr("Hostname:").":"; ?> +<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" + name="sql_hostname" value="<?php echo isset($_SESSION['sql_hostname']) ? + $_SESSION['sql_hostname'] : 'localhost' ; ?>"> </div> <?php Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step6_selectdatabase.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,8 +23,8 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header.php'); +include_once(LINPHA_DIR.'/install/header_html.php'); /** * save settings from previous page @@ -42,11 +42,12 @@ /** * validate settings */ -if(empty($_SESSION['sql_hostname']) OR empty($_SESSION['sql_username']) OR empty($_SESSION['sql_password'])) +if(empty($_SESSION['sql_hostname']) OR empty($_SESSION['sql_username']) + OR empty($_SESSION['sql_password'])) { - echo "Validate informations... "; + echo tr("Validating Information")."... "; echo failed_msg(); - echo "<br />You must fill out all fields"; + echo "<br />".tr("Please Fill In All Fields").""; echo "</form>"; $show_next_button = false; @@ -54,18 +55,18 @@ exit(); } + switch($_SESSION['sql_dbtype']) { case "mysql": - echo "Checking server connection<br /><br />"; - echo "Connecting to"; - echo "MySQL-Server... "; + echo tr("Testing Server Connection")."<br /><br />"; + echo tr("Connecting MySQL-Server")."... "; $link = @mysql_connect($_SESSION['sql_hostname'], $_SESSION['sql_username'], $_SESSION['sql_password']); if (!$link) { echo failed_msg(); - echo "<br />Can't connect to server : " . mysql_error(); + echo "<br />".tr("Error Connecting To Server").": ".mysql_error().""; $error_nr = 2; } else @@ -73,11 +74,11 @@ echo success_msg(); $curtime = time(); - $result = mysql_query("CREATE database linpha_test_".$curtime); + $result = mysql_query("CREATE DATABASE linpha_test_".$curtime); if($result) { $able_to_create_database = true; - mysql_query("DROP database linpha_test_".$curtime); + mysql_query("DROP DATABASE linpha_test_".$curtime); $db_list = mysql_list_dbs($link); @@ -153,23 +154,30 @@ $checked_create = ' checked="checked"'; $checked_dontcreate = ''; } + + echo tr("You Are Allowed To Create A New Database (Recommended)"); ?> - You can created a new database (recommended): <br /> - <input type="radio" id="radio_db1" name="create_database" value="create"<?php echo $checked_create; ?>> - Database name: - <input type="text" name="sql_dbname_create" value="<?php echo isset($_SESSION['sql_dbname']) ? $_SESSION['sql_dbname'] : $dbname ; ?>" onKeyup="document.getElementById('radio_db1').checked = true;"> + <input type="radio" id="radio_db1" name="create_database" + value="create"<?php echo $checked_create; ?>> + <?php echo tr("New Database Name").": "; ?> + <input type="text" name="sql_dbname_create" + value="<?php echo isset($_SESSION['sql_dbname']) ? + $_SESSION['sql_dbname'] : $dbname ; ?>" + onKeyup="document.getElementById('radio_db1').checked = true;"> + <br /><br /> - Or,<br /> - <input type="radio" id="radio_db2" name="create_database" value="false"<?php echo $checked_dontcreate; ?>> + <?php echo tr("Or").","; ?><br /> + <input type="radio" id="radio_db2" name="create_database" + value="false"<?php echo $checked_dontcreate; ?>> <?php } if(isset($databases)) { + echo tr("Install Into Existing Database").": "; ?> - Install into an existing database: <br /> <select name="sql_dbname_installinto"<?php if($able_to_create_database) @@ -197,9 +205,11 @@ if(!$able_to_create_database AND !isset($database)) { + echo tr("Install Linpha Into").":<br />"; ?> - Install linpha into this database:<br /> - <input type="text" name="sql_dbname_installinto" value="<?php echo isset($_SESSION['sql_dbname']) ? $_SESSION['sql_dbname'] : '' ; ?>"> + <input type="text" name="sql_dbname_installinto" + value="<?php echo isset($_SESSION['sql_dbname']) ? + $_SESSION['sql_dbname'] : '' ; ?>"> <?php } Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step7_selectprefix.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,7 +23,7 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); +include_once(LINPHA_DIR.'/install/header.php'); /** @@ -34,7 +34,7 @@ $back_file = "step4_mode.php"; } -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header_html.php'); /** * save settings from previous page @@ -55,8 +55,9 @@ */ if( empty($_SESSION['sql_dbname']) ) { - echo "You must fill out all fields"; - + echo tr("Validating Information")."... "; + echo failed_msg(); + echo "<br />".tr("Please Fill In All Fields").""; echo "</form>"; $show_next_button = false; include_once("./footer.php"); @@ -66,13 +67,13 @@ switch($_SESSION['sql_dbtype']) { case "mysql": - echo "<h2>Checking database</h2><br />"; + echo "<h2>".tr("Checking Database")."</h2><br />"; $link = @mysql_connect($_SESSION['sql_hostname'], $_SESSION['sql_username'], $_SESSION['sql_password']); if(isset($_POST['create_database']) && $_POST['create_database'] == "create") { - echo "Creating database... "; + echo tr("Creating Database")."... "; $result = @mysql_query("CREATE database ".$_SESSION['sql_dbname']); if($result) @@ -90,12 +91,12 @@ if(!isset($error_nr)) { - echo "<br />Selecting database ".$_SESSION['sql_dbname'].'... '; + echo "<br />".tr("Selecting Database").". ".$_SESSION['sql_dbname'].'... '; $db_selected = @mysql_select_db($_SESSION['sql_dbname'], $link); if (!$db_selected) { echo failed_msg(); - echo "<br />Can't open database ".$_SESSION['sql_dbname'].": " . mysql_error() . "<br />"; + echo "<br />".tr("Failed Opening Database").". ".$_SESSION['sql_dbname'].": " . mysql_error() . "<br />"; $error_nr = 3; } else @@ -106,16 +107,15 @@ break; case "postgres": - echo "<h2>Checking server connection</h2><br />"; - echo "Connecting to"; - echo "PostgreSQL-Server... "; + echo tr("Testing Server Connection")."<br /><br />"; + echo tr("Connecting PostgreSQL-Server")."... "; $link = pg_pconnect("host=".$_SESSION['sql_hostname']." dbname=".$_SESSION['sql_dbname']." user=".$_SESSION['sql_username']." password=".$_SESSION['sql_password']); // port=5432 if (!$link) { echo failed_msg(); - echo "<br />Can't connect to server : " . pg_last_error($link); + echo "<br />".tr("Error Connecting To Server").": ".pg_last_error($link); $error_nr = 2; } else @@ -124,13 +124,13 @@ } break; case "sqlite": - echo "<h2>Checking database</h2><br />"; - echo "Creating database... "; + echo tr("Testing File Connection")."<br /><br />"; + echo tr("Connecting SQLite Database")."... "; if(file_exists($_SESSION['sql_dbname'])) { echo failed_msg(); - echo '<br />Database already exists, delete the file '.$_SESSION['sql_dbname'].' first!'; + echo "<br />".tr("Database Already Exists, Delete The File ".$_SESSION['sql_dbname']." first!").""; $error_nr = 3; } else @@ -142,7 +142,7 @@ else { echo failed_msg(); - echo '<br />Cannot create database: '.$sqliteerror; + echo "<br />".tr("Failed To Create Database").": ".$sqliteerror; $error_nr = 3; } } @@ -166,8 +166,10 @@ <br /><br /> <hr> <br /> - Please enter the prefix for the linpha tables (leave for default):<br /> - <input type="text" id="check01" onKeyup="checkForm()" name="sql_prefix" value="<?php echo isset($_SESSION['sql_prefix']) ? $_SESSION['sql_prefix'] : 'linpha_' ; ?>"> + <?php echo tr("Please Enter Database Prefix For Linpha Tables (Leave For Default)").": <br />" ?> + <input type="text" id="check01" onKeyup="checkForm()" name="sql_prefix" + value="<?php echo isset($_SESSION['sql_prefix']) ? + $_SESSION['sql_prefix'] : 'linpha_' ; ?>"> <?php $array_check = array( Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-03-30 18:56:38 UTC (rev 4457) +++ trunk/linpha2/install/step8_testing.php 2006-03-31 08:07:40 UTC (rev 4458) @@ -23,8 +23,8 @@ * linpha installer */ -include_once(LINPHA_DIR."/install/header.php"); -include_once(LINPHA_DIR."/install/header_html.php"); +include_once(LINPHA_DIR.'/install/header.php'); +include_once(LINPHA_DIR.'/install/header_html.php'); /** * save settings from previous page @@ -39,8 +39,9 @@ */ if( empty($_SESSION['sql_prefix']) ) { - echo "You must fill out all fields"; - + echo tr("Validating Information")."... "; + echo failed_msg(); + echo "<br />".tr("Please Fill In All Fields").""; echo "</form>"; $show_next_button = false; include_once("./footer.php"); @@ -51,7 +52,7 @@ * switching to AdoDB * connect to db and check if connection was succesfull */ - echo "Switching to AdoDB... "; + echo tr("Switching To AdoDB")."... "; $_SESSION['installmode1'] = true; $_SESSION['installmode2'] = true; @@ -71,16 +72,16 @@ if($_SESSION['sql_dbtype'] != "sqlite") { ?> - <h2>Checking prefix</h2><br /> + <h2><?php echo tr("Checking Table Prefix"); ?></h2><br /> - Doesn't any tables already exists... + <?php echo tr("Checking For Existing Tables")."... "; ?> <?php $array_tables = $linpha->db->MetaTables(); if (! isset($array_tables) OR ! is_array($array_tables)) { echo failed_msg(); - echo '<br />Cannot read tables: '.mysql_error(); + echo "<br />".tr("Cannot Read Tables").": ".mysql_error(); $error_nr = 2; } else @@ -100,7 +101,7 @@ if(isset($result) && is_array($result) && (count($result) > 0) ) { echo failed_msg(); - echo '<br />There is already a linpha installation with this prefix, choose another one!'; + echo "<br />".tr("Table Prefix Already Exists, Please Choose Another One").".!"; echo "</form>"; $show_next_button = false; include_once("./footer.php"); @@ -121,7 +122,7 @@ $n_runs = 1; if($_SESSION['sql_dbtype']=="mysql") { - echo 'Trying to create a new db user... '; + echo tr("Trying To Create New Database User")."... "; $random_pass = random_password(8); $random_user = "linpha_".random_password(4); @@ -136,14 +137,14 @@ "IDENTIFIED BY '".$random_pass."' WITH GRANT OPTION") ) { echo warning_msg(); - echo "<br />".$str_cant_create_user; + echo "<br />".tr("Failed To Create New User"); } else { if(! $linpha->db->Execute("FLUSH PRIVILEGES") ) { echo warning_msg(); - echo "<br />".$str_cant_create_user; + echo "<br />".tr("Failed To Create New User"); } else { @@ -154,7 +155,7 @@ if(! $test_conn->Connect($_SESSION['sql_hostname'], $random_user, $random_pass, $_SESSION['sql_dbname']) ) { echo warning_msg(); - echo "<br />".$str_cant_create_user; + echo "<br />".tr("Failed To Create New User"); } else { @@ -179,7 +180,7 @@ */ if($i == 2) { - echo "<br /><br />All went fine, now trying the new user...<br /><br />"; + echo "<br /><br />".tr("User Created, Now Running Tests")."...<br /><br />"; $orig_conn = $linpha->db; $linpha->db = $test_conn; } @@ -187,10 +188,10 @@ /** * Test table stuff */ - echo '<h2>Testing tables</h2>'; + echo "<h2>".tr("Testing Tables")."</h2>"; $table_name = $_SESSION['sql_prefix']."test".time(); - echo "<br />Running tests: "; + echo "<br />".tr("Running Tests").": "; $array_tests = array( "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL )", @@ -266,7 +267,7 @@ */ if(isset($use_other_conn)) { - echo '<br /><br /><b>New user failed, using original user...</b>'; + echo "<br /><br /><b>".tr("New User Tests Failed, Falling Back")."...</b>"; $linpha->db = $orig_conn; } elseif($n_runs == 2) Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-03-3... [truncated message content] |
From: <bz...@us...> - 2006-03-31 11:52:49
|
Revision: 4460 Author: bzrudi Date: 2006-03-31 03:52:26 -0800 (Fri, 31 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4460&view=rev Log Message: ----------- sqlite installation should work now Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/manual_install.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.sql.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/ChangeLog 2006-03-31 11:52:26 UTC (rev 4460) @@ -1,7 +1,9 @@ 2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer: - + at least mysql installation should work now (automatic mode only) + + at least mysql installation should work now + made i18n ready using tr() + + sqlite should work now also + todo: we should take care of some still hardcoded paths! e.g. /var ... 2006-03-30 flo * fixing some errors in browse by date view Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/manual_install.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -62,14 +62,15 @@ define('PREFIX', $_SESSION['sql_prefix']); define('DB_TYPE', $_SESSION['sql_dbtype']); + + +echo "<h2>".tr("LinPHA Manual Install")."</h2>"; ?> - -<h2>Installing LinPHA manual</h2> <br /> </form> <form method="POST" action="manual_install.php"> -Table prefix: +<?php echo tr("Table Prefix").":"; ?> <input type="text" name="sql_prefix" value="<?php echo $_SESSION['sql_prefix']; ?>"> <input type="submit" name="submit" value="Change"> </form> @@ -113,7 +114,7 @@ ?> <br /> -SQL executes<br /> +<?php echo tr("SQL Queries To Execute")."<br />"; ?> <textarea style="width: 95%; " rows="8" wrap="off"><?php echo $str_query; ?></textarea> @@ -128,7 +129,7 @@ include_once(LINPHA_DIR.'/install/sql/config.dir.php'); ?> <br /><br /> -Folders to create<br /> +<?php echo tr("Folders To Create")."<br />"; ?> <textarea style="width: 95%; " rows="3" wrap="off"> <?php echo $_SESSION['album_dir']."\n"; @@ -150,7 +151,7 @@ </textarea> <br /><br /> -Config file <b>sql/config.dir.php</b><br /> +<?php echo tr("Config File <b>sql/config.dir.php</b>")."<br />"; ?> <textarea style="width: 95%; " rows="3" wrap="off"><?php echo $str; ?></textarea> @@ -165,7 +166,7 @@ include_once(LINPHA_DIR.'/install/sql/config.sql.php'); ?> <br /><br /> -Database connection file <b><?php echo $_SESSION['sql_dir']; ?>config.sql.php</b><br /> +<?php echo tr("Database Connection File"); ?><b><?php echo $_SESSION['sql_dir']; ?>config.sql.php</b><br /> <textarea style="width: 95%; " rows="5" wrap="off"><?php echo $str; ?></textarea> Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/sql/sql.data.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -69,34 +69,34 @@ * metadata */ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (1, 'description', 1, 5)"; + "(id, name, field_type, flags) VALUES (1, 'description', 1, 5)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (2, 'category', 2, 5)"; + "(id, name, field_type, flags) VALUES (2, 'category', 2, 5)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (3, 'persons', 2, 5)"; + "(id, name, field_type, flags) VALUES (3, 'persons', 2, 5)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (4, 'date', 3, 5)"; + "(id, name, field_type, flags) VALUES (4, 'date', 3, 5)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (6, 'filename', 0, 1)"; + "(id, name, field_type, flags) VALUES (6, 'filename', 0, 1)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (7, 'imagesize', 0, 1)"; + "(id, name, field_type, flags) VALUES (7, 'imagesize', 0, 1)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`id`, `name`, `field_type`, `flags`) VALUES (8, 'dimension', 0, 1)"; + "(id, name, field_type, flags) VALUES (8, 'dimension', 0, 1)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('id_6', 0, 10)"; + "(name, field_type, flags) VALUES ('id_6', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('id_7', 0, 10)"; + "(name, field_type, flags) VALUES ('id_7', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('id_8', 0, 10)"; + "(name, field_type, flags) VALUES ('id_8', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('id_1', 0, 10)"; + "(name, field_type, flags) VALUES ('id_1', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('id_2', 0, 10)"; + "(name, field_type, flags) VALUES ('id_2', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('id_3', 0, 10)"; + "(name, field_type, flags) VALUES ('id_3', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(`name`, `field_type`, `flags`) VALUES ('exif_datetimeoriginal', 0, 10)"; + "(name, field_type, flags) VALUES ('exif_datetimeoriginal', 0, 10)"; ?> Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -21,211 +21,78 @@ * linpha installer */ -$sql_tables = array ( +$sql_tables = array( "CREATE TABLE ".$linpha_tables['config']." ( ". - "ID INTEGER PRIMARY KEY, ". - "option_name VARCHAR(50) not null, ". - "option_value VARCHAR(100) not null, ". - "userid INTEGER ". + "id SMALLINT PRIMARY KEY, " . + "option_name VARCHAR(50) NOT NULL default '', " . + "option_value VARCHAR(100) NOT NULL default '', " . + "userid MEDIUMINT unsigned default '0' " . ")", - - "CREATE TABLE ".$linpha_tables['users']." ( ". - "ID INTEGER PRIMARY KEY, ". - "nickname VARCHAR(20) not null, ". - "password VARCHAR(32) not null, ". - "email VARCHAR(255), ". - "lang VARCHAR(100) default 'English', ". - "level SMALLINT, ". - "groups VARCHAR(255), ". - "fullname VARCHAR(50) ". + "CREATE TABLE ".$linpha_tables['groups']." ( ". + "id INTEGER PRIMARY KEY, " . + "name VARCHAR(100) NOT NULL default '' " . ")", - - "CREATE TABLE ".$linpha_tables['first_lev_album']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "path VARCHAR(255) not null, ". - "name VARCHAR(255) not null, ". - "level INTEGER, ". - "groups VARCHAR(255) DEFAULT ';public;', ". - "photos SMALLINT ". + "CREATE TABLE ".$linpha_tables['permissions']." ( ". + "id INTEGER PRIMARY KEY, " . + "photos_id INTEGER NOT NULL default '0', " . + "perm_type VARCHAR(255) NOT NULL default '0', " . + "permission VARCHAR(255) NOT NULL default '' " . ")", - - "CREATE TABLE ".$linpha_tables['sec_lev_album']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "path VARCHAR(255) not null, ". - "name VARCHAR(255) not null, ". - "prev_alb_name VARCHAR(255) not null, ". - "level INTEGER, ". - "res VARCHAR(64), ". - "res1 VARCHAR(64) ". - ")", - - "CREATE TABLE ".$linpha_tables['third_lev_album']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "path VARCHAR(255) not null, ". - "name VARCHAR(255) not null, ". - "prev_alb_name VARCHAR(255) not null, ". - "level INTEGER, ". - "res VARCHAR(64), ". - "res1 VARCHAR(64) ". - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "name VARCHAR(255), ". - "filename VARCHAR(255) not null, ". - "thumbnail BLOB, ". - "prev_path VARCHAR(255), ". - "level INTEGER, ". - "res INT(5) DEFAULT 0 NOT NULL, ". - "md5sum VARCHAR(40), ". - "downloads INTEGER, ". - "fmkey_location VARCHAR(100), ". - "fmkey_type VARCHAR(100), ". - "fmkey_date VARCHAR(100) ". + "id INTEGER PRIMARY KEY, " . + "parent_id INTEGER NOT NULL default '0', " . + "img_type INTEGER NOT NULL default '0', " . + "name text NOT NULL, " . + "md5sum VARCHAR(40) NOT NULL default '', " . + "time_add INTEGER NOT NULL default '0', " . + "time_mod INTEGER NOT NULL default '0', " . + "time_exif INTEGER NOT NULL default '0', " . + "stats_numbers INTEGER NOT NULL default '0', " . + "stats_views INTEGER NOT NULL default '0', " . + "stats_downloads INTEGER NOT NULL default '0' " . ")", - - "CREATE TABLE ".$linpha_tables['photo_cache']." ( ". - "filename VARCHAR(255) PRIMARY KEY NOT NULL, ". - "photo_id INT UNSIGNED NOT NULL, ". - "date DATETIME NOT NULL, ". - "used TIMESTAMP, ". - "hits MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL, ". - "size INT UNSIGNED DEFAULT '0' NOT NULL, ". - "convert_time FLOAT DEFAULT '0.0' NOT NULL ". + "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". + "id INTEGER PRIMARY KEY, " . + "name VARCHAR(255) NOT NULL default '', " . + "field_type INTEGER NOT NULL default '0', " . + "flags INTEGER NOT NULL default '0' " . ")", - - "CREATE TABLE ".$linpha_tables['category']." ( ". - "ID INTEGER PRIMARY KEY, ". - "name VARCHAR(255) not null, ". - "isprivate SMALLINT ". + "CREATE TABLE ".$linpha_tables['meta_category']." ( ". + "id INTEGER PRIMARY KEY, " . + "field_id INTEGER NOT NULL default '0', " . + "name VARCHAR(255) NOT NULL default '', " . + "isprivate INTEGER default NULL " . ")", - - "CREATE TABLE ".$linpha_tables['counter_stats']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "ip VARCHAR(32), ". - "res INTEGER ". + "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". + "md5sum VARCHAR(32) NOT NULL default '', " . + "datetimeoriginal VARCHAR(255) default NULL, " . + "make VARCHAR(255) default NULL, " . + "model VARCHAR(255) default NULL, " . + "artist VARCHAR(255) default NULL, " . + "copyright VARCHAR(255) default NULL, " . + "aperturevalue VARCHAR(255) default NULL, " . + "shutterspeedvalue VARCHAR(255) default NULL, " . + "exposuretime VARCHAR(255) default NULL, " . + "isospeedratings VARCHAR(255) default NULL, " . + "flash VARCHAR(255) default NULL, " . + "focallength VARCHAR(255) default NULL, " . + "fnumber VARCHAR(255) default NULL " . ")", - - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "ID INTEGER PRIMARY KEY, ". - "groups VARCHAR(15) NOT NULL, ". - "res VARCHAR(20) ". + "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". + "md5sum VARCHAR(32) NOT NULL default '' " . ")", - - "CREATE TABLE ".$linpha_tables['image_comments']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "md5sum VARCHAR(40), ". - "author VARCHAR(20), ". - "comment TEXT, ". - "description VARCHAR(255), ". - "category VARCHAR(255) ". + "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". + "id INTEGER PRIMARY KEY, " . + "time INTEGER NOT NULL default '0', " . + "md5sum VARCHAR(32) NOT NULL default '', " . + "author VARCHAR(255) NOT NULL default '', " . + "comment text NOT NULL " . ")", - - "CREATE TABLE ".$linpha_tables['album_comments']." ( ". - "ID INTEGER PRIMARY KEY, ". - "date TIMESTAMP, ". - "album VARCHAR(255), ". - "author VARCHAR(20), ". - "comment TEXT ". - ")", - - "CREATE TABLE ".$linpha_tables['plugins']." ( ". - "ID INTEGER PRIMARY KEY, ". - "name VARCHAR(255), ". - "active SMALLINT(1) DEFAULT '0' NOT NULL ". - ")", - - "CREATE TABLE ".$linpha_tables['guestbook']." ( ". - "ID INTEGER PRIMARY KEY, ". - "name VARCHAR (50) ,". - "email VARCHAR (50) ,". - "country VARCHAR (50) ,". - "url VARCHAR (150) ,". - "comment TEXT not null ,". - "date INT (11) ". - ")", - - "CREATE TABLE ".$linpha_tables['mail_list']." ( ". - "ID INTERGER PRIMARY KEY, ". - "name varchar(100), ". - "email varchar(100), ". - "date INT (14), ". - "active SMALLINT(1) DEFAULT '0' NOT NULL ". - ")", - - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "ID INTEGER PRIMARY KEY, ". - "type varchar(255) NOT NULL, ". - "who int(1) NOT NULL default '0', ". - "groups_exceptions varchar(255) NOT NULL default '', ". - "groups_additional varchar(255) NOT NULL default '', ". - "and_or int(1) NOT NULL default '0', ". - "alb int(1) NOT NULL default '0', ". - "albums text NOT NULL ". - ")", - - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR(32) NOT NULL, ". - - // caption fields - "caption VARCHAR(255) NOT NULL, ". - "caption_writer VARCHAR(255) NOT NULL, ". - "headline VARCHAR(255) NOT NULL, ". - "instructions VARCHAR(255) NOT NULL, ". - - // keywords fields - "keywords VARCHAR(255) NOT NULL, ". - - // categories fields - "category VARCHAR(3) NOT NULL, ". - "supplemental_categorie VARCHAR(255) NOT NULL, ". - - //credits fields - "copyright VARCHAR(255) NOT NULL, ". - "byline VARCHAR(255) NOT NULL, " . - "byline_title VARCHAR(255) NOT NULL, ". - "credit VARCHAR(255) NOT NULL, " . - "source VARCHAR(255) NOT NULL, " . - - //status fields - "edit_status VARCHAR(255) NOT NULL, ". - "priority VARCHAR(255) NOT NULL, ". - "object_cycle VARCHAR(255) NOT NULL, ". - "job_id VARCHAR(255) NOT NULL, ". - "program VARCHAR(255) NOT NULL, ". - - // origin fields - "object_name VARCHAR(255) NOT NULL, ". - "date_created VARCHAR(255) NOT NULL, ". - "date_released VARCHAR(255) NOT NULL, ". - "time_created VARCHAR(255) NOT NULL, ". - "time_released VARCHAR(255) NOT NULL, ". - "city VARCHAR(255) NOT NULL, ". - "sublocation VARCHAR(255) NOT NULL, ". - "state VARCHAR(255) NOT NULL, ". - "country VARCHAR(255) NOT NULL, ". - "country_code VARCHAR(5) NOT NULL, ". - "trans_reference VARCHAR(255) NOT NULL, ". - "marked_ignored INT(1) ". - ")", - - "CREATE TABLE ".$linpha_tables['blacklist']." ( ". - "action VARCHAR(20), ". - "value TEXT ". + "CREATE TABLE ".$linpha_tables['meta_data']." ( ". + "id INTEGER PRIMARY KEY, " . + "field_id INTEGER NOT NULL default '0', " . + "md5sum VARCHAR(32) NOT NULL default '', " . + "meta_data VARCHAR(255) NOT NULL default '' " . ")" ); - - -/** - * create dynamically the linpha_meta_exif table - */ -include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); -$sql_tables[] = Metadata::createExifTable(); - -?> \ No newline at end of file +?> Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/step10_postsettings.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -42,7 +42,7 @@ include_once(LINPHA_DIR.'/install/header_html.php'); -echo tr("Connected To Database")."... "; +echo tr("Connecting To Database")."... "; unset($_SESSION['installmode1']); include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -17,12 +17,17 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } - /** * linpha installer */ +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } + +$album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); +$sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir_parent'] : 'var/'); +$cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir_parent'] : 'var/'); +$tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir_parent'] : 'var/'); + include_once(LINPHA_DIR.'/install/header.php'); /** @@ -56,11 +61,6 @@ include_once(LINPHA_DIR.'/install/header_html.php'); - -$album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); -$sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir_parent'] : 'var/'); -$cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir_parent'] : 'var/'); -$tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir_parent'] : 'var/'); ?> <div class="boxalign"> Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/step7_selectprefix.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -126,16 +126,61 @@ case "sqlite": echo tr("Testing File Connection")."<br /><br />"; echo tr("Connecting SQLite Database")."... "; - - if(file_exists($_SESSION['sql_dbname'])) +/** + * save settings from previous page + */ + $array = array('album', 'sql','cache','tmp'); + foreach($array AS $value) { + if( isset( $_POST[$value.'_dir'] ) ) + { + /** + * save correctly in session + */ + /** + * append '/' if not already done + */ + $len = strlen( $_POST[$value.'_dir'] ); + $lastsign = substr( $_POST[$value.'_dir'], $len-1); + if($lastsign != '/' && $lastsign != '\\') + { + $_POST[$value.'_dir'] .= '/'; + } + + /** + * save current value and append correct dir names + */ + $_SESSION[$value.'_dir_parent'] = $_POST[$value.'_dir']; + switch($value) + { + case 'album': $_SESSION[$value.'_dir'] = $_POST[$value.'_dir']; break; + case 'sql': $_SESSION[$value.'_dir'] = $_POST[$value.'_dir'].'sql/'; break; + case 'cache': $_SESSION[$value.'_dir'] = $_POST[$value.'_dir'].'cache/'; break; + case 'tmp': $_SESSION[$value.'_dir'] = $_POST[$value.'_dir'].'tmp/'; break; + } + } + + /** + * get correct dir names (take care of relativ and absolute paths, add + * LINPHA_DIR if necessary) + */ + $dirs[$value] = get_full_path( $_SESSION[$value.'_dir'] ); + $dirs[$value.'_parent'] = get_full_path( $_SESSION[$value.'_dir_parent'] ); + } + if(file_exists(LINPHA_DIR.'/'.$_SESSION['sql_dir'].$_SESSION['sql_dbname'])) + { echo failed_msg(); echo "<br />".tr("Database Already Exists, Delete The File ".$_SESSION['sql_dbname']." first!").""; $error_nr = 3; } else { - if ($db = @sqlite_open(LINPHA_DIR.'/sql/'.$_SESSION['sql_dbname'], 0666, $sqliteerror)) + + /** + * store in session to be used when switching to adodb + */ + + if ($db = @sqlite_open(LINPHA_DIR.'/'.$_SESSION['sql_dir'].$_SESSION['sql_dbname'], 0666, $sqliteerror)) { echo success_msg(); } Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/step8_testing.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -58,7 +58,7 @@ include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); + $linpha = new Linpha(); $linpha->sql->dbConnect(); echo success_msg(); @@ -173,6 +173,12 @@ /** * running tests */ +/** + * prevent test running sqlite db + */ +if($_SESSION['sql_dbtype'] != 'sqlite') +{ + for($i = 1; $i <= $n_runs; $i++) { /** @@ -192,7 +198,7 @@ $table_name = $_SESSION['sql_prefix']."test".time(); echo "<br />".tr("Running Tests").": "; - + $array_tests = array( "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL )", "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", @@ -200,11 +206,11 @@ "UPDATE" => "UPDATE ".$table_name." SET md5sum = '".md5('the life ist beautiful')."'", "SELECT" => "SELECT * FROM ".$table_name, "DELETE" => "DELETE FROM ".$table_name, - "DROP" => "DROP TABLE ".$table_name - ); + "DROP" => "DROP TABLE ".$table_name ); foreach($array_tests AS $key=>$value) { + echo " ".$key." "; $result = $linpha->db->Execute($value); @@ -261,7 +267,11 @@ } } } - +} +else +{ + echo tr("Skipping Database Tests"); +} /** * new user failed, use old connection */ Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/install/step9_createtables.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -92,6 +92,7 @@ if(!$result) { echo failed_msg(); + echo $value; echo ' '.$linpha->db->ErrorMsg().'<br />'; $error_nr = 1; } @@ -134,7 +135,7 @@ * create tmp dirs */ @mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); - @mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); + //@mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); /** * create sql dir Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-31 08:17:14 UTC (rev 4459) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-31 11:52:26 UTC (rev 4460) @@ -47,14 +47,19 @@ $db_hostname = $_SESSION['sql_hostname']; $db_username = $_SESSION['sql_username']; $db_password = $_SESSION['sql_password']; - $db_name = ($db_type == "sqlite" ? LINPHA_DIR.'/sql/' : '').$_SESSION['sql_dbname']; + $db_name = ($db_type == "sqlite" ? LINPHA_DIR.'/'.$_SESSION['sql_dir'] : '').$_SESSION['sql_dbname']; $db_prefix = $_SESSION['sql_prefix']; + } else { include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); $sql_dir = ''; + /** + * @todo get /var value from config table + */ + include_once(LINPHA_DIR.'/var/config.dir.php'); $include_file = linFilesys::getFullPath( $sql_dir ).'config.sql.php'; @@ -76,7 +81,28 @@ */ include_once(LINPHA_DIR.'/lib/adodb/adodb.inc.php'); $GLOBALS['linpha']->db = NewADOConnection($db_type); - @$GLOBALS['linpha']->db->Connect($db_hostname, $db_username, $db_password, $db_name); + switch(DB_TYPE) + { + case "sqlite": + { + if(isset($_SESSION['installmode1'])) + { + $sql_dir = linFilesys::getFullPath($_SESSION['sql_dir']); + $GLOBALS['linpha']->db->Connect($sql_dir.'database.sqlite'); + } + else + { + $GLOBALS['linpha']->db->Connect(LINPHA_DIR."/"."$sql_dir".'database.sqlite'); + } + break; + } + case "mysql": + $GLOBALS['linpha']->db->Connect($db_hostname, $db_username, $db_password, $db_name); + break; + case "pgsql": + $GLOBALS['linpha']->db->Connect($db_hostname, $db_username, $db_password, $db_name); + break; + } if( !isset($GLOBALS['linpha']->db) OR !$GLOBALS['linpha']->db->isConnected() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-01 11:10:21
|
Revision: 4467 Author: fangehrn Date: 2006-04-01 03:09:56 -0800 (Sat, 01 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4467&view=rev Log Message: ----------- * update several folder paths -> it should now work if you specify an other album dir than ./albums -> all paths stored and handled in linpha doesn't contain an ending '/' !! if the do, getFullPath() removes it !! * installer tested -> it works :-) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/get_thumb.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/home.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/ChangeLog 2006-04-01 11:09:56 UTC (rev 4467) @@ -1,3 +1,12 @@ +2006-04-01 flo + * update several folder paths + -> it should now work if you specify an other album dir than ./albums + -> all paths stored and handled in linpha doesn't contain an ending '/' !! + if the do, getFullPath() removes it !! + + * installer tested + -> it works :-) + 2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer: + at least mysql installation should work now Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/get_thumb.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -59,9 +59,12 @@ $force = false; } - $output_file = linImage::createThumbnail($data['id'],$data['img_type'],$force); - Header("Content-type: image/jpeg"); - readfile( $output_file ); + $output_file = LinImage::createThumbnail($data['id'],$data['img_type'],$force); + if(file_exists($output_file)) + { + Header("Content-type: image/jpeg"); + readfile( $output_file ); + } } catch(Exception $error) { Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/lib.install.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -46,7 +46,7 @@ */ if($tr_learn == true) { - $tmpfile = LINPHA_DIR."/var/tmp/lang.install.temp.txt"; + $tmpfile = LINPHA_DIR."/var/lang.install.temp.txt"; if(false == file_exists("$tmpfile")) { @@ -170,6 +170,51 @@ } /** +* create directory recursively - same as "mkdir -p" +*/ +function mkdir_p($target,$mode='0700') +{ + if(is_dir($target) || empty($target)) { // best case check first + return true; + } + if(file_exists($target) && !is_dir($target)) { // target exists bug isn't a directory.. + return false; + } + if( mkdir_p( substr( $target,0,strrpos( $target,'/') ) ) ) + { + return mkdir($target,intval($mode,8)); // crawl back up & create dir tree + } + else + { + return false; + } +} + +/** + * realpath() doesnt work if path is absolute + * linpha_realpath takes care of this + */ +function linpha_realpath( $path) +{ + if( ! is_absolute_path( $path ) ) + { + $path = realpath( $path ); + } + + /** + * remove ending '/' if exists + */ + $len = strlen( $path ); + $lastsign = substr( $path, $len-1); + if($lastsign == '/' OR $lastsign == '\\') + { + $path = substr($path,0,$len-1); + } + + return $path; +} + +/** * if $path is absolute, this is returned, if $path is relative, the relative path starting * from the linpha rootdirectory is returned * Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step2_requirements.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -376,7 +376,7 @@ print_foot(); echo "<br />"; -echo tr("For More Detailed Info - Please Click On The Status Text")."<br />; +echo tr("For More Detailed Info - Please Click On The Status Text")."<br />"; ?> <a href="#" onclick="show_hide_tables('',<?php echo $table_lines; ?>)"> Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -23,12 +23,13 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } +include_once(LINPHA_DIR.'/install/header.php'); + $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); $sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir_parent'] : 'var/'); $cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir_parent'] : 'var/'); $tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir_parent'] : 'var/'); -include_once(LINPHA_DIR.'/install/header.php'); /** * save settings from previous page @@ -68,10 +69,10 @@ <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$album_dir); ?>) +(-> <?php echo linpha_realpath( get_full_path($album_dir) ); ?>) <br /><br /> -<h2><?php echo tr("Warning: All Subdirectories Will Be Deleted"); ?></h2> +<h2><?php echo tr("Warning: All Existing Subdirectories Will Be Deleted"); ?></h2> <br /> <div class="boxalign"> @@ -79,7 +80,7 @@ <input class="boxalignelement" type="text" id="check02" onKeyup="checkForm()" name="sql_dir" size="30" value="<?php echo $sql_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$sql_dir); ?>/sql) +(-> <?php echo linpha_realpath( get_full_path($sql_dir) ); ?>/sql) <br /><br /> <div class="boxalign"> @@ -87,7 +88,7 @@ <input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" name="cache_dir" size="30" value="<?php echo $cache_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$cache_dir); ?>/cache) +(-> <?php echo linpha_realpath( get_full_path($cache_dir) ); ?>/cache) <br /><br /> <div class="boxalign"> @@ -95,7 +96,7 @@ <input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" name="tmp_dir" size="30" value="<?php echo $tmp_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$tmp_dir); ?>/tmp) +(-> <?php echo linpha_realpath( get_full_path($tmp_dir) ); ?>/tmp) <br /><br /> <?php Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -90,12 +90,12 @@ if( is_writable( $dirs['album'] ) ) { echo success_msg(); - echo '<br /> ('.$_SESSION['album_dir'].' => '.realpath( $dirs['album'] ).')'; + echo '<br /> ('.$_SESSION['album_dir'].' => '.linpha_realpath( $dirs['album'] ).')'; } else { echo warning_msg(); - echo '<br /> ('.$_SESSION['album_dir'].' => '.realpath( $dirs['album'] ).')'; + echo '<br /> ('.$_SESSION['album_dir'].' => '.linpha_realpath( $dirs['album'] ).')'; echo "<br />".tr("Album Directory Not Writable. Some Features May Not Work")."<br />"; } } @@ -110,6 +110,20 @@ foreach($array AS $value) { echo "<br /><br />Checking ".$value." Directory... "; + if(! is_dir( $dirs[$value.'_parent'] ) ) + { + echo warning_msg(); + echo "<br />".tr("Directory ".$dirs[$value.'_parent']." Doesnt Exists - Trying To Create")."... "; + if( mkdir_p( $dirs[$value.'_parent'] ) ) + { + echo success_msg(); + } + else + { + echo failed_msg(); + } + } + if( is_dir( $dirs[$value.'_parent'] ) ) { if( is_writable( $dirs[$value.'_parent'] ) ) @@ -133,13 +147,13 @@ { echo success_msg(); } - echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; + echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.linpha_realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; } else { echo failed_msg(); echo "<br />".tr("No Write Permissions. Please Change Permissions Or Choose Another Directory")."!"; - echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; + echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.linpha_realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; $error_nr = 1; } } Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step8_testing.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -118,7 +118,6 @@ /** * try to create a new db user */ -$str_cant_create_user = "Cannot create a new user for the linpha database. Always use the one you specified for all linpha operations..."; $n_runs = 1; if($_SESSION['sql_dbtype']=="mysql") { @@ -138,6 +137,7 @@ { echo warning_msg(); echo "<br />".tr("Failed To Create New User"); + echo "<br />".tr("Will use the one you specified for all linpha operations..."); } else { @@ -145,6 +145,7 @@ { echo warning_msg(); echo "<br />".tr("Failed To Create New User"); + echo "<br />".tr("Will use the one you specified for all linpha operations..."); } else { @@ -156,6 +157,7 @@ { echo warning_msg(); echo "<br />".tr("Failed To Create New User"); + echo "<br />".tr("Will use the one you specified for all linpha operations..."); } else { @@ -175,6 +177,7 @@ */ /** * prevent test running sqlite db + * @todo why?? -flo */ if($_SESSION['sql_dbtype'] != 'sqlite') { Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step9_createtables.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -115,32 +115,20 @@ * create cache directories */ echo "<br /><br />".tr("Creating Directories")."... "; - @mkdir( get_full_path( $_SESSION['cache_dir'] ), 0700 ); - - $imgcachedir = get_full_path( $_SESSION['cache_dir'] ).'img'; - $thumbcachedir = get_full_path( $_SESSION['cache_dir'] ).'thumb'; - @mkdir($imgcachedir, 0700); - for($i=0 ; $i<=9 ; $i++) - { - @mkdir($imgcachedir.'/'.$i, 0700); - } + mkdir( get_full_path( $_SESSION['cache_dir'] ), 0700 ); + mkdir(get_full_path( $_SESSION['cache_dir'] ).'img', 0700); + mkdir(get_full_path( $_SESSION['cache_dir'] ).'thumb', 0700); - @mkdir($thumbcachedir, 0700); - for($i=0 ; $i<=9 ; $i++) - { - @mkdir($thumbcachedir.'/'.$i, 0700); - } - /** * create tmp dirs */ - @mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); - //@mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); + mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); + //mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); /** * create sql dir */ - @mkdir( get_full_path( $_SESSION['sql_dir'] ), 0700 ); + mkdir( get_full_path( $_SESSION['sql_dir'] ), 0700 ); echo success_msg(); Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -37,13 +37,22 @@ */ function getFullPath($path) { - if(linFilesys::isAbsolutePath($path)) { - $full_path = $path; - } else { - $full_path = LINPHA_DIR.'/'.$path; + if( ! LinFilesys::isAbsolutePath($path)) + { + $path = LINPHA_DIR.'/'.$path; } - return $full_path; + /** + * remove ending '/' if exists + */ + $len = strlen( $path ); + $lastsign = substr( $path, $len-1); + if($lastsign == '/' OR $lastsign == '\\') + { + $path = substr($path,0,$len-1); + } + + return $path; } Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -52,7 +52,7 @@ */ if($tr_learn == true) { - $tmpfile = LINPHA_DIR."/var/tmp/lang.temp.txt"; + $tmpfile = LINPHA_DIR."/var/lang.temp.txt"; if(false == file_exists("$tmpfile")) { Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -103,7 +103,9 @@ * This function extends PHP's getimagesize() function. This include's * support for TIFF like files with PHP < 4.2.0 and others * - * @todo is this still necesarry using php > 5.x ??? + * @todo bzrudi: is this still necesarry using php > 5.x ??? + * @todo flo: yes i think so, imagemagick supports much more images than the gdlib + * but i don't now about the detectTiffType() stuff * * @author bzrudi,flo * @param string $path path to image @@ -145,9 +147,15 @@ if($return_value == 0) // identify succeed { - $g = explode( " ", $array_output[0] ); + if(isset($array_output[0])) + { + print_r($array_output); + exit(); + + $g = explode( " ", $array_output[0] ); - $g[2] = linIdentify::convertImagetype($g[2],$path); + $g[2] = linIdentify::convertImagetype($g[2],$path); + } } } } Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -52,23 +52,12 @@ function createThumbnail($id,$img_type,$force) { /** - * @todo remove workaround when installer implemented - */ - if( ! file_exists ( $GLOBALS['linpha']->sql->getPath('cache') . '/thumb' ) ) - { - mkdir( $GLOBALS['linpha']->sql->getPath('cache') . '/thumb' ); - } - - - $output = linSql::getCachePath('thumb',$id); - - - /** * check if thumbnail already exists OR if forced */ + $output = linSql::getCachePath('thumb',$id); if( ! file_exists( $output ) OR $force ) { - linSysLog('Create thumbnail '.$id.'<br />'); + linSysLog("Create thumbnail".$id."<br />"); /** * create subfolder if needed @@ -111,9 +100,8 @@ /** * create new tmp folder */ - $tmp_dir = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; - for($i=0; file_exists(linFilesys::getFullPath($tmp_dir).'thumb_folder_'.session_id().'_'.$i); $i++) { } - $tmp_folder = linFilesys::getFullPath($tmp_dir).'thumb_folder_'.session_id().'_'.$i; + for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } + $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; mkdir($tmp_folder,0700); /** @@ -167,84 +155,93 @@ */ $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); $album_dir = $GLOBALS['linpha']->sql->getPath('album'); - $src_file = $album_dir . implode('/',$array_path); + $src_file = $album_dir .'/'. implode('/',$array_path); - list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize( $src_file ); - - /** - * create video thumbnail - * @todo - */ - if( linIdentify::isVideo( $org_type ) ) + if(! file_exists($src_file)) { + echo $src_file.' '; + echo i18n("File doesnt exist anymore").'. '; + echo i18n("You should consider start a re-import of your files/folders").'<br />'; + } + else + { + list($org_width,$org_height,$org_type) = LinIdentify::linGetImageSize( $src_file ); + /** - * @todo $tmp_file = create_video_thumbnail($src_file); + * create video thumbnail + * @todo + */ + if( linIdentify::isVideo( $org_type ) ) + { + /** + * @todo $tmp_file = create_video_thumbnail($src_file); + */ + $output = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; + + } + /** + * create image thumbnail */ - $output = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; - + elseif( linIdentify::isSupportedImage( $org_type ) ) + { + /** + * read thumbsize + */ + $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_tn_size']; + $q = 75; + + + /*$max_width = $thumbsize; + $max_height = $thumbsize; + $w = $thumbsize; + $h = $thumbsize;*/ + + /** + * set parameters + */ + /*$array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); + $w = $array['w']; + $h = $array['h'];*/ + + + /** + * crop image + */ + $ratio = $org_width/$org_height; + if($ratio==1) + { + $x = 0; + $y = 0; + $w = $thumbsize; + $h = $thumbsize; + } + elseif($ratio>1) + { + $x = ( ($thumbsize*$ratio) - $thumbsize )/2; + $y = 0; + $w = ''; + $h = $thumbsize; + } + elseif($ratio<1) + { + $y = ( $thumbsize - ($thumbsize*$ratio) )/2; + $x = 0; + $w = $thumbsize; + $h = ''; + } + + $convert_str = 'convert'. + ' -quality '.$q. + ' -size '.$w.'x'.$h. // new size + ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop + ' '.lin_escape_string( $src_file ).'[0]'. // [0] -> take only first frame!!! + ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles + ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images + ' '.lin_escape_string( $output ); + + exec( $convert_str ); + } } - /** - * create image thumbnail - */ - elseif( linIdentify::isSupportedImage( $org_type ) ) - { - /** - * read thumbsize - */ - $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_tn_size']; - $q = 75; - - - /*$max_width = $thumbsize; - $max_height = $thumbsize; - $w = $thumbsize; - $h = $thumbsize;*/ - - /** - * set parameters - */ - /*$array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); - $w = $array['w']; - $h = $array['h'];*/ - - - /** - * crop image - */ - $ratio = $org_width/$org_height; - if($ratio==1) - { - $x = 0; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; - } - elseif($ratio>1) - { - $x = ( ($thumbsize*$ratio) - $thumbsize )/2; - $y = 0; - $w = ''; - $h = $thumbsize; - } - elseif($ratio<1) - { - $y = ( $thumbsize - ($thumbsize*$ratio) )/2; - $x = 0; - $w = $thumbsize; - $h = ''; - } - - $convert_str = 'convert'. - ' -quality '.$q. - ' -size '.$w.'x'.$h. // new size - ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop - ' '.lin_escape_string( $src_file ).'[0]'. // [0] -> take only first frame!!! - ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles - ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images - ' '.lin_escape_string( $output ); - - exec( $convert_str ); - } } } Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -47,7 +47,6 @@ public $photos_filtered; public $use_javascript; public $id_current, $id_parent, $img_type, $filename, $md5sum; -private $album_dir; private $nr_pages, $current_page; // only used if javascript disabled /** @@ -55,11 +54,6 @@ */ function __construct() { - /** - * get some variables - */ - $this->album_dir = $GLOBALS['linpha']->sql->getPath('album'); - } @@ -613,6 +607,7 @@ /** * setup random imgages view + * @todo what if the file doesnt exists anymore? */ function setRandomImages() { @@ -630,7 +625,7 @@ } $GLOBALS['linpha']->template->output['random_images'] = Array(); - $query = $GLOBALS['linpha']->db->SelectLimit("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 ORDER BY ".$str_random, $GLOBALS['nr_random_images']); + $query = $GLOBALS['linpha']->db->SelectLimit("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 ORDER BY ".$str_random, $GLOBALS['nr_random_images']); while($data = $query->FetchRow()) { $path = implode('/',linSql::getFullFilenameFromId($data['id'])); @@ -704,7 +699,8 @@ $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id_current ); - $this->full_filename = $this->album_dir.implode('/',$array_files); + $filename = LinSql::getPath('album').'/'.implode('/',$array_files); + $this->full_filename = LinFilesys::getFullPath( $filename ); $this->viewImg_viewReadImageInformation(); @@ -767,7 +763,7 @@ { include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); - $MetaData->saveExifData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); + $MetaData->saveExifData( $this->full_filename,$this->md5sum); } } @@ -784,7 +780,7 @@ { include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); - $MetaData->saveIptcData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); + $MetaData->saveIptcData( $this->full_filename,$this->md5sum); } } @@ -825,10 +821,10 @@ $value = $this->filename; break; case 'imagesize': - $value = filesize(LINPHA_DIR.'/'.$this->full_filename); + $value = filesize( $this->full_filename ); break; case 'dimension': - $array = linIdentify::linGetImageSize(LINPHA_DIR.'/'.$this->full_filename); + $array = LinIdentify::linGetImageSize( $this->full_filename ); $value = $array[0].'x'.$array[1]; break; } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -41,13 +41,12 @@ { if($parent_id == 0) { - $dirname = $GLOBALS['linpha']->sql->getPath('album'); + $dirname = LinSql::getPath('album'); } else { - $array = $GLOBALS['linpha']->sql->getFullFilenameFromId( $parent_id ); - $path_str = $GLOBALS['linpha']->sql->config->value['sys_path_album_dir'] . implode('/',$array) . '/'; - $dirname = linFilesys::getFullPath( $path_str ); + $array = LinSql::getFullFilenameFromId( $parent_id ); + $dirname = LinSql::getPath('album') .'/'. implode('/',$array); } if( ! file_exists( $dirname ) ) @@ -88,7 +87,7 @@ */ foreach($array_delete AS $key=>$value) { - linImport::deleteEntry( $key, $dirname.$value); + linImport::deleteEntry( $key, $dirname.'/'.$value); } /** @@ -107,38 +106,38 @@ } elseif($value{0} == '.') { - //linSysLog('hidden'); + linSysLog("File ".$dirname.'/'.$value." Is Hidden<br />"); } elseif( in_array( $value, linImport::getIgnoreFilelist() ) ) { - //linSysLog('ignore'); + linSysLog("File ".$dirname.'/'.$value." Is In The Ignore List<br />"); } elseif( in_array($ext, linImport::getIgnoreFileext() ) ) { - //linSysLog('ignore'); + linSysLog("File ".$dirname.'/'.$value." Is In The Ignore List<br />"); } - elseif( !is_readable( $dirname.$value) ) + elseif( !is_readable( $dirname.'/'.$value) ) { - //linSysLog('not readable'); + linSysLog("File ".$dirname.'/'.$value." Is Not Readable<br />"); } /** * no need for is_link as links are detected correctly * with is_file, is_dir and is_readable ! - * elseif( is_link ($name.'/'.$value ) ) + * elseif( is_link ($dirname.'/'.$value ) ) { linSysLog('link'); }*/ - elseif( is_file( $dirname.$value ) ) + elseif( is_file( $dirname.'/'.$value ) ) { linImport::addNewFile( $parent_id, $dirname , $value ); } - elseif( is_dir( $dirname.$entry ) ) + elseif( is_dir( $dirname.'/'.$entry ) ) { linImport::addNewDir( $parent_id, $dirname , $value , $recursive); } else { - linSysLog('Error: what am i? '.$dirname.$entry.'<br />'); + linSysLog('Error: what am i? '.$dirname.'/'.$entry.'<br />'); } } @@ -172,53 +171,49 @@ */ function addNewFile( $parent_id , $dirname , $filename ) { - linSysLog('new file '.$dirname.$filename.'<br />'); + linSysLog('new file '.$dirname.'/'.$filename.'<br />'); - list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize($dirname.$filename); - if( linIdentify::isVideo($org_type) OR linIdentify::isSupportedImage($org_type)) - { - /** - * calculate md5sum (not for videos we have - * plenty of memory_limit problems here...) - * - * -> but we need an md5sum for statistics, comments, etc. - * -> calculate one of the full filename - * -> with a re-import all is lost... - * - * @todo as we're using php >= 5.0 in linpha 2.0, we can use the builtin md5_file - * do we have such limits with this function either??? - */ - if( linIdentify::isVideo($org_type) ) - { - $md5sum = md5($dirname.'/'.$filename); - } - elseif( linIdentify::isSupportedImage($org_type) ) - { - $md5sum = md5_file($dirname.'/'.$filename); - } - - - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( " . - "parent_id , name, img_type , md5sum , time_add , time_mod , stats_numbers ) " . - "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . - "'".$org_type."' , '".$md5sum."', '".time()."', '".time()."', '1' )"); + list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize($dirname.'/'.$filename); - /** - * delete thumbnail if one exists with the same id - */ - $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); - linImage::deleteThumbnail($inserted_id); - - /** - * update number of photos - */ - linImport::updateNumberPhotos( $parent_id ); + /** + * calculate md5sum (not for videos we have + * plenty of memory_limit problems here...) + * + * -> but we need an md5sum for statistics, comments, etc. + * -> calculate one of the full filename + * -> with a re-import all is lost... + * + * @todo as we're using php >= 5.0 in linpha 2.0, we can use the builtin md5_file + * do we have such limits with this function either??? + */ + if( linIdentify::isVideo($org_type) ) + { + $md5sum = md5($dirname.'/'.$filename); } + elseif( linIdentify::isSupportedImage($org_type) ) + { + $md5sum = md5_file($dirname.'/'.$filename); + } else { - linSysLog("Omitting not supported file or broken image: " . - "<b>".$filename."</b> (Reported type: ".$org_type.")<br />"); + $md5sum = ''; } + + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( " . + "parent_id , name, img_type , md5sum , time_add , time_mod , stats_numbers ) " . + "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . + "'".$org_type."' , '".$md5sum."', '".time()."', '".time()."', '1' )"); + + /** + * delete thumbnail if one exists with the same id + */ + $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); + linImage::deleteThumbnail($inserted_id); + + /** + * update number of photos + */ + linImport::updateNumberPhotos( $parent_id ); } @@ -231,7 +226,7 @@ */ function addNewDir( $parent_id , $dirname , $filename , $recursive) { - linSysLog('new dir '.$dirname .$filename.'<br />'); + linSysLog('new dir '.$dirname .'/'.$filename.'<br />'); $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos " . "( parent_id , img_type , name , time_add , time_mod )" . @@ -246,7 +241,7 @@ if($recursive) { - linImport::addNewSubEntry( $inserted_id , $dirname.$filename.'/' , $recursive); + linImport::addNewSubEntry( $inserted_id , $dirname.'/'.$filename , $recursive); } } @@ -280,7 +275,7 @@ { linSysLog('ignore'); } - elseif( !is_readable( $dirname.$entry) ) + elseif( !is_readable( $dirname.'/'.$entry) ) { linSysLog('not readable'); } @@ -290,11 +285,11 @@ { echo 'link'; }*/ - elseif( is_file( $dirname.$entry ) ) + elseif( is_file( $dirname.'/'.$entry ) ) { linImport::addNewFile( $parent_id, $dirname , $entry ); } - elseif( is_dir( $dirname.$entry ) ) + elseif( is_dir( $dirname.'/'.$entry ) ) { linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -56,13 +56,9 @@ include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); $sql_dir = ''; - /** - * @todo get /var value from config table - */ - include_once(LINPHA_DIR.'/var/config.dir.php'); - $include_file = linFilesys::getFullPath( $sql_dir ).'config.sql.php'; + $include_file = LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php'; if( file_exists($include_file) ) { include_once( $include_file ); @@ -87,12 +83,12 @@ { if(isset($_SESSION['installmode1'])) { - $sql_dir = linFilesys::getFullPath($_SESSION['sql_dir']); - $GLOBALS['linpha']->db->Connect($sql_dir.'database.sqlite'); + $sql_dir = LinFilesys::getFullPath($_SESSION['sql_dir']); + $GLOBALS['linpha']->db->Connect($sql_dir.'/database.sqlite'); } else { - $GLOBALS['linpha']->db->Connect(LINPHA_DIR."/"."$sql_dir".'database.sqlite'); + $GLOBALS['linpha']->db->Connect(LinFilesys::getFullPath( $sql_dir ).'/database.sqlite'); } break; } @@ -148,7 +144,7 @@ */ if( ! isset($_SESSION['installmode2']) ) { - $this->config = new linSqlConfig(); + $this->config = new LinSqlConfig(); } } // end function dbConnect @@ -406,16 +402,17 @@ /** * returns the correct path to the albums directory + * pay attention to use this getPath and not access directly 'sys_path_album_dir' ! */ function getPath($what) { $path = $GLOBALS['linpha']->sql->config->value['sys_path_'.$what.'_dir']; - return linFilesys::getFullPath( $path ); + return LinFilesys::getFullPath( $path ); } function getCachePath($what,$id) { - $path = linSql::getPath('cache'); + $path = LinSql::getPath('cache'); if(strlen($id)==1) { @@ -426,7 +423,7 @@ $subdir = substr($id,0,2); } - return $path . $what .'/' .$subdir .'/'.$id .'.jpg'; + return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; } } // end class linSql @@ -435,7 +432,7 @@ /** * sub-class linSqlConfig */ -class linSqlConfig +class LinSqlConfig { public $value; Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/modules/module.albums.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -73,7 +73,7 @@ "WHERE img_type = '0' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); $array_files = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, stats_numbers, time_add FROM ".PREFIX."photos " . - "WHERE img_type <> '0' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); + "WHERE img_type <> '0' AND img_type <> '9999999' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); $linpha->imgview->photos = array_merge($array_folders,$array_files); Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-04-01 11:09:56 UTC (rev 4467) @@ -1,5 +1,5 @@ #main { -/* min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ + min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ } /** Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/templates/default/home.html.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -47,7 +47,7 @@ . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> <div class='div_folder_text'> - <h2><?php echo $value['name']; ?></h2> + <h2><?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-01 12:16:59
|
Revision: 4468 Author: fangehrn Date: 2006-04-01 04:16:49 -0800 (Sat, 01 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4468&view=rev Log Message: ----------- * big improvement in the import scripts -> removed redundancy -> added a "force_update" helpful to detect file permission changes! -> added possibility to check changes in the md5sum! for example: if the file is edited with an external program, linpha will now be able to check this and update the md5sum in the stats, comments etc.! (but the database has been up-to-date) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.import.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-01 11:09:56 UTC (rev 4467) +++ trunk/linpha2/ChangeLog 2006-04-01 12:16:49 UTC (rev 4468) @@ -7,6 +7,15 @@ * installer tested -> it works :-) + * big improvement in the import scripts + -> removed redundancy + -> added a "force_update" + helpful to detect file permission changes! + -> added possibility to check changes in the md5sum! + for example: if the file is edited with an external program, linpha will now be able + to check this and update the md5sum in the stats, comments etc.! + (but the database has been up-to-date) + 2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer: + at least mysql installation should work now Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-01 11:09:56 UTC (rev 4467) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-01 12:16:49 UTC (rev 4468) @@ -79,21 +79,21 @@ function set_navigation_line( $id ) { - $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); $str = '<a href="'.LINPHA_DIR.'/?cat=alb&id=0">></a> '; + $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); foreach($array_files AS $key=>$value) { if($value != "") { - $str .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$key.'">'.$value.'</a> > '; + $array_values[] = '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$key.'">'.$value.'</a>'; } } - /** - * remove last spacer signs - */ - $str = substr($str,0,strlen($str)-6); + if(isset($array_values)) + { + $str .= implode(' > ',$array_values); + } return $str; Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-01 11:09:56 UTC (rev 4467) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-01 12:16:49 UTC (rev 4468) @@ -62,7 +62,10 @@ $d = dir( $dirname ); while( false !== ($entry = $d->read() ) ) { - $importarray_folder[] = $entry; + if($entry != '.' AND $entry != '..') + { + $importarray_folder[] = $entry; + } } /** @@ -81,6 +84,7 @@ */ $array_new = array_diff($importarray_folder, $importarray_db); $array_delete = array_diff($importarray_db, $importarray_folder); + $array_update = array_intersect($importarray_db,$importarray_folder); /** * parse deleted entries @@ -95,50 +99,19 @@ */ foreach($array_new AS $value) { - /** - * no output as it would occur on each view! - */ - $ext = linFilesys::getFileExtFromPath($value); - - if($value == '.' OR $value == '..') + LinImport::addNewEntry( $parent_id , $dirname , $value, $recursive ); + } + + /** + * parse updated entries + * not by default! (performance issues) + */ + if(isset($force_update) OR isset($_GET['force_update'])) + { + foreach($array_update AS $key=>$value) { - //no output + LinImport::updateEntry( $key , $dirname , $value ); } - elseif($value{0} == '.') - { - linSysLog("File ".$dirname.'/'.$value." Is Hidden<br />"); - } - elseif( in_array( $value, linImport::getIgnoreFilelist() ) ) - { - linSysLog("File ".$dirname.'/'.$value." Is In The Ignore List<br />"); - } - elseif( in_array($ext, linImport::getIgnoreFileext() ) ) - { - linSysLog("File ".$dirname.'/'.$value." Is In The Ignore List<br />"); - } - elseif( !is_readable( $dirname.'/'.$value) ) - { - linSysLog("File ".$dirname.'/'.$value." Is Not Readable<br />"); - } - /** - * no need for is_link as links are detected correctly - * with is_file, is_dir and is_readable ! - * elseif( is_link ($dirname.'/'.$value ) ) - { - linSysLog('link'); - }*/ - elseif( is_file( $dirname.'/'.$value ) ) - { - linImport::addNewFile( $parent_id, $dirname , $value ); - } - elseif( is_dir( $dirname.'/'.$entry ) ) - { - linImport::addNewDir( $parent_id, $dirname , $value , $recursive); - } - else - { - linSysLog('Error: what am i? '.$dirname.'/'.$entry.'<br />'); - } } /** @@ -151,7 +124,7 @@ "AND parent_id = '".$parent_id."'"); while($data = $query->FetchRow(ADODB_FETCH_ASSOC)) { - linImport::updateDir($data['id'], $recursive); + LinImport::updateDir($data['id'], $recursive); } } } @@ -169,79 +142,33 @@ * @param string $dirname name of current directory * @param string $filename filename of file currently processed */ -function addNewFile( $parent_id , $dirname , $filename ) +function addNewEntry( $parent_id , $dirname , $filename , $recursive ) { - linSysLog('new file '.$dirname.'/'.$filename.'<br />'); + linSysLog('new '.$dirname.'/'.$filename.'<br />'); - list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize($dirname.'/'.$filename); - /** - * calculate md5sum (not for videos we have - * plenty of memory_limit problems here...) - * - * -> but we need an md5sum for statistics, comments, etc. - * -> calculate one of the full filename - * -> with a re-import all is lost... - * - * @todo as we're using php >= 5.0 in linpha 2.0, we can use the builtin md5_file - * do we have such limits with this function either??? - */ - if( linIdentify::isVideo($org_type) ) - { - $md5sum = md5($dirname.'/'.$filename); - } - elseif( linIdentify::isSupportedImage($org_type) ) - { - $md5sum = md5_file($dirname.'/'.$filename); - } - else - { - $md5sum = ''; - } - + list($md5sum,$file_type,$stats_number) = LinImport::getFileInformation($dirname,$filename); + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( " . "parent_id , name, img_type , md5sum , time_add , time_mod , stats_numbers ) " . "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . - "'".$org_type."' , '".$md5sum."', '".time()."', '".time()."', '1' )"); + "'".$file_type."' , '".$md5sum."', '".time()."', '".time()."', '".$stats_number."' )"); /** * delete thumbnail if one exists with the same id */ $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); - linImage::deleteThumbnail($inserted_id); + LinImage::deleteThumbnail($inserted_id); /** * update number of photos */ - linImport::updateNumberPhotos( $parent_id ); -} + LinImport::updateNumberPhotos( $parent_id ); -/** - * import new directory - * @param int $parent_id parent id of folder in database - * @param string $dirname name of current directory - * @param string $filename filename of file currently processed - * @param bool $recursive scan directory recursive if true - */ -function addNewDir( $parent_id , $dirname , $filename , $recursive) -{ - linSysLog('new dir '.$dirname .'/'.$filename.'<br />'); - - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos " . - "( parent_id , img_type , name , time_add , time_mod )" . - " VALUES ( '".$parent_id."' , '0' , '". linSql::linAddSlashes($filename)."' , '".time()."' , '".time()."' )"); - - /** - * delete thumbnail if one exists with the same id - */ - $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); - linImage::deleteThumbnail($inserted_id); - - if($recursive) + if($recursive && $file_type == 0) { - - linImport::addNewSubEntry( $inserted_id , $dirname.'/'.$filename , $recursive); + LinImport::addNewSubDir( $inserted_id , $dirname.'/'.$filename , $recursive); } } @@ -252,53 +179,16 @@ * @param string $dirname name of current directory * @param bool $recursive scan directory recursive if true */ -function addNewSubEntry( $parent_id , $dirname , $recursive) +function addNewSubDir( $parent_id , $dirname , $recursive) { $d = dir( $dirname ); - while( false !== ($entry = $d->read() ) ) { - $ext = linFilesys::getFileExtFromPath($entry); - if($entry == '.' OR $entry == '..') - { - //no output - } - elseif($entry{0} == '.') - { - linSysLog('hidden'); - } - elseif( in_array( $entry, linImport::getIgnoreFilelist() ) ) - { - linSysLog('ignore'); - } - elseif( in_array($ext, linImport::getIgnoreFileext() ) ) - { - linSysLog('ignore'); - } - elseif( !is_readable( $dirname.'/'.$entry) ) - { - linSysLog('not readable'); - } - /** - * no need for is_link as links are detected correctly with is_file, is_dir and is_readable ! - * elseif( is_link ($name.'/'.$entry ) ) - { - echo 'link'; - }*/ - elseif( is_file( $dirname.'/'.$entry ) ) - { - linImport::addNewFile( $parent_id, $dirname , $entry ); - } - elseif( is_dir( $dirname.'/'.$entry ) ) - { - linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); - } + LinImport::addNewEntry( $parent_id , $dirname , $entry, $recursive ); } $d->close(); +} -} // end function addNew - - /** * recursive delete entries * @param int $photo_id id of current image in database @@ -338,7 +228,41 @@ } } +/** + * update entry (check md5sum and file_type) + * the file_type changes if a file changes to readable + */ +function updateEntry( $id , $dirname , $filename ) +{ + list($md5sum,$file_type,$stats_number) = LinImport::getFileInformation($dirname,$filename); + + $data = $GLOBALS['linpha']->db->GetRow("SELECT img_type, md5sum " . + "FROM ".PREFIX."photos WHERE id = '".$id."'"); + + /** + * update file_type + */ + if($file_type != $data[0]) + { + linSysLog("Detected a change of file_type in: ".$dirname.'/'.$filename.'<br />'); + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos " . + "SET img_type = '".$file_type."', stats_numbers = '".$stats_number."' " . + "WHERE id = '".$id."'"); + } + + /** + * update md5sum + */ + /** + * @todo hey, thats a nice feature! we are now able to detect + * changes on images and update the md5sum of the images in the comments etc.!! + */ + if($md5sum != $data[1]) + { + } +} + /** * update recursively number of photos in parent directories * @param int $id id of current image in database @@ -360,48 +284,82 @@ } } - /** - * print file table - * @todo $parent_id is defined but not used in function? + * returns an array containing md5sum, file_type and number of images + * number of images: 0 default, 1 if is_video or is_supported_image */ -function printFiles( $parent_id ) +function getFileInformation($dirname,$filename) { - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, img_type, parent_id " . - "FROM ".PREFIX."photos "); - rs2html($query,'',array('id','name','img_type','parent_id')); + $md5sum = ''; + $stats_number = 0; + $ext = linFilesys::getFileExtFromPath($filename); + if($filename{0} == '.') + { + linSysLog("File ".$dirname.'/'.$filename." Is Hidden<br />"); + $file_type = 9999999; + } + elseif( in_array( $filename, linImport::getIgnoreFilelist() ) ) + { + linSysLog("File ".$dirname.'/'.$filename." Is In The Ignore List<br />"); + $file_type = 9999999; + } + elseif( in_array($ext, linImport::getIgnoreFileext() ) ) + { + linSysLog("File ".$dirname.'/'.$filename." Is In The Ignore List<br />"); + $file_type = 9999999; + } + elseif( !is_readable( $dirname.'/'.$filename) ) + { + linSysLog("File ".$dirname.'/'.$filename." Is Not Readable<br />"); + $file_type = 9999999; + } + /** + * no need for is_link as links are detected correctly + * with is_file, is_dir and is_readable ! + * elseif( is_link ($dirname.'/'.$value ) ) + { + linSysLog('link'); + }*/ + elseif( is_dir( $dirname.'/'.$filename ) ) + { + $file_type = 0; + } + elseif( is_file( $dirname.'/'.$filename ) ) + { + list($org_width,$org_height,$file_type) = LinIdentify::linGetImageSize($dirname.'/'.$filename); - echo '<br />'; + /** + * calculate md5sum (not for videos we have + * plenty of memory_limit problems here...) + * + * -> but we need an md5sum for statistics, comments, etc. + * -> calculate one of the full filename + * -> with a re-import all is lost... + * + * @todo as we're using php >= 5.0 in linpha 2.0, we can use the builtin md5_file + * do we have such limits with this function either??? + */ + if( LinIdentify::isVideo($file_type) ) + { + $md5sum = md5($dirname.'/'.$filename); + $stats_number = 1; + } + elseif( LinIdentify::isSupportedImage($file_type) ) + { + $md5sum = md5_file($dirname.'/'.$filename); + $stats_number = 1; + } + } + else + { + linSysLog('Error: what am i? '.$dirname.'/'.$filename.'<br />'); + } + + return array($md5sum,$file_type,$stats_number); } - /** - * prints out the table with file permissions - */ -function printPermTable() -{ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, photos_id, perm_type, permission " . - "FROM ".PREFIX."permissions"); - rs2html($query,'',array('id','photos_id','perm_type','permission')); - - - echo '<br />'; -} // end function printPermTable - - -/** - * truncate table - */ -function emptyTable() -{ - $GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."photos"); - -} // end function emptyTable - - - -/** * get an array with ignored filenames * * @author flo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-01 12:19:23
|
Revision: 4469 Author: fangehrn Date: 2006-04-01 04:19:15 -0800 (Sat, 01 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4469&view=rev Log Message: ----------- * moved path of lang.temp.txt from ./var/tmp to ./var as tmp doesnt exists all the time (during install) and ./var is always writable Modified Paths: -------------- trunk/linpha2/ChangeLog Property Changed: ---------------- trunk/linpha2/var/ Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-01 12:16:49 UTC (rev 4468) +++ trunk/linpha2/ChangeLog 2006-04-01 12:19:15 UTC (rev 4469) @@ -15,6 +15,9 @@ for example: if the file is edited with an external program, linpha will now be able to check this and update the md5sum in the stats, comments etc.! (but the database has been up-to-date) + + * moved path of lang.temp.txt from ./var/tmp to ./var as tmp doesnt exists all the time (during install) + and ./var is always writable 2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer: Property changes on: trunk/linpha2/var ___________________________________________________________________ Name: svn:ignore - cache sql tmp config.dir.php + cache sql tmp config.dir.php lang.temp.txt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-01 16:15:35
|
Revision: 4470 Author: fangehrn Date: 2006-04-01 08:15:21 -0800 (Sat, 01 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4470&view=rev Log Message: ----------- * improving template Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/templates/default/css/global.css trunk/linpha2/templates/default/css/view_img.css trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/view_img.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/ChangeLog 2006-04-01 16:15:21 UTC (rev 4470) @@ -19,6 +19,8 @@ * moved path of lang.temp.txt from ./var/tmp to ./var as tmp doesnt exists all the time (during install) and ./var is always writable + * improving template + 2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer: + at least mysql installation should work now Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 16:15:21 UTC (rev 4470) @@ -865,7 +865,7 @@ $id = $this->photos_filtered[$key]['id']; $name = $this->photos_filtered[$key]['name']; - $str = '<div class="div_'.$class.'thumb">' + $str = '<div class="thumbnavi_'.$class.'thumb">' . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&id='.$id.'">' . '<img class="img_'.$class.'thumb" src="'.LINPHA_DIR.'/get_thumb.php?id='.$id.'" /></a>' . '<br />'.$name.'</div>'."\n"; @@ -969,7 +969,7 @@ /** * set current thumb and image */ - $GLOBALS['linpha']->template->output['image'] = '<img class="mainimage" src="'.LINPHA_DIR.'/get_thumb.php?id=' + $GLOBALS['linpha']->template->output['image'] = '<img id="mainimage" src="'.LINPHA_DIR.'/get_thumb.php?id=' . $this->photos_filtered[$this->current_key]['id'] . '" />' . '<br />'.$this->photos_filtered[$this->current_key]['name']; Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-04-01 16:15:21 UTC (rev 4470) @@ -97,7 +97,7 @@ function printMenu($index) { echo "\n".'<ul>'."\n"; - echo "\t".'<li><span>'.i18n("More").' v</span>'."\n"; + echo "\t".'<li><span>'.i18n("More").' </span>'."\n"; echo "\n".'<ul>'."\n"; foreach($GLOBALS['linpha']->template->output['menu_'.$index] AS $key=>$value) @@ -108,7 +108,7 @@ } else { - echo "\t".'<li><span>'.$value['name'].' ></span>'."\n"; + echo "\t".'<li><span>'.$value['name'].' </span>'."\n"; echo "\t".'<ul>'."\n"; @@ -120,7 +120,7 @@ } else { - echo "\t\t".'<li><span>'.$sub_value['name'].' ></span>'."\n"; + echo "\t\t".'<li><span>'.$sub_value['name'].' </span>'."\n"; echo "\t\t".'<ul>'."\n"; Modified: trunk/linpha2/templates/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/css/global.css 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/templates/default/css/global.css 2006-04-01 16:15:21 UTC (rev 4470) @@ -21,6 +21,15 @@ } /** + * background color + * #divthumbnavi used in view_img.html.php + */ +#divleft, #divmain, #divright, #divthumbnavi { + background-color: #f90; +} + + +/** * title */ #title @@ -44,14 +53,15 @@ /** * left */ - #left + #divleft { position: absolute; - top: 160px; + top: 120px; left: 10px; - + } + #left + { width: 205px; - min-height: 400px; padding: 5px; margin: 0px; @@ -70,14 +80,28 @@ * main */ #divmain { - margin: 0px 10px 10px 10px; + margin: 0px 10px 10px 10px; } #main { - /*background-color: #d5eeff;*/ - /*border: 1px solid #09f;*/ padding: 5px; } +/** + * right + */ + #divright + { + position: absolute; + top: 280px; + right: 10px; + } + #right + { + width: 205px; + + padding: 5px; + margin: 0px; + } /** * menu @@ -156,7 +180,7 @@ margin: 0; padding: 0; } - #menu ul ul a, #menu ul ul span { + #menu ul ul a, #menu ul ul span, #menu ul ul div { display: block; margin: 0; @@ -173,6 +197,12 @@ background: #eeeeee; } + #menu ul span { + background: #ffffff url(../images/expand.gif) no-repeat 100% 100%; + } + #menu ul ul span { + background: #eeeeee url(../images/expand.gif) no-repeat 100% 100%; + } /** * the most important thing @@ -211,10 +241,6 @@ /** * rounded corner stuff */ - #divmain { - background-color: #f90; - } - .roundtop { background: url(../images/tr.gif) no-repeat top right; } Modified: trunk/linpha2/templates/default/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/css/view_img.css 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/templates/default/css/view_img.css 2006-04-01 16:15:21 UTC (rev 4470) @@ -1,65 +1,46 @@ #navigation { - margin: 10px 10px 10px 237px; + margin: 10px 237px 10px 10px; } +#divmain { + margin: 10px 237px 10px 10px; +} #main { text-align: center; } -.mainimage { +#mainimage { width: 350px; height: auto; } /** - * comment stuff + * thumb navigation stuff */ - .add_comment { - color: #036; - width: 600px; - text-align: left; - margin-left: 100px; + #divthumbnavi { + margin: 10px 10px 10px 10px; } - .add_comment input, .add_comment textarea { - background-color: #d5eeff; - } - - .comments { - border: 1px solid #09f; - width: 200px; - margin: 5px; - margin-left: 150px; - } - -/** - * navigation stuff - */ - .div_all_main { + #thumbnavi { position: relative; - - background-color: #d5fcf4; - border: 1px solid #0c9; - margin: 10px 10px 10px 237px; height: 120px; - + font-size: 0.5em; text-align: center; - font-size: 0.5em; } - .div_all_prevthumb { + .thumbnavi_prevthumb { position: absolute; right: 50%; margin-right: 50px; } - .div_all_nextthumb { + .thumbnavi_nextthumb { position: absolute; left: 50%; margin-left: 50px; } - .div_prevnextthumb { + .thumbnavi_prevnextthumb { /*border: 1px solid #000000;*/ float: left; width: 90px; @@ -67,7 +48,7 @@ margin: 2px; } - .div_currentthumb { + .thumbnavi_currentthumb { /*border: 1px solid #000000;*/ position: absolute; left: 50%; @@ -87,4 +68,24 @@ width: 50px; height: auto; border: 0px; + } + +/** + * comment stuff + */ + .add_comment { + color: #036; + width: 600px; + text-align: left; + margin-left: 100px; + } + .add_comment input, .add_comment textarea { + background-color: #d5eeff; + } + + .comments { + border: 1px solid #09f; + width: 200px; + margin: 5px; + margin-left: 150px; } \ No newline at end of file Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/templates/default/global.html.php 2006-04-01 16:15:21 UTC (rev 4470) @@ -75,7 +75,7 @@ <li><a href="./"><?php echo i18n("Home"); ?></a></li> </ul> <ul> - <li><span><?php echo i18n("Search"); ?> v</span> + <li><span><?php echo i18n("Search"); ?> </span> <ul> <li><a href="./?cat=search"><?php echo i18n("Extended Search"); ?></a></li> <li> @@ -89,14 +89,14 @@ </ul> <ul> <li> - <span><?php echo i18n("Login"); ?> v</span> + <span><?php echo i18n("Login"); ?> </span> <ul> <li> - <span> + <div> <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> - </span> + </div> </li> </ul> </li> Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2006-04-01 12:19:15 UTC (rev 4469) +++ trunk/linpha2/templates/default/view_img.html.php 2006-04-01 16:15:21 UTC (rev 4470) @@ -1,68 +1,95 @@ -<div id="left"> - <?php - foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) - { - echo $value['name'].': '.$value['value'].'<br />'; - } - ?> -</div> - <?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> <div id="navigation"> <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> </div> <?php } ?> -<div class="div_all_main"> - <div class="div_all_prevthumb"> - <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> +<div id="divthumbnavi"> + <div class="roundtop"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/tl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> </div> - <?php echo $GLOBALS['linpha']->template->output['current_thumb']; ?> - <div class="div_all_nextthumb"> - <?php echo $GLOBALS['linpha']->template->output['next_thumb']; ?> + + <div id="thumbnavi"> + <div class="thumbnavi_prevthumb"> + <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> + </div> + <?php echo $GLOBALS['linpha']->template->output['current_thumb']; ?> + <div class="thumbnavi_nextthumb"> + <?php echo $GLOBALS['linpha']->template->output['next_thumb']; ?> + </div> </div> + + <div class="roundbottom"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/bl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> </div> -<div id="main"> +<div id="divmain"> + <div class="roundtop"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/tl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> + <div id="main"> -<!-- show image --> -<?php echo $GLOBALS['linpha']->template->output['image']; ?> -<br /><br /> + <!-- show image --> + <?php echo $GLOBALS['linpha']->template->output['image']; ?> + <br /><br /> + + <!-- show add comment form --> + <div class="add_comment"> + <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> + <?php echo i18n("Add Comment"); ?>:<br /> + <div id="comment_div_text"> + <input type="text" id="comment_input_text" name="comment_text" value="" tabindex="1" size="40" maxlength="40" /> + <a href="javascript:open_textarea()">(+)</a> + </div> + <textarea style="display: none;" id="comment_textarea" name="comment_textarea" tabindex="1" rows="10" cols="50"></textarea> + <?php echo i18n("Name"); ?>: <input type="text" name="author" value="" tabindex="2" size="10" maxlength="40" /> + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" value="<?php echo i18n("submit"); ?>" /> + </form> + </div> + <br /><br /> + + <!-- show image comments --> + <?php while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) { ?> + <div class="comments"> + <?php echo $data['time']; ?> <?php echo $data['author']; ?> + <br /> + <?php echo $data['comment']; ?> + <br /><br /> + </div> + <?php } ?> + + <script language="JavaScript" type="text/javascript"> + function open_textarea() + { + document.getElementById('comment_textarea').style.display = 'block'; + document.getElementById('comment_div_text').style.display = 'none'; + + document.getElementById('comment_textarea').value = document.getElementById('comment_input_text').value; + } + </script> -<!-- show add comment form --> -<div class="add_comment"> -<form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> -<?php echo i18n("Add Comment"); ?>:<br /> -<div id="comment_div_text"> -<input type="text" id="comment_input_text" name="comment_text" value="" tabindex="1" size="40" maxlength="40" /> -<a href="javascript:open_textarea()">(+)</a> -</div> -<textarea style="display: none;" id="comment_textarea" name="comment_textarea" tabindex="1" rows="10" cols="50"></textarea> -<?php echo i18n("Name"); ?>: <input type="text" name="author" value="" tabindex="2" size="10" maxlength="40" /> -<input type="hidden" name="cmd" value="add_comment" /> -<input type="submit" name="submit" value="<?php echo i18n("submit"); ?>" /> -</form> -</div> -<br /><br /> - -<!-- show image comments --> -<?php while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) { ?> - <div class="comments"> - <?php echo $data['time']; ?> <?php echo $data['author']; ?> - <br /> - <?php echo $data['comment']; ?> - <br /><br /> </div> -<?php } ?> + <div class="roundbottom"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/bl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> </div> -<script language="JavaScript" type="text/javascript"> -function open_textarea() -{ - document.getElementById('comment_textarea').style.display = 'block'; - document.getElementById('comment_div_text').style.display = 'none'; - - document.getElementById('comment_textarea').value = document.getElementById('comment_input_text').value; -} -</script> \ No newline at end of file +<div id="divright" + <div class="roundtop"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/tl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> + <div id="right"> + <?php + foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) + { + echo $value['name'].': '.$value['value'].'<br />'; + } + ?> + </div> + <div class="roundbottom"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/bl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> +</div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-02 12:52:07
|
Revision: 4472 Author: fangehrn Date: 2006-04-02 05:51:42 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4472&view=rev Log Message: ----------- * added integrity check (checks album, tmp and cache folder) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/image_fields_select.php trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/include/common.php trunk/linpha2/linpha2.specs.txt Added Paths: ----------- trunk/linpha2/docs/ trunk/linpha2/docs/dev/ trunk/linpha2/lib/include/integrity.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/ChangeLog 2006-04-02 12:51:42 UTC (rev 4472) @@ -1,3 +1,6 @@ +2006-04-02 flo + * added integrity check (checks album, tmp and cache folder) + 2006-04-01 flo * update several folder paths -> it should now work if you specify an other album dir than ./albums Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/admin/image_fields_select.php 2006-04-02 12:51:42 UTC (rev 4472) @@ -8,6 +8,7 @@ $array_menu = Array( 'image' => Array('name' => 'Image', 'link' => 'imagefields_select_image'), + 'thumb' => Array('name' => 'Thumbnail', 'link' => 'imagefields_select_thumb'), 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video'), 'album' => Array('name' => 'Album', 'link' => 'imagefields_select_album') ); @@ -159,11 +160,16 @@ </form> <?php break; -case 'video': -?> +case 'thumb': -<?php + break; + +case 'video': + ?> + + <?php + break; } ?> Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/index.php 2006-04-02 12:51:42 UTC (rev 4472) @@ -9,6 +9,8 @@ include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new linpha(); $linpha->sql->startSession(); + + include_once(LINPHA_DIR.'/lib/include/integrity.php'); if(!isset($_GET['cat'])) { Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/lib/classes/linpha.class.php 2006-04-02 12:51:42 UTC (rev 4472) @@ -22,7 +22,7 @@ * This is the base class which needs to be included. It takes care of * including a number of class files and sets up basic things. */ -if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } +if(!defined('LINPHA_DIR')) { exit(1); } /** * installation check Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-02 12:51:42 UTC (rev 4472) @@ -161,6 +161,9 @@ $this->filterPhotosNotPermitted(); $this->setMenu(); + if(isset($_GET['admin_cmd'])) { + $this->adminCommands(); + } /** * set mode specific things @@ -364,7 +367,28 @@ } } +/** + * method for special admin commands, like rotating images, import stuff etc. + * @uses LinImgView::buildImgView() + */ +function adminCommands() +{ + switch($_GET['admin_cmd']) + { + case 'recreate': + LinImage::createThumbnail($this->id_current,$this->img_type,$force=true); + break; + case 'rotate_left': + case 'rotate_right': + break; + } +} + + + + + /** * define thumbnail view */ @@ -676,6 +700,11 @@ } + + + + + /** * setup comment view */ @@ -716,7 +745,6 @@ $GLOBALS['linpha']->template->output['comment'] = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); } - /** * setup image view */ Modified: trunk/linpha2/lib/include/common.php =================================================================== --- trunk/linpha2/lib/include/common.php 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/lib/include/common.php 2006-04-02 12:51:42 UTC (rev 4472) @@ -2,57 +2,59 @@ if(!defined('LINPHA_DIR')) { exit(1); } /** -* This file removes the magic quotes -* always include this file with *include_once* to prevent multiple remove of magic quotes! -* -* Magic-quotes was added to reduce code written by beginners from being dangerous. -* If you disable magic quotes, you must be very careful -* to protect yourself from SQL injection attacks. -* For details see http://www.php.net/manual/en/function.get-magic-quotes-gpc.php -* -* @author flo -*/ - -/** -* Disabling magic quotes at runtime -* for example fread() -*/ -set_magic_quotes_runtime(0); - -/** -* Remove magic quotes for get, post and cookie data -* We can't disable it, because we are already too late -* It could also be done with a directive in a .htaccess file -* (php_value magic_quotes_gpc 0) -*/ -if (get_magic_quotes_gpc()) { - function stripslashes_deep($value) - { - $value = is_array($value) ? - array_map('stripslashes_deep', $value) : - stripslashes($value); - - return $value; - } + * Magic Quotes stuff + */ + /** + * always include this file with *include_once* to prevent multiple remove of magic quotes! + * + * Magic-quotes was added to reduce code written by beginners from being dangerous. + * If you disable magic quotes, you must be very careful + * to protect yourself from SQL injection attacks. + * For details see http://www.php.net/manual/en/function.get-magic-quotes-gpc.php + * + * @author flo + */ - $_POST = array_map('stripslashes_deep', $_POST); - $_GET = array_map('stripslashes_deep', $_GET); - $_COOKIE = array_map('stripslashes_deep', $_COOKIE); - $_REQUEST = array_map('stripslashes_deep', $_REQUEST); + /** + * Disabling magic quotes at runtime + * for example fread() + */ + set_magic_quotes_runtime(0); /** - * http://php3.de/manual/de/features.file-upload.php - * Note that with magic_quotes_gpc on, the uploaded filename - * has backslashes added *but the tmp_name does not*. - * On Windows where the tmp_name path includes backslashes, - * you *must not* run stripslashes() on the tmp_name, - * so keep that in mind when de-magic_quotes-izing your input. - * - * -> do not stripslashes on whole array, but only on $_FILES[*]['name'] + * Remove magic quotes for get, post and cookie data + * We can't disable it, because we are already too late + * It could also be done with a directive in a .htaccess file + * (php_value magic_quotes_gpc 0) */ - foreach($_FILES AS $key=>$value) - { - $_FILES[$key]['name'] = stripslashes($_FILES[$key]['name']); + if (get_magic_quotes_gpc()) { + function stripslashes_deep($value) + { + $value = is_array($value) ? + array_map('stripslashes_deep', $value) : + stripslashes($value); + + return $value; + } + + $_POST = array_map('stripslashes_deep', $_POST); + $_GET = array_map('stripslashes_deep', $_GET); + $_COOKIE = array_map('stripslashes_deep', $_COOKIE); + $_REQUEST = array_map('stripslashes_deep', $_REQUEST); + + /** + * http://php3.de/manual/de/features.file-upload.php + * Note that with magic_quotes_gpc on, the uploaded filename + * has backslashes added *but the tmp_name does not*. + * On Windows where the tmp_name path includes backslashes, + * you *must not* run stripslashes() on the tmp_name, + * so keep that in mind when de-magic_quotes-izing your input. + * + * -> do not stripslashes on whole array, but only on $_FILES[*]['name'] + */ + foreach($_FILES AS $key=>$value) + { + $_FILES[$key]['name'] = stripslashes($_FILES[$key]['name']); + } } -} ?> Added: trunk/linpha2/lib/include/integrity.php =================================================================== --- trunk/linpha2/lib/include/integrity.php (rev 0) +++ trunk/linpha2/lib/include/integrity.php 2006-04-02 12:51:42 UTC (rev 4472) @@ -0,0 +1,81 @@ +<?php +/* +* Copyright (c) 2006 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * This is the base class which needs to be included. It takes care of + * including a number of class files and sets up basic things. + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +try +{ +/** + * check folders + */ + /** + * album folder + */ + $dir = LinSql::getPath('album'); + if( ! file_exists($dir) ) + { + throw new Exception(i18n("Directoy Not Existing").": ".i18n("Album").": ".$dir); + } + + if( ! is_readable($dir) ) + { + throw new Exception(i18n("Directoy Not Readable").": ".i18n("Album").": ".$dir); + } + + /** + * tmp folder + */ + $dir = LinSql::getPath('tmp'); + if( ! file_exists($dir) ) + { + throw new Exception(i18n("Directoy Not Existing").": ".i18n("Temp").": ".$dir); + } + + if( ! is_writable($dir) ) + { + throw new Exception(i18n("Directoy Not Writable").": ".i18n("Temp").": ".$dir); + } + + /** + * cache folder + */ + $dir = LinSql::getPath('cache'); + if( ! file_exists($dir) ) + { + throw new Exception(i18n("Directoy Not Existing").": ".i18n("Cache").": ".$dir); + } + + if( ! is_writable($dir) ) + { + throw new Exception(i18n("Directoy Not Writable").": ".i18n("Cache").": ".$dir); + } + + +} +catch(Exception $error) +{ + die("Error: ".$error -> getMessage()); +} + +?> \ No newline at end of file Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-04-01 17:49:00 UTC (rev 4471) +++ trunk/linpha2/linpha2.specs.txt 2006-04-02 12:51:42 UTC (rev 4472) @@ -115,147 +115,7 @@ - change perms to rwx owner and rwx group after install 770 for these folders -Part 6: Database Design -============================================================================== -tables ------- -? linpha_lin_photos -? linpha_lin_config -? linpha_lin_counter_stats - -? linpha_perm_issions -linpha_perm_users -linpha_perm_groups - -linpha_meta_comments -linpha_meta_category -linpha_meta_exif -linpha_meta_iptc -linpha_meta_fields -linpha_meta_data - -linpha_plugins -linpha_plugins_log -linpha_plugins_guestbook -linpha_plugins_stats -linpha_plugins_mail_list -linpha_plugins_photo_cache - - - -linpha_config -------------- -User are able to have their own config settings - -CREATE TABLE `linpha_config` ( - `ID` int NOT NULL auto_increment, - `option_name` varchar(100) NOT NULL default '', - `option_value` varchar(100) NOT NULL default '', - `userid` int default '0', - `user_override` int default '0' - ) - -userid: - if userid = 0 => system setting - - -override: - 0: no possible (paths etc.) - 1: admin may choose (not changeable by user) - 2: admin may choose (changeable by user) - - - Config Structure - - sys_db_* Database settings - sys_path_* Folder path settings - sys_im_* Imagemagick and GDlib settings - sys_style_* Layout, style, etc. (should be change...) - sys_lang_* Language settings - sys_import_* Import/add new folders/files - - Plugins: - wm_* Plugin watermark - gb_* Plugin Guestbook - log_* Plugin Logger - ... - - -linpha_meta_fields ------------------- - id - name - field_type - 1 => 'text', - 2 => 'select', - 3 => 'date' - flags - 1 => special fields, fields which cannot be filled: filename, imagesize, dimension - 5 => builtin enabled, description, category, persons, date - 6 => builtin disabled, - 7 => own enabled, - 8 => own disabled, - 10 => image fields selected, fields selected in image info - 11 => video fields selected, fields selected in video info - 12 => album fields selected, fields selected in album info - - -Part 11. image infos (exif/iptc/etc.) -=========================================================================== -- meta data of images/albums - i'm thinking about a very complex meta info system - user can enable/disable info box (like the box we have already with videos) - which would appear next to an image - user can define elements which appear in this box - example: - -------------------------------- - | Filename: 0001_img.jpg | - | Imagetype: JPEG | - | Resolution: 1600x1200 | - | ---------------------------- | - | Exif | - | Date: 23.02.2006 | - | Time: 12:20 | - | ---------------------------- | - | Iptc | - | Description: blabla | - | other Iptc fields | - | ---------------------------- | - | User defined fields | - | (stored in db) | - | Description: blabla | - | Categories: Holidays | - | Persons: me, he, she | - | Place: Switzerland | - | Comments: comment 1 | - | comment 2 | - -------------------------------- - - admin can choose which elements appear in this box - admin can create new user defined fields - (text fields, selects, checkbox) - - it doesn't matter if it is a folder or a file - both is possible - - on file base, store md5sum - on album base, store id/path ? - then it should also be possible to inherit fields from - an album to the images - example: if an album has the category Holidays, and if we search - for Holidays, all images in this album should be shown - (but what to do with subfolders?) - - - ability to define own image fields (low priority) - types: - 1 = text - 2 = select - 3 = select multiple - 4 = date - /* edit bzrudi */ - Yes, I agree - all of the above should be possible for power users - Part 12. main menu ============================================================================ - use a css only menu? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-02 13:11:37
|
Revision: 4473 Author: fangehrn Date: 2006-04-02 06:11:24 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4473&view=rev Log Message: ----------- * updated documentation, added todo list Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/linpha2.specs.txt Removed Paths: ------------- trunk/linpha2/db_data.sql Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-02 12:51:42 UTC (rev 4472) +++ trunk/linpha2/ChangeLog 2006-04-02 13:11:24 UTC (rev 4473) @@ -1,5 +1,6 @@ 2006-04-02 flo * added integrity check (checks album, tmp and cache folder) + * updated documentation, added todo list 2006-04-01 flo * update several folder paths Deleted: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-04-02 12:51:42 UTC (rev 4472) +++ trunk/linpha2/db_data.sql 2006-04-02 13:11:24 UTC (rev 4473) @@ -1,66 +0,0 @@ --- --- Daten f?r Tabelle `linpha_photos` --- -use linpha2; -TRUNCATE `linpha_config`; -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_adodb_cache_path', 'var/tmp/adocache', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_adodb_caching', '0', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_version', '1', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_bracket_support', '0', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_convert_path', '0', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_gd_version', '0', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_use_convert', '0', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_video_thumbnail', '1', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_import_autoimport', '1', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_image_exif', '1', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_image_iptc', '0', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_lang', 'German', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_lang_autolang', '1', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_path_album_dir', 'albums/', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_path_cache_dir', 'var/cache/', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_path_tmp_dir', 'var/tmp/', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_style_img_quality', '75', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_style_style', 'aqua', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_style_tn_size', '150', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_user_autologin', '1', 0); - --- -------------------------------------------------------- - --- --- Daten f?r Tabelle `linpha_groups` --- -TRUNCATE `linpha_groups`; -INSERT INTO `linpha_groups` (`name`) VALUES ('gruppe1'); -INSERT INTO `linpha_groups` (`name`) VALUES ('gruppe2'); - --- -------------------------------------------------------- - --- --- Daten f?r Tabelle `linpha_permissions` --- -TRUNCATE `linpha_permissions`; -INSERT INTO `linpha_permissions` (`photos_id`, `perm_type`, `permission`) VALUES (0, 'read', ';public;'); - --- -------------------------------------------------------- - -TRUNCATE `linpha_photos`; - - --- --- Daten f?r Tabelle `linpha_meta_fields` --- -TRUNCATE `linpha_meta_fields`; -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (1, 'description', 1, 5); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (2, 'category', 2, 5); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (3, 'persons', 2, 5); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (4, 'date', 3, 5); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (6, 'filename', 0, 1); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (7, 'imagesize', 0, 1); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (8, 'dimension', 0, 1); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_6', 0, 10); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_7', 0, 10); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_8', 0, 10); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_1', 0, 10); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_2', 0, 10); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_3', 0, 10); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('exif_datetimeoriginal', 0, 10); Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-04-02 12:51:42 UTC (rev 4472) +++ trunk/linpha2/linpha2.specs.txt 2006-04-02 13:11:24 UTC (rev 4473) @@ -82,41 +82,7 @@ - Fenster ueberwachen http://de.selfhtml.org/javascript/beispiele/fensterueberwachen.htm - -Part 5: Folder Structure -============================================================================== -actions/ -admin/ -admin/actions -admin/docs -admin/lang -albums/ -install/ -install/docs -install/lang -lib/ -lib/adodb -lib/classes -lib/docs -lib/graphics -lib/include -lib/lang -lib/plugins -lib/themes -var/ -var/cache/ -var/cache/imgcache -var/cache/thumbcache -var/sql/ -var/tmp/ - -hints: -- /var need to be checked by new installer for rw access -- change perms to rwx owner and rwx group after install 770 for these folders - - - -Part 12. main menu +Part 5. main menu ============================================================================ - use a css only menu? - use something like this: http://www.milonic.com/mfa/2004-February/003609.html ? @@ -169,89 +135,4 @@ lets say i'm requesting an image between 800x600 and 1024x768 i will get the image 1024x768, between 1024x768 and 1310x983 i will get an image with 1310x983 we would have calculate a good value of the different image sizes handling thecompromise - between size of the image and difference in size - - -############################################################################ -TODOS 2.0 -############################################################################ -- check automatically if a file was changed by an external program and update md5sum etc. -- check how much faster it is to have thumbnails stored on filesystem and not in db -- use of get_ride_of_magicquotes() in all files - - - use of templates (smarty? css? (http://www.csszengarden.com/tr/deutsch)) - use one css file for global settings - different css files for layout settings - different css files for colour settings - use css files like this: - // font settings - body, td, ..., ..., ... { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10pt; - color: #000033; - } - - // background color - body, td, .......... { - background-color: #002200; - } - - layout with header and footer written in css: - http://css.fractatulum.net/sample/layout7format.htm - - DONE - ==== - - store thumbnails in /var/cache/thumb? - - id or md5sum based? - /* edit bzrudi */ - (as discussed it should be id based...) - - - allow unlimited subfolders - - allow permissions set to all files and folders - - - complete rewrite of the install scripts - more steps: - 1. check requirements - 2. select db type - 3. enter db user/pass - 4. check connection - 5. create database or not (not needed with sqlite) - 6. create tables - 7. further settings (thumbnail size, admin account) - - - new folder structure: - actions/ - admin/ - admin/actions - admin/lang - albums/ - docs/ - docs/lang - graphics/ - install/ - install/lang - lang/ - lib/ - lib/adodb ? - lib/classes - lib/functions - lib/include - plugins/ - styles/layout/ - styles/format/ - - sql/ ? evtl. auch "tmp" "cache" oder etwas besseres ? - -- db design: - linpha_photos(id, name, md5sum, type, date_added) - linpha_permissions(id, photos_id, permissions, read_write) - linpha_stats(md5sum, downloads, views) - - todo: create sql query where it is possible with only one query to select only images - where i have permission to read like we have it with linpha 1.0: - SELECT linpha_photos.prev_path AS prev_path, linpha_photos.filename AS filename - FROM linpha_photos, linpha_first_lev_album - WHERE linpha_photos.prev_path LIKE CONCAT(linpha_first_lev_album.path,'%') - AND (linpha_first_lev_album.groups LIKE '%;public;%') - AND (linpha_photos.id='612'); - \ No newline at end of file + between size of the image and difference in size \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-02 13:50:24
|
Revision: 4475 Author: fangehrn Date: 2006-04-02 06:50:15 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4475&view=rev Log Message: ----------- * added a reset_database.php script which reloads the table entries maybe needs to be extended to recreate all tables, but not yet.. Modified Paths: -------------- trunk/linpha2/ChangeLog Added Paths: ----------- trunk/linpha2/reset_database.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-02 13:48:50 UTC (rev 4474) +++ trunk/linpha2/ChangeLog 2006-04-02 13:50:15 UTC (rev 4475) @@ -1,6 +1,8 @@ 2006-04-02 flo * added integrity check (checks album, tmp and cache folder) * updated documentation, added todo list + * added a reset_database.php script which reloads the table entries + maybe needs to be extended to recreate all tables, but not yet.. 2006-04-01 flo * update several folder paths Added: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php (rev 0) +++ trunk/linpha2/reset_database.php 2006-04-02 13:50:15 UTC (rev 4475) @@ -0,0 +1,72 @@ +<?php +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } + +include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +$linpha = new linpha(); +$linpha->sql->startSession(); + +$_SESSION['sys_im_bracket_support'] = $GLOBALS['linpha']->sql->config->value['sys_im_bracket_support']; +$_SESSION['sys_im_use_convert'] = $GLOBALS['linpha']->sql->config->value['sys_im_use_convert']; +$_SESSION['sys_im_convert_path'] = $GLOBALS['linpha']->sql->config->value['sys_im_convert_path']; +$_SESSION['language'] = $GLOBALS['linpha']->sql->config->value['sys_lang']; +$_SESSION['album_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_album_dir']; +$_SESSION['cache_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_cache_dir']; +$_SESSION['tmp_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; + + + +echo "<br /><br />".tr("Truncate Table Data")."... "; +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."config"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."groups"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_category"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_comments"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_data"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_exif"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_fields"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_iptc"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."permissions"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."photos"); + +echo "<br /><br />".tr("Inserting Table Data")."... "; +include_once(LINPHA_DIR.'/install/sql/sql.data.php'); +foreach($sql_queries AS $value) +{ + $result = $linpha->db->Execute($value); + if(!$result) + { + echo failed_msg(); + echo $value; + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } +} + +function failed_msg() +{ + $str = "<font color='red'>"; + $str .= "failed"; + $str .= "</font>"; + return $str; +} + +function warning_msg() +{ + $str = "<font color='orange'>"; + $str .= "warning"; + $str .= "</font>"; + return $str; +} + +function success_msg() +{ + $str = "<font color='green'>"; + $str .= "ok"; + $str .= "</font>"; + return $str; +} + +function tr($str) +{ + return $str; +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-02 21:02:47
|
Revision: 4476 Author: fangehrn Date: 2006-04-02 14:02:17 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4476&view=rev Log Message: ----------- * added select thumbnail feature * improving metadata Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_define_post.php trunk/linpha2/admin/image_fields_select.php trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/thumbnails.js trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/templates/default/view_thumb.html.php Added Paths: ----------- trunk/linpha2/docs/TODO.txt trunk/linpha2/lib/include/upgrade.php Removed Paths: ------------- trunk/linpha2/dev.txt Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/ChangeLog 2006-04-02 21:02:17 UTC (rev 4476) @@ -3,6 +3,8 @@ * updated documentation, added todo list * added a reset_database.php script which reloads the table entries maybe needs to be extended to recreate all tables, but not yet.. + * added select thumbnail feature + * improving metadata 2006-04-01 flo * update several folder paths Modified: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/admin/image_fields_define.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -249,19 +249,6 @@ $MetaData = new MetaData(); $MetaData->setFields( $GLOBALS['cat3'] ); - switch($GLOBALS['cat3']) - { - case 'exif': - $defined_fields = 'defined_exif_fields'; - $available_fields = 'available_exif_fields'; - break; - case 'iptc': - $defined_fields = 'defined_iptc_fields'; - $available_fields = 'available_iptc_fields'; - break; - } - - /** * get enabled/disabled setting */ @@ -284,7 +271,7 @@ Selected fields<br /> <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - foreach($MetaData->$defined_fields AS $key=>$value) + foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'."\n"; } @@ -301,7 +288,7 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($MetaData->$available_fields AS $key=>$value) + foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'; } Modified: trunk/linpha2/admin/image_fields_define_post.php =================================================================== --- trunk/linpha2/admin/image_fields_define_post.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/admin/image_fields_define_post.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -20,6 +20,9 @@ break; case 'add_new': + /** + * check for duplicates with the same name + */ $linpha->db->Execute("INSERT into ".PREFIX."meta_fields (name, field_type, flags) " . "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '7') "); break; Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/admin/image_fields_select.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -13,31 +13,46 @@ 'album' => Array('name' => 'Album', 'link' => 'imagefields_select_album') ); -if(isset($_POST['cmd'])) +print_admin_menu($array_menu,$cat3); + +switch($cat3) { - /** - * delete all existing entries in database - */ - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE flags = '10'"); +case 'image': + printFieldsTable(10); + break; +case 'thumb': + printFieldsTable(13); + break; - /** - * write new entrys - */ - if(isset($_POST['select_image_fields'])) +case 'video': + + break; +} + + + +function printFieldsTable($flag_nr) +{ + if(isset($_POST['cmd']) && $_POST['cmd']=='select_image_fields') { - foreach($_POST['select_image_fields'] AS $value) + /** + * delete all existing entries in database + */ + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."'"); + + /** + * write new entrys + */ + if(isset($_POST['select_image_fields'])) { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, flags)" . - " VALUES ('".linSql::linAddslashes($value)."','10')"); + foreach($_POST['select_image_fields'] AS $value) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, flags)" . + " VALUES ('".linSql::linAddslashes($value)."','".$flag_nr."')"); + } } } -} -print_admin_menu($array_menu,$cat3); - -switch($cat3) -{ -case 'image': /** * set exif/iptc fields */ @@ -54,7 +69,7 @@ Selected fields<br /> <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE flags = '10' ORDER by id"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."' ORDER by id"); while($data = $query->FetchRow()) { echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; @@ -74,14 +89,14 @@ <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('image_fields')" /> </td> <td> - Image fields<br /> + Image fields (builtin)<br /> <select id="image_fields" name="image_fields" size="7" style="width: 200px;"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE flags = '1'"); + "WHERE flags = '1' OR flags = '5'"); while($data = $query->FetchRow()) { - echo '<option value="id_'.$data['id'].'">'.$MetaData->array_special_fields[$data['name']].'</option>'; + echo '<option value="builtin_'.$data['name'].'">'.i18n( ucfirst( $data['name'] ) ).'</option>'; } ?> </select> @@ -92,11 +107,11 @@ <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> </td> <td> - Tag fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> + Image fields (own) (<a href="./?cat=imagefields_define_own">define</a>)<br /> <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE flags = '5' OR flags = '7'"); + "WHERE flags = '7'"); while($data = $query->FetchRow()) { echo '<option value="id_'.$data['id'].'">'.$data['name'].'</option>'; @@ -120,7 +135,7 @@ ?> <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - foreach($MetaData->defined_exif_fields AS $key=>$value) + foreach($MetaData->defined_fields['exif'] AS $key=>$value) { echo '<option value="exif_'.$key.'">'.$value.'</option>'; } @@ -143,7 +158,7 @@ ?> <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - foreach($MetaData->defined_iptc_fields AS $key=>$value) + foreach($MetaData->defined_fields['iptc'] AS $key=>$value) { echo '<option value="iptc_'.$key.'">'.$value.'</option>'; } @@ -158,150 +173,137 @@ </div> </form> -<?php - break; -case 'thumb': - - break; - -case 'video': - ?> - - <?php - break; -} -?> - - - -<script type="text/javascript"> -/** - * http://www.babailiica.com/js/sorter/ - */ - -function selectAll() -{ - obj = document.getElementById('select_image_fields'); - for (var i=0; i<obj.length; i++) { - obj[i].selected = true; - } -} - - -function copyElement (coming_from) -{ - obj_from = document.getElementById(coming_from); - obj = document.getElementById('select_image_fields'); - - NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); - obj.options[ obj.options.length ] = NewEntry; - + <script type="text/javascript"> /** - * append ' (exif)' and ' (iptc)' + * http://www.babailiica.com/js/sorter/ */ - if(coming_from=='exif_fields') + + function selectAll() { - obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (exif)'; + obj = document.getElementById('select_image_fields'); + for (var i=0; i<obj.length; i++) { + obj[i].selected = true; + } } - if(coming_from=='iptc_fields') - { - obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (iptc)'; - } - - /** - * remove new selection on left side - */ - obj.options[ obj.options.length-1 ].selected = false; -} - -function addElement () -{ - obj = document.getElementById('select_image_fields'); - - NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); - NewEntry.className = "option_title"; - obj.options[obj.options.length] = NewEntry; - document.form_image_fields.title_name.value = ""; -} - -function deleteElement () -{ - obj = document.getElementById('select_image_fields'); - current_index = obj.selectedIndex; - obj.options[ current_index ] = null; - - /** - * set selectedIndex back to field above - */ - if( current_index == obj.length ) + function copyElement (coming_from) { - obj.selectedIndex = current_index - 1; + obj_from = document.getElementById(coming_from); + obj = document.getElementById('select_image_fields'); + + NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); + obj.options[ obj.options.length ] = NewEntry; + + /** + * append ' (exif)' and ' (iptc)' + */ + if(coming_from=='exif_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (exif)'; + } + if(coming_from=='iptc_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (iptc)'; + } + + + /** + * remove new selection on left side + */ + obj.options[ obj.options.length-1 ].selected = false; } - else + + function addElement () { - obj.selectedIndex = current_index; + obj = document.getElementById('select_image_fields'); + + NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); + NewEntry.className = "option_title"; + obj.options[obj.options.length] = NewEntry; + document.form_image_fields.title_name.value = ""; } -} - -function moveupElement () -{ - obj = document.getElementById('select_image_fields'); - current_index = obj.selectedIndex; - if( current_index != 0 ) + function deleteElement () { - /** - * swap entries - */ - tmp_value = obj.options[ current_index ].value; - tmp_text = obj.options[ current_index ].text; - tmp_class = obj.options[ current_index ].className; + obj = document.getElementById('select_image_fields'); - obj.options[ current_index ].value = obj.options[ current_index - 1].value; - obj.options[ current_index ].text = obj.options[ current_index - 1].text; - obj.options[ current_index ].className = obj.options[ current_index - 1].className; - - obj.options[ current_index - 1].value = tmp_value; - obj.options[ current_index - 1].text = tmp_text; - obj.options[ current_index - 1].className = tmp_class; - + current_index = obj.selectedIndex; + obj.options[ current_index ] = null; + /** - * set selectedIndex back to swapped field + * set selectedIndex back to field above */ - obj.selectedIndex = current_index - 1; + if( current_index == obj.length ) + { + obj.selectedIndex = current_index - 1; + } + else + { + obj.selectedIndex = current_index; + } } -} - -function movedownElement () -{ - obj = document.getElementById('select_image_fields'); - current_index = obj.selectedIndex; - - if( current_index != ( obj.length - 1 ) ) + function moveupElement () { - /** - * swap entries - */ - tmp_value = obj.options[ current_index ].value; - tmp_text = obj.options[ current_index ].text; - tmp_class = obj.options[ current_index ].className; + obj = document.getElementById('select_image_fields'); - obj.options[ current_index ].value = obj.options[ current_index + 1].value; - obj.options[ current_index ].text = obj.options[ current_index + 1].text; - obj.options[ current_index ].className = obj.options[ current_index + 1].className; - - obj.options[ current_index + 1].value = tmp_value; - obj.options[ current_index + 1].text = tmp_text; - obj.options[ current_index + 1].className = tmp_class; + current_index = obj.selectedIndex; + if( current_index != 0 ) + { + /** + * swap entries + */ + tmp_value = obj.options[ current_index ].value; + tmp_text = obj.options[ current_index ].text; + tmp_class = obj.options[ current_index ].className; + + obj.options[ current_index ].value = obj.options[ current_index - 1].value; + obj.options[ current_index ].text = obj.options[ current_index - 1].text; + obj.options[ current_index ].className = obj.options[ current_index - 1].className; + + obj.options[ current_index - 1].value = tmp_value; + obj.options[ current_index - 1].text = tmp_text; + obj.options[ current_index - 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + obj.selectedIndex = current_index - 1; + } + } + + function movedownElement () + { + obj = document.getElementById('select_image_fields'); - /** - * set selectedIndex back to swapped field - */ - obj.selectedIndex = current_index + 1; + current_index = obj.selectedIndex; + + if( current_index != ( obj.length - 1 ) ) + { + /** + * swap entries + */ + tmp_value = obj.options[ current_index ].value; + tmp_text = obj.options[ current_index ].text; + tmp_class = obj.options[ current_index ].className; + + obj.options[ current_index ].value = obj.options[ current_index + 1].value; + obj.options[ current_index ].text = obj.options[ current_index + 1].text; + obj.options[ current_index ].className = obj.options[ current_index + 1].className; + + obj.options[ current_index + 1].value = tmp_value; + obj.options[ current_index + 1].text = tmp_text; + obj.options[ current_index + 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + obj.selectedIndex = current_index + 1; + } } + </script> +<?php } -</script> \ No newline at end of file +?> \ No newline at end of file Deleted: trunk/linpha2/dev.txt =================================================================== --- trunk/linpha2/dev.txt 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/dev.txt 2006-04-02 21:02:17 UTC (rev 4476) @@ -1,7 +0,0 @@ -ADODB_FETCH_ASSOC - -linSql::linAddslashes( ) - -$GLOBALS['linpha']->sql->config->value['']; - -<?php echo i18n(""); ?> \ No newline at end of file Added: trunk/linpha2/docs/TODO.txt =================================================================== --- trunk/linpha2/docs/TODO.txt (rev 0) +++ trunk/linpha2/docs/TODO.txt 2006-04-02 21:02:17 UTC (rev 4476) @@ -0,0 +1,121 @@ +############################################################################ +TODOS 2.0 +############################################################################ + + +## Small Todos +- Better Javascript detection + Currently the no-javscript site is loaded with a javascript location.href to the javascript enabled site + -> High Pageload, LinSysLog doesnt work + + +## Big Todos +- get_image.php (Image View, Image Cache) +- Slideshow (copy from linpha1) +- Search (copy from linpha1) +- Basket (finish) + - Support for the Icons + +- IPTC Image fields + - Write IPTC entries (see also https://sourceforge.net/forum/message.php?msg_id=3648731) + + +- User/Group System (copy from linpha1) + - Permissions + +- Filemanager (copy from linpha1) + - Add support for Write-Permissions + +- Plugins (copy from linpha1) + + + + + + + + + + + DONE + ==== + +- check automatically if a file was changed by an external program and update md5sum etc. +- check how much faster it is to have thumbnails stored on filesystem and not in db +- use of get_ride_of_magicquotes() in all files + + - use of templates (smarty? css? (http://www.csszengarden.com/tr/deutsch)) + use one css file for global settings + different css files for layout settings + different css files for colour settings + use css files like this: + // font settings + body, td, ..., ..., ... { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10pt; + color: #000033; + } + + // background color + body, td, .......... { + background-color: #002200; + } + + layout with header and footer written in css: + http://css.fractatulum.net/sample/layout7format.htm + + + - store thumbnails in /var/cache/thumb? + - id or md5sum based? + /* edit bzrudi */ + (as discussed it should be id based...) + + - allow unlimited subfolders + - allow permissions set to all files and folders + + - complete rewrite of the install scripts + more steps: + 1. check requirements + 2. select db type + 3. enter db user/pass + 4. check connection + 5. create database or not (not needed with sqlite) + 6. create tables + 7. further settings (thumbnail size, admin account) + + - new folder structure: + actions/ + admin/ + admin/actions + admin/lang + albums/ + docs/ + docs/lang + graphics/ + install/ + install/lang + lang/ + lib/ + lib/adodb ? + lib/classes + lib/functions + lib/include + plugins/ + styles/layout/ + styles/format/ + + sql/ ? evtl. auch "tmp" "cache" oder etwas besseres ? + +- db design: + linpha_photos(id, name, md5sum, type, date_added) + linpha_permissions(id, photos_id, permissions, read_write) + linpha_stats(md5sum, downloads, views) + + todo: create sql query where it is possible with only one query to select only images + where i have permission to read like we have it with linpha 1.0: + SELECT linpha_photos.prev_path AS prev_path, linpha_photos.filename AS filename + FROM linpha_photos, linpha_first_lev_album + WHERE linpha_photos.prev_path LIKE CONCAT(linpha_first_lev_album.path,'%') + AND (linpha_first_lev_album.groups LIKE '%;public;%') + AND (linpha_photos.id='612'); + \ No newline at end of file Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/index.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -11,6 +11,7 @@ $linpha->sql->startSession(); include_once(LINPHA_DIR.'/lib/include/integrity.php'); + include_once(LINPHA_DIR.'/lib/include/upgrade.php'); if(!isset($_GET['cat'])) { Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -25,7 +25,7 @@ * config table */ $options = array( - 'sys_db_version' => '1', + 'sys_db_version' => '2', 'sys_im_bracket_support' => $_SESSION['sys_im_bracket_support'], 'sys_im_convert_path' => $_SESSION['sys_im_convert_path'], 'sys_im_use_convert' => $_SESSION['sys_im_use_convert'], @@ -67,36 +67,54 @@ /** * metadata - */ -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (1, 'description', 1, 5)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (2, 'category', 2, 5)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (3, 'persons', 2, 5)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (4, 'date', 3, 5)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (6, 'filename', 0, 1)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (7, 'imagesize', 0, 1)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(id, name, field_type, flags) VALUES (8, 'dimension', 0, 1)"; + */ + /** + * special and builtin fields + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('description', 1, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('category', 2, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('persons', 2, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('date', 3, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('filename', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('imagesize', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('dimension', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('thumbnail', 0, 1)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('id_6', 0, 10)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('id_7', 0, 10)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('id_8', 0, 10)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('id_1', 0, 10)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('id_2', 0, 10)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('id_3', 0, 10)"; -$sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('exif_datetimeoriginal', 0, 10)"; + /** + * preselected fields for image info + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_filename', 0, 10)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_imagesize', 0, 10)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_dimension', 0, 10)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_description', 0, 10)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_category', 0, 10)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_persons', 0, 10)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('exif_datetimeoriginal', 0, 10)"; + /** + * preselected fields for thumbnails + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_thumbnail', 0, 13)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_filename', 0, 13)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_description', 0, 13)"; + ?> Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -82,7 +82,8 @@ "isospeedratings varchar(255) default NULL, " . "flash varchar(255) default NULL, " . "focallength varchar(255) default NULL, " . - "fnumber varchar(255) default NULL, " . + "fnumber varchar(255) default NULL, " . + "jpegcomment VARCHAR(255) default NULL, " . "PRIMARY KEY (md5sum), " . "KEY md5sum (md5sum) " . ")", Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -75,7 +75,8 @@ "isospeedratings VARCHAR(255) default NULL, " . "flash VARCHAR(255) default NULL, " . "focallength VARCHAR(255) default NULL, " . - "fnumber VARCHAR(255) default NULL " . + "fnumber VARCHAR(255) default NULL, " . + "jpegcomment VARCHAR(255) default NULL " . ")", "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". "md5sum VARCHAR(32) NOT NULL default '' " . Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -76,7 +76,8 @@ "isospeedratings VARCHAR(255) default NULL, " . "flash VARCHAR(255) default NULL, " . "focallength VARCHAR(255) default NULL, " . - "fnumber VARCHAR(255) default NULL " . + "fnumber VARCHAR(255) default NULL, " . + "jpegcomment VARCHAR(255) default NULL " . ")", "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". "md5sum VARCHAR(32) NOT NULL default '' " . Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/lib/classes/linpha.class.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -49,6 +49,7 @@ include_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.import.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.identify.class.php'); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.functions.php'); /** Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -75,7 +75,7 @@ * check for valid id */ - if( isset($current_data) ) + if( isset($current_data['id']) ) { $this->img_type = $current_data['img_type']; $this->filename = $current_data['name']; @@ -397,7 +397,49 @@ $GLOBALS['linpha']->template->setModuleName('view_thumb'); $this->setSubFolders(); + + /** + * create thumbnail info text (filename, description, etc.) + */ + foreach($this->photos_filtered AS $key=>$photo_value) + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; + + $filename = $photo_value['name']; + $md5sum = $photo_value['md5sum']; + $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $photo_value['id'] ); + $full_filename = LinSql::getPath('album').'/'.implode('/',$array_files); + $array_image_infos = MetaData::readInformations( $full_filename, $filename, $md5sum, $flag_nr=13 ); + + $index = 'before'; + foreach($array_image_infos AS $value) + { + /** + * got thumbnail, switch to index after + */ + if($value['value']=='thumbnail') + { + $index = 'after'; + } + else + { + if($index == 'before') + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']][$index] .= $value['value'].'<br />'; + } + elseif($index == 'after') + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']][$index] .= '<br />'.$value['value']; + } + } + } + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['title'] = $photo_value['name']; + } + + /** * switch between javascript */ @@ -423,13 +465,15 @@ { if( ( $GLOBALS['show_subfolders_separate'] && $value['img_type'] != 0 ) OR !$GLOBALS['show_subfolders_separate'] ) { - $GLOBALS['linpha']->template->output['files_db'] .= '{ id: "'.$value['id'].'", fn: "'.$value['name'].'" }, '; + $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; + $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; + $title = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['title']; + + $array_files_db[] = '{ id: "'.$value['id'].'", before: "'.$before.'", after: "'.$after.'", title: "'.$title.'" }'; } } - /** - * remove last 2 signs (the comma and the space) - */ - $GLOBALS['linpha']->template->output['files_db'] = substr($GLOBALS['linpha']->template->output['files_db'],0,strlen($GLOBALS['linpha']->template->output['files_db'])-2); + + $GLOBALS['linpha']->template->output['files_db'] .= implode($array_files_db,", \n"); } $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; @@ -445,6 +489,7 @@ /** * thumbnail view with javascript disabled + * @uses LinImgView::viewThumb_View() */ function viewThumb_View_nojs() { @@ -466,8 +511,10 @@ $this->writePageNumbers(); - - if($this->tot_photos > 0) // check if not all entries were folders + /** + * create array $this->photos_show which contains only the photos of the current page + */ + if($this->tot_photos > 0) // only if not all entries were folders { $img_nr = 1; $i = 0; @@ -745,55 +792,62 @@ $GLOBALS['linpha']->template->output['comment'] = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); } -/** - * setup image view - */ -function viewImg_view() +function viewImgCommon() { - $GLOBALS['linpha']->template->setModuleName('view_img'); - $this->viewImgSetPrevNextThumb(); - $this->viewImg_viewReadImageInformation(); + $this->viewImg_viewStoreImageInformation(); + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $GLOBALS['linpha']->template->output['image_infos'] = MetaData::readInformations( $this->full_filename, $this->filename, $this->md5sum, $flag_nr=10 ); + if(isset($_GET['force_update'])) { LinImport::updateEntry( $this->id_current , dirname($this->full_filename) , $this->filename ); } +} +/** + * setup image view + */ +function viewImg_view() +{ + $GLOBALS['linpha']->template->setModuleName('view_img'); + + $this->viewImgCommon(); + /** * image comments */ - - /** - * save comment - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment') - { - if( !empty($_POST['comment_textarea'])) + /** + * save comment + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment') { - $comment = $_POST['comment_textarea']; + if( !empty($_POST['comment_textarea'])) + { + $comment = $_POST['comment_textarea']; + } + else + { + $comment = $_POST['comment_text']; + } + + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($_POST['author'])."'," . + "'".linSql::linAddslashes($comment)."')"); } - else - { - $comment = $_POST['comment_text']; - } - - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($_POST['author'])."'," . - "'".linSql::linAddslashes($comment)."')"); - } - - /** - * get comments - */ - $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, time, author, comment FROM ".PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + + /** + * get comments + */ + $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, time, author, comment FROM ".PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); } /** - * read image informations + * store image informations in database if not exists */ -function viewImg_viewReadImageInformation() +function viewImg_viewStoreImageInformation() { $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id_current ); $this->full_filename = LinSql::getPath('album').'/'.implode('/',$array_files); @@ -842,78 +896,6 @@ $MetaData->saveIptcData( $this->full_filename,$this->md5sum); } } - - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { - $str_exif_fields = strtolower( implode(', ',$MetaData->defined_exif_fields) ); - $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$str_exif_fields." FROM ".PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); - } - - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { - $str_iptc_fields = strtolower( implode(', ',$MetaData->defined_iptc_fields) ); - $iptc_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$str_iptc_fields." FROM ".PREFIX."meta_iptc WHERE md5sum = '".$this->md5sum."'"); - } - - /** - * read image information from database - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."meta_fields WHERE flags = '10' ORDER by id"); - while($data = $query->FetchRow()) - { - $name = $MetaData->getNameOfField( $data['name'], false ); - $value = ''; - - $pos = strpos($data['name'],'_'); - $first_part = substr($data['name'],0,$pos); - $last_part = substr($data['name'],$pos+1); - switch($first_part) - { - case 'id': - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT name, field_type FROM ".PREFIX."meta_fields WHERE id = '".$last_part."'"); - if($meta_data['field_type']==0) // special fields like filename, dimension, imagesize - { - /** - * @todo maybe we could save this values in the db for speed improvements - */ - switch($meta_data['name']) - { - case 'filename': - $value = $this->filename; - break; - case 'imagesize': - $value = filesize( $this->full_filename ); - break; - case 'dimension': - $array = LinIdentify::linGetImageSize( $this->full_filename ); - $value = $array[0].'x'.$array[1]; - break; - } - } - else // builtin and own fields - { - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".PREFIX."meta_data ". - "WHERE field_id = '".$last_part."' AND md5sum = '".$this->md5sum."'"); - if(isset($meta_data['meta_data'])) { - $value = $meta_data['meta_data']; - } - } - break; - case 'exif': - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { - $value = $exif_data[$last_part]; - } - break; - case 'iptc': - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { - $value = $iptc_data[$last_part]; - } - break; - } - - if($value != '') - { - $GLOBALS['linpha']->template->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); - } - } } /** @@ -940,14 +922,8 @@ { $GLOBALS['linpha']->template->setModuleName('view_img'); - $this->viewImgSetPrevNextThumb(); - - $this->viewImg_viewReadImageInformation(); + $this->viewImgCommon(); - if(isset($_GET['force_update'])) { - LinImport::updateEntry( $this->id_current , dirname($this->full_filename) , $this->filename ); - } - /** * save metadata */ Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-04-02 13:50:15 UTC (rev 4475) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-04-02 21:02:17 UTC (rev 4476) @@ -21,35 +21,23 @@ /** * This class handles all the EXIF and IPTC stuff used in LinPHA * @package Metadata + * @author flo, bzrudi */ if(!defined('LINPHA_DIR')) { exit(1); } class MetaData { -public $all_exif_fields, $all_iptc_fields; -public $available_exif_fields, $available_iptc_fields; -public $defined_exif_fields, $defined_iptc_fields; +public $available_fields, $defined_fields; -private $current_all_fields, $current_available_fields, $current_defined_fields; function __construct() { - - /** - * should be replaced if language files are implemented... - */ - $this->array_special_fields = Array( - 'filename'=>'Filename', - 'imagesize'=>'Image Size', - 'dimension'=>'Dimension', - 'persons' => 'Persons', - 'description' => 'Description', - 'category' => 'Category', - 'date' => 'Date' - ); } +/** + * show nice name for exif, iptc, builtin and own fields, for example: convert "exif_datetimeoriginal" to "DateTime Original" + */ function getNameOfField( $key , $show_exifiptc_in_brackets) { $pos = strpos($key,'_'); @@ -57,22 +45,22 @@ $last_part = substr($key,$pos+1); switch($first_part) { - case 'id': // builtin and own fields and special fields like filename, imagesize and dimension + case 'builtin': // builtin and special fields like filename, imagesize and dimension + $value = i18n( ucfirst( $last_part ) ); + break; + + case 'id': // own fields $data2 = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."meta_fields WHERE id = '".$last_part."'"); - if(isset($this->array_special_fields[$data2['name']])) { - $value = $this->array_special_fields[$data2['name']]; - } else { - $value = $data2['name']; - } + $value = i18n( ucfirst( $data2['name'] ) ); break; case 'exif': - $value = $this->all_exif_fields[$last_part]; + $value = $GLOBALS['Tags_Exif'][$last_part]; if($show_exifiptc_in_brackets) { $value .= ' (exif)'; } break; case 'iptc': - $value = $this->all_iptc_fields[$last_part]; + $value = $GLOBALS['Tags_Iptc'][$last_part]; if($show_exifiptc_in_brackets) { $value .= ' (iptc)'; } @@ -82,189 +70,215 @@ return $value; } -function getDefaultExifFields() +/** + * read image information from database + */ +function readInformations($full_filename,$filename,$md5sum,$flag_nr) { - return Array - ( - 'datetimeoriginal', - 'make', - 'model', - 'artist', - 'copyright', - 'aperturevalue', - 'shutterspeedvalue', - 'exposuretime', - 'isospeedratings', - 'flash', - 'focallength', - 'fnumber' - ); + $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."' ORDER by id"); + while($fields_data = $query->FetchRow()) + { + $name = MetaData::getNameOfField( $fields_data['name'], false ); + $value = ''; + + $pos = strpos($fields_data['name'],'_'); + $first_part = substr($fields_data['name'],0,$pos); + $last_part = substr($fields_data['name'],$pos+1); + switch($first_part) + { + case 'builtin': + /** + * @todo maybe we could save this values in the db for speed improvements + */ + switch($last_part) + { + case 'filename': + $value = $filename; + break; + case 'imagesize': + $value = filesize( $full_filename ); + break; + case 'dimension': + $array = LinIdentify::linGetImageSize( $full_filename ); + $value = $array[0].'x'.$array[1]; + break; + case 'thumbnail': + $value = 'thumbnail'; + break; + default: // field entries which are stored in linpha_meta_data + /** + * get field id + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."meta_fields WHERE name = '".$last_part."'"); + + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".PREFIX."meta_data ". + "WHERE field_id = '".$data['id']."' AND md5sum = '".$md5sum."'"); + if(isset($meta_data['meta_data'])) { + $value = $meta_data['meta_data']; + } + } + case 'id': + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".PREFIX."meta_data ". + "WHERE field_id = '".$last_part."' AND md5sum = '".$md5sum."'"); + if(isset($meta_data['meta_data'])) { + $value = $meta_data['meta_data']; + } + break; + case 'exif': + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { + $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); + if(isset($exif_data[$last_part])) { + $value = $exif_data[$last_part]; + } + } + break; + case 'iptc': + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + $iptc_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." FROM ".PREFIX."meta_iptc WHERE md5sum = '".$md5sum."'"); + if(isset($iptc_data[$last_part])) { + $value = $iptc_data[$last_part]; + } + } + break; + } + + if($value != '') + { + $output_array[$fields_data['name']] = Array('name' => $name, 'value' => $value); + } + } + + return $output_array; } +/** + * set available and defined fields + * @param string $what [exif,iptc] + */ function setFields($what) { - switch($what) - { - case 'exif': + /** + * create definedfields[] + */ + $this->defined_fields[$what] = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_".$what); - $this->all_exif_fields = $this->getExifTranslationArray(); - /** - * modify array as needed - * change key to lowercase + * remove md5sum entry */ - foreach($this->all_exif_fields AS $key=>$value) + unset($this->defined_fields[$what]['MD5SUM']); + + /** + * change keys to lowercase + */ + foreach($this->defined_fields[$what] AS $key=>$value) { $new_key = strtolower($key); - unset($this->all_exif_fields[$key]); - $this->all_exif_fields[$new_key] = $key; + unset($this->defined_fields[$what][$key]); + $this->defined_fields[$what][$new_key] = $GLOBALS['Tags_'.ucfirst($what)][$new_key]; } - - $this->defined_exif_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_exif"); - - $this->current_defined_fields = $this->defined_exif_fields; - $this->current_available_fields = $this->available_exif_fields; - $this->current_all_fields = $this->all_exif_fields; - - break; - case 'iptc': - $this->all_iptc_fields = MetaData::getIptcTranslationArray(); - - $this->defined_iptc_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_iptc"); - $this->current_defined_fields = $this->defined_iptc_fields; - $this->current_available_fields = $this->available_iptc_fields; - $this->current_all_fields = $this->all_iptc_fields; - - break; - } - /** - * remove md5sum entry - */ - unset($this->current_defined_fields['MD5SUM']); - - - /** - * change keys to lowercase - */ - foreach($this->current_defined_fields AS $key=>$value) - { - $new_key = strtolower($key); - unset($this->current_defined_fields[$key]); - $this->current_defined_fields[$new_key] = $this->current_all_fields[$new_key]; - } - - /** * create available_fields */ - foreach($this->current_all_fields AS $key=>$value) - { - if( ! isset( $this->current_defined_fields[$key] )) + foreach($GLOBALS['Tags_'.ucfirst($what)] AS $key=>$value) { - $this->current_available_fields[$key] = $value; + if( ! isset( $this->defined_fields[$what][$key] )) + { + $this->available_fields[$what][$key] = $value; + } } - } - - switch($what) - { - case 'exif': - $this->defined_exif_fields = $this->current_defined_fields; - $this->available_exif_fields = $this->current_available_fields; - $this->all_exif_fields = $this->current_all_fields; - break; - case 'iptc': - $this->defined_iptc_fields = $this->current_defined_fields; - $this->available_iptc_fields = $this->current_available_fields; - $this->all_iptc_fields = $this->current_all_fields; - break; - } } - /** - * store EXIF data in DB - * - * create an entry in the db even if we haven't found anything - * to prevent img_view.class.php to call this function every time - * the image is viewed - */ - function saveExifData($filename,$md5sum) - { - /** - * get exif info from file - */ - $exif_data = get_EXIF_JPEG( $filename ); - - /** - * get exif tags - */ - $exif_tags = $this->getExifTranslationArray(); - /** - * special tags - */ - // Canon Owner Name append to Artist - if(isset($exif_data['Makernote_Tag']['Decoded Data']) - && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string - && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) - { - $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; - if(isset($exif_data[0][315]['Text Value'])) - { - $exif_data[0][315]['Text Value'] .= $owner; - } - else - { - $exif_data[0][315]['Text Value'] = $owner; - } - - } - - /** - * search for valid tags - */ - $str_columns = "md5sum, "; - $str_values = "'".$md5sum."', "; - foreach($exif_tags AS $key=>$value) - { - if($value != "" && in_array($key,$this->defined_exif_fields)) - { - /** - * there are currently only entries at level deep 2 and 5 in the - * array - */ - $array_pieces = explode('/',$value); - switch(count($array_pieces)) - { - case 2: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value'])) - { - $str_columns .= strtolower($key).', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; - $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; - } - break; - case 5: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value'])) - { - $str_columns .= strtolower($key).', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; - $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; - } - break; - default: - echo "Error no valid path for key: ".$key." value: ".$value; - break; - } - } - } - +/** + * save data in DB functions + */ + /** + * store EXIF data in DB + * + * create an entry in the db even if we haven't found anything + * to prevent img_view.class.php to call this function every time + * the image is viewed + */ + function saveExifData($filename,$md5sum) + { + /** + * get exif info from file + */ + $exif_data = get_EXIF_JPEG( $filename ); + + /** + * get exif tags + */ + $exif_tags = $this->getExifTranslationArray(); + + /** + * special tags + */ + // Canon Owner Name append to Artist + if(isset($exif_data['Makernote_Tag']['Decoded Data']) + && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string + && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) + { + $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; + if(isset($exif_data[0][315]['Text Value'])) + { + $exif_data[0][315]['Text Value'] .= $owner; + } + else + { + $exif_data[0][315]['Text Value'] = $owner; + } + + } + + /** + * search for valid tags + */ + $str_columns = "md5sum, "; + $str_values = "'".$md5sum."', "; + foreach($exif_tags AS $key=>$value) + { + $key = strtolower($key); + + if($value != "" && isset($this->defined_fields['exif'][$key])) + { + /** + * there are currently only entries at level deep 2 and 5 in the + * array + */ + $array_pieces = explode('/',$value); + switch(count($array_pieces)) + { + case 2: + if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value'])) + { + $str_columns .= $key.', '; + + $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; + $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; + } + break; + case 5: + if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value'])) + { + $str_columns .= $key.', '; + + $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; + $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; + } + break; + default: + echo "Error no valid path for key: ".$key." value: ".$value; + break; + } + } + } + /** * add jpegcomment */ - if(in_array('jpegcomment',$this->defined_exif_fields)) + if(in_array('jpegcomment',$this->defined_fields['exif'])) { $jpeg_header_data = get_jpeg_header_data( $filename ); $comment = get_jpeg_Comment( $jpeg_header_data ); @@ -274,100 +288,100 @@ $str_values .= "'".linSql::linAddslashes(trim( $comment ))."', "; } } - - /** - * remove last two signs - */ - $str_columns = substr($str_columns,0,strlen($str_columns)-2); - $str_values = substr($str_values,0,strlen($str_values)-2); - - + + /** + * remove last two signs + */ + $str_columns = substr($str_columns,0,strlen($str_columns)-2); + $str_values = substr($str_values,0,strlen($str_values)-2); + + /** * no double entries */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".PREFIX."meta_exif ". - "WHERE md5sum = '".$md5sum."'"); - $num = $query->RecordCount(); - if($num == 0) - { + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".PREFIX."meta_exif ". + "WHERE md5sum = '".$md5sum."'"); + $num = $query->RecordCount(); + if($num == 0) + { $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_exif (".$str_columns.") ". "VALUES (".$str_values.")"); - } - } + } + } /** * esacape sql strings a clean way - + function cleansql($text) - { - $return=""; - $chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY); + { + $return=""; + $chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY); $count = count($chars); - for ($c=0; $c<$count; $c++) - { - $letter=$chars[$c]; - if (!preg_match("/[a-zA-Z0-9]/", $letter)) - { - $return .= "\\$letter"; - } - else - { - $return .= "$letter"; - } - } - return $return; + for ($c=0; $c<$count; $c++) + { + $letter=$chars[$c]; + if (!preg_match("/[a-zA-Z0-9]/", $letter)) + { + $return .= "\\$letter"; + } + else + { + $return .= "$letter"; + } + } + return $return; } - */ - /** - * store IPTC data in DB - */ - function saveIptcData($filename, $md5sum) - { - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data($filename); - - if($jpeg_header_data) - { - // get array with all available IPTC data - $IPTC_Info = get_Photoshop_IPTC(get_Photoshop_IRB($jpeg_header_data)); - - // init values (prevent php notice msg if not set) - $caption = ""; - $object_name = ""; - $edit_status = ""; - $priority = ""; - $category = ""; - $supplemental_categorie = ""; - $job_id = ""; - $keywords = ""; - $date_released = ""; - $time_released = ""; - $instructions = ""; - $date_created = ""; - $time_created = ""; - $program = ""; - $object_cycle = ""; - $byline = ""; - $byline_title = ""; - $city = ""; - $sublocation = ""; - $state = ""; - $country_code = ""; - $country = ""; - $trans_reference = ""; - $headline = ""; - $credit = ""; - $source = ""; - $copyright = ""; - $caption_writer = ""; - - $IPTC_Meta = array(); - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".PREFIX."meta_iptc " . - "WHERE md5sum = '".$md5sum."' "); - $num = $query->RecordCount(); - - if($num == 0) - { + */ + /** + * store IPTC data in DB + */ + function saveIptcData($filename, $md5sum) + { + // Retrieve the header information + $jpeg_header_data = get_jpeg_header_data($filename); + + if($jpeg_header_data) + { + // get array with all available IPTC data + $IPTC_Info = get_Photoshop_IPTC(get_Photoshop_IRB($jpeg_header_data)); + + // init values (prevent php notice msg if not set) + $caption = ""; + $object_name = ""; + $edit_status = ""; + $priority = ""; + $category = ""; + $supplemental_categorie = ""; + $job_id = ""; + $keywords = ""; + $date_released = ""; + $time_released = ""; + $instructions = ""; + $date_created = ""; + $time_created = ""; + $program = ""; + $object_cycle = ""; + $byline = ""; + $byline_title = ""; + $city = ""; + $sublocation = ""; + $state = ""; + $country_code = ""; + $country = ""; + $trans_reference = ""; + $headline = ""; + $credit = ""; + $source = ""; + $copyright = ""; + $caption_writer = ""; + + $IPTC_Meta = array(); + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".PREFIX."meta_iptc " . + "WHERE md5sum = '".$md5sum."' "); + $num = $query->RecordCount(); + + if($num == 0) + { if(is_array($IPTC_Info)) { // Cycle through each of the IPTC-NAA IIM records @@ -496,14 +510,14 @@ "edit_status, priority, object_cycle, job_id, program, " . "object_name, date_created, date_released, time_created, " . "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . + "country_code, trans_reference) " . "VALUES('".$md5sum."', '".$caption."', '".$caption_writer."', '".$headline."', " . "'".$instructions."', '".$keywords."', '".$category."', '".$supplemental_categorie."', " . "'".$copyright."', '".$byline."', '".$byline_title."', '".$credit."', '".$source."', " . "'".$edit_status."', '".$priority."', '".$object_cycle."', '".$job_id."', '".$program."', " . "'".$object_name."', '".$date_created."', '".$date_released."', '".$time_created."', " . "'".$time_released."', '".$city."', '".$sublocation."', '".$state."', '".$country."', " . - "'".$country_code."', '".$trans_reference."', '0')"); + "'".$country_code."', '".$trans_reference."')"); return true; } @@ -512,544 +526,500 @@ /** * save empty entry to prevent re-read on every page visit */ - $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '', '', '', '', '', '', '', '', '', '', '', '', " . - "'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1')"); + $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."meta_iptc " . + "(md5sum) VALUES('".$md5sum."')"); return false; } - } - } - else - { - return false; - } - } + } + } + else + { + return false; + } + } + + +/** + * edit iptc functions + */ /** - * generate "more EXIF details" link. Used if we have only IPTC data but - * also wonna have an option to display EXIF + * edit IPTC Data in HTML popup + */ + function editIptcData() + { + + } + + /** + * save modified IPTC data to DB */ - /*function showMoreDetailLink($meta) + function saveModIptcData() { - global $exif_less, $exif_more; - if($meta == "exif") - { - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; - echo "<tr><td colspan='2' align='center'>".$link."2'>". - "<u><b>".$exif_more." (EXIF)</b></u></a></td></tr>"; + } - } - else - { - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&iptc="; - echo "<tr><td colspan='2' align='center'>".$link."2'>". - "<u><b>".$exif_more." (IPTC)</b></u></a></td></tr>"; - } - }*/ - - /** - * prepare EXIF HTML output left menu (get from DB) - */ - /*function showExifData($md5sum) - { - global $exif_less, $exif_more, $str_search_all_images_taken; - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; - switch(read_config("exif_level")) - { - case 'low': $exif_level = 1; break; - case 'medium': $exif_level = 2; break; - case 'high': $exif_level = 3; break; - } - - /** - * set exif setting in $_SESSION - - $show_exif = true; - - if(isset($_GET['exif']) && !isset($_GET['iptc'])) - { - $_SESSION['exif'] = $_GET['exif']; - - if($_GET['exif'] == 0) - { - $show_exif = false; - unset($_SESSION['exif']); - - } else { - $exif_level = $_GET['exif']; - } - } - elseif( isset($_SESSION['exif']) ) - { - ... [truncated message content] |
From: <bz...@us...> - 2006-04-03 11:24:20
|
Revision: 4478 Author: bzrudi Date: 2006-04-03 04:23:55 -0700 (Mon, 03 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4478&view=rev Log Message: ----------- Installer should work now for all supported databases. Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/footer.php trunk/linpha2/install/header.php trunk/linpha2/install/header_html.php trunk/linpha2/install/index.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/lib.requirements.php trunk/linpha2/install/manual_install.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step1_license.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/ChangeLog 2006-04-03 11:23:55 UTC (rev 4478) @@ -1,3 +1,7 @@ +2006-04-03 bzrudi <linpha2_AT_tuxpower_DOT_de> + * Installer should work now for all supported databases. + -> finished language stuff + 2006-04-02 flo * added integrity check (checks album, tmp and cache folder) * updated documentation, added todo list Modified: trunk/linpha2/install/footer.php =================================================================== --- trunk/linpha2/install/footer.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/footer.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ ?> <br /><br /> Modified: trunk/linpha2/install/header.php =================================================================== --- trunk/linpha2/install/header.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/header.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR."/install/lib.install.php"); @@ -73,10 +74,7 @@ } if(file_exists(LINPHA_DIR."/install/lang/lang.".$include_lang.".php")) { - include_once(LINPHA_DIR."/install/lang/lang.English.php"); include_once(LINPHA_DIR."/install/lang/lang.".$include_lang.".php"); - } else { - include_once(LINPHA_DIR."/install/lang/lang.English.php"); } @@ -120,6 +118,7 @@ if($key == 0) { $show_back_button = false; + $back_file = $files[$key]; } else { Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/header_html.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" Modified: trunk/linpha2/install/index.php =================================================================== --- trunk/linpha2/install/index.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/index.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -19,6 +19,7 @@ /** * linpha installer + * @package Installation */ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } @@ -50,15 +51,33 @@ echo "<br /><select name='language' size='1'>"; $options = get_available_language_files(); -foreach($options AS $value) +if(is_array($options)) { - if($value == $lang) { - $checked = ' selected="selected"'; - } else { - $checked = ''; +/** + * always include enable English + */ +echo "<option value='English' selected='selected'>English</option>\n"; + + foreach($options AS $value) + { + if($value == $lang) { + $checked = ' selected="selected"'; + } + else + { + $checked = ''; + } + echo "<option value='".$value."'".$checked.">".$value."</option>\n"; } - echo "<option value='".$value."'".$checked.">".$value."</option>\n"; } +else +{ + /** + * no langauge other than English available + */ + echo "<option value='English' selected='selected'>English</option>\n"; +} + ?> </select> Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/lib.install.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -23,6 +23,7 @@ * This simple method takes care of all translation related stuff. * If option tr_learn is set - all new entries will be autolearned. * @param string $text phrase/word to translate + * @package Installation */ function tr($text) { @@ -265,7 +266,7 @@ $file_handle = opendir($folder); $file = readdir($file_handle); - $options = array(); + //$options = array(); while($file != false) { $explode = explode(".",$file); @@ -279,8 +280,10 @@ } /* Sort language files aphabetically */ - asort($options); - + if(is_array($options)) + { + asort($options); + } return $options; } Modified: trunk/linpha2/install/lib.requirements.php =================================================================== --- trunk/linpha2/install/lib.requirements.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/lib.requirements.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -1,8 +1,24 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ - /** -* @package requirements +* @package Installation */ function check_convert() { Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/manual_install.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,15 +21,16 @@ /** * linpha installer + * @package Installation */ $is_special = true; $key = 9; -include_once(LINPHA_DIR."/install/header.php"); +include_once(LINPHA_DIR.'/install/header.php'); $back_file = "step3_dbtype.php"; -include_once("./header_html.php"); +include_once(LINPHA_DIR.'/install/header_html.php'); /** * initialize variables @@ -82,7 +83,7 @@ /** * get table names and add prefix */ - include_once(LINPHA_DIR."/install/sql/sql.tables.php"); + include_once(LINPHA_DIR.'/install/sql/sql.tables.php'); foreach($linpha_tables AS $key=>$value) { $linpha_tables[$key] = PREFIX.$value; Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -19,6 +19,7 @@ /** * linpha installer + * @package Installation */ /** Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step10_postsettings.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -19,6 +19,7 @@ /** * linpha installer + * @package Installation */ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } Modified: trunk/linpha2/install/step1_license.php =================================================================== --- trunk/linpha2/install/step1_license.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step1_license.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -19,6 +19,7 @@ /** * linpha installer + * @package Installation */ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step2_requirements.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); @@ -75,7 +76,7 @@ else { print_line_right(failed_msg()); - print_line_info("PHP Version >= 5.0.0 Required"); + print_line_info("PHP Version >= 5.0.0 is required"); $error = 1; } @@ -98,7 +99,8 @@ { print_line_middle("NONE"); print_line_right(failed_msg()); - print_line_info("Enable at least support for one Database in " . "your PHP configuration (php.ini)"); + print_line_info("Enable at least support for one Database in " . + "your PHP configuration file (php.ini)"); $error = 1; } else @@ -141,7 +143,9 @@ if($convert_version == "6.1.1" OR $convert_version == "6.1.2" OR $convert_version == "6.1.3") { print_line_right(warning_msg()); - print_line_info($convert_unsupported_msg); //TODO language + print_line_info("ImageMagick Versions 6.1.1 to 6.1.3 contain a bug " . + "which makes it unusable. Please consider using another " . + "Version or make use of GD library"); } else { @@ -225,7 +229,8 @@ { print_line_middle("No"); print_line_right(failed_msg()); - print_line_info($gd_jpg_missing_msg."<br />".$inst_linpha_not_work_correctly); //TODO language + print_line_info("Your GD Library lacks JPEG support, " . + "LinPHA will not support JPEG Images")."!"; $error = 1; } @@ -306,7 +311,10 @@ { print_line_middle($limit.' MB'); print_line_right(warning_msg()); - print_line_info($mem_limit_low_msg); + print_line_info("Your PHP memory limit is probably to low. If you " . + "encounter problems with creating thumbnails, try to increase " . + "the memory_limit in php.ini or resize your pictures to a " . + "lower resolution and try again."); } else { @@ -364,7 +372,7 @@ { print_line_middle("No"); print_line_right(failed_msg()); - print_line_info(sprintf($str_make_dir_writable,""<b>linpha/var</b>"")); //TODO language + print_line_info("Please make sure the directory /linpha/var/ is writeable"); $error = 1; } @@ -376,7 +384,7 @@ print_foot(); echo "<br />"; -echo tr("For More Detailed Info - Please Click On The Status Text")."<br />"; +echo tr("For more detailed info - Please click on the status info text above")."<br />"; ?> <a href="#" onclick="show_hide_tables('',<?php echo $table_lines; ?>)"> @@ -398,7 +406,7 @@ if(isset($error)) { echo "<h2>".tr("!!! INSTALLATION ABORTED !!!")."</h2><br />"; - echo "There was at least one serious error - continue at your own risk"; + echo tr("There was at least one serious error - continue at your own risk"); } include_once(LINPHA_DIR.'/install/footer.php'); Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step3_dbtype.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -19,6 +19,7 @@ /** * linpha installer + * @package Installation */ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step6_selectdatabase.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step7_selectprefix.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); @@ -31,7 +32,7 @@ */ if($_SESSION['sql_dbtype'] == "sqlite") { - $back_file = "step4_mode.php"; + $back_file = "step4_selectdirectories.php"; } include_once(LINPHA_DIR.'/install/header_html.php'); Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step8_testing.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-04-02 21:04:36 UTC (rev 4477) +++ trunk/linpha2/install/step9_createtables.php 2006-04-03 11:23:55 UTC (rev 4478) @@ -21,6 +21,7 @@ /** * linpha installer + * @package Installation */ include_once(LINPHA_DIR.'/install/header.php'); @@ -115,20 +116,19 @@ * create cache directories */ echo "<br /><br />".tr("Creating Directories")."... "; - mkdir( get_full_path( $_SESSION['cache_dir'] ), 0700 ); - mkdir(get_full_path( $_SESSION['cache_dir'] ).'img', 0700); - mkdir(get_full_path( $_SESSION['cache_dir'] ).'thumb', 0700); + @mkdir(get_full_path( $_SESSION['cache_dir'] ), 0700 ); + @mkdir(get_full_path( $_SESSION['cache_dir'] ).'img', 0700); + @mkdir(get_full_path( $_SESSION['cache_dir'] ).'thumb', 0700); /** * create tmp dirs */ - mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); - //mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); + @mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); /** * create sql dir */ - mkdir( get_full_path( $_SESSION['sql_dir'] ), 0700 ); + @mkdir( get_full_path( $_SESSION['sql_dir'] ), 0700 ); echo success_msg(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-04-03 12:34:34
|
Revision: 4480 Author: bzrudi Date: 2006-04-03 05:34:20 -0700 (Mon, 03 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4480&view=rev Log Message: ----------- minor improvements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/header.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step8_testing.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-03 11:31:55 UTC (rev 4479) +++ trunk/linpha2/ChangeLog 2006-04-03 12:34:20 UTC (rev 4480) @@ -1,6 +1,8 @@ 2006-04-03 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer should work now for all supported databases. -> finished language stuff + -> TODO: allow postgres install without password + : more help entries, better mysql non root install support 2006-04-02 flo * added integrity check (checks album, tmp and cache folder) Modified: trunk/linpha2/install/header.php =================================================================== --- trunk/linpha2/install/header.php 2006-04-03 11:31:55 UTC (rev 4479) +++ trunk/linpha2/install/header.php 2006-04-03 12:34:20 UTC (rev 4480) @@ -54,7 +54,7 @@ * make sure we don't have a include($_POST['language']) !!! */ $array_langs = get_available_language_files(); - $key = array_search( $_POST['language'], $array_langs); + $key = @array_search( $_POST['language'], $array_langs); if( $key === false ) { $include_lang = 'English'; @@ -71,6 +71,7 @@ else { $include_lang = 'English'; + $_SESSION['language'] = "English"; } if(file_exists(LINPHA_DIR."/install/lang/lang.".$include_lang.".php")) { Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-04-03 11:31:55 UTC (rev 4479) +++ trunk/linpha2/install/lib.install.php 2006-04-03 12:34:20 UTC (rev 4480) @@ -280,11 +280,11 @@ } /* Sort language files aphabetically */ - if(is_array($options)) + if(@is_array($options)) { asort($options); } - return $options; + return @$options; } function get_http_accept_lang() Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2006-04-03 11:31:55 UTC (rev 4479) +++ trunk/linpha2/install/step6_selectdatabase.php 2006-04-03 12:34:20 UTC (rev 4480) @@ -78,7 +78,7 @@ $result = mysql_query("CREATE DATABASE linpha_test_".$curtime); if($result) { - $able_to_create_database = true; + $_SESSION['allowed_to_create_db'] = true; mysql_query("DROP DATABASE linpha_test_".$curtime); $db_list = mysql_list_dbs($link); @@ -89,13 +89,13 @@ } else { - $able_to_create_database = false; + $_SESSION['allowed_to_create_db'] = false; } } break; case "postgres": - $able_to_create_database = false; + $_SESSION['allowed_to_create_db'] = false; break; // case "sqlite": sqlite goes directly to stage8 } @@ -116,7 +116,7 @@ <hr> <br /> <?php -if($able_to_create_database) +if($_SESSION['allowed_to_create_db'] == true) { /** * search a valid database name (which doesn't already exists) @@ -181,7 +181,7 @@ ?> <br /> <select name="sql_dbname_installinto"<?php - if($able_to_create_database) + if($_SESSION['allowed_to_create_db'] == true) { echo 'onChange="document.getElementById(\'radio_db2\').checked = true;"'; } @@ -204,13 +204,14 @@ <?php } -if(!$able_to_create_database AND !isset($database)) +if($_SESSION['allowed_to_create_db'] == false AND !isset($database)) { - echo tr("Install Linpha Into").":<br />"; + echo tr("Name Of Database To Use (Must Exist)").":<br />"; ?> <input type="text" name="sql_dbname_installinto" value="<?php echo isset($_SESSION['sql_dbname']) ? $_SESSION['sql_dbname'] : '' ; ?>"> + <?php } Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-04-03 11:31:55 UTC (rev 4479) +++ trunk/linpha2/install/step8_testing.php 2006-04-03 12:34:20 UTC (rev 4480) @@ -122,7 +122,7 @@ $n_runs = 1; if($_SESSION['sql_dbtype']=="mysql") { - echo tr("Trying To Create New Database User")."... "; + echo tr("Trying To Create New LinPHA Database User")."... "; $random_pass = random_password(8); $random_user = "linpha_".random_password(4); @@ -137,16 +137,18 @@ "IDENTIFIED BY '".$random_pass."' WITH GRANT OPTION") ) { echo warning_msg(); - echo "<br />".tr("Failed To Create New User"); - echo "<br />".tr("Will use the one you specified for all linpha operations..."); + echo "<br />".tr("Failed To Create New LinPHA User"); + echo "<br />".tr("Seems you are not allowed to create new Database users - " . + "using given defaults (NOTE: Installation should still work)")."... "; } else { if(! $linpha->db->Execute("FLUSH PRIVILEGES") ) { echo warning_msg(); - echo "<br />".tr("Failed To Create New User"); - echo "<br />".tr("Will use the one you specified for all linpha operations..."); + echo "<br />".tr("Failed To Create New LinPHA User"); + echo "<br />".tr("Seems you are not allowed to create new Database users - " . + "using given defaults (NOTE: Installation should still work)")."... "; } else { @@ -157,8 +159,9 @@ if(! $test_conn->Connect($_SESSION['sql_hostname'], $random_user, $random_pass, $_SESSION['sql_dbname']) ) { echo warning_msg(); - echo "<br />".tr("Failed To Create New User"); - echo "<br />".tr("Will use the one you specified for all linpha operations..."); + echo "<br />".tr("Failed To Create New LinPHA User"); + echo "<br />".tr("Seems you are not allowed to create new Database users - " . + "using given defaults (NOTE: Installation should still work)")."... "; } else { @@ -178,8 +181,10 @@ */ /** * prevent test running sqlite db - * @todo why?? -flo + * @todo why?? -flo + * @todo - because at least alter will fail ;-) - bzrudi */ + if($_SESSION['sql_dbtype'] != 'sqlite') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-06 21:37:33
|
Revision: 4484 Author: fangehrn Date: 2006-04-06 14:37:14 -0700 (Thu, 06 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4484&view=rev Log Message: ----------- * added user login system Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/install/step11_finish.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/templates/default/global.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/ChangeLog 2006-04-06 21:37:14 UTC (rev 4484) @@ -1,3 +1,6 @@ +2006-04-06 flo + * added user login system + 2006-04-04 flo * improving some templates Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-04-06 21:37:14 UTC (rev 4484) @@ -23,88 +23,99 @@ $sql_tables = array( "CREATE TABLE ".$linpha_tables['config']." ( ". - "`id` smallint(5) unsigned NOT NULL auto_increment, " . - "`option_name` varchar(50) NOT NULL default '', " . - "`option_value` varchar(100) NOT NULL default '', " . - "`userid` mediumint(8) unsigned default '0', " . - "PRIMARY KEY (`id`) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "option_name VARCHAR(255) NOT NULL default '', " . + "option_value VARCHAR(255) NOT NULL default '', " . + "userid INT default '0', " . + "override INT default '0', " . + "PRIMARY KEY (id) " . ")", + "CREATE TABLE ".$linpha_tables['users']." ( ". + "id INT NOT NULL AUTO_INCREMENT , " . + "username VARCHAR(255) NOT NULL , " . + "password VARCHAR(32) NOT NULL , " . + "email VARCHAR(255) NOT NULL , " . + "display_name VARCHAR(255) NOT NULL , " . + "stats_downloads INT NOT NULL , " . + "stats_downloads_size INT NOT NULL, " . + "PRIMARY KEY (id) " . + ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". - "`id` int(11) NOT NULL auto_increment, " . - "`name` varchar(100) NOT NULL default '', " . - "PRIMARY KEY (`id`) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "name VARCHAR(100) NOT NULL default '', " . + "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "`id` int(11) NOT NULL auto_increment, " . - "`photos_id` int(11) NOT NULL default '0', " . - "`perm_type` varchar(255) NOT NULL default '0', " . - "`permission` varchar(255) NOT NULL default '', " . - "PRIMARY KEY (`id`) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "photos_id INT NOT NULL default '0', " . + "perm_type VARCHAR(255) NOT NULL default '0', " . + "permission VARCHAR(255) NOT NULL default '', " . + "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['photos']." ( ". - "`id` int(11) NOT NULL auto_increment, " . - "`parent_id` int(11) NOT NULL default '0', " . - "`img_type` int(11) NOT NULL default '0', " . - "`name` text NOT NULL, " . - "`md5sum` varchar(40) NOT NULL default '', " . - "`time_add` int(11) NOT NULL default '0', " . - "`time_mod` int(11) NOT NULL default '0', " . - "`time_exif` int(11) NOT NULL default '0', " . - "`stats_numbers` int(11) NOT NULL default '0', " . - "`stats_views` int(11) NOT NULL default '0', " . - "`stats_downloads` int(11) NOT NULL default '0', " . - "PRIMARY KEY (`id`) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "parent_id INT NOT NULL default '0', " . + "img_type INT NOT NULL default '0', " . + "name text NOT NULL, " . + "md5sum VARCHAR(40) NOT NULL default '', " . + "time_add INT NOT NULL default '0', " . + "time_mod INT NOT NULL default '0', " . + "time_exif INT NOT NULL default '0', " . + "stats_numbers INT NOT NULL default '0', " . + "stats_views INT NOT NULL default '0', " . + "stats_downloads INT NOT NULL default '0', " . + "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id int(11) NOT NULL auto_increment, " . - "name varchar(255) NOT NULL default '', " . - "field_type int(11) NOT NULL default '0', " . - "flags int(11) NOT NULL default '0', " . - "PRIMARY KEY (id) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "name VARCHAR(255) NOT NULL default '', " . + "field_type INT NOT NULL default '0', " . + "flags INT NOT NULL default '0', " . + "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id int(11) NOT NULL auto_increment, " . - "field_id int(11) NOT NULL default '0', " . - "name varchar(255) NOT NULL default '', " . - "isprivate int(11) default NULL, " . - "PRIMARY KEY (id) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "field_id INT NOT NULL default '0', " . + "name VARCHAR(255) NOT NULL default '', " . + "isprivate INT default NULL, " . + "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum varchar(32) NOT NULL default '', " . - "datetimeoriginal varchar(255) default NULL, " . - "make varchar(255) default NULL, " . - "model varchar(255) default NULL, " . - "artist varchar(255) default NULL, " . - "copyright varchar(255) default NULL, " . - "aperturevalue varchar(255) default NULL, " . - "shutterspeedvalue varchar(255) default NULL, " . - "exposuretime varchar(255) default NULL, " . - "isospeedratings varchar(255) default NULL, " . - "flash varchar(255) default NULL, " . - "focallength varchar(255) default NULL, " . - "fnumber varchar(255) default NULL, " . + "md5sum VARCHAR(32) NOT NULL default '', " . + "datetimeoriginal VARCHAR(255) default NULL, " . + "make VARCHAR(255) default NULL, " . + "model VARCHAR(255) default NULL, " . + "artist VARCHAR(255) default NULL, " . + "copyright VARCHAR(255) default NULL, " . + "aperturevalue VARCHAR(255) default NULL, " . + "shutterspeedvalue VARCHAR(255) default NULL, " . + "exposuretime VARCHAR(255) default NULL, " . + "isospeedratings VARCHAR(255) default NULL, " . + "flash VARCHAR(255) default NULL, " . + "focallength VARCHAR(255) default NULL, " . + "fnumber VARCHAR(255) default NULL, " . "jpegcomment VARCHAR(255) default NULL, " . - "PRIMARY KEY (md5sum), " . + "PRIMARY KEY (md5sum), " . "KEY md5sum (md5sum) " . ")", "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum varchar(32) NOT NULL default '', " . - "PRIMARY KEY (md5sum), " . + "md5sum VARCHAR(32) NOT NULL default '', " . + "PRIMARY KEY (md5sum), " . "KEY md5sum (md5sum) " . ")", "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id int(11) NOT NULL auto_increment, " . - "`time` int(11) NOT NULL default '0', " . - "md5sum varchar(32) NOT NULL default '', " . - "author varchar(255) NOT NULL default '', " . - "`comment` text NOT NULL, " . - " PRIMARY KEY (id) " . + "id INT NOT NULL AUTO_INCREMENT, " . + "time INT NOT NULL default '0', " . + "md5sum VARCHAR(32) NOT NULL default '', " . + "author VARCHAR(255) NOT NULL default '', " . + "comment text NOT NULL, " . + " PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id int(11) NOT NULL auto_increment, " . - "field_id int(11) NOT NULL default '0', " . - "md5sum varchar(32) NOT NULL default '', " . - "meta_data varchar(255) NOT NULL default '', " . + "id INT NOT NULL AUTO_INCREMENT, " . + "field_id INT NOT NULL default '0', " . + "md5sum VARCHAR(32) NOT NULL default '', " . + "meta_data VARCHAR(255) NOT NULL default '', " . "PRIMARY KEY (id) " . ")" ); Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/install/sql/sql.tables.php 2006-04-06 21:37:14 UTC (rev 4484) @@ -23,6 +23,7 @@ $linpha_tables = Array( "config" => "config", + "users" => "users", "groups" => "groups", "permissions" => "permissions", "photos" => "photos", Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/install/step11_finish.php 2006-04-06 21:37:14 UTC (rev 4484) @@ -54,16 +54,18 @@ exit(1); } - /*echo "Adding linpha admin user... "; - //$result = $linpha->db->Execute("INSERT INTO ".PREFIX."users (nickname, password, email, lang, level, groups, fullname) " . - // "VALUES('".$linpha->sql->linAddslashes($_POST['admin_name'])."','".md5($_POST['admin_pass'])."','".$linpha->sql->linAddslashes($_POST['admin_email'])."','',10, ';1;','')"); + echo "Adding linpha admin user... "; + $result = $linpha->db->Execute("INSERT INTO ".PREFIX."users (username, password, email) VALUES (" . + "'".LinSql::linAddslashes($_POST['admin_name'])."', " . + "'".md5($_POST['admin_pass'])."', " . + "'".LinSql::linAddslashes($_POST['admin_email'])."')"); + if(!$result) { echo failed_msg(); } else { echo success_msg(); } - */ /** * save thumbnails default size Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-06 21:37:14 UTC (rev 4484) @@ -224,4 +224,65 @@ } return $str; } + +/** +* Set autologin-cookie +* +* can only be set once per request +* must be set before a header is already sent +* +* @uses LinSql::startSession +*/ +function set_linpha_cookie($userid, $md5pw) +{ + /** + * calculate correct path for cookie + * needs always to be the linpha root folder + * for example: http://localhost/linpha/index.php -> must be /linpha/ + */ + /** + * get directory and append needed ending slash + */ + $php_self_dir = dirname($_SERVER['PHP_SELF']); + $php_self_dir .= '/'; + + if(LINPHA_DIR != '.') + { + if(LINPHA_DIR == '..') + { + $num = 1; + } + else + { + $num = 1 + substr_count(TOP_DIR, '/'); + } + + /** + * remove directories + */ + for( ; $num > 0 ; $num--) + { + /** + * remove last slash + */ + $php_self_dir = substr($php_self_dir,0,strlen($php_self_dir)-1); + + /** + * get last slash + */ + $pos = strrpos($php_self_dir,'/'); + + /** + * remove last directory + */ + $php_self_dir = substr($php_self_dir,0,$pos+1); + } + } + + /** + * set the cookie + */ + setcookie("linpha_userid", $userid, (time() + 60 * 60 * 24 * 31), $php_self_dir); + setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); +} ?> Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-06 21:37:14 UTC (rev 4484) @@ -168,23 +168,31 @@ /** * read cookie - */ + */ if($this->config->value['sys_user_autologin']) { if(!isset($_SESSION['user_name']) && isset($_COOKIE["linpha_userid"])&&$_COOKIE["linpha_userid"]!=""&& isset($_COOKIE["linpha_password"])&&$_COOKIE["linpha_password"]!="") { - $query_username = $GLOBALS['linpha']->db->Execute("SELECT nickname, level, groups, fullname FROM ".PREFIX."users ". - "WHERE ID = '".linSql::linAddslashes($_COOKIE["linpha_userid"])."' ". - "AND password = '".linSql::linAddslashes($_COOKIE["linpha_password"])."'"); - if($row = $query_username->FetchRow()) + $query = $GLOBALS['linpha']->db->Execute("SELECT username, display_name FROM ".PREFIX."users ". + "WHERE id = '".LinSql::linAddslashes($_COOKIE["linpha_userid"])."' ". + "AND password = '".LinSql::linAddslashes($_COOKIE["linpha_password"])."'"); + if($data = $query->FetchRow()) { - $_SESSION["REMOTE_ADDR"] = @$_SERVER["REMOTE_ADDR"]; - $_SESSION["user_name"] = $row[0]; - $_SESSION["user_pass"] = $_COOKIE["linpha_password"]; - //$_SESSION["user_level"] = $row[1]; // Store user level - $_SESSION["user_groups"] = $row[2]; // Store user group membership - $_SESSION["user_fullname"] = (empty($row[3])) ? $row[0] : $row[3]; // Store user fullname + //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); + linSysLog(i18n("Successfully Logged In!<br />")); + + /** + * store user stuff + */ + $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; + $_SESSION['user_name'] = $data['username']; + $_SESSION['user_id'] = $_COOKIE["linpha_userid"]; + + /** + * Store users display name. If display name is blank - store username. + */ + $_SESSION['user_displayname'] = (empty($data['display_name'])) ? $_SESSION['user_name'] : $data['display_name']; } else // wrong cookie { @@ -195,21 +203,107 @@ } /** - * check login + * check login and fill session */ - if(isset($_SESSION['user_name']) && isset($_SESSION['user_pass'])) + if( isset($_POST['cmd']) ) { - $this->passed=true; - if (@$_SESSION["REMOTE_ADDR"]!=@$_SERVER["REMOTE_ADDR"]) + if($_POST['cmd']=='logout') { - // ip check wrong! + /** + * @todo + */ + //linpha_log('login','notice','User '.@$_SESSION['user_name'].": logged out"); + //$this->passed=false; + $_SESSION = array(); // delete all session data + session_destroy(); // destroy session + + if(isset($_COOKIE["linpha_userid"])) { + setcookie("linpha_userid"); // delete cookie linpha_userid + setcookie("linpha_password"); // delete cookie linpha_password + } + } + elseif($_POST['cmd']=='login') + { + if( !isset($_POST['username']) OR !isset($_POST['password']) OR empty($_POST['username']) OR empty($_POST['password'])) + { + linSysLog(i18n("Please Fill In All Fields!")); + } + else + { + /** + * get user from DB + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT id, username, password, id, display_name FROM ".PREFIX."users ". + "WHERE username='".LinSql::linAddslashes($_POST['username'])."'"); + + if( $_POST['username'] == $data['username'] && md5($_POST['password']) == $data['password']) + { + /** + * Log sucessfull login + * @todo + */ + //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); + linSysLog(i18n("Successfully Logged In!<br />")); + + /** + * store user stuff + */ + $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; + $_SESSION['user_name'] = $_POST['username']; + $_SESSION['user_id'] = $data['id']; + + /** + * Store users display name. If display name is blank - store username. + */ + $_SESSION['user_displayname'] = (empty($data['display_name'])) ? $_SESSION['user_name'] : $data['display_name']; + + if(isset($_POST['rememberme'])) { + set_linpha_cookie($data['id'], md5($_POST['password'])); + } + + /** + * some security stuff + */ + unset($_POST['password']); + unset($_REQUEST['password']); + } + else + { + /** + * Log failed login + * @todo + */ + //linpha_log('login','error','User '.$_POST['user_name'].": login failed!"); + + linSysLog(i18n("Login Failed!<br />")); + } + } + } + } + + /** + * set passed + * check remote_addr + */ + if(isset($_SESSION['user_id']) && isset($_SESSION['user_name']) && !empty($_SESSION['user_id']) && !empty($_SESSION['user_name']) ) + { + if( isset($_SERVER['REMOTE_ADDR']) && ($_SESSION["REMOTE_ADDR"] != $_SERVER["REMOTE_ADDR"]) ) + { + /** + * ip check wrong! + */ $this->passed=false; - unset($_SESSION['user_name'], $_SESSION['user_pass'], $_SESSION['user_groups'], $_SESSION['user_fullname']); + $_SESSION = array(); session_destroy(); } - - } else { + else + { + $this->passed=true; + } + } + else + { $this->passed=false; } Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-04-04 21:03:53 UTC (rev 4483) +++ trunk/linpha2/templates/default/global.html.php 2006-04-06 21:37:14 UTC (rev 4484) @@ -93,9 +93,21 @@ <ul> <li> <div> - <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> - <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> - <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> + <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> + <?php if($GLOBALS['linpha']->sql->passed) { ?> + <!-- logout infos --> + <?php echo i18n("You Are Currently Logged In As:").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />'; ?> + <input type="hidden" name="cmd" value="logout" /> + <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> + <?php } else { ?> + <!-- login infos --> + <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> + <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> + <?php if($GLOBALS['linpha']->sql->config->value['sys_user_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="checkbox_remember" /><label for="checkbox_remember"><?php echo i18n("Remember Me"); ?></label><?php } ?> + <input type="hidden" name="cmd" value="login" /> + <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> + <?php } ?> + </form> </div> </li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-07 19:49:55
|
Revision: 4485 Author: fangehrn Date: 2006-04-07 12:49:35 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4485&view=rev Log Message: ----------- fixed some notices in installer Modified Paths: -------------- trunk/linpha2/docs/TODO.txt trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/reset_database.php Modified: trunk/linpha2/docs/TODO.txt =================================================================== --- trunk/linpha2/docs/TODO.txt 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/docs/TODO.txt 2006-04-07 19:49:35 UTC (rev 4485) @@ -8,17 +8,31 @@ Currently the no-javscript site is loaded with a javascript location.href to the javascript enabled site -> High Pageload, LinSysLog doesnt work +- define installer behaviour + - if installation is complete, the user must delete the install/ folder ? + - user have to delete var/sql/config.sql.php before another installation can continue ? + -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) + -> should we really delete the content of the cache folders? what if the user specify wrongly the album folder as the cache folder...?? ## Big Todos - get_image.php (Image View, Image Cache) -- Slideshow (copy from linpha1) - Search (copy from linpha1) - Basket (finish) - Support for the Icons -- IPTC Image fields - - Write IPTC entries (see also https://sourceforge.net/forum/message.php?msg_id=3648731) +- use lightbox + http://www.huddletogether.com/projects/lightbox2/ + +- IPTC/XMP Image fields + - Read XMP entries + - Write IPTC/XMP entries + - UTF-8 support + - see also + https://sourceforge.net/forum/message.php?msg_id=3648731) + and + https://sourceforge.net/forum/message.php?msg_id=3674100 + - Videos - Video thumbnail (what about ffmpeg?) - switch between quicktime and mplayer? Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -57,8 +57,8 @@ /** * groups */ -$sql_queries[] = "INSERT INTO ".PREFIX."groups (name) VALUES ('group1')"; -$sql_queries[] = "INSERT INTO ".PREFIX."groups (name) VALUES ('group2')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('group1')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('group2')"; /** * permissions Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -42,9 +42,15 @@ ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". "id INT NOT NULL AUTO_INCREMENT, " . - "name VARCHAR(100) NOT NULL default '', " . + "group_name VARCHAR(255) NOT NULL default '', " . "PRIMARY KEY (id) " . ")", + "CREATE TABLE ".$linpha_tables['user_group']." ( ". + "id INT NOT NULL AUTO_INCREMENT, " . + "group_id INT NOT NULL, " . + "user_id INT NOT NULL, " . + "PRIMARY KEY (id) " . + ")", "CREATE TABLE ".$linpha_tables['permissions']." ( ". "id INT NOT NULL AUTO_INCREMENT, " . "photos_id INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/sql/sql.tables.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -25,6 +25,7 @@ "config" => "config", "users" => "users", "groups" => "groups", + "user_group" => "user_group", "permissions" => "permissions", "photos" => "photos", "meta_fields" => "meta_fields", Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step10_postsettings.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -30,7 +30,7 @@ /** * now, it is too late to go back... */ -if($_SESSION['install_mode'] =="manual") +if(isset($_SESSION['install_mode']) && $_SESSION['install_mode'] =="manual") { $back_file = "manual_install.php"; $show_back_button = true; Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -49,7 +49,7 @@ * sqlite doesn't know anyhting about username, password, hostname and * databasename -> skip the following pages */ - if($_SESSION['sql_dbtype'] == "sqlite") + if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") { $_SESSION['sql_username'] = ''; $_SESSION['sql_password'] = ''; Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -27,6 +27,27 @@ include_once(LINPHA_DIR.'/install/header.php'); /** + * validate settings + */ +if(!isset($_POST['album_dir']) OR empty($_POST['album_dir']) OR + !isset($_POST['sql_dir']) OR empty($_POST['sql_dir']) OR + !isset($_POST['cache_dir']) OR empty($_POST['cache_dir']) OR + !isset($_POST['tmp_dir']) OR empty($_POST['tmp_dir']) ) +{ + include_once(LINPHA_DIR.'/install/header_html.php'); + + echo tr("Validating Information")."... "; + echo failed_msg(); + echo "<br />".tr("Please Fill In All Fields").""; + + echo "</form>"; + $show_next_button = false; + + include_once(LINPHA_DIR.'/install/footer.php'); + exit(); +} + +/** * save settings from previous page */ $array = array('album', 'sql','cache','tmp'); @@ -71,7 +92,7 @@ /** * goto manual mode */ - if($_SESSION['install_mode'] == "manual") + if(isset($_SESSION['install_mode']) && $_SESSION['install_mode'] =="manual") { header("Location: manual_install.php"); exit(); Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step7_selectprefix.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -30,7 +30,7 @@ /** * sqlite go back stuff */ -if($_SESSION['sql_dbtype'] == "sqlite") +if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") { $back_file = "step4_selectdirectories.php"; } Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -225,64 +225,4 @@ return $str; } -/** -* Set autologin-cookie -* -* can only be set once per request -* must be set before a header is already sent -* -* @uses LinSql::startSession -*/ -function set_linpha_cookie($userid, $md5pw) -{ - /** - * calculate correct path for cookie - * needs always to be the linpha root folder - * for example: http://localhost/linpha/index.php -> must be /linpha/ - */ - /** - * get directory and append needed ending slash - */ - $php_self_dir = dirname($_SERVER['PHP_SELF']); - $php_self_dir .= '/'; - - if(LINPHA_DIR != '.') - { - if(LINPHA_DIR == '..') - { - $num = 1; - } - else - { - $num = 1 + substr_count(TOP_DIR, '/'); - } - - /** - * remove directories - */ - for( ; $num > 0 ; $num--) - { - /** - * remove last slash - */ - $php_self_dir = substr($php_self_dir,0,strlen($php_self_dir)-1); - - /** - * get last slash - */ - $pos = strrpos($php_self_dir,'/'); - - /** - * remove last directory - */ - $php_self_dir = substr($php_self_dir,0,$pos+1); - } - } - - /** - * set the cookie - */ - setcookie("linpha_userid", $userid, (time() + 60 * 60 * 24 * 31), $php_self_dir); - setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); -} ?> Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -165,7 +165,7 @@ } session_start(); - + /** * read cookie */ @@ -182,17 +182,7 @@ //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); linSysLog(i18n("Successfully Logged In!<br />")); - /** - * store user stuff - */ - $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; - $_SESSION['user_name'] = $data['username']; - $_SESSION['user_id'] = $_COOKIE["linpha_userid"]; - - /** - * Store users display name. If display name is blank - store username. - */ - $_SESSION['user_displayname'] = (empty($data['display_name'])) ? $_SESSION['user_name'] : $data['display_name']; + $this->setUserInformation($data['username'],$_COOKIE["linpha_userid"],$data['display_name']); } else // wrong cookie { @@ -245,20 +235,10 @@ //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); linSysLog(i18n("Successfully Logged In!<br />")); - /** - * store user stuff - */ - $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; - $_SESSION['user_name'] = $_POST['username']; - $_SESSION['user_id'] = $data['id']; + $this->setUserInformation($_POST['username'],$data['id'],$data['display_name']); - /** - * Store users display name. If display name is blank - store username. - */ - $_SESSION['user_displayname'] = (empty($data['display_name'])) ? $_SESSION['user_name'] : $data['display_name']; - if(isset($_POST['rememberme'])) { - set_linpha_cookie($data['id'], md5($_POST['password'])); + $this->setLinphaCookie($data['id'], md5($_POST['password'])); } /** @@ -318,13 +298,31 @@ } } // end function startSession +/** + * set user infos after correct login + */ +function setUserInformation($username,$userid,$displayname) +{ + /** + * store user stuff + */ + $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; + $_SESSION['user_name'] = $username; + $_SESSION['user_id'] = $userid; + + /** + * Store users display name. If display name is blank - store username. + */ + $_SESSION['user_displayname'] = (empty($displayname)) ? $_SESSION['user_name'] : $displayname; +} + + /** * permission stuff */ - /** * get permission string from photo id * @@ -419,11 +417,13 @@ return false; } + + + /** * other stuff */ - /** * add slashes for sql data * @@ -520,6 +520,67 @@ return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; } +/** +* Set autologin-cookie +* +* can only be set once per request +* must be set before a header is already sent +* +* @uses LinSql::startSession +*/ +function setLinphaCookie($userid, $md5pw) +{ + /** + * calculate correct path for cookie + * needs always to be the linpha root folder + * for example: http://localhost/linpha/index.php -> must be /linpha/ + */ + /** + * get directory and append needed ending slash + */ + $php_self_dir = dirname($_SERVER['PHP_SELF']); + $php_self_dir .= '/'; + + if(LINPHA_DIR != '.') + { + if(LINPHA_DIR == '..') + { + $num = 1; + } + else + { + $num = 1 + substr_count(TOP_DIR, '/'); + } + + /** + * remove directories + */ + for( ; $num > 0 ; $num--) + { + /** + * remove last slash + */ + $php_self_dir = substr($php_self_dir,0,strlen($php_self_dir)-1); + + /** + * get last slash + */ + $pos = strrpos($php_self_dir,'/'); + + /** + * remove last directory + */ + $php_self_dir = substr($php_self_dir,0,$pos+1); + } + } + + /** + * set the cookie + */ + setcookie("linpha_userid", $userid, (time() + 60 * 60 * 24 * 31), $php_self_dir); + setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); +} + } // end class linSql Modified: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/reset_database.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -3,8 +3,9 @@ include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new linpha(); -$linpha->sql->startSession(); +$linpha->sql->dbConnect(); + $_SESSION['sys_im_bracket_support'] = $GLOBALS['linpha']->sql->config->value['sys_im_bracket_support']; $_SESSION['sys_im_use_convert'] = $GLOBALS['linpha']->sql->config->value['sys_im_use_convert']; $_SESSION['sys_im_convert_path'] = $GLOBALS['linpha']->sql->config->value['sys_im_convert_path']; @@ -14,32 +15,96 @@ $_SESSION['tmp_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; +/** + * create tables + */ + /** + * get table names and add prefix + */ + include_once(LINPHA_DIR.'/install/sql/sql.tables.php'); + foreach($linpha_tables AS $key=>$value) + { + $linpha_tables[$key] = PREFIX.$value; + } + + /** + * drop tables + */ + echo tr("Drop tables")."... "; + while( list($key,$value) = each($linpha_tables) ) + { + $result = @$linpha->db->Execute("DROP TABLE ".$value); + if(!$result) + { + echo failed_msg(); + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } + } + if(!isset($error_nr)) + { + echo success_msg(); + unset($error_nr); + } -echo "<br /><br />".tr("Truncate Table Data")."... "; -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."config"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."groups"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_category"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_comments"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_data"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_exif"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_fields"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_iptc"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."permissions"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."photos"); + + /** + * include sql strings + */ + include_once(LINPHA_DIR."/install/sql/sql.".DB_TYPE.".php"); + + /** + * finally create tables + */ + echo tr("Creating Tables")."... "; + + $translation_array = array_keys($linpha_tables); // only used in error case + while( list($key,$query) = each($sql_tables) ) + { + $result = $linpha->db->Execute($query); + if(!$result) + { + echo PREFIX.$translation_array[$key].' '; + echo failed_msg(); + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } + } + if(!isset($error_nr)) + { + echo success_msg(); + unset($error_nr); + } -echo "<br /><br />".tr("Inserting Table Data")."... "; -include_once(LINPHA_DIR.'/install/sql/sql.data.php'); -foreach($sql_queries AS $value) -{ - $result = $linpha->db->Execute($value); - if(!$result) + +/** + * insert data + */ + echo "<br /><br />".tr("Inserting Table Data")."... "; + include_once(LINPHA_DIR.'/install/sql/sql.data.php'); + foreach($sql_queries AS $value) { - echo failed_msg(); - echo $value; - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; + $result = $linpha->db->Execute($value); + if(!$result) + { + echo failed_msg(); + echo $value; + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } } -} + if(!isset($error_nr)) + { + echo success_msg(); + unset($error_nr); + } + + + + + + + function failed_msg() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-07 21:56:35
|
Revision: 4487 Author: fangehrn Date: 2006-04-07 14:56:10 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4487&view=rev Log Message: ----------- * implemented admin section for user, groups and group memberships Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_read.php trunk/linpha2/docs/TODO.txt trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/lib/classes/linpha.sql.class.php Added Paths: ----------- trunk/linpha2/admin/permissions.php trunk/linpha2/admin/permissions_groups.php trunk/linpha2/admin/permissions_usergroup.php trunk/linpha2/admin/permissions_users.php Removed Paths: ------------- trunk/linpha2/admin/actions/save_permissions.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/ChangeLog 2006-04-07 21:56:10 UTC (rev 4487) @@ -1,3 +1,6 @@ +2006-04-07 flo + * implemented admin section for user, groups and group memberships + 2006-04-06 flo * added user login system Deleted: trunk/linpha2/admin/actions/save_permissions.php =================================================================== --- trunk/linpha2/admin/actions/save_permissions.php 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/admin/actions/save_permissions.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -1,82 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -if(!defined('TOP_DIR')) { define('TOP_DIR','../..'); } -//error_reporting(0); - -include_once(TOP_DIR.'/lib/classes/linpha.class.php'); - -$linpha = new linpha(); -$linpha->sql->dbConnect(); - -/** - * insert or update - */ -$query = $linpha->db->Execute("SELECT id FROM ".PREFIX."permissions WHERE photos_id = '".$linpha->sql->linAddslashes($_POST['photo_id'])."'"); -$num = $query->RecordCount(); - -/** - * if inherit is selected, delete if an entry exists - * and only if the photo_id != 0, because we can't delete - * the top permission entry!! - */ -if(isset($_POST['inherit'])) -{ - if($num != 0 && $_POST['photo_id'] != 0) - { - $linpha->db->Execute("DELETE FROM ".PREFIX."permissions WHERE photos_id = '".$linpha->sql->linAddslashes($_POST['photo_id'])."'"); - } -} -else -{ - if(isset($_POST['group'])) - { - if(in_array('public',$_POST['group'])) - { - $str_groups = 'public'; - } - else - { - $str_groups = implode(';',$_POST['group']); - } - } - else - { - /** - * no group selected - * -> only admin has permissions - */ - $str_groups = ''; - } - - if($num != 0) - { - $linpha->db->Execute("UPDATE ".PREFIX."permissions SET permission = ';".$linpha->sql->linAddslashes($str_groups).";' " . - "WHERE photos_id = '".$linpha->sql->linAddslashes($_POST['photo_id'])."'"); - } - else - { - $linpha->db->Execute("INSERT into ".PREFIX."permissions (photos_id, perm_type, permission) VALUES (" . - "'".$linpha->sql->linAddslashes($_POST['photo_id'])."', 'read'," . - "';".$linpha->sql->linAddslashes($str_groups).";' )"); - } -} - -header("Location: ".TOP_DIR."/admin/?cat=permissions&parent_id=".$_POST['parent_id']); -?> \ No newline at end of file Added: trunk/linpha2/admin/permissions.php =================================================================== --- trunk/linpha2/admin/permissions.php (rev 0) +++ trunk/linpha2/admin/permissions.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -0,0 +1,46 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'users'; +} + +$array_menu = Array( + 'users' => Array('name' => 'Users', 'link' => 'permissions_users'), + 'groups' => Array('name' => 'Groups', 'link' => 'permissions_groups'), + 'usergroup' => Array('name' => 'Group Memberships', 'link' => 'permissions_usergroup'), + 'view' => Array('name' => 'View', 'link' => 'permissions_view'), + 'write' => Array('name' => 'Write', 'link' => 'permissions_write'), + 'basket' => Array('name' => 'Basket', 'link' => 'permissions_basket'), + 'metadata' => Array('name' => 'Meta Data', 'link' => 'permissions_metadata'), + 'others' => Array('name' => 'Others', 'link' => 'permissions_others'), +); + +print_admin_menu($array_menu,$cat2); + +switch($cat2) +{ +case 'users': + include_once('./permissions_users.php'); + break; +case 'groups': + include_once('./permissions_groups.php'); + break; +case 'usergroup': + include_once('./permissions_usergroup.php'); + break; +case 'view': + include_once('./permissions_read.php'); + break; +case 'write': + include_once('./permissions_write.php'); + break; +case 'basket': +case 'metadata': +case 'others': + include_once('./permissions_others.php'); + break; +} +?> + Added: trunk/linpha2/admin/permissions_groups.php =================================================================== --- trunk/linpha2/admin/permissions_groups.php (rev 0) +++ trunk/linpha2/admin/permissions_groups.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -0,0 +1,75 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * save data + */ +if(isset($_POST['cmd'])) +{ + /** + * @todo use something like htmlspecialchars() ? + */ + switch($_POST['cmd']) + { + case 'ren_group': + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."groups " . + "SET group_name='".LinSql::linAddslashes($_POST['group_name'])."' " . + "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + break; + case 'del_group': + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."groups ". + "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + break; + case 'new_group': + $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."groups (group_name) ". + "VALUES ('".LinSql::linAddslashes($_POST['new_group_name'])."')"); + break; + } +} +?> +<table border="1"> + <tr> + <td><b><?php echo i18n("Group Name"); ?></b></td> + <td><b><?php echo i18n("Actions"); ?></b></td> + </tr> +<?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER BY group_name"); + while($data = $query->FetchRow()) + { +?> + <tr> + <form name="mod_group" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> + <td> + <input style="width: 200;" type="text" name="group_name" value="<?php echo $data['group_name']; ?>" maxsize="255"> + </td> + + <td> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> + <input type="hidden" name="cmd" value="ren_group"> + <input type="submit" value="<?php echo i18n("Rename Group"); ?>" style="float: left;"> + </form> + + <form name="del_group" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> + <input type="submit" value="<?php echo i18n("Delete Group"); ?>" style="float: left;"> + <input type="hidden" name="cmd" value="del_group"> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> + </form> + + <form name="edit_members" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup?groupid='.$data['id']; ?>"> + <input type="submit" value="<?php echo i18n("Edit Group Members"); ?>" style="float: left;"> + </form> + </td> + </tr> +<?php + } +?> + <tr> + <form name="new_user" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> + <td><input style="width: 200;" type="text" name="new_group_name" maxsize="255"></td> + <td> + <input type="hidden" name="cmd" value="new_group"> + <input type="submit" value="<?php echo i18n("Create Group"); ?>"> + </td> + </form> + </tr> +</table> Modified: trunk/linpha2/admin/permissions_read.php =================================================================== --- trunk/linpha2/admin/permissions_read.php 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/admin/permissions_read.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -1,12 +1,69 @@ <?php if(!defined('LINPHA_DIR')) { exit(1); } -//error_reporting(0); - include_once(LINPHA_DIR.'/lib/adodb/tohtml.inc.php'); /** + * save POST data + */ +if(isset($_POST['cmd']) && $_POST['cmd'] == 'save_permissions') +{ + /** + * insert or update + */ + $query = $linpha->db->Execute("SELECT id FROM ".PREFIX."permissions WHERE photos_id = '".$linpha->sql->linAddslashes($_POST['photo_id'])."'"); + $num = $query->RecordCount(); + + /** + * if inherit is selected, delete if an entry exists + * and only if the photo_id != 0, because we can't delete + * the top permission entry!! + */ + if(isset($_POST['inherit'])) + { + if($num != 0 && $_POST['photo_id'] != 0) + { + $linpha->db->Execute("DELETE FROM ".PREFIX."permissions WHERE photos_id = '".$linpha->sql->linAddslashes($_POST['photo_id'])."'"); + } + } + else + { + if(isset($_POST['group'])) + { + if(in_array('public',$_POST['group'])) + { + $str_groups = 'public'; + } + else + { + $str_groups = implode(';',$_POST['group']); + } + } + else + { + /** + * no group selected + * -> only admin has permissions + */ + $str_groups = ''; + } + + if($num != 0) + { + $linpha->db->Execute("UPDATE ".PREFIX."permissions SET permission = ';".$linpha->sql->linAddslashes($str_groups).";' " . + "WHERE photos_id = '".$linpha->sql->linAddslashes($_POST['photo_id'])."'"); + } + else + { + $linpha->db->Execute("INSERT into ".PREFIX."permissions (photos_id, perm_type, permission) VALUES (" . + "'".$linpha->sql->linAddslashes($_POST['photo_id'])."', 'read'," . + "';".$linpha->sql->linAddslashes($str_groups).";' )"); + } + } +} + +/** * set parameters */ if(isset($_GET['parent_id']) && $_GET['parent_id'] != 0) @@ -30,7 +87,7 @@ /** * get groups */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."groups"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups"); while($data = $query->FetchRow()) { $array_groups[$data[0]] = $data[1]; @@ -64,7 +121,7 @@ "WHERE id = '".linSql::linAddslashes($_GET['id'])."'"); $data = $query->FetchRow(); ?> - <form name="permission" method="POST" action="<?php echo LINPHA_DIR.'/admin/actions/save_permissions.php'; ?>"> + <form name="permission" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_view&parent_id='.$parent_id; ?>"> <h3>Change/Add permissions of folder/file "<?php echo $data[0]; ?>"</h3> <?php @@ -100,8 +157,9 @@ ?> <input type="hidden" name="photo_id" value="<?php echo $_GET['id']; ?>" /> <input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>" /> + <input type="hidden" name="cmd" value="save_permissions" /> <input type="submit" name="submit" value="save" /> - <a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions&parent_id='.$parent_id; ?>">cancel</a> + <a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions_view&parent_id='.$parent_id; ?>">cancel</a> </form> <br /><br /> <?php @@ -116,12 +174,12 @@ <?php if(isset($_GET['parent_id']) && $_GET['parent_id'] != 0) { - echo ' (<a href="'.LINPHA_DIR.'/admin/?cat=permissions&parent_id=0">Show all folders</a>)'; + echo ' (<a href="'.LINPHA_DIR.'/admin/?cat=permissions_view&parent_id=0">Show all folders</a>)'; } ?> <br /> Permission set: <b><?php echo get_readable_perms($perm); ?></b> - (<a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions&parent_id='.$parent_id.'&cmd=edit&id='.$parent_id; ?>">change</a>) + (<a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions_view&parent_id='.$parent_id.'&cmd=edit&id='.$parent_id; ?>">change</a>) <br /><br /> <table border='1'> <tr> @@ -157,7 +215,7 @@ echo str_repeat(' >',$stage).' '; if($data['img_type']==0) { - echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions&parent_id='.$data['id'].'">'.$data['name'].'</a>'; + echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_view&parent_id='.$data['id'].'">'.$data['name'].'</a>'; } else { @@ -190,11 +248,11 @@ if($i != 0) { - echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions&parent_id='.$GLOBALS['parent_id'].'&cmd=edit&id='.$data['id'].'">add</a>'; + echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_view&parent_id='.$GLOBALS['parent_id'].'&cmd=edit&id='.$data['id'].'">add</a>'; } else { - echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions&parent_id='.$GLOBALS['parent_id'].'&cmd=edit&id='.$data['id'].'">change</a>'; + echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_view&parent_id='.$GLOBALS['parent_id'].'&cmd=edit&id='.$data['id'].'">change</a>'; } echo '</td></tr>'; Added: trunk/linpha2/admin/permissions_usergroup.php =================================================================== --- trunk/linpha2/admin/permissions_usergroup.php (rev 0) +++ trunk/linpha2/admin/permissions_usergroup.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -0,0 +1,137 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * get groups + */ +echo '<b>'.i18n("Edit Group Members").'</b><br />'; +$query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER by group_name"); +while($data = $query->FetchRow()) +{ + echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=group&id='.$data['id'].'">'.$data['group_name'].'</a><br />'; +} + +echo '<br /><br />'; + +/** + * get users + */ +echo '<b>'.i18n("Edit User Memberships").'</b><br />'; +$query = $GLOBALS['linpha']->db->Execute("SELECT id, username FROM ".PREFIX."users ORDER by username"); +while($data = $query->FetchRow()) +{ + echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&id='.$data['id'].'">'.$data['username'].'</a><br />'; +} +?> +<br /><br /> +<hr /> +<br /><br /> +<?php +/** + * edit group members + */ +if(isset($_GET['edit'])) +{ + if($_GET['edit'] == 'group') + { + $column_name = 'group_id'; + $table_name = 'groups'; + $select_name = 'group_name'; + $other_select_name = 'username'; + $other_table_name = 'users'; + } + elseif($_GET['edit'] == 'user') + { + $column_name = 'user_id'; + $table_name = 'users'; + $select_name = 'username'; + $other_select_name = 'group_name'; + $other_table_name = 'groups'; + } + else + { + die("no access"); + } + + /** + * save data + */ + if(isset($_POST['cmd']) && $_POST['cmd'] == 'edit') + { + /** + * delete all entries of current user + */ + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."user_group WHERE ".$column_name." = '".LinSql::linAddslashes($_GET['id'])."'"); + + /** + * add new entries if exists + */ + if(isset($_POST['usergroup'])) + { + foreach($_POST['usergroup'] AS $value) + { + if($_GET['edit']=='group') + { + $userid = LinSql::linAddslashes($value); + $groupid = LinSql::linAddslashes($_GET['id']); + } + elseif($_GET['edit']=='user') + { + $userid = LinSql::linAddslashes($_GET['id']); + $groupid = LinSql::linAddslashes($value); + } + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('".$userid."','".$groupid."')"); + } + } + } + + /** + * get informations + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT ".$select_name." FROM ".PREFIX.$table_name." WHERE id = '".LinSql::linAddslashes($_GET['id'])."'"); + echo '<b>'.i18n("Edit").': '.$data[$select_name].'</b><br />'; + + /** + * get all groups/users + */ + ?> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&id='.$_GET['id']; ?>"> + <select name="usergroup[]" size="5" style="width: 200;" multiple="multiple"> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, ".$other_select_name." FROM ".PREFIX.$other_table_name." ORDER by ".$other_select_name); + while($data = $query->FetchRow()) + { + /** + * check if selected + */ + if($_GET['edit']=='group') + { + $userid = $data['id']; + $groupid = LinSql::linAddslashes($_GET['id']); + } + elseif($_GET['edit']=='user') + { + $userid = LinSql::linAddslashes($_GET['id']); + $groupid = $data['id']; + } + $data2 = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."user_group WHERE user_id = '".$userid."' AND group_id = '".$groupid."'"); + if(isset($data2['id'])) + { + $checked = ' selected="selected"'; + } + else + { + $checked = ''; + } + + echo '<option value="'.$data['id'].'"'.$checked.'>'.$data[$other_select_name].'</option>'; + } + ?> + <input type="hidden" name="cmd" value="edit" /> + <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </select> + </form> + <?php + +} +?> \ No newline at end of file Added: trunk/linpha2/admin/permissions_users.php =================================================================== --- trunk/linpha2/admin/permissions_users.php (rev 0) +++ trunk/linpha2/admin/permissions_users.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -0,0 +1,156 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * save data + */ +if(isset($_POST['cmd'])) +{ + /** + * @todo use something like htmlspecialchars() ? + */ + switch($_POST['cmd']) + { + case 'mod_user': + + /** + * update password + * only if it is not empty + */ + if(empty($_POST['mod_user_pass'])) + { + $new_password = ""; + } else { + $md5_pass = md5($_POST['mod_user_pass']); + $new_password = "password='".$md5_pass."', "; + } + + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."users SET ". + "username='".LinSql::linAddslashes($_POST['mod_user_name'])."', ". + "display_name='".LinSql::linAddslashes($_POST['mod_user_fullname'])."', ". + $new_password. + "email='".LinSql::linAddslashes($_POST['mod_user_mail'])."' ". + "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + + /** + * if current account is changed update session variables and login cookie + */ + if($_POST['old_user_name'] == $_SESSION['user_name']) + { + $_SESSION['user_name'] = $_POST['mod_user_name']; + $_SESSION['user_displayname'] = (empty($_POST['mod_user_fullname'])) ? $_POST['mod_user_name'] : $_POST['mod_user_fullname']; //Store user fullname. If fullname is blank - store username. + + /** + * does not work, because headers are already sent + * + if(isset($_COOKIE["linpha_userid"]) && + isset($_COOKIE["linpha_password"]) && + isset($md5_pass)) + { + $GLOBALS['linpha']->sql->setLinphaCookie($_POST['id'], $md5_pass); + }*/ + } + + break; + case 'del_user': + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."users WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + break; + case 'new_user': + $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."users " . + "(username, password, email, display_name) ". + "VALUES " . + "('".LinSql::linAddslashes($_POST['new_user_name'])."', '".md5($_POST['new_user_pass'])."', ". + "'".LinSql::linAddslashes($_POST['new_user_mail'])."', '".LinSql::linAddslashes($_POST['new_user_fullname'])."')"); + break; + } +} + +/** + * @todo !! + */ +function smart_htmlspecialchars($str) +{ + return $str; +} + +?> +<table border="1"> + <tr> + <td><b><?php echo i18n("Username"); ?></b></td> + <td><b><?php echo i18n("Display Name"); ?></b></td> + <td><b><?php echo i18n("Password"); ?></b></td> + <td><b><?php echo i18n("Email"); ?></b></td> + <td><b><?php echo i18n("Actions"); ?></b></td> + </tr> +<?php + /** + * show users + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, username, display_name, email FROM ".PREFIX."users ORDER BY username"); + while($data = $query->FetchRow()) + { + ?> + <tr> + <form name="mod_user" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_users'; ?>"> + <td> + <input type="text" name="mod_user_name" size="20" maxlength="255" value="<?php echo smart_htmlspecialchars($data['username'], ENT_QUOTES); ?>"> + </td> + <td> + <input type="text" name="mod_user_fullname" size="20" maxlength="255" value="<?php echo smart_htmlspecialchars($data['display_name'], ENT_QUOTES); ?>"> + </td> + <td> + <input type="password" name="mod_user_pass" size="20" maxlength="255"> + </td> + <td> + <input type="text" name="mod_user_mail" size="20" maxlength="255" value="<?php echo $data['email']; ?>"> + </td> + <td> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> + <input type="hidden" name="old_user_name" value="<?php echo smart_htmlspecialchars($data['username'], ENT_QUOTES); ?>"> + <input type="hidden" name="cmd" value="mod_user"> + <input type="submit" value="<?php echo i18n("Modify User"); ?>" style="float: left;"> + </form> + + <form name="edit_groups" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&userid='.$data['id']; ?>"> + <input type="submit" name="edit_groups" value="<?php echo i18n("Edit Groups"); ?>" style="float: left;"> + </form> + + <form name="del_user" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_users'; ?>"> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> + <input type="hidden" name="cmd" value="del_user"> + <input type="submit" value="<?php echo i18n("Delete"); ?>" style="float: left;"> + </form> + </td> + </tr> + <?php + } + + /** + * add new user + */ + ?> + <form name="new_user" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_users'; ?>"> + <tr> + <td><input type="text" name="new_user_name" size="20" maxlength="255"></td> + <td><input type="text" name="new_user_fullname" size="20" maxlength="255"></td> + <td><input type="password" name="new_user_pass" size="20" maxlength="255"></td> + <td><input type="text" name="new_user_mail" size="20" maxlength="255"></td> + <td> + <input type="hidden" name="cmd" value="new_user"> + <input type="submit" value="<?php echo i18n("Create User"); ?>" onclick="return checkPassLength();"> + </td> + </tr> + </form> +</table> + +<script language="JavaScript" type="text/javascript"> +function checkPassLength() +{ + if(document.new_user.new_user_pass.value.length <3 ) + { + alert ('<?php echo i18n("Password To Short"); ?>'); + document.new_user.new_user_pass.focus(); + return false; + } +} +</script> \ No newline at end of file Modified: trunk/linpha2/docs/TODO.txt =================================================================== --- trunk/linpha2/docs/TODO.txt 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/docs/TODO.txt 2006-04-07 21:56:10 UTC (rev 4487) @@ -8,13 +8,19 @@ Currently the no-javscript site is loaded with a javascript location.href to the javascript enabled site -> High Pageload, LinSysLog doesnt work -- define installer behaviour - - if installation is complete, the user must delete the install/ folder ? - - user have to delete var/sql/config.sql.php before another installation can continue ? +## Big Todos + +- Installer + - define final installer behaviour + - if installation is complete, the user must delete the install/ folder ? (install/ignore_delete_install_msg.txt) + - user have to delete var/sql/config.sql.php before another installation can continue ? -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) - -> should we really delete the content of the cache folders? what if the user specify wrongly the album folder as the cache folder...?? + -> should we really delete the content of the cache folders? + - what if the user specify wrongly the album folder as the cache folder...?? + - what if a hacker gets access to the install and specify '/' as cache folder...?? + -> an idea: only delete content of tmp, cache and sql folders if they are not changed + - DONT add feature to drop tables if they already exists -## Big Todos - get_image.php (Image View, Image Cache) - Search (copy from linpha1) - Basket (finish) Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -32,10 +32,10 @@ ")", "CREATE TABLE ".$linpha_tables['users']." ( ". "id INT NOT NULL AUTO_INCREMENT , " . - "username VARCHAR(255) NOT NULL , " . - "password VARCHAR(32) NOT NULL , " . - "email VARCHAR(255) NOT NULL , " . - "display_name VARCHAR(255) NOT NULL , " . + "username VARCHAR(255) NOT NULL default '' , " . + "password VARCHAR(32) NOT NULL default '' , " . + "email VARCHAR(255) NOT NULL default '' , " . + "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INT NOT NULL , " . "stats_downloads_size INT NOT NULL, " . "PRIMARY KEY (id) " . Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -23,14 +23,29 @@ $sql_tables = array( "CREATE TABLE ".$linpha_tables['config']." ( ". "id SERIAL PRIMARY KEY, " . - "option_name VARCHAR(50) NOT NULL default '', " . - "option_value VARCHAR(100) NOT NULL default '', " . - "userid INT default '0' " . + "option_name VARCHAR(255) NOT NULL default '', " . + "option_value VARCHAR(255) NOT NULL default '', " . + "userid INT default '0', " . + "override INT default '0' " . ")", + "CREATE TABLE ".$linpha_tables['users']." ( ". + "id SERIAL PRIMARY KEY, " . + "username VARCHAR(255) NOT NULL default '' , " . + "password VARCHAR(32) NOT NULL default '' , " . + "email VARCHAR(255) NOT NULL default '' , " . + "display_name VARCHAR(255) NOT NULL default '' , " . + "stats_downloads INT NOT NULL default 0 , " . + "stats_downloads_size INT NOT NULL default 0 " . + ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". "id SERIAL PRIMARY KEY, " . - "name VARCHAR(100) NOT NULL default '' " . + "group_name VARCHAR(255) NOT NULL default '' " . ")", + "CREATE TABLE ".$linpha_tables['user_group']." ( ". + "id SERIAL PRIMARY KEY, " . + "group_id INT NOT NULL default 0, " . + "user_id INT NOT NULL default 0" . + ")", "CREATE TABLE ".$linpha_tables['permissions']." ( ". "id SERIAL PRIMARY KEY, " . "photos_id INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -24,14 +24,29 @@ $sql_tables = array( "CREATE TABLE ".$linpha_tables['config']." ( ". "id SMALLINT PRIMARY KEY, " . - "option_name VARCHAR(50) NOT NULL default '', " . - "option_value VARCHAR(100) NOT NULL default '', " . - "userid MEDIUMINT unsigned default '0' " . + "option_name VARCHAR(255) NOT NULL default '', " . + "option_value VARCHAR(255) NOT NULL default '', " . + "userid INT default '0', " . + "override INT default '0' " . ")", + "CREATE TABLE ".$linpha_tables['users']." ( ". + "id INTEGER PRIMARY KEY, " . + "username VARCHAR(255) NOT NULL default '' , " . + "password VARCHAR(32) NOT NULL default '' , " . + "email VARCHAR(255) NOT NULL default '' , " . + "display_name VARCHAR(255) NOT NULL default '' , " . + "stats_downloads INT NOT NULL default '0'' , " . + "stats_downloads_size INT NOT NULL default '0'' " . + ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". "id INTEGER PRIMARY KEY, " . - "name VARCHAR(100) NOT NULL default '' " . + "group_name VARCHAR(255) NOT NULL default '' " . ")", + "CREATE TABLE ".$linpha_tables['user_group']." ( ". + "id INTEGER PRIMARY KEY, " . + "group_id INT NOT NULL default '0', " . + "user_id INT NOT NULL default '0'" . + ")", "CREATE TABLE ".$linpha_tables['permissions']." ( ". "id INTEGER PRIMARY KEY, " . "photos_id INTEGER NOT NULL default '0', " . Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-07 19:58:20 UTC (rev 4486) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-07 21:56:10 UTC (rev 4487) @@ -226,7 +226,7 @@ $data = $GLOBALS['linpha']->db->GetRow("SELECT id, username, password, id, display_name FROM ".PREFIX."users ". "WHERE username='".LinSql::linAddslashes($_POST['username'])."'"); - if( $_POST['username'] == $data['username'] && md5($_POST['password']) == $data['password']) + if( isset($data['username']) && isset($data['password']) && $_POST['username'] == $data['username'] && md5($_POST['password']) == $data['password']) { /** * Log sucessfull login This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-08 15:41:56
|
Revision: 4489 Author: fangehrn Date: 2006-04-08 08:41:24 -0700 (Sat, 08 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4489&view=rev Log Message: ----------- * finished permission and user/group system * finished permissions: - image view - metadata comments - metadata edit - admin section Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/home.php trunk/linpha2/admin/import.php trunk/linpha2/admin/index.php trunk/linpha2/admin/permissions_groups.php trunk/linpha2/admin/permissions_read.php trunk/linpha2/admin/permissions_usergroup.php trunk/linpha2/admin/permissions_users.php trunk/linpha2/get_thumb.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step1_license.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/plugins/watermark/func.watermark.php trunk/linpha2/templates/default/css/home.css trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/default/view_meta.html.php Added Paths: ----------- trunk/linpha2/admin/permissions_others.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/ChangeLog 2006-04-08 15:41:24 UTC (rev 4489) @@ -1,3 +1,12 @@ +2006-04-08 flo + * remove PHP NOTICE in phpmeta/IPTC.php + * finished permission and user/group system + * finished permissions: + - image view + - metadata comments + - metadata edit + - admin section + 2006-04-07 flo * implemented admin section for user, groups and group memberships Modified: trunk/linpha2/admin/home.php =================================================================== --- trunk/linpha2/admin/home.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/home.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -0,0 +1,4 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +?> \ No newline at end of file Modified: trunk/linpha2/admin/import.php =================================================================== --- trunk/linpha2/admin/import.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/import.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -9,7 +9,7 @@ if($linpha->sql->config->value['sys_import_autoimport']) { - linImport::updateDir( $parent_id = 0, $recursive = true ); + LinImport::updateDir( $parent_id = 0, $recursive = true ); } /** @@ -19,19 +19,12 @@ /** * first, only for images */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE img_type <> 0"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); while($data = $query->FetchRow()) { - linImage::createThumbnail($data['id'],$data['img_type'],$force=false); + LinImage::createThumbnail($data['id'],$data['img_type'],$force=false); } - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) - { - echo 'Linpha Syslog:<br />'; - echo $GLOBALS['linpha']->template->output['sys_log']; - } - - /** * @todo should we create the folder thumbnails here? * they will be automatically created on each visit @@ -40,10 +33,4 @@ */ -linImport::printfiles( 1 ); - -//$rs = $linpha->db->Execute("SELECT * FROM ".PREFIX."photos"); -//rs2html($rs,'',array('id','parent_id','img_type','name')); - - ?> \ No newline at end of file Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/index.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -9,6 +9,11 @@ $linpha = new linpha(); $linpha->sql->startSession(); + if(!$linpha->sql->isAdmin()) + { + echo i18n("Only Admin Has Access To This Area"); + exit(1); + } /** * @todo admin permission check */ @@ -39,9 +44,11 @@ } } ?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> -<link rel='stylesheet' href='admin.css' type='text/css'> +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/admin/admin.css'; ?>' type='text/css'> +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/syslog.css'; ?>' type='text/css'> </head> <body> @@ -73,6 +80,19 @@ } ?> + +<?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> + <!-- syslog --> + <div id="sys_log"> + <div id="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> + <div id="sys_log_text"> + <?php echo i18n("Linpha Syslog"); ?>:<br /> + <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> + </div> + </div> + <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/classes/syslog.js"> </script> +<?php } ?> + </body> </html> @@ -87,17 +107,17 @@ { if($value['link']=='linpha_home') { - echo '<li><a href="../">'.$value['name'].'</a></li>'; + echo '<li><a href="../">'.i18n($value['name']).'</a></li>'; } else { if($active==$key) { - echo '<li class="active"><a href="./?cat='.$value['link'].'" class="current">'.$value['name'].'</a></li>'; + echo '<li class="active"><a href="./?cat='.$value['link'].'" class="current">'.i18n($value['name']).'</a></li>'; } else { - echo '<li><a href="./?cat='.$value['link'].'">'.$value['name'].'</a></li>'; + echo '<li><a href="./?cat='.$value['link'].'">'.i18n($value['name']).'</a></li>'; } } } Modified: trunk/linpha2/admin/permissions_groups.php =================================================================== --- trunk/linpha2/admin/permissions_groups.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/permissions_groups.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -9,21 +9,62 @@ /** * @todo use something like htmlspecialchars() ? */ - switch($_POST['cmd']) + + /** + * prevent changes on admin group + */ + switch($_POST['cmd']) + { + case 'ren_group': + case 'del_group': + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); + $admingroup_id = $data['id']; + if($_POST['id'] == $admingroup_id) + { + linSysLog(i18n("Error").' trying to edit admin, something went wrong!'); + $error = 1; + } + break; + } + + /** + * check if group already exists + */ + switch($_POST['cmd']) + { + case 'ren_group': + case 'new_group': + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups " . + "WHERE group_name = '".LinSql::linAddslashes($_POST['group_name'])."'"); + if(isset($data['id'])) + { + linSysLog(i18n("Error: Group Already Exists")); + $error = 2; + } + break; + } + + if(!isset($error)) { - case 'ren_group': - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."groups " . - "SET group_name='".LinSql::linAddslashes($_POST['group_name'])."' " . - "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); - break; - case 'del_group': - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."groups ". - "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); - break; - case 'new_group': - $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."groups (group_name) ". - "VALUES ('".LinSql::linAddslashes($_POST['new_group_name'])."')"); - break; + switch($_POST['cmd']) + { + case 'ren_group': + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."groups " . + "SET group_name='".LinSql::linAddslashes($_POST['group_name'])."' " . + "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + linSysLog("Group Renamed"); + break; + case 'del_group': + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."groups ". + "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + linSysLog("Group Deleted"); + break; + case 'new_group': + $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."groups (group_name) ". + "VALUES ('".LinSql::linAddslashes($_POST['group_name'])."')"); + linSysLog("Group Created"); + break; + } } } ?> @@ -38,24 +79,26 @@ { ?> <tr> - <form name="mod_group" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> <td> <input style="width: 200;" type="text" name="group_name" value="<?php echo $data['group_name']; ?>" maxsize="255"> </td> <td> + <?php if($data['group_name'] != 'admin') { ?> <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> <input type="hidden" name="cmd" value="ren_group"> <input type="submit" value="<?php echo i18n("Rename Group"); ?>" style="float: left;"> </form> - <form name="del_group" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> <input type="submit" value="<?php echo i18n("Delete Group"); ?>" style="float: left;"> <input type="hidden" name="cmd" value="del_group"> <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> + <?php } ?> </form> - <form name="edit_members" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup?groupid='.$data['id']; ?>"> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=group&id='.$data['id']; ?>"> <input type="submit" value="<?php echo i18n("Edit Group Members"); ?>" style="float: left;"> </form> </td> @@ -64,8 +107,8 @@ } ?> <tr> - <form name="new_user" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> - <td><input style="width: 200;" type="text" name="new_group_name" maxsize="255"></td> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_groups'; ?>"> + <td><input style="width: 200;" type="text" name="group_name" maxsize="255"></td> <td> <input type="hidden" name="cmd" value="new_group"> <input type="submit" value="<?php echo i18n("Create Group"); ?>"> Added: trunk/linpha2/admin/permissions_others.php =================================================================== --- trunk/linpha2/admin/permissions_others.php (rev 0) +++ trunk/linpha2/admin/permissions_others.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -0,0 +1,150 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat3)) +{ + $cat3 = ''; +} + +switch($cat2) +{ +case 'basket': + $array_menu = array( + 'print' => Array('name' => "Print", 'link' => 'permissions_basket_print'), + 'mail' => Array('name' => "Mail", 'link' => 'permissions_basket_mail'), + 'download' => Array('name' => "Download", 'link' => 'permissions_basket_download'), + ); + break; +case 'metadata': + $array_menu = array( + 'comments' => Array('name' => "Write Comments", 'link' => 'permissions_metadata_comments'), + 'deletecomments' => Array('name' => "Delete Comments", 'link' => 'permissions_metadata_deletecomments'), + 'edit' => Array('name' => "Edit Image Informations", 'link' => 'permissions_metadata_edit'), + ); + break; +case 'others': + $array_menu = array( + 'watermark' => Array('name' => "Watermark", 'link' => 'permissions_others_watermark'), + 'stats' => Array('name' => "Statistics", 'link' => 'permissions_others_stats'), + 'download' => Array('name' => "Download", 'link' => 'permissions_others_download'), + ); + break; +} + +print_admin_menu($array_menu,$cat3); + +if(!empty($cat3)) +{ + if($cat2 == 'basket' OR $cat2 == 'metadata') + { + $key = $cat2.'_'.$cat3; + } + elseif($cat2 == 'others') + { + $key = $cat3; + } + + /** + * save data + */ + if(isset($_POST['cmd']) && $_POST['cmd'] == 'edit') + { + if($_POST['allowall'] == 'allowall') + { + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."permissions " . + "SET permission = ';public;' " . + "WHERE perm_type = '".LinSql::linAddslashes($key)."'"); + } + else + { + if(!isset($_POST['groups'])) + { + $str = ''; + } + else + { + $str = ';'.implode(';',$_POST['groups']).';'; + } + + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."permissions " . + "SET permission = '".LinSql::linAddslashes($str)."' " . + "WHERE perm_type = '".LinSql::linAddslashes($key)."'"); + } + } + + + echo '<b>'.i18n("Edit").': '.i18n($array_menu[$cat3]['name']).'</b><br />'; + + $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".PREFIX."permissions " . + "WHERE perm_type = '".LinSql::linAddslashes($key)."'"); + $array_permissions = explodeAndSlice(';',$data['permission']); + + if(in_array('public',$array_permissions)) + { + $allowall_checked = ' checked="checked"'; + $allowgroups_checked = ''; + } + else + { + $allowall_checked = ''; + $allowgroups_checked = ' checked="checked"'; + } +?> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'_'.$cat3; ?>"> + <br /> + <input type="radio" id="allowall" name="allowall" value="allowall"<?php echo $allowall_checked; ?>onClick="update_forms()" /> + <label for="allowall"><?php echo i18n("Allow All"); ?></label> + <br /><br /> + <input type="radio" id="allowgroups" name="allowall" value="allowgroups"<?php echo $allowgroups_checked; ?>onClick="update_forms()" /> + <label for="allowgroups"><?php echo i18n("Allow Only This Groups:"); ?></label> + <br /> + + <select id="selectgroups" name="groups[]" size="5" style="width: 200;" multiple="multiple"> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER by group_name"); + while($data = $query->FetchRow()) + { + if(in_array($data['id'],$array_permissions)) + { + $checked = ' selected="selected"'; + } + else + { + $checked = ''; + } + + echo '<option value="'.$data['id'].'"'.$checked.'>'.$data['group_name'].'</option>'; + } + ?> + <input type="hidden" name="cmd" value="edit" /> + <br /> + <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </select> + </form> + + <script language="JavaScript" type="text/javascript"> + + function update_forms() + { + var allowall = document.getElementById('allowall'); + var allowgroups = document.getElementById('allowgroups'); + var selectgroups = document.getElementById('selectgroups'); + + if(allowall.checked) + { + selectgroups.disabled = true; + selectgroups.selectedIndex = -1; + } + + if(allowgroups.checked) + { + selectgroups.disabled = false; + } + } + update_forms(); + + </script> + +<?php +} +?> \ No newline at end of file Modified: trunk/linpha2/admin/permissions_read.php =================================================================== --- trunk/linpha2/admin/permissions_read.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/permissions_read.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -87,7 +87,8 @@ /** * get groups */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups"); + $array_groups = Array(); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups WHERE group_name <> 'admin'"); while($data = $query->FetchRow()) { $array_groups[$data[0]] = $data[1]; @@ -206,10 +207,11 @@ list($i, $perm) = $GLOBALS['linpha']->sql->getPerm( $data['id'] ); /** - * exclude files with inherited permissions - * (-> show only files which have permission explicitly set) + * exclude files */ - if($data['img_type'] == 0 || $GLOBALS['view_mode']=='files' || ( $data['img_type'] != 0 && $i == 0 ) ) + if($data['img_type'] == 0 // show folders + || $GLOBALS['view_mode']=='files' // show files if we not on top + || ( $data['img_type'] != 0 && $i == 0 ) ) // show files which have permissions explicitly set (not inherited) { echo '<tr><td>'; echo str_repeat(' >',$stage).' '; Modified: trunk/linpha2/admin/permissions_usergroup.php =================================================================== --- trunk/linpha2/admin/permissions_usergroup.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/permissions_usergroup.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -23,9 +23,7 @@ echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&id='.$data['id'].'">'.$data['username'].'</a><br />'; } ?> -<br /><br /> -<hr /> -<br /><br /> +<br /><hr /><br /> <?php /** * edit group members @@ -89,13 +87,22 @@ * get informations */ $data = $GLOBALS['linpha']->db->GetRow("SELECT ".$select_name." FROM ".PREFIX.$table_name." WHERE id = '".LinSql::linAddslashes($_GET['id'])."'"); - echo '<b>'.i18n("Edit").': '.$data[$select_name].'</b><br />'; + echo '<b>'; + if($_GET['edit']=='user') + { + echo i18n("Edit Memberships Of User:"); + } + else + { + echo i18n("Edit Members Of Group:"); + } + echo ' '.$data[$select_name].'</b><br />'; /** * get all groups/users */ ?> - <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&id='.$_GET['id']; ?>"> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit='.$_GET['edit'].'&id='.$_GET['id']; ?>"> <select name="usergroup[]" size="5" style="width: 200;" multiple="multiple"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, ".$other_select_name." FROM ".PREFIX.$other_table_name." ORDER by ".$other_select_name); Modified: trunk/linpha2/admin/permissions_users.php =================================================================== --- trunk/linpha2/admin/permissions_users.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/admin/permissions_users.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -3,6 +3,10 @@ /** * save data + * @todo create new user: check if name does not already exists + * @todo rename user: check if name does not already exists + * -> will not be easy + * @todo check if username and password not empty */ if(isset($_POST['cmd'])) { @@ -43,8 +47,8 @@ /** * does not work, because headers are already sent * - if(isset($_COOKIE["linpha_userid"]) && - isset($_COOKIE["linpha_password"]) && + if(isset($_COOKIE['linpha_userid']) && + isset($_COOKIE['linpha_password']) && isset($md5_pass)) { $GLOBALS['linpha']->sql->setLinphaCookie($_POST['id'], $md5_pass); @@ -111,7 +115,7 @@ <input type="submit" value="<?php echo i18n("Modify User"); ?>" style="float: left;"> </form> - <form name="edit_groups" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&userid='.$data['id']; ?>"> + <form name="edit_groups" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&id='.$data['id']; ?>"> <input type="submit" name="edit_groups" value="<?php echo i18n("Edit Groups"); ?>" style="float: left;"> </form> Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/get_thumb.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -26,9 +26,8 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); -$linpha->sql->dbConnect(); +$linpha->sql->startSession(); /** * check for valid id @@ -39,7 +38,7 @@ { throw new Exception("no id supplied!"); } - $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE id = '".linSql::linAddslashes( $_GET['id'] )."'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes( $_GET['id'] )."'"); if($query->RecordCount() != 1) { @@ -48,7 +47,7 @@ $data = $query->FetchRow(ADODB_FETCH_ASSOC); - if( ! $GLOBALS['linpha']->sql->photoIsAllowed( $data['id'] ) ) + if( ! LinSql::photoIsAllowed( $data['id'] ) ) { throw new Exception("not permitted!"); } Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -40,6 +40,7 @@ 'sys_path_cache_dir' => $_SESSION['cache_dir'], 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], 'sys_style_img_quality' => '75', + 'sys_style_nrrandomimages' => '4', 'sys_style_template' => 'default', 'sys_style_tn_size' => '150', 'sys_user_autologin' => '1' @@ -57,8 +58,7 @@ /** * groups */ -$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('group1')"; -$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('group2')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('admin')"; /** * permissions @@ -66,6 +66,25 @@ $sql_queries[] = "INSERT INTO ".PREFIX."permissions (photos_id, perm_type, permission) " . "VALUES (0, 'read', ';public;')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('basket_print', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('basket_mail', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('basket_download', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('metadata_comments', ';public;')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('metadata_deletecomments', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('metadata_edit', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('watermark', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('stats', '')"; +$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . + "VALUES ('download', '')"; + /** * metadata */ Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/install/step10_postsettings.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -54,7 +54,7 @@ echo success_msg(); /** - * add new linpha user + * add new linpha admin user */ echo "<br /><br />"; echo "<h2>".tr("Setup Linpha Admin User").".</h2>"; Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/install/step11_finish.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -59,11 +59,18 @@ "'".LinSql::linAddslashes($_POST['admin_name'])."', " . "'".md5($_POST['admin_pass'])."', " . "'".LinSql::linAddslashes($_POST['admin_email'])."')"); - if(!$result) { echo failed_msg(); } else { + $userid = $GLOBALS['linpha']->db->Insert_ID(); + + /** + * adding user to group 'admin' + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('".$userid."','".$data['id']."')"); + echo success_msg(); } @@ -74,7 +81,7 @@ if( isset( $_POST['sys_style_tn_size'] ) ) { $result = $linpha->db->Execute("UPDATE ".PREFIX."config " . - "SET option_value = '".$linpha->sql->linAddslashes($_POST['sys_style_tn_size'])."' " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_style_tn_size'])."' " . "WHERE option_name = 'sys_style_tn_size'"); if(!$result) { Modified: trunk/linpha2/install/step1_license.php =================================================================== --- trunk/linpha2/install/step1_license.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/install/step1_license.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -32,8 +32,9 @@ <br /> <input type="hidden" name="language" value="<?php echo isset($_POST['language']) ? $_POST['language'] : ''; ?>"> <input type="checkbox" id="check01" onChange="checkForm()"> -<?php echo tr("Please Accept The GNU General Public License")."<br />"; - +<label for="check01"><?php echo tr("Please Accept The GNU General Public License"); ?></label> +<br /> +<?php $array_check = array('check01' => 'checkbox'); $do_javascript_disable_button = true; include_once(LINPHA_DIR.'/install/footer.php'); Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -31,7 +31,6 @@ */ $show_subfolders_separate = 0; $nr_prev_next_thumbs = 3; -$nr_random_images = 4; $array_tn_sizes = Array(50,75,100,150,200,250,300,400,500); $def_tn_size = 150; $array_nr_images = Array('auto',10,25,50,100,200,'all'); @@ -219,13 +218,15 @@ { if( ! ($this->mode == 'image' && $value['img_type']==0 ) ) // exclude subfolders from img_view { - if( $GLOBALS['linpha']->sql->photoIsAllowed( $value['id'] ) ) + if( LinSql::photoIsAllowed( $value['id'] ) ) { $this->photos_filtered[] = $value; } } } } + + unset($this->photos); } @@ -236,43 +237,41 @@ { /** - * all modes (thumb, image and home) + * Menu Admin */ - $GLOBALS['linpha']->template->output['menu_Admin'] = Array( - 'import' => Array( - 'name' => i18n("Import"), - 'value' => Array( - Array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&force_update') - ) - ) - ); - - /** - * thumb and image, except home - */ - switch($this->mode) - { - case 'thumb': - case 'image': - /** - * append to "admin - import" entry - */ - $GLOBALS['linpha']->template->output['menu_Admin']['import']['value'][] = Array( - 'name' => i18n("Recreate This Thumbnail"), - 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' - ); + if($GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->output['menu_Admin']['import'] = + Array( + 'name' => i18n("Import"), + 'value' => Array( + Array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&force_update') + ) + ); $GLOBALS['linpha']->template->output['menu_Admin']['permissions'] = Array( 'name' => i18n("Permissions"), 'value' => Array( - Array('name' => i18n("Set Permissions"), 'value' => LINPHA_DIR.'/admin/?cat=permissions&cmd=edit&id='.$this->id_current) + Array('name' => i18n("Set Permissions"), 'value' => LINPHA_DIR.'/admin/?cat=permissions_view&cmd=edit&id='.$this->id_current) ) ); - } + + + if($this->mode == 'thumb' OR $this->mode == 'image') + { + /** + * append to "admin - import" entry + */ + $GLOBALS['linpha']->template->output['menu_Admin']['import']['value'][] = Array( + 'name' => i18n("Recreate This Thumbnail"), + 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' + ); + } + } /** - * thumb and image mode separate, without home mode + * Menu More */ if($this->mode != 'home') { @@ -303,7 +302,7 @@ $array_views_links[] = Array('name' => i18n('Detail'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - $GLOBALS['linpha']->template->output['menu_More'] = Array( + $GLOBALS['linpha']->template->output['menu_More']['basket'] = Array( 'name' => i18n("Basket"), 'value' => Array( @@ -311,8 +310,10 @@ Array('name' => i18n("Switch To Basket View"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), Array('name' => i18n("Open Basket"), 'value' => $open_basket_link), Array('name' => i18n("Images In Basket").': '.count($_SESSION['basket_ids']), 'value' => '#') - ) - ), + ) + ); + + $GLOBALS['linpha']->template->output['menu_More']['view'] = Array( 'name' => i18n("View"), 'value' => Array( @@ -320,16 +321,20 @@ Array('name' => i18n("View"), 'value' => $array_views_links), Array('name' => i18n("Thumb Size"), 'value' => $array_tn_sizes_links), Array('name' => i18n("Thumb Nr"), 'value' => $array_nr_links) - ) - ), - Array( - 'name' => i18n("Metainfo"), - 'value' => Array( - Array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albcomment'), - Array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') - ) - ) - ); + ) + ); + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = + Array( + 'name' => i18n("Metainfo"), + 'value' => Array( + Array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albcomment'), + Array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + ) + ); + } break; case 'image': @@ -723,13 +728,28 @@ $str_random = 'random()'; break; } + + $nr_random_images = $GLOBALS['linpha']->sql->config->value['sys_style_nrrandomimages']; + $GLOBALS['linpha']->template->output['random_images'] = Array(); + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 ORDER BY ".$str_random); - $GLOBALS['linpha']->template->output['random_images'] = Array(); - $query = $GLOBALS['linpha']->db->SelectLimit("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 ORDER BY ".$str_random, $GLOBALS['nr_random_images']); - while($data = $query->FetchRow()) + for($i = 1; $i <= $nr_random_images ; ) { - $path = implode('/',linSql::getFullFilenameFromId($data['id'])); - $GLOBALS['linpha']->template->output['random_images'][] = Array('id'=>$data['id'],'path'=>$path); + $data = $query->FetchRow(); + if(isset($data['id'])) + { + $path = implode('/',LinSql::getFullFilenameFromId($data['id'])); + + if(file_exists(LinFilesys::getFullPath($path)) && LinSql::photoIsAllowed($data['id'])) + { + $GLOBALS['linpha']->template->output['random_images'][] = Array('id'=>$data['id'],'path'=>$path); + $i++; + } + } + else + { + break; + } } } @@ -818,6 +838,8 @@ /** * image comments */ + if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) + { /** * save comment */ @@ -842,6 +864,7 @@ */ $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, time, author, comment FROM ".PREFIX."meta_comments " . "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + } } /** @@ -924,32 +947,35 @@ $this->viewImgCommon(); - /** - * save metadata - */ - if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - if(isset($_POST['field'])) + /** + * save metadata + */ + if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') { - /** - * delete existing entries - */ - $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - - foreach($_POST['field'] AS $key=>$value) + if(isset($_POST['field'])) { - if(is_array($value)) // coming from a select (categories etc.) + /** + * delete existing entries + */ + $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + + foreach($_POST['field'] AS $key=>$value) { - $value = ';'.implode(';',$value).';'; + if(is_array($value)) // coming from a select (categories etc.) + { + $value = ';'.implode(';',$value).';'; + } + + if(! empty($value)) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_data ". + "(field_id, md5sum, meta_data) VALUES " . + "('".linSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); + } } - - if(! empty($value)) - { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_data ". - "(field_id, md5sum, meta_data) VALUES " . - "('".linSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); - } } } } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -25,7 +25,7 @@ class LinSql { -public $passed; +private $isLoggedIn, $isAdmin; public $config; // sub class $linpha->sql->config /** @@ -154,7 +154,7 @@ */ function startSession() { - $this->passed = false; + $this->isLoggedIn = false; /** * connect to db if not already done @@ -171,23 +171,23 @@ */ if($this->config->value['sys_user_autologin']) { if(!isset($_SESSION['user_name']) && - isset($_COOKIE["linpha_userid"])&&$_COOKIE["linpha_userid"]!=""&& - isset($_COOKIE["linpha_password"])&&$_COOKIE["linpha_password"]!="") + isset($_COOKIE['linpha_userid'])&&$_COOKIE['linpha_userid']!=""&& + isset($_COOKIE['linpha_password'])&&$_COOKIE['linpha_password']!="") { $query = $GLOBALS['linpha']->db->Execute("SELECT username, display_name FROM ".PREFIX."users ". - "WHERE id = '".LinSql::linAddslashes($_COOKIE["linpha_userid"])."' ". - "AND password = '".LinSql::linAddslashes($_COOKIE["linpha_password"])."'"); + "WHERE id = '".LinSql::linAddslashes($_COOKIE['linpha_userid'])."' ". + "AND password = '".LinSql::linAddslashes($_COOKIE['linpha_password'])."'"); if($data = $query->FetchRow()) { //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); linSysLog(i18n("Successfully Logged In!<br />")); - $this->setUserInformation($data['username'],$_COOKIE["linpha_userid"],$data['display_name']); + $this->setUserInformation($data['username'],$_COOKIE['linpha_userid'],$data['display_name']); } else // wrong cookie { - setcookie("linpha_userid"); // delete cookie linpha_userid - setcookie("linpha_password"); // delete cookie linpha_password + setcookie('linpha_userid'); // delete cookie linpha_userid + setcookie('linpha_password'); // delete cookie linpha_password } } } @@ -203,13 +203,12 @@ * @todo */ //linpha_log('login','notice','User '.@$_SESSION['user_name'].": logged out"); - //$this->passed=false; $_SESSION = array(); // delete all session data session_destroy(); // destroy session - if(isset($_COOKIE["linpha_userid"])) { - setcookie("linpha_userid"); // delete cookie linpha_userid - setcookie("linpha_password"); // delete cookie linpha_password + if(isset($_COOKIE['linpha_userid'])) { + setcookie('linpha_userid'); // delete cookie linpha_userid + setcookie('linpha_password'); // delete cookie linpha_password } } elseif($_POST['cmd']=='login') @@ -262,40 +261,57 @@ } /** - * set passed - * check remote_addr + * set isLoggedIn and isAdmin, check REMOTE_ADDR + * if $_SERVER['REMOTE_ADDR'] doesnt exists, we cant do this -> disable ip check */ - if(isset($_SESSION['user_id']) && isset($_SESSION['user_name']) && !empty($_SESSION['user_id']) && !empty($_SESSION['user_name']) ) - { - if( isset($_SERVER['REMOTE_ADDR']) && ($_SESSION["REMOTE_ADDR"] != $_SERVER["REMOTE_ADDR"]) ) + $this->isAdmin = false; + if(isset($_SESSION['user_id']) && isset($_SESSION['user_name']) && !empty($_SESSION['user_id']) && !empty($_SESSION['user_name']) ) { - /** - * ip check wrong! - */ - $this->passed=false; - - $_SESSION = array(); - session_destroy(); + if( isset($_SERVER['REMOTE_ADDR']) && ($_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) ) + { + /** + * ip check wrong! + */ + $this->isLoggedIn=false; + + $_SESSION = array(); + session_destroy(); + } + else + { + $this->isLoggedIn=true; + + /** + * set isAdmin + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); + if(in_array($data['id'],$_SESSION['user_groups'])) + { + $this->isAdmin = true; + } + } } else { - $this->passed=true; + $this->isLoggedIn=false; } - } - else - { - $this->passed=false; - } - + /** - * initialize basket - * it's much nicer if we can later just use count($_SESSION['basket_ids']) etc. - * without additional isset() and so on.. + * initialize some session variables */ - if( ! isset( $_SESSION['basket_ids'] ) ) - { - $_SESSION['basket_ids'] = Array(); - } + if( ! isset( $_SESSION['user_groups']) ) + { + $_SESSION['user_groups'] = Array(); + } + + /** + * it's much nicer if we can later just use count($_SESSION['basket_ids']) etc. + * without additional isset() and so on.. + */ + if( ! isset( $_SESSION['basket_ids'] ) ) + { + $_SESSION['basket_ids'] = Array(); + } } // end function startSession /** @@ -315,6 +331,14 @@ */ $_SESSION['user_displayname'] = (empty($displayname)) ? $_SESSION['user_name'] : $displayname; + /** + * get user_groups + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT group_id FROM ".PREFIX."user_group WHERE user_id = '".$userid."'"); + while($data = $query->FetchRow()) + { + $_SESSION['user_groups'][] = $data['group_id']; + } } @@ -331,6 +355,20 @@ */ function getPerm( $photos_id ) { + /** + * special behaviour for top permission + * the top permission is only for inheritation + * for example: + * top perm = ;admin; + * perm folder1 = ;public; + * perm folder2 = ;admin; + * users must be able to see folder1 + */ + if($photos_id == 0) + { + return array(0, ';public;'); + } + for($i = 0 ; true ; $i++) { $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".PREFIX."permissions WHERE perm_type = 'read' " . @@ -342,7 +380,7 @@ } else { - $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos WHERE id = '".linSql::linAddslashes($photos_id)."'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($photos_id)."'"); if( isset( $data[0] ) ) { @@ -360,66 +398,77 @@ } // end function getPerm /** - * This function checks if we are in the specific group - * - * return always true if group_id is 'public' - * if we are in the group "admin", we are automatically in - * every group + * returns true if we're allowed to see this photo */ -function inGroup($group_id) +function photoIsAllowed( $photo_id ) { - if($group_id == 'public') + /** + * admin sees always all photos + */ + if($GLOBALS['linpha']->sql->isAdmin()) { return true; } - if(!isset($_SESSION["user_groups"])) + list($stage,$perm) = LinSql::getPerm( $photo_id ); + $array_photo_perm = explodeAndSlice(';',$perm); + + foreach($array_photo_perm AS $value) { - return false; + if( $value == 'public' OR in_array($value, $_SESSION['user_groups']) ) + { + return true; + } } + return false; +} - /** - * create array with all groups, user is member of - */ - $group_member_of = explodeAndSlice(";",$_SESSION["user_groups"]); +/** + * method to check if we are logged in + */ +function isLoggedIn() +{ + return $this->isLoggedIn; +} - /** - * admin's have permissions for all groups - */ - if(in_array('admin', $group_member_of)) { - return true; - } - - - if(in_array($group_id, $group_member_of)) { - return true; - } else { - return false; - } +/** + * method to check if we are admin + */ +function isAdmin() +{ + return $this->isAdmin; } /** - * returns true if we're allowed to see this photo + * check permissions, basket_*, metadata_*, download, statistics, watermark, ... */ -function photoIsAllowed( $photo_id ) +function checkPermission($perm_type) { - list($stage,$perm) = linSql::getPerm( $photo_id ); - $array_photo_perm = explodeAndSlice(';',$perm); + if($GLOBALS['linpha']->sql->isAdmin()) + { + return true; + } - foreach($array_photo_perm AS $value) + $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".PREFIX."permissions " . + "WHERE perm_type = '".LinSql::linAddslashes($perm_type)."'"); + $array_permissions = explodeAndSlice(';',$data['permission']); + + if(in_array('public',$array_permissions)) { - - if( $GLOBALS['linpha']->sql->inGroup( $value ) ) - { - return true; - } + return true; } - return false; + + $array = array_intersect($_SESSION['user_groups'],$array_permissions); + if(count($array) > 0) + { + return true; + } + else + { + return false; + } } - - - /** * other stuff */ Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/lib/modules/module.albums.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -25,9 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } /** - * @todo temporary set permission string and configs + * @todo temporary set configs */ -$_SESSION["user_groups"] = ';1;'; $order_by = 'name ASC'; /** @@ -37,6 +36,15 @@ $linpha->imgview = new linImgview(); /** + * check permission + */ + if(isset($_GET['id']) && !LinSql::photoIsAllowed( $_GET['id']) ) + { + echo i18n("Error: No Access"); + exit(1); + } + +/** * set some infos */ $linpha->template->URL_base = LINPHA_DIR.'/?cat=alb'; Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/lib/modules/module.browse.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -25,9 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } /** - * @todo temporary set permission string and configs + * @todo temporary set configs */ -$_SESSION["user_groups"] = ';1;'; $order_by = 'name ASC'; /** Modified: trunk/linpha2/lib/plugins/watermark/func.watermark.php =================================================================== --- trunk/linpha2/lib/plugins/watermark/func.watermark.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/lib/plugins/watermark/func.watermark.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -25,11 +25,6 @@ */ function need_watermark($imgid) { - /*if(!isset($GLOBALS['passed'])) { - $passed = false; - } else { - global $passed; - }*/ if( read_plugins_config('watermark') && read_config('wm_active') && !check_permissions('watermark',$imgid) ) { Modified: trunk/linpha2/templates/default/css/home.css =================================================================== --- trunk/linpha2/templates/default/css/home.css 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/templates/default/css/home.css 2006-04-08 15:41:24 UTC (rev 4489) @@ -62,7 +62,7 @@ left: 20px; width: 130px; - height: auto; + height: 130px; border: 0; } \ No newline at end of file Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/templates/default/global.html.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -94,7 +94,7 @@ <li> <div> <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> - <?php if($GLOBALS['linpha']->sql->passed) { ?> + <?php if($GLOBALS['linpha']->sql->isLoggedIn()) { ?> <!-- logout infos --> <?php echo i18n("You Are Currently Logged In As:").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />'; ?> <input type="hidden" name="cmd" value="logout" /> Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/templates/default/view_img.html.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -30,14 +30,16 @@ </div> <div id="main"> <!-- edit meta data - include view_meta.html --> - <?php if($_SESSION['mode_imageview']=='meta') { - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/view_meta.html.php'); - } else { ?> + <?php if($_SESSION['mode_imageview']=='meta') { + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/view_meta.html.php'); + } else { ?> <!-- show image --> <?php echo $GLOBALS['linpha']->template->output['image']; ?> <br /><br /> - + + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> <!-- show add comment form --> <div class="add_comment"> <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> @@ -73,8 +75,9 @@ document.getElementById('comment_textarea').value = document.getElementById('comment_input_text').value; } </script> + <?php } /* end if checkPermission('metadata_comments') */ ?> - <?php } /* end if view==meta */ ?> + <?php } /* end if view!=meta */ ?> </div> <div class="roundbottom"> Modified: trunk/linpha2/templates/default/view_meta.html.php =================================================================== --- trunk/linpha2/templates/default/view_meta.html.php 2006-04-08 13:35:57 UTC (rev 4488) +++ trunk/linpha2/templates/default/view_meta.html.php 2006-04-08 15:41:24 UTC (rev 4489) @@ -1,9 +1,18 @@ +<?php +/** + * this file is included from view_img.html.php + */ + +?> <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=img'; ?>">Back to normal view</a> <h1><?php i18n("Edit Image Imformation"); ?></h1> <?php -$query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type FROM ".PREFIX."meta_fields " . - "WHERE flags = '5' OR flags = '7' ORDER by id"); -$num = $query->RecordCount(); + +if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) +{ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type FROM ".PREFIX."meta_fields " . + "WHERE flags = '5' OR flags = '7' ORDER by id"); + $num = $query->RecordCount(); ?> <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <table border='1'> @@ -70,4 +79,5 @@ </table> <input type="hidden" name="cmd" value="insert_metadata" /> <input type="submit" name="submit" value="submit" /> -</form> \ No newline at end of file +</form> +<?php } /* end if checkPermission('metadata_edit') */ ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-08 19:39:18
|
Revision: 4490 Author: fangehrn Date: 2006-04-08 12:38:58 -0700 (Sat, 08 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4490&view=rev Log Message: ----------- * implemented home site configuration * implemented sort orders Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/reset_database.php trunk/linpha2/templates/default/css/home.css trunk/linpha2/templates/default/home.html.php Added Paths: ----------- trunk/linpha2/admin/settings.php trunk/linpha2/admin/settings_layout.php Removed Paths: ------------- trunk/linpha2/admin/home.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/ChangeLog 2006-04-08 19:38:58 UTC (rev 4490) @@ -6,6 +6,8 @@ - metadata comments - metadata edit - admin section + * implemented home site configuration + * implemented sort orders 2006-04-07 flo * implemented admin section for user, groups and group memberships Deleted: trunk/linpha2/admin/home.php =================================================================== --- trunk/linpha2/admin/home.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/admin/home.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -1,4 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -?> \ No newline at end of file Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/admin/index.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -20,7 +20,7 @@ if( ! isset( $_GET['cat'] ) ) { - $cat1 = 'home'; + $cat1 = 'settings'; } else { @@ -55,7 +55,7 @@ <?php $array_menu = Array( 'linpha_home' => Array('name' => 'Linpha Home', 'link' => 'linpha_home'), - 'home' => Array('name' => 'Home', 'link' => 'home'), + 'settings' => Array('name' => 'Settings', 'link' => 'settings'), 'permissions' => Array('name' => 'Permissions', 'link' => 'permissions'), 'import' => Array('name' => 'Import', 'link' => 'import'), 'imagefields' => Array('name' => 'Image fields', 'link' => 'imagefields'), @@ -65,8 +65,8 @@ switch($cat1) { -case 'home': - include_once('./home.php'); +case 'settings': + include_once('./settings.php'); break; case 'permissions': include_once('./permissions.php'); @@ -124,4 +124,74 @@ ?> </ul> <?php -} \ No newline at end of file +} + +function printAdminConfig($type,$text,$id,$options=array()) +{ + switch($type) + { + case 'radio': + if($GLOBALS['linpha']->sql->config->value[$id]) + { + $str_enabled = ' checked="checked"'; + $str_disabled = ''; + } + else + { + $str_enabled = ''; + $str_disabled = ' checked="checked"'; + } + echo $text; + ?> + <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /> + <label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> + <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/> + <label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> + <br /> + <?php + break; + case 'text': + echo $text; + ?> + <input type="text" name="<?php echo $id; ?>" value="<?php echo $GLOBALS['linpha']->sql->config->value[$id]; ?>" maxlength="255"/> + <br /> + <?php + + break; + case 'select': + echo $text; + ?> + <select name="<?php echo $id; ?>" size="1"> + <?php + foreach($options AS $key=>$value) + { + if($key == $GLOBALS['linpha']->sql->config->value[$id]) + { + $selected = ' selected="selected"'; + } + else + { + $selected = ''; + } + echo '<option value="'.$key.'"'.$selected.'>'.$value.'</option>'; + } + ?> + </select> + <?php + break; + } +} + +function saveConfig($array) +{ + foreach($array AS $value) + { + if(isset($GLOBALS['linpha']->sql->config->value[$value]) && + isset($_POST[$value])) + { + $GLOBALS['linpha']->sql->config->updateConfig($value,$_POST[$value]); + } + } + $GLOBALS['linpha']->sql->config->reloadConfig(); +} +?> \ No newline at end of file Added: trunk/linpha2/admin/settings.php =================================================================== --- trunk/linpha2/admin/settings.php (rev 0) +++ trunk/linpha2/admin/settings.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -0,0 +1,24 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'layout'; +} + +$array_menu = Array( + 'layout' => Array('name' => 'Layout', 'link' => 'settings_layout'), + 'others' => Array('name' => 'Others', 'link' => 'settings_others') +); + +print_admin_menu($array_menu,$cat2); + +switch($cat2) +{ + case 'layout': + include_once(LINPHA_DIR.'/admin/settings_layout.php'); + break; + case 'others': + break; +} +?> \ No newline at end of file Added: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php (rev 0) +++ trunk/linpha2/admin/settings_layout.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -0,0 +1,86 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat3)) +{ + $cat3 = 'home'; +} + +$array_menu = Array( + 'home' => Array('name' => 'Home Site', 'link' => 'settings_layout_home'), + 'others' => Array('name' => 'Others', 'link' => 'settings_layout_others') +); + +print_admin_menu($array_menu,$cat3); +?> + +<form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=settings_layout_'.$cat3; ?>"> +<?php + +switch($cat3) +{ +case 'home': + $welcometxt = i18n("Add Your Own Welcome Text Here"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT comment FROM ".PREFIX."meta_comments WHERE md5sum='welcometext'"); + if(isset($data['comment'])) + { + $welcometxt = $data['comment']; + $update = true; + } + + /** + * save settings + */ + if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + saveConfig(Array('sys_style_home_usedefaultwelcometext', + 'sys_style_home_nrrandomimages', + 'sys_style_home_showalbums', + 'sys_style_home_firstsortorder', + 'sys_style_home_showbrowsebydate')); + if(isset($_POST['welcometext']) && $_POST['welcometext'] != $welcometxt) + { + /** + * insert or update + */ + if(isset($update)) + { + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."meta_comments SET " . + "comment = '".LinSql::linAddslashes($_POST['welcometext'])."'" . + "WHERE md5sum='welcometext'"); + $welcometxt = $_POST['welcometext']; + } + else + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (md5sum, comment) " . + "VALUES ('welcometext', '".LinSql::linAddslashes($_POST['welcometext'])."')"); + $welcometxt = $_POST['welcometext']; + } + } + } + + + echo '<b>'.i18n("Welcome Text").'</b><br />'; + printAdminConfig('radio',i18n("Use Default Welcome Text"),'sys_style_home_usedefaultwelcometext'); + + ?> + <textarea name="welcometext" rows="10" cols="50"><?php echo htmlspecialchars($welcometxt,ENT_QUOTES); ?></textarea> + <br /><br /><br /> + <?php + printAdminConfig('text',i18n("Nr Of Random Images (0 to disable)"),'sys_style_home_nrrandomimages'); + printAdminConfig('radio',i18n("Show Browse By Date"),'sys_style_home_showbrowsebydate'); + printAdminConfig('radio',i18n("Show Albums On Home Site"),'sys_style_home_showalbums'); + printAdminConfig('select',i18n("Sort Order Of First Level Albums"),'sys_style_home_firstsortorder',getSortOrders()); + + break; +case 'others': + + + + break; +} +?> +<br /><br /><hr /> +<input type="hidden" name="cmd" value="saveconfig" /> +<input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> +</form> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -40,7 +40,12 @@ 'sys_path_cache_dir' => $_SESSION['cache_dir'], 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], 'sys_style_img_quality' => '75', - 'sys_style_nrrandomimages' => '4', + 'sys_style_home_showbrowsebydate' => '1', + 'sys_style_home_nrrandomimages' => '4', + 'sys_style_home_showalbums' => '1', + 'sys_style_home_usedefaultwelcometext' => '1', + 'sys_style_home_firstsortorder' => 'nameasc', + 'sys_style_sortorder' => 'nameasc', 'sys_style_template' => 'default', 'sys_style_tn_size' => '150', 'sys_user_autologin' => '1' Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -129,8 +129,42 @@ } } +/** + * returns an array with the sort orders + */ +function getSortOrders() +{ + return Array( + 'nameasc' => i18n("Name Asc"), + 'namedesc' => i18n("Name Desc"), + 'dateasc' => i18n("Date Asc"), + 'datedesc' => i18n("Date Desc") + ); +} /** + * return the correct sql order string + */ +function getSqlSortOrder($order) +{ + switch($order) + { + case 'nameasc': + return "name ASC"; + break; + case 'namedesc': + return "name DESC"; + break; + case 'dateasc': + return "time_add ASC"; + break; + case 'datedesc': + return "time_add DESC"; + break; + } +} + +/** * explode string to array and remove first and last entry of array because they are empty * * should be moved to "others" Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -34,7 +34,6 @@ $array_tn_sizes = Array(50,75,100,150,200,250,300,400,500); $def_tn_size = 150; $array_nr_images = Array('auto',10,25,50,100,200,'all'); -$array_sort_orders = Array('nameasc', 'namedesc', 'dateasc', 'datedesc'); $no_js_nr_rows = 3; $no_js_nr_cols = 4; @@ -62,6 +61,8 @@ */ function setCurrentView($modulename) { + $this->orderby = getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_sortorder']); + if(isset($_GET['id']) && $_GET['id'] != 0) { /** @@ -121,6 +122,7 @@ if($modulename=='albums') { $this->mode = 'home'; + $this->orderby = getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); } else // $modulename=='browse', others will come.. { @@ -278,7 +280,8 @@ /** * more than one time used stuff */ - foreach($GLOBALS['array_sort_orders'] AS $value) + $array = getSortOrders(); + foreach($array AS $value) { $array_sort_orders_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); } @@ -378,14 +381,17 @@ */ function adminCommands() { - switch($_GET['admin_cmd']) + if($GLOBALS['linpha']->sql->isAdmin()) { - case 'recreate': - LinImage::createThumbnail($this->id_current,$this->img_type,$force=true); - break; - case 'rotate_left': - case 'rotate_right': - break; + switch($_GET['admin_cmd']) + { + case 'recreate': + LinImage::createThumbnail($this->id_current,$this->img_type,$force=true); + break; + case 'rotate_left': + case 'rotate_right': + break; + } } } @@ -663,6 +669,28 @@ { $GLOBALS['linpha']->template->setModuleName('home'); + /** + * set welcome text + */ + if($GLOBALS['linpha']->sql->config->value['sys_style_home_usedefaultwelcometext']) + { + $GLOBALS['linpha']->template->output['welcome'] = '<h1>'.i18n("Welcome").'</h1>'. + i18n("Hi, this is the home of \"The PHP Photo Archive\" " . + "<a href=\"http://linpha.sf.net\">aka LinPHA</a>.").'<br />'; + } + else + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT comment FROM ".PREFIX."meta_comments WHERE md5sum='welcometext'"); + if(isset($data['comment'])) + { + $GLOBALS['linpha']->template->output['welcome'] = $data['comment']; + } + else + { + $GLOBALS['linpha']->template->output['welcome'] = ''; + } + } + $this->setRandomImages(); $this->setBrowseByDate(); @@ -683,27 +711,30 @@ */ function setBrowseByDate() { - $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - - $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . - "FROM ".PREFIX."meta_exif"); - if(isset($data[0]) && isset($data[1]) && !empty($data[0]) && !empty($data[1]) ) + if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate']) { - /** - * get min and max year - */ - $min_year = substr($data[0],0,4); - $max_year = substr($data[1],0,4); - - /** - * get years between - */ - for($i = $min_year; $i <= $max_year; $i++) + $GLOBALS['linpha']->template->output['browse_by_date'] = ''; + + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + "FROM ".PREFIX."meta_exif"); + if(isset($data[0]) && isset($data[1]) && !empty($data[0]) && !empty($data[1]) ) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + /** + * get min and max year + */ + $min_year = substr($data[0],0,4); + $max_year = substr($data[1],0,4); + + /** + * get years between + */ + for($i = $min_year; $i <= $max_year; $i++) { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data[0]>0) + { + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } } } } @@ -716,40 +747,45 @@ */ function setRandomImages() { - switch(DB_TYPE) - { - case 'mysql': - $str_random = 'rand()'; - break; - case 'postgres': - $str_random = 'random()'; - break; - case 'sqlite': - $str_random = 'random()'; - break; - } - - $nr_random_images = $GLOBALS['linpha']->sql->config->value['sys_style_nrrandomimages']; $GLOBALS['linpha']->template->output['random_images'] = Array(); - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 ORDER BY ".$str_random); - for($i = 1; $i <= $nr_random_images ; ) + if($GLOBALS['linpha']->sql->config->value['sys_style_home_nrrandomimages'] != 0) { - $data = $query->FetchRow(); - if(isset($data['id'])) + switch(DB_TYPE) + { + case 'mysql': + $str_random = 'rand()'; + break; + case 'postgres': + $str_random = 'random()'; + break; + case 'sqlite': + $str_random = 'random()'; + break; + } + + $nr_random_images = $GLOBALS['linpha']->sql->config->value['sys_style_home_nrrandomimages']; + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 ORDER BY ".$str_random); + + for($i = 1; $i <= $nr_random_images ; ) { - $path = implode('/',LinSql::getFullFilenameFromId($data['id'])); - - if(file_exists(LinFilesys::getFullPath($path)) && LinSql::photoIsAllowed($data['id'])) + $data = $query->FetchRow(); + if(isset($data['id'])) { - $GLOBALS['linpha']->template->output['random_images'][] = Array('id'=>$data['id'],'path'=>$path); - $i++; + $array = LinSql::getFullFilenameFromId( $data['id'] ); + $path = LinSql::getPath('album') .'/'. implode('/',$array); + + if(file_exists(LinFilesys::getFullPath($path)) && LinSql::photoIsAllowed($data['id'])) + { + $GLOBALS['linpha']->template->output['random_images'][] = Array('id'=>$data['id'],'path'=>$path); + $i++; + } } + else + { + break; + } } - else - { - break; - } } } Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/lib/modules/module.albums.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -78,10 +78,10 @@ * take folders first */ $array_folders = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, md5sum, stats_numbers, time_add FROM ".PREFIX."photos " . - "WHERE img_type = '0' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); + "WHERE img_type = '0' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$linpha->imgview->orderby); $array_files = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, md5sum, stats_numbers, time_add FROM ".PREFIX."photos " . - "WHERE img_type <> '0' AND img_type <> '9999999' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); + "WHERE img_type <> '0' AND img_type <> '9999999' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$linpha->imgview->orderby); $linpha->imgview->photos = array_merge($array_folders,$array_files); Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/lib/modules/module.browse.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -222,7 +222,7 @@ $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT p.id, p.name, p.img_type, p.md5sum, p.stats_numbers, p.time_add " . "FROM ".PREFIX."photos AS p LEFT OUTER JOIN ".PREFIX."meta_exif AS e ON p.md5sum = e.md5sum " . "WHERE e.datetimeoriginal is NULL AND img_type <> '0' AND img_type <> '9999999' " . - "ORDER by ".$order_by); + "ORDER by ".$linpha->imgview->orderby); } else { @@ -231,7 +231,7 @@ "WHERE p.md5sum = e.md5sum " . "AND img_type <> '0' AND img_type <> '9999999' " . "AND e.datetimeoriginal LIKE '".$search_string."%' " . - "ORDER by ".$order_by); + "ORDER by ".$linpha->imgview->orderby); } Modified: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/reset_database.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -30,7 +30,7 @@ /** * drop tables */ - echo tr("Drop tables")."... "; + echo "<br /><br />".tr("Drop tables")."... "; while( list($key,$value) = each($linpha_tables) ) { $result = @$linpha->db->Execute("DROP TABLE ".$value); @@ -56,7 +56,7 @@ /** * finally create tables */ - echo tr("Creating Tables")."... "; + echo "<br /><br />".tr("Creating Tables")."... "; $translation_array = array_keys($linpha_tables); // only used in error case while( list($key,$query) = each($sql_tables) ) @@ -99,12 +99,13 @@ unset($error_nr); } + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."users (username, password) VALUES ('admin','".md5('test')."')"); + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('1','1')"); - function failed_msg() { Modified: trunk/linpha2/templates/default/css/home.css =================================================================== --- trunk/linpha2/templates/default/css/home.css 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/templates/default/css/home.css 2006-04-08 19:38:58 UTC (rev 4490) @@ -21,9 +21,8 @@ } .div_random { - height: 200px; -} +} .div_random_img { float: left; margin-left: 40px; @@ -32,8 +31,8 @@ .img_random_thumbnail { border: 0; - max-width: 130px; - max-height: 130px; + width: 130px; + height: 130px; } .div_folder { Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-04-08 15:41:24 UTC (rev 4489) +++ trunk/linpha2/templates/default/home.html.php 2006-04-08 19:38:58 UTC (rev 4490) @@ -5,58 +5,63 @@ <div id="main"> -<h1><?php echo i18n("Welcome"); ?></h1> -<br /><br /><br /> +<?php echo $GLOBALS['linpha']->template->output['welcome']; ?> +<br /> -<hr /> - +<!-- Random Images --> <?php if( count($GLOBALS['linpha']->template->output['random_images']) > 0 ) { ?> + <hr /> <h1><?php echo i18n("Random images"); ?></h1> - <div class='div_random'> <?php foreach($GLOBALS['linpha']->template->output['random_images'] AS $key=>$value) { ?> - <div class='div_random_img'> + <div class="div_random_img"> <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="randomimage" /></a>'; ?> + <br /><br /> </div> <?php } ?> - </div> - - <hr /> + <div style="clear: both;"></div> <?php } ?> +<!-- Browse by Date --> <?php -if(!empty($GLOBALS['linpha']->template->output['browse_by_date'])) { +if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate'] && + !empty($GLOBALS['linpha']->template->output['browse_by_date'])) { + echo "<hr />"; echo i18n("Browse by Date").': '.$GLOBALS['linpha']->template->output['browse_by_date']; - echo "<br /><hr />"; + echo "<br />"; } ?> -<h1><?php echo i18n("Albums"); ?></h1> - -<?php -foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) -{ - ?> - <div class='div_folder'> - <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' - . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> - - <div class='div_folder_text'> - <h2><?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> - - <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> - - <br /> - <?php echo strftime("%x %X",$value['time_add']); ?> - +<!-- Albums --> +<?php if($GLOBALS['linpha']->sql->config->value['sys_style_home_showalbums']) { ?> + <hr /> + <h1><?php echo i18n("Albums"); ?></h1> + + <?php + foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) + { + ?> + <div class='div_folder'> + <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' + . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> + + <div class='div_folder_text'> + <h2><?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> + + <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> + + <br /> + <?php echo strftime("%x %X",$value['time_add']); ?> + + </div> </div> - </div> - <?php + <?php + } } ?> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-08 21:58:14
|
Revision: 4491 Author: fangehrn Date: 2006-04-08 14:57:45 -0700 (Sat, 08 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4491&view=rev Log Message: ----------- * startet writing linpha image class Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/get_image.php trunk/linpha2/get_thumb.php trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/reset_database.php trunk/linpha2/templates/default/css/view_img.css Added Paths: ----------- trunk/linpha2/lib/include/image.gdlib.thumbnail.php trunk/linpha2/lib/include/image.imagemagick.thumbnail.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/ChangeLog 2006-04-08 21:57:45 UTC (rev 4491) @@ -8,6 +8,7 @@ - admin section * implemented home site configuration * implemented sort orders + * startet writing linpha image class 2006-04-07 flo * implemented admin section for user, groups and group memberships Modified: trunk/linpha2/get_image.php =================================================================== --- trunk/linpha2/get_image.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/get_image.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -0,0 +1,73 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Image view + * @package Image + */ + +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } + +include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +$linpha = new linpha(); +$linpha->sql->startSession(); + +/** + * check for valid id + */ +try +{ + if(!isset( $_GET['id'] ) ) + { + throw new Exception("no id supplied!"); + } + $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes( $_GET['id'] )."'"); + + if($query->RecordCount() != 1) + { + throw new Exception("wrong id supplied!"); + } + + $data = $query->FetchRow(); + + if( ! LinSql::photoIsAllowed( $data['id'] ) ) + { + throw new Exception("not permitted!"); + } + + if( isset($_GET['force'] ) ) { + $force = true; + } else { + $force = false; + } + + $output_file = LinImage::createImage($data['id'],$data['img_type'],$force); + if(file_exists($output_file)) + { + Header("Content-type: image/jpeg"); + readfile( $output_file ); + } +} +catch(Exception $error) +{ + echo "Error: ".$error -> getMessage(); +} + +?> \ No newline at end of file Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/get_thumb.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -45,7 +45,7 @@ throw new Exception("wrong id supplied!"); } - $data = $query->FetchRow(ADODB_FETCH_ASSOC); + $data = $query->FetchRow(); if( ! LinSql::photoIsAllowed( $data['id'] ) ) { @@ -58,12 +58,13 @@ $force = false; } - $output_file = LinImage::createThumbnail($data['id'],$data['img_type'],$force); - if(file_exists($output_file)) + $thumbnail = new LinImage(); + if( ! $thumbnail->createFile('thumb',$data['id'],$data['img_type'],$force) ) { - Header("Content-type: image/jpeg"); - readfile( $output_file ); + throw new Exception("Error while creating thumbnail!"); } + + $thumbnail->printFileToScreen(); } catch(Exception $error) { Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/index.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -7,7 +7,7 @@ * some init stuff */ include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); + $linpha = new Linpha(); $linpha->sql->startSession(); include_once(LINPHA_DIR.'/lib/include/integrity.php'); Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -28,8 +28,8 @@ $options = array( 'sys_db_version' => '2', 'sys_im_bracket_support' => $_SESSION['sys_im_bracket_support'], - 'sys_im_convert_path' => $_SESSION['sys_im_convert_path'], - 'sys_im_use_convert' => $_SESSION['sys_im_use_convert'], + 'sys_im_imagemagick_path' => $_SESSION['sys_im_convert_path'], + 'sys_im_use_imagemagick' => $_SESSION['sys_im_use_convert'], 'sys_im_video_thumbnail' => '1', 'sys_import_autoimport' => '1', 'sys_image_exif' => '1', @@ -39,7 +39,8 @@ 'sys_path_album_dir' => $_SESSION['album_dir'], 'sys_path_cache_dir' => $_SESSION['cache_dir'], 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], - 'sys_style_img_quality' => '75', + 'sys_style_image_quality' => '75', + 'sys_style_image_size' => '700', 'sys_style_home_showbrowsebydate' => '1', 'sys_style_home_nrrandomimages' => '4', 'sys_style_home_showalbums' => '1', @@ -47,7 +48,8 @@ 'sys_style_home_firstsortorder' => 'nameasc', 'sys_style_sortorder' => 'nameasc', 'sys_style_template' => 'default', - 'sys_style_tn_size' => '150', + 'sys_style_thumb_size_max' => '200', + 'sys_style_thumb_size_display' => '150', 'sys_user_autologin' => '1' ); Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/install/step10_postsettings.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -82,7 +82,7 @@ <?php $query = $linpha->db->Execute("SELECT option_value FROM ".PREFIX."config " . - "WHERE option_name='sys_im_use_convert'"); + "WHERE option_name='sys_im_use_imagemagick'"); $data = $query->FetchRow(); if(false === $data[0]) Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/install/step11_finish.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -82,7 +82,7 @@ { $result = $linpha->db->Execute("UPDATE ".PREFIX."config " . "SET option_value = '".LinSql::linAddslashes($_POST['sys_style_tn_size'])."' " . - "WHERE option_name = 'sys_style_tn_size'"); + "WHERE option_name = 'sys_style_thumb_size_max'"); if(!$result) { echo failed_msg(); Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -64,7 +64,7 @@ */ function isSupportedImage($org_type) { - if( $GLOBALS['linpha']->sql->config->value['sys_im_use_convert'] ) { + if( $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick'] ) { if($org_type >= 1 && $org_type < 1000) { return true; } else { @@ -137,8 +137,8 @@ } else { - $identify_path = $GLOBALS['linpha']->sql->config->value['sys_im_convert_path'] ."identify"; - if( $GLOBALS['linpha']->sql->config->value['sys_im_use_convert'] ) + $identify_path = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path'] ."identify"; + if( $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick'] ) { /** * $array_output[0] contains something like '2272 1704 JPEG' Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -22,237 +22,323 @@ * This class provides a couple methods for image manipulation/creation * @package Image */ + +if(!defined('LINPHA_DIR')) { exit(1); } class LinImage { + +private $id; +private $img_type; +private $mode; + +private $output_file; +private $src_file, $org_width, $org_height; + /** - * delete thumbnail by id - * - * @param int $id id of thumb in database + * constructor */ -function deleteThumbnail($id) +function __construct() { - $output = linSql::getCachePath('thumb',$id); - - if(file_exists($output)) - { - unlink($output); - } } - -/** - * create thumbnail - * - * @param int $id thumbnail id - * @param int $img_type description - * @param bool $force force recreate of thumbs - */ -function createThumbnail($id,$img_type,$force) +function setFileInformation() { /** - * check if thumbnail already exists OR if forced + * check if already exists OR if forced */ - $output = linSql::getCachePath('thumb',$id); - if( ! file_exists( $output ) OR $force ) + $this->output_file = LinImage::getCachePath($this->mode,$this->id); + if( file_exists( $this->output_file ) AND !$this->force ) { - linSysLog("Create thumbnail".$id."<br />"); + $this->isCached = true; + } + else // !file_exists() OR $this->force + { + $this->isCached = false; /** * create subfolder if needed */ - if( ! file_exists( dirname($output) ) ) + if( ! file_exists( dirname($this->output_file) ) ) { - if( ! @mkdir( dirname($output) ) ) + if( ! @mkdir( dirname($this->output_file) ) ) { - echo "Cannot create folder ".dirname($output)." check permissions!"; + echo "Cannot create folder ".dirname($this->output_file)." check permissions!"; + return false; } } + } + + /** + * use imagemagick or gdlib + */ + if($GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) + { + $this->include_str = 'imagemagick'; + } + else + { + $this->include_str = 'gdlib'; + } + + return true; +} + +function setSourceFileInformation() +{ + /** + * set source file informations + */ + if($this->img_type != 0 && $this->img_type != 9999999) + { + $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id ); + $album_dir = $GLOBALS['linpha']->sql->getPath('album'); + $this->src_file = $album_dir .'/'. implode('/',$array_path); + + if(! file_exists($this->src_file)) + { + echo $this->src_file.' '; + echo i18n("File doesnt exist anymore").'. '; + echo i18n("You should consider start a re-import of your files/folders").'<br />'; + return false; + } + + list($this->org_width,$this->org_height,$org_type) = LinIdentify::linGetImageSize( $this->src_file ); + } + + return true; +} + +function printFileToScreen() +{ + if(file_exists($this->output_file)) + { + Header("Content-type: image/jpeg"); + readfile( $this->output_file ); + } +} + +function createFile($mode,$id,$img_type,$force) +{ + $this->id = $id; + $this->mode = $mode; + $this->force = $force; + $this->img_type = $img_type; + + if( ! $this->setFileInformation() ) + { + return false; + } + + if( ! $this->isCached) + { + if( ! $this->setSourceFileInformation() ) + { + return false; + } + + if($this->mode == 'thumb') + { + $this->createThumbnail(); + } + elseif($this->mode == 'image') + { + $this->createImage(); + } + } + + if( ! file_exists( $this->output_file ) ) + { + return false; + } + + return true; +} + + +/** + * thumbnail functions + */ + function createThumbnail() + { /** * create folder thumbnail */ - if($img_type == 0) + if($this->img_type == 0) { - /** - * check if we have already some thumbnails in this folder - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE parent_id = '".linSql::linAddslashes( $id )."'"); - $array_ids = Array(); - $i=0; - while($data = $query->FetchRow()) + if( ! $this->createThumbnailFolder() ) { - if($i >= 4) - { - break; - } - - if( file_exists( linSql::getCachePath('thumb',$data['id']) ) ) - { - $array_ids[] = $data['id']; - $i++; - } + $this->output_file = LINPHA_DIR.'/lib/graphics/subfolder_image.png'; } + } + elseif( linIdentify::isVideo( $this->img_type ) ) + { + $this->createThumbnailVideo(); + } + elseif( linIdentify::isSupportedImage( $this->img_type ) ) + { + + $this->createThumbnailImage(); + } + } - if(count($array_ids)>=1) - { - /** - * create new tmp folder - */ - for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } - $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; - mkdir($tmp_folder,0700); + function createThumbnailImage() + { + /** + * include the file which contains the imagemagick strings and exec() + */ + $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $q = 75; + $img_type = $this->img_type; + $input = $this->src_file; + $output = $this->output_file; + $org_height = $this->org_height; + $org_width = $this->org_width; + + include(LINPHA_DIR.'/lib/include/image.'.$this->include_str.'.thumbnail.php'); + } - /** - * run imagemagick - */ - for($i=1; list($key,$value) = each($array_ids) ; $i++) - { - exec( "convert ". linSql::getCachePath('thumb',$value) . " -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); - } + function createThumbnailFolder() + { + /** + * thumbnail icon only available with imagemagick + */ + if(! $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) + { + return false; + } - exec("convert -size 180x180 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 ".$output); - - for($i=1; $i<=count($array_ids); $i++ ) - { - switch($i) - { - case 1: - exec("composite -geometry +10+10 ".$tmp_folder."/1.jpg ".$output." ".$output); - break; - case 2: - exec("composite -geometry +100+10 ".$tmp_folder."/2.jpg ".$output." ".$output); - break; - case 3: - exec("composite -geometry +10+100 ".$tmp_folder."/3.jpg ".$output." ".$output); - break; - case 4: - exec("composite -geometry +100+100 ".$tmp_folder."/4.jpg ".$output." ".$output); - break; - } - } - - /** - * delete tmp folder - */ - reset($array_ids); - for($i=1; list($key,$value) = each($array_ids) ; $i++) - { - unlink( $tmp_folder .'/'. $i . '.jpg' ); - } - rmdir($tmp_folder); + /** + * check if we have already some thumbnails in this folder + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->id )."'"); + $array_ids = Array(); + $i=0; + while($data = $query->FetchRow()) + { + if($i >= 4) + { + break; } - else + + if( file_exists( LinImage::getCachePath('thumb',$data['id']) ) ) { - $output = LINPHA_DIR.'/lib/graphics/subfolder_image.png'; + $array_ids[] = $data['id']; + $i++; } } - else // create image/video thumbnail + + if(count($array_ids) == 0) { - /** - * set source and output file - */ - $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); - $album_dir = $GLOBALS['linpha']->sql->getPath('album'); - $src_file = $album_dir .'/'. implode('/',$array_path); - - if(! file_exists($src_file)) + return false; + } + + /** + * create new tmp folder + */ + for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } + $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; + mkdir($tmp_folder,0700); + + /** + * run imagemagick + */ + for($i=1; list($key,$value) = each($array_ids) ; $i++) { - echo $src_file.' '; - echo i18n("File doesnt exist anymore").'. '; - echo i18n("You should consider start a re-import of your files/folders").'<br />'; + exec("convert ". LinImage::getCachePath('thumb',$value) . " -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); } - else + + exec("convert -size 180x180 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 ".$this->output_file); + + for($i=1; $i<=count($array_ids); $i++ ) { - list($org_width,$org_height,$org_type) = LinIdentify::linGetImageSize( $src_file ); - - /** - * create video thumbnail - * @todo - */ - if( linIdentify::isVideo( $org_type ) ) + switch($i) { - /** - * @todo $tmp_file = create_video_thumbnail($src_file); - */ - $output = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; - + case 1: + exec("composite -geometry +10+10 ".$tmp_folder."/1.jpg ".$this->output_file." ".$this->output_file); + break; + case 2: + exec("composite -geometry +100+10 ".$tmp_folder."/2.jpg ".$this->output_file." ".$this->output_file); + break; + case 3: + exec("composite -geometry +10+100 ".$tmp_folder."/3.jpg ".$this->output_file." ".$this->output_file); + break; + case 4: + exec("composite -geometry +100+100 ".$tmp_folder."/4.jpg ".$this->output_file." ".$this->output_file); + break; } - /** - * create image thumbnail - */ - elseif( linIdentify::isSupportedImage( $org_type ) ) - { - /** - * read thumbsize - */ - $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_tn_size']; - $q = 75; - - - /*$max_width = $thumbsize; - $max_height = $thumbsize; - $w = $thumbsize; - $h = $thumbsize;*/ + } - /** - * set parameters - */ - /*$array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); - $w = $array['w']; - $h = $array['h'];*/ - - - /** - * crop image - */ - $ratio = $org_width/$org_height; - if($ratio==1) - { - $x = 0; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; - } - elseif($ratio>1) - { - $x = ( ($thumbsize*$ratio) - $thumbsize )/2; - $y = 0; - $w = ''; - $h = $thumbsize; - } - elseif($ratio<1) - { - $y = ( $thumbsize - ($thumbsize*$ratio) )/2; - $x = 0; - $w = $thumbsize; - $h = ''; - } - - $convert_str = 'convert'. - ' -quality '.$q. - ' -size '.$w.'x'.$h. // new size - ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop - ' '.lin_escape_string( $src_file ).'[0]'. // [0] -> take only first frame!!! - ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles - ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images - ' '.lin_escape_string( $output ); - - exec( $convert_str ); - } + /** + * delete tmp folder + */ + reset($array_ids); + for($i=1; list($key,$value) = each($array_ids) ; $i++) + { + unlink( $tmp_folder .'/'. $i . '.jpg' ); } - } + rmdir($tmp_folder); } - if( ! file_exists( $output) ) + function createThumbnailVideo() { - echo "Thumbnail couldnt be created or opened!"; + /** + * @todo + */ + $this->output_file = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; } + + +/** + * image functions + */ + function createImage() + { + + } + + + +/** + * returns the full path to the cached image + * in thumb mode, $id is the photoid + * in image mode, $id is the cached photoid + */ +function getCachePath($what,$id) +{ + $path = LinSql::getPath('cache'); - return $output; + if(strlen($id)==1) + { + $subdir = $id.'0'; // dont use foldernames 1-9 because it would only contain one image per folder + } + else + { + $subdir = substr($id,0,2); + } + + return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; } +/** + * delete thumbnail by id + * + * @param int $id id of thumb in database + */ +function deleteThumbnail($id) +{ + $output = LinImage::getCachePath('thumb',$id); + + if(file_exists($output)) + { + if( ! @unlink( $output ) ) + { + linSysLog('Warning: '.$output.' cannot be deleted, check permissions'); + } + } +} /** * This returns returns width and height of the scaled image Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -1069,11 +1069,10 @@ /** - * set current thumb and image + * set current image and thumb */ - $GLOBALS['linpha']->template->output['image'] = '<img id="mainimage" src="'.LINPHA_DIR.'/get_thumb.php?id=' - . $this->photos_filtered[$this->current_key]['id'] . '" />' - . '<br />'.$this->photos_filtered[$this->current_key]['name']; + $GLOBALS['linpha']->template->output['image'] = '<img id="mainimage" src="'.LINPHA_DIR.'/get_image.php?id=' + . $this->photos_filtered[$this->current_key]['id'] . '" />'; $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImg_viewThumbHtml( $this->current_key , 'current' ); } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -217,14 +217,7 @@ /** * delete thumbnail in cache folder */ - $thumbnail = linSql::getCachePath('thumb',$photo_id); - if( file_exists( $thumbnail ) ) - { - if( ! @unlink( $thumbnail ) ) - { - linSysLog('Warning: '.$thumbnail.' cannot be deleted, check permissions'); - } - } + LinImage::deleteThumbnail($photo_id); } /** Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -553,22 +553,6 @@ return LinFilesys::getFullPath( $path ); } -function getCachePath($what,$id) -{ - $path = LinSql::getPath('cache'); - - if(strlen($id)==1) - { - $subdir = $id.'0'; // dont use foldernames 1-9 because it would only contain one image per folder - } - else - { - $subdir = substr($id,0,2); - } - - return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; -} - /** * Set autologin-cookie * Added: trunk/linpha2/lib/include/image.gdlib.thumbnail.php =================================================================== --- trunk/linpha2/lib/include/image.gdlib.thumbnail.php (rev 0) +++ trunk/linpha2/lib/include/image.gdlib.thumbnail.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -0,0 +1,96 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Create thumbnails with gdlib + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * calculate crop + */ + $ratio = $org_width/$org_height; + if($ratio==1) + { + $x = 0; + $y = 0; + $w = $thumbsize; + $h = $thumbsize; + } + elseif($ratio>1) + { + $x = ( $org_width - $org_height )/2; + $y = 0; + $w = $thumbsize; + $h = $thumbsize; + $src_size = $org_height; + } + elseif($ratio<1) + { + $y = ( $org_height - $org_width )/2; + $x = 0; + $w = $thumbsize; + $h = $thumbsize; + + $src_size = $org_width; + } + + +/** + * create image resources + */ + switch($img_type) + { + case 1: $src_image = imagecreatefromgif($input); break; + case 2: $src_image = imagecreatefromjpeg($input); break; + case 3: $src_image = imagecreatefrompng($input); break; + default: return false;; + } + $scaled_image = imagecreatetruecolor($thumbsize, $thumbsize); + +/** + * resize and crop image + */ + imagecopyresized( + $scaled_image,$src_image, + 0,0, // int dstX, int dstY + $x,$y, // int srcX, int srcY + $w,$h, // int dstW, int dstH + $src_size,$src_size // int srcW, int srcH + ); + +/** + * destroy source image + */ + imagedestroy($src_image); + +/** + * save image + */ + imagejpeg($scaled_image,$output,$q); + +/** + * destroy scaled image + */ + imagedestroy($scaled_image); + +?> \ No newline at end of file Added: trunk/linpha2/lib/include/image.imagemagick.thumbnail.php =================================================================== --- trunk/linpha2/lib/include/image.imagemagick.thumbnail.php (rev 0) +++ trunk/linpha2/lib/include/image.imagemagick.thumbnail.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -0,0 +1,68 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Create thumbnails with imagemagick + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * crop image + */ +$ratio = $org_width/$org_height; +if($ratio==1) +{ + $x = 0; + $y = 0; + $w = $thumbsize; + $h = $thumbsize; +} +elseif($ratio>1) +{ + $x = ( ($thumbsize*$ratio) - $thumbsize )/2; + $y = 0; + $w = ''; + $h = $thumbsize; +} +elseif($ratio<1) +{ + $y = ( $thumbsize - ($thumbsize*$ratio) )/2; + $x = 0; + $w = $thumbsize; + $h = ''; +} + +$q = 100; + + +$convert_str = 'convert'. + ' -quality '.$q. + ' -size '.$w.'x'.$h. // new size + ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop + ' '.lin_escape_string( $input ).'[0]'. // [0] -> take only first frame!!! + ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles + ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images + ' '.lin_escape_string( $output ); + +exec( $convert_str ); + +?> \ No newline at end of file Modified: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/reset_database.php 2006-04-08 21:57:45 UTC (rev 4491) @@ -7,8 +7,8 @@ $_SESSION['sys_im_bracket_support'] = $GLOBALS['linpha']->sql->config->value['sys_im_bracket_support']; -$_SESSION['sys_im_use_convert'] = $GLOBALS['linpha']->sql->config->value['sys_im_use_convert']; -$_SESSION['sys_im_convert_path'] = $GLOBALS['linpha']->sql->config->value['sys_im_convert_path']; +$_SESSION['sys_im_use_convert'] = $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']; +$_SESSION['sys_im_convert_path'] = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path']; $_SESSION['language'] = $GLOBALS['linpha']->sql->config->value['sys_lang']; $_SESSION['album_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_album_dir']; $_SESSION['cache_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_cache_dir']; Modified: trunk/linpha2/templates/default/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/css/view_img.css 2006-04-08 19:38:58 UTC (rev 4490) +++ trunk/linpha2/templates/default/css/view_img.css 2006-04-08 21:57:45 UTC (rev 4491) @@ -10,8 +10,6 @@ } #mainimage { - width: 350px; - height: auto; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-04-09 15:43:34
|
Revision: 4496 Author: bzrudi Date: 2006-04-09 08:43:12 -0700 (Sun, 09 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4496&view=rev Log Message: ----------- added support for database port selection Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/sql/config.sql.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.sql.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/ChangeLog 2006-04-09 15:43:12 UTC (rev 4496) @@ -1,3 +1,9 @@ +2006-04-09 bzrudi <linpha2_AT_tuxpower_DOT_de> + * Installer + -> added database port support + -> allow install without passwd (remove as must have) + TODO: more help entries, better mysql non root install support + 2006-04-08 flo * remove PHP NOTICE in phpmeta/IPTC.php * finished permission and user/group system Modified: trunk/linpha2/install/sql/config.sql.php =================================================================== --- trunk/linpha2/install/sql/config.sql.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/sql/config.sql.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -4,7 +4,8 @@ $str .= '$db_hostname = "'.$_SESSION['sql_hostname'].'";'.$comment[2]."\n"; $str .= '$db_username = "'.$_SESSION['sql_username'].'";'.$comment[3]."\n"; $str .= '$db_password = "'.$_SESSION['sql_password'].'";'.$comment[4]."\n"; -$str .= '$db_name = "'.($_SESSION['sql_dbtype'] == "sqlite" ? 'sql/' : '').$_SESSION['sql_dbname'].'";'.$comment[5]."\n"; -$str .= '$db_prefix = "'.$_SESSION['sql_prefix'].'";'.$comment[6]."\n"; +$str .= '$db_port = "'.$_SESSION['sql_dbport'].'";'.$comment[5]."\n"; +$str .= '$db_name = "'.($_SESSION['sql_dbtype'] == "sqlite" ? 'sql/' : '').$_SESSION['sql_dbname'].'";'.$comment[6]."\n"; +$str .= '$db_prefix = "'.$_SESSION['sql_prefix'].'";'.$comment[7]."\n"; $str.= '?>'; ?> \ No newline at end of file Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step10_postsettings.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -133,8 +133,8 @@ $array_check = array( 'check01' => 'text', - 'check02' => 'text', - 'check03' => 'text' + 'check02' => 'text' + //'check03' => 'text' ); $do_javascript_disable_button = true; include_once(LINPHA_DIR.'/install/footer.php'); Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step2_requirements.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -124,6 +124,8 @@ list($convert_avail, $convert_path, $convert_version) = check_convert(); if($convert_avail) { + echo $convert_path ; + echo "path war"; /** * the imagemagick versions 6.1.1 - 6.1.3 contains a bug with the switch Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -66,7 +66,7 @@ ?> <div class="boxalign"> -<?php echo tr("Album Directory:"); ?> +<?php echo tr("Album Directory").":"; ?> <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> </div> @@ -77,7 +77,7 @@ <br /> <div class="boxalign"> -<?php echo tr("Sql Directory:"); ?> +<?php echo tr("Sql Directory").":"; ?> <input class="boxalignelement" type="text" id="check02" onKeyup="checkForm()" name="sql_dir" size="30" value="<?php echo $sql_dir; ?>"> </div> @@ -85,7 +85,7 @@ <br /><br /> <div class="boxalign"> -<?php echo tr("Cache Directory:"); ?> +<?php echo tr("Cache Directory").":"; ?> <input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" name="cache_dir" size="30" value="<?php echo $cache_dir; ?>"> </div> @@ -93,7 +93,7 @@ <br /><br /> <div class="boxalign"> -<?php echo tr("Temp Directory:"); ?> +<?php echo tr("Temp Directory").":"; ?> <input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" name="tmp_dir" size="30" value="<?php echo $tmp_dir; ?>"> </div> Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -201,6 +201,21 @@ <hr /> <h1><?php echo tr("$title_str[$key]"); ?></h1> <br /> +<?php +if($_SESSION['sql_dbtype'] == 'mysql') +{ + echo tr("NOTE: If you have setup a root Password for your MySQL Database " . + "please login using your root account.")."<br /><br />"; + $_SESSION['sql_dbport'] = '3306'; +} +elseif($_SESSION['sql_dbtype'] == 'postgres') +{ + echo tr("NOTE: There is currently now way to let LinPHA create the required " . + "Database, so you have to create a new Database using \"createdb\" " . + "from commandline before you proceed.")."<br /><br />"; + $_SESSION['sql_dbport'] = '5432'; +} +?> <div class="boxalign"> <?php echo tr("Username").":"; ?> @@ -223,13 +238,23 @@ $_SESSION['sql_hostname'] : 'localhost' ; ?>"> </div> +<div class="boxalign"> +<?php echo tr("Port").":"; ?> +<input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" + name="sql_dbport" value="<?php echo isset($_SESSION['sql_dbport']) ? + $_SESSION['sql_dbport'] : '3306' ; ?>"> +</div> + + <?php $array_check = array( 'check01' => 'text', - 'check02' => 'text', - 'check03' => 'text' + //'check02' => 'text', + 'check03' => 'text', + 'check04' => 'text' ); + $do_javascript_disable_button = true; include_once(LINPHA_DIR.'/install/footer.php'); ?> \ No newline at end of file Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step6_selectdatabase.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -39,12 +39,15 @@ if(isset($_POST['sql_password'])) { $_SESSION['sql_password'] = $_POST['sql_password']; } +if(isset($_POST['sql_dbport'])) { + $_SESSION['sql_dbport'] = $_POST['sql_dbport']; +} /** * validate settings */ if(empty($_SESSION['sql_hostname']) OR empty($_SESSION['sql_username']) - OR empty($_SESSION['sql_password'])) + OR empty($_SESSION['sql_dbport'])) { echo tr("Validating Information")."... "; echo failed_msg(); @@ -63,7 +66,8 @@ echo tr("Testing Server Connection")."<br /><br />"; echo tr("Connecting MySQL-Server")."... "; - $link = @mysql_connect($_SESSION['sql_hostname'], $_SESSION['sql_username'], $_SESSION['sql_password']); + $link = @mysql_connect($_SESSION['sql_hostname'].":".$_SESSION['sql_dbport'], + $_SESSION['sql_username'], $_SESSION['sql_password']); if (!$link) { echo failed_msg(); @@ -216,4 +220,4 @@ } include_once(LINPHA_DIR.'/install/footer.php'); -?> \ No newline at end of file +?> Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step7_selectprefix.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -70,7 +70,8 @@ case "mysql": echo "<h2>".tr("Checking Database")."</h2><br />"; - $link = @mysql_connect($_SESSION['sql_hostname'], $_SESSION['sql_username'], $_SESSION['sql_password']); + $link = @mysql_connect($_SESSION['sql_hostname'].":".$_SESSION['sql_dbport'], + $_SESSION['sql_username'], $_SESSION['sql_password']); if(isset($_POST['create_database']) && $_POST['create_database'] == "create") { @@ -111,8 +112,12 @@ echo tr("Testing Server Connection")."<br /><br />"; echo tr("Connecting PostgreSQL-Server")."... "; - $link = pg_pconnect("host=".$_SESSION['sql_hostname']." dbname=".$_SESSION['sql_dbname']." user=".$_SESSION['sql_username']." password=".$_SESSION['sql_password']); - // port=5432 + $link = pg_connect("host=".$_SESSION['sql_hostname']." " . + "port=".$_SESSION['sql_dbport']." " . + "dbname=".$_SESSION['sql_dbname']." " . + "user=".$_SESSION['sql_username']." " . + "password=".$_SESSION['sql_password'].""); + if (!$link) { echo failed_msg(); Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step8_testing.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -156,7 +156,8 @@ * close connection and connect with just created user */ $test_conn = NewADOConnection($_SESSION['sql_dbtype']); - if(! $test_conn->Connect($_SESSION['sql_hostname'], $random_user, $random_pass, $_SESSION['sql_dbname']) ) + if(! $test_conn->Connect("$_SESSION['sql_hostname']:$_SESSION['sql_dbport']", + $random_user, $random_pass, $_SESSION['sql_dbname']) ) { echo warning_msg(); echo "<br />".tr("Failed To Create New LinPHA User"); Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/install/step9_createtables.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -179,6 +179,8 @@ $comment[4] = ''; $comment[5] = ''; $comment[6] = ''; + $comment[7] = ''; + include_once(LINPHA_DIR.'/install/sql/config.sql.php'); fwrite( $fp, $str ); Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-09 15:19:07 UTC (rev 4495) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-09 15:43:12 UTC (rev 4496) @@ -47,6 +47,7 @@ $db_hostname = $_SESSION['sql_hostname']; $db_username = $_SESSION['sql_username']; $db_password = $_SESSION['sql_password']; + $db_port = $_SESSION['sql_dbport']; $db_name = ($db_type == "sqlite" ? LINPHA_DIR.'/'.$_SESSION['sql_dir'] : '').$_SESSION['sql_dbname']; $db_prefix = $_SESSION['sql_prefix']; @@ -94,18 +95,18 @@ } case "mysql": - $GLOBALS['linpha']->db->Connect($db_hostname, $db_username, $db_password, $db_name); + $GLOBALS['linpha']->db->Connect("$db_hostname:$db_port", $db_username, $db_password, $db_name); break; case "postgres": { if(isset($db_password)) { - $GLOBALS['linpha']->db->Connect("host=$db_hostname user=$db_username password=$db_password dbname=$db_name"); + $GLOBALS['linpha']->db->Connect("host=$db_hostname port=$db_port user=$db_username password=$db_password dbname=$db_name"); } else { - $GLOBALS['linpha']->db->Connect("host=$db_hostname user=$db_username dbname=$db_name"); + $GLOBALS['linpha']->db->Connect("host=$db_hostname port=$db_port user=$db_username dbname=$db_name"); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-04-09 19:46:36
|
Revision: 4498 Author: fangehrn Date: 2006-04-09 12:46:00 -0700 (Sun, 09 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4498&view=rev Log Message: ----------- * adding config entries (reset_database.php needed) * partially finished image class - get_image.php - imagemagick and gdlib - image cache Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/settings_layout.php trunk/linpha2/get_image.php trunk/linpha2/get_thumb.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/lib/classes/image/gdlib/thumbnail.php trunk/linpha2/lib/classes/image/imagemagick/thumbnail.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/thumbnails.js trunk/linpha2/lib/include/common.php trunk/linpha2/templates/default/css/global.css trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/view_thumb.html.php Added Paths: ----------- trunk/linpha2/lib/classes/image/gdlib/image.php trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php trunk/linpha2/lib/classes/image/imagemagick/image.php trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php Removed Paths: ------------- trunk/linpha2/lib/include/image.gdlib.thumbnail.php trunk/linpha2/lib/include/image.imagemagick.thumbnail.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/ChangeLog 2006-04-09 19:46:00 UTC (rev 4498) @@ -1,3 +1,13 @@ +2006-04-09 flo + * testing another way of setting the height of main div in javascript thumbnail viewer + - #main { height: 85%; } and do not set the height in thumbnails.js + this way we always have scrollbars, but we see more (after scrolling..) + * adding config entries (reset_database.php needed) + * partially finished image class + - get_image.php + - imagemagick and gdlib + - image cache + 2006-04-09 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer -> added database port support Modified: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/admin/settings_layout.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -7,7 +7,8 @@ } $array_menu = Array( - 'home' => Array('name' => 'Home Site', 'link' => 'settings_layout_home'), + 'homesite' => Array('name' => 'Home Site', 'link' => 'settings_layout_home'), + 'thumb' => Array('name' => 'Thumb View', 'link' => 'settings_layout_thumb'), 'others' => Array('name' => 'Others', 'link' => 'settings_layout_others') ); @@ -73,6 +74,12 @@ printAdminConfig('select',i18n("Sort Order Of First Level Albums"),'sys_style_home_firstsortorder',getSortOrders()); break; +case 'thumb': + printAdminConfig('radio',i18n("Show Subfolders Separate"),'sys_style_thumb_showsubfoldersseparate'); + break; +case 'image': + printAdminConfig('text',i18n("Nr Of Previous/Next Thumbnails"),'sys_style_image_nrprevnextthumbs'); + break; case 'others': Modified: trunk/linpha2/get_image.php =================================================================== --- trunk/linpha2/get_image.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/get_image.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -19,16 +19,12 @@ */ /** - * Image view + * Thumb view related methods and functions * @package Image */ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -$linpha = new linpha(); -$linpha->sql->startSession(); - /** * check for valid id */ @@ -36,38 +32,35 @@ { if(!isset( $_GET['id'] ) ) { - throw new Exception("no id supplied!"); + throw new Exception("no id supplied!"); } - $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes( $_GET['id'] )."'"); - - if($query->RecordCount() != 1) - { - throw new Exception("wrong id supplied!"); - } - - $data = $query->FetchRow(); - if( ! LinSql::photoIsAllowed( $data['id'] ) ) + /** + * create overrideSettings + */ + $overrideSettings = Array(); + if(isset($_GET['width']) && isset($_GET['height'])) { - throw new Exception("not permitted!"); + $overrideSettings['max_width'] = $_GET['width']; + $overrideSettings['max_height'] = $_GET['height']; } - if( isset($_GET['force'] ) ) { - $force = true; - } else { - $force = false; - } + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); - $output_file = LinImage::createImage($data['id'],$data['img_type'],$force); - if(file_exists($output_file)) + $image = new LinImage(); + if( ! $image->createImage($_GET['id'],$overrideSettings) ) { - Header("Content-type: image/jpeg"); - readfile( $output_file ); + throw new Exception("Error while creating image!<br />Error: ".$image->error_msg); } + + $image->printFileToScreen(); } catch(Exception $error) { echo "Error: ".$error -> getMessage(); } + ?> \ No newline at end of file Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/get_thumb.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -25,10 +25,6 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -$linpha = new linpha(); -$linpha->sql->startSession(); - /** * check for valid id */ @@ -36,34 +32,19 @@ { if(!isset( $_GET['id'] ) ) { - throw new Exception("no id supplied!"); + throw new Exception("no id supplied!"); } - $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes( $_GET['id'] )."'"); - - if($query->RecordCount() != 1) - { - throw new Exception("wrong id supplied!"); - } - - $data = $query->FetchRow(); - if( ! LinSql::photoIsAllowed( $data['id'] ) ) - { - throw new Exception("not permitted!"); - } + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); - if( isset($_GET['force'] ) ) { - $force = true; - } else { - $force = false; - } - $thumbnail = new LinImage(); - if( ! $thumbnail->createFile('thumb',$data['id'],$data['img_type'],$force) ) + if( ! $thumbnail->createThumbnail($_GET['id']) ) { - throw new Exception("Error while creating thumbnail!"); + throw new Exception("Error while creating thumbnail!<br />Error: ".$thumbnail->error_msg); } - + $thumbnail->printFileToScreen(); } catch(Exception $error) @@ -71,4 +52,5 @@ echo "Error: ".$error -> getMessage(); } + ?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -39,17 +39,25 @@ 'sys_path_album_dir' => $_SESSION['album_dir'], 'sys_path_cache_dir' => $_SESSION['cache_dir'], 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], - 'sys_style_image_quality' => '75', - 'sys_style_image_size' => '700', + + 'sys_style_sortorder' => 'nameasc', + 'sys_style_template' => 'default', 'sys_style_home_showbrowsebydate' => '1', 'sys_style_home_nrrandomimages' => '4', 'sys_style_home_showalbums' => '1', 'sys_style_home_usedefaultwelcometext' => '1', 'sys_style_home_firstsortorder' => 'nameasc', - 'sys_style_sortorder' => 'nameasc', - 'sys_style_template' => 'default', 'sys_style_thumb_size_max' => '200', 'sys_style_thumb_size_display' => '150', + 'sys_style_thumb_showsubfoldersseparate' => '0', + 'sys_style_thumb_selectsizes' => '50,75,100,150,200,250,300,400,500', + 'sys_style_thumb_selectnrimages' => 'auto,10,25,50,100,200,all', + 'sys_style_thumb_nojsnrrows' => '3', + 'sys_style_thumb_nojsnrcols' => '4', + 'sys_style_image_quality' => '75', + 'sys_style_image_size' => '700', + 'sys_style_image_nrprevnextthumbs' => '3', + 'sys_user_autologin' => '1' ); Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -72,6 +72,21 @@ "stats_downloads INT NOT NULL default '0', " . "PRIMARY KEY (id) " . ")", + "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". + "id INT NOT NULL AUTO_INCREMENT, " . + "photo_id INT NOT NULL default '0', " . + "img_width INT NOT NULL default '0', " . + "img_height INT NOT NULL default '0', " . + "img_quality INT NOT NULL default '0', " . + "img_size INT NOT NULL default '0', " . + "is_rotated INT NOT NULL default '0', " . + "has_watermark INT NOT NULL default '0', " . + "time_add INT NOT NULL default '0', " . + "time_use INT NOT NULL default '0', " . + "time_creating INT NOT NULL default '0', " . + "hits INT NOT NULL default '0', " . + "PRIMARY KEY (id) " . + ")", "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". "id INT NOT NULL AUTO_INCREMENT, " . "name VARCHAR(255) NOT NULL default '', " . Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -20,6 +20,7 @@ /** * linpha installer */ + $sql_tables = array( "CREATE TABLE ".$linpha_tables['config']." ( ". "id SERIAL PRIMARY KEY, " . @@ -65,6 +66,20 @@ "stats_views INT NOT NULL default '0', " . "stats_downloads INT NOT NULL default '0' " . ")", + "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". + "id SERIAL PRIMARY KEY, " . + "photo_id INT NOT NULL default '0', " . + "img_width INT NOT NULL default '0', " . + "img_height INT NOT NULL default '0', " . + "img_quality INT NOT NULL default '0', " . + "img_size INT NOT NULL default '0', " . + "is_rotated INT NOT NULL default '0', " . + "has_watermark INT NOT NULL default '0', " . + "time_add INT NOT NULL default '0', " . + "time_use INT NOT NULL default '0', " . + "time_creating INT NOT NULL default '0', " . + "hits INT NOT NULL default '0' " . + ")", "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". "id SERIAL PRIMARY KEY, " . "name VARCHAR(255) NOT NULL default '', " . Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -66,6 +66,20 @@ "stats_views INTEGER NOT NULL default '0', " . "stats_downloads INTEGER NOT NULL default '0' " . ")", + "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". + "id INTEGER PRIMARY KEY, " . + "photo_id INTEGER NOT NULL default '0', " . + "img_width INTEGER NOT NULL default '0', " . + "img_height INTEGER NOT NULL default '0', " . + "img_quality INTEGER NOT NULL default '0', " . + "img_size INTEGER NOT NULL default '0', " . + "is_rotated INTEGER NOT NULL default '0', " . + "has_watermark INTEGER NOT NULL default '0', " . + "time_add INTEGER NOT NULL default '0', " . + "time_use INTEGER NOT NULL default '0', " . + "time_creating INTEGER NOT NULL default '0', " . + "hits INTEGER NOT NULL default '0' " . + ")", "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". "id INTEGER PRIMARY KEY, " . "name VARCHAR(255) NOT NULL default '', " . Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/install/sql/sql.tables.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -28,6 +28,7 @@ "user_group" => "user_group", "permissions" => "permissions", "photos" => "photos", + "photos_cache" => "photos_cache", "meta_fields" => "meta_fields", "meta_category" => "meta_category", "meta_exif" => "meta_exif", Added: trunk/linpha2/lib/classes/image/gdlib/image.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/image.php (rev 0) +++ trunk/linpha2/lib/classes/image/gdlib/image.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -0,0 +1,66 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Create thumbnails with gdlib + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * create image resources + */ + switch($this->img_type) + { + case 1: $src_image = imagecreatefromgif($this->src_file); break; + case 2: $src_image = imagecreatefromjpeg($this->src_file); break; + case 3: $src_image = imagecreatefrompng($this->src_file); break; + default: return false;; + } + $scaled_image = imagecreatetruecolor($this->img_width, $this->img_height); + +/** + * resize and crop image + */ + imagecopyresized( + $scaled_image,$src_image, + 0,0, // int dstX, int dstY + 0,0, // int srcX, int srcY + $this->img_width,$this->img_height, // int dstW, int dstH + $this->org_width,$this->org_height // int srcW, int srcH + ); + +/** + * destroy source image + */ + imagedestroy($src_image); + +/** + * save image + */ + imagejpeg($scaled_image,$this->output_file,$this->img_quality); + +/** + * destroy scaled image + */ + imagedestroy($scaled_image); + +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/image/gdlib/thumbnail.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -28,44 +28,44 @@ /** * calculate crop */ - $ratio = $org_width/$org_height; + $ratio = $this->org_width/$this->org_height; if($ratio==1) { $x = 0; $y = 0; - $w = $thumbsize; - $h = $thumbsize; + $w = $this->img_thumbsize; + $h = $this->img_thumbsize; } elseif($ratio>1) { - $x = ( $org_width - $org_height )/2; + $x = ( $this->org_width - $this->org_height )/2; $y = 0; - $w = $thumbsize; - $h = $thumbsize; - $src_size = $org_height; + $w = $this->img_thumbsize; + $h = $this->img_thumbsize; + $src_size = $this->org_height; } elseif($ratio<1) { - $y = ( $org_height - $org_width )/2; + $y = ( $this->org_height - $this->org_width )/2; $x = 0; - $w = $thumbsize; - $h = $thumbsize; + $w = $this->img_thumbsize; + $h = $this->img_thumbsize; - $src_size = $org_width; + $src_size = $this->org_width; } /** * create image resources */ - switch($img_type) + switch($image_type) { - case 1: $src_image = imagecreatefromgif($input); break; - case 2: $src_image = imagecreatefromjpeg($input); break; - case 3: $src_image = imagecreatefrompng($input); break; + case 1: $src_image = imagecreatefromgif($this->src_file); break; + case 2: $src_image = imagecreatefromjpeg($this->src_file); break; + case 3: $src_image = imagecreatefrompng($this->src_file); break; default: return false;; } - $scaled_image = imagecreatetruecolor($thumbsize, $thumbsize); + $scaled_image = imagecreatetruecolor($this->img_thumbsize, $this->img_thumbsize); /** * resize and crop image @@ -86,7 +86,7 @@ /** * save image */ - imagejpeg($scaled_image,$output,$q); + imagejpeg($scaled_image,$this->output_file,$this->img_quality); /** * destroy scaled image Added: trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php (rev 0) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -0,0 +1,34 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Create folder thumbnails with gdlib + * don't think we are going to create the same nice folder icons as with imagemagick + * -> use first image in this folder as thumbnail + * + * + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +copy( LinImage::getCachePath('thumb',$array_ids[0]), $this->output_file ); + +?> \ No newline at end of file Added: trunk/linpha2/lib/classes/image/imagemagick/image.php =================================================================== --- trunk/linpha2/lib/classes/image/imagemagick/image.php (rev 0) +++ trunk/linpha2/lib/classes/image/imagemagick/image.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -0,0 +1,41 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Create thumbnails with imagemagick + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + + +$convert_str = $this->imagemagick_path.'convert'. + ' -quality '.$this->img_quality. + ' -size "'.$this->img_width.'x'.$this->img_height.'"'. // new size + ' '.linEscapeString($this->src_file).'[0]'. // [0] -> take only first frame!!! + ' -resize "'.$this->img_width.'x'.$this->img_height.'"'. // new size + ' +profile "*"'. // delete all profiles + ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images + ' '.linEscapeString($this->output_file); + +LinFilesys::linExec( $convert_str ); + + +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/image/imagemagick/thumbnail.php =================================================================== --- trunk/linpha2/lib/classes/image/imagemagick/thumbnail.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/image/imagemagick/thumbnail.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -27,42 +27,45 @@ /** * crop image + * first, scaled down image to $w x $h + * keep ratio: + * if image is wider than heigh, the height is $thumbsize, and width is "empty" + * (-> imagemagick will set the correct width to keep the ratio) + * after the resize, the image is too wide + * -> crop it */ -$ratio = $org_width/$org_height; -if($ratio==1) -{ - $x = 0; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; -} -elseif($ratio>1) -{ - $x = ( ($thumbsize*$ratio) - $thumbsize )/2; - $y = 0; - $w = ''; - $h = $thumbsize; -} -elseif($ratio<1) -{ - $y = ( $thumbsize - ($thumbsize*$ratio) )/2; - $x = 0; - $w = $thumbsize; - $h = ''; -} + $ratio = $this->org_width/$this->org_height; + if($ratio==1) + { + $x = 0; + $y = 0; + $w = $this->img_thumbsize; + $h = $this->img_thumbsize; + } + elseif($ratio>1) + { + $x = ( ($this->img_thumbsize*$ratio) - $this->img_thumbsize )/2; + $y = 0; + $w = ''; + $h = $this->img_thumbsize; + } + elseif($ratio<1) + { + $y = ( $this->img_thumbsize - ($this->img_thumbsize*$ratio) )/2; + $x = 0; + $w = $this->img_thumbsize; + $h = ''; + } -$q = 100; - - -$convert_str = 'convert'. - ' -quality '.$q. +$convert_str = $this->imagemagick_path.'convert'. + ' -quality '.$this->img_quality. ' -size '.$w.'x'.$h. // new size - ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop - ' '.lin_escape_string( $input ).'[0]'. // [0] -> take only first frame!!! + ' -crop '.$this->img_thumbsize.'x'.$this->img_thumbsize.'+'.$x.'+'.$y. // crop + ' '.linEscapeString( $this->src_file ).'[0]'. // [0] -> take only first frame!!! ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images - ' '.lin_escape_string( $output ); + ' '.linEscapeString( $this->output_file ); -exec( $convert_str ); +LinFilesys::linExec( $convert_str ); ?> \ No newline at end of file Added: trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php (rev 0) +++ trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -0,0 +1,75 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * Create folder thumbnail with imagemagick + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + + +/** + * create new tmp folder + */ + for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } + $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; + mkdir($tmp_folder,0700); + +/** + * run imagemagick + */ + for($i=1; list($key,$value) = each($array_ids) ; $i++) + { + LinFilesys::linExec("convert ". LinImage::getCachePath('thumb',$value) . " -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); + } + + LinFilesys::linExec("convert -size 180x180 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 ".$this->output_file); + + for($i=1; $i<=count($array_ids); $i++ ) + { + switch($i) + { + case 1: + LinFilesys::linExec("composite -geometry +10+10 ".$tmp_folder."/1.jpg ".$this->output_file." ".$this->output_file); + break; + case 2: + LinFilesys::linExec("composite -geometry +100+10 ".$tmp_folder."/2.jpg ".$this->output_file." ".$this->output_file); + break; + case 3: + LinFilesys::linExec("composite -geometry +10+100 ".$tmp_folder."/3.jpg ".$this->output_file." ".$this->output_file); + break; + case 4: + LinFilesys::linExec("composite -geometry +100+100 ".$tmp_folder."/4.jpg ".$this->output_file." ".$this->output_file); + break; + } + } + +/** + * delete tmp folder + */ + reset($array_ids); + for($i=1; list($key,$value) = each($array_ids) ; $i++) + { + unlink( $tmp_folder .'/'. $i . '.jpg' ); + } + rmdir($tmp_folder); + +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -26,7 +26,24 @@ class LinFilesys { + /** + * close session before exec() + * if exec() is called twice (like on the print preview), apache will hang + * on windows + * + * $_SESSION is still available after session_write_close! + * but we cannot edit it!!!! + */ +function linExec($str) +{ + session_write_close(); + + exec( $str ); +} + + +/** * if $path is absolute, input is just returned, if $path is relative, * the relative path starting from the linpha root directory is returned * Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -30,8 +30,8 @@ * If option tr_learn is set - all new entries will be autolearned. * @param string $text phrase/word to translate */ - function i18n($text) - { +function i18n($text) +{ global $translate; $tr_learn = true; //autolearn new language entries @@ -195,7 +195,7 @@ * @return string escape string * @package filesys */ -function lin_escape_string($str) +function linEscapeString($str) { if(getOS() == 'win') { @@ -259,4 +259,34 @@ return $str; } -?> +/** + * some functions to calculate the page rendering time + * this is very useful while trying to speed up LinPHA :-) + */ +function startTimer($string) +{ + global $timer; + $timer[$string]=getRenderTime(); +} + +/** + * some functions to calculate the page rendering time + * this is very useful while trying to speed up LinPHA :-) + */ +function stopTimer($string) +{ + global $timer; + return number_format(getRenderTime()-$timer[$string],4); +} + +/** + * some functions to calculate the page rendering time + * this is very useful while trying to speed up LinPHA :-) + */ +function getRenderTime() +{ + list ($usec, $sec)=explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -143,7 +143,7 @@ /** * $array_output[0] contains something like '2272 1704 JPEG' */ - exec ( $identify_path.' -format "%w %h %m" '.lin_escape_string($path), $array_output = Array(), $return_value = 0); + linExec ( $identify_path.' -format "%w %h %m" '.linEscapeString($path), $array_output = Array(), $return_value = 0); if($return_value == 0) // identify succeed { @@ -154,7 +154,7 @@ $g = explode( " ", $array_output[0] ); - $g[2] = linIdentify::convertImagetype($g[2],$path); + $g[2] = LinIdentify::convertImagetype($g[2],$path); } } } @@ -164,13 +164,13 @@ { if($g[2] == 15) { - if(linIdentify::convertImagetype($ext) == 1000) // 1000 = mpg, mpeg, mpe, ... + if(LinIdentify::convertImagetype($ext) == 1000) // 1000 = mpg, mpeg, mpe, ... { - $g[2] = linIdentify::convertImagetype('mpg'); // get imagetype of mpg + $g[2] = LinIdentify::convertImagetype('mpg'); // get imagetype of mpg }elseif($ext == 'mov'){ - $g[2] = linIdentify::convertImagetype('mov'); + $g[2] = LinIdentify::convertImagetype('mov'); }elseif($ext == 'mp4'){ - $g[2] = linIdentify::convertImagetype('mp4'); + $g[2] = LinIdentify::convertImagetype('mp4'); } } } @@ -181,10 +181,10 @@ */ if( !$g[2] ) { - $type = linIdentify::getImagetypeFromFilename($path); + $type = LinIdentify::getImagetypeFromFilename($path); if($type < 1000) { - $g[2] = linIdentify::convertImagetype('unsupported'); + $g[2] = LinIdentify::convertImagetype('unsupported'); } else { Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -27,15 +27,18 @@ class LinImage { +public $error_msg; - -private $id; +private $photo_id, $cached_id; private $img_type; private $mode; +private $image_tool; private $output_file; -private $src_file, $org_width, $org_height; - +private $src_file; +private $org_width, $org_height, $img_width, $img_height; +private $img_quality; + /** * constructor */ @@ -43,12 +46,172 @@ { } +/** + * set cached_id and output_file + * in image mode set also rotate, watermark, quality, ... + * and add an empty entry in the cache database + */ +function setCachedInfos() +{ + if($this->mode == 'thumb') + { + $this->cached_id = $this->photo_id; + $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); + } + elseif($this->mode == 'img') + { + /** + * check additional settings + */ + /** + * max_width and max_height + */ + if(isset($this->overrideSettings['max_width']) && isset($this->overrideSettings['max_height'])) + { + $this->max_width = $this->overrideSettings['max_width']; + $this->max_height = $this->overrideSettings['max_height']; + } + else + { + $this->max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_size']; + $this->max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_size']; + } + + /** + * rotate (printing, ...) + */ + if(isset($this->overrideSettings['rotate'])) + { + $this->rotate = $this->overrideSettings['rotate']; + } + else + { + $this->rotate = 0; + } + + /** + * watermark + */ + if(isset($this->overrideSettings['watermark'])) + { + $this->watermark = $this->overrideSettings['watermark']; + } + else + { + /** + * @todo place need_watermark() here + */ + $this->watermark = 0; + } + + /** + * quality + */ + if(isset($this->overrideSettings['quality'])) + { + $this->img_quality = intval($this->overrideSettings['quality']); // oh, do intval() for security, comes from $_GET and will be included in exec() commands + } + else + { + $this->img_quality = intval($GLOBALS['linpha']->sql->config->value['sys_style_image_quality']); + } + + /** + * in image mode this is done earlier, because we need already org_width and org_height + * to determine if image is cached or not + * in thumb mode this can only be done later, because there are also folders and videos + */ + if( ! $this->setSourceFileInformation() ) + { + return false; + } + + $array = $this->scaleToFit($this->org_width,$this->org_height,$this->max_width,$this->max_height); + $this->img_width = $array['w']; + $this->img_height = $array['h']; + + /** + * check if entry in linpha_photos_cache exists + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."photos_cache WHERE " . + "photo_id = '".$this->photo_id."' AND " . + "img_width = '".$this->img_width."' AND " . + "img_height = '".$this->img_height."' AND " . + "img_quality = '".$this->img_quality."' AND " . + "is_rotated = '".$this->rotate."' AND " . + "has_watermark = '".$this->watermark."'"); + + if(isset($data['id']) && !empty($data['id'])) + { + $this->cached_id = $data['id']; + $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); + } + else + { + /** + * insert an empty entry and get cached_id + * we will update correct values only if create cached image has been successfull + */ + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos_cache " . + "(photo_id) VALUES ('".$this->photo_id."')"); + $this->cached_id = $GLOBALS['linpha']->db->Insert_ID(); + $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); + + if(file_exists($this->output_file)) + { + /** + * o-oh, we're leaking old files in cache path, -> delete it + */ + unlink($this->output_file); + } + } + } + + +} + function setFileInformation() { /** - * check if already exists OR if forced + * check for valid id */ - $this->output_file = LinImage::getCachePath($this->mode,$this->id); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes( $this->photo_id )."'"); + + if($query->RecordCount() != 1) + { + $this->error_msg = "wrong id supplied!"; + return false; + } + + $data = $query->FetchRow(); + + if( ! LinSql::photoIsAllowed( $data['id'] ) ) + { + $this->error_msg = "not permitted!"; + return false; + } + + if($this->mode == 'img' && ! LinIdentify::isSupportedImage( $data['img_type'] ) ) + { + $this->error_msg = "only images possible!"; + return false; + } + + /** + * checke force parameter + */ + if( isset($_GET['force'] ) ) { + $this->force = true; + } else { + $this->force = false; + } + + $this->img_type = $data['img_type']; + $this->setCachedInfos(); + + /** + * check if file already exists OR if forced + */ if( file_exists( $this->output_file ) AND !$this->force ) { $this->isCached = true; @@ -64,7 +227,7 @@ { if( ! @mkdir( dirname($this->output_file) ) ) { - echo "Cannot create folder ".dirname($this->output_file)." check permissions!"; + $this->error_msg = "Cannot create folder ".dirname($this->output_file)." check permissions!"; return false; } } @@ -75,11 +238,12 @@ */ if($GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) { - $this->include_str = 'imagemagick'; + $this->image_tool = 'imagemagick'; + $this->imagemagick_path = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path']; } else { - $this->include_str = 'gdlib'; + $this->image_tool = 'gdlib'; } return true; @@ -92,7 +256,7 @@ */ if($this->img_type != 0 && $this->img_type != 9999999) { - $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id ); + $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->photo_id ); $album_dir = $GLOBALS['linpha']->sql->getPath('album'); $this->src_file = $album_dir .'/'. implode('/',$array_path); @@ -111,109 +275,81 @@ return true; } -function printFileToScreen() -{ - if(file_exists($this->output_file)) + +/** + * thumbnail functions + */ + function createThumbnail($photo_id) { - Header("Content-type: image/jpeg"); - readfile( $this->output_file ); - } -} + $this->mode = 'thumb'; + $this->photo_id = $photo_id; -function createFile($mode,$id,$img_type,$force) -{ - $this->id = $id; - $this->mode = $mode; - $this->force = $force; - $this->img_type = $img_type; - - if( ! $this->setFileInformation() ) - { - return false; - } - - if( ! $this->isCached) - { - if( ! $this->setSourceFileInformation() ) + if( ! $this->setFileInformation() ) { return false; } - - if($this->mode == 'thumb') + + if( ! $this->isCached ) { - $this->createThumbnail(); - } - elseif($this->mode == 'image') - { - $this->createImage(); - } - } + if( ! $this->setSourceFileInformation() ) + { + return false; + } + + /** + * image thumbnail + */ + if( LinIdentify::isSupportedImage( $this->img_type ) ) + { + + $this->createThumbnailImage(); + } + /** + * folder thumbnail + */ + elseif($this->img_type == 0) + { + if( ! $this->createThumbnailFolder() ) + { + $this->output_file = LINPHA_DIR.'/lib/graphics/subfolder_image.png'; + } + } + /** + * video thumbnail + */ + elseif( LinIdentify::isVideo( $this->img_type ) ) + { + $this->createThumbnailVideo(); + } - if( ! file_exists( $this->output_file ) ) - { - return false; - } - return true; -} - - -/** - * thumbnail functions - */ - function createThumbnail() - { - /** - * create folder thumbnail - */ - if($this->img_type == 0) - { - if( ! $this->createThumbnailFolder() ) + if( ! file_exists( $this->output_file ) ) { - $this->output_file = LINPHA_DIR.'/lib/graphics/subfolder_image.png'; + return false; } - } - elseif( linIdentify::isVideo( $this->img_type ) ) - { - $this->createThumbnailVideo(); - } - elseif( linIdentify::isSupportedImage( $this->img_type ) ) - { - - $this->createThumbnailImage(); - } + } + + return true; } function createThumbnailImage() { /** - * include the file which contains the imagemagick strings and exec() + * include the file which contains the imagemagick strings and exec() / gdlib instructions */ - $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - $q = 75; - $img_type = $this->img_type; - $input = $this->src_file; - $output = $this->output_file; - $org_height = $this->org_height; - $org_width = $this->org_width; + $this->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->img_quality = 75; - include(LINPHA_DIR.'/lib/include/image.'.$this->include_str.'.thumbnail.php'); + include(LINPHA_DIR.'/lib/classes/image/'.$this->image_tool.'/thumbnail.php'); } function createThumbnailFolder() { /** - * thumbnail icon only available with imagemagick - */ - if(! $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) - { - return false; - } - - /** * check if we have already some thumbnails in this folder + * and create array_ids which holds 4 image ids */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->id )."'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); $array_ids = Array(); $i=0; while($data = $query->FetchRow()) @@ -230,56 +366,17 @@ } } + /** + * no images found in this folder + */ if(count($array_ids) == 0) { return false; } - /** - * create new tmp folder - */ - for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } - $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; - mkdir($tmp_folder,0700); - - /** - * run imagemagick - */ - for($i=1; list($key,$value) = each($array_ids) ; $i++) - { - exec("convert ". LinImage::getCachePath('thumb',$value) . " -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); - } - - exec("convert -size 180x180 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 ".$this->output_file); - - for($i=1; $i<=count($array_ids); $i++ ) - { - switch($i) - { - case 1: - exec("composite -geometry +10+10 ".$tmp_folder."/1.jpg ".$this->output_file." ".$this->output_file); - break; - case 2: - exec("composite -geometry +100+10 ".$tmp_folder."/2.jpg ".$this->output_file." ".$this->output_file); - break; - case 3: - exec("composite -geometry +10+100 ".$tmp_folder."/3.jpg ".$this->output_file." ".$this->output_file); - break; - case 4: - exec("composite -geometry +100+100 ".$tmp_folder."/4.jpg ".$this->output_file." ".$this->output_file); - break; - } - } - - /** - * delete tmp folder - */ - reset($array_ids); - for($i=1; list($key,$value) = each($array_ids) ; $i++) - { - unlink( $tmp_folder .'/'. $i . '.jpg' ); - } - rmdir($tmp_folder); + include(LINPHA_DIR.'/lib/classes/image/'.$this->image_tool.'/thumbnail_folder.php'); + + return true; } function createThumbnailVideo() @@ -294,9 +391,66 @@ /** * image functions */ - function createImage() + function createImage($photo_id, $overrideSettings) { + $this->mode = 'img'; + $this->photo_id = $photo_id; + $this->overrideSettings = $overrideSettings; + + if( ! $this->setFileInformation() ) + { + return false; + } + + if( ! $this->isCached ) + { + /** + * include the create image script + */ + startTimer("createimage"); + include(LINPHA_DIR.'/lib/classes/image/'.$this->image_tool.'/image.php'); + $time = stopTimer("createimage") * 1000000; + + //echo $time; exit(); + + if( ! file_exists( $this->output_file ) ) + { + return false; + } + + /** + * finish cache entry + */ + $filesize = filesize( $this->output_file ); + if($filesize <= 0) + { + $this->error_msg = "Incorrect filesize (".$filesize.")"; + return false; + } + + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos_cache SET " . + "img_width = '".$this->img_width."', " . + "img_height = '".$this->img_height."', " . + "img_quality = '".$this->img_quality."', " . + "img_size = '".$filesize."', " . + "is_rotated = '".$this->rotate."', " . + "has_watermark = '".$this->watermark."', " . + "time_add = '".time()."', " . + "time_creating = '".$time."' " . + "WHERE id = '".$this->cached_id."'"); + } + else + { + /** + * got a cached copy, increment counter and time_use + */ + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos_cache " . + "SET hits = hits + 1, time_use = '".time()."' " . + "WHERE id = '".$this->cached_id."'"); + } + + return true; } @@ -346,7 +500,7 @@ * calculated from $src_h and $src_w * if $no_increase is set, the image is only decreased */ -function scaleToFit($src_h,$src_w,$dst_h,$dst_w,$no_increase) +function scaleToFit($src_w,$src_h,$dst_w,$dst_h,$no_increase=1) { if($src_h == 0 OR $src_w == 0) { @@ -376,14 +530,25 @@ $tmp_height = $dst_w / $img_relation; // calc the new height with screen width if ($tmp_height > $dst_h) { // we were wrong, it's still widther than screen -> $dst_h is decisive $array['w'] = round($img_relation*$dst_h); - $array['h'] = $dst_h; + $array['h'] = intval($dst_h); // oh, do intval() for security, comes from $_GET and will be included in exec() commands } else { - $array['w'] = $dst_w; + $array['w'] = intval($dst_w); // oh, do intval() for security, comes from $_GET and will be included in exec() commands $array['h'] = round($tmp_height); } } + return $array; } +/** + * send correct header and file + */ +function printFileToScreen() +{ + Header("Content-type: image/jpeg"); + readfile( $this->output_file ); +} + + } // end class linImage ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -25,17 +25,6 @@ if(!defined('LINPHA_DIR')) { exit(1); } -/** - * config stuff - * @todo make vars db entries - */ -$show_subfolders_separate = 0; -$nr_prev_next_thumbs = 3; -$array_tn_sizes = Array(50,75,100,150,200,250,300,400,500); -$array_nr_images = Array('auto',10,25,50,100,200,'all'); -$no_js_nr_rows = 3; -$no_js_nr_cols = 4; - class LinImgview { public $mode; // 'home', 'thumb', 'image' @@ -290,12 +279,14 @@ switch($this->mode) { case 'thumb': - - foreach($GLOBALS['array_tn_sizes'] AS $value) + $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); + foreach($array AS $value) { $array_tn_sizes_links[] = Array('name' => $value.' '.i18n("Pixel"), 'value' => 'javascript:set_tn_size('.$value.')'); } - foreach($GLOBALS['array_nr_images'] AS $value) + + $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); + foreach($array AS $value) { $array_nr_links[] = Array('name' => $value, 'value' =>"javascript:set_nr_images('".$value."')"); } @@ -473,7 +464,8 @@ { foreach($this->photos_filtered AS $key=>$value) { - if( ( $GLOBALS['show_subfolders_separate'] && $value['img_type'] != 0 ) OR !$GLOBALS['show_subfolders_separate'] ) + if( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) + OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) { $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; @@ -506,7 +498,7 @@ /** * prepare variables */ - $max_photos_per_page = $GLOBALS['no_js_nr_rows'] * $GLOBALS['no_js_nr_cols']; + $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows']; $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); if(isset($_GET['pn']) && $_GET['pn'] > 1) { @@ -532,8 +524,9 @@ foreach($this->photos_filtered AS $value) { - if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page - && ( ( $GLOBALS['show_subfolders_separate'] && $value['img_type'] != 0 ) OR !$GLOBALS['show_subfolders_separate'] ) ) + if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page // add images only while in current page + && ( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) // add images only if no folder because they are shown separate + OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) ) // add folders only if they are not shown separate { $this->photos_show[] = $value; $img_nr++; @@ -641,7 +634,7 @@ $GLOBALS['linpha']->template->output['navigation'] = ''; } - if($GLOBALS['show_subfolders_separate']) + if($GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate']) { foreach($this->photos_filtered AS $key=>$value) { @@ -1022,6 +1015,8 @@ */ function viewImgSetPrevNextThumb() { + $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; + /** * search current key in array */ @@ -1046,7 +1041,7 @@ * set prev thumbs */ $GLOBALS['linpha']->template->output['prev_thumb'] = ''; - for($i=$GLOBALS['nr_prev_next_thumbs']; $i > 0; $i--) + for($i=$nr_prev_next_thumbs; $i > 0; $i--) { if($this->current_key >= $i) { @@ -1058,7 +1053,7 @@ * set next thumbs */ $GLOBALS['linpha']->template->output['next_thumb'] = ''; - for($i=0; $i < $GLOBALS['nr_prev_next_thumbs']; $i++) + for($i=0; $i < $nr_prev_next_thumbs; $i++) { if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) { Modified: trunk/linpha2/lib/classes/thumbnails.js =================================================================== --- trunk/linpha2/lib/classes/thumbnails.js 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/classes/thumbnails.js 2006-04-09 19:46:00 UTC (rev 4498) @@ -55,10 +55,10 @@ } /** - * set correct main height + * set correct main height only if photos_per_page == auto */ - document.getElementById('main').style.height = linInnerHeight - document.getElementById('spacer_height')['offsetHeight']; - +// document.getElementById('main').style.height = linInnerHeight - document.getElementById('spacer_height')['offsetHeight']; + /** * calculate nr of photos per page (from select form) */ Modified: trunk/linpha2/lib/include/common.php =================================================================== --- trunk/linpha2/lib/include/common.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/include/common.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -11,6 +11,8 @@ * If you disable magic quotes, you must be very careful * to protect yourself from SQL injection attacks. * For details see http://www.php.net/manual/en/function.get-magic-quotes-gpc.php + * + * There is also a nice UnifyMagicQuotes() function in the getid3 library... * * @author flo */ @@ -56,5 +58,9 @@ { $_FILES[$key]['name'] = stripslashes($_FILES[$key]['name']); } + + $HTTP_GET_VARS = $_GET; + $HTTP_POST_VARS = $_POST; + $HTTP_COOKIE_VARS = $_COOKIE; } ?> Deleted: trunk/linpha2/lib/include/image.gdlib.thumbnail.php =================================================================== --- trunk/linpha2/lib/include/image.gdlib.thumbnail.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/include/image.gdlib.thumbnail.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -1,96 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* Florian Angehrn -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * Create thumbnails with gdlib - * @package Image - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * calculate crop - */ - $ratio = $org_width/$org_height; - if($ratio==1) - { - $x = 0; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; - } - elseif($ratio>1) - { - $x = ( $org_width - $org_height )/2; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; - $src_size = $org_height; - } - elseif($ratio<1) - { - $y = ( $org_height - $org_width )/2; - $x = 0; - $w = $thumbsize; - $h = $thumbsize; - - $src_size = $org_width; - } - - -/** - * create image resources - */ - switch($img_type) - { - case 1: $src_image = imagecreatefromgif($input); break; - case 2: $src_image = imagecreatefromjpeg($input); break; - case 3: $src_image = imagecreatefrompng($input); break; - default: return false;; - } - $scaled_image = imagecreatetruecolor($thumbsize, $thumbsize); - -/** - * resize and crop image - */ - imagecopyresized( - $scaled_image,$src_image, - 0,0, // int dstX, int dstY - $x,$y, // int srcX, int srcY - $w,$h, // int dstW, int dstH - $src_size,$src_size // int srcW, int srcH - ); - -/** - * destroy source image - */ - imagedestroy($src_image); - -/** - * save image - */ - imagejpeg($scaled_image,$output,$q); - -/** - * destroy scaled image - */ - imagedestroy($scaled_image); - -?> \ No newline at end of file Deleted: trunk/linpha2/lib/include/image.imagemagick.thumbnail.php =================================================================== --- trunk/linpha2/lib/include/image.imagemagick.thumbnail.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/lib/include/image.imagemagick.thumbnail.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -1,68 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* Florian Angehrn -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * Create thumbnails with imagemagick - * @package Image - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * crop image - */ -$ratio = $org_width/$org_height; -if($ratio==1) -{ - $x = 0; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; -} -elseif($ratio>1) -{ - $x = ( ($thumbsize*$ratio) - $thumbsize )/2; - $y = 0; - $w = ''; - $h = $thumbsize; -} -elseif($ratio<1) -{ - $y = ( $thumbsize - ($thumbsize*$ratio) )/2; - $x = 0; - $w = $thumbsize; - $h = ''; -} - -$q = 100; - - -$convert_str = 'convert'. - ' -quality '.$q. - ' -size '.$w.'x'.$h. // new size - ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop - ' '.lin_escape_string( $input ).'[0]'. // [0] -> take only first frame!!! - ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles - ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images - ' '.lin_escape_string( $output ); - -exec( $convert_str ); - -?> \ No newline at end of file Modified: trunk/linpha2/templates/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/css/global.css 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/templates/default/css/global.css 2006-04-09 19:46:00 UTC (rev 4498) @@ -132,10 +132,6 @@ /** * menu */ - #divmenu { - height: 40px; - } - #menu { margin-left: 50px; } Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-04-09 19:46:00 UTC (rev 4498) @@ -1,5 +1,5 @@ #main { - min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ + height: 85%; } /** @@ -27,8 +27,6 @@ width: 530px; height: 35px; margin-left: -265px; /* should be the half of 'width' */ - - /* border: 1px #000000 solid;*/ } .page_nr_divs { float: left; Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/templates/default/global.html.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -65,11 +65,6 @@ </div> <!-- menu --> -<!-- -need an outer div for the correct height, because elements in #menu are floated -and doesn't count to the this elements height ---> -<div id="divmenu"> <div id="menu"> <ul> <li><a href="./"><?php echo i18n("Home"); ?></a></li> @@ -126,7 +121,7 @@ </ul> <?php $GLOBALS['linpha']->template->printMenu("Admin","./admin/"); ?> </div> -</div> +<div style="clear: both;"></div> <!-- end menu --> <?php $GLOBALS['linpha']->template->includeFile('body'); ?> Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-04-09 15:45:06 UTC (rev 4497) +++ trunk/linpha2/templates/default/home.html.php 2006-04-09 19:46:00 UTC (rev 4498) @@ -3,68 +3,66 @@ <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/tl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> </div> -<div id="main"> - -<?php echo $GLOBALS['linpha']->template->output['welcome']; ?> -<br /> - -<!-- Random Images --> -<?php if( count($GLOBALS['linpha']->template->output['random_images']) > 0 ) { ?> - <hr /> - <h1><?php echo i18n("Random images"); ?></h1> - <?php - foreach($GLOBALS['linpha']->template->output['random_images'] AS $key=>$value) - { - ?> - <div class="div_random_img"> - <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' - . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="randomimage" /></a>'; ?> - <br /><br /> - </div> + <div id="main"> + + <?php echo $GLOBALS['linpha']->template->output['welcome']; ?> + <br /> + + <!-- Random Images --> + <?php if( count($GLOBALS['linpha']->template->output['random_images']) > 0 ) { ?> + <hr /> + <h1><?php echo i18n("Random images"); ?></h1> <?php + foreach($GLOBALS['linpha']->template->output['random_images'] AS $key=>$value) + { + ?> + <div class="div_random_img"> + <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' + . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="randomimage" /></a>'; ?> + <br /><br /> + </div> + <?php + } + ?> + <div style="clear: both;"></div> + <?php } ?> + + <!-- Browse by Date --> + <?php + if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate'] && + !empty($GLOBALS['linpha']->template->output['browse_by_date'])) { + echo "<hr />"; + echo i18n("Browse by Date").': '.$GLOBALS['linpha']->template->output['browse_by_date']; + echo "<br />"; } ?> - <div style="clear: both;"></div> -<?php } ?> - -<!-- Browse by Date --> -<?php -if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate'] && - !empty($GLOBALS['linpha']->template->output['browse_by_date'])) { - echo "<hr />"; - echo i18n("Browse by Date").': '.$GLOBALS['linpha']->template->output['browse_by_date']; - echo "<br />"; -} -?> - -<!-- Albums --> -<?php if($GLOBALS['linpha']->sql->config->value['sys_style_home_showalbums']) { ?> - <hr /> - <h1><?php echo i18n("Albums"); ?></h1> - <?php - foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) - { - ?> - <div class='div_folder'> - <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' - . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> - - <div class='div_folder_text'> - <h2><?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> - - <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> - - <br /> - <?php echo strftime("%x %X",$value['time_add']); ?> - - </div> - </div> + <!-- Albums --> + <?php if($GLOBALS['linpha']->sql->config->value['sys_style_home_showalbums']) { ?> + <hr /> + <h1><?php echo i18n("Albums"); ?></h1> + <?php - } -} -?> -</div> + foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) + { + ?> + <div class="div_folder"> + <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' + . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> + + <div class="div_folder_text"> + <h2><?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name... [truncated message content] |