linpha-cvs Mailing List for LinPHA PHP Photo Gallery (Page 5)
Status: Inactive
Brought to you by:
bzrudi
You can subscribe to this list here.
2006 |
Jan
|
Feb
(143) |
Mar
(104) |
Apr
(127) |
May
(20) |
Jun
(10) |
Jul
(28) |
Aug
(48) |
Sep
(55) |
Oct
(85) |
Nov
(57) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(41) |
Mar
(56) |
Apr
(8) |
May
(1) |
Jun
(9) |
Jul
(54) |
Aug
(24) |
Sep
(2) |
Oct
(14) |
Nov
(30) |
Dec
(7) |
2008 |
Jan
(48) |
Feb
(52) |
Mar
(18) |
Apr
(30) |
May
(4) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <fan...@us...> - 2008-02-07 20:22:40
|
Revision: 4855 http://linpha.svn.sourceforge.net/linpha/?rev=4855&view=rev Author: fangehrn Date: 2008-02-07 12:22:33 -0800 (Thu, 07 Feb 2008) Log Message: ----------- updated to adodb503 Modified Paths: -------------- trunk/linpha2/lib/adodb/adodb-active-record.inc.php trunk/linpha2/lib/adodb/adodb-csvlib.inc.php trunk/linpha2/lib/adodb/adodb-datadict.inc.php trunk/linpha2/lib/adodb/adodb-error.inc.php trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php trunk/linpha2/lib/adodb/adodb-errorpear.inc.php trunk/linpha2/lib/adodb/adodb-exceptions.inc.php trunk/linpha2/lib/adodb/adodb-iterator.inc.php trunk/linpha2/lib/adodb/adodb-lib.inc.php trunk/linpha2/lib/adodb/adodb-pager.inc.php trunk/linpha2/lib/adodb/adodb-pear.inc.php trunk/linpha2/lib/adodb/adodb-perf.inc.php trunk/linpha2/lib/adodb/adodb-php4.inc.php trunk/linpha2/lib/adodb/adodb-time.inc.php trunk/linpha2/lib/adodb/adodb-xmlschema.inc.php trunk/linpha2/lib/adodb/adodb-xmlschema03.inc.php trunk/linpha2/lib/adodb/adodb.inc.php trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php trunk/linpha2/lib/adodb/lang/adodb-ar.inc.php trunk/linpha2/lib/adodb/lang/adodb-bg.inc.php trunk/linpha2/lib/adodb/lang/adodb-bgutf8.inc.php trunk/linpha2/lib/adodb/lang/adodb-ca.inc.php trunk/linpha2/lib/adodb/lang/adodb-en.inc.php trunk/linpha2/lib/adodb/lang/adodb-pl.inc.php trunk/linpha2/lib/adodb/lang/adodb-pt-br.inc.php trunk/linpha2/lib/adodb/lang/adodb-ro.inc.php trunk/linpha2/lib/adodb/lang/adodb-uk1251.inc.php trunk/linpha2/lib/adodb/pivottable.inc.php trunk/linpha2/lib/adodb/rsfilter.inc.php trunk/linpha2/lib/adodb/server.php trunk/linpha2/lib/adodb/toexport.inc.php trunk/linpha2/lib/adodb/tohtml.inc.php trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php Added Paths: ----------- trunk/linpha2/lib/adodb/adodb-memcache.lib.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssql_n.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php trunk/linpha2/lib/adodb/lang/adodb_th.inc.php trunk/linpha2/lib/classes/adodb-exceptions.inc.php Removed Paths: ------------- trunk/linpha2/lib/adodb/adodb-time.zip Modified: trunk/linpha2/lib/adodb/adodb-active-record.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-active-record.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-active-record.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,7 +1,7 @@ <?php /* -@version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. +@version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Latest version is available at http://adodb.sourceforge.net Released under both BSD license and Lesser GPL library license. @@ -10,7 +10,7 @@ Active Record implementation. Superset of Zend Framework's. - Version 0.04 + Version 0.08 See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord for info on Ruby on Rails Active Record implementation @@ -18,11 +18,14 @@ global $_ADODB_ACTIVE_DBS; global $ADODB_ACTIVE_CACHESECS; // set to true to enable caching of metadata such as field info +global $ACTIVE_RECORD_SAFETY; // set to false to disable safety checks +global $ADODB_ACTIVE_DEFVALS; // use default values of table definition when creating new active record. // array of ADODB_Active_DB's, indexed by ADODB_Active_Record->_dbat $_ADODB_ACTIVE_DBS = array(); +$ACTIVE_RECORD_SAFETY = true; +$ADODB_ACTIVE_DEFVALS = false; - class ADODB_Active_DB { var $db; // ADOConnection var $tables; // assoc array of ADODB_Active_Table objects, indexed by tablename @@ -41,11 +44,16 @@ global $_ADODB_ACTIVE_DBS; foreach($_ADODB_ACTIVE_DBS as $k => $d) { - if ($d->db == $db) return $k; + if (PHP_VERSION >= 5) { + if ($d->db === $db) return $k; + } else { + if ($d->db->_connectionID === $db->_connectionID && $db->database == $d->db->database) + return $k; + } } $obj = new ADODB_Active_DB(); - $obj->db =& $db; + $obj->db = $db; $obj->tables = array(); $_ADODB_ACTIVE_DBS[] = $obj; @@ -63,16 +71,24 @@ var $_lasterr = false; // last error message var $_original = false; // the original values loaded or inserted, refreshed on update + static function UseDefaultValues($bool=null) + { + global $ADODB_ACTIVE_DEFVALS; + if (isset($bool)) $ADODB_ACTIVE_DEFVALS = $bool; + return $ADODB_ACTIVE_DEFVALS; + } + // should be static - function SetDatabaseAdapter(&$db) + static function SetDatabaseAdapter(&$db) { return ADODB_SetDatabaseAdapter($db); } - // php4 constructor - function ADODB_Active_Record($table = false, $pkeyarr=false, $db=false) + + public function __set($name, $value) { - ADODB_Active_Record::__construct($table,$pkeyarr,$db); + $name = str_replace(' ', '_', $name); + $this->$name = $value; } // php5 constructor @@ -102,6 +118,12 @@ $this->UpdateActiveTable($pkeyarr); } + function __wakeup() + { + $class = get_class($this); + new $class; + } + function _pluralize($table) { $ut = strtoupper($table); @@ -129,20 +151,26 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false) { global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS; - - $activedb =& $_ADODB_ACTIVE_DBS[$this->_dbat]; + global $ADODB_ACTIVE_DEFVALS; + $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat]; + $table = $this->_table; $tables = $activedb->tables; $tableat = $this->_tableat; if (!$forceUpdate && !empty($tables[$tableat])) { - $tobj =& $tables[$tableat]; - foreach($tobj->flds as $name => $fld) + + $tobj = $tables[$tableat]; + foreach($tobj->flds as $name => $fld) { + if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value)) + $this->$name = $fld->default_value; + else $this->$name = null; + } return; } - $db =& $activedb->db; + $db = $activedb->db; $fname = $ADODB_CACHE_DIR . '/adodb_' . $db->databaseType . '_active_'. $table . '.cache'; if (!$forceUpdate && $ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR && file_exists($fname)) { $fp = fopen($fname,'r'); @@ -191,7 +219,10 @@ case 0: foreach($cols as $name => $fldobj) { $name = strtolower($name); - $this->$name = null; + if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) + $this->$name = $fldobj->default_value; + else + $this->$name = null; $attr[$name] = $fldobj; } foreach($pkeys as $k => $name) { @@ -202,7 +233,11 @@ case 1: foreach($cols as $name => $fldobj) { $name = strtoupper($name); - $this->$name = null; + + if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) + $this->$name = $fldobj->default_value; + else + $this->$name = null; $attr[$name] = $fldobj; } @@ -212,12 +247,16 @@ break; default: foreach($cols as $name => $fldobj) { - $name = ($name); - $this->$name = null; + $name = ($fldobj->name); + + if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) + $this->$name = $fldobj->default_value; + else + $this->$name = null; $attr[$name] = $fldobj; } foreach($pkeys as $k => $name) { - $keys[$name] = ($name); + $keys[$name] = $cols[$name]->name; } break; } @@ -250,7 +289,7 @@ if ($this->_dbat < 0) $db = false; else { $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat]; - $db =& $activedb->db; + $db = $activedb->db; } if (function_exists('adodb_throw')) { @@ -274,8 +313,17 @@ return $this->_lasterr; } + function ErrorNo() + { + if ($this->_dbat < 0) return -9999; // no database connection... + $db = $this->DB(); + + return (int) $db->ErrorNo(); + } + + // retrieve ADOConnection from _ADODB_Active_DBs - function &DB() + function DB() { global $_ADODB_ACTIVE_DBS; @@ -285,24 +333,26 @@ return $false; } $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat]; - $db =& $activedb->db; + $db = $activedb->db; return $db; } // retrieve ADODB_Active_Table - function &TableInfo() + function TableInfo() { global $_ADODB_ACTIVE_DBS; $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat]; - $table =& $activedb->tables[$this->_tableat]; + $table = $activedb->tables[$this->_tableat]; return $table; } // set a numeric array (using natural table field ordering) as object properties function Set(&$row) { - $db =& $this->DB(); + global $ACTIVE_RECORD_SAFETY; + + $db = $this->DB(); if (!$row) { $this->_saved = false; @@ -311,18 +361,34 @@ $this->_saved = true; - $table =& $this->TableInfo(); - if (sizeof($table->flds) != sizeof($row)) { + $table = $this->TableInfo(); + if ($ACTIVE_RECORD_SAFETY && sizeof($table->flds) != sizeof($row)) { + # <AP> + $bad_size = TRUE; + if (sizeof($row) == 2 * sizeof($table->flds)) { + // Only keep string keys + $keys = array_filter(array_keys($row), 'is_string'); + if (sizeof($keys) == sizeof($table->flds)) + $bad_size = FALSE; + } + if ($bad_size) { $this->Error("Table structure of $this->_table has changed","Load"); return false; } - - $cnt = 0; + # </AP> + } + else + $keys = array_keys($row); + # <AP> + reset($keys); + $this->_original = array(); foreach($table->flds as $name=>$fld) { - $this->$name = $row[$cnt]; - $cnt += 1; + $value = $row[current($keys)]; + $this->$name = $value; + $this->_original[] = $value; + next($keys); } - $this->_original = $row; + # </AP> return true; } @@ -383,7 +449,7 @@ function Load($where,$bindarr=false) { - $db =& $this->DB(); if (!$db) return false; + $db = $this->DB(); if (!$db) return false; $this->_where = $where; $save = $db->SetFetchMode(ADODB_FETCH_NUM); @@ -405,9 +471,9 @@ // false on error function Insert() { - $db =& $this->DB(); if (!$db) return false; + $db = $this->DB(); if (!$db) return false; $cnt = 0; - $table =& $this->TableInfo(); + $table = $this->TableInfo(); $valarr = array(); $names = array(); @@ -455,8 +521,8 @@ function Delete() { - $db =& $this->DB(); if (!$db) return false; - $table =& $this->TableInfo(); + $db = $this->DB(); if (!$db) return false; + $table = $this->TableInfo(); $where = $this->GenWhere($db,$table); $sql = 'DELETE FROM '.$this->_table.' WHERE '.$where; @@ -466,10 +532,10 @@ } // returns an array of active record objects - function &Find($whereOrderBy,$bindarr=false,$pkeysArr=false) + function Find($whereOrderBy,$bindarr=false,$pkeysArr=false) { - $db =& $this->DB(); if (!$db || empty($this->_table)) return false; - $arr =& $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr); + $db = $this->DB(); if (!$db || empty($this->_table)) return false; + $arr = $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr); return $arr; } @@ -478,8 +544,8 @@ { global $ADODB_ASSOC_CASE; - $db =& $this->DB(); if (!$db) return false; - $table =& $this->TableInfo(); + $db = $this->DB(); if (!$db) return false; + $table = $this->TableInfo(); $pkey = $table->keys; @@ -509,7 +575,7 @@ if ($ADODB_ASSOC_CASE == 0) foreach($pkey as $k => $v) $pkey[$k] = strtolower($v); - elseif ($ADODB_ASSOC_CASE == 0) + elseif ($ADODB_ASSOC_CASE == 1) foreach($pkey as $k => $v) $pkey[$k] = strtoupper($v); @@ -530,7 +596,7 @@ } } - $this->_original =& $valarr; + $this->_original = $valarr; } return $ok; } @@ -538,8 +604,8 @@ // returns 0 on error, 1 on update, -1 if no change in data (no update) function Update() { - $db =& $this->DB(); if (!$db) return false; - $table =& $this->TableInfo(); + $db = $this->DB(); if (!$db) return false; + $table = $this->TableInfo(); $where = $this->GenWhere($db, $table); @@ -584,7 +650,7 @@ $sql = 'UPDATE '.$this->_table." SET ".implode(",",$pairs)." WHERE ".$where; $ok = $db->Execute($sql,$valarr); if ($ok) { - $this->_original =& $neworig; + $this->_original = $neworig; return 1; } return 0; @@ -592,7 +658,7 @@ function GetAttributeNames() { - $table =& $this->TableInfo(); + $table = $this->TableInfo(); if (!$table) return false; return array_keys($table->flds); } Modified: trunk/linpha2/lib/adodb/adodb-csvlib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-csvlib.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-csvlib.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -8,7 +8,7 @@ /* - V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. @@ -54,7 +54,7 @@ $line = "====1,$tt,$sql\n"; if ($rs->databaseType == 'array') { - $rows =& $rs->_array; + $rows = $rs->_array; } else { $rows = array(); while (!$rs->EOF) { @@ -64,7 +64,7 @@ } for($i=0; $i < $max; $i++) { - $o =& $rs->FetchField($i); + $o = $rs->FetchField($i); $flds[] = $o; } @@ -90,7 +90,7 @@ * error occurred in sql INSERT/UPDATE/DELETE, * empty recordset is returned */ - function &csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array') + function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array') { $false = false; $err = false; @@ -261,6 +261,7 @@ /** * Save a file $filename and its $contents (normally for caching) with file locking + * Returns true if ok, false if fopen/fwrite error, 0 if rename error (eg. file is locked) */ function adodb_write_file($filename, $contents,$debug=false) { @@ -280,25 +281,29 @@ $mtime = substr(str_replace(' ','_',microtime()),2); // getmypid() actually returns 0 on Win98 - never mind! $tmpname = $filename.uniqid($mtime).getmypid(); - if (!($fd = @fopen($tmpname,'a'))) return false; - $ok = ftruncate($fd,0); - if (!fwrite($fd,$contents)) $ok = false; + if (!($fd = @fopen($tmpname,'w'))) return false; + if (fwrite($fd,$contents)) $ok = true; + else $ok = false; fclose($fd); - chmod($tmpname,0644); - // the tricky moment - @unlink($filename); - if (!@rename($tmpname,$filename)) { - unlink($tmpname); - $ok = false; + + if ($ok) { + chmod($tmpname,0644); + // the tricky moment + @unlink($filename); + if (!@rename($tmpname,$filename)) { + unlink($tmpname); + $ok = 0; + } + if (!$ok) { + if ($debug) ADOConnection::outp( " Rename $tmpname ".($ok? 'ok' : 'failed')); + } } - if (!$ok) { - if ($debug) ADOConnection::outp( " Rename $tmpname ".($ok? 'ok' : 'failed')); - } return $ok; } if (!($fd = @fopen($filename, 'a'))) return false; if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) { - $ok = fwrite( $fd, $contents ); + if (fwrite( $fd, $contents )) $ok = true; + else $ok = false; fclose($fd); chmod($filename,0644); }else { Modified: trunk/linpha2/lib/adodb/adodb-datadict.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-datadict.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-datadict.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,7 +1,7 @@ <?php /** - V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -216,8 +216,115 @@ } function MetaType($t,$len=-1,$fieldobj=false) - { - return ADORecordSet::MetaType($t,$len,$fieldobj); + { + static $typeMap = array( + 'VARCHAR' => 'C', + 'VARCHAR2' => 'C', + 'CHAR' => 'C', + 'C' => 'C', + 'STRING' => 'C', + 'NCHAR' => 'C', + 'NVARCHAR' => 'C', + 'VARYING' => 'C', + 'BPCHAR' => 'C', + 'CHARACTER' => 'C', + 'INTERVAL' => 'C', # Postgres + 'MACADDR' => 'C', # postgres + ## + 'LONGCHAR' => 'X', + 'TEXT' => 'X', + 'NTEXT' => 'X', + 'M' => 'X', + 'X' => 'X', + 'CLOB' => 'X', + 'NCLOB' => 'X', + 'LVARCHAR' => 'X', + ## + 'BLOB' => 'B', + 'IMAGE' => 'B', + 'BINARY' => 'B', + 'VARBINARY' => 'B', + 'LONGBINARY' => 'B', + 'B' => 'B', + ## + 'YEAR' => 'D', // mysql + 'DATE' => 'D', + 'D' => 'D', + ## + 'UNIQUEIDENTIFIER' => 'C', # MS SQL Server + ## + 'TIME' => 'T', + 'TIMESTAMP' => 'T', + 'DATETIME' => 'T', + 'TIMESTAMPTZ' => 'T', + 'T' => 'T', + 'TIMESTAMP WITHOUT TIME ZONE' => 'T', // postgresql + ## + 'BOOL' => 'L', + 'BOOLEAN' => 'L', + 'BIT' => 'L', + 'L' => 'L', + ## + 'COUNTER' => 'R', + 'R' => 'R', + 'SERIAL' => 'R', // ifx + 'INT IDENTITY' => 'R', + ## + 'INT' => 'I', + 'INT2' => 'I', + 'INT4' => 'I', + 'INT8' => 'I', + 'INTEGER' => 'I', + 'INTEGER UNSIGNED' => 'I', + 'SHORT' => 'I', + 'TINYINT' => 'I', + 'SMALLINT' => 'I', + 'I' => 'I', + ## + 'LONG' => 'N', // interbase is numeric, oci8 is blob + 'BIGINT' => 'N', // this is bigger than PHP 32-bit integers + 'DECIMAL' => 'N', + 'DEC' => 'N', + 'REAL' => 'N', + 'DOUBLE' => 'N', + 'DOUBLE PRECISION' => 'N', + 'SMALLFLOAT' => 'N', + 'FLOAT' => 'N', + 'NUMBER' => 'N', + 'NUM' => 'N', + 'NUMERIC' => 'N', + 'MONEY' => 'N', + + ## informix 9.2 + 'SQLINT' => 'I', + 'SQLSERIAL' => 'I', + 'SQLSMINT' => 'I', + 'SQLSMFLOAT' => 'N', + 'SQLFLOAT' => 'N', + 'SQLMONEY' => 'N', + 'SQLDECIMAL' => 'N', + 'SQLDATE' => 'D', + 'SQLVCHAR' => 'C', + 'SQLCHAR' => 'C', + 'SQLDTIME' => 'T', + 'SQLINTERVAL' => 'N', + 'SQLBYTES' => 'B', + 'SQLTEXT' => 'X', + ## informix 10 + "SQLINT8" => 'I8', + "SQLSERIAL8" => 'I8', + "SQLNCHAR" => 'C', + "SQLNVCHAR" => 'C', + "SQLLVARCHAR" => 'X', + "SQLBOOL" => 'L' + ); + + if (!$this->connection->IsConnected()) { + $t = strtoupper($t); + if (isset($typeMap[$t])) return $typeMap[$t]; + return 'N'; + } + return $this->connection->MetaType($t,$len,$fieldobj); } function NameQuote($name = NULL,$allowBrackets=false) @@ -261,7 +368,7 @@ function ExecuteSQLArray($sql, $continueOnError = true) { $rez = 2; - $conn = &$this->connection; + $conn = $this->connection; $saved = $conn->debug; foreach($sql as $line) { @@ -277,7 +384,7 @@ return $rez; } - /* + /** Returns the actual type given a character code. C: varchar @@ -344,11 +451,19 @@ { $tabname = $this->TableName ($tabname); $sql = array(); - list($lines,$pkey) = $this->_GenFields($flds); + list($lines,$pkey,$idxs) = $this->_GenFields($flds); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' '; foreach($lines as $v) { $sql[] = $alter . $v; } + if (is_array($idxs)) { + foreach($idxs as $idx => $idxdef) { + $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); + $sql = array_merge($sql, $sql_idxs); + } + } return $sql; } @@ -367,11 +482,20 @@ { $tabname = $this->TableName ($tabname); $sql = array(); - list($lines,$pkey) = $this->_GenFields($flds); + list($lines,$pkey,$idxs) = $this->_GenFields($flds); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; foreach($lines as $v) { $sql[] = $alter . $v; } + if (is_array($idxs)) { + foreach($idxs as $idx => $idxdef) { + $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); + $sql = array_merge($sql, $sql_idxs); + } + + } return $sql; } @@ -389,7 +513,9 @@ { $tabname = $this->TableName ($tabname); if ($flds) { - list($lines,$pkey) = $this->_GenFields($flds); + list($lines,$pkey,$idxs) = $this->_GenFields($flds); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); list(,$first) = each($lines); list(,$column_def) = split("[\t ]+",$first,2); } @@ -429,22 +555,36 @@ return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname))); } - /* + /** Generate the SQL to create table. Returns an array of sql strings. */ - function CreateTableSQL($tabname, $flds, $tableoptions=false) + function CreateTableSQL($tabname, $flds, $tableoptions=array()) { - if (!$tableoptions) $tableoptions = array(); + list($lines,$pkey,$idxs) = $this->_GenFields($flds, true); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); - list($lines,$pkey) = $this->_GenFields($flds, true); - $taboptions = $this->_Options($tableoptions); $tabname = $this->TableName ($tabname); $sql = $this->_TableSQL($tabname,$lines,$pkey,$taboptions); + // ggiunta - 2006/10/12 - KLUDGE: + // if we are on autoincrement, and table options includes REPLACE, the + // autoincrement sequence has already been dropped on table creation sql, so + // we avoid passing REPLACE to trigger creation code. This prevents + // creating sql that double-drops the sequence + if ($this->autoIncrement && isset($taboptions['REPLACE'])) + unset($taboptions['REPLACE']); $tsql = $this->_Triggers($tabname,$taboptions); foreach($tsql as $s) $sql[] = $s; + if (is_array($idxs)) { + foreach($idxs as $idx => $idxdef) { + $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); + $sql = array_merge($sql, $sql_idxs); + } + } + return $sql; } @@ -460,6 +600,9 @@ $f1 = array(); foreach($f0 as $token) { switch (strtoupper($token)) { + case 'INDEX': + $f1['INDEX'] = ''; + // fall through intentionally case 'CONSTRAINT': case 'DEFAULT': $hasparam = $token; @@ -471,6 +614,20 @@ break; } } + // 'index' token without a name means single column index: name it after column + if (array_key_exists('INDEX', $f1) && $f1['INDEX'] == '') { + $f1['INDEX'] = isset($f0['NAME']) ? $f0['NAME'] : $f0[0]; + // check if column name used to create an index name was quoted + if (($f1['INDEX'][0] == '"' || $f1['INDEX'][0] == "'" || $f1['INDEX'][0] == "`") && + ($f1['INDEX'][0] == substr($f1['INDEX'], -1))) { + $f1['INDEX'] = $f1['INDEX'][0].'idx_'.substr($f1['INDEX'], 1, -1).$f1['INDEX'][0]; + } + else + $f1['INDEX'] = 'idx_'.$f1['INDEX']; + } + // reset it, so we don't get next field 1st token as INDEX... + $hasparam = false; + $flds[] = $f1; } @@ -478,9 +635,10 @@ $this->autoIncrement = false; $lines = array(); $pkey = array(); + $idxs = array(); foreach($flds as $fld) { $fld = _array_change_key_case($fld); - + $fname = false; $fdefault = false; $fautoinc = false; @@ -494,6 +652,8 @@ $fconstraint = false; $fnotnull = false; $funsigned = false; + $findex = ''; + $funiqueindex = false; //----------------- // Parse attributes @@ -519,7 +679,8 @@ case 'AUTOINCREMENT': case 'AUTO': $fautoinc = true; $fnotnull = true; break; case 'KEY': - case 'PRIMARY': $fprimary = $v; $fnotnull = true; break; + // a primary key col can be non unique in itself (if key spans many cols...) + case 'PRIMARY': $fprimary = $v; $fnotnull = true; /*$funiqueindex = true;*/ break; case 'DEF': case 'DEFAULT': $fdefault = $v; break; case 'NOTNULL': $fnotnull = $v; break; @@ -527,6 +688,9 @@ case 'DEFDATE': $fdefdate = $v; break; case 'DEFTIMESTAMP': $fdefts = $v; break; case 'CONSTRAINT': $fconstraint = $v; break; + // let INDEX keyword create a 'very standard' index on column + case 'INDEX': $findex = $v; break; + case 'UNIQUE': $funiqueindex = true; break; } //switch } // foreach $fld @@ -556,6 +720,27 @@ // some databases do not allow blobs to have defaults if ($ty == 'X') $fdefault = false; + // build list of indexes + if ($findex != '') { + if (array_key_exists($findex, $idxs)) { + $idxs[$findex]['cols'][] = ($fname); + if (in_array('UNIQUE', $idxs[$findex]['opts']) != $funiqueindex) { + if ($this->debug) ADOConnection::outp("Index $findex defined once UNIQUE and once not"); + } + if ($funiqueindex && !in_array('UNIQUE', $idxs[$findex]['opts'])) + $idxs[$findex]['opts'][] = 'UNIQUE'; + } + else + { + $idxs[$findex] = array(); + $idxs[$findex]['cols'] = array($fname); + if ($funiqueindex) + $idxs[$findex]['opts'] = array('UNIQUE'); + else + $idxs[$findex]['opts'] = array(); + } + } + //-------------------- // CONSTRUCT FIELD SQL if ($fdefts) { @@ -570,24 +755,47 @@ } else { $fdefault = $this->connection->sysDate; } - } else if ($fdefault !== false && !$fnoquote) + } else if ($fdefault !== false && !$fnoquote) { if ($ty == 'C' or $ty == 'X' or - ( substr($fdefault,0,1) != "'" && !is_numeric($fdefault))) + ( substr($fdefault,0,1) != "'" && !is_numeric($fdefault))) { + + if (($ty == 'D' || $ty == 'T') && strtolower($fdefault) != 'null') { + // convert default date into database-aware code + if ($ty == 'T') + { + $fdefault = $this->connection->DBTimeStamp($fdefault); + } + else + { + $fdefault = $this->connection->DBDate($fdefault); + } + } + else if (strlen($fdefault) != 1 && substr($fdefault,0,1) == ' ' && substr($fdefault,strlen($fdefault)-1) == ' ') $fdefault = trim($fdefault); else if (strtolower($fdefault) != 'null') $fdefault = $this->connection->qstr($fdefault); + } + } $suffix = $this->_CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned); + // add index creation if ($widespacing) $fname = str_pad($fname,24); + + // check for field names appearing twice + if (array_key_exists($fid, $lines)) { + ADOConnection::outp("Field '$fname' defined twice"); + } + $lines[$fid] = $fname.' '.$ftype.$suffix; if ($fautoinc) $this->autoIncrement = true; } // foreach $flds - return array($lines,$pkey); + return array($lines,$pkey,$idxs); } - /* + + /** GENERATE THE SIZE PART OF THE DATATYPE $ftype is the actual type $ty is the type defined originally in the DDL @@ -680,7 +888,7 @@ return $sql; } - /* + /** GENERATE TRIGGERS IF NEEDED used when table has auto-incrementing field that is emulated using triggers */ @@ -689,7 +897,7 @@ return array(); } - /* + /** Sanitize options, so that array elements with no keys are promoted to keys */ function _Options($opts) @@ -703,7 +911,7 @@ return $newopts; } - /* + /** "Florian Buzin [ easywe ]" <florian.buzin#easywe.de> This function changes/adds new fields to your table. You don't @@ -760,7 +968,9 @@ // already exists, alter table instead - list($lines,$pkey) = $this->_GenFields($flds); + list($lines,$pkey,$idxs) = $this->_GenFields($flds); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); $alter = 'ALTER TABLE ' . $this->TableName($tablename); $sql = array(); @@ -770,8 +980,13 @@ $flds = Lens_ParseArgs($v,','); // We are trying to change the size of the field, if not allowed, simply ignore the request. - if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4)) continue; - + // $flds[1] holds the type, $flds[2] holds the size -postnuke addition + if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4) + && (isset($flds[0][2]) && is_numeric($flds[0][2]))) { + if ($this->debug) ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1])); + #echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>"; + continue; + } $sql[] = $alter . $this->alterCol . ' ' . $v; } else { $sql[] = $alter . $this->addCol . ' ' . $v; Modified: trunk/linpha2/lib/adodb/adodb-error.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-error.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-error.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,6 +1,6 @@ <?php /** - * @version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. @@ -92,14 +92,14 @@ { if (is_numeric($errormsg)) return (integer) $errormsg; static $error_regexps = array( - '/(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$/' => DB_ERROR_NOSUCHTABLE, - '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/' => DB_ERROR_ALREADY_EXISTS, - '/divide by zero$/' => DB_ERROR_DIVZERO, - '/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER, - '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD, - '/parser: parse error at or near \"/' => DB_ERROR_SYNTAX, - '/referential integrity violation/' => DB_ERROR_CONSTRAINT, - '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/' + '/(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$/i' => DB_ERROR_NOSUCHTABLE, + '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/i' => DB_ERROR_ALREADY_EXISTS, + '/divide by zero$/i' => DB_ERROR_DIVZERO, + '/pg_atoi: error in .*: can\'t parse /i' => DB_ERROR_INVALID_NUMBER, + '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/i' => DB_ERROR_NOSUCHFIELD, + '/parser: parse error at or near \"/i' => DB_ERROR_SYNTAX, + '/referential integrity violation/i' => DB_ERROR_CONSTRAINT, + '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i' => DB_ERROR_ALREADY_EXISTS ); reset($error_regexps); Modified: trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,6 +1,6 @@ <?php /** - * @version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. @@ -30,7 +30,6 @@ */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { - echo 'hi'; if (error_reporting() == 0) return; // obey @ protocol switch($fn) { case 'EXECUTE': @@ -65,26 +64,16 @@ * and optionally, port number, of the socket receiving the debug information. * 3 message is appended to the file destination */ - /*if (defined('ADODB_ERROR_LOG_TYPE')) { + if (defined('ADODB_ERROR_LOG_TYPE')) { $t = date('Y-m-d H:i:s'); if (defined('ADODB_ERROR_LOG_DEST')) error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST); else error_log("($t) $s", ADODB_ERROR_LOG_TYPE); - }*/ + } - /** - * if adodb errorhandler is used, the function $db->ErrorMsg() does not work - * anymore - * -> output the error to screen - * -> no need anymore for : - * if(!$create) { echo $GLOBALS['db']->ErrorMsg().'<br />'; } - */ - echo $s.'<br />'; - - linLog(LOG_TYPE_DB,LOG_ERR,'db',$s); //print "<p>$s</p>"; - //trigger_error($s,ADODB_ERROR_HANDLER_TYPE); + trigger_error($s,ADODB_ERROR_HANDLER_TYPE); } ?> Modified: trunk/linpha2/lib/adodb/adodb-errorpear.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorpear.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-errorpear.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,6 +1,6 @@ <?php /** - * @version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -78,7 +78,7 @@ * Returns last PEAR_Error object. This error might be for an error that * occured several sql statements ago. */ -function &ADODB_PEAR_Error() +function ADODB_PEAR_Error() { global $ADODB_Last_PEAR_Error; Modified: trunk/linpha2/lib/adodb/adodb-exceptions.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-exceptions.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-exceptions.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,7 +1,7 @@ <?php /** - * @version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-iterator.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-iterator.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-iterator.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,7 +1,7 @@ <?php /* - V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -18,68 +18,13 @@ Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2 + + + Moved to adodb.inc.php to improve performance. */ - class ADODB_Iterator implements Iterator { - private $rs; - function __construct($rs) - { - $this->rs = $rs; - } - function rewind() - { - $this->rs->MoveFirst(); - } - function valid() - { - return !$this->rs->EOF; - } - - function key() - { - return $this->rs->_currentRow; - } - - function current() - { - return $this->rs->fields; - } - - function next() - { - $this->rs->MoveNext(); - } - - function __call($func, $params) - { - return call_user_func_array(array($this->rs, $func), $params); - } - - - function hasMore() - { - return !$this->rs->EOF; - } - -} - - -class ADODB_BASE_RS implements IteratorAggregate { - function getIterator() { - return new ADODB_Iterator($this); - } - - /* this is experimental - i don't really know what to return... */ - function __toString() - { - include_once(ADODB_DIR.'/toexport.inc.php'); - return _adodb_export($this,',',',',false,true); - } -} - - ?> \ No newline at end of file Modified: trunk/linpha2/lib/adodb/adodb-lib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-lib.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-lib.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,5 +1,8 @@ <?php + + + // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -7,7 +10,7 @@ $ADODB_INCLUDED_LIB = 1; /* - @version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim\@natsoft.com.my). All rights reserved. + @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim\@natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. @@ -16,7 +19,106 @@ Less commonly used functions are placed here to reduce size of adodb.inc.php. */ +function adodb_strip_order_by($sql) +{ + $rez = preg_match('/(\sORDER\s+BY\s[^)]*)/is',$sql,$arr); + if ($arr) + if (strpos($arr[0],'(') !== false) { + $at = strpos($sql,$arr[0]); + $cntin = 0; + for ($i=$at, $max=strlen($sql); $i < $max; $i++) { + $ch = $sql[$i]; + if ($ch == '(') { + $cntin += 1; + } elseif($ch == ')') { + $cntin -= 1; + if ($cntin < 0) { + break; + } + } + } + $sql = substr($sql,0,$at).substr($sql,$i); + } else + $sql = str_replace($arr[0], '', $sql); + return $sql; + } +if (false) { + $sql = 'select * from (select a from b order by a(b),b(c) desc)'; + $sql = '(select * from abc order by 1)'; + die(adodb_strip_order_by($sql)); +} + +function adodb_probetypes(&$array,&$types,$probe=8) +{ +// probe and guess the type + $types = array(); + if ($probe > sizeof($array)) $max = sizeof($array); + else $max = $probe; + + + for ($j=0;$j < $max; $j++) { + $row = $array[$j]; + if (!$row) break; + $i = -1; + foreach($row as $v) { + $i += 1; + + if (isset($types[$i]) && $types[$i]=='C') continue; + + //print " ($i ".$types[$i]. "$v) "; + $v = trim($v); + + if (!preg_match('/^[+-]{0,1}[0-9\.]+$/',$v)) { + $types[$i] = 'C'; // once C, always C + + continue; + } + if ($j == 0) { + // If empty string, we presume is character + // test for integer for 1st row only + // after that it is up to testing other rows to prove + // that it is not an integer + if (strlen($v) == 0) $types[$i] = 'C'; + if (strpos($v,'.') !== false) $types[$i] = 'N'; + else $types[$i] = 'I'; + continue; + } + + if (strpos($v,'.') !== false) $types[$i] = 'N'; + + } + } + +} + +function adodb_transpose(&$arr, &$newarr, &$hdr, &$fobjs) +{ + $oldX = sizeof(reset($arr)); + $oldY = sizeof($arr); + + if ($hdr) { + $startx = 1; + $hdr = array('Fields'); + for ($y = 0; $y < $oldY; $y++) { + $hdr[] = $arr[$y][0]; + } + } else + $startx = 0; + + for ($x = $startx; $x < $oldX; $x++) { + if ($fobjs) { + $o = $fobjs[$x]; + $newarr[] = array($o->name); + } else + $newarr[] = array(); + + for ($y = 0; $y < $oldY; $y++) { + $newarr[$x-$startx][] = $arr[$y][$x]; + } + } +} + // Force key to upper. // See also http://www.php.net/manual/en/function.array-change-key-case.php function _array_change_key_case($an_array) @@ -42,7 +144,10 @@ $keyCol = array($keyCol); } foreach($fieldArray as $k => $v) { - if ($autoQuote && !is_numeric($v) and strncmp($v,"'",1) !== 0 and strcasecmp($v,'null')!=0) { + if ($v === null) { + $v = 'NULL'; + $fieldArray[$k] = $v; + } else if ($autoQuote && !is_numeric($v) /*and strncmp($v,"'",1) !== 0 -- sql injection risk*/ and strcasecmp($v,$zthis->null2null)!=0) { $v = $zthis->qstr($v); $fieldArray[$k] = $v; } @@ -297,15 +402,15 @@ { $qryRecs = 0; - if (preg_match("/^\s*SELECT\s+DISTINCT/is", $sql) || + if (!empty($zthis->_nestedSQL) || preg_match("/^\s*SELECT\s+DISTINCT/is", $sql) || preg_match('/\s+GROUP\s+BY\s+/is',$sql) || preg_match('/\s+UNION\s+/is',$sql)) { + + $rewritesql = adodb_strip_order_by($sql); + // ok, has SELECT DISTINCT or GROUP BY so see if we can use a table alias // but this is only supported by oracle and postgresql... if ($zthis->dataProvider == 'oci8') { - - $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql); - // Allow Oracle hints to be used for query optimization, Chris Wrye if (preg_match('#/\\*+.*?\\*\\/#', $sql, $hint)) { $rewritesql = "SELECT ".$hint[0]." COUNT(*) FROM (".$rewritesql.")"; @@ -313,33 +418,22 @@ $rewritesql = "SELECT COUNT(*) FROM (".$rewritesql.")"; } else if (strncmp($zthis->databaseType,'postgres',8) == 0) { - - $info = $zthis->ServerInfo(); - if (substr($info['version'],0,3) >= 7.1) { // good till version 999 - $rewritesql = preg_replace('/(\sORDER\s+BY\s[^)]*)/is','',$sql); - $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_"; - } + $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_"; + } else { + $rewritesql = "SELECT COUNT(*) FROM ($rewritesql)"; } } else { // now replace SELECT ... FROM with SELECT COUNT(*) FROM $rewritesql = preg_replace( '/^\s*SELECT\s.*\s+FROM\s/Uis','SELECT COUNT(*) FROM ',$sql); - - - // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails // with mssql, access and postgresql. Also a good speedup optimization - skips sorting! // also see http://phplens.com/lens/lensforum/msgs.php?id=12752 - if (preg_match('/\sORDER\s+BY\s*\(/i',$rewritesql)) - $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$rewritesql); - else - $rewritesql = preg_replace('/(\sORDER\s+BY\s[^)]*)/is','',$rewritesql); + $rewritesql = adodb_strip_order_by($rewritesql); } - - if (isset($rewritesql) && $rewritesql != $sql) { - if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[1]; + if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0]; if ($secs2cache) { // we only use half the time of secs2cache because the count can quickly @@ -361,7 +455,7 @@ if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0]; - $rstest = &$zthis->Execute($rewritesql,$inputarr); + $rstest = $zthis->Execute($rewritesql,$inputarr); if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr); if ($rstest) { @@ -383,7 +477,6 @@ $rstest->Close(); if ($qryRecs == -1) return 0; } - return $qryRecs; } @@ -396,7 +489,7 @@ data will get out of synch. use CachePageExecute() only with tables that rarely change. */ -function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, +function _adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0) { $atfirstpage = false; @@ -432,9 +525,9 @@ // We get the data we want $offset = $nrows * ($page-1); if ($secs2cache > 0) - $rsreturn = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr); + $rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr); else - $rsreturn = &$zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache); + $rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache); // Before returning the RecordSet, we set the pagination properties we need @@ -450,7 +543,7 @@ } // Iv\xE1n Oliva version -function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0) +function _adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0) { $atfirstpage = false; @@ -466,16 +559,16 @@ // the last page number. $pagecounter = $page + 1; $pagecounteroffset = ($pagecounter * $nrows) - $nrows; - if ($secs2cache>0) $rstest = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr); - else $rstest = &$zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache); + if ($secs2cache>0) $rstest = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr); + else $rstest = $zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache); if ($rstest) { while ($rstest && $rstest->EOF && $pagecounter>0) { $atlastpage = true; $pagecounter--; $pagecounteroffset = $nrows * ($pagecounter - 1); $rstest->Close(); - if ($secs2cache>0) $rstest = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr); - else $rstest = &$zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache); + if ($secs2cache>0) $rstest = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr); + else $rstest = $zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache); } if ($rstest) $rstest->Close(); } @@ -487,8 +580,8 @@ // We get the data we want $offset = $nrows * ($page-1); - if ($secs2cache > 0) $rsreturn = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr); - else $rsreturn = &$zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache); + if ($secs2cache > 0) $rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr); + else $rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache); // Before returning the RecordSet, we set the pagination properties we need if ($rsreturn) { @@ -502,6 +595,8 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq=false,$force=2) { + global $ADODB_QUOTE_FIELDNAMES; + if (!$rs) { printf(ADODB_BAD_RS,'GetUpdateSQL'); return false; @@ -548,7 +643,7 @@ $type = 'C'; } - if (strpos($upperfname,' ') !== false) + if ((strpos($upperfname,' ') !== false) || ($ADODB_QUOTE_FIELDNAMES)) $fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote; else $fnameq = $upperfname; @@ -558,7 +653,7 @@ //********************************************************// if (is_null($arrFields[$upperfname]) || (empty($arrFields[$upperfname]) && strlen($arrFields[$upperfname]) == 0) - || $arrFields[$upperfname] === 'null' + || $arrFields[$upperfname] === $zthis->null2null ) { switch ($force) { @@ -580,7 +675,7 @@ default: case 3: //Set the value that was given in array, so you can give both null and empty values - if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === 'null') { + if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === $zthis->null2null) { $setFields .= $field->name . " = null, "; } else { $setFields .= _adodb_column_sql($zthis, 'U', $type, $upperfname, $fnameq,$arrFields, $magicq); @@ -662,6 +757,7 @@ static $cacheRS = false; static $cacheSig = 0; static $cacheCols; + global $ADODB_QUOTE_FIELDNAMES; $tableName = ''; $values = ''; @@ -680,10 +776,10 @@ //php can't do a $rsclass::MetaType() $rsclass = $zthis->rsPrefix.$zthis->databaseType; $recordSet = new $rsclass(-1,$zthis->fetchMode); - $recordSet->connection = &$zthis; + $recordSet->connection = $zthis; if (is_string($cacheRS) && $cacheRS == $rs) { - $columns =& $cacheCols; + $columns = $cacheCols; } else { $columns = $zthis->MetaColumns( $tableName ); $cacheRS = $tableName; @@ -691,7 +787,7 @@ } } else if (is_subclass_of($rs, 'adorecordset')) { if (isset($rs->insertSig) && is_integer($cacheRS) && $cacheRS == $rs->insertSig) { - $columns =& $cacheCols; + $columns = $cacheCols; } else { for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) $columns[] = $rs->FetchField($i); @@ -699,7 +795,7 @@ $cacheCols = $columns; $rs->insertSig = $cacheSig++; } - $recordSet =& $rs; + $recordSet = $rs; } else { printf(ADODB_BAD_RS,'GetInsertSQL'); @@ -711,7 +807,7 @@ $upperfname = strtoupper($field->name); if (adodb_key_exists($upperfname,$arrFields,$force)) { $bad = false; - if (strpos($upperfname,' ') !== false) + if ((strpos($upperfname,' ') !== false) || ($ADODB_QUOTE_FIELDNAMES)) $fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote; else $fnameq = $upperfname; @@ -721,7 +817,7 @@ /********************************************************/ if (is_null($arrFields[$upperfname]) || (empty($arrFields[$upperfname]) && strlen($arrFields[$upperfname]) == 0) - || $arrFields[$upperfname] === 'null' + || $arrFields[$upperfname] === $zthis->null2null ) { switch ($force) { @@ -743,7 +839,7 @@ default: case 3: //Set the value that was given in array, so you can give both null and empty values - if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === 'null') { + if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === $zthis->null2null) { $values .= "null, "; } else { $values .= _adodb_column_sql($zthis, 'I', $type, $upperfname, $fnameq, $arrFields, $magicq); @@ -904,9 +1000,21 @@ case "T": $val = $zthis->DBTimeStamp($arrFields[$fname]); break; + + case "N": + $val = $arrFields[$fname]; + if (!is_numeric($val)) $val = str_replace(',', '.', (float)$val); + break; + case "I": + case "R": + $val = $arrFields[$fname]; + if (!is_numeric($val)) $val = (integer) $val; + break; + + default: - $val = $arrFields[$fname]; + $val = str_replace(array("'"," ","("),"",$arrFields[$fname]); // basic sql injection defence if (empty($val)) $val = '0'; break; } @@ -926,7 +1034,8 @@ if ($inputarr) { foreach($inputarr as $kk=>$vv) { if (is_string($vv) && strlen($vv)>64) $vv = substr($vv,0,64).'...'; - $ss .= "($kk=>'$vv') "; + if (is_null($vv)) $ss .= "($kk=>null) "; + else $ss .= "($kk=>'$vv') "; } $ss = "[ $ss ]"; } Added: trunk/linpha2/lib/adodb/adodb-memcache.lib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-memcache.lib.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/adodb-memcache.lib.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -0,0 +1,118 @@ +<?php + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +global $ADODB_INCLUDED_MEMCACHE; +$ADODB_INCLUDED_MEMCACHE = 1; + +/* + + V4.90 8 June 2006 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. See License.txt. + Set tabs to 4 for best viewing. + + Latest version is available at http://adodb.sourceforge.net + +*/ + + function getmemcache($key,&$err, $timeout=0, $host, $port) + { + $false = false; + $err = false; + + if (!function_exists('memcache_pconnect')) { + $err = 'Memcache module PECL extension not found!'; + return $false; + } + + $memcache = new Memcache; + if (!@$memcache->pconnect($host, $port)) { + $err = 'Can\'t connect to memcache server on: '.$host.':'.$port; + return $false; + } + + $rs = $memcache->get($key); + if (!$rs) { + $err = 'Item with such key doesn\'t exists on the memcached server.'; + return $false; + } + + $tdiff = intval($rs->timeCreated+$timeout - time()); + if ($tdiff <= 2) { + switch($tdiff) { + case 2: + if ((rand() & 15) == 0) { + $err = "Timeout 2"; + return $false; + } + break; + case 1: + if ((rand() & 3) == 0) { + $err = "Timeout 1"; + return $false; + } + break; + default: + $err = "Timeout 0"; + return $false; + } + } + return $rs; + } + + function putmemcache($key, $rs, $host, $port, $compress, $debug=false) + { + $false = false; + $true = true; + + if (!function_exists('memcache_pconnect')) { + if ($debug) ADOConnection::outp(" Memcache module PECL extension not found!<br>\n"); + return $false; + } + + $memcache = new Memcache; + if (!@$memcache->pconnect($host, $port)) { + if ($debug) ADOConnection::outp(" Can't connect to memcache server on: $host:$port<br>\n"); + return $false; + } + + $rs->timeCreated = time(); + if (!$memcache->set($key, $rs, $compress, 0)) { + if ($debug) ADOConnection::outp(" Failed to save data at the memcached server!<br>\n"); + return $false; + } + return $true; + } + + function flushmemcache($key=false, $host, $port, $debug=false) + { + if (!function_exists('memcache_pconnect')) { + if ($debug) ADOConnection::outp(" Memcache module PECL extension not found!<br>\n"); + return; + } + + $memcache = new Memcache; + if (!@$memcache->pconnect($host, $port)) { + if ($debug) ADOConnection::outp(" Can't connect to memcache server on: $host:$port<br>\n"); + return; + } + + if ($key) { + if (!$memcache->delete($key)) { + if ($debug) ADOConnection::outp("CacheFlush: $key entery doesn't exist on memcached server!<br>\n"); + } else { + if ($debug) ADOConnection::outp("CacheFlush: $key entery flushed from memcached server!<br>\n"); + } + } else { + if (!$memcache->flush()) { + if ($debug) ADOConnection::outp("CacheFlush: Failure flushing all enteries from memcached server!<br>\n"); + } else { + if ($debug) ADOConnection::outp("CacheFlush: All enteries flushed from memcached server!<br>\n"); + } + } + return; + } +?> Modified: trunk/linpha2/lib/adodb/adodb-pager.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-pager.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-pager.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,7 +1,7 @@ <?php /* - V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -247,12 +247,12 @@ $savec = $ADODB_COUNTRECS; if ($this->db->pageExecuteCountRows) $ADODB_COUNTRECS = true; if ($this->cache) - $rs = &$this->db->CachePageExecute($this->cache,$this->sql,$rows,$this->curr_page); + $rs = $this->db->CachePageExecute($this->cache,$this->sql,$rows,$this->curr_page); else - $rs = &$this->db->PageExecute($this->sql,$rows,$this->curr_page); + $rs = $this->db->PageExecute($this->sql,$rows,$this->curr_page); $ADODB_COUNTRECS = $savec; - $this->rs = &$rs; + $this->rs = $rs; if (!$rs) { print "<h3>Query failed: $this->sql</h3>"; return; Modified: trunk/linpha2/lib/adodb/adodb-pear.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-pear.inc.php 2008-02-06 23:25:59 UTC (rev 4854) +++ trunk/linpha2/lib/adodb/adodb-pear.inc.php 2008-02-07 20:22:33 UTC (rev 4855) @@ -1,6 +1,6 @@ <?php /** - * @version V4.91 2 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. @@ -109,11 +109,11 @@ * error */ - function &factory($type) + function factory($type) { include_once(ADODB_DIR."/drivers/adodb-$type.inc.php"); - $obj = &NewADOConnection($type); - if (!is_object($obj)) $obj =& new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); + $obj = NewADOConnection($type); + if (!is_object($obj)) $obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); return $obj; } @@ -136,7 +136,7 @@ * @see DB::parseDSN * @see DB::isError */ - function &connect($dsn, $options = false) + function connect($dsn, $options = false) { if (is_array($dsn)) { $dsninfo = $dsn; @@ -157,9 +157,9 @@ @include_once("adodb-$type.inc.php"); } - @$obj =& NewADOConnection($type); + @$obj = NewADOConnection($type); if (!is_object($obj)) { - $obj =& new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); + $obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); return $obj; } if (is_array($options)) { Modified: trunk/linpha2/lib/adodb/adodb-perf.inc.php ===========================================... [truncated message content] |
From: bzrudi <bz...@us...> - 2008-02-07 15:07:06
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18178 Modified Files: ChangeLog Log Message: 1.3.3 RELEASE Index: ChangeLog =================================================================== RCS file: /cvsroot/linpha/linpha/ChangeLog,v retrieving revision 1.1275 retrieving revision 1.1276 diff -C2 -d -r1.1275 -r1.1276 *** ChangeLog 16 Jan 2008 17:49:12 -0000 1.1275 --- ChangeLog 7 Feb 2008 15:06:58 -0000 1.1276 *************** *** 1,2 **** --- 1,8 ---- + ############################################### + ### ### + ### LinPHA 1.3.3 RELEASE! ### + ### ### + ############################################### + 2008-01-17 Tadashi Jokagi <elf2000 AT users DOT sourceforge DOT net> * ftp/index.php: fixed xss and xss. |
From: <fan...@us...> - 2008-02-06 23:26:04
|
Revision: 4854 http://linpha.svn.sourceforge.net/linpha/?rev=4854&view=rev Author: fangehrn Date: 2008-02-06 15:25:59 -0800 (Wed, 06 Feb 2008) Log Message: ----------- 2008-02-06 flo * User - implemented "improved hash algorithm" for more secure password hashes * Cookies - added cookie settings Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/permissions_users.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/install/step11_finish.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/include/sql/sql.mysql.php trunk/linpha2/lib/include/sql/sql.oci8po.php trunk/linpha2/lib/include/sql/sql.postgres.php trunk/linpha2/lib/include/sql/sql.sqlite.php trunk/linpha2/reset_database.php trunk/linpha2/templates/default/fragments.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/ChangeLog 2008-02-06 23:25:59 UTC (rev 4854) @@ -4,6 +4,12 @@ * common.php/linpha.class.php - fixed LINPHA_CLIENT when linpha is installed not to a subfolder - secured $_SERVER['PATH_INFO'] + + * User + - implemented "improved hash algorithm" for more secure password hashes + + * Cookies + - added cookie settings 2008-02-04 flo * Some more work on the installer Modified: trunk/linpha2/admin/maintenance.php =================================================================== --- trunk/linpha2/admin/maintenance.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/maintenance.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -1,25 +1,25 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset($cat2)) -{ - $cat2 = 'import'; -} - -$array_menu = array( - 'import' => array('name' => i18n("Import"), 'link' => 'maintenance_import'), - 'db' => array('name' => i18n("Database"), 'link' => 'maintenance_db'), -); - -LinAdmin::printAdminMenu($array_menu,$cat2); - -switch($cat2) -{ - case 'import': - include_once(LINPHA_DIR.'/admin/maintenance_import.php'); - break; - case 'db': - include_once(LINPHA_DIR.'/admin/maintenance_db.php'); - break; -} -?> +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'import'; +} + +$array_menu = array( + 'import' => array('name' => i18n("Import"), 'link' => 'maintenance_import'), + 'db' => array('name' => i18n("Database"), 'link' => 'maintenance_db'), +); + +LinAdmin::printAdminMenu($array_menu,$cat2); + +switch($cat2) +{ + case 'import': + include_once(LINPHA_DIR.'/admin/maintenance_import.php'); + break; + case 'db': + include_once(LINPHA_DIR.'/admin/maintenance_db.php'); + break; +} +?> Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/metadata_define.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -431,10 +431,10 @@ { obj_from.selectedIndex = obj_from.selectedIndex - 1; } - else if( old_index > obj_from.length -1 ) - { - obj_from.selectedIndex = obj_from.length -1; - } + else if( old_index > obj_from.length -1 ) + { + obj_from.selectedIndex = obj_from.length -1; + } else { obj_from.selectedIndex = old_index; Modified: trunk/linpha2/admin/metadata_define_post.php =================================================================== --- trunk/linpha2/admin/metadata_define_post.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/metadata_define_post.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -1,145 +1,145 @@ -<?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. -*/ - -/** - * @package admin - * @subpackage MetaData - * - * For a description of the table structure, flags, etc. consult the developper - * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -switch($_POST['cmd']) -{ -case 'update_builtin': - - foreach($_POST['builtin'] AS $key=>$value) - { - if($value) { - $flag = 5; - } else { - $flag = 6; - } - - $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . - "flags = '".$flag."' ". - "WHERE id = '".LinSql::linAddslashes($key)."'"); - } - - break; - -case 'add_new': - /** - * check for duplicates with the same name - */ - $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_fields (name, field_type, flags) " . - "VALUES ('".LinSql::linAddslashes($_POST['new_name'])."', '".LinSql::linAddslashes($_POST['new_type'])."', '7') "); - break; - -case 'change_field': - - if(LinSql::linAddslashes($_POST['builtin'][$_POST['id']])) { - $flag = 7; - } else { - $flag = 8; - } - - $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . - "name = '".LinSql::linAddslashes($_POST['new_name'])."', ". - "flags = '".$flag."' ". - "WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); - break; - -case 'delete': - ?> - <h3>Delete selected field</h3> - Really sure? all will be lost... - <form action="./?cat=metadata_define_own" method="POST"> - <input type="hidden" name="cmd" value="do_delete" /> - <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> - <input type="submit" name="delete" value="delete" /> - <a href="./?cat=metadata_define_own">Cancel</a> - </form> - <br /><br /> - <?php - break; - -case 'do_delete': - $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_fields WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); - break; - -case 'add_new_category': - if(isset($_POST['isprivate'])) { - $isprivate = 1; - } else { - $isprivate = 0; - } - $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_category (field_id, name, isprivate) VALUES (" . - "'".LinSql::linAddslashes($_POST['field_id'])."'," . - "'".LinSql::linAddslashes($_POST['new_name'])."'," . - "'".$isprivate."')"); - - break; - -case 'mod_category': - if(isset($_POST['isprivate'])) { - $isprivate = 1; - } else { - $isprivate = 0; - } - - $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_category SET " . - "name = '".LinSql::linAddslashes($_POST['new_name'])."', ". - "isprivate = '".$isprivate."' ". - "WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); - - break; - -case 'delete_category': - $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_category WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); - break; - -case 'update_config_metadata': - $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['metadata_config_enable']); - $linpha->sql->config->reloadConfig(); - break; - -case 'create_metadata_table': - if( ! isset($_POST['selected_fields'])) { - $_POST['selected_fields'] = Array(); - } - if(isset($cat3)) { - if(LIN_DB_TYPE == "mysql") { - $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_$cat3"); - } else { - @$linpha->db->Execute("DROP TABLE ".LIN_PREFIX."meta_$cat3"); - } - $linpha->db->Execute(LinMetaData::createMetaDataTable( $_POST['selected_fields'], $cat3)); - } - break; - -default: - echo i18n("FATAL: Unknown POST Request"); - exit(); - break; -} -?> +<?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. +*/ + +/** + * @package admin + * @subpackage MetaData + * + * For a description of the table structure, flags, etc. consult the developper + * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +switch($_POST['cmd']) +{ +case 'update_builtin': + + foreach($_POST['builtin'] AS $key=>$value) + { + if($value) { + $flag = 5; + } else { + $flag = 6; + } + + $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . + "flags = '".$flag."' ". + "WHERE id = '".LinSql::linAddslashes($key)."'"); + } + + break; + +case 'add_new': + /** + * check for duplicates with the same name + */ + $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_fields (name, field_type, flags) " . + "VALUES ('".LinSql::linAddslashes($_POST['new_name'])."', '".LinSql::linAddslashes($_POST['new_type'])."', '7') "); + break; + +case 'change_field': + + if(LinSql::linAddslashes($_POST['builtin'][$_POST['id']])) { + $flag = 7; + } else { + $flag = 8; + } + + $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . + "name = '".LinSql::linAddslashes($_POST['new_name'])."', ". + "flags = '".$flag."' ". + "WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); + break; + +case 'delete': + ?> + <h3>Delete selected field</h3> + Really sure? all will be lost... + <form action="./?cat=metadata_define_own" method="POST"> + <input type="hidden" name="cmd" value="do_delete" /> + <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + <a href="./?cat=metadata_define_own">Cancel</a> + </form> + <br /><br /> + <?php + break; + +case 'do_delete': + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_fields WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); + break; + +case 'add_new_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_category (field_id, name, isprivate) VALUES (" . + "'".LinSql::linAddslashes($_POST['field_id'])."'," . + "'".LinSql::linAddslashes($_POST['new_name'])."'," . + "'".$isprivate."')"); + + break; + +case 'mod_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + + $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_category SET " . + "name = '".LinSql::linAddslashes($_POST['new_name'])."', ". + "isprivate = '".$isprivate."' ". + "WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); + + break; + +case 'delete_category': + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_category WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); + break; + +case 'update_config_metadata': + $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['metadata_config_enable']); + $linpha->sql->config->reloadConfig(); + break; + +case 'create_metadata_table': + if( ! isset($_POST['selected_fields'])) { + $_POST['selected_fields'] = Array(); + } + if(isset($cat3)) { + if(LIN_DB_TYPE == "mysql") { + $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_$cat3"); + } else { + @$linpha->db->Execute("DROP TABLE ".LIN_PREFIX."meta_$cat3"); + } + $linpha->db->Execute(LinMetaData::createMetaDataTable( $_POST['selected_fields'], $cat3)); + } + break; + +default: + echo i18n("FATAL: Unknown POST Request"); + exit(); + break; +} +?> Modified: trunk/linpha2/admin/permissions_users.php =================================================================== --- trunk/linpha2/admin/permissions_users.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/permissions_users.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -52,8 +52,7 @@ { $sql_str_new_password = ""; } else { - $md5_pass = md5($_POST['mod_user_pass']); - $sql_str_new_password = "password='".$md5_pass."', "; + $sql_str_new_password = "password='".$GLOBALS['linpha']->sql->getPWHash($_POST['mod_user_pass'])."', "; } $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."users SET ". @@ -62,6 +61,8 @@ $sql_str_new_password. "user_email='".LinSql::linAddslashes($_POST['mod_user_mail'])."' ". "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + + unset($sql_str_new_password, $_POST['mod_user_pass'], $_REQUEST['mod_user_pass']); /** * if current account is changed update session variables and login cookie @@ -73,7 +74,7 @@ /** * does not work, because headers are already sent - * + * @TODO if(isset($_COOKIE['linpha_userid']) && isset($_COOKIE['linpha_password']) && isset($md5_pass)) @@ -117,8 +118,11 @@ $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."users " . "(username, password, user_email, display_name) ". "VALUES " . - "('".LinSql::linAddslashes($_POST['new_user_name'])."', '".md5($_POST['new_user_pass'])."', ". + "('".LinSql::linAddslashes($_POST['new_user_name'])."', '".$GLOBALS['linpha']->sql->getPWHash($_POST['new_user_pass'])."', ". "'".LinSql::linAddslashes($_POST['new_user_mail'])."', '".LinSql::linAddslashes($_POST['new_user_fullname'])."')"); + + unset($_POST['new_user_pass'], $_REQUEST['new_user_pass']); + break; } } Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -1,136 +1,136 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset($cat3)) -{ - $cat3 = 'enable'; -} - -$arrPlugins = LinAdmin::getPlugins(); - -/** - * save settings before showing menu - */ - if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - foreach($arrPlugins as $value) - { - $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; - } - - /** - * create database tables and insert config data if necessary - */ - foreach($arrPlugins as $value) // go through all plugins - { - // only if we enabled the plugin now and it didn't existed before - if( isset($_POST['plugins_'.$value.'_enable']) - && $_POST['plugins_'.$value.'_enable']=='1' - && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) - { - $str1 = i18n("Enabling plugin \"%s\""); - linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); - - /** - * create database tables - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.'.LIN_DB_TYPE.'.php'; - if( file_exists($includeFile) ) - { - $sql_tables = array(); - include($includeFile); - - linSysLog(i18n("Creating tables")); - foreach($sql_tables as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - /** - * insert config data - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; - if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) - { - $sql_queries = array(); - include($includeFile); - - linSysLog(i18n("Insert config data")); - foreach($sql_queries as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - } - } - - // set plugins_*_enable to '1' - $LinAdmin->saveConfig($arrPluginsFullName); - } - -/** - * show menu - */ -$array_menu = array( - 'enable' => array('name' => i18n("Enable/Disable Plugins"), 'link' => 'settings_plugins_enable'), -); -foreach( $arrPlugins as $key=>$value) -{ - if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) - && $LinAdmin->option_value_system['plugins_'.$value.'_enable'] == '1' - ) - { - $array_menu[$value] = array( - 'name' => $LinAdmin->description_array['plugins_'.$value], - 'link' => 'settings_plugins_'.$value - ); - } -} - -LinAdmin::printAdminMenu($array_menu,$cat3); -?> - -<form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=settings_plugins_'.$cat3; ?>"> -<?php -if($cat3=='enable') -{ - foreach( $arrPlugins as $key=>$value) - { - if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable'])) { - $optionValue = $LinAdmin->option_value_system['plugins_'.$value.'_enable']; - } else { - $optionValue = '0'; - } - - $LinAdmin->printAdminConfig( - 'radio', - $LinAdmin->getDescriptionByOptionName('plugins_'.$value), - 'plugins_'.$value.'_enable', - $optionValue - ); - } -} -elseif(in_array($cat3,$arrPlugins)) // prevent including evil file -{ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$cat3.'/settings.'.$cat3.'.php'; - if( file_exists($includeFile)) - { - include_once($includeFile); - } -} - +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat3)) +{ + $cat3 = 'enable'; +} + +$arrPlugins = LinAdmin::getPlugins(); + +/** + * save settings before showing menu + */ + if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + foreach($arrPlugins as $value) + { + $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; + } + + /** + * create database tables and insert config data if necessary + */ + foreach($arrPlugins as $value) // go through all plugins + { + // only if we enabled the plugin now and it didn't existed before + if( isset($_POST['plugins_'.$value.'_enable']) + && $_POST['plugins_'.$value.'_enable']=='1' + && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) + { + $str1 = i18n("Enabling plugin \"%s\""); + linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); + + /** + * create database tables + */ + $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.'.LIN_DB_TYPE.'.php'; + if( file_exists($includeFile) ) + { + $sql_tables = array(); + include($includeFile); + + linSysLog(i18n("Creating tables")); + foreach($sql_tables as $sqlStr) + { + $result = $linpha->db->Execute($sqlStr); + + // it the table already exists, we get automatically a nice message like + // "Table 'linpha2_plugins_maps_markers' already exists" + if(!$result) { + linSysLog($linpha->db->ErrorMsg()); + } + } + } + + /** + * insert config data + */ + $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; + if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) + { + $sql_queries = array(); + include($includeFile); + + linSysLog(i18n("Insert config data")); + foreach($sql_queries as $sqlStr) + { + $result = $linpha->db->Execute($sqlStr); + + // it the table already exists, we get automatically a nice message like + // "Table 'linpha2_plugins_maps_markers' already exists" + if(!$result) { + linSysLog($linpha->db->ErrorMsg()); + } + } + } + + } + } + + // set plugins_*_enable to '1' + $LinAdmin->saveConfig($arrPluginsFullName); + } + +/** + * show menu + */ +$array_menu = array( + 'enable' => array('name' => i18n("Enable/Disable Plugins"), 'link' => 'settings_plugins_enable'), +); +foreach( $arrPlugins as $key=>$value) +{ + if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) + && $LinAdmin->option_value_system['plugins_'.$value.'_enable'] == '1' + ) + { + $array_menu[$value] = array( + 'name' => $LinAdmin->description_array['plugins_'.$value], + 'link' => 'settings_plugins_'.$value + ); + } +} + +LinAdmin::printAdminMenu($array_menu,$cat3); +?> + +<form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=settings_plugins_'.$cat3; ?>"> +<?php +if($cat3=='enable') +{ + foreach( $arrPlugins as $key=>$value) + { + if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable'])) { + $optionValue = $LinAdmin->option_value_system['plugins_'.$value.'_enable']; + } else { + $optionValue = '0'; + } + + $LinAdmin->printAdminConfig( + 'radio', + $LinAdmin->getDescriptionByOptionName('plugins_'.$value), + 'plugins_'.$value.'_enable', + $optionValue + ); + } +} +elseif(in_array($cat3,$arrPlugins)) // prevent including evil file +{ + $includeFile = LINPHA_DIR.'/lib/plugins/'.$cat3.'/settings.'.$cat3.'.php'; + if( file_exists($includeFile)) + { + include_once($includeFile); + } +} + ?> \ No newline at end of file Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/docs/dev/TODO.txt 2008-02-06 23:25:59 UTC (rev 4854) @@ -29,11 +29,6 @@ - compress javascripts (prototype and scriptaculous) they are now nearly 200KB big -- php session - limit the session cookie not only to domain, but also to full url path - we cannot use the same session in localhost/linpha1.0 and localhost/linpha2.0 - -> session_set_cookie_params() - ## Big Todos - Switch to strict mode @@ -115,6 +110,12 @@ DONE ############################################################################ +- php session + limit the session cookie not only to domain, but also to full url path + we cannot use the same session in localhost/linpha1.0 and localhost/linpha2.0 + -> session_set_cookie_params() + + - how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? i suggest using define('LIN_STR_SUBMIT', "Submit"); in the language file and use it this way: echo i18n( LIN_STR_SUBMIT ); Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/install/step11_finish.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -57,8 +57,11 @@ echo "Adding linpha admin user... "; $result = $linpha->db->Execute("INSERT INTO ".LIN_PREFIX."users (username, password, user_email) VALUES (" . "'".LinSql::linAddslashes($_POST['admin_name'])."', " . - "'".md5($_POST['admin_pass'])."', " . + "'".$linpha->sql->getPWHash($_POST['admin_pass'])."', " . "'".LinSql::linAddslashes($_POST['admin_email'])."')"); + + unset($_POST['admin_pass'],$_REQUEST['admin_pass']); + if(!$result) { echo failed_msg(); Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -314,7 +314,7 @@ 'sys_style_image_height', 'sys_style_image_nrprevnextthumbs', - 'sys_user_autologin' + 'sys_session_autologin' ); }*/ @@ -346,7 +346,8 @@ 'sys_style_home_usedefaultwelcometext', 'sys_style_thumb_showsubfoldersseparate', 'sys_style_image_useeffects', - 'sys_user_autologin', + 'sys_session_autologin', + 'sys_session_ipcheck', 'plugins_filemanager_enable', 'plugins_guestbook_enable', Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -213,7 +213,7 @@ */ $GLOBALS['linpha']->template = new linTemplate(); global $linTpl; - $linTpl = $GLOBALS['linpha']->template; + $linTpl = $GLOBALS['linpha']->template; // this is just a reference linIncludeLanguageFile(); @@ -263,34 +263,60 @@ */ if (session_id() == '') { - session_name('linpha2'); + if (empty($GLOBALS['linpha']->sql->config->value['sys_session_name'])) { + session_name('linpha2'); + } else { + session_name($GLOBALS['linpha']->sql->config->value['sys_session_name']); + } + + if (!empty($GLOBALS['linpha']->sql->config->value['sys_session_cookiepath'])) { + switch($GLOBALS['linpha']->sql->config->value['sys_session_cookiepath']) + { + case 'unchanged': + break; + case 'auto': + $path = LINPHA_LINK; + if (substr($path,strlen($path)-2)=='/?') { + $path = substr($path,0,strlen($path)-2); + } + session_set_cookie_params(0,$path); + break; + case 'root': + case 'top': + session_set_cookie_params(0,'/'); + break; + default: + session_set_cookie_params(0,$GLOBALS['linpha']->sql->config->value['sys_session_cookiepath']); + break; + } + } + session_start(); } /** * 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']!="") + if ($this->config->value['sys_session_autologin'] + && !isset($_SESSION['user_name']) + && isset($_COOKIE['linpha_userid']) && $_COOKIE['linpha_userid']!="" + && isset($_COOKIE['linpha_password']) && $_COOKIE['linpha_password']!="") + { + $query = $GLOBALS['linpha']->db->Execute("SELECT username, password, display_name FROM ".LIN_PREFIX."users ". + "WHERE id = '".LinSql::linAddslashes($_COOKIE['linpha_userid'])."' ". + "AND password = '".LinSql::linAddslashes($_COOKIE['linpha_password'])."'"); + if($data = $query->FetchRow()) { - $query = $GLOBALS['linpha']->db->Execute("SELECT username, display_name FROM ".LIN_PREFIX."users ". - "WHERE id = '".LinSql::linAddslashes($_COOKIE['linpha_userid'])."' ". - "AND password = '".LinSql::linAddslashes($_COOKIE['linpha_password'])."'"); - if($data = $query->FetchRow()) - { - linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$_POST['username'].': successfully logged in.'); - linSysLog(i18n("Successfully Logged In!")); - - $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 - } + linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$data['username'].': successfully logged in (cookie).'); + linSysLog(i18n("Successfully Logged In!")); + + $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 + } } /** @@ -331,10 +357,12 @@ /** * get user from DB */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id, username, password, id, display_name FROM ".LIN_PREFIX."users ". + $data = $GLOBALS['linpha']->db->GetRow("SELECT id, username, password, display_name FROM ".LIN_PREFIX."users ". "WHERE username='".LinSql::linAddslashes($_POST['username'])."'"); - if( isset($data['username']) && isset($data['password']) && $_POST['username'] == $data['username'] && md5($_POST['password']) == $data['password']) + if ( isset($data['username']) && isset($data['password']) + && $_POST['username'] == $data['username'] + && $this->compareHash($data['id'], $_POST['password'], $data['password']) ) { /** * sucessfull login @@ -345,8 +373,9 @@ $this->setUserInformation($_POST['username'],$data['id'],$data['display_name']); - if(isset($_POST['rememberme'])) { - $this->setLinphaCookie($data['id'], md5($_POST['password'])); + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin'] + && isset($_POST['rememberme'])) { + $this->setLinphaCookie($data['id'], $data['password']); // this should be the updated hash (when needed) from compareHash() (call by reference) } /** @@ -375,11 +404,15 @@ $this->isAdmin = false; 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']) ) + if( $GLOBALS['linpha']->sql->config->value['sys_session_ipcheck'] && + isset($_SERVER['REMOTE_ADDR']) && ($_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) ) { /** * ip check wrong! */ + linLog(LOG_TYPE_USER,LOG_WARNING,'login','IP Check failed for '.$_SESSION['user_name']. + '. Session IP: '.$_SESSION['REMOTE_ADDR'].', Current IP: '.$_SERVER['REMOTE_ADDR']); + $this->isLoggedIn=false; $_SESSION = array(); @@ -601,6 +634,66 @@ } } + function getPWHash($pw) + { + require(LINPHA_DIR.'/lib/iha/iha.php'); + $iha = new iha(); + + /** + * see not below + $sql_dir = ''; + require_once( LINPHA_DIR.'/var/config.dir.php' ); + $hash_secret = ''; + require_once( LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php' ); + $iha->password = $hash_secret;*/ + + return $iha->hash($pw); + } + function compareHash($userid,$pw,&$hash) + { + if (strlen($hash)==32) // old md5 hash is used + { + if (md5($pw)==$hash) + { + // update old hash + $hash = $this->getPWHash($pw); + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."users " . + "SET password = '".LinSql::linAddslashes($hash)."' " . + "WHERE id = '".LinSql::linAddslashes($userid)."'"); + + return true; + } + else + { + return false; + } + } + else + { + require(LINPHA_DIR.'/lib/iha/iha.php'); + $iha = new iha(); + + /** + * @TODO + * $hash_secret not used at the moment + * it has 2 main disadvantages: + * - we would have to change require_once(config.sql.php) to require(config.sql.php) + * - if the admin deletes the file config.sql.php users will not never be able to authenticate + * - it does not make sense to store the $hash_secret in the database instead of a file, + * this would be no additional security! + $sql_dir = ''; + require_once( LINPHA_DIR.'/var/config.dir.php' ); + $hash_secret = ''; + require_once( LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php' ); + $iha->password = $hash_secret;*/ + + if ($iha->compare($pw, $hash)) + return true; + else + return false; + } + } + /** * other stuff */ @@ -777,7 +870,7 @@ * * @uses LinSql::startSession */ - function setLinphaCookie($userid, $md5pw) + function setLinphaCookie($userid, $pwhash) { /** * calculate correct path for cookie @@ -829,7 +922,7 @@ * 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); + setcookie("linpha_password", $pwhash, (time() + 60 * 60 * 24 * 31), $php_self_dir); } } // end class LinSql Modified: trunk/linpha2/lib/include/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.data.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.data.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -53,6 +53,11 @@ 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], 'sys_path_install_dir' => 'install', + 'sys_session_autologin' => '1', + 'sys_session_ipcheck' => '1', + 'sys_session_cookiepath' => 'unchanged', + 'sys_session_name' => 'linpha2', + 'sys_basket_mail_max_size' => (1024*1024*2), 'sys_basket_mail_smpthost' => 'localhost', 'sys_basket_download_limit' => '0', @@ -95,8 +100,6 @@ 'sys_style_layout_title' => 'Linpha 2.0', 'sys_style_others_sortorder' => 'nameasc', - - 'sys_user_autologin' => '1', ); $options_user_overrideable = Array( Modified: trunk/linpha2/lib/include/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -33,7 +33,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id INT NOT NULL AUTO_INCREMENT , " . "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(32) NOT NULL default '' , " . + "password VARCHAR(255) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INT default '0', " . Modified: trunk/linpha2/lib/include/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -32,7 +32,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id NUMBER PRIMARY KEY, " . "username VARCHAR2(255) NOT NULL, " . - "password VARCHAR2(32) NOT NULL, " . + "password VARCHAR2(255) NOT NULL, " . "user_email VARCHAR2(255) NOT NULL, " . "display_name VARCHAR2(255), " . "stats_downloads NUMBER(10) DEFAULT '0', " . Modified: trunk/linpha2/lib/include/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -32,7 +32,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id SERIAL PRIMARY KEY, " . "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(32) NOT NULL default '' , " . + "password VARCHAR(255) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INT NOT NULL default 0 , " . Modified: trunk/linpha2/lib/include/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -32,7 +32,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id INTEGER PRIMARY KEY, " . "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(32) NOT NULL default '' , " . + "password VARCHAR(255) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INTEGER NOT NULL default '0' , " . Modified: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/reset_database.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -106,7 +106,7 @@ unset($error_nr); } - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."users (username, password) VALUES ('root','".md5('test')."')"); + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."users (username, password) VALUES ('root','".$linpha->sql->getPWHash('test')."')"); $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."user_group (user_id, group_id) VALUES ('1','1')"); Modified: trunk/linpha2/templates/default/fragments.php =================================================================== --- trunk/linpha2/templates/default/fragments.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/templates/default/fragments.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -56,7 +56,7 @@ <br /> <label for="linFormUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /><br /> <label for="linFormPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /><br /> - <?php if($GLOBALS['linpha']->sql->config->value['sys_user_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> + <?php if($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> <input type="hidden" name="cmd" value="login" /> <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Login"); ?>" /><br /><br /> <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-06 20:50:54
|
Revision: 4853 http://linpha.svn.sourceforge.net/linpha/?rev=4853&view=rev Author: fangehrn Date: 2008-02-06 12:50:49 -0800 (Wed, 06 Feb 2008) Log Message: ----------- 2008-02-06 flo * common.php/linpha.class.php - fixed LINPHA_CLIENT when linpha is installed not to a subfolder - secured $_SERVER['PATH_INFO'] Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/linpha2.specs.txt trunk/linpha2/docs/dev/security.txt trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/include/calendar.php trunk/linpha2/lib/include/common.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/ChangeLog 2008-02-06 20:50:49 UTC (rev 4853) @@ -1,4 +1,10 @@ + +2008-02-06 flo + * common.php/linpha.class.php + - fixed LINPHA_CLIENT when linpha is installed not to a subfolder + - secured $_SERVER['PATH_INFO'] + 2008-02-04 flo * Some more work on the installer - fixed several bugs (absolute paths, sqlite, manual mode, back navigation) Modified: trunk/linpha2/docs/dev/linpha2.specs.txt =================================================================== --- trunk/linpha2/docs/dev/linpha2.specs.txt 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/docs/dev/linpha2.specs.txt 2008-02-06 20:50:49 UTC (rev 4853) @@ -53,6 +53,13 @@ - htmlentities() - smart_htmlspecialchars() from phpmeta used several times in forms in linpha1 ? + /* update 06.02.2008 fa */ + decided to use htmlentities($str, ENT_QUOTES) + difference between htmlspecialchars() and htmlentities(): + htmlspecialchars(): Array( ["] => " [<] => < [>] => > [&] => & ) + htmlentities(): Array( [ ] => [¡] => ¡ [¢] => ¢ [£] => £ [¤] => ¤ [¥] => ¥ [¦] => ¦ [§] => § [¨] => ¨ [©] => © [ª] => ª [«] => « [¬] => ¬ [] => ­ [®] => ® [¯] => ¯ [°] => ° [±] => ± [²] => ² [³] => ³ [´] => ´ [µ] => µ [¶] => ¶ [·] => · [¸] => ¸ [¹] => ¹ [º] => º [»] => » [¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿ [À] => À [Á] => Á [Â] => Â [Ã] => Ã [Ä] => Ä [Å] => Å [Æ] => Æ [Ç] => Ç [È] => È [É] => É [Ê] => Ê [Ë] => Ë [Ì] => Ì [Í] => Í [Î] => Î [Ï] => Ï [Ð] => Ð [Ñ] => Ñ [Ò] => Ò [Ó] => Ó [Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => × [Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û [Ü] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß [à] => à [á] => á [â] => â [ã] => ã [ä] => ä [å] => å [æ] => æ [ç] => ç [è] => è [é] => é [ê] => ê [ë] => ë [ì] => ì [í] => í [î] => î [ï] => ï [ð] => ð [ñ] => ñ [ò] => ò [ó] => ó [ô] => ô [õ] => õ [ö] => ö [÷] => ÷ [ø] => ø [ù] => ù [ú] => ú [û] => û [ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ ["] => " [<] => < [>] => > [&] => &) + -> its better to convert German Umlauts etc. to html entities to prevent problems if the browser does not support UTF-8 + - ? - php session limit the session cookie not only to domain, but also to full url path Modified: trunk/linpha2/docs/dev/security.txt =================================================================== --- trunk/linpha2/docs/dev/security.txt 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/docs/dev/security.txt 2008-02-06 20:50:49 UTC (rev 4853) @@ -8,6 +8,8 @@ where no quotes are used, take special care: "ORDER by id,(select password from users)" - encode all untrusted html data with htmlspecialchars( $text, ENT_QUOTES ) + /* update 06.02.2008 fa */ decided to switch to htmlentities($str, ENT_QUOTES) + see linpha2.specs.txt for details - check every data coming by the user (GET/POST/COOKIE) Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -79,10 +79,16 @@ } } - if(!defined('LINPHA_CLIENT')) + if(!defined('LINPHA_CLIENT')) // LINPHA_CLIENT must be defined before linpha is included from another page { - define('LINPHA_CLIENT', LinFilesys::cleanPath( dirname($_SERVER['PHP_SELF']).'/'.LINPHA_DIR ) ); + $dir = dirname($_SERVER['PHP_SELF']); + if ($dir=='\\' || $dir=='/') { // this is the case when linpha is installed not to a subfolder + define('LINPHA_CLIENT', '' ); // LINPHA_CLIENT has never an ending slash + } else { + define('LINPHA_CLIENT', LinFilesys::cleanPath( $dir.'/'.LINPHA_DIR ) ); + } } + /** * installation check Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -230,6 +230,14 @@ } else { + /** + * u-oh... take care when handling with $_SERVER['PATH_INFO'], it is not secure + * and may contain cross site scripting. in common.php all htmlentities have been + * replaced + * + * LinSql::getIdFromFullFilename does not output to the browser, always uses addslashes() + * and returns false if it is not a valid album, so as far as i know it's safe to use it this way + */ if( isset($_SERVER['PATH_INFO']) ) { $id = LinSql::getIdFromFullFilename( substr($_SERVER['PATH_INFO'],1) ); // PATH_INFO starts with a '/' -> remove this Modified: trunk/linpha2/lib/include/calendar.php =================================================================== --- trunk/linpha2/lib/include/calendar.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/include/calendar.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -1,179 +1,179 @@ -<?php -/* -* Copyright (c) 2004 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('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } - -include_once(LINPHA_DIR.'/lib/include/common.php'); - -$style['tablebg']="#B3BCDE"; - -/** - * @todo do we need the startSession() for the language stuff? - */ -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -?> -<title>Calender - LinPHA</title> -</head> -<body> -<?php - $m = (!isset($_GET['m'])) ? date("n",mktime()) : $_GET['m']; // wenn $m $y noch nicht existiert, aktuellen monat und aktuelles jahr in $m und $y schreiben - $y = (!isset($_GET['y'])) ? date("Y",mktime()) : $_GET['y']; -?> -<div align="center"> -<table bgcolor="<?php echo $style['tablebg']; ?>"> - <tr> - <td valign="top"> -<?php - /*== get what weekday the first is on ==*/ - $month_in_dec = strftime("%m",mktime(0,0,0,$m,1,$y)); - - $tmpd = getdate(mktime(0,0,0,$m,1,$y)); - $firstwday= $tmpd["wday"]; - - $lastday = mk_getLastDayofMonth($m,$y); - - $arr_month_long = Array( - '1' => i18n("January"), - '2' => i18n("February"), - '3' => i18n("March"), - '4' => i18n("April"), - '5' => i18n("May"), - '6' => i18n("June"), - '7' => i18n("July"), - '8' => i18n("August"), - '9' => i18n("September"), - '10' => i18n("October"), - '11' => i18n("November"), - '12' => i18n("December") - ); -?> -<table cellpadding=2 cellspacing=0 border=1> - <tr> - <td colspan=7 bgcolor="<?php echo $style['tablebg']; ?>"> - <table cellpadding=0 cellspacing=0 border=0 width="100%"> - <tr> - <td width="20"><a href="?m=<?php echo (($m-1)<1) ? 12 : $m-1 ; ?>&y=<?php echo (($m-1)<1) ? $y-1 : $y ; ?>&form=<?php echo $_GET['form']; ?>"><<</a></td> - <td bgcolor="<?php echo $style['tablebg']; ?>" align="center"><font size=2> - <?php echo $arr_month_long[intval($month_in_dec)]." ".$y; ?> - </font></td> - <td width="20"><a href="?m=<?php echo (($m+1)>12) ? 1 : $m+1 ; ?>&y=<?php echo (($m+1)>12) ? $y+1 : $y ; ?>&form=<?php echo $_GET['form']; ?>">>></a></td> - </tr> - </table></td> - </tr> - <tr> - <td width="22"><?php echo i18n("Sun"); ?></td> - <td width="22"><?php echo i18n("Mon"); ?></td> - <td width="22"><?php echo i18n("Tue"); ?></td> - <td width="22"><?php echo i18n("Wed"); ?></td> - <td width="22"><?php echo i18n("Thu"); ?></td> - <td width="22"><?php echo i18n("Fri"); ?></td> - <td width="22"><?php echo i18n("Sat"); ?></td> - </tr> - <?php - $d = 1; - $wday = $firstwday; - $firstweek = true; - - /*== loop through all the days of the month ==*/ - while ( $d <= $lastday) - { - - /*== set up blank days for first week ==*/ - if ($firstweek) { - print "<tr>"; - for ($i=1; $i<=$firstwday; $i++) - { print '<td><font size="2"></font></td>'; } - $firstweek = false; - } - - /*== Sunday start week with <tr> ==*/ - if ($wday==0) { print "<tr>"; } - - /*== check for event ==*/ - print "<td>"; - if($d<10) { - if($m<10) { - $tag = "$y:0$m:0$d"; - } else { - $tag = "$y:$m:0$d"; - } - } else { - if($m<10) { - $tag = "$y:0$m:$d"; - } else { - $tag = "$y:$m:$d"; - } - } - - $heute = date("Y:m:d",mktime()); // "01" bis "12" - if($tag==$heute) - { - $font1 = "<font color=\"#FF0000\">"; - $font2 = "</font>"; - } - else - { - $font1 = ""; - $font2 = ""; - } - if(isset($_GET['additional_cmd'])) - { - $str = ",opener.".$_GET['additional_cmd']; - } - else - { - $str = ""; - } - echo '<a href="#" onClick="opener.document.getElementById(\''.$_GET['form'].'\').value=\''.$tag.'\'' . $str . ',window.close();">'.$font1.$d.$font2.'</a>'; - print "</td>\n"; - - /*== Saturday week with </tr> ==*/ - if ($wday==6) { print "</tr>\n"; } - - $wday++; - $wday = $wday % 7; - $d++; - } -?> -</tr> -</table> -<div align="center"><a href="#" onClick="window.close()"><?php echo i18n("Close Window"); ?></a></div> - - </td> - </tr> -</table> -</div> -</body> -</html> -<?php -/*== get the last day of the month ==*/ -function mk_getLastDayofMonth($mon,$year) -{ - for ($tday=28; $tday <= 31; $tday++) - { - $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); - if ($tdate["mon"] != $mon) - { break; } - - } - $tday--; - - return $tday; -} -?> +<?php +/* +* Copyright (c) 2004 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('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } + +include_once(LINPHA_DIR.'/lib/include/common.php'); + +$style['tablebg']="#B3BCDE"; + +/** + * @todo do we need the startSession() for the language stuff? + */ +include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +?> +<title>Calender - LinPHA</title> +</head> +<body> +<?php + $m = (!isset($_GET['m'])) ? date("n",mktime()) : $_GET['m']; // wenn $m $y noch nicht existiert, aktuellen monat und aktuelles jahr in $m und $y schreiben + $y = (!isset($_GET['y'])) ? date("Y",mktime()) : $_GET['y']; +?> +<div align="center"> +<table bgcolor="<?php echo $style['tablebg']; ?>"> + <tr> + <td valign="top"> +<?php + /*== get what weekday the first is on ==*/ + $month_in_dec = strftime("%m",mktime(0,0,0,$m,1,$y)); + + $tmpd = getdate(mktime(0,0,0,$m,1,$y)); + $firstwday= $tmpd["wday"]; + + $lastday = mk_getLastDayofMonth($m,$y); + + $arr_month_long = Array( + '1' => i18n("January"), + '2' => i18n("February"), + '3' => i18n("March"), + '4' => i18n("April"), + '5' => i18n("May"), + '6' => i18n("June"), + '7' => i18n("July"), + '8' => i18n("August"), + '9' => i18n("September"), + '10' => i18n("October"), + '11' => i18n("November"), + '12' => i18n("December") + ); +?> +<table cellpadding=2 cellspacing=0 border=1> + <tr> + <td colspan=7 bgcolor="<?php echo $style['tablebg']; ?>"> + <table cellpadding=0 cellspacing=0 border=0 width="100%"> + <tr> + <td width="20"><a href="?m=<?php echo (($m-1)<1) ? 12 : $m-1 ; ?>&y=<?php echo (($m-1)<1) ? $y-1 : $y ; ?>&form=<?php echo $_GET['form']; ?>"><<</a></td> + <td bgcolor="<?php echo $style['tablebg']; ?>" align="center"><font size=2> + <?php echo $arr_month_long[intval($month_in_dec)]." ".$y; ?> + </font></td> + <td width="20"><a href="?m=<?php echo (($m+1)>12) ? 1 : $m+1 ; ?>&y=<?php echo (($m+1)>12) ? $y+1 : $y ; ?>&form=<?php echo $_GET['form']; ?>">>></a></td> + </tr> + </table></td> + </tr> + <tr> + <td width="22"><?php echo i18n("Sun"); ?></td> + <td width="22"><?php echo i18n("Mon"); ?></td> + <td width="22"><?php echo i18n("Tue"); ?></td> + <td width="22"><?php echo i18n("Wed"); ?></td> + <td width="22"><?php echo i18n("Thu"); ?></td> + <td width="22"><?php echo i18n("Fri"); ?></td> + <td width="22"><?php echo i18n("Sat"); ?></td> + </tr> + <?php + $d = 1; + $wday = $firstwday; + $firstweek = true; + + /*== loop through all the days of the month ==*/ + while ( $d <= $lastday) + { + + /*== set up blank days for first week ==*/ + if ($firstweek) { + print "<tr>"; + for ($i=1; $i<=$firstwday; $i++) + { print '<td><font size="2"></font></td>'; } + $firstweek = false; + } + + /*== Sunday start week with <tr> ==*/ + if ($wday==0) { print "<tr>"; } + + /*== check for event ==*/ + print "<td>"; + if($d<10) { + if($m<10) { + $tag = "$y:0$m:0$d"; + } else { + $tag = "$y:$m:0$d"; + } + } else { + if($m<10) { + $tag = "$y:0$m:$d"; + } else { + $tag = "$y:$m:$d"; + } + } + + $heute = date("Y:m:d",mktime()); // "01" bis "12" + if($tag==$heute) + { + $font1 = "<font color=\"#FF0000\">"; + $font2 = "</font>"; + } + else + { + $font1 = ""; + $font2 = ""; + } + if(isset($_GET['additional_cmd'])) + { + $str = ",opener.".$_GET['additional_cmd']; + } + else + { + $str = ""; + } + echo '<a href="#" onClick="opener.document.getElementById(\''.$_GET['form'].'\').value=\''.$tag.'\'' . $str . ',window.close();">'.$font1.$d.$font2.'</a>'; + print "</td>\n"; + + /*== Saturday week with </tr> ==*/ + if ($wday==6) { print "</tr>\n"; } + + $wday++; + $wday = $wday % 7; + $d++; + } +?> +</tr> +</table> +<div align="center"><a href="#" onClick="window.close()"><?php echo i18n("Close Window"); ?></a></div> + + </td> + </tr> +</table> +</div> +</body> +</html> +<?php +/*== get the last day of the month ==*/ +function mk_getLastDayofMonth($mon,$year) +{ + for ($tday=28; $tday <= 31; $tday++) + { + $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); + if ($tdate["mon"] != $mon) + { break; } + + } + $tday--; + + return $tday; +} +?> Modified: trunk/linpha2/lib/include/common.php =================================================================== --- trunk/linpha2/lib/include/common.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/include/common.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -77,7 +77,7 @@ } /** - * secure PHP_SELF + * secure PHP_SELF and PATH_INFO * * added from linpha1 patch 1432469 * @@ -97,14 +97,27 @@ * */ // Secure the PHP_SELF variable by first making all HTML code unuseable + + //$_SERVER['PHP_SELF'] = '/tests/simple.php/"><script>alert(\'xss\')</script><foo'; $_SERVER['PHP_SELF'] = htmlentities($_SERVER['PHP_SELF']); + if (isset($_SERVER['PATH_INFO'])) { + /** + * @TODO this will probably break special signs in the perma-link feature + * www.somewhere.com/index.php/album1/photo.jpg + * www.somewhere.com/index.php/album2 with spaces and 'quotes' and other "quotes"/photo <1>.jpg + * + * for the moment its ok for me. would need furhter investigation to get perma-link with special signs working + */ + $_SERVER['PATH_INFO'] = htmlentities($_SERVER['PATH_INFO']); + } + // Split it up into path and filename $SELF_DIR = dirname($_SERVER['PHP_SELF']); $SELF_FILE = basename($_SERVER['PHP_SELF']); // Check for a .php inside the $SELF_DIR... - while (ereg(".php", $SELF_DIR)) + while (ereg(".php", $SELF_DIR)) // this will not work if there is a folder with .php in its name, but this is very unlikely { // Correct the dirname $SELF_DIR = substr($SELF_DIR, 0, (strpos($SELF_DIR, ".php") + 4)); @@ -115,7 +128,22 @@ } // Put both together again and let's pray it is secured now... - $_SERVER['PHP_SELF'] = $SELF_DIR."/".$SELF_FILE; + if ( $SELF_DIR=='/' || $SELF_DIR=='\\') { + // if linpha is not installed in a subfolder take special behaviour + $_SERVER['PHP_SELF'] = "/".$SELF_FILE; + + /** + * (windows xp sp2 apache2.2 + * dirname('/'): \ + * dirname('/index.php'): \ + * dirname('/linpha/index.php'): /linpha + * dirname('/linpha/index.php/<asd>'): /linpha/index.php + * dirname('/linpha/index.php/<asd>/<asd>'): /linpha/index.php/<asd>) + */ + + } else { + $_SERVER['PHP_SELF'] = $SELF_DIR."/".$SELF_FILE; + } // Remove uneccessary variables unset($SELF_DIR); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-04 22:12:53
|
Revision: 4852 http://linpha.svn.sourceforge.net/linpha/?rev=4852&view=rev Author: fangehrn Date: 2008-02-04 14:12:44 -0800 (Mon, 04 Feb 2008) Log Message: ----------- 2008-02-04 flo * Some more work on the installer - fixed several bugs (absolute paths, sqlite, manual mode, back navigation) - don't like the gray background - added hash_secret variable in config.sql.php will be used by iha.class Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/security.txt trunk/linpha2/install/header.php trunk/linpha2/install/header_html.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/look.css trunk/linpha2/install/manual_install.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/install/step4_selectdirectories.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.admin.class.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.exiftool.class.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.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/sql/config.dir.php trunk/linpha2/lib/include/sql/config.sql.php trunk/linpha2/lib/plugins/log/sql/sql.data.php Added Paths: ----------- trunk/linpha2/lib/iha/ trunk/linpha2/lib/iha/License-LGPL.txt trunk/linpha2/lib/iha/iha.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/ChangeLog 2008-02-04 22:12:44 UTC (rev 4852) @@ -1,3 +1,11 @@ + +2008-02-04 flo + * Some more work on the installer + - fixed several bugs (absolute paths, sqlite, manual mode, back navigation) + - don't like the gray background + - added hash_secret variable in config.sql.php + will be used by iha.class + 2008-02-02 bzrudi * It should now be possible to auto adjust images to fit tracks AND to auto assign images to closest/nearest trackpoint in GPX file using some offset Modified: trunk/linpha2/docs/dev/security.txt =================================================================== --- trunk/linpha2/docs/dev/security.txt 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/docs/dev/security.txt 2008-02-04 22:12:44 UTC (rev 4852) @@ -11,4 +11,13 @@ - check every data coming by the user (GET/POST/COOKIE) -- every switch statement should have a default: case to prevent manipulation \ No newline at end of file +- every switch statement should have a default: case to prevent manipulation + + + + + + + +http://www.php-einfach.de/improved_hash_algorithm.php +http://cookies.lcs.mit.edu/pubs/webauth:tr.pdf \ No newline at end of file Modified: trunk/linpha2/install/header.php =================================================================== --- trunk/linpha2/install/header.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/header.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -86,19 +86,6 @@ "step11_finish.php" ); -$title_str[0] = i18n_install("Welcome"); -$title_str[1] = i18n_install("Accept GPL"); -$title_str[2] = i18n_install("Requirements"); -$title_str[3] = i18n_install("Database Type"); -$title_str[4] = i18n_install("Directories"); -$title_str[5] = i18n_install("Database Login"); -$title_str[6] = i18n_install("Select Database"); -$title_str[7] = i18n_install("Select Prefix"); -$title_str[8] = i18n_install("System Checks"); -$title_str[9] = i18n_install("Database Tables"); -$title_str[10] = i18n_install("Post Settings"); -$title_str[11] = i18n_install("Finalizing"); - if(! isset($is_special)) { $current_file = basename($_SERVER['PHP_SELF']); @@ -141,10 +128,14 @@ if($key >= 3) { session_start(); + + /** + * not needed?! this will delete our saved requirements and dbtype + * if($key==3) { $_SESSION = Array(); - } + }*/ } Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/header_html.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -24,75 +24,54 @@ * @package Installation */ +$menu_str[0] = i18n_install("Welcome"); +$menu_str[1] = i18n_install("Accept GPL"); +$menu_str[2] = i18n_install("Requirements"); +$menu_str[3] = i18n_install("Database Type"); +$menu_str[4] = i18n_install("Directories"); +$menu_str[5] = i18n_install("Database Login"); +$menu_str[6] = i18n_install("Select Database"); +$menu_str[7] = i18n_install("Select Prefix"); +$menu_str[8] = i18n_install("System Checks"); +$menu_str[9] = i18n_install("Database Tables"); +$menu_str[10] = i18n_install("Post Settings"); +$menu_str[11] = i18n_install("Finalizing"); + +$icon_str[0] = './graphics/start.png'; +$icon_str[1] = './graphics/gnu.png'; +$icon_str[2] = './graphics/important.png'; +$icon_str[3] = './graphics/phppg.png'; +$icon_str[4] = './graphics/directories.png'; +$icon_str[5] = './graphics/login.png'; +$icon_str[6] = './graphics/phppg.png'; +$icon_str[7] = './graphics/phppg.png'; +$icon_str[8] = './graphics/phppg.png'; +$icon_str[9] = './graphics/createtables.png'; +$icon_str[10] = './graphics/settings.png'; +$icon_str[11] = './graphics/finish.png'; + +$title_str[0] = i18n_install("Welcome To LinPHA2 Installation Wizzard"); +$title_str[1] = i18n_install("Accept The GNU General Public License GPL"); +$title_str[2] = i18n_install("Checking For Required Software"); +$title_str[3] = i18n_install("Select Type Of Database To Use"); +$title_str[4] = i18n_install("Define LinPHA Storage And Album Directories"); +$title_str[5] = i18n_install("Directories Testing And Database Login"); +$title_str[6] = i18n_install("Connection Test And Database Selection"); +$title_str[7] = i18n_install("Database Table Prefix Selection"); +$title_str[8] = i18n_install("Running Database Tests And Checking Permissions"); +$title_str[9] = i18n_install("Creating Database Tables And Writing Config Files"); +$title_str[10] = i18n_install("Setup LinPHA Admin And Initial Settings"); +$title_str[11] = i18n_install("Finishing LinPHA2 Setup"); + +$icon = $icon_str[$key]; +$title = $title_str[$key]; + $end = count($files)-1; $step = $key+1; $finalstep = $end+1; $strStep = i18n_install("Step %d of %d"); $strStep = sprintf($strStep, $step, $finalstep); - -switch($step) -{ - case 1: - $icon = './graphics/start.png'; - $title = i18n_install("Welcome To LinPHA2 Installation Wizzard"); - break; - - case 2: - $icon = './graphics/gnu.png'; - $title = i18n_install("Accept The GNU General Public License GPL"); - break; - - case 3: - $icon = './graphics/important.png'; - $title = i18n_install("Checking For Required Software"); - break; - - case 4: - $icon = './graphics/phppg.png'; - $title = i18n_install("Select Type Of Database To Use"); - break; - - case 5: - $icon = './graphics/directories.png'; - $title = i18n_install("Define LinPHA Storage And Album Directories"); - break; - - case 6: - $icon = './graphics/login.png'; - $title = i18n_install("Directories Testing And Database Login"); - break; - - case 7: - $icon = './graphics/phppg.png'; - $title = i18n_install("Connection Test And Database Selection"); - break; - - case 8: - $icon = './graphics/phppg.png'; - $title = i18n_install("Database Table Prefix Selection"); - break; - - case 9: - $icon = './graphics/phppg.png'; - $title = i18n_install("Running Database Tests And Checking Permissions"); - break; - - case 10: - $icon = './graphics/createtables.png'; - $title = i18n_install("Creating Database Tables And Writing Config Files"); - break; - - case 11: - $icon = './graphics/settings.png'; - $title = i18n_install("Setup LinPHA Admin And Initial Settings"); - break; - - case 12: - $icon = './graphics/finish.png'; - $title = i18n_install("Finishing LinPHA2 Setup"); - break; -} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -131,20 +110,13 @@ } echo '<div class="leftsidebox'.$style.'">'; - echo $title_str[$i]; - /* switch($i) - { - case 0: - echo i18n_install("Welcome"); - break; - case $end: - echo i18n_install("Finish"); - break; - default: - echo $title_str[$i]; - break; + + if ($i==0) { + echo '<a href="'.$_SERVER['PHP_SELF'].'?reset">'.$menu_str[$i].'</a>'; + } else { + echo $menu_str[$i]; } -*/ + echo "</div>"; } Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/lib.install.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -105,7 +105,7 @@ } if( installMkdir_p( substr( $target,0,strrpos( $target,'/') ) ) ) { - return mkdir($target,intval($mode,8)); // crawl back up & create dir tree + return @mkdir($target,intval($mode,8)); // crawl back up & create dir tree } else { @@ -161,6 +161,11 @@ /** * if $path is absolute, this is returned, if $path is relative, the relative path starting * from the linpha rootdirectory is returned +* +* always removed ending '/' to have unified paths in linpha +* +* this function is also defined in linpha.filesys.class.php +* always update both files! * * @author flo * @param string $path a path @@ -170,17 +175,29 @@ */ function installGetFullPath($path) { - if(installIsAbsolutePath($path)) { - $full_path = $path; - } else { - $full_path = LINPHA_DIR.'/'.$path; - } - - return $full_path; + if ( ! installIsAbsolutePath($path) ) + { + $path = LINPHA_DIR.'/'.$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; } /** * checks wether $path is absolute or relative +* +* this function is also defined in linpha.filesys.class.php +* always update both files! * * @author flo * @param string $path a path @@ -190,10 +207,10 @@ */ function installIsAbsolutePath($path) { - if(substr($path,0,1) == '/' OR // string begins with a '/' -> absolut path + if (substr($path,0,1) == '/' OR // string begins with a '/' -> absolut path ((strpos($path, ':') !== false) AND (strpos( PHP_OS, 'WIN' ) !== FALSE)) // we are on windows and the string contains a ':' -> absolut path (c:/..) - ) { // absolut path + ) { // absolute path return true; } else { return false; @@ -201,9 +218,13 @@ } /** - * creates a random password + * generates a random string/password in given length + * @author bzrudi + * @param int length of random string to generate + * @return string random string + * @package functions */ -function random_password($len) +function installRandomString($len) { $pass = ''; $lchar = 0; @@ -296,26 +317,30 @@ $array = array('album','sql','cache','tmp'); foreach($array AS $value) { - /** - * remove ending slash if not already done - */ - $len = strlen( $_POST[$value.'_dir'] ); - $lastsign = substr( $_POST[$value.'_dir'], $len-1); - if($lastsign == '/' && $lastsign == '\\') - { - $_POST[$value.'_dir'] = substr($_POST[$value.'_dir'],0,$len-1); - } + if (isset($_POST[$value.'_dir'])) + { + /** + * remove ending slash if not already done + */ + $len = strlen( $_POST[$value.'_dir'] ); + $lastsign = substr( $_POST[$value.'_dir'], $len-1); + if($lastsign == '/' && $lastsign == '\\') + { + $_POST[$value.'_dir'] = substr($_POST[$value.'_dir'],0,$len-1); + } + + /** + * save current value and append correct dir names + */ + $_SESSION[$value.'_dir'] = $_POST[$value.'_dir']; + + /** + * get correct dir names (take care of relativ and absolute paths, add + * LINPHA_DIR if necessary) + */ + } - /** - * save current value and append correct dir names - */ - $_SESSION[$value.'_dir'] = $_POST[$value.'_dir']; - - /** - * get correct dir names (take care of relativ and absolute paths, add - * LINPHA_DIR if necessary) - */ - $dirs[$value] = installGetFullPath( $_SESSION[$value.'_dir'] ); + $dirs[$value] = installGetFullPath( $_SESSION[$value.'_dir'] ); } return $dirs; } Modified: trunk/linpha2/install/look.css =================================================================== --- trunk/linpha2/install/look.css 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/look.css 2008-02-04 22:12:44 UTC (rev 4852) @@ -55,12 +55,12 @@ .leftside { - background: #F3F3F3; /*#e2e2e2;*/ + background: #E0E8FF; /*#F3F3F3; /*#e2e2e2;*/ border-right: 0px; } .rightside { - background: #F3F3F3; /*#eeeeee;*/ + background: #E0E8FF; /*#F3F3F3; /*#eeeeee;*/ } .button { @@ -85,6 +85,10 @@ font-weight: bold; } +.leftsidebox a { + color: #000000; +} + .box2 { } Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/manual_install.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -59,6 +59,7 @@ $_SESSION['sql_password'] = ""; $_SESSION['sql_dbname'] = "linpha"; $_SESSION['sql_dbport'] = "3306"; + $_SESSION['hash_secret'] = ""; define('LIN_PREFIX', $_SESSION['sql_prefix']); @@ -137,16 +138,8 @@ echo $_SESSION['album_dir']."\n"; echo $_SESSION['sql_dir']."\n"; echo $_SESSION['cache_dir']."\n"; -echo $_SESSION['cache_dir'].'/imgcache/'."\n"; -for($i = 0; $i < 10; $i++) -{ - echo $_SESSION['cache_dir'].'/imgcache/'.$i.'/'."\n"; -} -echo $_SESSION['cache_dir'].'/thumbache/'."\n"; -for($i = 0; $i < 10; $i++) -{ - echo $_SESSION['cache_dir'].'/thumbache/'.$i.'/'."\n"; -} +echo $_SESSION['cache_dir'].'/img'."\n"; +echo $_SESSION['cache_dir'].'/thumb/'."\n"; echo $_SESSION['tmp_dir']."\n"; echo $_SESSION['tmp_dir'].'/adocache/'; ?> @@ -165,6 +158,7 @@ $comment[2] = $changeme; $comment[3] = $changeme; $comment[4] = $changeme; $comment[5] = $changeme; $comment[6] = $donotchange; $comment[7] = $changeme; +$comment[8] = $changeme; include_once(LINPHA_DIR.'/lib/include/sql/config.sql.php'); ?> Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step10_postsettings.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -45,13 +45,14 @@ echo i18n_install("Connecting To Database...").' '; unset($_SESSION['installmode1']); +$_SESSION['installmode2'] = true; include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new Linpha(); -$linpha->sql->dbConnect(); +$linpha->sql->dbConnect(); // will exit on failure -echo success_msg(); // TODO: we should check for success before stating it ;-) +echo success_msg(); /** * add new linpha admin user Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step3_dbtype.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -77,21 +77,22 @@ * check for supported databases * define disabled and checked variables */ -foreach($array_databases AS $key=>$value) +foreach ($array_databases as $key=>$value) { - if(!function_exists($value)) { + if (!function_exists($value)) { $disabled = ' disabled="disabled"'; } else { $disabled = ''; } - if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == $key) { + if (isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == $key && empty($disabled)) { $checked = ' checked="checked"'; + $is_first = false; } else { /** * use first entry as checked */ - if(!isset($is_first) && empty($disabled)) + if (!isset($is_first) && empty($disabled)) { $is_first = false; $checked = ' checked="checked"'; @@ -125,12 +126,10 @@ <br /><br /> <h1><?php echo i18n_install("Select Installation Mode"); ?></h1><hr> -<input type='radio' id='linInputModeAutomatic' name='install_mode' value='automatic' checked="checked"><?php -/* no linebreak between <input> and <label> tag */ ?><label for="linInputModeAutomatic"> +<label for="linInputModeAutomatic"><input type='radio' id='linInputModeAutomatic' name='install_mode' value='automatic' checked="checked"> <?php echo i18n_install("Automatic mode"); ?></label> <br /> -<input type='radio' id='linInputModeManual' name='install_mode' value='manual'><?php -/* no linebreak between <input> and <label> tag */ ?><label for="linInputModeManual"> +<label for="linInputModeManual"><input type='radio' id='linInputModeManual' name='install_mode' value='manual'> <?php echo i18n_install("Manual Mode (Experts Only)"); ?></label> <?php Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step4_selectdirectories.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -27,9 +27,9 @@ include_once(LINPHA_DIR.'/install/header.php'); if (!isset($_SESSION['default_sql_dir']) ) { // save for later use in initInitialDirectories() - $_SESSION['default_sql_dir'] = 'var/sql-'.random_password(10); - $_SESSION['default_cache_dir'] = 'var/cache-'.random_password(10); - $_SESSION['default_tmp_dir'] = 'var/tmp-'.random_password(10); + $_SESSION['default_sql_dir'] = 'var/sql-'.installRandomString(10); + $_SESSION['default_cache_dir'] = 'var/cache-'.installRandomString(10); + $_SESSION['default_tmp_dir'] = 'var/tmp-'.installRandomString(10); } $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); @@ -69,12 +69,13 @@ include_once(LINPHA_DIR.'/install/header_html.php'); + +echo i18n_install("For security reasons folders were named random.").' '; +echo i18n_install("For maximum security place all these folders outside of the www root!").' '; +echo '('.i18n_install("Relative or absolute paths are allowed.").')<br /><br />'; ?> <div class="boxalign"> <?php -echo '<b>'.i18n_install("For maximum security place all these folders outside of the www root!") . - '</b><br />('.i18n_install("Relative or absolute paths allowed.").')<br /><br />'; - echo i18n_install("Album Directory").":"; ?> <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> @@ -113,11 +114,7 @@ (-> <?php echo installLinRealpath( installGetFullPath($tmp_dir) ); ?>) <br /><br /> -<?php -echo i18n_install("For security reasons folders were named random."); -?> - <input type="hidden" name="cmd_step4" value="save"> Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step6_selectdatabase.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -110,7 +110,7 @@ $_SESSION['allowed_to_create_db'] = false; break; -// case "sqlite": sqlite goes directly to stage8 +// case "sqlite": sqlite goes directly to stage7 } if(isset($error_nr)) Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step7_selectprefix.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -133,39 +133,55 @@ /** * checking album, sql, cache and tmp directory */ - $dirs = initSessionValues(); - if(initInitialDirectories($dirs) != true) - { - $show_next_button = false; - include_once(LINPHA_DIR.'/install/footer.php'); - exit(); - } - - echo i18n_install("Connecting SQLite Database...").' '; - - if(file_exists(LINPHA_DIR.'/'.$_SESSION['sql_dir'].'/'.$_SESSION['sql_dbname'])) + if(isset($_POST['cmd_step4'])) + { + /** + * checking album, sql, cache and tmp directory + */ + $dirs = initSessionValues(); + if(initInitialDirectories($dirs) != true) + { + $show_next_button = false; + include_once(LINPHA_DIR.'/install/footer.php'); + exit(); + } + } + + + if (isset($_SESSION['sqlite_db_created']) && $_SESSION['sqlite_db_created']==$_SESSION['sql_dir']) { - echo failed_msg(); - echo "<br />".sprintf( i18n_install("Database Already Exists, Delete First The File %s!"),$_SESSION['sql_dbname'] ); - $error_nr = 3; + echo i18n_install("Sqlite database already created, please continue to next step."); } else { - - /** - * 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(); - } - else - { - echo failed_msg(); - echo "<br />".i18n_install("Failed To Create Database").": ".$sqliteerror; - $error_nr = 3; - } + echo i18n_install("Creating SQLite Database...").' '; + + $sqlite_file = installGetFullPath( $_SESSION['sql_dir'] ).'/'.$_SESSION['sql_dbname']; + if(file_exists($sqlite_file)) + { + echo failed_msg(); + echo "<br />".sprintf( i18n_install("Database Already Exists, Delete First The File %s!"),$_SESSION['sql_dbname'] ); + $error_nr = 3; + } + else + { + if ($db = @sqlite_open($sqlite_file, 0666, $sqliteerror)) + { + echo success_msg(); + + /** + * do check for sqlite database already exist only once per sql_dir + * to prevent error message when pushing back button on step8 + */ + $_SESSION['sqlite_db_created'] = $_SESSION['sql_dir']; + } + else + { + echo failed_msg(); + echo "<br />".i18n_install("Failed To Create Database").": ".$sqliteerror; + $error_nr = 3; + } + } } break; case "oci8po": Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step8_testing.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -61,10 +61,10 @@ * switching to AdoDB * connect to db and check if connection was succesfull */ - echo i18n_install("Switching To AdoDB..").' '; + echo i18n_install("Switching To AdoDB...").' '; $_SESSION['installmode1'] = true; $_SESSION['installmode2'] = true; - + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new Linpha(); @@ -130,8 +130,8 @@ if($_SESSION['sql_dbtype'] == "mysql") { echo i18n_install("Trying To Create New LinPHA Database User...").' '; - $random_pass = random_password(8); - $random_user = "linpha_".random_password(4); + $random_pass = installRandomString(10); + $random_user = "linpha_".installRandomString(4); if($_SESSION['sql_hostname'] == 'localhost' OR $_SESSION['sql_hostname'] == '127.0.0.1') { @@ -180,21 +180,13 @@ } } } - echo '<br /><br /><hr /><br />'; + echo '<br /><br />'; } +echo '<br /><br />'; /** * running tests */ -/** - * prevent test running sqlite db - * @todo why?? -flo - * @todo - because at least alter will fail ;-) - bzrudi - */ - -if($_SESSION['sql_dbtype'] != 'sqlite') -{ - for($i = 1; $i <= $n_runs; $i++) { /** @@ -215,16 +207,32 @@ echo "<br />".i18n_install("Running Tests").": "; - $array_tests = array( - "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL )", - "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", - "ALTER" => "ALTER TABLE ".$table_name." ADD md5sum VARCHAR(32)", - "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 ); - - foreach($array_tests AS $key=>$value) + if ($_SESSION['sql_dbtype'] == 'sqlite') + { + /** + * sqlite does not support ALTER commands + */ + $array_tests = array( + "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL, md5sum VARCHAR(32) )", + "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", + "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 + ); + } else { + $array_tests = array( + "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL )", + "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", + "ALTER" => "ALTER TABLE ".$table_name." ADD md5sum VARCHAR(32)", + "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 + ); + } + + foreach($array_tests AS $key=>$value) { echo " ".$key." "; @@ -283,21 +291,14 @@ } } } -} -else -{ - /** - * skip tests for sqlite - */ - echo i18n_install("Skipping Database Tests"); -} + /** * new user failed, use old connection */ if(isset($use_other_conn)) { echo "<br /><br /><b>".i18n_install("New User Tests Failed, Falling Back...")."</b>"; - $linpha->db = $orig_conn; + $linpha->db = $orig_conn; // @TODO flo: i don't think that this makes any sense... } elseif($n_runs == 2) { Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step9_createtables.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -211,6 +211,8 @@ $comment[5] = ''; $comment[6] = ''; $comment[7] = ''; + $comment[8] = ''; + $_SESSION['hash_secret'] = installRandomString(32); include_once(LINPHA_DIR.'/lib/include/sql/config.sql.php'); Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,9 @@ * This class provides functions for edit configs etc. * @package Admin */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinAdmin { Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +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')) { exit(1); } include_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -25,6 +25,9 @@ * @package MetaData * @author bzrudi */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinExifTool extends LinMetaData { Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -23,11 +23,10 @@ * @package Filesystem */ +if(!defined('LINPHA_DIR')) { exit(1); } class LinFilesys { - - /** * create directory recursively - same as "mkdir -p" */ @@ -174,6 +173,9 @@ * the relative path starting from the linpha root directory is returned * * always removed ending '/' to have unified paths in linpha +* +* this function is also defined in lib.install.php +* always update both files! * * @author flo * @param string $path a path @@ -200,9 +202,11 @@ return $path; } - /** * checks wether $path is absolute or relative +* +* this function is also defined in linpha.filesys.class.php +* always update both files! * * @author flo * @param string $path a path @@ -213,7 +217,7 @@ { if(substr($path,0,1) == '/' OR // string begins with a '/' -> absolut path ((strpos($path, ':') !== false) AND (strpos( PHP_OS, 'WIN' ) !== FALSE)) // we are on windows and the string contains a ':' -> absolut path (c:/..) - ) { // absolut path + ) { // absolute path return true; } else { return false; Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -23,6 +23,8 @@ * @package Functions */ +if(!defined('LINPHA_DIR')) { exit(1); } + /** * get content of the systems PATH variable and remove dirs not in open_basedir and safe_mode_exec_dir (only if activated) */ @@ -582,7 +584,6 @@ /** * Setup Log Time Output Message & Remote IP */ - $time = linStrftime(time()); $ip = $_SERVER["REMOTE_ADDR"]; if( !isset($_SESSION['user_name'])) { $user = 'anonymous'; @@ -612,6 +613,8 @@ if(isset($GLOBALS['linpha']->sql->config->value['plugins_log_enable']) && $GLOBALS['linpha']->sql->config->value['plugins_log_enable'] == '1') { + $time = linStrftime(time()); // only when database is connected + /** * In case of database connection error a file named * db_error_tmp.log is created. If the file exists, copy it's content @@ -946,7 +949,6 @@ * @param int length of random string to generate * @return string random string * @package functions - */ function random_string($len) { Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -24,6 +24,8 @@ * @package Image */ +if(!defined('LINPHA_DIR')) { exit(1); } + class LinIdentify { Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,7 @@ * This class takes care of all different views (thumb view, menus...) * @package Image */ + if(!defined('LINPHA_DIR')) { exit(1); } define('LIN_SELECT_FIELDS', Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -18,13 +18,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + /** * This class takes automagic care of added/deleted images and albums * @package Image */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinImport { - /** * update selected directory * add new dirs/files, delete old ones Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -18,15 +18,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -if (!defined('LINPHA_DIR')) { exit (1); } -include_once LINPHA_DIR.'/lib/pjmt/Unicode.php'; - /** * This is the baseclass to handle all the EXIF/IPTC/XMP stuff used in LinPHA * It is extended by LinExifTool and LinPjmtTool class * @package MetaData * @author bzrudi,flo */ + +if (!defined('LINPHA_DIR')) { exit (1); } +include_once LINPHA_DIR.'/lib/pjmt/Unicode.php'; + class LinMetaData { public $defined_fields, $available_fields, $objMetaTool; Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -24,6 +24,9 @@ * @package MetaData * @author bzrudi,flo */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinPjmtTool extends LinMetaData { /** Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -23,6 +23,8 @@ * @package Database */ +if(!defined('LINPHA_DIR')) { exit(1); } + class LinSql { private $isLoggedIn, $isAdmin; @@ -49,9 +51,8 @@ $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_name = $_SESSION['sql_dbname']; $db_prefix = $_SESSION['sql_prefix']; - } else { @@ -61,20 +62,23 @@ include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); */ + /** + * if this file does not exists we already switch to installer + */ $sql_dir = ''; - include(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... + require_once(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... $include_file = LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php'; if( file_exists($include_file) ) { - include_once( $include_file ); + require_once( $include_file ); } else { - linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to the database !!! Cannot get config file ./var/config.sql.php"); + linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to the database !!! Cannot get config file $include_file"); include(LINPHA_DIR."/lib/include/db_connect_error.html"); - echo "<br /><br /><b>ERROR MESSAGE: Failed to include config file './var/config.sql.php' is it missing?</b>"; + echo "<br /><br /><b>ERROR MESSAGE: Failed to include config file. See log file for details.</b>"; exit(1); } @@ -114,15 +118,11 @@ switch(LIN_DB_TYPE) { case "sqlite": - if(isset($_SESSION['installmode1'])) - { - $sql_dir = LinFilesys::getFullPath($_SESSION['sql_dir']); - $GLOBALS['linpha']->db->Connect($sql_dir.'/database.sqlite'); + if(isset($_SESSION['installmode1'])) { + $sql_dir = $_SESSION['sql_dir']; } - else - { - $GLOBALS['linpha']->db->Connect(LinFilesys::getFullPath( $sql_dir ).'/database.sqlite'); - } + + $GLOBALS['linpha']->db->Connect(LinFilesys::getFullPath( $sql_dir ).'/'.$db_name); break; case "mysql": $GLOBALS['linpha']->db->Connect("$db_hostname:$db_port", $db_username, $db_password, $db_name); Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,9 @@ * This class takes care of LinPHAs template layouts * @package Template */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinTemplate { public $template_name, $layout_name; @@ -159,8 +162,8 @@ </style> <![endif]--> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> <script type="text/javascript" language="JavaScript"> var LINPHA_LINK = '<?php echo LINPHA_LINK; ?>'; var LINPHA_CLIENT = '<?php echo LINPHA_CLIENT; ?>'; @@ -169,11 +172,11 @@ var IdCurrent = startIdCurrent; <?php if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { - //echo "var checkAjaxCompatibility = true;"."\n"; - echo "myLinGlobal.checkAjaxCompatibility();"."\n"; -} /*else { - echo "var checkAjaxCompatibility = false;"."\n"; -}*/ + //echo "var checkAjaxCompatibility = true;"."\n"; + echo "myLinGlobal.checkAjaxCompatibility();"."\n"; +} /*else { + echo "var checkAjaxCompatibility = false;"."\n"; +}*/ ?> </script> Added: trunk/linpha2/lib/iha/License-LGPL.txt =================================================================== --- trunk/linpha2/lib/iha/License-LGPL.txt (rev 0) +++ trunk/linpha2/lib/iha/License-LGPL.txt 2008-02-04 22:12:44 UTC (rev 4852) @@ -0,0 +1,506 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portio... [truncated message content] |
From: <bz...@us...> - 2008-02-04 13:52:34
|
Revision: 4851 http://linpha.svn.sourceforge.net/linpha/?rev=4851&view=rev Author: bzrudi Date: 2008-02-04 05:52:22 -0800 (Mon, 04 Feb 2008) Log Message: ----------- fixe exiftool gps data import Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/modules/module.geodata.php trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-02 16:43:14 UTC (rev 4850) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-04 13:52:22 UTC (rev 4851) @@ -950,17 +950,17 @@ /** * Lower array data to make it compareable to $metaTags */ - //$lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); + $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); //echo '<pre>', print_r($lowerDataArray), '</pre>'; foreach($this->getDefaultMetaTags('gps') AS $key => $value) { - if(array_key_exists($value, $dataArray)) + if(array_key_exists($value, $lowerDataArray)) { $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($dataArray[$value])."', "; + $str_values .= "'".trim($lowerDataArray[$value])."', "; } } /** @@ -1004,14 +1004,21 @@ if(is_array($dataArray)) { + /** + * Lower array data to make it compareable to $metaTags + */ + + $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); + foreach($this->getDefaultMetaTags('gps') AS $key => $value) { - if(array_key_exists($value, $dataArray)) + if(array_key_exists($value, $lowerDataArray)) { $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($dataArray[$value])."', "; + $str_values .= "'".trim($lowerDataArray[$value])."', "; } } + /** * Remove last two signs (the comma and the space) which we add to much */ Modified: trunk/linpha2/lib/modules/module.geodata.php =================================================================== --- trunk/linpha2/lib/modules/module.geodata.php 2008-02-02 16:43:14 UTC (rev 4850) +++ trunk/linpha2/lib/modules/module.geodata.php 2008-02-04 13:52:22 UTC (rev 4851) @@ -21,6 +21,18 @@ if (!defined('LINPHA_DIR')) { exit (1); } include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; +$urlFull = LINPHA_LINK.'&linCat=geodata'; + +$linpha->template->setModuleName('geodata'); +//$linpha->template->overrideModule('head','map'); +$linpha->template->URL_full = $urlFull; +$linpha->template->URL_base = $urlFull; +$linpha->template->output['title'] = i18n("Geodata"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + + + + $GPXData = new LinXmlParser('/tmp/sample.gpx'); $array_with_gpx = $GPXData->readXmlFile(); $track_times = $GPXData->getGpxTimeRange($array_with_gpx); Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 16:43:14 UTC (rev 4850) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-04 13:52:22 UTC (rev 4851) @@ -136,7 +136,7 @@ } /** - * This method checks for start and end date/time for the gpx file + * This method checks for start and end date/time from the gpx file * @param array with all trkpt informtion from file * @return array (starttime, endtime); * @author bzrudi @@ -174,7 +174,7 @@ } /** - * This method checks parses all images in folder and get's start and + * This method parses all images in folder and get's start and * end date/time. * @param int parent_id for images to parse * @return array (starttime, endtime); @@ -410,7 +410,7 @@ } /** - * This method is mainly a wrapper function for trkptradar() which does + * This method is mainly a wrapper function for trkptRadar() which does * the main work when finding nearest trackpoint * @param array $images with all data read from the files * @author bzrudi @@ -528,6 +528,8 @@ ($lon > 0) ? $lonref = "E" : $latref = "W"; ($lat > 0) ? $latref = "N" : $latref = "S"; + // 0 = Above Sea Level + // 1 = Below Sea Level ($ele > 0) ? $eleref = "0" : $eleref = "1"; echo "Latref ".$latref." Longref ".$lonref."<br><br>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-02 16:43:16
|
Revision: 4850 http://linpha.svn.sourceforge.net/linpha/?rev=4850&view=rev Author: bzrudi Date: 2008-02-02 08:43:14 -0800 (Sat, 02 Feb 2008) Log Message: ----------- add ele/alt attribute Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/modules/module.geodata.php trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-02 15:05:22 UTC (rev 4849) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-02 16:43:14 UTC (rev 4850) @@ -29,8 +29,8 @@ */ class LinMetaData { - public $defined_fields, $available_fields; - protected $objMetaTool; + public $defined_fields, $available_fields, $objMetaTool; + private $cachedFieldNames, $cachedFieldIds, $cachedSelectedFieldNames; /** Modified: trunk/linpha2/lib/modules/module.geodata.php =================================================================== --- trunk/linpha2/lib/modules/module.geodata.php 2008-02-02 15:05:22 UTC (rev 4849) +++ trunk/linpha2/lib/modules/module.geodata.php 2008-02-02 16:43:14 UTC (rev 4850) @@ -24,7 +24,7 @@ $GPXData = new LinXmlParser('/tmp/sample.gpx'); $array_with_gpx = $GPXData->readXmlFile(); $track_times = $GPXData->getGpxTimeRange($array_with_gpx); -$image_times = $GPXData->getImageTimeRange(41); //parent_id linpha_photos +$image_times = $GPXData->getImageTimeRange(6); //parent_id linpha_photos echo "<br>***OFFSET CHECKING***"; Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 15:05:22 UTC (rev 4849) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 16:43:14 UTC (rev 4850) @@ -435,7 +435,8 @@ $trkdata[$this->date2unixTime($value['time'])] = array("time" => $this->date2unixTime($value['time']), "lat" => $value['trkpt']['lat'], - "lon" => $value['trkpt']['lon']); + "lon" => $value['trkpt']['lon'], + "ele" => $value['ele']); } echo "<br>***CALLING TRACKPOINT RADAR***<br>"; @@ -477,7 +478,8 @@ $this->writeGpsData2File($image_filename, $trkdata[$image_time]['lat'], - $trkdata[$image_time]['lon']); + $trkdata[$image_time]['lon'], + $trkdata[$image_time]['ele']); return false; } @@ -490,7 +492,8 @@ $this->writeGpsData2File($image_filename, $trkdata[$image_time + $offset]['lat'], - $trkdata[$image_time + $offset]['lon']); + $trkdata[$image_time + $offset]['lon'], + $trkdata[$image_time + $offset]['ele']); return false; } @@ -502,7 +505,8 @@ "".$trkdata[$image_time - $offset]['lon']."<br><br>"; $this->writeGpsData2File($image_filename, $trkdata[$image_time - $offset]['lat'], - $trkdata[$image_time - $offset]['lon']); + $trkdata[$image_time - $offset]['lon'], + $trkdata[$image_time - $offset]['ele']); return false; } @@ -517,13 +521,14 @@ /** * Write GPS data to file */ - private function writeGpsData2File($filename, $lat, $lon) + private function writeGpsData2File($filename, $lat, $lon, $ele) { echo "Trying to write GPS data to files - ***SIMULATION***<br>"; echo "Trying file: ".$filename."<br>"; ($lon > 0) ? $lonref = "E" : $latref = "W"; ($lat > 0) ? $latref = "N" : $latref = "S"; + ($ele > 0) ? $eleref = "0" : $eleref = "1"; echo "Latref ".$latref." Longref ".$lonref."<br><br>"; @@ -532,12 +537,15 @@ $filename = LINPHA_DIR."/$filename"; $return = ""; $meta = ""; - $parameters = "-GPSLongitudeRef = ".$lonref." " . - "-GPSLongitude = ".$lon." " . - "-GPSLatitudeRef = ".$latref." " . - "-GPSLatitude = ".$lat." "; - - //LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + $parameters = "-GPSLongitudeRef='$lonref' " . + "-GPSLongitude='$lon' " . + "-GPSLatitudeRef='$latref' " . + "-GPSLatitude='$lat' " . + "-GPSAltitudeRef='$eleref' " . + "-GPSAltitude='$ele' "; + + //exec(LINPHA_DIR.'/lib/exiftool/exiftool'." $parameters $filename"); + //LinFilesys::linExec($metaData->objMetaTool.' '.$parameters.' "'.$filename.'"', $meta, $return); } }// end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-02 15:05:31
|
Revision: 4849 http://linpha.svn.sourceforge.net/linpha/?rev=4849&view=rev Author: bzrudi Date: 2008-02-02 07:05:22 -0800 (Sat, 02 Feb 2008) Log Message: ----------- minor improvements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-02 13:11:40 UTC (rev 4848) +++ trunk/linpha2/ChangeLog 2008-02-02 15:05:22 UTC (rev 4849) @@ -3,6 +3,7 @@ assign images to closest/nearest trackpoint in GPX file using some offset logic. - add some new methods for this + * Add support for images starting earlier as track 2008-02-01 bzrudi * More improvements to XML parser class. XML/GPX parsing works now, same @@ -10,7 +11,7 @@ well as the image EXIF datetimeoriginal tag from all images in folder. * Add some required new methods to LinMetaData() class * Add new file modules.geodata.php for testing all geodata stuff - * some basic tests work alright now + * Some basic tests work alright now 2008-01-31 bzrudi * Maps plugin Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 13:11:40 UTC (rev 4848) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 15:05:22 UTC (rev 4849) @@ -294,7 +294,58 @@ if($images['starttime'] < $track['starttime']) { echo "Offset detected, images start earlier...<br>"; - print_r($images['geodata']); + + $number = count($images['geodata']); + + while(list($image_time, $filename) = each($images['geodata'])) + { + if($image_time < $track['starttime']) + { + $no_offsync++; + $files_offsync[] = $filename; + } + } + echo "$no_offsync "."out of ".$number ." images are out of sync...<br>"; + echo "We have an offset of ".($track['starttime']-$images['starttime'])." " . + "seconds, which is about ".(($track['starttime']-$images['starttime'])/3600)." hours"; + echo "<br>Calibrating...<br>"; + + if($no_offsync > '0') + { + $full_hour = round(($track['starttime']-$images['starttime'])/3600, '0'); + + if($full_hour != '0') + { + echo "Usually offset is because of wrong UTC/GMT settings, so " . + "trying full hours first<br>"; + echo "Setting full hour offset to ".$full_hour." h<br>"; + echo "Faking image times... new setting +$full_hour h<br>"; + + $offset = ($full_hour*3600); + + } + else + { + echo "Danm, looks like we have an time skew < 1h - not so good<br>"; + echo "Setting offset to 5 min...<br>"; + echo "Faking image times... new setting -5 min<br>"; + + $offset = '300'; + } + + foreach($images['geodata'] AS $image_time => $filename) + { + $geo_tmp[($image_time + $offset)] = $filename; + } + + $image_tmp = array("starttime" => ($images['starttime'] + $offset), + "endtime" => ($images['endtime'] + $offset), + "geodata" => $geo_tmp ); + + echo "Rerunning offset test...<br>"; + $this->fixImagesOffset($track, $image_tmp); + } + } elseif($images['endtime'] > $track['endtime']) { @@ -398,7 +449,7 @@ while($loop === true) { - $loop = $this->trkptRadar($trkdata, $image_time, $offset); + $loop = $this->trkptRadar($trkdata, $image_time, $offset, $image_filename); $offset++; } } @@ -415,7 +466,7 @@ * @author bzrudi * @return bool */ - private function trkptRadar($trkdata, $image_time, $offset) + private function trkptRadar($trkdata, $image_time, $offset, $image_filename) { if(array_key_exists($image_time, $trkdata)) { @@ -423,6 +474,11 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time]['lat']."<br>and LON: " . "".$trkdata[$image_time]['lon']."<br><br>"; + + $this->writeGpsData2File($image_filename, + $trkdata[$image_time]['lat'], + $trkdata[$image_time]['lon']); + return false; } elseif(array_key_exists(($image_time + $offset), $trkdata)) @@ -431,6 +487,11 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time + $offset]['lat']."<br>and LON: " . "".$trkdata[$image_time + $offset]['lon']."<br><br>"; + + $this->writeGpsData2File($image_filename, + $trkdata[$image_time + $offset]['lat'], + $trkdata[$image_time + $offset]['lon']); + return false; } elseif(array_key_exists(($image_time - $offset), $trkdata)) @@ -439,6 +500,10 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time - $offset]['lat']."<br>and LON: " . "".$trkdata[$image_time - $offset]['lon']."<br><br>"; + $this->writeGpsData2File($image_filename, + $trkdata[$image_time - $offset]['lat'], + $trkdata[$image_time - $offset]['lon']); + return false; } else @@ -448,6 +513,32 @@ } } + + /** + * Write GPS data to file + */ + private function writeGpsData2File($filename, $lat, $lon) + { + echo "Trying to write GPS data to files - ***SIMULATION***<br>"; + echo "Trying file: ".$filename."<br>"; + + ($lon > 0) ? $lonref = "E" : $latref = "W"; + ($lat > 0) ? $latref = "N" : $latref = "S"; + + echo "Latref ".$latref." Longref ".$lonref."<br><br>"; + + + $filename = substr($filename, 2); + $filename = LINPHA_DIR."/$filename"; + $return = ""; + $meta = ""; + $parameters = "-GPSLongitudeRef = ".$lonref." " . + "-GPSLongitude = ".$lon." " . + "-GPSLatitudeRef = ".$latref." " . + "-GPSLatitude = ".$lat." "; + + //LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + } }// end class /* vi: set ts=4 sw=4 sts=4 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-02 13:11:43
|
Revision: 4848 http://linpha.svn.sourceforge.net/linpha/?rev=4848&view=rev Author: bzrudi Date: 2008-02-02 05:11:40 -0800 (Sat, 02 Feb 2008) Log Message: ----------- even more improvements to gpx stuff Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/modules/module.geodata.php trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-01 18:08:14 UTC (rev 4847) +++ trunk/linpha2/ChangeLog 2008-02-02 13:11:40 UTC (rev 4848) @@ -1,3 +1,9 @@ +2008-02-02 bzrudi + * It should now be possible to auto adjust images to fit tracks AND to auto + assign images to closest/nearest trackpoint in GPX file using some offset + logic. + - add some new methods for this + 2008-02-01 bzrudi * More improvements to XML parser class. XML/GPX parsing works now, same for getting all required timestamps (starttime/endtime) from xml file as @@ -4,7 +10,7 @@ well as the image EXIF datetimeoriginal tag from all images in folder. * Add some required new methods to LinMetaData() class * Add new file modules.geodata.php for testing all geodata stuff - * some basic test work alright now + * some basic tests work alright now 2008-01-31 bzrudi * Maps plugin Modified: trunk/linpha2/lib/modules/module.geodata.php =================================================================== --- trunk/linpha2/lib/modules/module.geodata.php 2008-02-01 18:08:14 UTC (rev 4847) +++ trunk/linpha2/lib/modules/module.geodata.php 2008-02-02 13:11:40 UTC (rev 4848) @@ -21,8 +21,8 @@ if (!defined('LINPHA_DIR')) { exit (1); } include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; -$GPXData = new LinXmlParser(); -$array_with_gpx = $GPXData->readXmlFile('/tmp/sample.gpx'); +$GPXData = new LinXmlParser('/tmp/sample.gpx'); +$array_with_gpx = $GPXData->readXmlFile(); $track_times = $GPXData->getGpxTimeRange($array_with_gpx); $image_times = $GPXData->getImageTimeRange(41); //parent_id linpha_photos @@ -31,7 +31,7 @@ if($GPXData->compareTimeRanges($track_times, $image_times)) { echo "<br>Time range OK, going checking offset<br>"; - $GPXData->fixImagesOffset($track_times, $image_times); + $GPXData->fixImagesOffset($track_times, $image_times, $image_tmp=array()); } else { Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-01 18:08:14 UTC (rev 4847) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 13:11:40 UTC (rev 4848) @@ -31,9 +31,9 @@ private $data, $parser, $filename, $values, $index_array; private $data_range, $gpx, $xml_data , $meta_data; - function __construct() + function __construct($filename) { - + $this->filename = $filename; } /** @@ -56,12 +56,12 @@ * @param string $filename * @return array with all trackpoints */ - public function readXmlFile($filename) + public function readXmlFile() { /** * open and parse xml file for Track data */ - $this->data = file_get_contents($filename); + $this->data = file_get_contents($this->filename); $this->parser = xml_parser_create(); /** @@ -254,9 +254,10 @@ } /** - * Compare time ranges for track and images. E.g time range for images - * must be smaller than the range for tracks. - * @param $array start/endtime track + * Check for offset. E.g. all images must be taken within track time range + * Delta t for the first and last image must be smaller than delta t for + * the gpx track, this method takes care of it. + * @param $array $track start/endtime track * @param $array start/endtime images * @return bool true/false * @author bzrudi @@ -277,13 +278,16 @@ } /** - * Check for offset. E.g. all images must be taken within track time range - * - */ - public function fixImagesOffset($track, $images) + * All images must be taken within track time range delta t. If we found + * images taken earlier or later, fix it! + * @param $array $track start/endtime track + * @param $array start/endtime images + * @author bzrudi + */ + public function fixImagesOffset($track, $images) //, $image_tmp { /** - * Number off imges out of sync + * Number of images out of sync */ $no_offsync = '0'; @@ -297,7 +301,7 @@ echo "Offset detected, images end later...<br>"; $number = count($images['geodata']); - + //print_r($images['geodata']); while(list($image_time, $filename) = each($images['geodata'])) { if($image_time > $track['endtime']) @@ -314,26 +318,26 @@ if($no_offsync > '0') { $full_hour = round(($images['endtime']-$track['endtime'])/3600, '0'); - + if($full_hour != '0') { - echo "Usually offset is because of wrong UTC/GMT settings, so " . + echo "Usually offset is because of wrong UTC/GMT settings, so " . "trying full hours first<br>"; - echo "Setting full hour offset to ".$full_hour." h<br>"; - echo "Faking image times... new setting -$full_hour h<br>"; - - $offset = ($full_hour*3600); - + echo "Setting full hour offset to ".$full_hour." h<br>"; + echo "Faking image times... new setting -$full_hour h<br>"; + + $offset = ($full_hour*3600); + } else { - echo "Danm, looks like we have an time skew < 1h - not so good<br>"; - echo "Setting offset to 5 min...<br>"; - echo "Faking image times... new setting -5 min<br>"; - - $offset = '300'; + echo "Danm, looks like we have an time skew < 1h - not so good<br>"; + echo "Setting offset to 5 min...<br>"; + echo "Faking image times... new setting -5 min<br>"; + + $offset = '300'; } - + foreach($images['geodata'] AS $image_time => $filename) { $geo_tmp[($image_time-$offset)] = $filename; @@ -342,16 +346,108 @@ $image_tmp = array("starttime" => ($images['starttime'] - $offset), "endtime" => ($images['endtime'] - $offset), "geodata" => $geo_tmp ); - + echo "Rerunning offset test...<br>"; $this->fixImagesOffset($track, $image_tmp); } } else { - echo "***BINGO ALL IMAGES ARE NOW WITHIN TRACK TIME RANGE***<br>"; + echo "<br>***BINGO ALL IMAGES ARE NOW WITHIN TRACK TIME RANGE***<br>"; + $this->triggerImage2trkpt($images); } } + + /** + * This method is mainly a wrapper function for trkptradar() which does + * the main work when finding nearest trackpoint + * @param array $images with all data read from the files + * @author bzrudi + * @return none (yet) + */ + private function triggerImage2trkpt($images) + { + /** + * @todo mv to __constructor + */ + $gpx = $this->readXmlFile($this->filename); + + ksort($images['geodata']); + ksort($gpx); + + /** + * Create new array with all needed information sorted + */ + foreach($gpx AS $index => $value) + { + + $trkdata[$this->date2unixTime($value['time'])] = + array("time" => $this->date2unixTime($value['time']), + "lat" => $value['trkpt']['lat'], + "lon" => $value['trkpt']['lon']); + } + + echo "<br>***CALLING TRACKPOINT RADAR***<br>"; + + foreach($images['geodata'] AS $image_time => $image_filename) + { + echo "Trying to find match for: ".$image_time." ".$image_filename."<br>"; + + $offset = '1'; + $loop = true; + + while($loop === true) + { + $loop = $this->trkptRadar($trkdata, $image_time, $offset); + $offset++; + } + } + } + + /** + * Trackpoint radar. Try to find nearest trkpt for image + * We do this by adding an offset (positiv and negativ) of one second to + * the original image_time until we got key hit. + * + * @param array $trkdata array with time and lat lon from gpx track + * @param int $image_time current image timestamp + * @param int $offset current offset in seconds + * @author bzrudi + * @return bool + */ + private function trkptRadar($trkdata, $image_time, $offset) + { + if(array_key_exists($image_time, $trkdata)) + { + echo "Got hit after: 0 loops ".$image_time; + echo "<br>Connecting image ".$image_time." " . + "<br>to LAT: ".$trkdata[$image_time]['lat']."<br>and LON: " . + "".$trkdata[$image_time]['lon']."<br><br>"; + return false; + } + elseif(array_key_exists(($image_time + $offset), $trkdata)) + { + echo "Got hit after: +".$offset." loops ".$image_time; + echo "<br>Connecting image ".$image_time." " . + "<br>to LAT: ".$trkdata[$image_time + $offset]['lat']."<br>and LON: " . + "".$trkdata[$image_time + $offset]['lon']."<br><br>"; + return false; + } + elseif(array_key_exists(($image_time - $offset), $trkdata)) + { + echo "Got hit after: -".$offset." loops ".$image_time; + echo "<br>Connecting image ".$image_time." " . + "<br>to LAT: ".$trkdata[$image_time - $offset]['lat']."<br>and LON: " . + "".$trkdata[$image_time - $offset]['lon']."<br><br>"; + return false; + } + else + { + flush(); + return true; + } + + } }// end class /* vi: set ts=4 sw=4 sts=4 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-01 18:08:19
|
Revision: 4847 http://linpha.svn.sourceforge.net/linpha/?rev=4847&view=rev Author: bzrudi Date: 2008-02-01 10:08:14 -0800 (Fri, 01 Feb 2008) Log Message: ----------- Add new file modules.geodata.php Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/lib/plugins/maps/xml_parser.class.php Added Paths: ----------- trunk/linpha2/lib/modules/module.geodata.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-01 13:37:03 UTC (rev 4846) +++ trunk/linpha2/ChangeLog 2008-02-01 18:08:14 UTC (rev 4847) @@ -3,6 +3,8 @@ for getting all required timestamps (starttime/endtime) from xml file as well as the image EXIF datetimeoriginal tag from all images in folder. * Add some required new methods to LinMetaData() class + * Add new file modules.geodata.php for testing all geodata stuff + * some basic test work alright now 2008-01-31 bzrudi * Maps plugin Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-01 13:37:03 UTC (rev 4846) +++ trunk/linpha2/index.php 2008-02-01 18:08:14 UTC (rev 4847) @@ -64,6 +64,9 @@ case 'download': require_once(LINPHA_DIR.'/lib/modules/module.download.php'); break; +case 'geodata': + require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); + break; case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Added: trunk/linpha2/lib/modules/module.geodata.php =================================================================== --- trunk/linpha2/lib/modules/module.geodata.php (rev 0) +++ trunk/linpha2/lib/modules/module.geodata.php 2008-02-01 18:08:14 UTC (rev 4847) @@ -0,0 +1,44 @@ +<?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. + */ + +if (!defined('LINPHA_DIR')) { exit (1); } +include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; + +$GPXData = new LinXmlParser(); +$array_with_gpx = $GPXData->readXmlFile('/tmp/sample.gpx'); +$track_times = $GPXData->getGpxTimeRange($array_with_gpx); +$image_times = $GPXData->getImageTimeRange(41); //parent_id linpha_photos + +echo "<br>***OFFSET CHECKING***"; + +if($GPXData->compareTimeRanges($track_times, $image_times)) +{ + echo "<br>Time range OK, going checking offset<br>"; + $GPXData->fixImagesOffset($track_times, $image_times); +} +else +{ + echo "<br>Time Range error - images time range is larger than track time"; + echo "ABORT"; +} + + +//echo "<pre>", print_r($array_with_gpx), "</pre>"; +?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-02-01 13:37:03 UTC (rev 4846) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-02-01 18:08:14 UTC (rev 4847) @@ -23,23 +23,7 @@ * @package Plugins */ if(!defined('LINPHA_DIR')) { exit(1); } -include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; -$GPXData = new LinXmlParser(); -$array_with_gpx = $GPXData->readXmlFile('/tmp/sample.gpx'); -$track_times = $GPXData->getGpxTimeRange($array_with_gpx); -$image_times = $GPXData->getImageTimeRange(19); -if($GPXData->compareTimeRanges($track_times, $image_times)) -{ - echo " ALL OK"; - } - else - { - echo "TRACK ERROR"; - } - -//echo "<pre>", print_r($array_with_gpx), "</pre>"; - /** * xml load/save stuff */ @@ -146,7 +130,7 @@ { if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) { - $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; + //echo "<pre>", print_r($array_with_gpx), "</pre>"; $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; } if( $_POST['cmd'] == 'saveMarker' ) Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-01 13:37:03 UTC (rev 4846) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-01 18:08:14 UTC (rev 4847) @@ -163,19 +163,19 @@ } } - echo "MIN ".$date_min." -- "; - echo "MAX ".$date_max; - echo " DIFF ".($date_max - $date_min)."<br>"; - echo "TRACK START AM:".date("Y-m-d, H-i-s", $date_min); - echo " TRACK ENDE UM:".date("Y-m-d, H-i-s", $date_max)."<br>"; - + echo "**TRACK INFO**<br>"; + echo "min ".$date_min." -- "; + echo "max ".$date_max; + echo " length ".($date_max - $date_min)."<br>"; + echo "track starts from: ".date("Y:m:d H:i:s", $date_min); + echo " track ends at: ".date("Y:m:d H:i:s", $date_max)."<br><br>"; + return array("starttime" => $date_min, "endtime" => $date_max); } - - + /** - * This method checks parses all images in folder and get's start and - * end date/time. + * This method checks parses all images in folder and get's start and + * end date/time. * @param int parent_id for images to parse * @return array (starttime, endtime); * @author bzrudi @@ -201,6 +201,12 @@ $current_time = $metaData->getDateTimeOriginal($filename); $current_time = $this->date2unixTime($current_time); + /** + * Buffer data, so we don't need to read image header again + * and again + */ + $geodata[$current_time] = $filename; + if($current_time < $date_min) { $date_min = $current_time; @@ -211,14 +217,15 @@ } } } - echo "MIN ".$date_min." -- "; - echo "MAX ".$date_max; - echo "DIFF ".($date_max - $date_min)."<br>"; - - echo "IMAGE START AM:".date("Y-m-d, H-i-s", $date_min); - echo " IMAGE ENDE UM:".date("Y-m-d, H-i-s", $date_max); - - return array("starttime" => $date_min, "endtime" => $date_max); + echo "**IMAGE INFO**<br>"; + echo "min ".$date_min." -- "; + echo "max ".$date_max; + echo " length ".($date_max - $date_min)."<br>"; + + echo "images start from: ".date("Y:m:d H:i:s", $date_min); + echo " images end at: ".date("Y:m:d H:i:s", $date_max)."<br>"; + + return array("starttime" => $date_min, "endtime" => $date_max, "geodata" => $geodata); } /** @@ -235,7 +242,7 @@ * Example EXIF 2007:07:17 09:25:16 */ unset($time_unix); - + $year = substr($datetime, 0, 4); $month = substr($datetime, 5, 2); $day = substr($datetime, 8, 2); @@ -245,9 +252,9 @@ $time_unix = mktime($hour, $min, $sec, $month, $day, $year); return $time_unix; } - + /** - * Compare time ranges for track and images. E.g time range for images + * Compare time ranges for track and images. E.g time range for images * must be smaller than the range for tracks. * @param $array start/endtime track * @param $array start/endtime images @@ -258,7 +265,7 @@ { $time_track = ($track['endtime'] - $track['starttime']); $time_images = ($images['endtime'] - $images['starttime']); - + if($time_images <= $time_track) { return true; @@ -267,8 +274,84 @@ { return false; } - } + } + /** + * Check for offset. E.g. all images must be taken within track time range + * + */ + public function fixImagesOffset($track, $images) + { + /** + * Number off imges out of sync + */ + $no_offsync = '0'; + + if($images['starttime'] < $track['starttime']) + { + echo "Offset detected, images start earlier...<br>"; + print_r($images['geodata']); + } + elseif($images['endtime'] > $track['endtime']) + { + echo "Offset detected, images end later...<br>"; + + $number = count($images['geodata']); + + while(list($image_time, $filename) = each($images['geodata'])) + { + if($image_time > $track['endtime']) + { + $no_offsync++; + $files_offsync[] = $filename; + } + } + echo "$no_offsync "."out of ".$number ." images are out of sync...<br>"; + echo "We have an offset of ".($images['endtime']-$track['endtime'])." " . + "seconds, which is about ".(($images['endtime']-$track['endtime'])/3600)." hours"; + echo "<br>Calibrating...<br>"; + + if($no_offsync > '0') + { + $full_hour = round(($images['endtime']-$track['endtime'])/3600, '0'); + + if($full_hour != '0') + { + echo "Usually offset is because of wrong UTC/GMT settings, so " . + "trying full hours first<br>"; + echo "Setting full hour offset to ".$full_hour." h<br>"; + echo "Faking image times... new setting -$full_hour h<br>"; + + $offset = ($full_hour*3600); + + } + else + { + echo "Danm, looks like we have an time skew < 1h - not so good<br>"; + echo "Setting offset to 5 min...<br>"; + echo "Faking image times... new setting -5 min<br>"; + + $offset = '300'; + } + + foreach($images['geodata'] AS $image_time => $filename) + { + $geo_tmp[($image_time-$offset)] = $filename; + } + + $image_tmp = array("starttime" => ($images['starttime'] - $offset), + "endtime" => ($images['endtime'] - $offset), + "geodata" => $geo_tmp ); + + echo "Rerunning offset test...<br>"; + $this->fixImagesOffset($track, $image_tmp); + } + } + else + { + echo "***BINGO ALL IMAGES ARE NOW WITHIN TRACK TIME RANGE***<br>"; + } + } }// end class /* vi: set ts=4 sw=4 sts=4 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-01 13:37:06
|
Revision: 4846 http://linpha.svn.sourceforge.net/linpha/?rev=4846&view=rev Author: bzrudi Date: 2008-02-01 05:37:03 -0800 (Fri, 01 Feb 2008) Log Message: ----------- improved GPX file parsing support Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-31 19:57:11 UTC (rev 4845) +++ trunk/linpha2/ChangeLog 2008-02-01 13:37:03 UTC (rev 4846) @@ -1,3 +1,9 @@ +2008-02-01 bzrudi + * More improvements to XML parser class. XML/GPX parsing works now, same + for getting all required timestamps (starttime/endtime) from xml file as + well as the image EXIF datetimeoriginal tag from all images in folder. + * Add some required new methods to LinMetaData() class + 2008-01-31 bzrudi * Maps plugin - all DBs should work now (untestet) Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-31 19:57:11 UTC (rev 4845) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-02-01 13:37:03 UTC (rev 4846) @@ -1,64 +1,64 @@ <?php /* -* Copyright (c) 2007 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. -*/ + * Copyright (c) 2007 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 class handles all the IPTC/XMP stuff used in LinPHA. Currently - * we support IPTC/XMP, EXIF may follow as soon as we have tested ExifTool for - * speed, stability and portability. + * we support IPTC/XMP, EXIF may follow as soon as we have tested ExifTool for + * speed, stability and portability. * @package MetaData * @author bzrudi */ class LinExifTool extends LinMetaData { - -public $exiftool, $filename; + public $exiftool, $filename; + /** * Constructor */ - function __construct() + function __construct() { /** * Automagic set required exiftool depending on OS * @todo mac detecting and testing */ - if(LIN_OS == "unix") + if(LIN_OS == "unix") { - $this->exiftool = LINPHA_DIR.'/lib/exiftool/exiftool'; + $this->exiftool = LINPHA_DIR.'/lib/exiftool/exiftool'; } - elseif(LIN_OS == "win") + elseif(LIN_OS == "win") { - $this->exiftool = LINPHA_DIR.'\lib\exiftool\exiftool.exe'; // forward slashes will not work + $this->exiftool = LINPHA_DIR.'\lib\exiftool\exiftool.exe'; // forward slashes will not work } - else // Macintosh - Seems that exiftool will be installed into /usr/bin - // by default when using the install package *.dmg + else // Macintosh - Seems that exiftool will be installed into /usr/bin + // by default when using the install package *.dmg { - if(file_exists('/usr/bin/exiftool')) - { - $this->exiftool = '/usr/bin/exiftool'; - } - else // fallback to UNIX default - may work ! - { - $this->exiftool = LINPHA_DIR.'/lib/exiftool/exiftool'; - } - } + if(file_exists('/usr/bin/exiftool')) + { + $this->exiftool = '/usr/bin/exiftool'; + } + else // fallback to UNIX default - may work ! + { + $this->exiftool = LINPHA_DIR.'/lib/exiftool/exiftool'; + } + } } /** @@ -66,46 +66,46 @@ * Most modern Cameras should support it. * @param string $filename The filename of the Image * @param string $outfile The filename inkl. path to store thumb to - * @return bool + * @return bool * @author bzrudi */ public function getEmbeddedThumbnail($filename, $outfile) { $got_thumb = false; //prevent notice - - $parameters = "-b " . // get binary data + + $parameters = "-b " . // get binary data "-ThumbnailImage"; // get thumbnail from composite - + /** * Buffer output of passthru and save to $thumb var - */ - ob_start(); - passthru($this->exiftool.' '.$parameters.' "'.$filename.'"'); + */ + ob_start(); + passthru($this->exiftool.' '.$parameters.' "'.$filename.'"'); $thumb = ob_get_contents(); - ob_end_clean(); - - if(strlen($thumb) > 10) + ob_end_clean(); + + if(strlen($thumb) > 10) { $fileobj = file_put_contents($outfile, $thumb); - - if($fileobj > 10) //$fileobj is number of bytes written - { - $got_thumb = true; - } - else - { - $got_thumb = false; - } + + if($fileobj > 10) //$fileobj is number of bytes written + { + $got_thumb = true; + } + else + { + $got_thumb = false; + } } - - if($got_thumb) - { - return true; - } - else - { - return false; - } + + if($got_thumb) + { + return true; + } + else + { + return false; + } } /** @@ -121,20 +121,20 @@ $parameters = "-g ". //Group by Tags "-h "; //Enable HTML output - LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $return); - + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $return); + foreach($return as $value) { echo $value; - } - + } + } - + /** * This method reads all available MetaData (Group) Information from image. * @param string $metatype iptc, xmp, exif, makernotes... * @param string $filename - * @return array Array with all available Tag informations + * @return array Array with all available Tag informations * @author bzrudi * @todo respect exec return status, don't use filename as input (security) */ @@ -143,7 +143,7 @@ $meta =""; $return=""; $metaArray = array(); - + $parameters = "-$metatype:all " . // Get all Tag Information "-s " . // Print tag names instead of descr. "-t " . // Use tab \t as delimiter @@ -151,42 +151,42 @@ "-a " . // Allow duplicates "-c %.10f " . // GPS formatting to float instead of words "-m "; // Ignore minor errors - + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); - - + + /* - echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; - echo '<pre>', print_r($meta), '</pre>'; - exit(); - */ + echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; + echo '<pre>', print_r($meta), '</pre>'; + exit(); + */ /** - * Create usable array information by cycling and splitting + * Create usable array information by cycling and splitting * all information */ foreach($meta as $value) { - $temp = explode("\t", $value); + $temp = explode("\t", $value); $metaArray[trim($temp['0'])] = @trim($temp['1']); - } - - return $metaArray; + } + + return $metaArray; } /** * Save all MetaData to database * @param string $filename filename to parse for MetaData * @param string $md5sum md5sum of file - * @param string $tag save EXIF, IPTC or XMP MetaData + * @param string $tag save EXIF, IPTC or XMP MetaData */ public function saveMetaData($filename, $md5sum, $tag) { - + $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); - - //echo '<pre>', print_r($dataArray), '</pre>'; - + //echo '<pre>', print_r($dataArray), '</pre>'; + + $str_columns = "md5sum, "; $str_values = "'" . $md5sum . "', "; @@ -194,38 +194,38 @@ { /** * Lower array data to make it compareable to LinExifTool::$metaTags - */ + */ $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - + /** - * Search for valid and filled tags + * Search for valid and filled tags */ foreach($this->defined_fields[$tag] AS $key => $value) { if(array_key_exists($key, $lowerDataArray)) - { - $str_columns .= str_replace("_", "-", $key) . ', '; - $str_values .= "'".trim($lowerDataArray[$key])."', "; - //$str_values .= "'".HTML_UTF8_Escape(trim($lowerDataArray[$key]))."', "; + { + $str_columns .= str_replace("_", "-", $key) . ', '; + $str_values .= "'".trim($lowerDataArray[$key])."', "; + //$str_values .= "'".HTML_UTF8_Escape(trim($lowerDataArray[$key]))."', "; } } - /** - * Remove last two signs (the comma and the space) which we add to much - */ - $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); - $str_values = substr($str_values, 0, strlen($str_values) - 2); + /** + * Remove last two signs (the comma and the space) which we add to much + */ + $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); + $str_values = substr($str_values, 0, strlen($str_values) - 2); - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_$tag " . + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_$tag " . "(" . $str_columns . ") VALUES (" . $str_values . ")"); } } /** - * Simple method to return just exif date and orientation tag during - * import as needed by linpha_photos, this is not used for any meta_x table. + * Simple method to return just exif date and orientation tag during + * import as needed by linpha_photos, this is not used for any meta_x table. * example: 2004:02:14 18:24:19 and -90 - * + * * @param string $dirname, $filename * @return array $time_exif (unix timestamp) * $rotate (degrees to rotate) otherMarker @@ -233,15 +233,15 @@ **/ public function getBasicMeta($dirname, $filename) { - $return = ""; + $return = ""; $meta = ""; $filename = "".$dirname."/".$filename.""; - $parameters = "-exif:datetimeoriginal " . // Get date tag + $parameters = "-exif:datetimeoriginal " . // Get date tag "-exif:orientation " . // Get orientation tag "-s -n -t "; // Print tag name tab seper. - - LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); - + + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + if(is_array($meta)) { foreach($meta AS $value) @@ -249,7 +249,7 @@ $temp = explode("\t", $value); $metaArray[strtolower(trim($temp['0']))] = @trim($temp['1']); } - + } $date = $metaArray['datetimeoriginal']; @@ -267,7 +267,7 @@ { $time_exif = "0"; } - + if($metaArray['orientation']) { $rotate = $metaArray['orientation']; @@ -276,38 +276,38 @@ { $rotate = "0"; } - - return array($time_exif, $rotate); + + return array($time_exif, $rotate); } /** - * This method defines tags to index, e.g. create them in MetaData relation. - * And also sets available fields, e.g. those defined in $metaTags, but + * This method defines tags to index, e.g. create them in MetaData relation. + * And also sets available fields, e.g. those defined in $metaTags, but * not used in database yet. * @param string $metatype [exif,iptc,xmp] * @return array fileds already selected to be used (defined_fields) * and also available fields from $metaTags (available_fields) - * @author bzrudi,flo + * @author bzrudi,flo */ public function setMetaFields($metatype) { - + /** - * Create defined_fields var, use a new array with lowercase keys and + * Create defined_fields var, use a new array with lowercase keys and * without the md5sum entry. - * MetaColumns() returns the keys always uppercase independent + * MetaColumns() returns the keys always uppercase independent * of ADODB_ASSOC_CASE setting, so strtolower() them. */ $array = $GLOBALS['linpha']->db->MetaColumns(LIN_PREFIX."meta_".$metatype); $this->defined_fields[$metatype] = array (); - + foreach ($array AS $key => $value) { if ($key != 'MD5SUM') //todo check array_pop { $new_key = strtolower($key); - $this->defined_fields[$metatype][$new_key] = - LinExifTool::$metaTags[$metatype][$new_key]; + $this->defined_fields[$metatype][$new_key] = + LinExifTool::$metaTags[$metatype][$new_key]; } } @@ -325,22 +325,49 @@ } /** + * Just get DateTimeOriginal from EXIF header + * + * @param filename $filename + * @return DateTimeOriginal as unixtime + */ + public function getDateTimeOriginal($filename) + { + $return = ""; + $meta = ""; + $parameters = "-exif:datetimeoriginal " .// Get date tag + "-fast "; // hurry up ;-) + + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + + if(isset($meta['0'])) + { + /** + * Cut DateTimeOriginal + */ + $len = strlen($meta['0']); + $image_date = substr($meta['0'], ($len - 19)); + + } + return $image_date; + } + + /** * Define array with allowed IPTC/XMP tags and human readable translation * @param none - * @return none - * @author bzrudi + * @return none + * @author bzrudi */ public static $metaTags = array( 'xmp' => array( - - //Iptc4xmpCore schema tags + + //Iptc4xmpCore schema tags 'countrycode' => 'Country Code', 'intellectualgenre' => 'Intellectual Genre', 'location' => 'Location', 'scene' => 'Scene', 'subjectcode' => 'Subject Code', - //Dublin Core schema tags + //Dublin Core schema tags 'contributor' => 'Contributor', 'coverage' => 'Coverage', 'creator' => 'Creator', @@ -352,8 +379,8 @@ 'rights' => 'Rights', 'subject' => 'Subject', 'title' => 'Title', - - //Adobe Photoshop schema tags + + //Adobe Photoshop schema tags 'authorsposition' => 'Authors Position', 'captionwriter' => 'Caption Writer', 'category' => 'Category', @@ -361,7 +388,7 @@ 'colormode' => 'Color Mode', 'country' => 'Country', 'credit' => 'Credit', - //'datecreated' => 'DateCreated', + //'datecreated' => 'DateCreated', 'headline' => 'Headline', 'iccprofilename' => 'ICC Profile Name', 'instructions' => 'Instructions', @@ -408,10 +435,10 @@ 'originatingprogram' => 'Originating Program', 'releasedate' => 'Release Date' ), - + //EXIF schema tags 'exif' => array( - + //IFD0 'processingsoftware' => 'Processing Software', 'imagewidth' => 'Image Width', @@ -461,7 +488,7 @@ 'rating' => 'Rating', 'ratingpercent' => 'Rating Percent', 'copyright' => 'Copyright', - + //ExifIFD 'exposuretime' => 'Exposure Time', 'fnumber' => 'F Number', @@ -507,7 +534,7 @@ 'subjectdistancerange' => 'Subject Distance Range', 'gamma' => 'Gamma' ) - ); + ); } /* vi: set ts=4 sw=4 sts=4 */ Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-31 19:57:11 UTC (rev 4845) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-01 13:37:03 UTC (rev 4846) @@ -1200,6 +1200,19 @@ } return $rotate; } + + /** + * Wrapper method to get DateTimeOriginal from EXIF header depending on + * used Meta Toolkit + * + * @param filename $filename + * @return DateTimeOriginal as unixtime + */ + public function getDateTimeOriginal($filename) + { + $image_date = $this->objMetaTool->getDateTimeOriginal($filename); + return $image_date; + } } /* vi: set ts=4 sw=4 sts=4 */ Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-31 19:57:11 UTC (rev 4845) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-02-01 13:37:03 UTC (rev 4846) @@ -1,45 +1,44 @@ <?php /* -* Copyright (c) 2007 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. -*/ + * Copyright (c) 2007 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 class handles all the EXIF stuff using PJMT as fallback when exiftool - * can't be used in LinPHA for some reasons. + * can't be used in LinPHA for some reasons. * @package MetaData * @author bzrudi,flo */ class LinPjmtTool extends LinMetaData { - /** * Constructor */ function __construct() { - + } /** * This method reads all available GeoData Information from image. * @param string $metatype exi * @param string $filename - * @return array Array with all available Tag informations + * @return array Array with all available Tag informations * @author bzrudi * @todo respect exec return status, don't use filename as input (security) */ @@ -47,63 +46,63 @@ { include_once (LINPHA_DIR . '/lib/pjmt/JPEG.php'); include_once (LINPHA_DIR . '/lib/pjmt/EXIF.php'); - + /** * get exif info from file */ $exif_data = get_EXIF_JPEG($filename); - + if($exif_data) { /** - * search for valid tags + * search for valid tags */ foreach($this->getDefaultMetaTags('gps') AS $key => $value) { if(!empty(LinPjmtTool::$metaTags['exif'][$value]['pathvalue'])) { /** - * there are currently only entries at level deep 2 and 5 + * there are currently only entries at level deep 2 and 5 * in the array */ - $ap = explode('/', - LinPjmtTool::$metaTags['exif'][$value]['pathvalue']); - + $ap = explode('/', + LinPjmtTool::$metaTags['exif'][$value]['pathvalue']); + switch(count($ap)) { case 2 : if(isset($exif_data[$ap[0]][$ap[1]]['Text Value'])) { //echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; - $dataArray[$value] = - LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])); + $dataArray[$value] = + LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])); } - break; + break; case 5 : if(isset($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) { //echo "DATA2".$exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value']; $dataArray[$value] = - LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])); + LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])); } - break; + break; } } } - if(is_array($dataArray)){ - return $dataArray; - }else { - return array(); + if(is_array($dataArray)){ + return $dataArray; + }else { + return array(); + } + } - - } } - + /** * Save all MetaData to database * @param string $filename filename to parse for MetaData * @param string $md5sum md5sum of file - * @param string $tag save IPTC or XMP MetaData + * @param string $tag save IPTC or XMP MetaData */ public function saveMetaData($filename, $md5sum, $metatype) { @@ -123,7 +122,7 @@ * special tags */ // Canon Owner Name append to Artist - if (isset ($exif_data['Makernote_Tag']['Decoded Data']) + 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'])) { @@ -140,19 +139,19 @@ } /** - * search for valid tags + * search for valid tags */ foreach($this->defined_fields['exif'] AS $key => $value) { if(!empty(LinPjmtTool::$metaTags['exif'][$key]['pathvalue'])) { /** - * there are currently only entries at level deep 2 and 5 + * there are currently only entries at level deep 2 and 5 * in the array */ - $ap = explode('/', - LinPjmtTool::$metaTags['exif'][$key]['pathvalue']); - + $ap = explode('/', + LinPjmtTool::$metaTags['exif'][$key]['pathvalue']); + switch(count($ap)) { case 2 : @@ -174,8 +173,8 @@ } break; default : - echo "Error no valid path for key: " . $key . " value: " . - LinPjmtTool::$metaTags['exif'][$key]['pathvalue'] . "<br />"; + echo "Error no valid path for key: " . $key . " value: " . + LinPjmtTool::$metaTags['exif'][$key]['pathvalue'] . "<br />"; break; } } @@ -202,12 +201,11 @@ $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); $str_values = substr($str_values, 0, strlen($str_values) - 2); - $GLOBALS['linpha']->db->Execute("INSERT INTO " . LIN_PREFIX . + $GLOBALS['linpha']->db->Execute("INSERT INTO " . LIN_PREFIX . "meta_exif (" . $str_columns . ") " . "VALUES (" . $str_values . ")"); } - /** * Define tags to index and set available fields * @param string $tag [exif] @@ -217,7 +215,7 @@ /** * create defined_fields * use a new array with lowercase keys without the md5sum entry - * MetaColumns() returns the keys always uppercase + * MetaColumns() returns the keys always uppercase * independent of ADODB_ASSOC_CASE */ $array = $GLOBALS['linpha']->db->MetaColumns(LIN_PREFIX."meta_".$tag); @@ -228,8 +226,8 @@ if ($key != 'MD5SUM') { $new_key = strtolower($key); - $this->defined_fields[$tag][$new_key] = - LinPjmtTool::$metaTags[$tag][$new_key]['name']; + $this->defined_fields[$tag][$new_key] = + LinPjmtTool::$metaTags[$tag][$new_key]['name']; } } @@ -245,15 +243,14 @@ } } - /** - * Simple method to return just exif date and orientation tag during - * import as needed by linpha_photos, this is not used for any meta_x table. + * Simple method to return just exif date and orientation tag during + * import as needed by linpha_photos, this is not used for any meta_x table. * example: 2004:02:14 18:24:19 and -90 - * + * * @param string $dirname, $filename * @return array $time_exif (unix timestamp) - * $rotate (degrees to rotate) + * $rotate (degrees to rotate) * @author bzrudi,flo **/ public function getBasicMeta($dirname, $filename) @@ -261,12 +258,12 @@ include_once( LINPHA_DIR.'/lib/pjmt/EXIF.php' ); $date = ""; $meta = get_EXIF_JPEG($dirname.'/'.$filename); - + if(isset($meta[0][34665]['Data'][0][36867]['Data'][0]) ) { $date = $meta[0][34665]['Data'][0][36867]['Data'][0]; } - + if(strlen($date) > 4) { $year = substr($date, 0, 4); @@ -279,29 +276,48 @@ } else { - $time_exif = "0"; + $time_exif = "0"; } - + if(isset($meta[0][274]['Data'][0])) { - $rotate = $meta[0][274]['Data'][0]; + $rotate = $meta[0][274]['Data'][0]; } else { - $rotate = "0"; + $rotate = "0"; } - - - return array($time_exif, $rotate); - + + + return array($time_exif, $rotate); + } /** + * Just get DateTimeOriginal from EXIF header + * + * @param filename $filename + * @return DateTimeOriginal as string + */ + public function getDateTimeOriginal($filename) + { + include_once( LINPHA_DIR.'/lib/pjmt/EXIF.php' ); + $date = ""; + $meta = @get_EXIF_JPEG($filename); + + if(isset($meta[0][34665]['Data'][0][36867]['Data'][0]) ) + { + $image_date = $meta[0][34665]['Data'][0][36867]['Data'][0]; + } + return $image_date; + } + + /** * Define array with allowed EXIF tags and human readable translation * @param none - * @return none - * @author flo - */ + * @return none + * @author flo + */ public static $metaTags = array ( 'exif' => array ( @@ -310,595 +326,595 @@ 'name' => 'Image Width', 'pathkey' => 'ImageWidth', 'pathvalue' => '' - ), + ), 'imagelength' => array ( 'name' => 'Image Length', 'pathkey' => 'ImageLength', 'pathvalue' => '' - ), + ), 'bitspersample' => array ( 'name' => 'Bits Per Sample', 'pathkey' => 'BitsPerSample', 'pathvalue' => '' - ), + ), 'compression' => array ( 'name' => 'Compression', 'pathkey' => 'Compression', 'pathvalue' => '' - ), + ), 'photometricinterpretation' => array ( 'name' => 'Photometric Interpretation', 'pathkey' => 'PhotometricInterpretation', 'pathvalue' => '' - ), + ), 'orientation' => array ( 'name' => 'Orientation', 'pathkey' => 'Orientation', 'pathvalue' => '0/274' - ), + ), 'samplesperpixel' => array ( 'name' => 'Samples Per Pixel', 'pathkey' => 'SamplesPerPixel', 'pathvalue' => '' - ), + ), 'planarconfiguration' => array ( 'name' => 'Planar Configuration', 'pathkey' => 'PlanarConfiguration', 'pathvalue' => '' - ), + ), 'ycbcrsubsampling' => array ( 'name' => 'YCbCr Sub Sampling', 'pathkey' => 'YCbCrSubSampling', 'pathvalue' => '' - ), + ), 'ycbcrpositioning' => array ( 'name' => 'YCbCr Positioning', 'pathkey' => 'YCbCrPositioning', 'pathvalue' => '0/531' - ), + ), 'xresolution' => array ( 'name' => 'X Resolution', 'pathkey' => 'XResolution', 'pathvalue' => '0/282' - ), + ), 'yresolution' => array ( 'name' => 'Y Resolution', 'pathkey' => 'YResolution', 'pathvalue' => '0/283' - ), + ), 'resolutionunit' => array ( 'name' => 'Resolution Unit', 'pathkey' => 'ResolutionUnit', 'pathvalue' => '0/296' - ), + ), 'stripoffsets' => array ( 'name' => 'Strip Offsets', 'pathkey' => 'StripOffsets', 'pathvalue' => '' - ), + ), 'rowsperstrip' => array ( 'name' => 'Rows Per Strip', 'pathkey' => 'RowsPerStrip', 'pathvalue' => '' - ), + ), 'stripbytecounts' => array ( 'name' => 'Strip Byte Counts', 'pathkey' => 'StripByteCounts', 'pathvalue' => '' - ), + ), 'jpeginterchangeformat' => array ( 'name' => 'JPEG Interchange Format', 'pathkey' => 'JPEGInterchangeFormat', 'pathvalue' => '' - ), + ), 'jpeginterchangeformatlength' => array ( 'name' => 'JPEG Interchange Format Length', 'pathkey' => 'JPEGInterchangeFormatLength', 'pathvalue' => '' - ), + ), 'transferfunction' => array ( 'name' => 'Transfer Function', 'pathkey' => 'TransferFunction', 'pathvalue' => '' - ), + ), 'whitepoint' => array ( 'name' => 'White Point', 'pathkey' => 'WhitePoint', 'pathvalue' => '' - ), + ), 'primarychromaticities' => array ( 'name' => 'Primary Chromaticities', 'pathkey' => 'PrimaryChromaticities', 'pathvalue' => '' - ), + ), 'ycbcrcoefficients' => array ( 'name' => 'YCbCr Coefficients', 'pathkey' => 'YCbCrCoefficients', 'pathvalue' => '' - ), + ), 'referenceblackwhite' => array ( 'name' => 'Reference Black White', 'pathkey' => 'ReferenceBlackWhite', 'pathvalue' => '' - ), + ), 'datetime' => array ( 'name' => 'Date Time', 'pathkey' => 'DateTime', 'pathvalue' => '0/306' - ), + ), 'imagedescription' => array ( 'name' => 'Image Description', 'pathkey' => 'ImageDescription', 'pathvalue' => '0/270' - ), + ), 'make' => array ( 'name' => 'Make', 'pathkey' => 'Make', 'pathvalue' => '0/271' - ), + ), 'model' => array ( 'name' => 'Model', 'pathkey' => 'Model', 'pathvalue' => '0/272' - ), + ), 'software' => array ( 'name' => 'Software', 'pathkey' => 'Software', 'pathvalue' => '0/305' - ), + ), 'artist' => array ( 'name' => 'Artist', 'pathkey' => 'Artist', 'pathvalue' => '0/315' - ), + ), 'copyright' => array ( 'name' => 'Copyright', 'pathkey' => 'Copyright', 'pathvalue' => '0/33432' - ), + ), 'exifversion' => array ( 'name' => 'Exif Version', 'pathkey' => 'ExifVersion', 'pathvalue' => '0/34665/Data/0/36864' - ), + ), 'flashpixversion' => array ( 'name' => 'FlashPix Version', 'pathkey' => 'FlashpixVersion', 'pathvalue' => '0/34665/Data/0/40960' - ), + ), 'colorspace' => array ( 'name' => 'Color Space', 'pathkey' => 'ColorSpace', 'pathvalue' => '0/34665/Data/0/40961' - ), + ), 'componentsconfiguration' => array ( 'name' => 'Components Configuration', 'pathkey' => 'ComponentsConfiguration', 'pathvalue' => '0/34665/Data/0/37121' - ), + ), 'compressedbitsperpixel' => array ( 'name' => 'Compressed Bits Per Pixel', 'pathkey' => 'CompressedBitsPerPixel', 'pathvalue' => '0/34665/Data/0/37122' - ), + ), 'pixelxdimension' => array ( 'name' => 'Pixel X Dimension', 'pathkey' => 'PixelXDimension', 'pathvalue' => '0/34665/Data/0/40962' - ), + ), 'pixelydimension' => array ( 'name' => 'Pixel Y Dimension', 'pathkey' => 'PixelYDimension', 'pathvalue' => '0/34665/Data/0/40963' - ), + ), 'usercomment' => array ( 'name' => 'User Comment', 'pathkey' => 'UserComment', 'pathvalue' => '0/34665/Data/0/37510' - ), + ), 'relatedsoundfile' => array ( 'name' => 'Related Sound File', 'pathkey' => 'RelatedSoundFile', 'pathvalue' => '' - ), + ), 'datetimeoriginal' => array ( 'name' => 'Date Time Original', 'pathkey' => 'DateTimeOriginal', 'pathvalue' => '0/34665/Data/0/36867' - ), + ), 'datetimedigitized' => array ( 'name' => 'Date Time Digitized', 'pathkey' => 'DateTimeDigitized', 'pathvalue' => '0/34665/Data/0/36868' - ), + ), 'subsectime' => array ( 'name' => 'Sub Sec Time', 'pathkey' => 'SubSecTime', 'pathvalue' => '' - ), + ), 'subsectimeoriginal' => array ( 'name' => 'Sub Sec Time Original', 'pathkey' => 'SubSecTimeOriginal', 'pathvalue' => '' - ), + ), 'subsectimedigitized' => array ( 'name' => 'Sub Sec Time Digitized', 'pathkey' => 'SubSecTimeDigitized', 'pathvalue' => '' - ), + ), 'exposuretime' => array ( 'name' => 'Exposure Time', 'pathkey' => 'ExposureTime', 'pathvalue' => '0/34665/Data/0/33434' - ), + ), 'fnumber' => array ( 'name' => 'F Number', 'pathkey' => 'FNumber', 'pathvalue' => '0/34665/Data/0/33437' - ), + ), 'exposureprogram' => array ( 'name' => 'Exposure Program', 'pathkey' => 'ExposureProgram', 'pathvalue' => '0/34665/Data/0/34850' - ), + ), 'spectralsensitivity' => array ( 'name' => 'Spectral Sensitivity', 'pathkey' => 'SpectralSensitivity', 'pathvalue' => '' - ), + ), 'isospeedratings' => array ( 'name' => 'ISO Speed Ratings', 'pathkey' => 'ISOSpeedRatings', 'pathvalue' => '0/34665/Data/0/34855' - ), + ), 'oecf' => array ( 'name' => 'OECF', 'pathkey' => 'OECF', 'pathvalue' => '' - ), + ), 'shutterspeedvalue' => array ( 'name' => 'Shutter Speed Value', 'pathkey' => 'ShutterSpeedValue', 'pathvalue' => '0/34665/Data/0/37377' - ), + ), 'aperturevalue' => array ( 'name' => 'Aperture Value', 'pathkey' => 'ApertureValue', 'pathvalue' => '0/34665/Data/0/37378' - ), + ), 'brightnessvalue' => array ( 'name' => 'Brightness Value', 'pathkey' => 'BrightnessValue', 'pathvalue' => '0/34665/Data/0/37379' - ), + ), 'exposurebiasvalue' => array ( 'name' => 'Exposure Bias Value', 'pathkey' => 'ExposureBiasValue', 'pathvalue' => '0/34665/Data/0/37380' - ), + ), 'maxaperturevalue' => array ( 'name' => 'MaxAperture Value', 'pathkey' => 'MaxApertureValue', 'pathvalue' => '0/34665/Data/0/37381' - ), + ), 'subjectdistance' => array ( 'name' => 'Subject Distance', 'pathkey' => 'SubjectDistance', 'pathvalue' => '0/34665/Data/0/37382' - ), + ), 'meteringmode' => array ( 'name' => 'Metering Mode', 'pathkey' => 'MeteringMode', 'pathvalue' => '0/34665/Data/0/37383' - ), + ), 'lightsource' => array ( 'name' => 'Light Source', 'pathkey' => 'LightSource', 'pathvalue' => '0/34665/Data/0/37384' - ), + ), 'flash' => array ( 'name' => 'Flash', 'pathkey' => 'Flash', 'pathvalue' => '0/34665/Data/0/37385' - ), + ), 'focallength' => array ( 'name' => 'Focal Length', 'pathkey' => 'FocalLength', 'pathvalue' => '0/34665/Data/0/37386' - ), + ), 'subjectarea' => array ( 'name' => 'Subject Area', 'pathkey' => 'SubjectArea', 'pathvalue' => '' - ), + ), 'flashenergy' => array ( 'name' => 'Flash Energy', 'pathkey' => 'FlashEnergy', 'pathvalue' => '' - ), + ), 'spatialfrequencyresponse' => array ( 'name' => 'Spatial Frequency Response', 'pathkey' => 'SpatialFrequencyResponse', 'pathvalue' => '' - ), + ), 'focalplanexresolution' => array ( 'name' => 'Focal Plane X Resolution', 'pathkey' => 'FocalPlaneXResolution', 'pathvalue' => '0/34665/Data/0/41486' - ), + ), 'focalplaneyresolution' => array ( 'name' => 'Foca Plane Y Resolution', 'pathkey' => 'FocalPlaneYResolution', 'pathvalue' => '0/34665/Data/0/41487' - ), + ), 'focalplaneresolutionunit' => array ( 'name' => 'Focal Plane Resolution Unit', 'pathkey' => 'FocalPlaneResolutionUnit', 'pathvalue' => '0/34665/Data/0/41488' - ), + ), 'subjectlocation' => array ( 'name' => 'Subject Location', 'pathkey' => 'SubjectLocation', 'pathvalue' => '' - ), + ), 'exposureindex' => array ( 'name' => 'Exposure Index', 'pathkey' => 'ExposureIndex', 'pathvalue' => '' - ), + ), 'sensingmethod' => array ( 'name' => 'Sensing Method', 'pathkey' => 'SensingMethod', 'pathvalue' => '0/34665/Data/0/41495' - ), + ), 'filesource' => array ( 'name' => 'File Source', 'pathkey' => 'FileSource', 'pathvalue' => '0/34665/Data/0/41728' - ), + ), 'scenetype' => array ( 'name' => 'Scene Type', 'pathkey' => 'SceneType', 'pathvalue' => '0/34665/Data/0/41729' - ), + ), 'cfapattern' => array ( 'name' => 'CFA Pattern', 'pathkey' => 'CFAPattern', 'pathvalue' => '' - ), + ), 'customrendered' => array ( 'name' => 'Custom Rendered', 'pathkey' => 'CustomRendered', 'pathvalue' => '0/34665/Data/0/41985' - ), + ), 'exposuremode' => array ( 'name' => 'Exposure Mode', 'pathkey' => 'ExposureMode', 'pathvalue' => '0/34665/Data/0/41986' - ), + ), 'whitebalance' => array ( 'name' => 'White Balance', 'pathkey' => 'WhiteBalance', 'pathvalue' => '0/34665/Data/0/41987' - ), + ), 'digitalzoomratio' => array ( 'name' => 'Digital Zoom Ratio', 'pathkey' => 'DigitalZoomRatio', 'pathvalue' => '0/34665/Data/0/41988' - ), + ), 'focallengthin35mmfilm' => array ( 'name' => 'Focal Length In 35mm Film', 'pathkey' => 'FocalLengthIn35mmFilm', 'pathvalue' => '' - ), + ), 'scenecapturetype' => array ( 'name' => 'Scene Capture Type', 'pathkey' => 'SceneCaptureType', 'pathvalue' => '0/34665/Data/0/41990' - ), + ), 'gaincontrol' => array ( 'name' => 'Gain Control', 'pathkey' => 'GainControl', 'pathvalue' => '0/34665/Data/0/41991' - ), + ), 'contrast' => array ( 'name' => 'Contrast', 'pathkey' => 'Contrast', 'pathvalue' => '0/34665/Data/0/41992' - ), + ), 'saturation' => array ( 'name' => 'Saturation', 'pathkey' => 'Saturation', 'pathvalue' => '0/34665/Data/0/41993' - ), + ), 'sharpness' => array ( 'name' => 'Sharpness', 'pathkey' => 'Sharpness', 'pathvalue' => '0/34665/Data/0/41994' - ), + ), 'devicesettingdescription' => array ( 'name' => 'Device Setting Description', 'pathkey' => 'DeviceSettingDescription', 'pathvalue' => '' - ), + ), 'subjectdistancerange' => array ( 'name' => 'Subject Distance Range', 'pathkey' => 'SubjectDistanceRange', 'pathvalue' => '' - ), + ), 'imageuniqueid' => array ( 'name' => 'Image Unique ID', 'pathkey' => 'ImageUniqueID', 'pathvalue' => '' - ), + ), 'gpsversionid' => array ( 'name' => 'GPS Version ID', 'pathkey' => 'GPSVersionID', 'pathvalue' => '0/34853/Data/0/0' - ), + ), 'gpslatituderef' => array ( 'name' => 'GPS Latitude Ref', 'pathkey' => 'GPSLatitudeRef', 'pathvalue' => '0/34853/Data/0/1' - ), + ), 'gpslatitude' => array ( 'name' => 'GPS Latitude', 'pathkey' => 'GPSLatitude', 'pathvalue' => '0/34853/Data/0/2' - ), + ), 'gpslongituderef' => array ( 'name' => 'GPS Longitude Ref', 'pathkey' => 'GPSLongitudeRef', 'pathvalue' => '0/34853/Data/0/3' - ), + ), 'gpslongitude' => array ( 'name' => 'GPS Longitude', 'pathkey' => 'GPSLongitude', 'pathvalue' => '0/34853/Data/0/4' - ), + ), 'gpsaltituderef' => array ( 'name' => 'GPS Altitude Ref', 'pathkey' => 'GPSAltitudeRef', 'pathvalue' => '0/34853/Data/0/5' - ), + ), 'gpsaltitude' => array ( 'name' => 'GPS Altitude', 'pathkey' => 'GPSAltitude', 'pathvalue' => '0/34853/Data/0/6' - ), + ), 'gpstimestamp' => array ( 'name' => 'GPS Timestamp', 'pathkey' => 'GPSTimeStamp', 'pathvalue' => '0/34853/Data/0/7' - ), + ), 'gpssatellites' => array ( 'name' => 'GPS Satellites', 'pathkey' => 'GPSSatellites', 'pathvalue' => '0/34853/Data/0/8' - ), + ), 'gpsstatus' => array ( 'name' => 'GPS Status', 'pathkey' => 'GPSStatus', 'pathvalue' => '0/34853/Data/0/9' - ), + ), 'gpsmeasuremode' => array ( 'name' => 'GPS Measure Mode', 'pathkey' => 'GPSMeasureMode', 'pathvalue' => '0/34853/Data/0/10' - ), + ), 'gpsdop' => array ( 'name' => 'GPS DOP', 'pathkey' => 'GPSDOP', 'pathvalue' => '0/34853/Data/0/11' - ), + ), 'gpsspeedref' => array ( 'name' => 'GPS Speed Ref', 'pathkey' => 'GPSSpeedRef', 'pathvalue' => '0/34853/Data/0/12' - ), + ), 'gpsspeed' => array ( 'name' => 'GPS Speed', 'pathkey' => 'GPSSpeed', 'pathvalue' => '0/34853/Data/0/13' - ), + ), 'gpstrackref' => array ( 'name' => 'GPS Track Ref', 'pathkey' => 'GPSTrackRef', 'pathvalue' => '0/34853/Data/0/14' - ), + ), 'gpstrack' => array ( 'name' => 'GPS Track', 'pathkey' => 'GPSTrack', 'pathvalue' => '0/34853/Data/0/15' - ), + ), 'gpsimgdirectionref' => array ( 'name' => 'GPS Img Direction Ref', 'pathkey' => 'GPSImgDirectionRef', 'pathvalue' => '0/34853/Data/0/16' - ), + ), 'gpsimgdirection' => array ( 'name' => 'GPS Img Direction', 'pathkey' => 'GPSImgDirection', 'pathvalue' => '0/34853/Data/0/17' - ), + ), 'gpsmapdatum' => array ( 'name' => 'GPS Map Datum', 'pathkey' => 'GPSMapDatum', 'pathvalue' => '0/34853/Data/0/18' - ), + ), 'gpsdestlatituderef' => array ( 'name' => 'GPS Dest Latitude Ref', 'pathkey' => 'GPSDestLatitudeRef', 'pathvalue' => '0/34853/Data/0/19' - ), + ), 'gpsdestlatitude' => array ( 'name' => 'GPS Dest Latitude', 'pathkey' => 'GPSDestLatitude', 'pathvalue' => '0/34853/Data/0/20' - ), + ), 'gpsdestlongituderef' => array ( 'name' => 'GPS Dest Longitude Ref', 'pathkey' => 'GPSDestLongitudeRef', 'pathvalue' => '0/34853/Data/0/21' - ), + ), 'gpsdestlongitude' => array ( 'name' => 'GPS Dest Longitude', 'pathkey' => 'GPSDestLongitude', 'pathvalue' => '0/34853/Data/0/22' - ), + ), 'gpsdestbearingref' => array ( 'name' => 'GPS Dest Bearing Ref', 'pathkey' => 'GPSDestBearingRef', 'pathvalue' => '0/34853/Data/0/23' - ), + ), 'gpsdestbearing' => array ( 'name' => 'GPS Dest Bearing', 'pathkey' => 'GPSDestBearing', 'pathvalue' => '0/34853/Data/0/24' - ), + ), 'gpsdestdistanceref' => array ( 'name' => 'GPS Dest Distance Ref', 'pathkey' => 'GPSDestDistanceRef', 'pathvalue' => '0/34853/Data/0/25' - ), + ), 'gpsdestdistance' => array ( 'name' => 'GPS Dest Distance', 'pathkey' => 'GPSDestDistance', 'pathvalue' => '0/34853/Data/0/26' - ), + ), 'gpsprocessingmethod' => array ( 'name' => 'GPS Processing Method', 'pathkey' => 'GPSProcessingMethod', 'pathvalue' => '0/34853/Data/0/27' - ), + ), 'gpsareainformation' => array ( 'name' => 'GPS Area Information', 'pathkey' => 'GPSAreaInformation', 'pathvalue' => '0/34853/Data/0/28' - ), + ), 'gpsdatestamp' => array ( 'name' => 'GPS DateStamp', 'pathkey' => 'GPSDateStamp', 'pathvalue' => '0/34853/Data/0/29' - ), + ), 'gpsdifferential' => array ( 'name' => 'GPS Differential', 'pathkey' => 'GPSDifferential', 'pathvalue' => '0/34853/Data/0/30' - ), + ), 'jpegcomment' => array ( 'name' => 'JPEG Comment', 'pathkey' => 'JpegComment', 'pathvalue' => '' - ), - - ), - - ); + ), + ), + + ); + } /* vi: set ts=4 sw=4 sts=4 */ ?> Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-31 19:57:11 UTC (rev 4845) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-02-01 13:37:03 UTC (rev 4846) @@ -24,11 +24,22 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; -/* + $GPXData = new LinXmlParser(); $array_with_gpx = $GPXData->readXmlFile('/tmp/sample.gpx'); -echo "<pre>", print_r($array_with_gpx), "</pre>"; -*/ +$track_times = $GPXData->getGpxTimeRange($array_with_gpx); +$image_times = $GPXData->getImageTimeRange(19); +if($GPXData->compareTimeRanges($track_times, $image_times)) +{ + echo " ALL OK"; + } + else + { + echo "TRACK ERROR"; + } + +//echo "<pre>", print_r($array_with_gpx), "</pre>"; + /** * xml load/save stuff */ Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-01-31 19:57:11 UTC (rev 4845) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-01 13:37:03 UTC (rev 4846) @@ -18,7 +18,9 @@ */ if(!defined('TOP_DIR')) { define('TOP_DIR','../../'); } +//include_once LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'; + /** * Class to parse Garmin GPX files and return values for * latitiude, longitude, elevation, time and more. @@ -27,12 +29,13 @@ class LinXmlParser { private $data, $parser, $filename, $values, $index_array; - private $data_range, $gpx, $xml_data; + private $data_range, $gpx, $xml_data , $meta_data; function __construct() { } + /** * This method reads all trackpoints and related data from an xml file and * returns them as an array, example: @@ -131,7 +134,142 @@ return $this->gpx; } -} + /** + * This method checks for start and end date/time for the gpx file + * @param array with all trkpt informtion from file + * @return array (starttime, endtime); + * @author bzrudi + */ + public function getGpxTimeRange($gpx_data) + { + $date_min = '9999999999'; + $date_max = '0'; + + foreach($gpx_data AS $key => $value) + { + if(isset($value['time'])) + { + $current_time = $this->date2unixTime($value['time']); + + if($current_time < $date_min) + { + $date_min = $current_time; + } + elseif($current_time > $date_max) + { + $date_max = $current_time; + } + + } + } + echo "MIN ".$date_min." -- "; + echo "MAX ".$date_max; + echo " DIFF ".($date_max - $date_min)."<br>"; + echo "TRACK START AM:".date("Y-m-d, H-i-s", $date_min); + echo " TRACK ENDE UM:".date("Y-m-d, H-i-s", $date_max)."<br>"; + + return array("starttime" => $date_min, "endtime" => $date_max); + } + + + /** + * This method checks parses all images in folder and get's start and + * end date/time. + * @param int parent_id for images to parse + * @return array (starttime, endtime); + * @author bzrudi + */ + public function getImageTimeRange($parent_id) + { + $date_min = '9999999999'; + $date_max = '0'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id " . +... [truncated message content] |
From: <bz...@us...> - 2008-01-31 19:57:25
|
Revision: 4845 http://linpha.svn.sourceforge.net/linpha/?rev=4845&view=rev Author: bzrudi Date: 2008-01-31 11:57:11 -0800 (Thu, 31 Jan 2008) Log Message: ----------- remove test xml output Modified Paths: -------------- trunk/linpha2/lib/plugins/maps/module.maps.php Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-31 19:54:28 UTC (rev 4844) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-31 19:57:11 UTC (rev 4845) @@ -24,11 +24,11 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; - +/* $GPXData = new LinXmlParser(); $array_with_gpx = $GPXData->readXmlFile('/tmp/sample.gpx'); echo "<pre>", print_r($array_with_gpx), "</pre>"; - +*/ /** * xml load/save stuff */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-01-31 19:54:36
|
Revision: 4844 http://linpha.svn.sourceforge.net/linpha/?rev=4844&view=rev Author: bzrudi Date: 2008-01-31 11:54:28 -0800 (Thu, 31 Jan 2008) Log Message: ----------- First draft for the XML parser class (xml_parser.class.php) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/plugins/maps/module.maps.php Added Paths: ----------- trunk/linpha2/lib/plugins/maps/xml_parser.class.php Removed Paths: ------------- trunk/linpha2/lib/plugins/maps/garmingpx_parser.class.php trunk/linpha2/lib/plugins/maps/gpx.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-31 13:01:02 UTC (rev 4843) +++ trunk/linpha2/ChangeLog 2008-01-31 19:54:28 UTC (rev 4844) @@ -6,7 +6,8 @@ - code cleanups - still work in progress - btw - installer looks fine - + * First draft for the XML parser class (xml_parser.class.php) + 2008-01-30 flo * installer - improved layout Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-31 13:01:02 UTC (rev 4843) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-31 19:54:28 UTC (rev 4844) @@ -29,7 +29,6 @@ */ class LinMetaData { - public $defined_fields, $available_fields; protected $objMetaTool; private $cachedFieldNames, $cachedFieldIds, $cachedSelectedFieldNames; @@ -1029,6 +1028,15 @@ } /** + * Parse GPX data from file + */ + public function parseGpxFile($filename) + { + $parser = new GpxParser($filename); + + } + + /** * Simple wrapper method for saveMetaData() * @param string $what meta type exif,iptc,xmp * @param string $filename filename @@ -1193,5 +1201,6 @@ return $rotate; } } + /* vi: set ts=4 sw=4 sts=4 */ ?> Deleted: trunk/linpha2/lib/plugins/maps/garmingpx_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/garmingpx_parser.class.php 2008-01-31 13:01:02 UTC (rev 4843) +++ trunk/linpha2/lib/plugins/maps/garmingpx_parser.class.php 2008-01-31 19:54:28 UTC (rev 4844) @@ -1,84 +0,0 @@ -<?php -/* -* Copyright (c) 2004 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','../../'); } - -/** -* Class to parse Garmin GPX files and return values for -* latitiude, longitude, elevation, time and more. Makes use of libxml -* to read XML data -> requires php >= 4.2.0! -* -* @author bzrudi -*/ -class GpxParser -{ - -var $xmldata; //protected -var $parsedata; //protected -var $filename; //protected - -/** - * Constructor - */ -function GpxParser($filename) -{ - include_once(TOP_DIR.'/plugins/maps/libxml/IsterXmlSimpleXMLImpl.php'); - $xmlreader = new IsterXmlSimpleXMLImpl; - $this->xmldata = $xmlreader->load_file($filename); - $this->filename = $filename; -} - -/** - * This method checks whether file contains waypoints (wpt) or trackpoints - * (trkpt) or even routepoints (rtp) and takes good care of - * how we handle them. - * - * @param none - * @return array returns only XmlData and filetype - * @author bzrudi - */ -function getGpxFileType() -{ - $this->parsedata = file_get_contents($this->filename); - - if(strpos($this->parsedata, 'trkpt')) - { - echo "TRACKFILE DETECTED"; - return array($this->xmldata, 'trkpt'); - } - elseif(strpos($this->parsedata, 'rtept')) - { - echo "ROUTEFILE DETECTED"; - return array($this->xmldata, 'rtept'); - } - elseif(strpos($this->parsedata, 'wpt')) - { - echo "WAYFILE DETECTED"; - return array($this->xmldata, 'wpt'); - } - else - { - echo "CANNOT DETECT INPUT FILE FORMAT"; - return array('dummy', 'failed'); - } -} - -} // end class -?> - Deleted: trunk/linpha2/lib/plugins/maps/gpx.php =================================================================== --- trunk/linpha2/lib/plugins/maps/gpx.php 2008-01-31 13:01:02 UTC (rev 4843) +++ trunk/linpha2/lib/plugins/maps/gpx.php 2008-01-31 19:54:28 UTC (rev 4844) @@ -1,99 +0,0 @@ -<?php -/** - * This method parses an XML file (currently in Garmin GPX format) and saves - * all available information in the DB - * - * @param string filename - * @author bzrudi - */ -function parseXMLDataFile($filename) -{ - -$gpxparser = new GpxParser($filename); -list($xmldata, $filetype) = $gpxparser->getGpxFileType(); - - switch($filetype) - { - case "trkpt": - { - foreach( $xmldata->gpx->trk->trkseg->trkpt as $trkinfo) - { - $latlon = $trkinfo->attributes(); //array(lat,lon) - - $lat = $latlon['lat']; - $lon = $latlon['lon']; - $ele = $trkinfo->ele->CDATA(); - $time = $trkinfo->time->CDATA(); - - //echo"LAT:".$lat."LON:".$lon."ELE:".$ele."<br>"; - - $location = new Location($lat, $lon, '<div class="someCssClass">' . - 'LAT: '.$lat.'<br>' . - 'LON: '.$lon.'<br>' . - 'HÖHE: '.$ele.'m<br>' . - 'DATE: '.$time.'</div>'); - $this->cmap->addLocation($location); - } - break; - } - - case "rtept": - { - foreach( $xmldata->gpx->rte->rtept as $pointinfo) - { - $latlon = $pointinfo->attributes(); //array(lat,lon) - - $lat = $latlon['lat']; - $lon = $latlon['lon']; - //$ele = $pointinfo->ele->CDATA(); - //$name = $pointinfo->name->CDATA(); - - //echo"LAT:".$lat."LON:".$lon."ELE:".$ele."NAME:".$name."<br>"; - - $location = new Location($lat, $lon, '<div class="someCssClass">' . - 'LAT: '.$lat.'<br>' . - 'LON: '.$lon.'<br>' . - 'HÖHE: na<br>' . - 'Name: na</div>'); - $this->cmap->addLocation($location); - } - break; - } - - case "wpt": - { - foreach( $xmldata->gpx->wpt as $wpointinfo) - { - $latlon = $wpointinfo->attributes(); //array(lat,lon) - - $lat = $latlon['lat']; - $lon = $latlon['lon']; - $ele = $wpointinfo->ele->CDATA(); - $name = $wpointinfo->name->CDATA(); - $cmt = $wpointinfo->cmt->CDATA(); - //$desc = $wpointinfo->desc->CDATA(); - $sym = $wpointinfo->sym->CDATA(); - - //echo"LAT: ".$lat."LON: ".$lon."ELE: ".$ele."NAME: ".$name." " . - // "CMT: ".$cmt."SYMBOL: ".$sym."<br>"; - - $location = new Location($lat, $lon, '<div class="someCssClass">' . - 'LAT: '.$lat.'<br>' . - 'LON: '.$lon.'<br>' . - 'ELE: '.$ele.'m<br>' . - 'NAM: '.$name.'<br>' . - 'CMT: '.$cmt.'<br>' . - 'SYM: '.$sym.'<br></div>'); - $this->cmap->addLocation($location); - } - break; - } - case "failed": - { - echo "CANNOT DETECT INPUT FILE FORMAT"; - } - } -} - - - Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-31 13:01:02 UTC (rev 4843) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-31 19:54:28 UTC (rev 4844) @@ -23,10 +23,13 @@ * @package Plugins */ if(!defined('LINPHA_DIR')) { exit(1); } +include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; -/* $MetaData = new LinMetaData(); - $MetaData->importGeoData();*/ -/** +$GPXData = new LinXmlParser(); +$array_with_gpx = $GPXData->readXmlFile('/tmp/sample.gpx'); +echo "<pre>", print_r($array_with_gpx), "</pre>"; + +/** * xml load/save stuff */ if(isset($_GET['xml'])) Copied: trunk/linpha2/lib/plugins/maps/xml_parser.class.php (from rev 4841, trunk/linpha2/lib/plugins/maps/garmingpx_parser.class.php) =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php (rev 0) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-01-31 19:54:28 UTC (rev 4844) @@ -0,0 +1,137 @@ +<?php +/* + * Copyright (c) 2004 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','../../'); } + +/** + * Class to parse Garmin GPX files and return values for + * latitiude, longitude, elevation, time and more. + * @author bzrudi + */ +class LinXmlParser +{ + private $data, $parser, $filename, $values, $index_array; + private $data_range, $gpx, $xml_data; + + function __construct() + { + + } + /** + * This method reads all trackpoints and related data from an xml file and + * returns them as an array, example: + * [685] => Array + * ( + * [trkpt] => Array + * ( + * [lon] => 7.715998599305749 + * [lat] => 50.1166464574635 + * ) + * + * [ele] => 191.92 + * [time] => 2007-12-23T13:31:50Z + * [extension] => + * [flags] => 0 + * ) + * + * @param string $filename + * @return array with all trackpoints + */ + public function readXmlFile($filename) + { + /** + * open and parse xml file for Track data + */ + $this->data = file_get_contents($filename); + $this->parser = xml_parser_create(); + + /** + * lowercase tags + */ + xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); + xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1); + + /** + * This function returns two arrays, one for the index and one for + * the values. + */ + xml_parse_into_struct($this->parser, $this->data, $this->values, $this->index_array); + xml_parser_free($this->parser); + + /** + * Loop through index array to find all occurencies of "trkpt" + */ + foreach($this->index_array AS $key => $val) + { + if($key == "trkpt") // hit + { + $this->data_range = $val; + + for($i=0; $i < count($this->data_range); $i+=2) + { + $offset = $this->data_range[$i]; + $len = $this->data_range[$i + 1] - $offset; + $this->xml_data[] = $this->parseXmlArray(array_slice($this->values, $offset, $len)); + } + } + else + { + continue; + } + } + return $this->xml_data; + } + + /** + * This is just an helper/wrapper method for readXmlFile() and is called + * for each trkpoint data entry from readXmlFile(). + * + * @param array $sliced_arrav + * @return unknown + */ + private function parseXmlArray($sliced_array) + { + for($i=0; $i < count($sliced_array); $i++) + { + /** + * Trkpt data is somewhat other to handle than ele and time data, + * as the return is an array. + */ + if($sliced_array[$i]["tag"] == "trkpt") + { + $this->gpx[$sliced_array[$i]["tag"]] = @$sliced_array[$i]["attributes"]; + } + + /** + * This is anything beetween the <trkpt> and </trkpt> tag + */ + else + { + $this->gpx[$sliced_array[$i]["tag"]] = @$sliced_array[$i]["value"]; + } + } + + //return new LinXmlParser($this->gpx); + return $this->gpx; + + } +} + +/* vi: set ts=4 sw=4 sts=4 */ +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-01-31 13:01:25
|
Revision: 4843 http://linpha.svn.sourceforge.net/linpha/?rev=4843&view=rev Author: bzrudi Date: 2008-01-31 05:01:02 -0800 (Thu, 31 Jan 2008) Log Message: ----------- add auto import hint Modified Paths: -------------- trunk/linpha2/lib/plugins/maps/settings.maps.php Modified: trunk/linpha2/lib/plugins/maps/settings.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-31 12:27:25 UTC (rev 4842) +++ trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-31 13:01:02 UTC (rev 4843) @@ -94,7 +94,15 @@ i18n("Auto Import Geotagged Images"), 'plugins_maps_geotagged_autoimport', $LinAdmin->option_value_system['plugins_maps_geotagged_autoimport'] - ); +); } +if($GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged'] +&& !$GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport']) +{ + echo i18n("Auto import of geotagged images is disabled, so remember to import them"); + echo ' <a href="./?cat=maintenance">'.i18n("manually").'</a>.'; +}; + +/* vi: set ts=4 sw=4 sts=4 */ ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-01-31 12:36:16
|
Revision: 4842 http://linpha.svn.sourceforge.net/linpha/?rev=4842&view=rev Author: bzrudi Date: 2008-01-31 04:27:25 -0800 (Thu, 31 Jan 2008) Log Message: ----------- more improvements in maps plugin Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.exiftool.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.pjmt.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/plugins/maps/module.maps.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-30 21:08:44 UTC (rev 4841) +++ trunk/linpha2/ChangeLog 2008-01-31 12:27:25 UTC (rev 4842) @@ -1,4 +1,12 @@ - +2008-01-31 bzrudi + * Maps plugin + - all DBs should work now (untestet) + - PJMT and exiftool should work now + - add admin options to enable/disable geodata and autoimport + - code cleanups + - still work in progress + - btw - installer looks fine + 2008-01-30 flo * installer - improved layout Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 21:08:44 UTC (rev 4841) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-31 12:27:25 UTC (rev 4842) @@ -173,14 +173,13 @@ return $metaArray; } - /** * Save all MetaData to database * @param string $filename filename to parse for MetaData * @param string $md5sum md5sum of file * @param string $tag save EXIF, IPTC or XMP MetaData */ - function saveMetaData($filename, $md5sum, $tag) + public function saveMetaData($filename, $md5sum, $tag) { $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); @@ -325,7 +324,6 @@ } } - /** * Define array with allowed IPTC/XMP tags and human readable translation * @param none Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2008-01-30 21:08:44 UTC (rev 4841) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2008-01-31 12:27:25 UTC (rev 4842) @@ -1,257 +1,257 @@ <?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. -*/ + * 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. + */ /** * This class provides a couple methods for image manipulation/creation * @package Image */ - + if(!defined('LINPHA_DIR')) { exit(1); } class LinImage { -public $error_msg; -public $output_file; + public $error_msg; + public $output_file; -public $photo_id, $cached_id; -public $isCached; -public $mode; -public $img_type, $org_width, $org_height, $rotate; + public $photo_id, $cached_id; + public $isCached; + public $mode; + public $img_type, $org_width, $org_height, $rotate; -private $src_file; -private $img_width, $img_height; -private $img_quality; -private $imageTool; + private $src_file; + private $img_width, $img_height; + private $img_quality; + private $imageTool; -/** - * constructor - */ -function __construct() -{ -} + /** + * constructor + */ + function __construct() + { + } -function setFileInformation() -{ - /** - * check for valid id - * and get img_type and rotate informations - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type, rotate, width, height " . + function setFileInformation() + { + /** + * check for valid id + * and get img_type and rotate informations + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type, rotate, width, height " . "FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes( $this->photo_id )."'"); - if( $query->EOF ) // not a single value returned - { - $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; - } + if( $query->EOF ) // not a single value returned + { + $this->error_msg = "wrong id supplied!"; + return false; + } - /** - * checke force parameter - */ - if( isset($_GET['force'] ) ) { - $this->force = true; - } else { - $this->force = false; - } + $data = $query->FetchRow(); - /** - * set additional informations - */ - $this->rotate = $data['rotate']; - $this->img_type = $data['img_type']; - $this->org_width = $data['width']; - $this->org_height = $data['height']; - $this->setCachedInfos(); - - /** - * check if file already exists OR if forced - */ - if( file_exists( $this->output_file ) AND !$this->force ) - { - $this->isCached = true; - } - else // !file_exists() OR $this->force - { - $this->isCached = false; + if( ! LinSql::photoIsAllowed( $data['id'] ) ) + { + $this->error_msg = "not permitted!"; + return false; + } - /** - * create subfolder if needed - */ - if( ! file_exists( dirname($this->output_file) ) ) - { - if( ! @mkdir( dirname($this->output_file) ) ) - { - $this->error_msg = "Cannot create folder ".dirname($this->output_file)." check permissions!"; - return false; - } - } + if($this->mode == 'img' && ! LinIdentify::isSupportedImage( $data['img_type'] ) ) + { + $this->error_msg = "only images possible!"; + return false; + } - /** - * use imagemagick or gdlib - */ - if($GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) - { - include_once(LINPHA_DIR.'/lib/classes/image/linpha.imagemagick.class.php'); - - $this->imageTool = new LinImageMagick(); - $this->imageTool->imagemagickPath = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path']; - } - else - { - include_once(LINPHA_DIR.'/lib/classes/image/linpha.gdlib.class.php'); - - $this->imageTool = new LinGDLib(); - $this->imageTool->imgType = $this->img_type; - } + /** + * checke force parameter + */ + if( isset($_GET['force'] ) ) { + $this->force = true; + } else { + $this->force = false; + } - $this->imageTool->imgQuality = $this->img_quality; - $this->imageTool->orgWidth = $this->org_width; - $this->imageTool->orgHeight = $this->org_height; - } - - return true; -} + /** + * set additional informations + */ + $this->rotate = $data['rotate']; + $this->img_type = $data['img_type']; + $this->org_width = $data['width']; + $this->org_height = $data['height']; + $this->setCachedInfos(); -/** - * 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; + /** + * check if file already exists OR if forced + */ + if( file_exists( $this->output_file ) AND !$this->force ) + { + $this->isCached = true; + } + else // !file_exists() OR $this->force + { + $this->isCached = false; - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id,$this->img_type); - } - 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_width']; - $this->max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; - } - - /** - * update rotate (printing, ...) if applicable (no else() !! ) - * the rotate value from the database is read earlier - */ - if(isset($this->overrideSettings['rotate'])) - { - $this->rotate = $this->overrideSettings['rotate']; - } - - /** - * watermark (true|false) - */ - 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']); - } + /** + * create subfolder if needed + */ + if( ! file_exists( dirname($this->output_file) ) ) + { + if( ! @mkdir( dirname($this->output_file) ) ) + { + $this->error_msg = "Cannot create folder ".dirname($this->output_file)." check permissions!"; + return false; + } + } - /** - * 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; - } + /** + * use imagemagick or gdlib + */ + if($GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) + { + include_once(LINPHA_DIR.'/lib/classes/image/linpha.imagemagick.class.php'); + + $this->imageTool = new LinImageMagick(); + $this->imageTool->imagemagickPath = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path']; + } + else + { + include_once(LINPHA_DIR.'/lib/classes/image/linpha.gdlib.class.php'); + + $this->imageTool = new LinGDLib(); + $this->imageTool->imgType = $this->img_type; + } - /** - * this results in fliped img_width and img_height for later photos_cache - * compare, we take care of it below... - */ - $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']; + $this->imageTool->imgQuality = $this->img_quality; + $this->imageTool->orgWidth = $this->org_width; + $this->imageTool->orgHeight = $this->org_height; + } - /** - * check if entry in linpha_photos_cache exists - */ - /** - * Take care of fliped img_width and img_height, or it will result in a - * cache hit miss (scaleToFit() (above) takes the width and height from - * photos table, where values are wrong for images which need rotate) - */ - $rot = $GLOBALS['linpha']->db->GetRow("SELECT is_rotated, img_width, img_height " . + return true; + } + + /** + * 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,$this->img_type); + } + 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_width']; + $this->max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; + } + + /** + * update rotate (printing, ...) if applicable (no else() !! ) + * the rotate value from the database is read earlier + */ + if(isset($this->overrideSettings['rotate'])) + { + $this->rotate = $this->overrideSettings['rotate']; + } + + /** + * watermark (true|false) + */ + 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; + } + + /** + * this results in fliped img_width and img_height for later photos_cache + * compare, we take care of it below... + */ + $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 + */ + /** + * Take care of fliped img_width and img_height, or it will result in a + * cache hit miss (scaleToFit() (above) takes the width and height from + * photos table, where values are wrong for images which need rotate) + */ + $rot = $GLOBALS['linpha']->db->GetRow("SELECT is_rotated, img_width, img_height " . "FROM ".LIN_PREFIX."photos_cache " . "WHERE photo_id = '".$this->photo_id."' "); - if(isset($rot['is_rotated']) && $rot['is_rotated'] != 0) - { - - $dummy_height = $this->img_height; - $this->img_height = $this->img_width; - $this->img_width = $dummy_height; - linLog(LOG_TYPE_IMPORT,LOG_INFO,'debug',"Flipping width and height to get cache hit for image # ".$this->photo_id); - } - - $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE " . + if(isset($rot['is_rotated']) && $rot['is_rotated'] != 0) + { + + $dummy_height = $this->img_height; + $this->img_height = $this->img_width; + $this->img_width = $dummy_height; + linLog(LOG_TYPE_IMPORT,LOG_INFO,'debug',"Flipping width and height to get cache hit for image # ".$this->photo_id); + } + + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE " . "photo_id = '".$this->photo_id."' AND " . "img_width = '".$this->img_width."' AND " . "img_height = '".$this->img_height."' AND " . @@ -259,411 +259,410 @@ "is_rotated = '".$this->rotate."' AND " . "has_watermark = '".$this->watermark."'"); - if(isset($data['id']) && !empty($data['id'])) - { - linLog(LOG_TYPE_IMPORT,LOG_INFO,'debug',"Cache HIT for image # ".$this->photo_id); + if(isset($data['id']) && !empty($data['id'])) + { + linLog(LOG_TYPE_IMPORT,LOG_INFO,'debug',"Cache HIT for image # ".$this->photo_id); - $this->cached_id = $data['id']; - $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); - } - else - { - linLog( LOG_TYPE_IMPORT,LOG_INFO,'image',"Cache MISS for image # ".$this->photo_id); - - - /** - * 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 ".LIN_PREFIX."photos_cache " . + $this->cached_id = $data['id']; + $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); + } + else + { + linLog( LOG_TYPE_IMPORT,LOG_INFO,'image',"Cache MISS for image # ".$this->photo_id); + + + /** + * 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 ".LIN_PREFIX."photos_cache " . "(photo_id) VALUES ('".$this->photo_id."')"); - - $this->cached_id = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) " . + + $this->cached_id = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) " . "FROM ".LIN_PREFIX."photos_cache "); - $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); - - if(file_exists($this->output_file)) - { - /** - * o-oh, we're leaking old files in cache path, -> delete it - */ - unlink($this->output_file); - } - } - } + $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); + + if(file_exists($this->output_file)) + { + /** + * o-oh, we're leaking old files in cache path, -> delete it + */ + unlink($this->output_file); + } + } + } - -} -/** - * set source file informations - * - * @todo save values to database and read from there - */ -function setSourceFileInformation() -{ - if($this->img_type != 0 && $this->img_type != 9999999) - { - $this->src_file = LinSql::getFullImagePath( $this->photo_id ); + } - 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; - } - } - - return true; -} + /** + * set source file informations + * + * @todo save values to database and read from there + */ + function setSourceFileInformation() + { + if($this->img_type != 0 && $this->img_type != 9999999) + { + $this->src_file = LinSql::getFullImagePath( $this->photo_id ); + 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; + } + } -/** - * thumbnail functions - * - * @return true on success, false on failure (checks for valid id, valid image, valid permission!) - */ - function createThumbnail($photo_id) - { - $this->mode = 'thumb'; - $this->photo_id = $photo_id; + return true; + } - if( ! $this->setFileInformation() ) - { - return false; - } - - if( ! $this->isCached ) - { - if( ! $this->setSourceFileInformation() ) - { - return false; - } - - linLog(LOG_TYPE_IMPORT,LOG_INFO,'thumbnail',"Creating thumbnail ".$this->photo_id); + /** + * thumbnail functions + * + * @return true on success, false on failure (checks for valid id, valid image, valid permission!) + */ + function createThumbnail($photo_id) + { + $this->mode = 'thumb'; + $this->photo_id = $photo_id; - /** - * 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( ! $this->setFileInformation() ) + { + return false; + } - if( ! file_exists( $this->output_file ) ) - { - $this->error_msg = "Output File Doesnt Exists"; - return false; - } - } - - return true; - } - - function createThumbnailImage() - { - /** - * Exiftool can be used to extract the embedded thumbnail within the - * EXIF segment of the image. Most cameras support it. - * It is usually 5-10 times faster than using convert and is perfect - * when low on memory or with older CPU, even so the thumbs didn't look - * that nice as the ones created with convert ;-) - */ - if($GLOBALS['linpha']->sql->config->value['sys_import_use_emb_thumb']) + if( ! $this->isCached ) { - include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); - - $objExifTool = new LinExifTool; + if( ! $this->setSourceFileInformation() ) + { + return false; + } - /** - * Default fallback if image doesn't contain embedded thumb - */ - if(!$objExifTool->getEmbeddedThumbnail($this->src_file, $this->output_file)) - { - $this->imageTool->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - $this->imageTool->imgQuality = 75; + linLog(LOG_TYPE_IMPORT,LOG_INFO,'thumbnail',"Creating thumbnail ".$this->photo_id); - $this->imageTool->createThumbnail($this->src_file,$this->output_file,$this->rotate); - } + /** + * 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 ) ) + { + $this->error_msg = "Output File Doesnt Exists"; + return false; + } } + + return true; + } + + function createThumbnailImage() + { + /** + * Exiftool can be used to extract the embedded thumbnail within the + * EXIF segment of the image. Most cameras support it. + * It is usually 5-10 times faster than using convert and is perfect + * when low on memory or with older CPU, even so the thumbs didn't look + * that nice as the ones created with convert ;-) + */ + if($GLOBALS['linpha']->sql->config->value['sys_import_use_emb_thumb']) + { + include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); + + $objExifTool = new LinExifTool; + + /** + * Default fallback if image doesn't contain embedded thumb + */ + if(!$objExifTool->getEmbeddedThumbnail($this->src_file, $this->output_file)) + { + $this->imageTool->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->imageTool->imgQuality = 75; + + $this->imageTool->createThumbnail($this->src_file,$this->output_file,$this->rotate); + } + } else { /** - * include the file which contains the imagemagick strings and exec() / gdlib instructions - */ + * include the file which contains the imagemagick strings and exec() / gdlib instructions + */ $this->imageTool->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; $this->imageTool->imgQuality = 75; $this->imageTool->createThumbnail($this->src_file,$this->output_file,$this->rotate); } - } - - function createThumbnailFolder() - { - /** - * 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, img_type FROM ".LIN_PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); - $array_thumbs = Array(); - $i=0; - while($data = $query->FetchRow()) - { - if($i >= 4) - { - break; - } - - $file = LinImage::getCachePath('thumb',$data['id'],$data['img_type']); + } - if( file_exists( $file ) ) - { - if($data['1']=='0') { // folders are gif files, all others are jpg - $type = '1'; - } else { - $type = '2'; - } + function createThumbnailFolder() + { + /** + * 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, img_type FROM ".LIN_PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); + $array_thumbs = Array(); + $i=0; + while($data = $query->FetchRow()) + { + if($i >= 4) + { + break; + } + + $file = LinImage::getCachePath('thumb',$data['id'],$data['img_type']); - $array_thumbs[] = array('id' => $data['id'],'file' => $file, 'type' => $type); - $i++; - } - } - - /** - * no images found in this folder - */ - if(count($array_thumbs) == 0) - { - return false; - } + if( file_exists( $file ) ) + { + if($data['1']=='0') { // folders are gif files, all others are jpg + $type = '1'; + } else { + $type = '2'; + } - $this->imageTool->createThumbnailFolder($this->output_file,$array_thumbs); - - if( !file_exists($this->output_file)) - { - return false; - } - else - { - return true; - } - } - - function createThumbnailVideo() - { - $dummy_thumbnail = LINPHA_DIR.'/lib/graphics/video.jpg'; - $this->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - $this->img_quality = 75; - //$this->imageTool->orgWidth = 320; - //$this->imageTool->orgHeight = 240; + $array_thumbs[] = array('id' => $data['id'],'file' => $file, 'type' => $type); + $i++; + } + } + + /** + * no images found in this folder + */ + if(count($array_thumbs) == 0) + { + return false; + } + + $this->imageTool->createThumbnailFolder($this->output_file,$array_thumbs); + + if( !file_exists($this->output_file)) + { + return false; + } + else + { + return true; + } + } + + function createThumbnailVideo() + { + $dummy_thumbnail = LINPHA_DIR.'/lib/graphics/video.jpg'; + $this->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->img_quality = 75; + //$this->imageTool->orgWidth = 320; + //$this->imageTool->orgHeight = 240; $video_thumbnail_created = false; - - /** - * check if there exists a .thm file - * (video thumbnail of Canon videos) - */ - $pos = strrpos($this->src_file,'.'); - $start = substr($this->src_file,0,$pos); - $thm_file = $start.'.thm'; - - if(file_exists($thm_file)) - { - list($this->org_width, $this->org_height, $file_type) = - LinIdentify::linGetImageSize($thm_file); - + + /** + * check if there exists a .thm file + * (video thumbnail of Canon videos) + */ + $pos = strrpos($this->src_file,'.'); + $start = substr($this->src_file,0,$pos); + $thm_file = $start.'.thm'; + + if(file_exists($thm_file)) + { + list($this->org_width, $this->org_height, $file_type) = + LinIdentify::linGetImageSize($thm_file); + $this->src_file = $thm_file; - $this->imageTool->orgWidth = $this->org_width; - $this->imageTool->orgHeight = $this->org_height; - $this->imageTool->imgType = $file_type; - $this->imageTool->img_thumbsize = $this->img_thumbsize; - $this->imageTool->imgQuality = 75; - $this->imageTool->createThumbnail($this->src_file,$this->output_file,$this->rotate); - $video_thumbnail_created = true; - } - - if(!$video_thumbnail_created) - { - /** + $this->imageTool->orgWidth = $this->org_width; + $this->imageTool->orgHeight = $this->org_height; + $this->imageTool->imgType = $file_type; + $this->imageTool->img_thumbsize = $this->img_thumbsize; + $this->imageTool->imgQuality = 75; + $this->imageTool->createThumbnail($this->src_file,$this->output_file,$this->rotate); + $video_thumbnail_created = true; + } + + if(!$video_thumbnail_created) + { + /** * try getting thumbnail with exiftool if requested */ - if($GLOBALS['linpha']->sql->config->value['sys_im_video_thumbnail'] && - $GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail'] ) - { - include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); + if($GLOBALS['linpha']->sql->config->value['sys_im_video_thumbnail'] && + $GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail'] ) + { + include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); $objExifTool = new LinExifTool(); if($objExifTool->getEmbeddedThumbnail($this->src_file, $this->output_file)) { /** * get width and height from thumb - - list($this->org_width, $this->org_height, $file_type) = - LinIdentify::linGetImageSize($this->src_file); - - $this->imageTool->orgWidth = $this->org_width; - $this->imageTool->orgHeight = $this->org_height; - */ - $video_thumbnail_created = true; + + list($this->org_width, $this->org_height, $file_type) = + LinIdentify::linGetImageSize($this->src_file); + + $this->imageTool->orgWidth = $this->org_width; + $this->imageTool->orgHeight = $this->org_height; + */ + $video_thumbnail_created = true; } else // try getting at least codec for imagemagick { - /** - * only if codec is mjpg, because otherwise we get an access - * violation message box on the servers desktop of convert.exe - * (already reported to imagemagick http://studio. imagemagick. - * org/magick/viewtopic.php?t=2868) - */ - $file_info = $objExifTool->readMetaDataFromFile("all", $this->src_file); - - if(isset($file_info['Codec']) && - $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) - { - $codec = strtolower($file_info['Codec']); - if(strpos($codec, "mjpeg") !== false - OR strpos($codec, "motion jpeg") !== false - OR strpos($codec, "motion jpg") !== false - OR strpos($codec, "mjpg") !== false) - { - $return_value = $this->imageTool->createThumbnailVideo($this->src_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize); - - if($return_value == 0 && file_exists($this->output_file)) /* && empty($array_output[0]) */ - { - $video_thumbnail_created = true; - } - else - { - $video_thumbnail_created = false; - } - } - } - else - { - $video_thumbnail_created = false; - } + /** + * only if codec is mjpg, because otherwise we get an access + * violation message box on the servers desktop of convert.exe + * (already reported to imagemagick http://studio. imagemagick. + * org/magick/viewtopic.php?t=2868) + */ + $file_info = $objExifTool->readMetaDataFromFile("all", $this->src_file); + + if(isset($file_info['Codec']) && + $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick']) + { + $codec = strtolower($file_info['Codec']); + if(strpos($codec, "mjpeg") !== false + OR strpos($codec, "motion jpeg") !== false + OR strpos($codec, "motion jpg") !== false + OR strpos($codec, "mjpg") !== false) + { + $return_value = $this->imageTool->createThumbnailVideo($this->src_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize); + + if($return_value == 0 && file_exists($this->output_file)) /* && empty($array_output[0]) */ + { + $video_thumbnail_created = true; + } + else + { + $video_thumbnail_created = false; + } + } + } + else + { + $video_thumbnail_created = false; + } } - } - else - { - $video_thumbnail_created = false; - } - } - - /** - * copy the video icon in the lower right corner - */ - if($video_thumbnail_created) - { - /** - * watermark currently broken - image scaling wrong and distorted - * also - so disable temporary (flo?) - */ - /* - include_once(LINPHA_DIR.'/lib/plugins/watermark/func.watermark.php'); - $this->imageTool->wm_config = Array( - 'wm_watermark' => 2, - 'wm_align' => 'southeast', - 'wm_dissolve' => 100, - 'wm_img_img' => $dummy_thumbnail, - 'wm_resize' => 'no', // use 'no' because the gdlib cannot handle transparent images with imagecopyresized() !! - 'wm_horizontal' => 5, - 'wm_vertical' => 5 - ); - */ - /** - * warning: session will be closed! - */ - //$this->imageTool->orgWidth = $this->img_thumbsize; // only used with gdlib - //$this->imageTool->orgHeight = $this->img_thumbsize; // only used with gdlib + } + else + { + $video_thumbnail_created = false; + } + } - //$this->imageTool->createImage($this->output_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize,$this->rotate,$watermark=1); - } - else - { - /** - * use default video icon - */ - $this->output_file = $dummy_thumbnail; - } - } + /** + * copy the video icon in the lower right corner + */ + if($video_thumbnail_created) + { + /** + * watermark currently broken - image scaling wrong and distorted + * also - so disable temporary (flo?) + */ + /* + include_once(LINPHA_DIR.'/lib/plugins/watermark/func.watermark.php'); + $this->imageTool->wm_config = Array( + 'wm_watermark' => 2, + 'wm_align' => 'southeast', + 'wm_dissolve' => 100, + 'wm_img_img' => $dummy_thumbnail, + 'wm_resize' => 'no', // use 'no' because the gdlib cannot handle transparent images with imagecopyresized() !! + 'wm_horizontal' => 5, + 'wm_vertical' => 5 + ); + */ + /** + * warning: session will be closed! + */ + //$this->imageTool->orgWidth = $this->img_thumbsize; // only used with gdlib + //$this->imageTool->orgHeight = $this->img_thumbsize; // only used with gdlib + //$this->imageTool->createImage($this->output_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize,$this->rotate,$watermark=1); + } + else + { + /** + * use default video icon + */ + $this->output_file = $dummy_thumbnail; + } + } -/** - * image functions - */ - function createImage($photo_id, $overrideSettings) - { - $this->mode = 'img'; - $this->photo_id = $photo_id; - - $this->overrideSettings = $overrideSettings; - if( ! $this->setFileInformation() ) // will also do setCachedInfos() and setSourceFileInformation() - { - return false; - } - - if( ! $this->isCached OR $this->force ) - { - linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Creating image ".$this->photo_id); - - /** - * include the create image script - */ - linStartTimer("createimage"); - - $this->imageTool->createImage($this->src_file,$this->output_file,$this->img_width,$this->img_height,$this->rotate,$this->watermark); + /** + * image functions + */ + function createImage($photo_id, $overrideSettings) + { + $this->mode = 'img'; + $this->photo_id = $photo_id; - $time = linStopTimer("createimage") * 1000000; - - //echo $time; exit(); + $this->overrideSettings = $overrideSettings; - if( ! file_exists( $this->output_file ) ) - { - $this->error_msg = "Output File Doesnt Exists"; - return false; - } + if( ! $this->setFileInformation() ) // will also do setCachedInfos() and setSourceFileInformation() + { + return false; + } - /** - * finish cache entry - */ - $filesize = filesize( $this->output_file ); - if($filesize <= 0) - { - $this->error_msg = "Incorrect filesize (".$filesize.")"; - return false; - } + if( ! $this->isCached OR $this->force ) + { + linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Creating image ".$this->photo_id); + + /** + * include the create image script + */ + linStartTimer("createimage"); + + $this->imageTool->createImage($this->src_file,$this->output_file,$this->img_width,$this->img_height,$this->rotate,$this->watermark); - /** - * If image needs rotating (by EXIF value) flip width and height - * to have the right values in photos_cache - */ - if($this->rotate != 0) - { - $dummy_height = $this->img_height; - $this->img_height = $this->img_width; - $this->img_width = $dummy_height; - linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Height/width flip during storage of image # ".$this->photo_id." in photos_cache" ); - - } - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos_cache SET " . + $time = linStopTimer("createimage") * 1000000; + + //echo $time; exit(); + + if( ! file_exists( $this->output_file ) ) + { + $this->error_msg = "Output File Doesnt Exists"; + return false; + } + + /** + * finish cache entry + */ + $filesize = filesize( $this->output_file ); + if($filesize <= 0) + { + $this->error_msg = "Incorrect filesize (".$filesize.")"; + return false; + } + + /** + * If image needs rotating (by EXIF value) flip width and height + * to have the right values in photos_cache + */ + if($this->rotate != 0) + { + $dummy_height = $this->img_height; + $this->img_height = $this->img_width; + $this->img_width = $dummy_height; + linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Height/width flip during storage of image # ".$this->photo_id." in photos_cache" ); + + } + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos_cache SET " . "img_width = '".$this->img_width."', " . "img_height = '".$this->img_height."', " . "img_quality = '".$this->img_quality."', " . @@ -673,257 +672,255 @@ "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 ".LIN_PREFIX."photos_cache " . + } + else + { + /** + * got a cached copy, increment counter and time_use + */ + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos_cache " . "SET hits = hits + 1, time_use = '".time()."' " . "WHERE id = '".$this->cached_id."'"); - } + } - return true; - } + return true; + } - -/** - * Rotates images when called from menu direction left/right. - * Insert rotation value into linpha_photos and flip image width - * and height in table. - * Later do a force recreate - * - * @param string $direction either 90 (right turn) or -90 (left turn) - * @param int $linID - * - */ - function rotateImageByMenuCall($direction, $linId) - { - /** - * Insert ration value in linpha_photos - */ - $rotate = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + /** + * Rotates images when called from menu direction left/right. + * Insert rotation value into linpha_photos and flip image width + * and height in table. + * Later do a force recreate + * + * @param string $direction either 90 (right turn) or -90 (left turn) + * @param int $linID + * + */ + function rotateImageByMenuCall($direction, $linId) + { + /** + * Insert ration value in linpha_photos + */ + $rotate = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . "SET rotate='".LinSql::linAddslashes($direction)."' " . "WHERE id='".$linId."'"); - - /** - * Flip image width and height - */ - $imagedata = $GLOBALS['linpha']->db->GetRow("SELECT width AS width, height AS height " . + + /** + * Flip image width and height + */ + $imagedata = $GLOBALS['linpha']->db->GetRow("SELECT width AS width, height AS height " . "FROM ".LIN_PREFIX."photos " . "WHERE id='".LinSql::linAddslashes($linId)."' "); - - $flip = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . + + $flip = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . "width = '".LinSql::linAddslashes($imagedata['height'])."', " . "height = '".LinSql::linAddslashes($imagedata['width'])."' " . "WHERE id='".LinSql::linAddslashes($linId)."'"); - - /** - * force recreate with new values - */ - $thumbnail = new LinImage(); - $_GET['force'] = true; - $thumbnail->createThumbnail( $linId ); - } + /** + * force recreate with new values + */ + $thumbnail = new LinImage(); + $_GET['force'] = true; + $thumbnail->createThumbnail( $linId ); + } -/** - * returns the full path to the cached image - * in thumb mode, $id is the photoid - * in image mode, $id is the cached photoid - * - * @param string $what 'thumb' or 'img' - * @param int $id image id - * @return string full path to cached image - * - * @todo use img_type as parameter and decide in this function - * which file extension to use - */ -function getCachePath($what,$id,$img_type) -{ - /** - * thumbnails of folders are gif files, all others are (currently at least) jpg files - */ - if($what == 'thumb' && $img_type == '0') { - $ext = 'gif'; - } else { - $ext = 'jpg'; - } - - $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 . '.' . $ext; -} + /** + * returns the full path to the cached image + * in thumb mode, $id is the photoid + * in image mode, $id is the cached photoid + * + * @param string $what 'thumb' or 'img' + * @param int $id image id + * @return string full path to cached image + * + * @todo use img_type as parameter and decide in this function + * which file extension to use + */ + function getCachePath($what,$id,$img_type) + { + /** + * thumbnails of folders are gif files, all others are (currently at least) jpg files + */ + if($what == 'thumb' && $img_type == '0') { + $ext = 'gif'; + } else { + $ext = 'jpg'; + } -/** - * deleteCached thumbnail by id - * - * @param int $id id of thumb in database - * @return boolean false if there was no image, true if there was an image to delete - */ -function deleteCachedThumbnail($id,$img_type) -{ - $output = LinImage::getCachePath('thumb',$id,$img_type); - - if(file_exists($output)) - { - if( ! @unlink( $output ) ) - { - linSysLog( i18n("Warning while deleting file/folder, check permissions!").'<br />'.$output ); - } - - return true; - } - else - { - return false; - } -} + $path = LinSql::getPath('cache'); -/** - * delete all cached images by this photo id - * (there can be more than one image with the same photo id in different sizes etc.) - * - * @param int $id id of image in database - */ -function deleteCachedImage($id,$img_type) -{ - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE photo_id = '".$id."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) - { - $output = LinImage::getCachePath('img',$data[0],$img_type); - - if(file_exists($output)) - { - if( ! @unlink( $output ) ) - { - linSysLog( i18n("Warning while deleting file/folder, check permissions!").'<br />'.$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); + } -/** - * This returns returns width and height of the scaled image - * to fit in $dst_h and $dst_w, it keeps the image ratio - * calculated from $src_h and $src_w - * if $no_increase is set, the image is only decreased - */ -function scaleToFit($src_w,$src_h,$dst_w,$dst_h,$no_increase=1) -{ - if($src_h == 0 OR $src_w == 0) - { - return array('w' => 0, 'h' => 0); - } + return $path . '/' . $what . '/' . $subdir . '/' . $id . '.' . $ext; + } - $img_relation = $src_w/$src_h; + /** + * deleteCached thumbnail by id + * + * @param int $id id of thumb in database + * @return boolean false if there was no image, true if there was an image to delete + */ + function deleteCachedThumbnail($id,$img_type) + { + $output = LinImage::getCachePath('thumb',$id,$img_type); - // Image is smaller than screen, no resize required - if (($src_w <= $dst_w) && ($src_h <= $dst_h) && $no_increase) - { - $array['w'] = $src_w; - $array['h'] = $src_h; - } - else - { - /* - The image is way bigger than the screen, resize maintaining aspect ratio + if(file_exists($output)) + { + if( ! @unlink( $output ) ) + { + linSysLog( i18n("Warning while deleting file/folder, check permissions!").'<br />'.$output ); + } - $src_w, $src_h: original image sizes - $dst_w, $dst_h: screen width and height - $img_relation = $src_w/$src_h; - - Either $dst_w decisive or $dst_h, usually $dst_h - */ + return true; + } + else + { + return false; + } + } - $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'] = intval($dst_h); // oh, do intval() for security, comes from $_GET and will be included in exec() commands - } else { - $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; -} + /** + * delete all cached images by this photo id + * (there can be more than one image with the same photo id in different sizes etc.) + * + * @param int $id id of image in database + */ + function deleteCachedImage($id,$img_type) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE photo_id = '".$id."'"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + $output = LinImage::getCachePath('img',$data[0],$img_type); -/** - * send correct header and file - */ -function printFileToScreen() -{ - if( $this->img_type == 0 ) // folder are gif images, all other are jpg - { - header("Content-type: image/gif"); - } - else - { - header("Content-type: image/jpeg"); - } - - /** - * show correct image filename wenn selecting "save as" in browser - * it works on firefox, but it does not on my IE - */ - header("Content-Disposition: inline; filename=".basename($this->src_file).";" ); - - readfile( $this->output_file ); -} + if(file_exists($output)) + { + if( ! @unlink( $output ) ) + { + linSysLog( i18n("Warning while deleting file/folder, check permissions!").'<br />'.$output ); + } + } + } + } -/** - * rotates an image with a given angle using GDLib - * do nothing if imagerotate() doesn't exists - * - * - * @param imageressource $src_img pointer to the source image - * @param int $angle angle to rotate - * @author flo - */ -function GDimageRotate(& $src_img, $angle) -{ - if($angle != "0") - { - if(function_exists('imagerotate')) - { - /** - * flip $angle, because with this function, left means right, and right means left :-) - */ - $angle = 360 - $angle; - $angle = $angle % 360; - $src_img = imagerotate($src_img,$angle,0); - } - else - { - linLog(LOG_TYPE_META,LOG_WARNING,'rotate',"Cannot rotate image becuase the function imagerotate() doesnt exists, consider upgrading your php version"); - } - } -} + /** + * This returns returns width and height of the scaled image + * to fit in $dst_h and $dst_w, it keeps the image ratio + * calculated from $src_h and $src_w + * if $no_increase is set, the image is only decreased + */ + function scaleToFit($src_w,$src_h,$dst_w,$dst_h,$no_increase=1) + { + if($src_h == 0 OR $src_w == 0) + { + return array('w' => 0, 'h' => 0); + } -function &GDimageCreateFrom($src_file,$img_type) -{ - switch($img_type) - { - case 1: $src_image = imagecreatefromgif($src_file); break; - case 2: $src_image = imagecreatefromjpeg($src_file); break; - case 3: $src_image = imagecreatefrompng($src_file); break; - default: $foobar = false; return $foobar; break; - } - - return $src_image; -} - + $img_relation = $src_w/$src_h; + + // Image is smaller than screen, no resize required + if (($src_w <= $dst_w) && ($src_h <= $dst_h) && $no_increase) + { + $array['w'] = $src_w; + $array['h'] = $src_h; + } + else + { + /* + The image is way bigger than the screen, resize maintaining aspect ratio + + $src_w, $src_h: original image sizes + $dst_w, $dst_h: screen width and height + $img_relation = $src_w/$src_h; + + Either $dst_w decisive or $dst_h, usually $dst_h + */ + + $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'] = intval($dst_h); // oh, do intval() for security, comes from $_GET and will be included in exec() commands + } else { + $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() + { + if( $this->img_type == 0 ) // folder are gif images, all other are jpg + { + header("Content-type: image/gif"); + } + else + { + header("Content-type: image/jpeg"); + } + + /** + * show correct image filename wenn selecting "save as" in browser + * it works on firefox, but it does not on my IE + */ + header("Content-Disposition: inline; filename=".basename($this->src_file).";" ); + + readfile( $this->output_file ); + } + + /** + * rotates an image with a given angle using GDLib + * do nothing if imagerotate() doesn't exists + * + * + * @param imageressource $src_img pointer to the source image + * @param int $angle angle to rotate + * @author flo + */ + function GDimageRotate(& $src_img, $angle) + { + if($angle != "0") + { + if(function_exists('imagerotate')) + { + /** + * flip $angle, because with this function, left means right, and right means left :-) + */ + $angle = 360 - $angle; + $angle = $angle % 360; + $src_img = imagerotate($src_img,$angle,0); + } + else + { + linLog(LOG_TYPE_META,LOG_WARNING,'rotate',"Cannot rotate image becuase the function imagerotate() doesnt exists, consider upgrading your php version"); + } + } + } + + function &GDimageCreateFrom($src_file,$img_type) + { + switch($img_type) + { + case 1: $src_image = imagecreatefromgif($src_file); break; + case 2: $src_image = imagecreatefromjpeg($src_file); break; + case 3: $src_image = imagecreatefrompng($src_file); break; + default: $foobar = false; return $foobar; break; + } + + return $src_image; + } + } // 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 2008-01-30 21:08:44 UTC (rev 4841) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-01-31 12:27:25 UTC (rev 4842) @@ -53,7 +53,6 @@ } - /** * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) * @param string $modulname (album, browse, search, ...) @@ -152,7 +151,6 @@ } } - /** * main function to prepare desired layout view */ @@ -236,7 +234,6 @@ include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } - /** * filter out files and folders not permitted and escape filename * all other values dont have to be escaped @@ -268,7 +265,6 @@ unset($this->photos); } - /** * create optional top menu */ @@ -545,7 +541,6 @@ } } - /** * method for special admin commands, like rotating images, import stuff etc. * @uses LinImgview::buildImgView() @@ -613,9 +608,6 @@ } } - - - /** * define thumbnail view */ @@ -721,7 +713,6 @@ } } - /** * thumbnail view with javascript disabled (static) * @uses LinImgView::viewThumb() @@ -893,11 +884,6 @@ $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); } - - - - - /** * setup main/home view layout */ @@ -1062,10 +1048,6 @@ } } - - - - /** * setup basket view */ @@ -1150,9 +1132,6 @@ LinMetaData::saveModifiedMetaData(); } - - - /** * setup image view */ @@ -1306,7 +1285,7 @@ } /** - * store image informations in database if not exists + * store image informations in database if s */ function viewImgStoreImageInformation() { @@ -1325,6 +1304,21 @@ { $MetaData->saveData($value, $this->src_file, $this->md5sum ); } + + /** + * Read image geodata. This depends on the maps plugin. So we only + * run this additionally import if maps plugin is enabled and admin + * selected "autoimport". + * This should prevent a... [truncated message content] |
From: <fan...@us...> - 2008-01-30 21:09:04
|
Revision: 4841 http://linpha.svn.sourceforge.net/linpha/?rev=4841&view=rev Author: fangehrn Date: 2008-01-30 13:08:44 -0800 (Wed, 30 Jan 2008) Log Message: ----------- 2008-01-30 flo * installer - improved layout moved title down because of banner blindness - improved error handling in rm_rf() * linpha.filesys.class.php - improved error handling also in the same function here Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/header_html.php trunk/linpha2/install/layout.css trunk/linpha2/install/lib.install.php trunk/linpha2/install/look.css trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/lib/classes/linpha.filesys.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/ChangeLog 2008-01-30 21:08:44 UTC (rev 4841) @@ -1,3 +1,13 @@ + +2008-01-30 flo + * installer + - improved layout + moved title down because of banner blindness + - improved error handling in rm_rf() + + * linpha.filesys.class.php + - improved error handling also in the same function here + 2008-01-30 bzrudi * Split out GPS meta/geodata from meta_exif into a seperate relation within the maps plugin. The relation is created when admin enables the maps plugin Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/header_html.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -23,132 +23,102 @@ * linpha installer * @package Installation */ + +$end = count($files)-1; +$step = $key+1; +$finalstep = $end+1; + +$strStep = i18n_install("Step %d of %d"); +$strStep = sprintf($strStep, $step, $finalstep); + +switch($step) +{ + case 1: + $icon = './graphics/start.png'; + $title = i18n_install("Welcome To LinPHA2 Installation Wizzard"); + break; + + case 2: + $icon = './graphics/gnu.png'; + $title = i18n_install("Accept The GNU General Public License GPL"); + break; + + case 3: + $icon = './graphics/important.png'; + $title = i18n_install("Checking For Required Software"); + break; + + case 4: + $icon = './graphics/phppg.png'; + $title = i18n_install("Select Type Of Database To Use"); + break; + + case 5: + $icon = './graphics/directories.png'; + $title = i18n_install("Define LinPHA Storage And Album Directories"); + break; + + case 6: + $icon = './graphics/login.png'; + $title = i18n_install("Directories Testing And Database Login"); + break; + + case 7: + $icon = './graphics/phppg.png'; + $title = i18n_install("Connection Test And Database Selection"); + break; + + case 8: + $icon = './graphics/phppg.png'; + $title = i18n_install("Database Table Prefix Selection"); + break; + + case 9: + $icon = './graphics/phppg.png'; + $title = i18n_install("Running Database Tests And Checking Permissions"); + break; + + case 10: + $icon = './graphics/createtables.png'; + $title = i18n_install("Creating Database Tables And Writing Config Files"); + break; + + case 11: + $icon = './graphics/settings.png'; + $title = i18n_install("Setup LinPHA Admin And Initial Settings"); + break; + + case 12: + $icon = './graphics/finish.png'; + $title = i18n_install("Finishing LinPHA2 Setup"); + break; +} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html lang="de"> +<html> <head> <title><?php echo i18n_install("LinPHA2 Install Wizzard"); ?></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"> -<link rel="stylesheet" type="text/css" href="look.css"> +<link rel="stylesheet" type="text/css" href="layout.css" /> +<link rel="stylesheet" type="text/css" href="look.css" /> </head> <body> <div class="main"> -<div class="header"> + <div class="header"> + <div class="header_left"> + <img class='header_icons' src='./graphics/start.png' /> + </div> + <div class="header_right"> + <h1 class="header_title"><?php echo i18n_install("Linpha 2 Installation Wizzard"); ?></h1> + <p class='header_subinfo'><?php echo $strStep; ?></p> + </div> + </div> + <div class="leftside"> <?php -$end = count($files)-1; -$step = $key+1; -$finalstep = $end+1; -switch($step) -{ - case '1': - - echo "<img class='header_icons' src='./graphics/start.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Welcome To LinPHA2 Installation Wizzard"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '2': - echo "<img class='header_icons' src='./graphics/gnu.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Accept The GNU General Public License GPL"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '3': - echo "<img class='header_icons' src='./graphics/important.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Checking For Required Software"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '4': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Select Type Of Database To Use"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '5': - echo "<img class='header_icons' src='./graphics/directories.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Define LinPHA Storage And Album Directories"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '6': - echo "<img class='header_icons' src='./graphics/login.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Directories Testing And Database Login"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '7': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Connection Test And Database Selection"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '8': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Database Table Prefix Selection"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '9': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Running Database Tests And Checking Permissions"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '10': - echo "<img class='header_icons' src='./graphics/createtables.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Creating Database Tables And Writing Config Files"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '11': - echo "<img class='header_icons' src='./graphics/settings.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Setup LinPHA Admin And Initial Settings"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '12': - echo "<img class='header_icons' src='./graphics/finish.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Finishing LinPHA2 Setup"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - -} -?> -</div> -<div class="leftside"> -<?php - for($i = 0; $i <= $end; $i++ ) { if($i == $key) @@ -190,7 +160,17 @@ </div> <div class="rightside"> - + + <div class="title_left"> + <img src="<?php echo $icon; ?>" /> + </div> + <div class="header_right"> + <br /> + <h1 class="title"><?php echo $title; ?></h1> + </div> + <div style="clear: both"></div> + <br /> + <?php if($show_next_button) Modified: trunk/linpha2/install/layout.css =================================================================== --- trunk/linpha2/install/layout.css 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/layout.css 2008-01-30 21:08:44 UTC (rev 4841) @@ -27,55 +27,60 @@ margin-right: auto; } -.header { +div.header { background-image: url('./graphics/header_bg.jpg'); - position: absolute; - width: 780px; height: 80px; - float: left; border: 1px solid #000000; margin: 0px; padding: 0px; - } +} -.header_icons { -float: left; - position: absolute; - margin-top: 8px; - margin-left: 45px; -} +div.header_left { + float: left; + width: 65px; + padding: 7px; +} -.header_info { - position: absolute; - margin-top: 8px; - margin-left: 160px; -} +div.header_right { + float: left; +} -.header_subinfo { - position: absolute; - margin-top: 45px; - margin-left: 160px; +h1.header_title { + margin-top: 3px; + margin-bottom: 3px; } +p.header_subinfo { +} + + +div.title_left { + float: left; + width: 65px; + padding: 0px; + margin-right: 5px; +} + + .leftside { - position: absolute; + position: relative; width: 150px; height: 430px; float: left; text-align: center; - margin-top: 82px; + /*margin-top: 82px;*/ padding: 5px; } .rightside { - position: absolute; - width: 610px; + position: relative; + width: 607px; min-height: 427px; height: expression( "427px" ); /* ie hack */ float: left; text-align: left; - margin-top: 82px; - margin-left: 160px; + /*margin-top: 82px;*/ + /*margin-left: 160px;*/ padding: 5px; padding-top: 8px; } Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/lib.install.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -74,20 +74,22 @@ */ function installRm_rf($path,$followLinks=false) { - $dir = opendir($path) ; - while (false !== ($entry = readdir($dir))) - { - if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) - { - unlink( "$path/$entry" ); - } - elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) - { - installRm_rf( "$path/$entry" ); - } - } - closedir($dir) ; - return @rmdir($path); + $dir = @opendir($path); + if ($dir) { + while (false !== ($entry = @readdir($dir))) + { + if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) + { + unlink( "$path/$entry" ); + } + elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) + { + installRm_rf( "$path/$entry" ); + } + } + @closedir($dir) ; + } + return @rmdir($path); } /** @@ -330,7 +332,7 @@ { try { - $init_ok = true; + $init_ok = true; echo "<h1>".i18n_install("Checking Directory Permissions")."</h1><hr>"; /** @@ -348,20 +350,19 @@ { echo warning_msg(); //echo '<br /> ('.$_SESSION['album_dir'].' => '.installLinRealpath( $dirs['album'] ).')'; - echo "<br />".i18n_install("Album Directory Not Writable. Some Features May Not Work")."<br />"; + echo "<br /><strong>".i18n_install("Album Directory Not Writable. Some Features May Not Work")."</strong><br />"; } } else { - throw new Exception(failed_msg()."<br />".$_SESSION['album_dir']."<br />".i18n_install("No Valid Directory Found!")); + throw new Exception(failed_msg()."<br />".$_SESSION['album_dir']."<br /><strong>".i18n_install("No Valid Directory Found!")."</strong>"); } //echo "<br />"; //echo i18n_install("Creating Required Directories...").' '; - $array = array('sql','cache','tmp'); - foreach($array AS $value) + foreach( array('sql','cache','tmp') as $value) { echo "<br />".i18n_install("Checking Directory:")." ".$value."..."." "; @@ -371,7 +372,7 @@ * oh oh, pay attention, only try to delete the folder on default values! * if the users choose wrongly the albums folder, all images would be deleted.!!!! */ - if( $_SESSION[$value.'_dir'] == 'var/'.$value) + if( $_SESSION[$value.'_dir'] == $_SESSION['default_'.$value.'_dir']) { //echo warning_msg(); //echo "<br />".i18n_install("Directory Already Exists - Trying To Delete...").' '; @@ -381,12 +382,12 @@ } else { - throw new Exception(failed_msg()."<br />".i18n_install("Please Delete Folder Manually!")); + throw new Exception(failed_msg()."<br /><strong>".i18n_install("Please Delete Folder Manually!")."</strong>"); } } else { - throw new Exception(failed_msg()."<br />".i18n_install("Directory Allready Exists, Please Delete Folder Manually!")); + throw new Exception(failed_msg()."<br /><strong>".i18n_install("Directory Allready Exists, Please Delete Folder Manually!")."</strong>"); } } Modified: trunk/linpha2/install/look.css =================================================================== --- trunk/linpha2/install/look.css 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/look.css 2008-01-30 21:08:44 UTC (rev 4841) @@ -1,16 +1,17 @@ body { - font-size: 10pt; + font-size: 0.7em; color: #000000; text-decoration: none; + font-family: Verdana, Arial, Helvetica, sans-serif; } h1 { - font-size: 14pt; + font-size: 1.3em; font-weight: bold; } h2 { - font-size: 12pt; + font-size: 1.2em; font-weight: bold; } @@ -31,25 +32,35 @@ .main { } -.header_info { - font-size: 14pt; - font-weight: bold; +img.header_icon { +} + +h1.header_title { + font-size: 2em; + font-weight: bold; color: #CCCCCC; } -.header_subinfo { - font-size: 10pt; - font-weight: bold; +p.header_subinfo { + font-size: 1em; + font-weight: bold; color: #CCCCCC; } + + +h1.title { + font-size: 1.5em; +} + + .leftside { - background: #e2e2e2; + background: #F3F3F3; /*#e2e2e2;*/ border-right: 0px; } .rightside { - background: #eeeeee; + background: #F3F3F3; /*#eeeeee;*/ } .button { @@ -63,13 +74,15 @@ } .leftsidebox { - background: #cccccc; - color: #000033; + background: #DBEAF5; /*#ffffff;*/ + color: #000000; + font-weight: bold; } .leftsideboxactive { - background: #ffffff; - color: #0000ff; + background: #335DB3; /*#cccccc;*/ + color: #DBEAF5; /*#000033;*/ + font-weight: bold; } .box2 { Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/step2_requirements.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -418,7 +418,7 @@ print_line_middle( i18n_install("Yes") ); print_line_right(success_msg()); print_line_info( - i18n_install("The /albums folder is protected from outside."). + i18n_install("The /albums folder is protected from outside.").' '. i18n_install("Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details.") ); } Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/step4_selectdirectories.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -26,10 +26,16 @@ include_once(LINPHA_DIR.'/lib/include/common.php'); include_once(LINPHA_DIR.'/install/header.php'); +if (!isset($_SESSION['default_sql_dir']) ) { // save for later use in initInitialDirectories() + $_SESSION['default_sql_dir'] = 'var/sql-'.random_password(10); + $_SESSION['default_cache_dir'] = 'var/cache-'.random_password(10); + $_SESSION['default_tmp_dir'] = 'var/tmp-'.random_password(10); +} + $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); -$sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir'] : 'var/sql-'.random_password(10)); -$cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir'] : 'var/cache-'.random_password(10)); -$tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir'] : 'var/tmp-'.random_password(10)); +$sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir'] : $_SESSION['default_sql_dir']); +$cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir'] : $_SESSION['default_cache_dir']); +$tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir'] : $_SESSION['default_tmp_dir']); /** @@ -64,9 +70,12 @@ include_once(LINPHA_DIR.'/install/header_html.php'); ?> +<div class="boxalign"> +<?php +echo '<b>'.i18n_install("For maximum security place all these folders outside of the www root!") . + '</b><br />('.i18n_install("Relative or absolute paths allowed.").')<br /><br />'; -<div class="boxalign"> -<?php echo i18n_install("Album Directory").":"; ?> +echo i18n_install("Album Directory").":"; ?> <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> </div> @@ -74,7 +83,10 @@ <br /><br /> <br /> -<h2 style="color: red;"><?php echo i18n_install("Note: For security reasons folders were named random!"); ?></h2><hr> +<h2 style="color: red;"><?php +echo i18n_install("Warning: All directories below will be deleted if they exist!").'<br />'; +?></h2> +<hr /> <br /> <div class="boxalign"> @@ -100,6 +112,12 @@ </div> (-> <?php echo installLinRealpath( installGetFullPath($tmp_dir) ); ?>) <br /><br /> + +<?php +echo i18n_install("For security reasons folders were named random."); +?> + + <input type="hidden" name="cmd_step4" value="save"> Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/step6_selectdatabase.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -129,7 +129,7 @@ <hr> <br /> <?php -if($_SESSION['allowed_to_create_db'] == true) +if ($_SESSION['allowed_to_create_db'] == true) { /** * search a valid database name (which doesn't already exists) @@ -169,30 +169,45 @@ $checked_dontcreate = ''; } - echo i18n_install("Create A New Database (Recommended)"); - ?> - <br /> + echo i18n_install("Create A New Database (Recommended)").'<br />'; +} + +if ($_SESSION['allowed_to_create_db'] == true && isset($databases)) +{ + ?> + <label for="radio_db1"> <input type="radio" id="radio_db1" name="create_database" value="create"<?php echo $checked_create; ?>> + <?php +} - <?php echo i18n_install("New Database Name").": "; ?> +if ($_SESSION['allowed_to_create_db'] == true) +{ + echo i18n_install("New Database Name").": "; ?> + </label> <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 /> - <?php echo i18n_install("Or").","; ?><br /> + <?php +} + +if ($_SESSION['allowed_to_create_db'] == true && isset($databases)) +{ +?> + <label for="radio_db2"><?php echo i18n_install("Or").","; ?><br /> <input type="radio" id="radio_db2" name="create_database" value="false"<?php echo $checked_dontcreate; ?>> <?php } -if(isset($databases)) +if (isset($databases)) { echo i18n_install("Install Into Existing Database:").' '; ?> - + </label> <select name="sql_dbname_installinto"<?php if($_SESSION['allowed_to_create_db'] == true) { Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -65,19 +65,22 @@ } else { - $dir = opendir($path) ; - while (false !== ($entry = readdir($dir))) + $dir = @opendir($path); + if ($dir) { - if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) - { - @unlink( "$path/$entry" ); - } - elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) - { - LinFilesys::rm_rf( "$path/$entry" ); - } - } - closedir($dir) ; + while (false !== ($entry = @readdir($dir))) + { + if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) + { + @unlink( "$path/$entry" ); + } + elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) + { + LinFilesys::rm_rf( "$path/$entry" ); + } + } + @closedir($dir); + } return @rmdir($path); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-01-30 20:24:40
|
Revision: 4840 http://linpha.svn.sourceforge.net/linpha/?rev=4840&view=rev Author: bzrudi Date: 2008-01-30 12:24:33 -0800 (Wed, 30 Jan 2008) Log Message: ----------- "add support for other db than PG (hopefully)" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/lib/plugins/maps/sql/sql.data.php trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php trunk/linpha2/templates/default/maps.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/ChangeLog 2008-01-30 20:24:33 UTC (rev 4840) @@ -5,6 +5,9 @@ expected performance issues and the mysql "big table" problem. It should currently work partially with PostgresDB, other DB will follow later. Needs "reset_database.php" to work and sys_import_use_exiftool=1 + * add support for PJMT + * add support for other db than PG (hopefully) + * still a lot to fix, so expect errors 2008-01-29 flo * updated to latest protoype 1.6.0.2 and scriptaculous 1.8.1 Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -951,12 +951,20 @@ if(is_array($dataArray)) { + /** + * Lower array data to make it compareable to $metaTags + */ + $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); + + //echo '<pre>', print_r($lowerDataArray), '</pre>'; + foreach($this->getDefaultMetaTags('gps') AS $key => $value) { - if(array_key_exists($value, $dataArray)) + if(array_key_exists($value, $lowerDataArray)) { + $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= trim($dataArray[$value]).", "; + $str_values .= "'".trim($lowerDataArray[$value])."', "; } } /** Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -74,24 +74,28 @@ case 2 : if(isset($exif_data[$ap[0]][$ap[1]]['Text Value'])) { - //echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; + echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; $dataArray[$value] = - "'" . LinSql :: linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])) . "', "; + LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])); } break; case 5 : if(isset($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) { - //echo "DATA2".$exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value']; + echo "DATA2".$exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value']; $dataArray[$value] = - "'" . LinSql :: linAddslashes(trim($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) . "' "; + LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])); } break; } } } - - return $dataArray; + if(is_array($dataArray)){ + return $dataArray; + }else { + return array(); + } + } } Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -240,7 +240,8 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . - "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . + "INNER JOIN ".LIN_PREFIX."photos P ". + "ON PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . "AND gpslongituderef IS NOT NULL " . @@ -250,7 +251,8 @@ if( $query->EOF ) { - //echo "Error: Please enable EXIF GPS fields!"; + //echo "ERROR: Can't get data for albums"; + error_log("ERROR: Can't get data for albums",'',0); } else { @@ -291,7 +293,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, " . "P.name, gpslatituderef, gpslatitude, gpslongituderef, gpslongitude " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . @@ -385,7 +387,7 @@ { foreach(array('gpslatitude','gpslongitude') as $value) { - error_log("USING PJMT",'','0'); + error_log("USING PJMT",'','0'); $arrHits = array(); // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) Modified: trunk/linpha2/lib/plugins/maps/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.data.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/plugins/maps/sql/sql.data.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -9,7 +9,7 @@ "VALUES ('plugins_maps_defaultMarkerZoom', '10', '0', '0')"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . - "VALUES ('plugins_maps_mapType', 'google', '0', '0')"; + "VALUES ('plugins_maps_mapType', '0', '0', '0')"; // google maps key for http://localhost $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . @@ -22,6 +22,9 @@ "VALUES ('plugins_maps_setMarkers', '')"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . - "VALUES ('plugins_maps_enable_geotagged', '0', '0', '0')"; + "VALUES ('plugins_maps_enable_geotagged', '0', '0', '0')"; + +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . + "VALUES ('plugins_maps_geotagged_autoimport', '1', '0', '0')"; ?> Modified: trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -10,5 +10,42 @@ "markerlon VARCHAR(255) NOT NULL default '', " . "markerzoom INT NOT NULL default '0', " . "PRIMARY KEY (id) )"; + +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_image_geodata ( ". + "md5sum CHAR(32) NOT NULL default '', " . + "gpsversionid VARCHAR(255) DEFAULT '', " . + "gpslatituderef VARCHAR(255) DEFAULT '', " . + "gpslatitude VARCHAR(255) DEFAULT '', " . + "gpslongituderef VARCHAR(255) DEFAULT '', " . + "gpslongitude VARCHAR(255) DEFAULT '', " . + "gpsaltituderef VARCHAR(255) DEFAULT '', " . + "gpsaltitude VARCHAR(255) DEFAULT '', " . + "gpstimestamp VARCHAR(255) DEFAULT '', " . + "gpssatellites VARCHAR(255) DEFAULT '', " . + "gpsstatus VARCHAR(255) DEFAULT '', " . + "gpsmeasuremode VARCHAR(255) DEFAULT '', " . + "gpsdop VARCHAR(255) DEFAULT '', " . + "gpsspeedref VARCHAR(255) DEFAULT '', " . + "gpsspeed VARCHAR(255) DEFAULT '', " . + "gpstrackref VARCHAR(255) DEFAULT '', " . + "gpstrack VARCHAR(255) DEFAULT '', " . + "gpsimgdirectionref VARCHAR(255) DEFAULT '', " . + "gpsimgdirection VARCHAR(255) DEFAULT '', " . + "gpsmapdatum VARCHAR(255) DEFAULT '', " . + "gpsdestlatituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlatitude VARCHAR(255) DEFAULT '', " . + "gpsdestlongituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlongitude VARCHAR(255) DEFAULT '', " . + "gpsdestbearingref VARCHAR(255) DEFAULT '', " . + "gpsdestbearing VARCHAR(255) DEFAULT '', " . + "gpsdestdistanceref VARCHAR(255) DEFAULT '', " . + "gpsdestdistance VARCHAR(255) DEFAULT '', " . + "gpsprocessingmethod VARCHAR(255) DEFAULT '', " . + "gpsareainformation VARCHAR(255) DEFAULT '', " . + "gpsdatestamp VARCHAR(255) DEFAULT '', " . + "gpsdatetime VARCHAR(255) DEFAULT '', " . + "gpsposition VARCHAR(255) DEFAULT '', " . + "PRIMARY KEY (md5sum) )"; -?> \ No newline at end of file +/* vi: set ts=4 sw=4 sts=4 */ +?> Modified: trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -22,5 +22,44 @@ "BEGIN " . "SELECT ".LIN_PREFIX."plugins_maps_markers_seq.nextval INTO :new.id FROM DUAL; " . "END; "; - -?> \ No newline at end of file + + +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_image_geodata ( ". + "md5sum CHAR(32) NOT NULL default '', " . + "gpsversionid VARCHAR(255) DEFAULT '', " . + "gpslatituderef VARCHAR(255) DEFAULT '', " . + "gpslatitude VARCHAR(255) DEFAULT '', " . + "gpslongituderef VARCHAR(255) DEFAULT '', " . + "gpslongitude VARCHAR(255) DEFAULT '', " . + "gpsaltituderef VARCHAR(255) DEFAULT '', " . + "gpsaltitude VARCHAR(255) DEFAULT '', " . + "gpstimestamp VARCHAR(255) DEFAULT '', " . + "gpssatellites VARCHAR(255) DEFAULT '', " . + "gpsstatus VARCHAR(255) DEFAULT '', " . + "gpsmeasuremode VARCHAR(255) DEFAULT '', " . + "gpsdop VARCHAR(255) DEFAULT '', " . + "gpsspeedref VARCHAR(255) DEFAULT '', " . + "gpsspeed VARCHAR(255) DEFAULT '', " . + "gpstrackref VARCHAR(255) DEFAULT '', " . + "gpstrack VARCHAR(255) DEFAULT '', " . + "gpsimgdirectionref VARCHAR(255) DEFAULT '', " . + "gpsimgdirection VARCHAR(255) DEFAULT '', " . + "gpsmapdatum VARCHAR(255) DEFAULT '', " . + "gpsdestlatituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlatitude VARCHAR(255) DEFAULT '', " . + "gpsdestlongituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlongitude VARCHAR(255) DEFAULT '', " . + "gpsdestbearingref VARCHAR(255) DEFAULT '', " . + "gpsdestbearing VARCHAR(255) DEFAULT '', " . + "gpsdestdistanceref VARCHAR(255) DEFAULT '', " . + "gpsdestdistance VARCHAR(255) DEFAULT '', " . + "gpsprocessingmethod VARCHAR(255) DEFAULT '', " . + "gpsareainformation VARCHAR(255) DEFAULT '', " . + "gpsdatestamp VARCHAR(255) DEFAULT '', " . + "gpsdatetime VARCHAR(255) DEFAULT '', " . + "gpsposition VARCHAR(255) DEFAULT '', " . + "PRIMARY KEY (md5sum) )"; + +/* vi: set ts=4 sw=4 sts=4 */ +?> + \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -44,4 +44,8 @@ "gpsdatestamp VARCHAR(255) DEFAULT '', " . "gpsdatetime VARCHAR(255) DEFAULT '', " . "gpsposition VARCHAR(255) DEFAULT '' )"; + + +/* vi: set ts=4 sw=4 sts=4 */ ?> + Modified: trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -10,4 +10,40 @@ "markerlon VARCHAR(255) NOT NULL default '', " . "markerzoom INTEGER NOT NULL default '0' )"; -?> \ No newline at end of file +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_image_geodata ( ". + "md5sum CHAR(32) PRIMARY KEY, " . + "gpsversionid VARCHAR(255) DEFAULT '', " . + "gpslatituderef VARCHAR(255) DEFAULT '', " . + "gpslatitude VARCHAR(255) DEFAULT '', " . + "gpslongituderef VARCHAR(255) DEFAULT '', " . + "gpslongitude VARCHAR(255) DEFAULT '', " . + "gpsaltituderef VARCHAR(255) DEFAULT '', " . + "gpsaltitude VARCHAR(255) DEFAULT '', " . + "gpstimestamp VARCHAR(255) DEFAULT '', " . + "gpssatellites VARCHAR(255) DEFAULT '', " . + "gpsstatus VARCHAR(255) DEFAULT '', " . + "gpsmeasuremode VARCHAR(255) DEFAULT '', " . + "gpsdop VARCHAR(255) DEFAULT '', " . + "gpsspeedref VARCHAR(255) DEFAULT '', " . + "gpsspeed VARCHAR(255) DEFAULT '', " . + "gpstrackref VARCHAR(255) DEFAULT '', " . + "gpstrack VARCHAR(255) DEFAULT '', " . + "gpsimgdirectionref VARCHAR(255) DEFAULT '', " . + "gpsimgdirection VARCHAR(255) DEFAULT '', " . + "gpsmapdatum VARCHAR(255) DEFAULT '', " . + "gpsdestlatituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlatitude VARCHAR(255) DEFAULT '', " . + "gpsdestlongituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlongitude VARCHAR(255) DEFAULT '', " . + "gpsdestbearingref VARCHAR(255) DEFAULT '', " . + "gpsdestbearing VARCHAR(255) DEFAULT '', " . + "gpsdestdistanceref VARCHAR(255) DEFAULT '', " . + "gpsdestdistance VARCHAR(255) DEFAULT '', " . + "gpsprocessingmethod VARCHAR(255) DEFAULT '', " . + "gpsareainformation VARCHAR(255) DEFAULT '', " . + "gpsdatestamp VARCHAR(255) DEFAULT '', " . + "gpsdatetime VARCHAR(255) DEFAULT '', " . + "gpsposition VARCHAR(255) DEFAULT '' )"; + +/* vi: set ts=4 sw=4 sts=4 */ +?> Modified: trunk/linpha2/templates/default/maps.head.php =================================================================== --- trunk/linpha2/templates/default/maps.head.php 2008-01-30 18:00:37 UTC (rev 4839) +++ trunk/linpha2/templates/default/maps.head.php 2008-01-30 20:24:33 UTC (rev 4840) @@ -1,47 +1,47 @@ -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> -<script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; -var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; -var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; -var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; -var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; -var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; -var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; - -var linMapsDefaultMarkerZoom = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; -var linMapsMarkerThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_markerThumbSize']; ?>; -</script> - -<?php -if( $GLOBALS['linpha']->sql->config->value['plugins_maps_mapType'] == 'google' ) -{ - ?> - <script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>"></script> - <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.googlemaps.js"></script> - <?php - - /** - * @todo - * google recommends using this kind of html header: - * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> - * but without strict mode we need this css stuff to get polylines also working - * http://www.google.com/apis/maps/documentation/#XHTML_and_VML - ?> - <style type="text/css"> - v\:* { - behavior:url(#default#VML); - } - </style> - <?php - */ -} -elseif( $linTpl->output['mapType'] == 'xyz' ) -{ - ?> - <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.xyz.js"></script> - <?php -} -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> +<script language="JavaScript" type="text/javascript"> +var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; +var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; +var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; +var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; +var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; +var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; +var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; + +var linMapsDefaultMarkerZoom = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; +var linMapsMarkerThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_markerThumbSize']; ?>; +</script> + +<?php +if( $GLOBALS['linpha']->sql->config->value['plugins_maps_mapType'] == '0' ) //0=google +{ + ?> + <script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>"></script> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.googlemaps.js"></script> + <?php + + /** + * @todo + * google recommends using this kind of html header: + * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + * but without strict mode we need this css stuff to get polylines also working + * http://www.google.com/apis/maps/documentation/#XHTML_and_VML + ?> + <style type="text/css"> + v\:* { + behavior:url(#default#VML); + } + </style> + <?php + */ +} +elseif( $linTpl->output['mapType'] == 'xyz' ) +{ + ?> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.xyz.js"></script> + <?php +} +?> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-01-30 18:01:00
|
Revision: 4839 http://linpha.svn.sourceforge.net/linpha/?rev=4839&view=rev Author: fangehrn Date: 2008-01-30 10:00:37 -0800 (Wed, 30 Jan 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/include/sql/sql.info.txt Added: trunk/linpha2/lib/include/sql/sql.info.txt =================================================================== --- trunk/linpha2/lib/include/sql/sql.info.txt (rev 0) +++ trunk/linpha2/lib/include/sql/sql.info.txt 2008-01-30 18:00:37 UTC (rev 4839) @@ -0,0 +1,7 @@ + + + +- only use lower case table and column names + +missing: utf8 explanations +missing: sample table for each database driver \ 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...> - 2008-01-30 17:40:30
|
Revision: 4838 http://linpha.svn.sourceforge.net/linpha/?rev=4838&view=rev Author: bzrudi Date: 2008-01-30 09:40:27 -0800 (Wed, 30 Jan 2008) Log Message: ----------- "add support for PJMT (I hate it ;-))" Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/lib/plugins/maps/settings.maps.php Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -185,7 +185,7 @@ $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); - echo '<pre>', print_r($dataArray), '</pre>'; + //echo '<pre>', print_r($dataArray), '</pre>'; $str_columns = "md5sum, "; Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -748,7 +748,7 @@ * @return array with metadata information * @author bzrudi,flo */ - private function getDefaultMetaTags($type) + protected function getDefaultMetaTags($type) { switch($type) { @@ -939,32 +939,24 @@ AND img_type <> 9999999 AND geodata <> 1 "); - while ($data = $query->FetchRow()) + while($data = $query->FetchRow()) { $filename = LinSql::getFullImagePath($data['0']); $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); - echo '<pre>', print_r($dataArray), '</pre>'; + //echo '<pre>', print_r($dataArray), '</pre>'; $str_columns = "md5sum, "; $str_values = "'".$data['1']."', "; if(is_array($dataArray)) { - /** - * Lower array data to make it compareable to $metaTags - */ - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - echo '<pre>', print_r($lowerDataArray), '</pre>'; - foreach($this->getDefaultMetaTags('gps') AS $key => $value) { - if(array_key_exists($value, $lowerDataArray)) + if(array_key_exists($value, $dataArray)) { - $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($lowerDataArray[$value])."', "; + $str_values .= trim($dataArray[$value]).", "; } } /** Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -36,6 +36,66 @@ } /** + * This method reads all available GeoData Information from image. + * @param string $metatype exi + * @param string $filename + * @return array Array with all available Tag informations + * @author bzrudi + * @todo respect exec return status, don't use filename as input (security) + */ + public function readMetaDataFromFile($metatype, $filename) + { + include_once (LINPHA_DIR . '/lib/pjmt/JPEG.php'); + include_once (LINPHA_DIR . '/lib/pjmt/EXIF.php'); + + /** + * get exif info from file + */ + $exif_data = get_EXIF_JPEG($filename); + + if($exif_data) + { + /** + * search for valid tags + */ + foreach($this->getDefaultMetaTags('gps') AS $key => $value) + { + if(!empty(LinPjmtTool::$metaTags['exif'][$value]['pathvalue'])) + { + /** + * there are currently only entries at level deep 2 and 5 + * in the array + */ + $ap = explode('/', + LinPjmtTool::$metaTags['exif'][$value]['pathvalue']); + + switch(count($ap)) + { + case 2 : + if(isset($exif_data[$ap[0]][$ap[1]]['Text Value'])) + { + //echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; + $dataArray[$value] = + "'" . LinSql :: linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])) . "', "; + } + break; + case 5 : + if(isset($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) + { + //echo "DATA2".$exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value']; + $dataArray[$value] = + "'" . LinSql :: linAddslashes(trim($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) . "' "; + } + break; + } + } + } + + return $dataArray; + } + } + + /** * Save all MetaData to database * @param string $filename filename to parse for MetaData * @param string $md5sum md5sum of file Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -24,8 +24,8 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } - //$MetaData = new LinMetaData(); - //$MetaData->importGeoData(); + $MetaData = new LinMetaData(); + $MetaData->importGeoData(); /** * xml load/save stuff */ @@ -56,7 +56,7 @@ if( $data['albid'] != '0' ) { $query2 = $GLOBALS['linpha']->db->Execute("SELECT P.parent_id " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . "INNER JOIN ".LIN_PREFIX."photos P " . "ON PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . @@ -102,11 +102,11 @@ case 'saveMarker': - //error_log("SAVING MARKERS",'','0'); + error_log("SAVING MARKERS",'','0'); case 'editMarker': - //error_log("EDITING MARKERS",'','0'); + error_log("EDITING MARKERS",'','0'); header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; @@ -163,7 +163,7 @@ break; case 'deleteMarker': - //error_log("DELETING MARKERS",'','0'); + error_log("DELETING MARKERS",'','0'); header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; @@ -197,8 +197,9 @@ case 'assignAlbumChange': case 'assignAlbumDelete': - //error_log("ASSIGNING ALBUM MARKERS",'','0'); - header('Content-type: text/xml'); + error_log("ASSIGNING ALBUM MARKERS",'','0'); + + header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; echo '<root>'."\n"; @@ -233,11 +234,12 @@ break; case 'loadAlbums': - //error_log("LOADING ALBUMS",'','0'); - echo '{ "albums": [' . "\n"; + error_log("LOADING ALBUMS",'','0'); + echo '{ "albums": [' . "\n"; + $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . @@ -246,7 +248,7 @@ echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; - if( !$query ) + if( $query->EOF ) { //echo "Error: Please enable EXIF GPS fields!"; } @@ -273,8 +275,9 @@ break; case 'loadImages': -// error_log("LOADING IMAGES",'','0'); - if( !isset($_REQUEST['albId']) ) { + error_log("LOADING IMAGES",'','0'); + + if( !isset($_REQUEST['albId']) ) { break; } @@ -288,7 +291,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, " . "P.name, gpslatituderef, gpslatitude, gpslongituderef, gpslongitude " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . @@ -300,7 +303,7 @@ if( $query->EOF ) { - error_log("Error: Please enable EXIF GPS fields!",'',0); + error_log("Error: No geotagged images found",'',0); } else { @@ -382,6 +385,7 @@ { foreach(array('gpslatitude','gpslongitude') as $value) { + error_log("USING PJMT",'','0'); $arrHits = array(); // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) Modified: trunk/linpha2/lib/plugins/maps/settings.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -40,6 +40,7 @@ 'plugins_maps_google_key', 'plugins_maps_markerThumbSize', 'plugins_maps_enable_geotagged', + 'plugins_maps_geotagged_autoimport', )); } @@ -86,5 +87,14 @@ $LinAdmin->option_value_system['plugins_maps_enable_geotagged'] ); +if($GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged']) +{ + $LinAdmin->printAdminConfig( + 'radio', + i18n("Auto Import Geotagged Images"), + 'plugins_maps_geotagged_autoimport', + $LinAdmin->option_value_system['plugins_maps_geotagged_autoimport'] + ); +} ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-01-30 16:46:20
|
Revision: 4837 http://linpha.svn.sourceforge.net/linpha/?rev=4837&view=rev Author: fangehrn Date: 2008-01-30 08:46:15 -0800 (Wed, 30 Jan 2008) Log Message: ----------- fixed html "error" Modified Paths: -------------- trunk/linpha2/lib/include/db_connect_error.html Modified: trunk/linpha2/lib/include/db_connect_error.html =================================================================== --- trunk/linpha2/lib/include/db_connect_error.html 2008-01-30 13:35:12 UTC (rev 4836) +++ trunk/linpha2/lib/include/db_connect_error.html 2008-01-30 16:46:15 UTC (rev 4837) @@ -9,8 +9,9 @@ <br> <h2><u>Database Connection Error</u></h2> <br><br> -<img src="<?php echo LINPHA_DIR; ?>/lib/graphics/linpha2.gif"> +<img src="<?php echo LINPHA_DIR; ?>/lib/graphics/linpha2.gif" /> <br><br> <h2>Service should be back shortly</h2> The LinPHA Team +</div> </body></html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-01-30 13:35:15
|
Revision: 4836 http://linpha.svn.sourceforge.net/linpha/?rev=4836&view=rev Author: bzrudi Date: 2008-01-30 05:35:12 -0800 (Wed, 30 Jan 2008) Log Message: ----------- "first try on spitting GPS geodata from images into maps plugin - expect it broken for all DB other than PostgreSQL" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/include/sql/sql.mysql.php trunk/linpha2/lib/include/sql/sql.oci8po.php trunk/linpha2/lib/include/sql/sql.postgres.php trunk/linpha2/lib/include/sql/sql.sqlite.php trunk/linpha2/lib/include/sql/sql.tables.php trunk/linpha2/lib/plugins/filemanager/sql/sql.data.php trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/lib/plugins/maps/settings.maps.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/ChangeLog 2008-01-30 13:35:12 UTC (rev 4836) @@ -1,4 +1,11 @@ - +2008-01-30 bzrudi + * Split out GPS meta/geodata from meta_exif into a seperate relation within the + maps plugin. The relation is created when admin enables the maps plugin + and is called 'plugins_maps_image_geodata'. This is mostly done due to + expected performance issues and the mysql "big table" problem. + It should currently work partially with PostgresDB, other DB will follow + later. Needs "reset_database.php" to work and sys_import_use_exiftool=1 + 2008-01-29 flo * updated to latest protoype 1.6.0.2 and scriptaculous 1.8.1 * compressed javascript files with yui compresser Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -185,7 +185,8 @@ $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); - //echo '<pre>', print_r($dataArray), '</pre>'; + echo '<pre>', print_r($dataArray), '</pre>'; + $str_columns = "md5sum, "; $str_values = "'" . $md5sum . "', "; @@ -221,7 +222,6 @@ } } - /** * Simple method to return just exif date and orientation tag during * import as needed by linpha_photos, this is not used for any meta_x table. @@ -507,41 +507,7 @@ 'saturation' => 'Saturation', 'sharpness' => 'Sharpness', 'subjectdistancerange' => 'Subject Distance Range', - 'gamma' => 'Gamma', - - //GPS - 'gpsversionid' => 'GPS Version ID', - 'gpslatituderef' => 'GPS Latitude Ref', - 'gpslatitude' => 'GPS Latitude', - 'gpslongituderef' => 'GPS Longitude Ref', - 'gpslongitude' => 'GPS Longitude', - 'gpsaltituderef' => 'GPS Altitude Ref', - 'gpsaltitude' => 'GPS Altitude', - 'gpstimestamp' => 'GPS Time Stamp', - 'gpssatellites' => 'GPS Satellites', - 'gpsstatus' => 'GPS Status', - 'gpsmeasuremode' => 'GPS Measure Mode', - 'gpsdop' => 'GPS DOP', - 'gpsspeedref' => 'GPS Speed Ref', - 'gpsspeed' => 'GPS Speed', - 'gpstrackref' => 'GPS Track', - 'gpstrack' => 'GPS Track', - 'gpsimgdirectionref' => 'GPS Img Direction Ref', - 'gpsimgdirection' => 'GPS Img Direction', - 'gpsmapdatum' => 'GPS Map Datum', - 'gpsdestlatituderef' => 'GPS Dest Latitude Ref', - 'gpsdestlatitude' => 'GPS Dest Latitude', - 'gpsdestlongituderef' => 'GPS Dest Longitude Ref', - 'gpsdestlongitude' => 'GPS Dest Longitude', - 'gpsdestbearingref' => 'GPS Dest Bearing Ref', - 'gpsdestbearing' => 'GPS Dest Bearing', - 'gpsdestdistanceref' => 'GPS Dest Distance Ref', - 'gpsdestdistance' => 'GPS Dest Distance', - 'gpsprocessingmethod' => 'GPS Processing Method', - 'gpsareainformation' => 'GPS Area Information', - 'gpsdatestamp' => 'GPS Date Stamp', - 'gpsdatetime' => 'GPS Date Time', - 'gpsposition' => 'GPS Position' //not definied in exiftool!? + 'gamma' => 'Gamma' ) ); } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -742,9 +742,10 @@ /** * This method is used to setup the initial most useful defaults for the - * MetaData tables EXIF/IPTC/XMP during creation - * @param string exif,iptc,xmp - * @return array initial metadata values used for table create + * MetaData tables EXIF/IPTC/XMP during creation and provides default + * Geodata (GPS) Tgas for the maps plugin + * @param string exif,iptc,xmp,gps + * @return array with metadata information * @author bzrudi,flo */ private function getDefaultMetaTags($type) @@ -801,6 +802,43 @@ 'supplementalcategories', ); break; + + case 'gps': + return array ( + 'gpsversionid', + 'gpslatituderef', + 'gpslatitude', + 'gpslongituderef', + 'gpslongitude', + 'gpsaltituderef', + 'gpsaltitude', + 'gpstimestamp', + 'gpssatellites', + 'gpsstatus', + 'gpsmeasuremode', + 'gpsdop', + 'gpsspeedref', + 'gpsspeed', + 'gpstrackref', + 'gpstrack', + 'gpsimgdirectionref', + 'gpsimgdirection', + 'gpsmapdatum', + 'gpsdestlatituderef', + 'gpsdestlatitude', + 'gpsdestlongituderef', + 'gpsdestlongitude', + 'gpsdestbearingref', + 'gpsdestbearing', + 'gpsdestdistanceref', + 'gpsdestdistance', + 'gpsprocessingmethod', + 'gpsareainformation', + 'gpsdatestamp', + 'gpsdatetime', + 'gpsposition', + ); + break; default: return array(); @@ -883,7 +921,67 @@ return $str; } + + /** + * Save all Image GeoData (GPS) to database. + * Used in maps plugin if enabled. We just get all information about images + * from the LIN_PREFIX.photos relation. For speed improvements a new value + * bool value "geodata" is altered to the photos relation to only parse all + * images once. + * + */ + function importGeoData() + { + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum + FROM ".LIN_PREFIX."photos + WHERE img_type <> 0 + AND img_type <> 9999999 + AND geodata <> 1 "); + + while ($data = $query->FetchRow()) + { + $filename = LinSql::getFullImagePath($data['0']); + $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); + echo '<pre>', print_r($dataArray), '</pre>'; + + $str_columns = "md5sum, "; + $str_values = "'".$data['1']."', "; + + if(is_array($dataArray)) + { + /** + * Lower array data to make it compareable to $metaTags + */ + $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); + + echo '<pre>', print_r($lowerDataArray), '</pre>'; + + foreach($this->getDefaultMetaTags('gps') AS $key => $value) + { + if(array_key_exists($value, $lowerDataArray)) + { + + $str_columns .= str_replace("_", "-", $value) . ', '; + $str_values .= "'".trim($lowerDataArray[$value])."', "; + } + } + /** + * Remove last two signs (the comma and the space) which we add to much + */ + $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); + $str_values = substr($str_values, 0, strlen($str_values) - 2); + + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_image_geodata " . + "(" . $str_columns . ") VALUES (" . $str_values . ")"); + + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET geodata='1' WHERE md5sum='".$data['1']."' "); + } + } + } + /** * Simple wrapper method for saveMetaData() * @param string $what meta type exif,iptc,xmp Modified: trunk/linpha2/lib/include/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.mysql.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/include/sql/sql.mysql.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -74,6 +74,7 @@ "stats_numbers INT NOT NULL default '0', " . "stats_views INT NOT NULL default '0', " . "stats_downloads INT NOT NULL default '0', " . + "geodata INT(1) default '0', " . "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". Modified: trunk/linpha2/lib/include/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -69,6 +69,7 @@ "stats_numbers NUMBER(10) DEFAULT '0', " . "stats_views NUMBER(10) DEFAULT '0', " . "stats_downloads NUMBER(10) DEFAULT '0'" . + "geodata NUMBER(1) default '0' " . ")", "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". "id NUMBER PRIMARY KEY, " . Modified: trunk/linpha2/lib/include/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.postgres.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/include/sql/sql.postgres.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -68,7 +68,8 @@ "rotate 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' " . + "stats_downloads INT NOT NULL default '0', " . + "geodata INT default '0' " . ")", "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". "id SERIAL PRIMARY KEY, " . Modified: trunk/linpha2/lib/include/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -68,7 +68,8 @@ "rotate 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' " . + "stats_downloads INTEGER NOT NULL default '0', " . + "geodata INTEGER default '0' " . ")", "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". "id INTEGER PRIMARY KEY, " . Modified: trunk/linpha2/lib/include/sql/sql.tables.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.tables.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/include/sql/sql.tables.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -17,10 +17,18 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/** - * linpha installer - */ - +if(isset($GLOBALS['linpha']->sql->config->value['plugins_maps_enable'])) +{ + // still need the plugin entries; workaround for reset_database.php + $plugins_maps_image_geodata = 'plugins_maps_image_geodata => plugins_maps_image_geodata'; + $plugins_maps_markers = 'plugins_maps_markers => plugins_maps_markers'; +} +else +{ + $plugins_maps_image_geodata = ''; + $plugins_maps_markers = ''; +} + $linpha_tables = Array( "config" => "config", "users" => "users", @@ -36,6 +44,9 @@ "meta_xmp" => "meta_xmp", "meta_comments" => "meta_comments", "meta_data" => "meta_data", - "plugins_maps_setMarkers" => "plugins_maps_markers", // still need the plugin entries; workaround for reset_database.php + "plugins_maps_image_geodata" => "plugins_maps_image_geodata", + "plugins_maps_markers" => "plugins_maps_markers", + //$plugins_maps_image_geodata."", + //$plugins_maps_markers, ); ?> Modified: trunk/linpha2/lib/plugins/filemanager/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/plugins/filemanager/sql/sql.data.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/plugins/filemanager/sql/sql.data.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -10,9 +10,4 @@ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . "VALUES ('plugins_filemanager_nrUploads', '0', '0', '0')"; - - -//$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . -// "VALUES ('plugins_example', ';public;')"; - -?> \ No newline at end of file +?> Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -1,327 +1,346 @@ -<?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. - */ - -/** - * Google Maps - * @package Plugins - */ -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * xml load/save stuff - */ -if(isset($_GET['xml'])) -{ - if(isset($_REQUEST['cmd'])) // $_POST - { - switch($_REQUEST['cmd']) // $_POST - { - case 'loadMarkers': - - echo '{ "markers": [' . "\n"; - - $query = $GLOBALS['linpha']->db->Execute( - "SELECT id, albId, albPath, markerName, markerLat, markerLon, markerZoom " . - "FROM ".LIN_PREFIX."plugins_maps_markers" - ); - - if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) { - $allowed = true; - } else { - $allowed = false; - } - - while($data = $query->FetchRow()) - { - if( $data['albId']!=0 ) { - - $query2 = $GLOBALS['linpha']->db->Execute("SELECT P.parent_id " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL " . - "AND P.parent_id = '".LinSql::linAddslashes($data['albId'])."'"); - if($query2->EOF) { - $type = 'album'; - } else { - $type = 'albumWithImg'; - } - - } else { - $type = 'marker'; - } - - $path = htmlspecialchars($data['albPath'],ENT_QUOTES); - - echo '{"id": '.$data['id'].', "type": "'.$type.'", "albId": '.$data['albId'].', "path": "'.$path.'", ' . - '"name": "'.htmlspecialchars($data['markerName'],ENT_QUOTES).'", ' . - '"lat": '.$data['markerLat'].', "lon": '.$data['markerLon'].', ' . - '"zoom": '.$data['markerZoom'].'}'; - - // firefox ignores the last comma, but IE produces an error! grmpf - if( !$query->EOF ) { - echo ",\n"; - } else { - echo "\n"; - } - } - - /* ?> { "markers": [ - {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, - {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, - {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, - ] } <?php */ - - echo '] }' . "\n"; - - break; - - case 'saveMarker': - case 'editMarker': - - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) - OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; - } - else - { - if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) - { - $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; - } - - if( $_POST['cmd'] == 'saveMarker' ) - { - $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_markers " . - "(markerName, markerLat, markerLon, markerZoom) " . - "VALUES (" . - "'".LinSql::linAddslashes($_POST['linInputMarkerName'])."', " . - "'".floatval($_POST['linInputLat'])."', " . - "'".floatval($_POST['linInputLon'])."', " . - "'".intval($_POST['linInputZoom'])."')" - ); - } - else // edit Marker - { - if( !isset($_POST['linInputMarkerId']) OR empty($_POST['linInputMarkerId']) ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: No valid marker").'</responseMsg>'."\n"; - } - } - - echo '<responseCode>success</responseCode>'."\n"; - } - - echo '</root>'."\n"; - - break; - case 'deleteMarker': - - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; - } - elseif( !isset($_REQUEST['markerId']) ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_NOVALIDDATA.'</responseMsg>'."\n"; - } - else - { - $markerId = intval($_REQUEST['markerId']); - $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."plugins_maps_markers " . - "WHERE id='".LinSql::linAddslashes($markerId)."'"); - - echo '<responseCode>success</responseCode>'."\n"; - echo '<responseData>'.$markerId.'</responseData>'."\n"; - } - - echo '</root>'."\n"; - - break; - - case 'assignAlbum': - case 'assignAlbumChange': - case 'assignAlbumDelete': - - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; - } - elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_NOVALIDDATA.'</responseMsg>'."\n"; - } - else - { - $markerId = intval($_REQUEST['markerId']); - $albId = intval($_REQUEST['albId']); - - $arrAlbPath = LinSql::getFullFilenameFromId($albId); - $albPath = implode('/',$arrAlbPath); - - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."plugins_maps_markers " . - "SET albId = '".LinSql::linAddslashes($albId)."', " . - "albPath = '".LinSql::linAddslashes($albPath)."' WHERE id='".LinSql::linAddslashes($markerId)."'"); - - echo '<responseCode>success</responseCode>'."\n"; - } - - echo '</root>'."\n"; - - break; - case 'loadAlbums': - - echo '{ "albums": [' . "\n"; - - $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL "); - - echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; - - if( !$query ) - { - //echo "Error: Please enable EXIF GPS fields!"; - } - else - { - while($data = $query->FetchRow()) - { - echo '{"id": '.$data['parent_id'].', "name": "'. - htmlspecialchars( - implode( '/', LinSql::getFullFilenameFromId($data['parent_id']) ) - ,ENT_QUOTES).'"}'; - - // firefox ignores the last comma, but IE produces an error! grmpf - if( !$query->EOF ) { - echo ",\n"; - } else { - echo "\n"; - } - } - } - - echo '] }' . "\n"; - - break; - case 'loadImages': - - if( !isset($_REQUEST['albId']) ) { - break; - } - - $albId = intval($_REQUEST['albId']); - - if($albId == 0) { - $filterStr = ""; - } else { - $filterStr = "AND P.parent_id = '".$albId."'"; - } - - $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL " . - $filterStr); - - echo '{ "images": [' . "\n"; - - if( !$query ) - { - //echo "Error: Please enable EXIF GPS fields!"; - } - else - { - while($data = $query->FetchRow()) - { - $latlon = getExifLatLon($data); - - echo '{"id": '.$data['id'].', "parent_id": '.$data['parent_id'].', ' . - '"type": "images", "text": "", "name": "'.htmlspecialchars( $data['name'] ,ENT_QUOTES).'", ' . - '"lat": '.$latlon['gpslatitude'].', "lon": '.$latlon['gpslongitude'] . - "}"; - - // firefox ignores the last comma, but IE produces an error! grmpf - if( !$query->EOF ) { - echo ",\n"; - } else { - echo "\n"; - } - } - } - - echo '] }' . "\n"; - - break; - } - } - - exit(); -} - - -$urlFull = LINPHA_LINK.'&linCat=maps'; - -$linpha->template->setModuleName('maps'); -//$linpha->template->overrideModule('head','map'); -$linpha->template->URL_full = $urlFull; -$linpha->template->URL_base = $urlFull; -$linpha->template->output['title'] = i18n("Maps"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); - - +<?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. + */ + +/** + * Google Maps + * @package Plugins + */ +if(!defined('LINPHA_DIR')) { exit(1); } + + //$MetaData = new LinMetaData(); + //$MetaData->importGeoData(); +/** + * xml load/save stuff + */ +if(isset($_GET['xml'])) +{ + if(isset($_REQUEST['cmd'])) // $_POST + { + switch($_REQUEST['cmd']) // $_POST + { + case 'loadMarkers': + error_log("LOADING MARKERS",'','0'); + + echo '{ "markers": [' . "\n"; + + $query = $GLOBALS['linpha']->db->Execute( + "SELECT id, albid, albpath, markername, markerlat, markerlon, markerzoom " . + "FROM ".LIN_PREFIX."plugins_maps_markers" + ); + + if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) { + $allowed = true; + } else { + $allowed = false; + } + + while($data = $query->FetchRow()) + { + if( $data['albid'] != '0' ) { + + $query2 = $GLOBALS['linpha']->db->Execute("SELECT P.parent_id " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "INNER JOIN ".LIN_PREFIX."photos P " . + "ON PM.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL " . + "AND P.parent_id = '".LinSql::linAddslashes($data['albid'])."'"); + + if($query2->EOF) { + $type = 'album'; + } else { + $type = 'albumWithImg'; + } + + } else { + $type = 'marker'; + } + + $path = htmlspecialchars($data['albpath'],ENT_QUOTES); + + echo '{"id": '.$data['id'].', "type": "'.$type.'", "albid": '.$data['albid'].', "path": "'.$path.'", ' . + '"name": "'.htmlspecialchars($data['markername'],ENT_QUOTES).'", ' . + '"lat": '.$data['markerlat'].', "lon": '.$data['markerlon'].', ' . + '"zoom": '.$data['markerzoom'].'}'; + + // firefox ignores the last comma, but IE produces an error! grmpf + if( !$query->EOF ) { + echo ",\n"; + } else { + echo "\n"; + } + } + + /* ?> { "markers": [ + {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, + {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, + {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, + ] } <?php */ + + echo '] }' . "\n"; + + break; + + case 'saveMarker': + + //error_log("SAVING MARKERS",'','0'); + + case 'editMarker': + + //error_log("EDITING MARKERS",'','0'); + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) + OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; + } + else + { + if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) + { + $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; + } + + if( $_POST['cmd'] == 'saveMarker' ) + { + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_markers " . + "(markername, markerlat, markerlon, markerzoom) " . + "VALUES (" . + "'".LinSql::linAddslashes($_POST['linInputMarkerName'])."', " . + "'".floatval($_POST['linInputLat'])."', " . + "'".floatval($_POST['linInputLon'])."', " . + "'".intval($_POST['linInputZoom'])."')" + ); + } + else // edit Marker + { + if( !isset($_POST['linInputMarkerId']) OR empty($_POST['linInputMarkerId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid marker").'</responseMsg>'."\n"; + } + } + + echo '<responseCode>success</responseCode>'."\n"; + } + + echo '</root>'."\n"; + + break; + case 'deleteMarker': + + //error_log("DELETING MARKERS",'','0'); + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_REQUEST['markerId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_NOVALIDDATA.'</responseMsg>'."\n"; + } + else + { + $markerId = intval($_REQUEST['markerId']); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."plugins_maps_markers " . + "WHERE id='".LinSql::linAddslashes($markerId)."'"); + + echo '<responseCode>success</responseCode>'."\n"; + echo '<responseData>'.$markerId.'</responseData>'."\n"; + } + + echo '</root>'."\n"; + + break; + + case 'assignAlbum': + case 'assignAlbumChange': + case 'assignAlbumDelete': + + //error_log("ASSIGNING ALBUM MARKERS",'','0'); + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_NOVALIDDATA.'</responseMsg>'."\n"; + } + else + { + $markerId = intval($_REQUEST['markerId']); + $albid = intval($_REQUEST['albId']); + + $arralbpath = LinSql::getFullFilenameFromId($albid); + $albpath = implode('/',$arralbpath); + + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."plugins_maps_markers " . + "SET albid = '".LinSql::linAddslashes($albid)."', " . + "albpath = '".LinSql::linAddslashes($albpath)."' " . + "WHERE id='".LinSql::linAddslashes($markerId)."'"); + + echo '<responseCode>success</responseCode>'."\n"; + } + + echo '</root>'."\n"; + + break; + case 'loadAlbums': + + //error_log("LOADING ALBUMS",'','0'); + echo '{ "albums": [' . "\n"; + + $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL "); + + echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; + + if( !$query ) + { + //echo "Error: Please enable EXIF GPS fields!"; + } + else + { + while($data = $query->FetchRow()) + { + echo '{"id": '.$data['parent_id'].', "name": "'. + htmlspecialchars( + implode( '/', LinSql::getFullFilenameFromId($data['parent_id']) ) + ,ENT_QUOTES).'"}'; + + // firefox ignores the last comma, but IE produces an error! grmpf + if( !$query->EOF ) { + echo ",\n"; + } else { + echo "\n"; + } + } + } + + echo '] }' . "\n"; + + break; + case 'loadImages': + +// error_log("LOADING IMAGES",'','0'); + if( !isset($_REQUEST['albId']) ) { + break; + } + + $albid = intval($_REQUEST['albId']); + + if($albid == 0) { + $filterStr = ""; + } else { + $filterStr = "AND P.parent_id = '".$albid."'"; + } + + $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, " . + "P.name, gpslatituderef, gpslatitude, gpslongituderef, gpslongitude " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . + "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL " . + $filterStr); + + echo '{ "images": [' . "\n"; + + if( $query->EOF ) + { + error_log("Error: Please enable EXIF GPS fields!",'',0); + } + else + { + while($data = $query->FetchRow()) + { + $latlon = getExifLatLon($data); + echo '{"id": '.$data['id'].', "parent_id": '.$data['parent_id'].', ' . + '"type": "images", "text": "", "name": "'.htmlspecialchars( $data['name'] ,ENT_QUOTES).'", ' . + '"lat": '.$latlon['gpslatitude'].', "lon": '.$latlon['gpslongitude'] . + "}"; + + // firefox ignores the last comma, but IE produces an error! grmpf + if( !$query->EOF ) { + echo ",\n"; + } else { + echo "\n"; + } + } + } + + echo '] }' . "\n"; + + break; + } + } + + exit(); +} + + +$urlFull = LINPHA_LINK.'&linCat=maps'; + +$linpha->template->setModuleName('maps'); +//$linpha->template->overrideModule('head','map'); +$linpha->template->URL_full = $urlFull; +$linpha->template->URL_base = $urlFull; +$linpha->template->output['title'] = i18n("Maps"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + + function getExifLatLon(&$LatLon) { /*Array PJMT @@ -377,4 +396,4 @@ } return $return; } -?> \ No newline at end of file +?> Modified: trunk/linpha2/lib/plugins/maps/settings.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-30 12:59:00 UTC (rev 4835) +++ trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-30 13:35:12 UTC (rev 4836) @@ -1,81 +1,90 @@ -<?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. -*/ - -/** - * Settings for the admin section - * @package admin - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -echo '<a href="./?cat=permissions_plugins_maps_setMarkers">'.i18n("Set Edit Permissions For The Map Marker").'</a><br /><br />'; - - - -/** - * save settings - */ - if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - $LinAdmin->saveConfig(Array( - 'plugins_maps_defaultMarkerZoom', - 'plugins_maps_mapType', - 'plugins_maps_google_key', - 'plugins_maps_markerThumbSize', - )); - } - -/** - * print options - */ -$LinAdmin->printAdminConfig( - 'text', - i18n("Default Zoom Level For Markers"), - 'plugins_maps_defaultMarkerZoom', - $LinAdmin->option_value_system['plugins_maps_defaultMarkerZoom'] -); -$LinAdmin->printAdminConfig( - 'text', - i18n("Marker Thumbnail Size"), - 'plugins_maps_markerThumbSize', - $LinAdmin->option_value_system['plugins_maps_markerThumbSize'] -); - -echo '<br /><br />'; - -$LinAdmin->printAdminConfig( - 'select', - i18n("Map Provider (Currently only google is implemented)"), - 'plugins_maps_mapType', - $LinAdmin->option_value_system['plugins_maps_mapType'], - array('options' => array('google','yahoo','openstreetmap')) -); -$LinAdmin->printAdminConfig( - 'text', - i18n("Key For Google Maps"), - 'plugins_maps_google_key', - $LinAdmin->option_value_system['plugins_maps_google_key'] -); -echo '<a href="http://code.google.com/apis/maps/signup.html">'.i18n("Sign Up for the Google Maps API Key").'</a><br />'; -echo i18n("The default key is only valid for the domain http://localhost").'<br /><br />'; - - - -?> \ No newline at end of file +<?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. +*/ + +/** + * Settings for the admin section + * @package admin + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +echo '<a href="./?cat=permissions_plugins_maps_setMarkers">'.i18n("Set Edit Permissions For The Map Marker").'</a><br /><br />'; + + + +/** + * save settings + */ + if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + $LinAdmin->saveConfig(Array( + 'plugins_maps_defaultMarkerZoom', + 'plugins_maps_mapType', + 'plugins_maps_google_key', + 'plugins_maps_markerThumbSize', + 'plugins_maps_enable_geotagged', + + )); + } + +/** + * print options + */ +$LinAdmin->printAdminConfig( + 'text', + i18n("Default Zoom Level For Markers"), + 'plugins_maps_defaultMarkerZoom', + $LinAdmin->option_value_system['plugins_maps_defaultMarkerZoom'] +); +$LinAdmin->printAdminConfig( + 'text', + i18n("Marker Thumbnail Size"), + 'plugins_maps_markerThumbSize', + $LinAdmin->option_value_system['plugins_maps_markerThumbSize'] +); + +echo '<br /><br />'; + +$LinAdmin->printAdminConfig( + 'select', + i18n("Map Provider (Currently only google is implemented)"), + 'plugins_maps_mapType', + $LinAdmin->option_value_system['plugins_maps_mapType'], + array('options' => array('google','yahoo','openstreetmap')) +); +$LinAdmin->printAdminConfig( + 'text', + i18n("Key For Google Maps"), + 'plugins_maps_google_key', + $LinAdmin->option_value_system['plugins_maps_google_key'] +); + +echo '<a href="http://code.google.com/apis/maps/signup.html">'.i18n("Sign Up for the Google Maps API Key").'</a><br />'; +echo i18n("The default key is only valid for the domain http://localhost").'<br /><br />'; + +$LinAdmin->printAdminConfig( + 'radio', + i18n("Enable Support For Geotagged Images"), + 'plugins_maps_enable_geotagged', + $LinAdmin->option_value_system['plugins_maps_enable_geotagged'] +); + + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-01-30 12:59:06
|
Revision: 4835 http://linpha.svn.sourceforge.net/linpha/?rev=4835&view=rev Author: bzrudi Date: 2008-01-30 04:59:00 -0800 (Wed, 30 Jan 2008) Log Message: ----------- "don't use uppercase characters in column names, causes PG to stumple upon" Modified Paths: -------------- trunk/linpha2/lib/plugins/maps/sql/sql.data.php trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php Modified: trunk/linpha2/lib/plugins/maps/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.data.php 2008-01-29 21:18:19 UTC (rev 4834) +++ trunk/linpha2/lib/plugins/maps/sql/sql.data.php 2008-01-30 12:59:00 UTC (rev 4835) @@ -18,8 +18,10 @@ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . "VALUES ('plugins_maps_markerThumbSize', '350', '0', '0')"; - $sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('plugins_maps_setMarkers', '')"; -?> \ No newline at end of file +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . + "VALUES ('plugins_maps_enable_geotagged', '0', '0', '0')"; + +?> Modified: trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php 2008-01-29 21:18:19 UTC (rev 4834) +++ trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php 2008-01-30 12:59:00 UTC (rev 4835) @@ -1,14 +1,14 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "albId INT NOT NULL default '0', " . - "albPath VARCHAR(255) NOT NULL default '', " . - "markerName VARCHAR(255) NOT NULL default '', " . - "markerLat VARCHAR(255) NOT NULL default '', " . - "markerLon VARCHAR(255) NOT NULL default '', " . - "markerZoom INT NOT NULL default '0', " . - "PRIMARY KEY (id) )"; - +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". + "id INT NOT NULL AUTO_INCREMENT, " . + "albid INT NOT NULL default '0', " . + "albpath VARCHAR(255) NOT NULL default '', " . + "markername VARCHAR(255) NOT NULL default '', " . + "markerlat VARCHAR(255) NOT NULL default '', " . + "markerlon VARCHAR(255) NOT NULL default '', " . + "markerzoom INT NOT NULL default '0', " . + "PRIMARY KEY (id) )"; + ?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php 2008-01-29 21:18:19 UTC (rev 4834) +++ trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php 2008-01-30 12:59:00 UTC (rev 4835) @@ -3,12 +3,12 @@ $sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". "id NUMBER PRIMARY KEY, " . - "albId NUMBER(10) DEFAULT '0', " . - "albPath VARCHAR(255) NOT NULL default '', " . - "markerName VARCHAR(255) NOT NULL default '', " . - "markerLat VARCHAR(255) NOT NULL default '', " . - "markerLon VARCHAR(255) NOT NULL default '', " . - "markerZoom NUMBER(10) DEFAULT '0' )"; + "albid NUMBER(10) DEFAULT '0', " . + "albpath VARCHAR(255) NOT NULL default '', " . + "markername VARCHAR(255) NOT NULL default '', " . + "markerlat VARCHAR(255) NOT NULL default '', " . + "markerlon VARCHAR(255) NOT NULL default '', " . + "markerzoom NUMBER(10) DEFAULT '0' )"; /** * autoincrement the oracle way ;-) Modified: trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php 2008-01-29 21:18:19 UTC (rev 4834) +++ trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php 2008-01-30 12:59:00 UTC (rev 4835) @@ -1,13 +1,47 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". - "id SERIAL PRIMARY KEY, " . - "albId INT default '0', " . - "albPath VARCHAR(255) NOT NULL default '', " . - "markerName VARCHAR(255) NOT NULL default '', " . - "markerLat VARCHAR(255) NOT NULL default '', " . - "markerLon VARCHAR(255) NOT NULL default '', " . - "markerZoom INT NOT NULL default '0' )"; - -?> \ No newline at end of file +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". + "id SERIAL PRIMARY KEY, " . + "albid INT default '0', " . + "albpath VARCHAR(255) NOT NULL default '', " . + "markername VARCHAR(255) NOT NULL default '', " . + "markerlat VARCHAR(255) NOT NULL default '', " . + "markerlon VARCHAR(255) NOT NULL default '', " . + "markerzoom SMALLINT NOT NULL default '0' )"; + +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_image_geodata ( ". + "md5sum CHAR(32) NOT NULL default '', " . + "gpsversionid VARCHAR(255) DEFAULT '', " . + "gpslatituderef VARCHAR(255) DEFAULT '', " . + "gpslatitude VARCHAR(255) DEFAULT '', " . + "gpslongituderef VARCHAR(255) DEFAULT '', " . + "gpslongitude VARCHAR(255) DEFAULT '', " . + "gpsaltituderef VARCHAR(255) DEFAULT '', " . + "gpsaltitude VARCHAR(255) DEFAULT '', " . + "gpstimestamp VARCHAR(255) DEFAULT '', " . + "gpssatellites VARCHAR(255) DEFAULT '', " . + "gpsstatus VARCHAR(255) DEFAULT '', " . + "gpsmeasuremode VARCHAR(255) DEFAULT '', " . + "gpsdop VARCHAR(255) DEFAULT '', " . + "gpsspeedref VARCHAR(255) DEFAULT '', " . + "gpsspeed VARCHAR(255) DEFAULT '', " . + "gpstrackref VARCHAR(255) DEFAULT '', " . + "gpstrack VARCHAR(255) DEFAULT '', " . + "gpsimgdirectionref VARCHAR(255) DEFAULT '', " . + "gpsimgdirection VARCHAR(255) DEFAULT '', " . + "gpsmapdatum VARCHAR(255) DEFAULT '', " . + "gpsdestlatituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlatitude VARCHAR(255) DEFAULT '', " . + "gpsdestlongituderef VARCHAR(255) DEFAULT '', " . + "gpsdestlongitude VARCHAR(255) DEFAULT '', " . + "gpsdestbearingref VARCHAR(255) DEFAULT '', " . + "gpsdestbearing VARCHAR(255) DEFAULT '', " . + "gpsdestdistanceref VARCHAR(255) DEFAULT '', " . + "gpsdestdistance VARCHAR(255) DEFAULT '', " . + "gpsprocessingmethod VARCHAR(255) DEFAULT '', " . + "gpsareainformation VARCHAR(255) DEFAULT '', " . + "gpsdatestamp VARCHAR(255) DEFAULT '', " . + "gpsdatetime VARCHAR(255) DEFAULT '', " . + "gpsposition VARCHAR(255) DEFAULT '' )"; +?> Modified: trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php 2008-01-29 21:18:19 UTC (rev 4834) +++ trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php 2008-01-30 12:59:00 UTC (rev 4835) @@ -1,13 +1,13 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". - "id INTEGER PRIMARY KEY, " . - "albId INTEGER NOT NULL default '0', " . - "albPath VARCHAR(255) NOT NULL default '', " . - "markerName VARCHAR(255) NOT NULL default '', " . - "markerLat VARCHAR(255) NOT NULL default '', " . - "markerLon VARCHAR(255) NOT NULL default '', " . - "markerZoom INTEGER NOT NULL default '0' )"; - +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +$sql_tables[] = "CREATE TABLE ".LIN_PREFIX."plugins_maps_markers ( ". + "id INTEGER PRIMARY KEY, " . + "albid INTEGER NOT NULL default '0', " . + "albpath VARCHAR(255) NOT NULL default '', " . + "markername VARCHAR(255) NOT NULL default '', " . + "markerlat VARCHAR(255) NOT NULL default '', " . + "markerlon VARCHAR(255) NOT NULL default '', " . + "markerzoom INTEGER NOT NULL default '0' )"; + ?> \ 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...> - 2008-01-29 21:18:28
|
Revision: 4834 http://linpha.svn.sourceforge.net/linpha/?rev=4834&view=rev Author: fangehrn Date: 2008-01-29 13:18:19 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Modified Paths: -------------- trunk/misc/design/22menuJSCook/indexJSEffectFade.php Added Paths: ----------- trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked2.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked3.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked31.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked4.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked5.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked6.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked61.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked62.js trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuWithEffects.js Added: trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked.js =================================================================== --- trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked.js (rev 0) +++ trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked.js 2008-01-29 21:18:19 UTC (rev 4834) @@ -0,0 +1 @@ +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7 1v={g:\'\',4x:\'\',4B:\'\',3Z:\'\',4C:\'\',4h:\'\',4j:\'\',4i:\'\',4k:\'\',4r:0,4g:0,2d:5D,1M:53,2l:5,3m:C,3p:C,2b:[0,0],2s:[0,0],2o:[0,0],1H:1,T:C};7 47=0;7 4q=\'54\';7 2z=C;7 18=C;7 29=Z 2j();7 1Y=Z 2j();7 2q=Z 2j();7 1i=Z 1C();7 12=Z 1C();7 3j=Z 1C();7 2K=0;7 44=0;7 42=V;7 2n=X;7 2r=0;k 55(o){7 1X=Z 2j();Q(v 4a o)1X[v]=o[v];j 1X}k 4l(I,f,E,o,g){7 1P=Z 2j();1P.2P=I;1P.f=f;1P.E=E;1P.o=o;1P.g=g;7 D=1i.H;1i[D]=1P;j D}k 56(){6(2K>0)j 1w(3j[--2K]);7 17=1r.57(\'52\');7 I=44++;17.I=\'5a\'+I;17.5b=\'0\';17.B.4W=\'5c\';17.5d=\'5e:X\';1r.1T.4X(17);17.B.5g=\'5h(1a=0)\';17.B.5i=5j;17.B.4e=\'4f\';17.B.5k=\'0\';17.5l=\'5m\';j 17}k 5n(17){3j[2K++]=17.I}k 3d(){j 4q+(++47)}k 3a(c,K,F,u,D){12[12.H]=c;7 M=12.H-1;F=(!F)?\'C\':(\'\\\'\'+F+\'\\\'\');7 1H=u.o.1H;7 48=(1H==3)||(1H==2&&K);7 1q=\'d,\'+K+\',\'+F+\',\'+D+\',\'+M;7 2L;6(48)2L=\' 3k="2y(\'+1q+\',X)" 49="3L (\'+1q+\')"\';s 2L=\' 3k="34 (\'+1q+\')" 49="36 (\'+1q+\')"\';j 2L+\' 4b="35 (\'+1q+\')" 5o="3M (\'+1q+\')"\'}k 43(c,K,F,u,D){12[12.H]=c;7 M=12.H-1;F=(!F)?\'C\':(\'\\\'\'+F+\'\\\'\');7 1q=\'d,\'+K+\',\'+F+\',\'+D+\',\'+M;j\' 3k="2y (\'+1q+\')" 4b="35 (\'+1q+\')"\'}k 3e(c){j c[1]}k 3b(g,K,11){7 Y=\'5p\'+g;6(K){Y+=\'4t\';6(11)Y+=\'4d\';s Y+=\'5q\'}s Y+=\'4d\';j 5r(Y)}k 3w(m,g,I,o,1M,u,D){7 q=\'<2P 1k="\'+g+\'3x" I="\'+I+\'" B="z-M: \'+1M+\';4e: 4f; 1z: 1b; 1y: 1b;">\';6(o.3m)q+=o.3m;q+=\'<1G 4m="5s f" I="\'+I+\'3G" 4o="\'+o.4g+\'" 1k="\'+g+\'5t">\';7 24=\'\';7 c;7 F;7 16;7 i;7 Y;Q(i=5;i<m.H;++i){c=m[i];6(!c)P;6(c==2q)c=3b(g,0,V);c.2Y=m;c.2k=I;16=(c.H>5);F=16?3d():C;q+=\'<1n 1k="\'+g+\'26"\';6(c[0]!=1Y)q+=3a(c,0,F,u,D);s q+=43(c,0,F,u,D);q+=\'>\'6(c[0]==29||c[0]==1Y){q+=3e(c);q+=\'</1n>\';P}Y=g+\'3z\';Y+=16?\'4u\':\'4v\';q+=\'<S 1k="\'+Y+\'3N">\';6(c[0]!=C)q+=c[0];s q+=16?o.4h:o.4i;q+=\'</S><S 1k="\'+Y+\'4y">\'+c[1];q+=\'</S><S 1k="\'+Y+\'4A">\';6(16){q+=o.4j;24+=3w(c,g,F,o,1M+o.2l,u,D)}s q+=o.4k;q+=\'</S></1n>\'}q+=\'</1G>\';6(o.3p)q+=o.3p;q+=\'</2P>\'+24;j q}k 4D(I,f,E,o,g){7 8=1w(I);6(!g)g=o.g;6(!g)g=\'\';6(!o)o=1v;6(!E)E=\'5u\';7 D=4l(I,f,E,o,g);7 u=1i[D];6(!o.2d)o.2d=1v.2d;6(!o.1H)o.1H=1v.1H;6(!o.1M)o.1M=1v.1M;6(!o.2l)o.2l=1v.2l;6(!o.2b)o.2b=1v.2b;6(!o.2s)o.2s=1v.2s;6(!o.2o)o.2o=1v.2o;u.5v=42;7 q=\'<1G 4m="5w f" 1k="\'+g+\'3z" 4o="\'+o.4r+\'">\';7 24=\'\';7 11;6(E.14(0)==\'h\'){q+=\'<1n>\';11=X}s{11=V}7 i;7 c;7 F;7 16;7 Y;Q(i=0;i<f.H;++i){c=f[i];6(!c)P;c.f=f;c.2k=I;q+=11?\'<1n\':\'<S\';q+=\' 1k="\'+g+\'2e"\';16=(c.H>5);F=16?3d():C;q+=3a(c,1,F,u,D)+\'>\';6(c==2q)c=3b(g,1,11);6(c[0]==29||c[0]==1Y){q+=3e(c);q+=11?\'</1n>\':\'</S>\';P}Y=g+\'4t\'+(16?\'4u\':\'4v\');q+=11?\'<S\':\'<1O\';q+=\' 1k="\'+Y+\'3N">\';q+=(c[0]==C)?(16?o.4x:o.3Z):c[0];q+=11?\'</S>\':\'</1O>\';q+=11?\'<S\':\'<1O\';q+=\' 1k="\'+Y+\'4y">\';q+=c[1];q+=11?\'</S>\':\'</1O>\';q+=11?\'<S\':\'<1O\';q+=\' 1k="\'+Y+\'4A">\';q+=16?o.4B:o.4C;q+=11?\'</S>\':\'</1O>\';q+=11?\'</1n>\':\'</S>\';6(16)24+=3w(c,g,F,o,o.1M,u,D)}6(!11)q+=\'</1n>\';q+=\'</1G>\'+24;8.2m=q}k 5x(I,E,o,g){7 2S=1w(I);7 f=C;Q(7 A=2S.R;A;A=A.1j){6(!A.J)P;7 1h=A.J.1K();6(1h!=\'3B\'&&1h!=\'3C\')P;f=2U(A);1l}6(f)4D(I,f,E,o,g)}k 2U(2S){7 13=Z 1C();Q(7 A=2S.R;A;A=A.1j){6(!A.J||A.J.1K()!=\'5y\')P;6(A.R==C){13[13.H]=2q;P}7 c=Z 1C();7 G=A.R;7 2T=X;Q(;G;G=G.1j){6(!G.J)P;6(G.N==\'5z\'){c[0]=1Y;c[1]=2V(G);2T=V;1l}6(G.N==\'5A\'){c[0]=29;c[1]=2V(G);2T=V;1l}7 1h=G.J.1K();6(1h!=\'1O\')P;6(!G.R)c[0]=C;s c[0]=G.2m;G=G.1j;1l}6(2T){13[13.H]=c;P}6(!G)P;Q(;G;G=G.1j){6(!G.J)P;7 1h=G.J.1K();6(1h==\'a\'){c[1]=G.2m;c[2]=G.5B;c[3]=G.2t;c[4]=G.5C;6(c[4]==\'\')c[4]=C}s 6(1h==\'1O\'||1h==\'2P\'){c[1]=G.2m;c[2]=C;c[3]=C;c[4]=C}1l}Q(;G;G=G.1j){6(!G.J)P;7 1h=G.J.1K();6(1h!=\'3B\'&&1h!=\'3C\')P;7 3r=2U(G);Q(i=0;i<3r.H;++i)c[i+5]=3r[i];1l}13[13.H]=c}j 13}k 2V(3F){7 1X=\'<S></S><S></S><S></S>\';7 A;Q(A=3F.R;A;A=A.1j){6(A.J&&A.J.1K()==\'1G\')1l}6(!A)j 1X;Q(A=A.R;A;A=A.1j){6(A.J&&A.J.1K()==\'4H\')1l}6(!A)j 1X;Q(A=A.R;A;A=A.1j){6(A.J&&A.J.1K()==\'1n\')1l}6(!A)j 1X;j A.2m}k 30(c){6(!c.2k)j C;7 m=1w(c.2k);6(c.f){7 f=c.f;m=m.R.R.R.R;7 i;Q(i=0;i<f.H;++i){6(f[i]==c)j m;m=m.1j}}s 6(c.2Y){7 f=c.2Y;7 1G=1w(c.2k+\'3G\');6(!1G)j C;m=1G.R.R;7 i;Q(i=5;i<f.H;++i){6(f[i]==c)j m;m=m.1j}}j C}k 4I(c,g){6(!c)j;7 21=30(c);6(!21)j;6(c.f)21.N=g+\'3T\';s 21.N=g+\'3P\';c.1R=V}k 4J(c,g){6(!c)j;7 21=30(c);6(!21)j;6(c.f)f.N=g+\'2e\';s f.N=g+\'26\';c.1R=V}k 2y(8,K,F,D,M,3H){6(!3H&&2n){34(8,K,F,D,M);j}3J(2z);6(12[M].1R)j;7 g=1i[D].g;6(!8.2N){8.2N=D;8.1U=K}7 t=1V(8,g);6(!t.1u)t.1u=Z 1C();7 i;Q(i=0;i<t.1u.H;++i){6(t.1u[i]==8)1l}6(i==t.1u.H){t.1u[i]=8}6(18){6(18==8||18==t){7 c=12[M];3g(c);j}7 31=1i[18.2N];7 2x=31.g;7 2J=1V(18,2x);6(2J!=t.2I){6(18.1U)18.N=2x+\'2e\';s 18.N=2x+\'26\';6(2J.I!=F)2M(2J,t,31)}}18=8;2H(t,g);7 c=12[M];7 3I=27(c);6(3I){6(K)8.N=g+\'3R\';s 8.N=g+\'3S\'}3g(c)}k 34(8,K,F,D,M){3J(2z);6(12[M].1R)j;2y(8,K,F,D,M,V);6(F){7 m=1w(F);7 u=1i[D];7 E=u.E;7 g=u.g;3f(8,K,m,u)}}k 35(8,K,F,D,M){7 2Q=1i[D].o.2d;2z=1x.4G(\'45 ()\',2Q);1x.40=\'\'}k 36(8,K,F,D,M){6(12[M].1R)j;6(27(12[M])){7 g=1i[D].g;6(8.1U)8.N=g+\'4M\';s 8.N=g+\'4N\'}}k 3L(8,K,F,D,M){6(12[M].1R)j;2n=V;36(8,K,F,D,M);6(F){7 m=1w(F);7 u=1i[D];3f(8,K,m,u)}}k 3M(8,K,F,D,M){6(12[M].1R)j;7 c=12[M];7 2B=C,2t=\'4O\';6(c.H>2)2B=c[2];6(c.H>3&&c[3])2t=c[3];6(2B!=C){2n=X;1x.4Q(2B,2t)}7 u=1i[D];7 g=u.g;7 t=1V(8,g);7 16=(c.H>5);6(!16){6(27(c)){6(8.1U)8.N=g+\'2e\';s 8.N=g+\'26\'}2M(t,C,u)}s{6(27(c)){6(8.1U)8.N=g+\'3R\';s 8.N=g+\'3S\'}}}k 41(8,K,m,u){7 E=u.E;7 1f;6(K){6(E.14(0)==\'h\')1f=u.o.2b;s 1f=u.o.2s}s 1f=u.o.2o;6(!K&&E.14(0)==\'h\')E=\'v\'+E.14(1)+E.14(2);7 1J=4T(E);7 p=m.20;7 1t=1S(m);7 W=3U(8,1J,p,1t);6(1J.14(0)==\'h\'){6(1J.14(1)==\'b\')m.B.1z=(2c(8,p)+2a(8)+1f[1])+\'O\';s m.B.1z=(2c(8,p)-2a(m)-1f[1])+\'O\';6(W==\'r\')m.B.1y=(1s(8,p)+1f[0])+\'O\';s m.B.1y=(1s(8,p)+1S(8)-1t-1f[0])+\'O\'}s{6(W==\'r\')m.B.1y=(1s(8,p)+1S(8)+1f[0])+\'O\';s m.B.1y=(1s(8,p)-1t-1f[0])+\'O\';6(1J.14(1)==\'b\')m.B.1z=(2c(8,p)+1f[1])+\'O\';s m.B.1z=(2c(8,p)+2a(8)-2a(m)+1f[1])+\'O\'}6(W!=E.14(2))E=E.14(0)+E.14(1)+W;j E}k 3U(8,1J,p,1t){7 W=1J.14(2);6(!(1r.1T))j W;7 1T=1r.1T;7 1W;7 2h;6(1x.3W){1W=1x.4U;2h=1x.3W+1W}s 6(1T.3Y){1W=1T.4V;2h=1T.3Y+1W}s j W;6(1J.14(0)==\'h\'){6(W==\'r\'&&(1s(8)+1t)>2h)W=\'l\';6(W==\'l\'&&(1s(8)+1S(8)-1t)<1W)W=\'r\';j W}s{6(W==\'r\'&&(1s(8,p)+1S(8)+1t)>2h)W=\'l\';6(W==\'l\'&&(1s(8,p)-1t)<1W)W=\'r\';j W}}k 3f(8,K,m,u){7 g=u.g;6(!m.2I){7 t=1V(8,g);m.2I=t;6(!t.1o)t.1o=Z 1C();t.1o[t.1o.H]=m}7 1F=m.1I;6(1F)1F.2p(V);s{7 E=41(8,K,m,u);m.3u=E;7 2F=X;6(m.B.1A!=\'3q\'&&u.o.T){2W{1F=u.o.T.3h(m,E);1F.2p(X)}2X(e){2F=V;m.1I=C}}s 2F=V;6(2F){m.B.1A=\'3q\'}}6(!2r){2r=2;2W{6(1x.4Y){6(4Z(50.51)<9)2r=1}}2X(e){}}6(2r==1){6(!m.1B)m.1B=Z 1C();3s("58",m);3s("59",m)}}k 2H(t,g){6(t.1u){7 i;7 q;7 13=t.1u;Q(i=0;i<13.H;++i){6(13[i].1U){6(13[i].N==(g+\'3T\'))P}s{6(13[i].N==(g+\'3P\'))P}6(13[i].1U)q=g+\'2e\';s q=g+\'26\';6(13[i].N!=q)13[i].N=q}}}k 45(){2n=X;6(18){7 u=1i[18.2N];7 g=u.g;2M(1V(18,g),C,u);18=C}}k 3i(t,u){7 1F=t.1I;6(1F)1F.2u(V);s{t.B.1A=\'1Q\';t.B.1z=\'1b\';t.B.1y=\'1b\';t.3u=C}4z(t);t.1u=C}k 2M(t,4c,u){7 g=u.g;7 q=g+\'3x\';6(t.1o){7 i;Q(i=0;i<t.1o.H;++i){3n(t.1o[i],u)}}1Z(t&&t!=4c){2H(t,g);6(t.N==q){3i(t,u)}s 1l;t=1V(t.2I,g)}}k 3n(t,u){6(t.B.1A==\'1Q\')j;6(t.1o){7 i;Q(i=0;i<t.1o.H;++i){3n(t.1o[i],u)}}7 g=u.g;2H(t,g);3i(t,u)}k 3s(J,m){7 x=2A(m);7 y=2E(m);7 w=m.2O;7 h=m.23;7 i;Q(i=0;i<1r.2w.4n(J).H;++i){7 8=1r.2w.4n(J)[i];6(!8||!8.20)P;7 3c=2A(8);7 38=2E(8);7 4s=8.2O;7 4w=8.23;6(3c>(x+w)||(3c+4s)<x)P;6(38>(y+h)||(38+4w)<y)P;6(8.B.1A==\'1Q\')P;m.1B[m.1B.H]=8;8.B.1A=\'1Q\'}}k 4z(m){6(m.1B){7 i;Q(i=0;i<m.1B.H;++i)m.1B[i].B.1A=""}m.1B=C}k 1V(8,g){7 4E=g+\'3x\';7 4F=g+\'3z\';1Z(8){6(8.N==4E||8.N==4F)j 8;8=8.3V}j C}k 2g(D,U,2Q){1x.4G(\'3D("\'+D+\'",\'+U+\')\',2Q)}k 3D(D,U){7 f=1w(D);6(!f||!f.1I)j;2W{6(U)f.1I.2p(X);s f.1I.2u(X)}2X(e){}}k 27(c){6(c==2q||c[0]==29||c[0]==1Y)j X;j V}k 1w(I){6(1r.2w)j 1r.2w[I];j 1r.4L(I)}k 1S(8){7 33=8.2O;6(33>0||!2D(8))j 33;6(!8.R)j 0;j 8.3K.28-8.R.28+1S(8.3K)}k 2a(8){7 39=8.23;6(39>0||!2D(8))j 39;6(!8.R)j 0;j 8.R.23}k 2A(8){6(!8)j 0;7 x=0;3O{x+=8.28;8=8.20}1Z(8);j x}k 1s(8,1D){7 x=0;1Z(8&&8!=1D){x+=8.28;8=8.20}6(8==1D)j x;j x-2A(1D)}k 2E(8){6(!8)j 0;7 y=0;3O{y+=8.2R;8=8.20}1Z(8);j y}k 2D(8){7 J=8.J;j J=="4P"||J=="1n"||J=="4R"||J=="4S"}k 2c(8,1D){7 y=0;6(!8.23&&2D(8)){7 3X=8.3V.R;8=8.R;y-=3X.R.2R}1Z(8&&8!=1D){y+=8.2R;8=8.20}6(8==1D)j y;j y-2E(1D)}k 3g(c){7 25=\'\';6(c.H>4)25=(c[4]!=C)?c[4]:(c[2]?c[2]:25);s 6(c.H>2)25=(c[2]?c[2]:25);1x.40=25}k 5f(8){6(8==3E)j\'3E\';6(8==C)j\'C\';7 3l=8+\':\\n\';7 i;Q(i 4a 8)3l+=i+\' = \'+8[i]+\'; \';j 3l}k 1E(T,f){T.U=V;T.f=f;f.1I=T;d.T=T}1E.19.3y=k(1c){6(1c){6(d.T.U)j X;d.T.U=V}s 6(!d.T.U)j X;j V}1E.19.2Z=k(1c){7 T=d.T;6(1c){6(!T.U)j X;T.U=X}s 6(T.U)j X;j V}1E.19.3A=k(){7 f=d.T.f;f.B.1A=\'3q\'}1E.19.3o=k(){}1E.19.3t=k(){7 f=d.T.f;f.B.1A=\'1Q\';f.B.1z=\'1b\';f.B.1y=\'1b\';f.1I=C;f.3u=C;d.T.f=C}k 22(f,E,15){d.1d=Z 1E(d,f);f.B.4p=\'1Q\';d.x=f.28;d.y=f.2R;6(E.14(0)==\'h\'){d.2v=\'h\';d.2C=E.14(1)}s{d.2v=\'v\';d.2C=E.14(2)}d.15=15;d.1e=f.2O;d.1g=f.23;d.L=0}22.19.2p=k(1c){6(!d.1d.3y(1c))j;7 L=d.L;6(d.2v==\'h\')d.37();s d.32();6(L==0){d.1d.3A()}6(L<1m){d.L+=d.15;2g(d.f.I,d.U,10)}s 6(d.U){d.1d.3o()}}22.19.2u=k(1c){6(!d.1d.2Z(1c))j;7 L=d.L;6(d.2v==\'h\')d.37();s d.32();6(L>0){d.L-=d.15;2g(d.f.I,d.U,10)}s 6(!d.U){d.f.B.2i=\'4K\';d.1d.3t()}}22.19.32=k(){7 L=d.L;6(L<0)L=0;6(L>1m)L=1m;7 1e=d.1e;7 1g=d.1g;7 x=d.x;7 1p=L*1e/1m;7 f=d.f;6(d.2C==\'l\'){f.B.1y=(x+1e-1p)+\'O\';f.B.2i=\'2G(1b \'+1p+\'O \'+1g+\'O 1b)\'}s{f.B.1y=(x-1e+1p)+\'O\';f.B.2i=\'2G(1b \'+1e+\'O \'+1g+\'O \'+(1e-1p)+\'O)\'}}22.19.37=k(){7 L=d.L;6(L<0)L=0;6(L>1m)L=1m;7 1e=d.1e;7 1g=d.1g;7 y=d.y;7 1p=L*1g/1m;7 f=d.f;6(d.2C==\'b\'){f.B.1z=(y-1g+1p)+\'O\';f.B.2i=\'2G(\'+(1g-1p)+\'O \'+1e+\'O \'+1g+\'O 1b)\'}s{f.B.1z=(y+1g-1p)+\'O\';f.B.2i=\'2G(1b \'+1e+\'O \'+1p+\'O 1b)\'}}k 46(15){6(!15)15=10;s 6(15<=0)15=10;s 6(15>=1m)15=1m;d.15=15}46.19.3h=k(f,E){j Z 22(f,E,d.15)}k 2f(f,1L,1N){d.1d=Z 1E(d,f);f.B.4p=\'1Q\';d.1L=1L;d.1N=1N;d.1a=0}2f.19.2p=k(1c){6(!d.1d.3y(1c))j;7 f=d.f;7 1a=d.1a;d.3v();6(1a==0){d.1d.3A()}6(1a<1m){d.1a+=10;2g(f.I,d.U,d.1L)}s 6(d.U){d.1d.3o()}}2f.19.2u=k(1c){6(!d.1d.2Z(1c))j;7 f=d.f;7 1a=d.1a;d.3v();6(d.1a>0){d.1a-=10;2g(f.I,d.U,d.1N)}s 6(!d.U){d.1d.3t()}}2f.19.3v=k(){d.f.B.1a=d.1a/1m}k 3Q(1L,1N){d.1L=1L;d.1N=1N}3Q.19.3h=k(f,E){j Z 2f(f,d.1L,d.1N)}',62,350,'||||||if|var|obj||||item|this||menu|prefix|||return|function||subMenu||nodeProperties||str||else|thisMenu|menuInfo||||||currentDomItem|style|null|menuID|orient|idSub|currentItem|length|id|tagName|isMain|percent|index|className|px|continue|for|firstChild|td|effect|show|true|horiz|false|classStr|new||vertical|_0|items|charAt|speed|hasChild|frameObj|_1|prototype|opacity|0px|changed|base|fullWidth|offsetAdjust|fullHeight|tag|_2|nextSibling|class|break|100|tr|cmSubMenu|space|param|document|cmGetXAt|subMenuWidth|cmItems|_3|cmGetObject|window|left|top|visibility|cmOverlap|Array|elm|CMSpecialEffectInstance|effectInstance|table|clickOpen|cmEffect|mode|toLowerCase|showSpeed|zIndexStart|hideSpeed|span|info|hidden|isDisabled|cmGetWidth|body|cmIsMain|cmGetThisMenu|browserLeft|returnVal|_4|while|offsetParent|menuItem|CMSlidingEffectInstance|offsetHeight|strSub|descript|MenuItem|cmIsDefaultItem|offsetLeft|_6|cmGetHeight|offsetHMainAdjust|cmGetYAt|delay|MainItem|CMFadingEffectInstance|cmTimeEffect|browserRight|clip|Object|subMenuID|zIndexInc|innerHTML|_5|offsetSubAdjust|showEffect|_7|_8|offsetVMainAdjust|target|hideEffect|slideOrient|all|thatPrefix|cmItemMouseOver|_9|cmGetX|link|slideDir|cmIsTRNode|cmGetY|forceShow|rect|cmResetMenu|cmParentMenu|thatMenu|_10|returnStr|cmHideMenu|cmMenuID|offsetWidth|div|delayTime|offsetTop|domMenu|hasAction|cmDrawFromTextSubMenu|getActionHTML|try|catch|parentItem|canHide|cmGetMenuItem|thatMenuInfo|slideMenuH|width|cmItemMouseOverOpenSub|cmItemMouseOut|cmItemMouseDown|slideMenuV|oy|height|cmActionItem|cmSplitItem|ox|cmNewID|cmNoActionItem|cmShowSubMenu|cmSetStatus|getInstance|cmHideThisMenu|_11|onmouseover|msg|subMenuHeader|cmHideSubMenu|finishShowing|subMenuFooter|visible|subMenuItems|cmHideControl|finishHiding|cmOrient|setOpacity|cmDrawSubMenu|SubMenu|canShow|Menu|startShowing|ul|ol|cmCallEffect|undefined|htmlNode|Table|calledByOpenSub|isDefaultItem|clearTimeout|lastChild|cmItemMouseDownOpenSub|cmItemMouseUp|Left|do|MenuItemDisabled|CMFadingEffect|MainItemHover|MenuItemHover|MainItemDisabled|cmGetHorizontalAlign|parentNode|innerWidth|firstTR|clientWidth|mainItemLeft|defaultStatus|cmMoveSubMenu|_14|cmNoClickItem|_15|cmHideMenuTime|CMSlidingEffect|_13|onClick|onmousedown|in|onmouseout|currentMenu|HSplit|position|absolute|subSpacing|folderLeft|itemLeft|folderRight|itemRight|cmAllocMenu|summary|tags|cellspacing|overflow|_12|mainSpacing|ow|Main|Folder|Item|oh|mainFolderLeft|Text|cmShowControl|Right|mainFolderRight|mainItemRight|cmDraw|str1|str2|setTimeout|tbody|cmDisableItem|cmEnableItem|auto|getElementById|MainItemActive|MenuItemActive|_16|TR|open|Tr|tR|String|pageXOffset|clientLeft|display|appendChild|opera|parseInt|navigator|appVersion|iframe|1000|cmSubMenuID|cmClone|cmAllocFrame|createElement|IFRAME|OBJECT|cmFrame|frameBorder|none|src|javascript|cmGetProperties|filter|alpha|zIndex|99|border|scrolling|no|cmFreeFrame|onmouseup|cm|VSplit|eval|sub|SubMenuTable|hbr|cmFrameMasking|main|cmDrawFromText|li|cmNoClick|cmNoAction|href|title|500'.split('|'),0,{})) Added: trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked2.js =================================================================== --- trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked2.js (rev 0) +++ trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked2.js 2008-01-29 21:18:19 UTC (rev 4834) @@ -0,0 +1,493 @@ +var _cmNodeProperties = { prefix: '', mainFolderLeft: '', mainFolderRight: '', mainItemLeft: '', mainItemRight: '', folderLeft: '', folderRight: '', itemLeft: '', itemRight: '', mainSpacing: 0, subSpacing: 0, delay: 500, zIndexStart: 1000, zIndexInc: 5, subMenuHeader: null, subMenuFooter: null, offsetHMainAdjust: [0, 0], offsetVMainAdjust: [0, 0], offsetSubAdjust: [0, 0], clickOpen: 1, effect: null +}; var _cmIDCount = 0; var _cmIDName = 'cmSubMenuID'; var _cmTimeOut = null; var _cmCurrentItem = null; var _cmNoAction = new Object (); var _cmNoClick = new Object (); var _cmSplit = new Object (); var _cmMenuList = new Array (); var _cmItemList = new Array (); var _cmFrameList = new Array (); var _cmFrameListSize = 0; var _cmFrameIDCount = 0; var _cmFrameMasking = true; var _cmClicked = false; var _cmHideObjects = 0; function cmClone (nodeProperties) +{ var returnVal = new Object (); for (v in nodeProperties) +returnVal[v] = nodeProperties[v]; return returnVal;} +function cmAllocMenu (id, menu, orient, nodeProperties, prefix) +{ var info = new Object (); info.div = id; info.menu = menu; info.orient = orient; info.nodeProperties = nodeProperties; info.prefix = prefix; var menuID = _cmMenuList.length; _cmMenuList[menuID] = info; return menuID;} +function cmAllocFrame () +{ if (_cmFrameListSize > 0) +return cmGetObject (_cmFrameList[--_cmFrameListSize]); var frameObj = document.createElement ('iframe'); var id = _cmFrameIDCount++; frameObj.id = 'cmFrame' + id; frameObj.frameBorder = '0'; frameObj.style.display = 'none'; frameObj.src = 'javascript:false'; document.body.appendChild (frameObj); frameObj.style.filter = 'alpha(opacity=0)'; frameObj.style.zIndex = 99; frameObj.style.position = 'absolute'; frameObj.style.border = '0'; frameObj.scrolling = 'no'; return frameObj;} +function cmFreeFrame (frameObj) +{ _cmFrameList[_cmFrameListSize++] = frameObj.id;} +function cmNewID () +{ return _cmIDName + (++_cmIDCount);} +function cmActionItem (item, isMain, idSub, menuInfo, menuID) +{ _cmItemList[_cmItemList.length] = item; var index = _cmItemList.length - 1; idSub = (!idSub) ? 'null' : ('\'' + idSub + '\''); var clickOpen = menuInfo.nodeProperties.clickOpen; var onClick = (clickOpen == 3) || (clickOpen == 2 && isMain); var param = 'this,' + isMain + ',' + idSub + ',' + menuID + ',' + index; var returnStr; if (onClick) +returnStr = ' onmouseover="cmItemMouseOver(' + param + ',false)" onmousedown="cmItemMouseDownOpenSub (' + param + ')"'; else +returnStr = ' onmouseover="cmItemMouseOverOpenSub (' + param + ')" onmousedown="cmItemMouseDown (' + param + ')"'; return returnStr + ' onmouseout="cmItemMouseOut (' + param + ')" onmouseup="cmItemMouseUp (' + param + ')"';} +function cmNoClickItem (item, isMain, idSub, menuInfo, menuID) +{ _cmItemList[_cmItemList.length] = item; var index = _cmItemList.length - 1; idSub = (!idSub) ? 'null' : ('\'' + idSub + '\''); var param = 'this,' + isMain + ',' + idSub + ',' + menuID + ',' + index; return ' onmouseover="cmItemMouseOver (' + param + ')" onmouseout="cmItemMouseOut (' + param + ')"';} +function cmNoActionItem (item) +{ return item[1];} +function cmSplitItem (prefix, isMain, vertical) +{ var classStr = 'cm' + prefix; if (isMain) +{ classStr += 'Main'; if (vertical) +classStr += 'HSplit'; else +classStr += 'VSplit';} +else +classStr += 'HSplit'; return eval (classStr);} +function cmDrawSubMenu (subMenu, prefix, id, nodeProperties, zIndexStart, menuInfo, menuID) +{ var str = '<div class="' + prefix + 'SubMenu" id="' + id + '" style="z-index: ' + zIndexStart + ';position: absolute; top: 0px; left: 0px;">'; if (nodeProperties.subMenuHeader) +str += nodeProperties.subMenuHeader; str += '<table summary="sub menu" id="' + id + 'Table" cellspacing="' + nodeProperties.subSpacing + '" class="' + prefix + 'SubMenuTable">'; var strSub = ''; var item; var idSub; var hasChild; var i; var classStr; for (i = 5; i < subMenu.length; ++i) +{ item = subMenu[i]; if (!item) +continue; if (item == _cmSplit) +item = cmSplitItem (prefix, 0, true); item.parentItem = subMenu; item.subMenuID = id; hasChild = (item.length > 5); idSub = hasChild ? cmNewID () : null; str += '<tr class="' + prefix + 'MenuItem"'; if (item[0] != _cmNoClick) +str += cmActionItem (item, 0, idSub, menuInfo, menuID); else +str += cmNoClickItem (item, 0, idSub, menuInfo, menuID); str += '>' +if (item[0] == _cmNoAction || item[0] == _cmNoClick) +{ str += cmNoActionItem (item); str += '</tr>'; continue;} +classStr = prefix + 'Menu'; classStr += hasChild ? 'Folder' : 'Item'; str += '<td class="' + classStr + 'Left">'; if (item[0] != null) +str += item[0]; else +str += hasChild ? nodeProperties.folderLeft : nodeProperties.itemLeft; str += '</td><td class="' + classStr + 'Text">' + item[1]; str += '</td><td class="' + classStr + 'Right">'; if (hasChild) +{ str += nodeProperties.folderRight; strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, zIndexStart + nodeProperties.zIndexInc, menuInfo, menuID);} +else +str += nodeProperties.itemRight; str += '</td></tr>';} +str += '</table>'; if (nodeProperties.subMenuFooter) +str += nodeProperties.subMenuFooter; str += '</div>' + strSub; return str;} +function cmDraw (id, menu, orient, nodeProperties, prefix) +{ var obj = cmGetObject (id); if (!prefix) +prefix = nodeProperties.prefix; if (!prefix) +prefix = ''; if (!nodeProperties) +nodeProperties = _cmNodeProperties; if (!orient) +orient = 'hbr'; var menuID = cmAllocMenu (id, menu, orient, nodeProperties, prefix); var menuInfo = _cmMenuList[menuID]; if (!nodeProperties.delay) +nodeProperties.delay = _cmNodeProperties.delay; if (!nodeProperties.clickOpen) +nodeProperties.clickOpen = _cmNodeProperties.clickOpen; if (!nodeProperties.zIndexStart) +nodeProperties.zIndexStart = _cmNodeProperties.zIndexStart; if (!nodeProperties.zIndexInc) +nodeProperties.zIndexInc = _cmNodeProperties.zIndexInc; if (!nodeProperties.offsetHMainAdjust) +nodeProperties.offsetHMainAdjust = _cmNodeProperties.offsetHMainAdjust; if (!nodeProperties.offsetVMainAdjust) +nodeProperties.offsetVMainAdjust = _cmNodeProperties.offsetVMainAdjust; if (!nodeProperties.offsetSubAdjust) +nodeProperties.offsetSubAdjust = _cmNodeProperties.offsetSubAdjust; menuInfo.cmFrameMasking = _cmFrameMasking; var str = '<table summary="main menu" class="' + prefix + 'Menu" cellspacing="' + nodeProperties.mainSpacing + '">'; var strSub = ''; var vertical; if (orient.charAt (0) == 'h') +{ str += '<tr>'; vertical = false;} +else +{ vertical = true;} +var i; var item; var idSub; var hasChild; var classStr; for (i = 0; i < menu.length; ++i) +{ item = menu[i]; if (!item) +continue; item.menu = menu; item.subMenuID = id; str += vertical ? '<tr' : '<td'; str += ' class="' + prefix + 'MainItem"'; hasChild = (item.length > 5); idSub = hasChild ? cmNewID () : null; str += cmActionItem (item, 1, idSub, menuInfo, menuID) + '>'; if (item == _cmSplit) +item = cmSplitItem (prefix, 1, vertical); if (item[0] == _cmNoAction || item[0] == _cmNoClick) +{ str += cmNoActionItem (item); str += vertical? '</tr>' : '</td>'; continue;} +classStr = prefix + 'Main' + (hasChild ? 'Folder' : 'Item'); str += vertical ? '<td' : '<span'; str += ' class="' + classStr + 'Left">'; str += (item[0] == null) ? (hasChild ? nodeProperties.mainFolderLeft : nodeProperties.mainItemLeft) +: item[0]; str += vertical ? '</td>' : '</span>'; str += vertical ? '<td' : '<span'; str += ' class="' + classStr + 'Text">'; str += item[1]; str += vertical ? '</td>' : '</span>'; str += vertical ? '<td' : '<span'; str += ' class="' + classStr + 'Right">'; str += hasChild ? nodeProperties.mainFolderRight : nodeProperties.mainItemRight; str += vertical ? '</td>' : '</span>'; str += vertical ? '</tr>' : '</td>'; if (hasChild) +strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, nodeProperties.zIndexStart, menuInfo, menuID);} +if (!vertical) +str += '</tr>'; str += '</table>' + strSub; obj.innerHTML = str;} +function cmDrawFromText (id, orient, nodeProperties, prefix) +{ var domMenu = cmGetObject (id); var menu = null; for (var currentDomItem = domMenu.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) +{ if (!currentDomItem.tagName) +continue; var tag = currentDomItem.tagName.toLowerCase (); if (tag != 'ul' && tag != 'ol') +continue; menu = cmDrawFromTextSubMenu (currentDomItem); break;} +if (menu) +cmDraw (id, menu, orient, nodeProperties, prefix);} +function cmDrawFromTextSubMenu (domMenu) +{ var items = new Array (); for (var currentDomItem = domMenu.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) +{ if (!currentDomItem.tagName || currentDomItem.tagName.toLowerCase () != 'li') +continue; if (currentDomItem.firstChild == null) +{ items[items.length] = _cmSplit; continue;} +var item = new Array (); var currentItem = currentDomItem.firstChild; var hasAction = false; for (; currentItem; currentItem = currentItem.nextSibling) +{ if (!currentItem.tagName) +continue; if (currentItem.className == 'cmNoClick') +{ item[0] = _cmNoClick; item[1] = getActionHTML (currentItem); hasAction = true; break;} +if (currentItem.className == 'cmNoAction') +{ item[0] = _cmNoAction; item[1] = getActionHTML (currentItem); hasAction = true; break;} +var tag = currentItem.tagName.toLowerCase (); if (tag != 'span') +continue; if (!currentItem.firstChild) +item[0] = null; else +item[0] = currentItem.innerHTML; currentItem = currentItem.nextSibling; break;} +if (hasAction) +{ items[items.length] = item; continue;} +if (!currentItem) +continue; for (; currentItem; currentItem = currentItem.nextSibling) +{ if (!currentItem.tagName) +continue; var tag = currentItem.tagName.toLowerCase (); if (tag == 'a') +{ item[1] = currentItem.innerHTML; item[2] = currentItem.href; item[3] = currentItem.target; item[4] = currentItem.title; if (item[4] == '') +item[4] = null;} +else if (tag == 'span' || tag == 'div') +{ item[1] = currentItem.innerHTML; item[2] = null; item[3] = null; item[4] = null;} +break;} +for (; currentItem; currentItem = currentItem.nextSibling) +{ if (!currentItem.tagName) +continue; var tag = currentItem.tagName.toLowerCase (); if (tag != 'ul' && tag != 'ol') +continue; var subMenuItems = cmDrawFromTextSubMenu (currentItem); for (i = 0; i < subMenuItems.length; ++i) +item[i + 5] = subMenuItems[i]; break;} +items[items.length] = item;} +return items;} +function getActionHTML (htmlNode) +{ var returnVal = '<td></td><td></td><td></td>'; var currentDomItem; for (currentDomItem = htmlNode.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) +{ if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'table') +break;} +if (!currentDomItem) +return returnVal; for (currentDomItem = currentDomItem.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) +{ if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'tbody') +break;} +if (!currentDomItem) +return returnVal; for (currentDomItem = currentDomItem.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) +{ if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'tr') +break;} +if (!currentDomItem) +return returnVal; return currentDomItem.innerHTML;} +function cmGetMenuItem (item) +{ if (!item.subMenuID) +return null; var subMenu = cmGetObject (item.subMenuID); if (item.menu) +{ var menu = item.menu; subMenu = subMenu.firstChild.firstChild.firstChild.firstChild; var i; for (i = 0; i < menu.length; ++i) +{ if (menu[i] == item) +return subMenu; subMenu = subMenu.nextSibling;} +} +else if (item.parentItem) +{ var menu = item.parentItem; var table = cmGetObject (item.subMenuID + 'Table'); if (!table) +return null; subMenu = table.firstChild.firstChild; var i; for (i = 5; i < menu.length; ++i) +{ if (menu[i] == item) +return subMenu; subMenu = subMenu.nextSibling;} +} +return null;} +function cmDisableItem (item, prefix) +{ if (!item) +return; var menuItem = cmGetMenuItem (item); if (!menuItem) +return; if (item.menu) +menuItem.className = prefix + 'MainItemDisabled'; else +menuItem.className = prefix + 'MenuItemDisabled'; item.isDisabled = true;} +function cmEnableItem (item, prefix) +{ if (!item) +return; var menuItem = cmGetMenuItem (item); if (!menuItem) +return; if (item.menu) +menu.className = prefix + 'MainItem'; else +menu.className = prefix + 'MenuItem'; item.isDisabled = true;} +function cmItemMouseOver (obj, isMain, idSub, menuID, index, calledByOpenSub) +{ if (!calledByOpenSub && _cmClicked) +{ cmItemMouseOverOpenSub (obj, isMain, idSub, menuID, index); return;} +clearTimeout (_cmTimeOut); if (_cmItemList[index].isDisabled) +return; var prefix = _cmMenuList[menuID].prefix; if (!obj.cmMenuID) +{ obj.cmMenuID = menuID; obj.cmIsMain = isMain;} +var thisMenu = cmGetThisMenu (obj, prefix); if (!thisMenu.cmItems) +thisMenu.cmItems = new Array (); var i; for (i = 0; i < thisMenu.cmItems.length; ++i) +{ if (thisMenu.cmItems[i] == obj) +break;} +if (i == thisMenu.cmItems.length) +{ thisMenu.cmItems[i] = obj;} +if (_cmCurrentItem) +{ if (_cmCurrentItem == obj || _cmCurrentItem == thisMenu) +{ var item = _cmItemList[index]; cmSetStatus (item); return;} +var thatMenuInfo = _cmMenuList[_cmCurrentItem.cmMenuID]; var thatPrefix = thatMenuInfo.prefix; var thatMenu = cmGetThisMenu (_cmCurrentItem, thatPrefix); if (thatMenu != thisMenu.cmParentMenu) +{ if (_cmCurrentItem.cmIsMain) +_cmCurrentItem.className = thatPrefix + 'MainItem'; else +_cmCurrentItem.className = thatPrefix + 'MenuItem'; if (thatMenu.id != idSub) +cmHideMenu (thatMenu, thisMenu, thatMenuInfo);} +} +_cmCurrentItem = obj; cmResetMenu (thisMenu, prefix); var item = _cmItemList[index]; var isDefaultItem = cmIsDefaultItem (item); if (isDefaultItem) +{ if (isMain) +obj.className = prefix + 'MainItemHover'; else +obj.className = prefix + 'MenuItemHover';} +cmSetStatus (item);} +function cmItemMouseOverOpenSub (obj, isMain, idSub, menuID, index) +{ clearTimeout (_cmTimeOut); if (_cmItemList[index].isDisabled) +return; cmItemMouseOver (obj, isMain, idSub, menuID, index, true); if (idSub) +{ var subMenu = cmGetObject (idSub); var menuInfo = _cmMenuList[menuID]; var orient = menuInfo.orient; var prefix = menuInfo.prefix; cmShowSubMenu (obj, isMain, subMenu, menuInfo);} +} +function cmItemMouseOut (obj, isMain, idSub, menuID, index) +{ var delayTime = _cmMenuList[menuID].nodeProperties.delay; _cmTimeOut = window.setTimeout ('cmHideMenuTime ()', delayTime); window.defaultStatus = '';} +function cmItemMouseDown (obj, isMain, idSub, menuID, index) +{ if (_cmItemList[index].isDisabled) +return; if (cmIsDefaultItem (_cmItemList[index])) +{ var prefix = _cmMenuList[menuID].prefix; if (obj.cmIsMain) +obj.className = prefix + 'MainItemActive'; else +obj.className = prefix + 'MenuItemActive';} +} +function cmItemMouseDownOpenSub (obj, isMain, idSub, menuID, index) +{ if (_cmItemList[index].isDisabled) +return; _cmClicked = true; cmItemMouseDown (obj, isMain, idSub, menuID, index); if (idSub) +{ var subMenu = cmGetObject (idSub); var menuInfo = _cmMenuList[menuID]; cmShowSubMenu (obj, isMain, subMenu, menuInfo);} +} +function cmItemMouseUp (obj, isMain, idSub, menuID, index) +{ if (_cmItemList[index].isDisabled) +return; var item = _cmItemList[index]; var link = null, target = '_self'; if (item.length > 2) +link = item[2]; if (item.length > 3 && item[3]) +target = item[3]; if (link != null) +{ _cmClicked = false; window.open (link, target);} +var menuInfo = _cmMenuList[menuID]; var prefix = menuInfo.prefix; var thisMenu = cmGetThisMenu (obj, prefix); var hasChild = (item.length > 5); if (!hasChild) +{ if (cmIsDefaultItem (item)) +{ if (obj.cmIsMain) +obj.className = prefix + 'MainItem'; else +obj.className = prefix + 'MenuItem';} +cmHideMenu (thisMenu, null, menuInfo);} +else +{ if (cmIsDefaultItem (item)) +{ if (obj.cmIsMain) +obj.className = prefix + 'MainItemHover'; else +obj.className = prefix + 'MenuItemHover';} +} +} +function cmMoveSubMenu (obj, isMain, subMenu, menuInfo) +{ var orient = menuInfo.orient; var offsetAdjust; if (isMain) +{ if (orient.charAt (0) == 'h') +offsetAdjust = menuInfo.nodeProperties.offsetHMainAdjust; else +offsetAdjust = menuInfo.nodeProperties.offsetVMainAdjust;} +else +offsetAdjust = menuInfo.nodeProperties.offsetSubAdjust; if (!isMain && orient.charAt (0) == 'h') +orient = 'v' + orient.charAt (1) + orient.charAt (2); var mode = String (orient); var p = subMenu.offsetParent; var subMenuWidth = cmGetWidth (subMenu); var horiz = cmGetHorizontalAlign (obj, mode, p, subMenuWidth); if (mode.charAt (0) == 'h') +{ if (mode.charAt (1) == 'b') +subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) + offsetAdjust[1]) + 'px'; else +subMenu.style.top = (cmGetYAt (obj, p) - cmGetHeight (subMenu) - offsetAdjust[1]) + 'px'; if (horiz == 'r') +subMenu.style.left = (cmGetXAt (obj, p) + offsetAdjust[0]) + 'px'; else +subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) - subMenuWidth - offsetAdjust[0]) + 'px';} +else +{ if (horiz == 'r') +subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) + offsetAdjust[0]) + 'px'; else +subMenu.style.left = (cmGetXAt (obj, p) - subMenuWidth - offsetAdjust[0]) + 'px'; if (mode.charAt (1) == 'b') +subMenu.style.top = (cmGetYAt (obj, p) + offsetAdjust[1]) + 'px'; else +subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) - cmGetHeight (subMenu) + offsetAdjust[1]) + 'px';} +if (horiz != orient.charAt (2)) +orient = orient.charAt (0) + orient.charAt (1) + horiz; return orient;} +function cmGetHorizontalAlign (obj, mode, p, subMenuWidth) +{ var horiz = mode.charAt (2); if (!(document.body)) +return horiz; var body = document.body; var browserLeft; var browserRight; if (window.innerWidth) +{ browserLeft = window.pageXOffset; browserRight = window.innerWidth + browserLeft;} +else if (body.clientWidth) +{ browserLeft = body.clientLeft; browserRight = body.clientWidth + browserLeft;} +else +return horiz; if (mode.charAt (0) == 'h') +{ if (horiz == 'r' && (cmGetXAt (obj) + subMenuWidth) > browserRight) +horiz = 'l'; if (horiz == 'l' && (cmGetXAt (obj) + cmGetWidth (obj) - subMenuWidth) < browserLeft) +horiz = 'r'; return horiz;} +else +{ if (horiz == 'r' && (cmGetXAt (obj, p) + cmGetWidth (obj) + subMenuWidth) > browserRight) +horiz = 'l'; if (horiz == 'l' && (cmGetXAt (obj, p) - subMenuWidth) < browserLeft) +horiz = 'r'; return horiz;} +} +function cmShowSubMenu (obj, isMain, subMenu, menuInfo) +{ var prefix = menuInfo.prefix; if (!subMenu.cmParentMenu) +{ var thisMenu = cmGetThisMenu (obj, prefix); subMenu.cmParentMenu = thisMenu; if (!thisMenu.cmSubMenu) +thisMenu.cmSubMenu = new Array (); thisMenu.cmSubMenu[thisMenu.cmSubMenu.length] = subMenu;} +var effectInstance = subMenu.cmEffect; if (effectInstance) +effectInstance.showEffect (true); else +{ var orient = cmMoveSubMenu (obj, isMain, subMenu, menuInfo); subMenu.cmOrient = orient; var forceShow = false; if (subMenu.style.visibility != 'visible' && menuInfo.nodeProperties.effect) +{ try +{ effectInstance = menuInfo.nodeProperties.effect.getInstance (subMenu, orient); effectInstance.showEffect (false);} +catch (e) +{ forceShow = true; subMenu.cmEffect = null;} +} +else +forceShow = true; if (forceShow) +{ subMenu.style.visibility = 'visible';} +} +if (!_cmHideObjects) +{ _cmHideObjects = 2; try +{ if (window.opera) +{ if (parseInt (navigator.appVersion) < 9) +_cmHideObjects = 1;} +} +catch (e) +{ } +} +if (_cmHideObjects == 1) +{ if (!subMenu.cmOverlap) +subMenu.cmOverlap = new Array (); cmHideControl ("IFRAME", subMenu); cmHideControl ("OBJECT", subMenu);} +} +function cmResetMenu (thisMenu, prefix) +{ if (thisMenu.cmItems) +{ var i; var str; var items = thisMenu.cmItems; for (i = 0; i < items.length; ++i) +{ if (items[i].cmIsMain) +{ if (items[i].className == (prefix + 'MainItemDisabled')) +continue;} +else +{ if (items[i].className == (prefix + 'MenuItemDisabled')) +continue;} +if (items[i].cmIsMain) +str = prefix + 'MainItem'; else +str = prefix + 'MenuItem'; if (items[i].className != str) +items[i].className = str;} +} +} +function cmHideMenuTime () +{ _cmClicked = false; if (_cmCurrentItem) +{ var menuInfo = _cmMenuList[_cmCurrentItem.cmMenuID]; var prefix = menuInfo.prefix; cmHideMenu (cmGetThisMenu (_cmCurrentItem, prefix), null, menuInfo); _cmCurrentItem = null;} +} +function cmHideThisMenu (thisMenu, menuInfo) +{ var effectInstance = thisMenu.cmEffect; if (effectInstance) +effectInstance.hideEffect (true); else +{ thisMenu.style.visibility = 'hidden'; thisMenu.style.top = '0px'; thisMenu.style.left = '0px'; thisMenu.cmOrient = null;} +cmShowControl (thisMenu); thisMenu.cmItems = null;} +function cmHideMenu (thisMenu, currentMenu, menuInfo) +{ var prefix = menuInfo.prefix; var str = prefix + 'SubMenu'; if (thisMenu.cmSubMenu) +{ var i; for (i = 0; i < thisMenu.cmSubMenu.length; ++i) +{ cmHideSubMenu (thisMenu.cmSubMenu[i], menuInfo);} +} +while (thisMenu && thisMenu != currentMenu) +{ cmResetMenu (thisMenu, prefix); if (thisMenu.className == str) +{ cmHideThisMenu (thisMenu, menuInfo);} +else +break; thisMenu = cmGetThisMenu (thisMenu.cmParentMenu, prefix);} +} +function cmHideSubMenu (thisMenu, menuInfo) +{ if (thisMenu.style.visibility == 'hidden') +return; if (thisMenu.cmSubMenu) +{ var i; for (i = 0; i < thisMenu.cmSubMenu.length; ++i) +{ cmHideSubMenu (thisMenu.cmSubMenu[i], menuInfo);} +} +var prefix = menuInfo.prefix; cmResetMenu (thisMenu, prefix); cmHideThisMenu (thisMenu, menuInfo);} +function cmHideControl (tagName, subMenu) +{ var x = cmGetX (subMenu); var y = cmGetY (subMenu); var w = subMenu.offsetWidth; var h = subMenu.offsetHeight; var i; for (i = 0; i < document.all.tags(tagName).length; ++i) +{ var obj = document.all.tags(tagName)[i]; if (!obj || !obj.offsetParent) +continue; var ox = cmGetX (obj); var oy = cmGetY (obj); var ow = obj.offsetWidth; var oh = obj.offsetHeight; if (ox > (x + w) || (ox + ow) < x) +continue; if (oy > (y + h) || (oy + oh) < y) +continue; if(obj.style.visibility == 'hidden') +continue; subMenu.cmOverlap[subMenu.cmOverlap.length] = obj; obj.style.visibility = 'hidden';} +} +function cmShowControl (subMenu) +{ if (subMenu.cmOverlap) +{ var i; for (i = 0; i < subMenu.cmOverlap.length; ++i) +subMenu.cmOverlap[i].style.visibility = "";} +subMenu.cmOverlap = null;} +function cmGetThisMenu (obj, prefix) +{ var str1 = prefix + 'SubMenu'; var str2 = prefix + 'Menu'; while (obj) +{ if (obj.className == str1 || obj.className == str2) +return obj; obj = obj.parentNode;} +return null;} +function cmTimeEffect (menuID, show, delayTime) +{ window.setTimeout ('cmCallEffect("' + menuID + '",' + show + ')', delayTime);} +function cmCallEffect (menuID, show) +{ var menu = cmGetObject (menuID); if (!menu || !menu.cmEffect) +return; try +{ if (show) +menu.cmEffect.showEffect (false); else +menu.cmEffect.hideEffect (false);} +catch (e) +{ } +} +function cmIsDefaultItem (item) +{ if (item == _cmSplit || item[0] == _cmNoAction || item[0] == _cmNoClick) +return false; return true;} +function cmGetObject (id) +{ if (document.all) +return document.all[id]; return document.getElementById (id);} +function cmGetWidth (obj) +{ var width = obj.offsetWidth; if (width > 0 || !cmIsTRNode (obj)) +return width; if (!obj.firstChild) +return 0; return obj.lastChild.offsetLeft - obj.firstChild.offsetLeft + cmGetWidth (obj.lastChild);} +function cmGetHeight (obj) +{ var height = obj.offsetHeight; if (height > 0 || !cmIsTRNode (obj)) +return height; if (!obj.firstChild) +return 0; return obj.firstChild.offsetHeight;} +function cmGetX (obj) +{ if (!obj) +return 0; var x = 0; do +{ x += obj.offsetLeft; obj = obj.offsetParent;} +while (obj); return x;} +function cmGetXAt (obj, elm) +{ var x = 0; while (obj && obj != elm) +{ x += obj.offsetLeft; obj = obj.offsetParent;} +if (obj == elm) +return x; return x - cmGetX (elm);} +function cmGetY (obj) +{ if (!obj) +return 0; var y = 0; do +{ y += obj.offsetTop; obj = obj.offsetParent;} +while (obj); return y;} +function cmIsTRNode (obj) +{ var tagName = obj.tagName; return tagName == "TR" || tagName == "tr" || tagName == "Tr" || tagName == "tR";} +function cmGetYAt (obj, elm) +{ var y = 0; if (!obj.offsetHeight && cmIsTRNode (obj)) +{ var firstTR = obj.parentNode.firstChild; obj = obj.firstChild; y -= firstTR.firstChild.offsetTop;} +while (obj && obj != elm) +{ y += obj.offsetTop; obj = obj.offsetParent;} +if (obj == elm) +return y; return y - cmGetY (elm);} +function cmSetStatus (item) +{ var descript = ''; if (item.length > 4) +descript = (item[4] != null) ? item[4] : (item[2] ? item[2] : descript); else if (item.length > 2) +descript = (item[2] ? item[2] : descript); window.defaultStatus = descript;} +function cmGetProperties (obj) +{ if (obj == undefined) +return 'undefined'; if (obj == null) +return 'null'; var msg = obj + ':\n'; var i; for (i in obj) +msg += i + ' = ' + obj[i] + '; '; return msg;} +function CMSpecialEffectInstance (effect, menu) +{ effect.show = true; effect.menu = menu; menu.cmEffect = effect; this.effect = effect;} +CMSpecialEffectInstance.prototype.canShow = function (changed) +{ if (changed) +{ if (this.effect.show) +return false; this.effect.show = true;} +else if (!this.effect.show) +return false; return true;} +CMSpecialEffectInstance.prototype.canHide = function (changed) +{ var effect = this.effect; if (changed) +{ if (!effect.show) +return false; effect.show = false;} +else if (effect.show) +return false; return true;} +CMSpecialEffectInstance.prototype.startShowing = function () +{ var menu = this.effect.menu; menu.style.visibility = 'visible';} +CMSpecialEffectInstance.prototype.finishShowing = function () +{ } +CMSpecialEffectInstance.prototype.finishHiding = function () +{ var menu = this.effect.menu; menu.style.visibility = 'hidden'; menu.style.top = '0px'; menu.style.left = '0px'; menu.cmEffect = null; menu.cmOrient = null; this.effect.menu = null;} +function CMSlidingEffectInstance (menu, orient, speed) +{ this.base = new CMSpecialEffectInstance (this, menu); menu.style.overflow = 'hidden'; this.x = menu.offsetLeft; this.y = menu.offsetTop; if (orient.charAt (0) == 'h') +{ this.slideOrient = 'h'; this.slideDir = orient.charAt (1);} +else +{ this.slideOrient = 'v'; this.slideDir = orient.charAt (2);} +this.speed = speed; this.fullWidth = menu.offsetWidth; this.fullHeight = menu.offsetHeight; this.percent = 0;} +CMSlidingEffectInstance.prototype.showEffect = function (changed) +{ if (!this.base.canShow (changed)) +return; var percent = this.percent; if (this.slideOrient == 'h') +this.slideMenuV (); else +this.slideMenuH (); if (percent == 0) +{ this.base.startShowing ();} +if (percent < 100) +{ this.percent += this.speed; cmTimeEffect (this.menu.id, this.show, 10);} +else if (this.show) +{ this.base.finishShowing ();} +} +CMSlidingEffectInstance.prototype.hideEffect = function (changed) +{ if (!this.base.canHide (changed)) +return; var percent = this.percent; if (this.slideOrient == 'h') +this.slideMenuV (); else +this.slideMenuH (); if (percent > 0) +{ this.percent -= this.speed; cmTimeEffect (this.menu.id, this.show, 10);} +else if (!this.show) +{ this.menu.style.clip = 'auto'; this.base.finishHiding ();} +} +CMSlidingEffectInstance.prototype.slideMenuH = function () +{ var percent = this.percent; if (percent < 0) +percent = 0; if (percent > 100) +percent = 100; var fullWidth = this.fullWidth; var fullHeight = this.fullHeight; var x = this.x; var space = percent * fullWidth / 100; var menu = this.menu; if (this.slideDir == 'l') +{ menu.style.left = (x + fullWidth - space) + 'px'; menu.style.clip = 'rect(0px ' + space + 'px ' + fullHeight + 'px 0px)';} +else +{ menu.style.left = (x - fullWidth + space) + 'px'; menu.style.clip = 'rect(0px ' + fullWidth + 'px ' + fullHeight + 'px ' + (fullWidth - space) + 'px)';} +} +CMSlidingEffectInstance.prototype.slideMenuV = function () +{ var percent = this.percent; if (percent < 0) +percent = 0; if (percent > 100) +percent = 100; var fullWidth = this.fullWidth; var fullHeight = this.fullHeight; var y = this.y; var space = percent * fullHeight / 100; var menu = this.menu; if (this.slideDir == 'b') +{ menu.style.top = (y - fullHeight + space) + 'px'; menu.style.clip = 'rect(' + (fullHeight - space) + 'px ' + fullWidth + 'px ' + fullHeight + 'px 0px)';} +else +{ menu.style.top = (y + fullHeight - space) + 'px'; menu.style.clip = 'rect(0px ' + fullWidth + 'px ' + space + 'px 0px)';} +} +function CMSlidingEffect (speed) +{ if (!speed) +speed = 10; else if (speed <= 0) +speed = 10; else if (speed >= 100) +speed = 100; this.speed = speed;} +CMSlidingEffect.prototype.getInstance = function (menu, orient) +{ return new CMSlidingEffectInstance (menu, orient, this.speed);} +function CMFadingEffectInstance (menu, showSpeed, hideSpeed) +{ this.base = new CMSpecialEffectInstance (this, menu); menu.style.overflow = 'hidden'; this.showSpeed = showSpeed; this.hideSpeed = hideSpeed; this.opacity = 0;} +CMFadingEffectInstance.prototype.showEffect = function (changed) +{ if (!this.base.canShow (changed)) +return; var menu = this.menu; var opacity = this.opacity; this.setOpacity (); if (opacity == 0) +{ this.base.startShowing ();} +if (opacity < 100) +{ this.opacity += 10; cmTimeEffect (menu.id, this.show, this.showSpeed);} +else if (this.show) +{ this.base.finishShowing ();} +} +CMFadingEffectInstance.prototype.hideEffect = function (changed) +{ if (!this.base.canHide (changed)) +return; var menu = this.menu; var opacity = this.opacity; this.setOpacity (); if (this.opacity > 0) +{ this.opacity -= 10; cmTimeEffect (menu.id, this.show, this.hideSpeed);} +else if (!this.show) +{ this.base.finishHiding ();} +} +CMFadingEffectInstance.prototype.setOpacity = function () +{ this.menu.style.opacity = this.opacity / 100;} +function CMFadingEffect (showSpeed, hideSpeed) +{ this.showSpeed = showSpeed; this.hideSpeed = hideSpeed;} +CMFadingEffect.prototype.getInstance = function (menu, orient) +{ return new CMFadingEffectInstance (menu, this.showSpeed, this.hideSpeed);} Added: trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked3.js =================================================================== --- trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked3.js (rev 0) +++ trunk/misc/design/22menuJSCook/JSCookMenu/JSCookMenuPacked3.js 2008-01-29 21:18:19 UTC (rev 4834) @@ -0,0 +1,1211 @@ +var _cmNodeProperties={prefix:"",mainFolderLeft:"",mainFolderRight:"",mainItemLeft:"",mainItemRight:"",folderLeft:"",folderRight:"",itemLeft:"",itemRight:"",mainSpacing:0,subSpacing:0,delay:500,zIndexStart:1000,zIndexInc:5,subMenuHeader:null,subMenuFooter:null,offsetHMainAdjust:[0,0],offsetVMainAdjust:[0,0],offsetSubAdjust:[0,0],clickOpen:1,effect:null}; +var _cmIDCount=0; +var _cmIDName="cmSubMenuID"; +var _cmTimeOut=null; +var _cmCurrentItem=null; +var _cmNoAction=new Object(); +var _cmNoClick=new Object(); +var _cmSplit=new Object(); +var _cmMenuList=new Array(); +var _cmItemList=new Array(); +var _cmFrameList=new Array(); +var _cmFrameListSize=0; +var _cmFrameIDCount=0; +var _cmFrameMasking=true; +var _cmClicked=false; +var _cmHideObjects=0; +function cmClone(_1){ +var _2=new Object(); +for(v in _1){ +_2[v]=_1[v]; +} +return _2; +} +function cmAllocMenu(id,_4,_5,_6,_7){ +var _8=new Object(); +_8.div=id; +_8.menu=_4; +_8.orient=_5; +_8.nodeProperties=_6; +_8.prefix=_7; +var _9=_cmMenuList.length; +_cmMenuList[_9]=_8; +return _9; +} +function cmAllocFrame(){ +if(_cmFrameListSize>0){ +return cmGetObject(_cmFrameList[--_cmFrameListSize]); +} +var _a=document.createElement("iframe"); +var id=_cmFrameIDCount++; +_a.id="cmFrame"+id; +_a.frameBorder="0"; +_a.style.display="none"; +_a.src="javascript:false"; +document.body.appendChild(_a); +_a.style.filter="alpha(opacity=0)"; +_a.style.zIndex=99; +_a.style.position="absolute"; +_a.style.border="0"; +_a.scrolling="no"; +return _a; +} +function cmFreeFrame(_c){ +_cmFrameList[_cmFrameListSize++]=_c.id; +} +function cmNewID(){ +return _cmIDName+(++_cmIDCount); +} +function cmActionItem(_d,_e,_f,_10,_11){ +_cmItemList[_cmItemList.length]=_d; +var _12=_cmItemList.length-1; +_f=(!_f)?"null":("'"+_f+"'"); +var _13=_10.nodeProperties.clickOpen; +var _14=(_13==3)||(_13==2&&_e); +var _15="this,"+_e+","+_f+","+_11+","+_12; +var _16; +if(_14){ +_16=" onmouseover=\"cmItemMouseOver("+_15+",false)\" onmousedown=\"cmItemMouseDownOpenSub ("+_15+")\""; +}else{ +_16=" onmouseover=\"cmItemMouseOverOpenSub ("+_15+")\" onmousedown=\"cmItemMouseDown ("+_15+")\""; +} +return _16+" onmouseout=\"cmItemMouseOut ("+_15+")\" onmouseup=\"cmItemMouseUp ("+_15+")\""; +} +function cmNoClickItem(_17,_18,_19,_1a,_1b){ +_cmItemList[_cmItemList.length]=_17; +var _1c=_cmItemList.length-1; +_19=(!_19)?"null":("'"+_19+"'"); +var _1d="this,"+_18+","+_19+","+_1b+","+_1c; +return " onmouseover=\"cmItemMouseOver ("+_1d+")\" onmouseout=\"cmItemMouseOut ("+_1d+")\""; +} +function cmNoActionItem(_1e){ +return _1e[1]; +} +function cmSplitItem(_1f,_20,_21){ +var _22="cm"+_1f; +if(_20){ +_22+="Main"; +if(_21){ +_22+="HSplit"; +}else{ +_22+="VSplit"; +} +}else{ +_22+="HSplit"; +} +return eval(_22); +} +function cmDrawSubMenu(_23,_24,id,_26,_27,_28,_29){ +var str="<div class=\""+_24+"SubMenu\" id=\""+id+"\" style=\"z-index: "+_27+";position: absolute; top: 0px; left: 0px;\">"; +if(_26.subMenuHeader){ +str+=_26.subMenuHeader; +} +str+="<table summary=\"sub menu\" id=\""+id+"Table\" cellspacing=\""+_26.subSpacing+"\" class=\""+_24+"SubMenuTable\">"; +var _2b=""; +var _2c; +var _2d; +var _2e; +var i; +var _30; +for(i=5;i<_23.length;++i){ +_2c=_23[i]; +if(!_2c){ +continue; +} +if(_2c==_cmSplit){ +_2c=cmSplitItem(_24,0,true); +} +_2c.parentItem=_23; +_2c.subMenuID=id; +_2e=(_2c.length>5); +_2d=_2e?cmNewID():null; +str+="<tr class=\""+_24+"MenuItem\""; +if(_2c[0]!=_cmNoClick){ +str+=cmActionItem(_2c,0,_2d,_28,_29); +}else{ +str+=cmNoClickItem(_2c,0,_2d,_28,_29); +} +str+=">"; +if(_2c[0]==_cmNoAction||_2c[0]==_cmNoClick){ +str+=cmNoActionItem(_2c); +str+="</tr>"; +continue; +} +_30=_24+"Menu"; +_30+=_2e?"Folder":"Item"; +str+="<td class=\""+_30+"Left\">"; +if(_2c[0]!=null){ +str+=_2c[0]; +}else{ +str+=_2e?_26.folderLeft:_26.itemLeft; +} +str+="</td><td class=\""+_30+"Text\">"+_2c[1]; +str+="</td><td class=\""+_30+"Right\">"; +if(_2e){ +str+=_26.folderRight; +_2b+=cmDrawSubMenu(_2c,_24,_2d,_26,_27+_26.zIndexInc,_28,_29); +}else{ +str+=_26.itemRight; +} +str+="</td></tr>"; +} +str+="</table>"; +if(_26.subMenuFooter){ +str+=_26.subMenuFooter; +} +str+="</div>"+_2b; +return str; +} +function cmDraw(id,_32,_33,_34,_35){ +var obj=cmGetObject(id); +if(!_35){ +_35=_34.prefix; +} +if(!_35){ +_35=""; +} +if(!_34){ +_34=_cmNodeProperties; +} +if(!_33){ +_33="hbr"; +} +var _37=cmAllocMenu(id,_32,_33,_34,_35); +var _38=_cmMenuList[_37]; +if(!_34.delay){ +_34.delay=_cmNodeProperties.delay; +} +if(!_34.clickOpen){ +_34.clickOpen=_cmNodeProperties.clickOpen; +} +if(!_34.zIndexStart){ +_34.zIndexStart=_cmNodeProperties.zIndexStart; +} +if(!_34.zIndexInc){ +_34.zIndexInc=_cmNodeProperties.zIndexInc; +} +if(!_34.offsetHMainAdjust){ +_34.offsetHMainAdjust=_cmNodeProperties.offsetHMainAdjust; +} +if(!_34.offsetVMainAdjust){ +_34.offsetVMainAdjust=_cmNodeProperties.offsetVMainAdjust; +} +if(!_34.offsetSubAdjust){ +_34.offsetSubAdjust=_cmNodeProperties.offsetSubAdjust; +} +_38.cmFrameMasking=_cmFrameMasking; +var str="<table summary=\"main menu\" class=\""+_35+"Menu\" cellspacing=\""+_34.mainSpacing+"\">"; +var _3a=""; +var _3b; +if(_33.charAt(0)=="h"){ +str+="<tr>"; +_3b=false; +}else{ +_3b=true; +} +var i; +var _3d; +var _3e; +var _3f; +var _40; +for(i=0;i<_32.length;++i){ +_3d=_32[i]; +if(!_3d){ +continue; +} +_3d.menu=_32; +_3d.subMenuID=id; +str+=_3b?"<tr":"<td"; +str+=" class=\""+_35+"MainItem\""; +_3f=(_3d.length>5); +_3e=_3f?cmNewID():null; +str+=cmActionItem(_3d,1,_3e,_38,_37)+">"; +if(_3d==_cmSplit){ +_3d=cmSplitItem(_35,1,_3b); +} +if(_3d[0]==_cmNoAction||_3d[0]==_cmNoClick){ +str+=cmNoActionItem(_3d); +str+=_3b?"</tr>":"</td>"; +continue; +} +_40=_35+"Main"+(_3f?"Folder":"Item"); +str+=_3b?"<td":"<span"; +str+=" class=\""+_40+"Left\">"; +str+=(_3d[0]==null)?(_3f?_34.mainFolderLeft:_34.mainItemLeft):_3d[0]; +str+=_3b?"</td>":"</span>"; +str+=_3b?"<td":"<span"; +str+=" class=\""+_40+"Text\">"; +str+=_3d[1]; +str+=_3b?"</td>":"</span>"; +str+=_3b?"<td":"<span"; +str+=" class=\""+_40+"Right\">"; +str+=_3f?_34.mainFolderRight:_34.mainItemRight; +str+=_3b?"</td>":"</span>"; +str+=_3b?"</tr>":"</td>"; +if(_3f){ +_3a+=cmDrawSubMenu(_3d,_35,_3e,_34,_34.zIndexStart,_38,_37); +} +} +if(!_3b){ +str+="</tr>"; +} +str+="</table>"+_3a; +obj.innerHTML=str; +} +function cmDrawFromText(id,_42,_43,_44){ +var _45=cmGetObject(id); +var _46=null; +for(var _47=_45.firstChild;_47;_47=_47.nextSibling){ +if(!_47.tagName){ +continue; +} +var tag=_47.tagName.toLowerCase(); +if(tag!="ul"&&tag!="ol"){ +continue; +} +_46=cmDrawFromTextSubMenu(_47); +break; +} +if(_46){ +cmDraw(id,_46,_42,_43,_44); +} +} +function cmDrawFromTextSubMenu(_49){ +var _4a=new Array(); +for(var _4b=_49.firstChild;_4b;_4b=_4b.nextSibling){ +if(!_4b.tagName||_4b.tagName.toLowerCase()!="li"){ +continue; +} +if(_4b.firstChild==null){ +_4a[_4a.length]=_cmSplit; +continue; +} +var _4c=new Array(); +var _4d=_4b.firstChild; +var _4e=false; +for(;_4d;_4d=_4d.nextSibling){ +if(!_4d.tagName){ +continue; +} +if(_4d.className=="cmNoClick"){ +_4c[0]=_cmNoClick; +_4c[1]=getActionHTML(_4d); +_4e=true; +break; +} +if(_4d.className=="cmNoAction"){ +_4c[0]=_cmNoAction; +_4c[1]=getActionHTML(_4d); +_4e=true; +break; +} +var tag=_4d.tagName.toLowerCase(); +if(tag!="span"){ +continue; +} +if(!_4d.firstChild){ +_4c[0]=null; +}else{ +_4c[0]=_4d.innerHTML; +} +_4d=_4d.nextSibling; +break; +} +if(_4e){ +_4a[_4a.length]=_4c; +continue; +} +if(!_4d){ +continue; +} +for(;_4d;_4d=_4d.nextSibling){ +if(!_4d.tagName){ +continue; +} +var tag=_4d.tagName.toLowerCase(); +if(tag=="a"){ +_4c[1]=_4d.innerHTML; +_4c[2]=_4d.href; +_4c[3]=_4d.target; +_4c[4]=_4d.title; +if(_4c[4]==""){ +_4c[4]=null; +} +}else{ +if(tag=="span"||tag=="div"){ +_4c[1]=_4d.innerHTML; +_4c[2]=null; +_4c[3]=null; +_4c[4]=null; +} +} +break; +} +for(;_4d;_4d=_4d.nextSibling){ +if(!_4d.tagName){ +continue; +} +var tag=_4d.tagName.toLowerCase(); +if(tag!="ul"&&tag!="ol"){ +continue; +} +var _52=cmDrawFromTextSubMenu(_4d); +for(i=0;i<_52.length;++i){ +_4c[i+5]=_52[i]; +} +break; +} +_4a[_4a.length]=_4c; +} +return _4a; +} +function getActionHTML(_53){ +var _54="<td></td><td></td><td></td>"; +var _55; +for(_55=_53.firstChild;_55;_55=_55.nextSibling){ +if(_55.tagName&&_55.tagName.toLowerCase()=="table"){ +break; +} +} +if(!_55){ +return _54; +} +for(_55=_55.firstChild;_55;_55=_55.nextSibling){ +if(_55.tagName&&_55.tagName.toLowerCase()=="tbody"){ +break; +} +} +if(!_55){ +return _54; +} +for(_55=_55.firstChild;_55;_55=_55.nextSibling){ +if(_55.tagName&&_55.tagName.toLowerCase()=="tr"){ +break; +} +} +if(!_55){ +return _54; +} +return _55.innerHTML; +} +function cmGetMenuItem(_56){ +if(!_56.subMenuID){ +return null; +} +var _57=cmGetObject(_56.subMenuID); +if(_56.menu){ +var _58=_56.menu; +_57=_57.firstChild.firstChild.firstChild.firstChild; +var i; +for(i=0;i<_58.length;++i){ +if(_58[i]==_56){ +return _57; +} +_57=_57.nextSibling; +} +}else{ +if(_56.parentItem){ +var _5a=_56.parentItem; +var _5b=cmGetObject(_56.subMenuID+"Table"); +if(!_5b){ +return null; +} +_57=_5b.firstChild.firstChild; +var i; +for(i=5;i<_5a.length;++i){ +if(_5a[i]==_56){ +return _57; +} +_57=_57.nextSibling; +} +} +} +return null; +} +function cmDisableItem(_5d,_5e){ +if(!_5d){ +return; +} +var _5f=cmGetMenuItem(_5d); +if(!_5f){ +return; +} +if(_5d.menu){ +_5f.className=_5e+"MainItemDisabled"; +}else{ +_5f.className=_5e+"MenuItemDisabled"; +} +_5d.isDisabled=true; +} +function cmEnableItem(_60,_61){ +if(!_60){ +return; +} +var _62=cmGetMenuItem(_60); +if(!_62){ +return; +} +if(_60.menu){ +menu.className=_61+"MainItem"; +}else{ +menu.className=_61+"MenuItem"; +} +_60.isDisabled=true; +} +function cmItemMouseOver(obj,_64,_65,_66,_67,_68){ +if(!_68&&_cmClicked){ +cmItemMouseOverOpenSub(obj,_64,_65,_66,_67); +return; +} +clearTimeout(_cmTimeOut); +if(_cmItemList[_67].isDisabled){ +return; +} +var _69=_cmMenuList[_66].prefix; +if(!obj.cmMenuID){ +obj.cmMenuID=_66; +obj.cmIsMain=_64; +} +var _6a=cmGetThisMenu(obj,_69); +if(!_6a.cmItems){ +_6a.cmItems=new Array(); +} +var i; +for(i=0;i<_6a.cmItems.length;++i){ +if(_6a.cmItems[i]==obj){ +break; +} +} +if(i==_6a.cmItems.length){ +_6a.cmItems[i]=obj; +} +if(_cmCurrentItem){ +if(_cmCurrentItem==obj||_cmCurrentItem==_6a){ +var _6c=_cmItemList[_67]; +cmSetStatus(_6c); +return; +} +var _6d=_cmMenuList[_cmCurrentItem.cmMenuID]; +var _6e=_6d.prefix; +var _6f=cmGetThisMenu(_cmCurrentItem,_6e); +if(_6f!=_6a.cmParentMenu){ +if(_cmCurrentItem.cmIsMain){ +_cmCurrentItem.className=_6e+"MainItem"; +}else{ +_cmCurrentItem.className=_6e+"MenuItem"; +} +if(_6f.id!=_65){ +cmHideMenu(_6f,_6a,_6d); +} +} +} +_cmCurrentItem=obj; +cmResetMenu(_6a,_69); +var _70=_cmItemList[_67]; +var _71=cmIsDefaultItem(_70); +if(_71){ +if(_64){ +obj.className=_69+"MainItemHover"; +}else{ +obj.className=_69+"MenuItemHover"; +} +} +cmSetStatus(_70); +} +function cmItemMouseOverOpenSub(obj,_73,_74,_75,_76){ +clearTimeout(_cmTimeOut); +if(_cmItemList[_76].isDisabled){ +return; +} +cmItemMouseOver(obj,_73,_74,_75,_76,true); +if(_74){ +var _77=cmGetObject(_74); +var _78=_cmMenuList[_75]; +var _79=_78.orient; +var _7a=_78.prefix; +cmShowSubMenu(obj,_73,_77,_78); +} +} +function cmItemMouseOut(obj,_7c,_7d,_7e,_7f){ +var _80=_cmMenuList[_7e].nodeProperties.delay; +_cmTimeOut=window.setTimeout("cmHideMenuTime ()",_80); +window.defaultStatus=""; +} +function cmItemMouseDown(obj,_82,_83,_84,_85){ +if(_cmItemList[_85].isDisabled){ +return; +} +if(cmIsDefaultItem(_cmItemList[_85])){ +var _86=_cmMenuList[_84].prefix; +if(obj.cmIsMain){ +obj.className=_86+"MainItemActive"; +}else{ +obj.className=_86+"MenuItemActive"; +} +} +} +function cmItemMouseDownOpenSub(obj,_88,_89,_8a,_8b){ +if(_cmItemList[_8b].isDisabled){ +return; +} +_cmClicked=true; +cmItemMouseDown(obj,_88,_89,_8a,_8b); +if(_89){ +var _8c=cmGetObject(_89); +var _8d=_cmMenuList[_8a]; +cmShowSubMenu(obj,_88,_8c,_8d); +} +} +function cmItemMouseUp(obj,_8f,_90,_91,_92){ +if(_cmItemList[_92].isDisabled){ +return; +} +var _93=_cmItemList[_92]; +var _94=null,target="_self"; +if(_93.length>2){ +_94=_93[2]; +} +if(_93.length>3&&_93[3]){ +target=_93[3]; +} +if(_94!=null){ +_cmClicked=false; +window.open(_94,target); +} +var _95=_cmMenuList[_91]; +var _96=_95.prefix; +var _97=cmGetThisMenu(obj,_96); +var _98=(_93.length>5); +if(!_98){ +if(cmIsDefaultItem(_93)){ +if(obj.cmIsMain){ +obj.className=_96+"MainItem"; +}else{ +obj.className=_96+"MenuItem"; +} +} +cmHideMenu(_97,null,_95); +}else{ +if(cmIsDefaultItem(_93)){ +if(obj.cmIsMain){ +obj.className=_96+"MainItemHover"; +}else{ +obj.className=_96+"MenuItemHover"; +} +} +} +} +function cmMoveSubMenu(obj,_9a,_9b,_9c){ +var _9d=_9c.orient; +var _9e; +if(_9a){ +if(_9d.charAt(0)=="h"){ +_9e=_9c.nodeProperties.offsetHMainAdjust; +}else{ +_9e=_9c.nodeProperties.offsetVMainAdjust; +} +}else{ +_9e=_9c.nodeProperties.offsetSubAdjust; +} +if(!_9a&&_9d.charAt(0)=="h"){ +_9d="v"+_9d.charAt(1)+_9d.charAt(2); +} +var _9f=String(_9d); +var p=_9b.offsetParent; +var _a1=cmGetWidth(_9b); +var _a2=cmGetHorizontalAlign(obj,_9f,p,_a1); +if(_9f.charAt(0)=="h"){ +if(_9f.charAt(1)=="b"){ +_9b.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)+_9e[1])+"px"; +}else{ +_9b.style.top=(cmGetYAt(obj,p)-cmGetHeight(_9b)-_9e[1])+"px"; +} +if(_a2=="r"){ +_9b.style.left=(cmGetXAt(obj,p)+_9e[0])+"px"; +}else{ +_9b.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)-_a1-_9e[0])+"px"; +} +}else{ +if(_a2=="r"){ +_9b.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)+_9e[0])+"px"; +}else{ +_9b.style.left=(cmGetXAt(obj,p)-_a1-_9e[0])+"px"; +} +if(_9f.charAt(1)=="b"){ +_9b.style.top=(cmGetYAt(obj,p)+_9e[1])+"px"; +}else{ +_9b.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)-cmGetHeight(_9b)+_9e[1])+"px"; +} +} +if(_a2!=_9d.charAt(2)){ +_9d=_9d.charAt(0)+_9d.charAt(1)+_a2; +} +return _9d; +} +function cmGetHorizontalAlign(obj,_a4,p,_a6){ +var _a7=_a4.charAt(2); +if(!(document.body)){ +return _a7; +} +var _a8=document.body; +var _a9; +var _aa; +if(window.innerWidth){ +_a9=window.pageXOffset; +_aa=window.innerWidth+_a9; +}else{ +if(_a8.clientWidth){ +_a9=_a8.clientLeft; +_aa=_a8.clientWidth+_a9; +}else{ +return _a7; +} +} +if(_a4.charAt(0)=="h"){ +if(_a7=="r"&&(cmGetXAt(obj)+_a6)>_aa){ +_a7="l"; +} +if(_a7=="l"&&(cmGetXAt(obj)+cmGetWidth(obj)-_a6)<_a9){ +_a7="r"; +} +return _a7; +}else{ +if(_a7=="r"&&(cmGetXAt(obj,p)+cmGetWidth(obj)+_a6)>_aa){ +_a7="l"; +} +if(_a7=="l"&&(cmGetXAt(obj,p)-_a6)<_a9){ +_a7="r"; +} +return _a7; +} +} +function cmShowSubMenu(obj,_ac,_ad,_ae){ +var _af=_ae.prefix; +if(!_ad.cmParentMenu){ +var _b0=cmGetThisMenu(obj,_af); +_ad.cmParentMenu=_b0; +if(!_b0.cmSubMenu){ +_b0.cmSubMenu=new Array(); +} +_b0.cmSubMenu[_b0.cmSubMenu.length]=_ad; +} +var _b1=_ad.cmEffect; +if(_b1){ +_b1.showEffect(true); +}else{ +var _b2=cmMoveSubMenu(obj,_ac,_ad,_ae); +_ad.cmOrient=_b2; +var _b3=false; +if(_ad.style.visibility!="visible"&&_ae.nodeProperties.effect){ +try{ +_b1=_ae.nodeProperties.effect.getInstance(_ad,_b2); +_b1.showEffect(false); +} +catch(e){ +_b3=true; +_ad.cmEffect=null; +} +}else{ +_b3=true; +} +if(_b3){ +_ad.style.visibility="visible"; +} +} +if(!_cmHideObjects){ +_cmHideObjects=2; +try{ +if(window.opera){ +if(parseInt(navigator.appVersion)<9){ +_cmHideObjects=1; +} +} +} +catch(e){ +} +} +if(_cmHideObjects==1){ +if(!_ad.cmOverlap){ +_ad.cmOverlap=new Array(); +} +cmHideControl("IFRAME",_ad); +cmHideControl("OBJECT",_ad); +} +... [truncated message content] |
From: <fan...@us...> - 2008-01-29 21:15:00
|
Revision: 4833 http://linpha.svn.sourceforge.net/linpha/?rev=4833&view=rev Author: fangehrn Date: 2008-01-29 13:14:57 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Modified Paths: -------------- trunk/misc/design/22menuJSCook/indexJSEffectFade.php trunk/misc/design/info.txt Added Paths: ----------- trunk/misc/design/24menuMygosumenu/ trunk/misc/design/24menuMygosumenu/XulMenu.js trunk/misc/design/24menuMygosumenu/XulMenu.txt trunk/misc/design/24menuMygosumenu/example1-cache.html trunk/misc/design/24menuMygosumenu/example1-cache.js trunk/misc/design/24menuMygosumenu/example1.css trunk/misc/design/24menuMygosumenu/example1.html trunk/misc/design/24menuMygosumenu/example2.css trunk/misc/design/24menuMygosumenu/example2.html trunk/misc/design/24menuMygosumenu/global.css trunk/misc/design/24menuMygosumenu/home.css trunk/misc/design/24menuMygosumenu/images/ trunk/misc/design/24menuMygosumenu/images/arrow1.gif trunk/misc/design/24menuMygosumenu/images/arrow2.gif trunk/misc/design/24menuMygosumenu/index.php trunk/misc/design/25menuDickerFisch/ trunk/misc/design/25menuDickerFisch/global.css trunk/misc/design/25menuDickerFisch/home.css trunk/misc/design/25menuDickerFisch/horizontal.html trunk/misc/design/25menuDickerFisch/ie6.css trunk/misc/design/25menuDickerFisch/ie7.css trunk/misc/design/25menuDickerFisch/index.php trunk/misc/design/25menuDickerFisch/index2.php trunk/misc/design/25menuDickerFisch/jq_dickerfisch_menue-c.js trunk/misc/design/25menuDickerFisch/jq_dickerfisch_menue.js trunk/misc/design/25menuDickerFisch/jquery.js trunk/misc/design/25menuDickerFisch/optional/ trunk/misc/design/25menuDickerFisch/optional/cookie.js trunk/misc/design/25menuDickerFisch/optional/dimensions-c.js trunk/misc/design/25menuDickerFisch/optional/dimensions.js trunk/misc/design/25menuDickerFisch/optional/jq.cleanCSSanim.js trunk/misc/design/25menuDickerFisch/rightarrow2.gif trunk/misc/design/25menuDickerFisch/style.css Modified: trunk/misc/design/22menuJSCook/indexJSEffectFade.php =================================================================== --- trunk/misc/design/22menuJSCook/indexJSEffectFade.php 2008-01-29 21:13:19 UTC (rev 4832) +++ trunk/misc/design/22menuJSCook/indexJSEffectFade.php 2008-01-29 21:14:57 UTC (rev 4833) @@ -18,10 +18,10 @@ <link rel="stylesheet" href="../14cornersSchill/roundCorners.css" media="screen" /> -<script type="text/javascript" src="./JSCookMenu/JSCookMenu.js"></script> -<script type="text/javascript" src="./JSCookMenu/effect.js"></script> +<!-- <script type="text/javascript" src="./JSCookMenu/JSCookMenu.js"></script> +<script type="text/javascript" src="./JSCookMenu/effect.js"></script> --> -<!-- <script type="text/javascript" src="./JSCookMenu/JSCookMenuPacked4.js"></script> --> +<script type="text/javascript" src="./JSCookMenu/JSCookMenuPacked62.js"></script> <link rel="stylesheet" href="./JSCookMenu/ThemePanelLinpha/theme.css" type="text/css"> <script type="text/javascript" src="./JSCookMenu/ThemePanelLinpha/theme.js"></script> Added: trunk/misc/design/24menuMygosumenu/XulMenu.js =================================================================== --- trunk/misc/design/24menuMygosumenu/XulMenu.js (rev 0) +++ trunk/misc/design/24menuMygosumenu/XulMenu.js 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,322 @@ +/* + * DO NOT REMOVE THIS NOTICE + * + * PROJECT: mygosuMenu + * VERSION: 1.4.2 + * COPYRIGHT: (c) 2003,2004 Cezary Tomczak + * LINK: http://gosu.pl/dhtml/mygosumenu.html + * LICENSE: BSD (revised) + */ + +function XulMenu(id) { + + this.type = "horizontal"; + this.position = { + "level1": { "top": 0, "left": 0}, + "levelX": { "top": 0, "left": 0} + } + this.zIndex = { + "visible": 1, + "hidden": -1 + } + this.arrow1 = null; + this.arrow2 = null; + + // Browser detection + this.browser = { + "ie": Boolean(document.body.currentStyle), + "ie5": (navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1) + }; + if (!this.browser.ie) { this.browser.ie5 = false; } + + /* Initialize the menu */ + this.init = function() { + if (!document.getElementById(this.id)) alert("Element '"+ this.id +"' does not exist in this document. XulMenu cannot be initialized."); + if (this.type != "horizontal" && this.type != "vertical") { return alert("XulMenu.init() failed. Unknown menu type: '"+this.type+"'"); } + document.onmousedown = click; + if (this.browser.ie && this.browser.ie5) { this.fixWrap(); } + this.fixSections(); + this.parse(document.getElementById(this.id).childNodes, this.tree, this.id); + } + + /* Search for .section elements and set width for them */ + this.fixSections = function() { + var arr = document.getElementById(this.id).getElementsByTagName("div"); + var sections = new Array(); + var widths = new Array(); + + for (var i = 0; i < arr.length; i++) { + if (arr[i].className == "section") { + sections.push(arr[i]); + } + } + for (var i = 0; i < sections.length; i++) { + widths.push(this.getMaxWidth(sections[i].childNodes)); + } + for (var i = 0; i < sections.length; i++) { + sections[i].style.width = (widths[i]) + "px"; + } + if (self.browser.ie) { + for (var i = 0; i < sections.length; i++) { + this.setMaxWidth(sections[i].childNodes, widths[i]); + } + } + } + + this.fixWrap = function() { + var elements = document.getElementById(this.id).getElementsByTagName("a"); + for (var i = 0; i < elements.length; i++) { + if (/item/.test(elements[i].className)) { + elements[i].innerHTML = '<div nowrap="nowrap">'+elements[i].innerHTML+'</div>'; + } + } + } + + /* Search for an element with highest width, return that width */ + this.getMaxWidth = function(nodes) { + var maxWidth = 0; + for (var i = 0; i < nodes.length; i++) { + if (nodes[i].nodeType != 1 || nodes[i].className == "section") { continue; } + if (nodes[i].offsetWidth > maxWidth) maxWidth = nodes[i].offsetWidth; + } + return maxWidth; + } + + /* Set width for item elements */ + this.setMaxWidth = function(nodes, maxWidth) { + for (var i = 0; i < nodes.length; i++) { + if (nodes[i].nodeType == 1 && /item/.test(nodes[i].className) && nodes[i].currentStyle) { + if (this.browser.ie5) { + nodes[i].style.width = (maxWidth) + "px"; + } else { + nodes[i].style.width = (maxWidth - parseInt(nodes[i].currentStyle.paddingLeft) - parseInt(nodes[i].currentStyle.paddingRight)) + "px"; + } + } + } + } + + /* Parse menu structure, create events, position elements */ + this.parse = function(nodes, tree, id) { + for (var i = 0; i < nodes.length; i++) { + if (nodes[i].nodeType != 1) { continue }; + switch (nodes[i].className) { + case "button": + nodes[i].id = id + "-" + tree.length; + tree.push(new Array()); + nodes[i].onmouseover = buttonOver; + nodes[i].onclick = buttonClick; + break; + case "item": + nodes[i].id = id + "-" + tree.length; + tree.push(new Array()); + nodes[i].onmouseover = itemOver; + nodes[i].onmouseout = itemOut; + nodes[i].onclick = itemClick; + break; + case "section": + nodes[i].id = id + "-" + (tree.length - 1) + "-section"; + var box1 = document.getElementById(id + "-" + (tree.length - 1)); + var box2 = document.getElementById(nodes[i].id); + var el = new Element(box1.id); + if (el.level == 1) { + if (this.type == "horizontal") { + box2.style.top = (box1.offsetTop + box1.offsetHeight + this.position.level1.top) + "px"; + if (this.browser.ie5) { + box2.style.left = (this.position.level1.left) + "px"; + } else { + box2.style.left = (box1.offsetLeft + this.position.level1.left) + "px"; + } + } else if (this.type == "vertical") { + box2.style.top = (box1.offsetTop + this.position.level1.top) + "px"; + if (this.browser.ie5) { + box2.style.left = (box1.offsetWidth + this.position.level1.left) + "px"; + } else { + box2.style.left = (box1.offsetLeft + box1.offsetWidth + this.position.level1.left) + "px"; + } + } + } else { + box2.style.top = (box1.offsetTop + this.position.levelX.top) + "px"; + box2.style.left = (box1.offsetLeft + box1.offsetWidth + this.position.levelX.left) + "px"; + } + break; + case "arrow": + nodes[i].id = id + "-" + (tree.length - 1) + "-arrow"; + break; + } + if (nodes[i].childNodes) { + if (nodes[i].className == "section") { + this.parse(nodes[i].childNodes, tree[tree.length - 1], id + "-" + (tree.length - 1)); + } else { + this.parse(nodes[i].childNodes, tree, id); + } + } + } + } + + /* Hide all sections */ + this.hideAll = function() { + for (var i = this.visible.length - 1; i >= 0; i--) { + this.hide(this.visible[i]); + } + } + + /* Hide higher or equal levels */ + this.hideHigherOrEqualLevels = function(n) { + for (var i = this.visible.length - 1; i >= 0; i--) { + var el = new Element(this.visible[i]); + if (el.level >= n) { + this.hide(el.id); + } else { + return; + } + } + } + + /* Hide a section */ + this.hide = function(id) { + var el = new Element(id); + document.getElementById(id).className = (el.level == 1 ? "button" : "item"); + if (el.level > 1 && this.arrow2) { + document.getElementById(id + "-arrow").src = this.arrow1; + } + document.getElementById(id + "-section").style.visibility = "hidden"; + document.getElementById(id + "-section").style.zIndex = this.zIndex.hidden; + if (this.visible.contains(id)) { + if (this.visible.getLast() == id) { + this.visible.pop(); + } else { + throw "XulMenu.hide("+id+") failed, trying to hide element that is not deepest visible element"; + } + } else { + throw "XulMenu.hide("+id+") failed, cannot hide element that is not visible"; + } + } + + /* Show a section */ + this.show = function(id) { + var el = new Element(id); + document.getElementById(id).className = (el.level == 1 ? "button-active" : "item-active"); + if (el.level > 1 && this.arrow2) { + document.getElementById(id + "-arrow").src = this.arrow2; + } + document.getElementById(id + "-section").style.visibility = "visible"; + document.getElementById(id + "-section").style.zIndex = this.zIndex.visible; + this.visible.push(id); + } + + /* event, document.onmousedown */ + function click(e) { + var el; + if (e) { + el = e.target.tagName ? e.target : e.target.parentNode; + } else { + el = window.event.srcElement; + if (el.parentNode && /item/.test(el.parentNode.className)) { + el = el.parentNode; + } + } + if (!self.visible.length) { return }; + if (!el.onclick) { self.hideAll(); } + } + + /* event, button.onmouseover */ + function buttonOver() { + if (!self.visible.length) { return; } + if (self.visible.contains(this.id)) { return }; + self.hideAll(); + var el = new Element(this.id); + if (el.hasChilds()) { + self.show(this.id); + } + } + + /* event, button.onclick */ + function buttonClick() { + this.blur(); + if (self.visible.length) { + self.hideAll(); + } else { + var el = new Element(this.id); + if (el.hasChilds()) { + self.show(this.id); + } + } + } + + /* event, item.onmouseover */ + function itemOver() { + var el = new Element(this.id); + self.hideHigherOrEqualLevels(el.level); + if (el.hasChilds()) { + self.show(this.id); + } + } + + /* event, item.onmouseout */ + function itemOut() { + var el = new Element(this.id); + if (!el.hasChilds()) { + document.getElementById(this.id).className = "item"; + } + } + + /* event, item.onclick */ + function itemClick() { + this.blur(); + var el = new Element(this.id); + self.hideHigherOrEqualLevels(el.level); + if (el.hasChilds()) { + self.show(this.id); + } + } + + function Element(id) { + + /* Get Level of given id + * Examples: menu-1 (1 level), menu-1-4 (2 level) */ + this.getLevel = function() { + var s = this.id.substr(this.menu.id.length); + return s.substrCount("-"); + } + + /* Check whether an element has a sub-section */ + this.hasChilds = function() { + return Boolean(document.getElementById(this.id + "-section")); + } + + if (!id) { throw "XulMenu.Element(id) failed, id cannot be empty"; } + this.menu = self; + this.id = id; + this.level = this.getLevel(); + } + + this.id = id; + var self = this; + + this.tree = new Array(); /* Multidimensional array, structure of the menu */ + this.visible = new Array(); /* Example: Array("menu-0", "menu-0-4", ...), succession is important ! */ +} + +/* Check whether array contains given string */ +if (typeof Array.prototype.contains == "undefined") { + Array.prototype.contains = function(s) { + for (var i = 0; i < this.length; i++) { + if (this[i] === s) { return true; } + } + return false; + } +} + +/* Get the last element from the array */ +if (typeof Array.prototype.getLast == "undefined") { + Array.prototype.getLast = function() { + return this[this.length-1]; + } +} + +/* Counts the number of substring occurrences */ +if (typeof String.prototype.substrCount == "undefined") { + String.prototype.substrCount = function(s) { + return this.split(s).length - 1; + } +} \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/XulMenu.txt =================================================================== --- trunk/misc/design/24menuMygosumenu/XulMenu.txt (rev 0) +++ trunk/misc/design/24menuMygosumenu/XulMenu.txt 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,130 @@ +---------------- +INSTALL +---------------- + +1) include .css file +2) include .js file +3) put html structure +4) initialize menu + +Html structure is: + +- XulMenu + - button + - section + - item + - item + - item + - section + - item + - item + - item + - item + - button + - section + - item + - item + - button + +Example of initializing: + var menu = new XulMenu("id_of_the_menu"); + menu.init(); + +Example of initializing and setting additional stuff: + var menu1 = new XulMenu("menu1"); + menu1.type = "horizontal"; + menu1.position.level1.top = 0; + menu1.position.level1.left = 0; + menu1.position.levelX.top = 0; + menu1.position.levelX.left = 0; + menu1.arrow1 = "images/arrow.gif"; + menu1.arrow2 = "images/arrow-active.gif"; + +Note: + arrow1 & arrow2 set only when you want the arrow image to change when + element is active. If you don't want the arrow to change keep both variables empty. + +---------------- +API +---------------- + +Controlling the menu: + + show(id) + hide(id) + hideAll() + hideHigherOrEqualLevels(n) + + id = id of the element + n = level + + examples: + + 1) + menu1.show("menu1-1"); + + 2) + menu1.show("menu1-1"); + menu1.show("menu1-1-2"); + menu1.show("menu1-1-2-0"); + menu1.hideHigherOrEqualLevels(2); + + Both examples show the same. + +---------------- +CACHING +---------------- + +If the menu is big, for example you want the whole structure of the site in the menu +and it is 50 KB then you should cache this data, so the user downloads this code only +once and not on each request. + +See files: example1-cache.html, example1-cache.js + +example1-cache.html - instead of menu structure put this: +<script type="text/javascript" src="example1-cache.js"></script> + +example1-cache.js - the code with removed whitespace characters and some js code: +document.write('... code of the menu with removed spaces and new lines ...'); + +Advantages: reduce bandwidth, faster page loading +Disadvantages: the links won't be visible to search engines + +Note: + Removing whitespace characters from the menu code is easy with this tool: + http://gosu.pl/demo/dhtml-tools/String.replace.html + 1) In "Before" put the menu code. + 2) In "Regexp" put this: \s*(<[^>]*>) + 3) In "NewSubStr" put this: $1 + Click Replace and it's done ! + +---------------- +FEATURES +---------------- + +- horizontal or vertical menu +- unlimited nesting +- can be positioned statically or absolutely +- position of submenus can be changed, so they can for example overflow parent elements +- on the same page there can be many menus created +- seperated into 3 layers: behaviour(javascript), structure(html), presentation(css) +- search engine friendly +- free for any use (BSD license) + +---------------- +COMPATIBILITY +---------------- + +Tested on: IE, Mozilla, Opera, Safari, Netscape, Firefox + +---------------- +CHANGELOG +---------------- + +*** 1.4.2 *** + + - added support for IE 5.0 & IE 5.5 + +*** 1.4.1 *** + + - [js] fixed a minor bug, onclick event \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/example1-cache.html =================================================================== --- trunk/misc/design/24menuMygosumenu/example1-cache.html (rev 0) +++ trunk/misc/design/24menuMygosumenu/example1-cache.html 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>#1.4 XulMenu example 1</title> + <link rel="stylesheet" type="text/css" href="example1.css" /> + <script type="text/javascript" src="../ie5.js"></script> + <script type="text/javascript" src="XulMenu.js"></script> + <style type="text/css"> + body { margin: 0; padding: 0; background: #ffffff; } + #bar { + background: #ECE9D8; + border: 1px solid; + border-color: #ffffff #ACA899 #ACA899 #ffffff; + padding-top: 3px; + padding-bottom: 3px; + cursor: default; + } + #menu1 { padding-left: 5px; } + #search { + position: absolute; + top: 0; + right: 5px; + } + #search input, + #search select { + font-family: georgia, tahoma, verdana; + font-size: 12px; + margin-top: 4px; + } + </style> +</head> +<body> + + <script type="text/javscript"> + /* preload images */ + var arrow1 = new Image(4, 7); + arrow1.src = "images/arrow1.gif"; + var arrow2 = new Image(4, 7); + arrow2.src = "images/arrow2.gif"; + </script> + + <div id="bar"> + + <script type="text/javascript" src="example1-cache.js"></script> + + <div id="search"> + <input type="text" name="searchField" value="" /> + <select name="searchWhat"><option value="">Articles</option><option value="">Links</option><option value="">PHP Manual</option></select> + <input type="button" value="Search" /> + </div> + + </div> + + <script type="text/javascript"> + var menu1 = new XulMenu("menu1"); + menu1.arrow1 = "images/arrow1.gif"; + menu1.arrow2 = "images/arrow2.gif"; + menu1.init(); + </script> + +</body> +</html> \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/example1-cache.js =================================================================== --- trunk/misc/design/24menuMygosumenu/example1-cache.js (rev 0) +++ trunk/misc/design/24menuMygosumenu/example1-cache.js 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1 @@ +document.write('<table cellspacing="0" cellpadding="0" id="menu1" class="XulMenu"><tr><td><a class="button" href="javascript:void(0)">Viewer</a><div class="section"><a class="item" href="example1.html">Home</a><a class="item" href="example1.html">Close</a></div></td><td><a class="button" href="javascript:void(0)">Articles</a><div class="section"><a class="item" href="javascript:void(0)">Advocacy<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Advocacy One</a><a class="item" href="example1.html">Advocacy Two</a><a class="item" href="example1.html">Advocacy Three</a><a class="item" href="example1.html">Advocacy Four</a><a class="item" href="example1.html">Advocacy Five</a><a class="item" href="example1.html">Advocacy Six</a><a class="item" href="example1.html">Advocacy Seven</a></div><a class="item" href="javascript:void(0)">Blogs<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="javascript:void(0)">PHP Guru<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Guru One</a><a class="item" href="example1.html">Guru Two</a><a class="item" href="example1.html">Guru Three</a><a class="item" href="example1.html">Guru Four</a></div></div><a class="item" href="javascript:void(0)">Design<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="javascript:void(0)">Archive<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.hmtl">Archive One</a></div><a class="item" href="example1.html">Design One</a><a class="item" href="example1.html">Design Two</a><a class="item" href="example1.html">Design Three</a><a class="item" href="example1.html">Design Four</a><a class="item" href="example1.html">Design Five</a></div><a class="item" href="javascript:void(0)">Develop<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Develop One</a><a class="item" href="example1.html">Develop Two</a><a class="item" href="example1.html">Develop Three</a><a class="item" href="example1.html">Develop Five</a><a class="item" href="example1.html">Develop Six</a><a class="item" href="example1.html">Develop Seven</a><a class="item" href="example1.html">Develop Eight</a></div><a class="item" href="javascript:void(0)">News<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">News One</a><a class="item" href="example1.html">News Two</a><a class="item" href="example1.html">News Three</a><a class="item" href="example1.html">News Four</a></div><a class="item" href="javascript:void(0)">Reviews<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Review One</a><a class="item" href="example1.html">Review Two</a></div><a class="item" href="example1.html">File Manager</a></div></td><td><a class="button" href="javascript:void(0)">Links</a><div class="section"><a class="item" href="javascript:void(0)">Advocacy<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="javascript:void(0)">Interviews<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Interview One</a><a class="item" href="example1.html">Interview Two</a><a class="item" href="example1.html">Interview Three</a><a class="item" href="example1.html">Interview Four</a><a class="item" href="example1.html">Interview Five</a><a class="item" href="example1.html">Interview Six</a><a class="item" href="example1.html">Interview Seven</a></div><a class="item" href="javascript:void(0)">PHP<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">PHP One</a><a class="item" href="example1.html">PHP Two</a><a class="item" href="example1.html">PHP Three</a></div><a class="item" href="example1.html">Advocacy One</a><a class="item" href="example1.html">Advocacy Two</a><a class="item" href="example1.html">Advocacy Three</a><a class="item" href="example1.html">Advocacy Four</a><a class="item" href="example1.html">Advocacy Five</a></div><a class="item" href="javascript:void(0)">Community<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Community One</a><a class="item" href="example1.html">Community Two</a><a class="item" href="example1.html">Community Three</a><a class="item" href="example1.html">Community Four</a><a class="item" href="example1.html">Community Five</a></div><a class="item" href="javascript:void(0)">Concepts<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="javascript:void(0)">Books<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Book One</a><a class="item" href="example1.html">Book Two</a><a class="item" href="example1.html">Book Three</a><a class="item" href="example1.html">Book Four</a></div><a class="section" href="javascript:void(0)">Patterns<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Pattern One</a><a class="item" href="example1.html">Pattern Two</a><a class="item" href="example1.html">Pattern Three</a><a class="item" href="example1.html">Pattern Four</a></div><a class="item" href="example1.html">Concept One</a><a class="item" href="example1.html">Concept Two</a><a class="item" href="example1.html">Concept Three</a></div><a class="item" href="javascript:void(0)">Tutorials<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="javascript:void(0)">Introductory<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a><div class="section"><a class="item" href="example1.html">Introductory One</a><a class="item" href="example1.html">IIntroductory Two</a><a class="item" href="example1.html">Introductory Three</a><a class="item" href="example1.html">Introductory Four</a><a class="item" href="example1.html">Introductory Five</a><a class="item" href="example1.html">Introductory Six</a><a class="item" href="example1.html">Introductory Seven</a></div><a class="item" href="example1.html">Tutorial One</a><a class="item" href="example1.html">Tutorial Two</a><a class="item" href="example1.html">Tutorial Three</a><a class="item" href="example1.html">Tutorial Four</a><a class="item" href="example1.html">Tutorial Five</a><a class="item" href="example1.html">Tutorial Six</a><a class="item" href="example1.html">Tutorial Seven</a><a class="item" href="example1.html">Tutorial Eight</a><a class="item" href="example1.html">Tutorial Nine</a></div></div></td><td><a class="button" href="javascript:void(0)">Help</a><div class="section"><a class="item" href="example1.html">About XulMenu</a><a class="item" href="example1.html">About this site</a></div></td></tr></table>'); \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/example1.css =================================================================== --- trunk/misc/design/24menuMygosumenu/example1.css (rev 0) +++ trunk/misc/design/24menuMygosumenu/example1.css 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,63 @@ +.XulMenu { + font-family: georgia, tahoma, verdana; + font-size: 11px; + -moz-user-select: none; +} +.XulMenu .button, +.XulMenu .button:hover, +.XulMenu .button-active, +.XulMenu .button-active:hover { + line-height: normal; + padding: 5px 6px 4px 6px; + border: 1px solid #ECE9D8; + color: #000000; + text-decoration: none; + cursor: default; + white-space: nowrap; + display: block; + position: relative; +} +.XulMenu .button:hover { + border-color: #ffffff #ACA899 #ACA899 #ffffff; +} +.XulMenu .button-active, +.XulMenu .button-active:hover { + border-color: #ACA899 #ffffff #ffffff #ACA899; +} +.XulMenu .item, +.XulMenu .item:hover, +.XulMenu .item-active, +.XulMenu .item-active:hover { + background: #ffffff; + line-height: normal; + padding: 3px 30px 3px 20px; + color: #000000; + text-decoration: none; + cursor: default; + white-space: nowrap; + display: block; + position: relative; +} +.XulMenu .item:hover, +.XulMenu .item-active, +.XulMenu .item-active:hover { + background: #316AC5; + color: #ffffff; +} +.XulMenu .section { + background: #ffffff; + border: 1px solid; + border-color: #F1EFE2 #716F64 #716F64 #F1EFE2; + padding: 2px 1px 1px 2px; + position: absolute; + visibility: hidden; + z-index: -1; +} +.XulMenu .arrow { + position: absolute; + top: 7px; + right: 8px; + border: 0; +} + +* html .XulMenu td { position: relative; } /* ie 5.0 fix */ \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/example1.html =================================================================== --- trunk/misc/design/24menuMygosumenu/example1.html (rev 0) +++ trunk/misc/design/24menuMygosumenu/example1.html 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,236 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <script type="text/javascript" src="file://d:/dhtml/dev/debug.js"></script> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>#1.4 XulMenu example 1</title> + <link rel="stylesheet" type="text/css" href="example1.css" /> + <script type="text/javascript" src="../ie5.js"></script> + <script type="text/javascript" src="XulMenu.js"></script> + <style type="text/css"> + body { margin: 0; padding: 0; background: #ffffff; } + #bar { + background: #ECE9D8; + border: 1px solid; + border-color: #ffffff #ACA899 #ACA899 #ffffff; + padding-top: 3px; + padding-bottom: 3px; + padding-left: 5px; + cursor: default; + } + #search { + position: absolute; + top: 0; + right: 5px; + } + #search input, + #search select { + font-family: georgia, tahoma, verdana; + font-size: 12px; + margin-top: 4px; + } + p { font-family: georgia, tahoma, verdana; font-size: 11px; margin: 2em; } + </style> +</head> +<body> + + <script type="text/javscript"> + /* preload images */ + var arrow1 = new Image(4, 7); + arrow1.src = "images/arrow1.gif"; + var arrow2 = new Image(4, 7); + arrow2.src = "images/arrow2.gif"; + </script> + + <div id="bar"> + + <table cellspacing="0" cellpadding="0" id="menu1" class="XulMenu"> + <tr> + <td> + <a class="button" href="javascript:void(0)">Viewer</a> + <div class="section"> + <a class="item" href="example1.html">Home</a> + <a class="item" href="example1.html">Close</a> + </div> + </td> + <td> + <a class="button" href="javascript:void(0)">Articles</a> + <div class="section"> + <a class="item" href="javascript:void(0)">Advocacy<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Advocacy One</a> + <a class="item" href="example1.html">Advocacy Two</a> + <a class="item" href="example1.html">Advocacy Three</a> + <a class="item" href="example1.html">Advocacy Four</a> + <a class="item" href="example1.html">Advocacy Five</a> + <a class="item" href="example1.html">Advocacy Six</a> + <a class="item" href="example1.html">Advocacy Seven</a> + </div> + <a class="item" href="javascript:void(0)">Blogs<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">PHP Guru<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Guru One</a> + <a class="item" href="example1.html">Guru Two</a> + <a class="item" href="example1.html">Guru Three</a> + <a class="item" href="example1.html">Guru Four</a> + </div> + </div> + <a class="item" href="javascript:void(0)">Design<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Archive<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.hmtl">Archive One</a> + </div> + <a class="item" href="example1.html">Design One</a> + <a class="item" href="example1.html">Design Two</a> + <a class="item" href="example1.html">Design Three</a> + <a class="item" href="example1.html">Design Four</a> + <a class="item" href="example1.html">Design Five</a> + </div> + <a class="item" href="javascript:void(0)">Develop<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Develop One</a> + <a class="item" href="example1.html">Develop Two</a> + <a class="item" href="example1.html">Develop Three</a> + <a class="item" href="example1.html">Develop Five</a> + <a class="item" href="example1.html">Develop Six</a> + <a class="item" href="example1.html">Develop Seven</a> + <a class="item" href="example1.html">Develop Eight</a> + </div> + <a class="item" href="javascript:void(0)">News<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">News One</a> + <a class="item" href="example1.html">News Two</a> + <a class="item" href="example1.html">News Three</a> + <a class="item" href="example1.html">News Four</a> + </div> + <a class="item" href="javascript:void(0)">Reviews<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Review One</a> + <a class="item" href="example1.html">Review Two</a> + </div> + <a class="item" href="example1.html">File Manager</a> + </div> + </td> + <td> + <a class="button" href="javascript:void(0)">Links</a> + <div class="section"> + <a class="item" href="javascript:void(0)">Advocacy<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Interviews<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Interview One</a> + <a class="item" href="example1.html">Interview Two</a> + <a class="item" href="example1.html">Interview Three</a> + <a class="item" href="example1.html">Interview Four</a> + <a class="item" href="example1.html">Interview Five</a> + <a class="item" href="example1.html">Interview Six</a> + <a class="item" href="example1.html">Interview Seven</a> + </div> + <a class="item" href="javascript:void(0)">PHP<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">PHP One</a> + <a class="item" href="example1.html">PHP Two</a> + <a class="item" href="example1.html">PHP Three</a> + </div> + <a class="item" href="example1.html">Advocacy One</a> + <a class="item" href="example1.html">Advocacy Two</a> + <a class="item" href="example1.html">Advocacy Three</a> + <a class="item" href="example1.html">Advocacy Four</a> + <a class="item" href="example1.html">Advocacy Five</a> + </div> + <a class="item" href="javascript:void(0)">Community<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Community One</a> + <a class="item" href="example1.html">Community Two</a> + <a class="item" href="example1.html">Community Three</a> + <a class="item" href="example1.html">Community Four</a> + <a class="item" href="example1.html">Community Five</a> + </div> + <a class="item" href="javascript:void(0)">Concepts<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Books<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Book One</a> + <a class="item" href="example1.html">Book Two</a> + <a class="item" href="example1.html">Book Three</a> + <a class="item" href="example1.html">Book Four</a> + </div> + <a class="section" href="javascript:void(0)">Patterns<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Pattern One</a> + <a class="item" href="example1.html">Pattern Two</a> + <a class="item" href="example1.html">Pattern Three</a> + <a class="item" href="example1.html">Pattern Four</a> + </div> + <a class="item" href="example1.html">Concept One</a> + <a class="item" href="example1.html">Concept Two</a> + <a class="item" href="example1.html">Concept Three</a> + </div> + <a class="item" href="javascript:void(0)">Tutorials<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Introductory<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.html">Introductory One</a> + <a class="item" href="example1.html">IIntroductory Two</a> + <a class="item" href="example1.html">Introductory Three</a> + <a class="item" href="example1.html">Introductory Four</a> + <a class="item" href="example1.html">Introductory Five</a> + <a class="item" href="example1.html">Introductory Six</a> + <a class="item" href="example1.html">Introductory Seven</a> + </div> + <a class="item" href="example1.html">Tutorial One</a> + <a class="item" href="example1.html">Tutorial Two</a> + <a class="item" href="example1.html">Tutorial Three</a> + <a class="item" href="example1.html">Tutorial Four</a> + <a class="item" href="example1.html">Tutorial Five</a> + <a class="item" href="example1.html">Tutorial Six</a> + <a class="item" href="example1.html">Tutorial Seven</a> + <a class="item" href="example1.html">Tutorial Eight</a> + <a class="item" href="example1.html">Tutorial Nine</a> + </div> + </div> + </td> + <td> + <a class="button" href="javascript:void(0)">Help</a> + <div class="section"> + <a class="item" href="example1.html">About XulMenu</a> + <a class="item" href="example1.html">About this site</a> + </div> + </td> + </tr> + </table> + + <div id="search"> + <input type="text" name="searchField" value="" /> + <select name="searchWhat"><option value="">Articles</option><option value="">Links</option><option value="">PHP Manual</option></select> + <input type="button" value="Search" /> + </div> + + </div> + + <script type="text/javascript"> + var menu1 = new XulMenu("menu1"); + menu1.arrow1 = "images/arrow1.gif"; + menu1.arrow2 = "images/arrow2.gif"; + menu1.init(); + </script> + + <p> + <b>Project</b>: <a href="http://gosu.pl/dhtml/mygosumenu.html">mygosuMenu</a> <br /> + <b>Menu type</b>: #1.4 XulMenu example 1 <br /> + <b>Features</b>: <br /> + - horizontal or vertical menu <br /> + - unlimited nesting <br /> + - can be positioned statically or absolutely <br /> + - position of submenus can be changed, so they can for example overflow parent elements <br /> + - on the same page there can be many menus created <br /> + - seperated into 3 layers: behaviour(javascript), structure(html), presentation(css) <br /> + - search engine friendly <br /> + - free for any use (BSD license) <br /> + <b>Compatibility</b>: Tested and works great on: IE 5.0/5.5/6.0, Mozilla 1.4/1.7, Opera 7.11/7.23/7.51, Netscape 7.11, Firefox 0.7/0.8/0.9, Safari 1.2 + </p> + +</body> +</html> \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/example2.css =================================================================== --- trunk/misc/design/24menuMygosumenu/example2.css (rev 0) +++ trunk/misc/design/24menuMygosumenu/example2.css 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,63 @@ +.XulMenu { + font-family: georgia, tahoma, verdana; + font-size: 11px; + -moz-user-select: none; +} +.XulMenu .button, +.XulMenu .button:hover, +.XulMenu .button-active, +.XulMenu .button-active:hover { + line-height: normal; + padding: 5px 6px 4px 6px; + border: 1px solid #ECE9D8; + color: #000000; + text-decoration: none; + cursor: default; + white-space: nowrap; + display: block; + position: relative; +} +.XulMenu .button:hover { + border-color: #ffffff #ACA899 #ACA899 #ffffff; +} +.XulMenu .button-active, +.XulMenu .button-active:hover { + border-color: #ACA899 #ffffff #ffffff #ACA899; +} +.XulMenu .item, +.XulMenu .item:hover, +.XulMenu .item-active, +.XulMenu .item-active:hover { + background: #ffffff; + line-height: normal; + padding: 3px 30px 3px 20px; + color: #000000; + text-decoration: none; + cursor: default; + white-space: nowrap; + display: block; + position: relative; +} +.XulMenu .item:hover, +.XulMenu .item-active, +.XulMenu .item-active:hover { + background: #316AC5; + color: #ffffff; +} +.XulMenu .section { + background: #ffffff; + border: 1px solid; + border-color: #F1EFE2 #716F64 #716F64 #F1EFE2; + padding: 2px 1px 1px 2px; + position: absolute; + visibility: hidden; + z-index: -1; +} +.XulMenu .arrow { + position: absolute; + top: 7px; + right: 8px; + border: 0; +} + +* html .XulMenu td { position: relative; } /* ie 5.0 fix */ \ No newline at end of file Added: trunk/misc/design/24menuMygosumenu/example2.html =================================================================== --- trunk/misc/design/24menuMygosumenu/example2.html (rev 0) +++ trunk/misc/design/24menuMygosumenu/example2.html 2008-01-29 21:14:57 UTC (rev 4833) @@ -0,0 +1,220 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>#1.4 XulMenu example 2</title> + <link rel="stylesheet" type="text/css" href="example2.css" /> + <script type="text/javascript" src="../ie5.js"></script> + <script type="text/javascript" src="XulMenu.js"></script> + <style type="text/css"> + html, body { height: 100%; } + body { margin: 0; padding: 0; background: #ffffff; } + #bar { + background: #ECE9D8; + border: 1px solid; + border-color: #ffffff #ACA899 #ACA899 #ffffff; + padding: 3px; + cursor: default; + } + table td { vertical-align: top; } + p { font-family: georgia, tahoma, verdana; font-size: 11px; margin: 2em; } + </style> +</head> +<body> + + <script type="text/javscript"> + /* preload images */ + var arrow1 = new Image(4, 7); + arrow1.src = "images/arrow1.gif"; + var arrow2 = new Image(4, 7); + arrow2.src = "images/arrow2.gif"; + </script> + + <table cellspacing="0" cellpadding="0" height="100%"><tr><td id="bar"> + + <table cellspacing="0" cellpadding="0" id="menu1" class="XulMenu"> + <tr> + <td> + <a class="button" href="javascript:void(0)">Viewer</a> + <div class="section"> + <a class="item" href="example2.html">Home</a> + <a class="item" href="example2.html">Close</a> + </div> + + <a class="button" href="javascript:void(0)">Articles</a> + <div class="section"> + <a class="item" href="javascript:void(0)">Advocacy<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Advocacy One</a> + <a class="item" href="example2.html">Advocacy Two</a> + <a class="item" href="example2.html">Advocacy Three</a> + <a class="item" href="example2.html">Advocacy Four</a> + <a class="item" href="example2.html">Advocacy Five</a> + <a class="item" href="example2.html">Advocacy Six</a> + <a class="item" href="example2.html">Advocacy Seven</a> + </div> + <a class="item" href="javascript:void(0)">Blogs<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">PHP Guru<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Guru One</a> + <a class="item" href="example2.html">Guru Two</a> + <a class="item" href="example2.html">Guru Three</a> + <a class="item" href="example2.html">Guru Four</a> + </div> + </div> + <a class="item" href="javascript:void(0)">Design<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Archive<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example1.hmtl">Archive One</a> + </div> + <a class="item" href="example2.html">Design One</a> + <a class="item" href="example2.html">Design Two</a> + <a class="item" href="example2.html">Design Three</a> + <a class="item" href="example2.html">Design Four</a> + <a class="item" href="example2.html">Design Five</a> + </div> + <a class="item" href="javascript:void(0)">Develop<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Develop One</a> + <a class="item" href="example2.html">Develop Two</a> + <a class="item" href="example2.html">Develop Three</a> + <a class="item" href="example2.html">Develop Five</a> + <a class="item" href="example2.html">Develop Six</a> + <a class="item" href="example2.html">Develop Seven</a> + <a class="item" href="example2.html">Develop Eight</a> + </div> + <a class="item" href="javascript:void(0)">News<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">News One</a> + <a class="item" href="example2.html">News Two</a> + <a class="item" href="example2.html">News Three</a> + <a class="item" href="example2.html">News Four</a> + </div> + <a class="item" href="javascript:void(0)">Reviews<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Review One</a> + <a class="item" href="example2.html">Review Two</a> + </div> + <a class="item" href="example2.html">File Manager</a> + </div> + + <a class="button" href="javascript:void(0)">Links</a> + <div class="section"> + <a class="item" href="javascript:void(0)">Advocacy<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Interviews<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Interview One</a> + <a class="item" href="example2.html">Interview Two</a> + <a class="item" href="example2.html">Interview Three</a> + <a class="item" href="example2.html">Interview Four</a> + <a class="item" href="example2.html">Interview Five</a> + <a class="item" href="example2.html">Interview Six</a> + <a class="item" href="example2.html">Interview Seven</a> + </div> + <a class="item" href="javascript:void(0)">PHP<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">PHP One</a> + <a class="item" href="example2.html">PHP Two</a> + <a class="item" href="example2.html">PHP Three</a> + </div> + <a class="item" href="example2.html">Advocacy One</a> + <a class="item" href="example2.html">Advocacy Two</a> + <a class="item" href="example2.html">Advocacy Three</a> + <a class="item" href="example2.html">Advocacy Four</a> + <a class="item" href="example2.html">Advocacy Five</a> + </div> + <a class="item" href="javascript:void(0)">Community<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Community One</a> + <a class="item" href="example2.html">Community Two</a> + <a class="item" href="example2.html">Community Three</a> + <a class="item" href="example2.html">Community Four</a> + <a class="item" href="example2.html">Community Five</a> + </div> + <a class="item" href="javascript:void(0)">Concepts<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Books<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Book One</a> + <a class="item" href="example2.html">Book Two</a> + <a class="item" href="example2.html">Book Three</a> + <a class="item" href="example2.html">Book Four</a> + </div> + <a class="section" href="javascript:void(0)">Patterns<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Pattern One</a> + <a class="item" href="example2.html">Pattern Two</a> + <a class="item" href="example2.html">Pattern Three</a> + <a class="item" href="example2.html">Pattern Four</a> + </div> + <a class="item" href="example2.html">Concept One</a> + <a class="item" href="example2.html">Concept Two</a> + <a class="item" href="example2.html">Concept Three</a> + </div> + <a class="item" href="javascript:void(0)">Tutorials<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="javascript:void(0)">Introductory<img class="arrow" src="images/arrow1.gif" width="4" height="7" alt="" /></a> + <div class="section"> + <a class="item" href="example2.html">Introductory One</a> + <a class="item" href="example2.html">IIntroductory Two</a> + <a class="item" href="example2.html">Introductory Three</a> + <a class="item" href="example2.html">Introductory Four</a> + <a class="item" href="example2.html">Introductory Five</a> + <a class="item" href="example2.html">Introductory Six</a> + <a class="item" href="example2.html">Introductory Seven</a> + </div> + <a class="item" href="example2.html">Tutorial One</a> + <a class="item" href="example2.html">Tutorial Two</a> + <a class="item" href="example2.html">Tutorial Three</a> + <a class="item" href="example2.html">Tutorial Four</a> + <a class="item" href="example2.html">Tutorial Five</a> + <a class="item" href="example2.html">Tutorial Six</a> + <a class="item" href="example2.html">Tutorial Seven</a> + <a class="item" href="example2.html">Tutorial Eight</a> + <a class="item" href="example2.html">Tutorial Nine</a> + </div> + </div> + + <a class="button" href="javascript:void(0)">Help</a> + <div class="section"> + <a class="item" href="example2.html">About XulMenu</a> + <a class="item" href="example2.html">About this site</a> + </div> + </td> + </tr> + </table> + + </td> + <td> + <p> + <b>Project</b>: <a href="http://gosu.pl/dhtml/mygosumenu.html">mygosuMenu</a> <br /> + <b>Menu type</b>: #1.4 XulMenu example 2 <br /> + <b>Features</b>: <br /> + - horizontal or vertical menu <br /> + - unlimited nesting <br /> + - can be positioned statically or absolutely <br /> + - position of submenus can be changed, so they can for example overflow parent elements <br /> + - on the same page there can be many menus created <br /> + - seperated into 3 layers: behaviour(javascript), structure(html), presentation(css) <br /> + - search engine friendly <br /> + - free for any use (BSD license) <br /> + <b>Compatibility</b>: Tested and works great on: IE 5.0/5.5/6.0, Mozilla 1.4/1.7, Opera 7.11/7.23/7.51, Netscape 7.11, Fire... [truncated message content] |
From: <fan...@us...> - 2008-01-29 21:13:26
|
Revision: 4832 http://linpha.svn.sourceforge.net/linpha/?rev=4832&view=rev Author: fangehrn Date: 2008-01-29 13:13:19 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Property Changed: ---------------- trunk/linpha2/var/ Property changes on: trunk/linpha2/var ___________________________________________________________________ Name: svn:ignore - cache sql tmp config.dir.php lang.temp.txt + cache-* sql-* tmp-* config.dir.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |