[Linpha-cvs] SF.net SVN: linpha: [4485] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-07 19:49:55
|
Revision: 4485 Author: fangehrn Date: 2006-04-07 12:49:35 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4485&view=rev Log Message: ----------- fixed some notices in installer Modified Paths: -------------- trunk/linpha2/docs/TODO.txt trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/reset_database.php Modified: trunk/linpha2/docs/TODO.txt =================================================================== --- trunk/linpha2/docs/TODO.txt 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/docs/TODO.txt 2006-04-07 19:49:35 UTC (rev 4485) @@ -8,17 +8,31 @@ Currently the no-javscript site is loaded with a javascript location.href to the javascript enabled site -> High Pageload, LinSysLog doesnt work +- define installer behaviour + - if installation is complete, the user must delete the install/ folder ? + - user have to delete var/sql/config.sql.php before another installation can continue ? + -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) + -> should we really delete the content of the cache folders? what if the user specify wrongly the album folder as the cache folder...?? ## Big Todos - get_image.php (Image View, Image Cache) -- Slideshow (copy from linpha1) - Search (copy from linpha1) - Basket (finish) - Support for the Icons -- IPTC Image fields - - Write IPTC entries (see also https://sourceforge.net/forum/message.php?msg_id=3648731) +- use lightbox + http://www.huddletogether.com/projects/lightbox2/ + +- IPTC/XMP Image fields + - Read XMP entries + - Write IPTC/XMP entries + - UTF-8 support + - see also + https://sourceforge.net/forum/message.php?msg_id=3648731) + and + https://sourceforge.net/forum/message.php?msg_id=3674100 + - Videos - Video thumbnail (what about ffmpeg?) - switch between quicktime and mplayer? Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -57,8 +57,8 @@ /** * groups */ -$sql_queries[] = "INSERT INTO ".PREFIX."groups (name) VALUES ('group1')"; -$sql_queries[] = "INSERT INTO ".PREFIX."groups (name) VALUES ('group2')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('group1')"; +$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('group2')"; /** * permissions Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -42,9 +42,15 @@ ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". "id INT NOT NULL AUTO_INCREMENT, " . - "name VARCHAR(100) NOT NULL default '', " . + "group_name VARCHAR(255) NOT NULL default '', " . "PRIMARY KEY (id) " . ")", + "CREATE TABLE ".$linpha_tables['user_group']." ( ". + "id INT NOT NULL AUTO_INCREMENT, " . + "group_id INT NOT NULL, " . + "user_id INT NOT NULL, " . + "PRIMARY KEY (id) " . + ")", "CREATE TABLE ".$linpha_tables['permissions']." ( ". "id INT NOT NULL AUTO_INCREMENT, " . "photos_id INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/sql/sql.tables.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -25,6 +25,7 @@ "config" => "config", "users" => "users", "groups" => "groups", + "user_group" => "user_group", "permissions" => "permissions", "photos" => "photos", "meta_fields" => "meta_fields", Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step10_postsettings.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -30,7 +30,7 @@ /** * now, it is too late to go back... */ -if($_SESSION['install_mode'] =="manual") +if(isset($_SESSION['install_mode']) && $_SESSION['install_mode'] =="manual") { $back_file = "manual_install.php"; $show_back_button = true; Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -49,7 +49,7 @@ * sqlite doesn't know anyhting about username, password, hostname and * databasename -> skip the following pages */ - if($_SESSION['sql_dbtype'] == "sqlite") + if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") { $_SESSION['sql_username'] = ''; $_SESSION['sql_password'] = ''; Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -27,6 +27,27 @@ include_once(LINPHA_DIR.'/install/header.php'); /** + * validate settings + */ +if(!isset($_POST['album_dir']) OR empty($_POST['album_dir']) OR + !isset($_POST['sql_dir']) OR empty($_POST['sql_dir']) OR + !isset($_POST['cache_dir']) OR empty($_POST['cache_dir']) OR + !isset($_POST['tmp_dir']) OR empty($_POST['tmp_dir']) ) +{ + include_once(LINPHA_DIR.'/install/header_html.php'); + + echo tr("Validating Information")."... "; + echo failed_msg(); + echo "<br />".tr("Please Fill In All Fields").""; + + echo "</form>"; + $show_next_button = false; + + include_once(LINPHA_DIR.'/install/footer.php'); + exit(); +} + +/** * save settings from previous page */ $array = array('album', 'sql','cache','tmp'); @@ -71,7 +92,7 @@ /** * goto manual mode */ - if($_SESSION['install_mode'] == "manual") + if(isset($_SESSION['install_mode']) && $_SESSION['install_mode'] =="manual") { header("Location: manual_install.php"); exit(); Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/install/step7_selectprefix.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -30,7 +30,7 @@ /** * sqlite go back stuff */ -if($_SESSION['sql_dbtype'] == "sqlite") +if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") { $back_file = "step4_selectdirectories.php"; } Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -225,64 +225,4 @@ return $str; } -/** -* Set autologin-cookie -* -* can only be set once per request -* must be set before a header is already sent -* -* @uses LinSql::startSession -*/ -function set_linpha_cookie($userid, $md5pw) -{ - /** - * calculate correct path for cookie - * needs always to be the linpha root folder - * for example: http://localhost/linpha/index.php -> must be /linpha/ - */ - /** - * get directory and append needed ending slash - */ - $php_self_dir = dirname($_SERVER['PHP_SELF']); - $php_self_dir .= '/'; - - if(LINPHA_DIR != '.') - { - if(LINPHA_DIR == '..') - { - $num = 1; - } - else - { - $num = 1 + substr_count(TOP_DIR, '/'); - } - - /** - * remove directories - */ - for( ; $num > 0 ; $num--) - { - /** - * remove last slash - */ - $php_self_dir = substr($php_self_dir,0,strlen($php_self_dir)-1); - - /** - * get last slash - */ - $pos = strrpos($php_self_dir,'/'); - - /** - * remove last directory - */ - $php_self_dir = substr($php_self_dir,0,$pos+1); - } - } - - /** - * set the cookie - */ - setcookie("linpha_userid", $userid, (time() + 60 * 60 * 24 * 31), $php_self_dir); - setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); -} ?> Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -165,7 +165,7 @@ } session_start(); - + /** * read cookie */ @@ -182,17 +182,7 @@ //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); linSysLog(i18n("Successfully Logged In!<br />")); - /** - * store user stuff - */ - $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; - $_SESSION['user_name'] = $data['username']; - $_SESSION['user_id'] = $_COOKIE["linpha_userid"]; - - /** - * Store users display name. If display name is blank - store username. - */ - $_SESSION['user_displayname'] = (empty($data['display_name'])) ? $_SESSION['user_name'] : $data['display_name']; + $this->setUserInformation($data['username'],$_COOKIE["linpha_userid"],$data['display_name']); } else // wrong cookie { @@ -245,20 +235,10 @@ //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); linSysLog(i18n("Successfully Logged In!<br />")); - /** - * store user stuff - */ - $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; - $_SESSION['user_name'] = $_POST['username']; - $_SESSION['user_id'] = $data['id']; + $this->setUserInformation($_POST['username'],$data['id'],$data['display_name']); - /** - * Store users display name. If display name is blank - store username. - */ - $_SESSION['user_displayname'] = (empty($data['display_name'])) ? $_SESSION['user_name'] : $data['display_name']; - if(isset($_POST['rememberme'])) { - set_linpha_cookie($data['id'], md5($_POST['password'])); + $this->setLinphaCookie($data['id'], md5($_POST['password'])); } /** @@ -318,13 +298,31 @@ } } // end function startSession +/** + * set user infos after correct login + */ +function setUserInformation($username,$userid,$displayname) +{ + /** + * store user stuff + */ + $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; + $_SESSION['user_name'] = $username; + $_SESSION['user_id'] = $userid; + + /** + * Store users display name. If display name is blank - store username. + */ + $_SESSION['user_displayname'] = (empty($displayname)) ? $_SESSION['user_name'] : $displayname; +} + + /** * permission stuff */ - /** * get permission string from photo id * @@ -419,11 +417,13 @@ return false; } + + + /** * other stuff */ - /** * add slashes for sql data * @@ -520,6 +520,67 @@ return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; } +/** +* Set autologin-cookie +* +* can only be set once per request +* must be set before a header is already sent +* +* @uses LinSql::startSession +*/ +function setLinphaCookie($userid, $md5pw) +{ + /** + * calculate correct path for cookie + * needs always to be the linpha root folder + * for example: http://localhost/linpha/index.php -> must be /linpha/ + */ + /** + * get directory and append needed ending slash + */ + $php_self_dir = dirname($_SERVER['PHP_SELF']); + $php_self_dir .= '/'; + + if(LINPHA_DIR != '.') + { + if(LINPHA_DIR == '..') + { + $num = 1; + } + else + { + $num = 1 + substr_count(TOP_DIR, '/'); + } + + /** + * remove directories + */ + for( ; $num > 0 ; $num--) + { + /** + * remove last slash + */ + $php_self_dir = substr($php_self_dir,0,strlen($php_self_dir)-1); + + /** + * get last slash + */ + $pos = strrpos($php_self_dir,'/'); + + /** + * remove last directory + */ + $php_self_dir = substr($php_self_dir,0,$pos+1); + } + } + + /** + * set the cookie + */ + setcookie("linpha_userid", $userid, (time() + 60 * 60 * 24 * 31), $php_self_dir); + setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); +} + } // end class linSql Modified: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php 2006-04-06 21:37:14 UTC (rev 4484) +++ trunk/linpha2/reset_database.php 2006-04-07 19:49:35 UTC (rev 4485) @@ -3,8 +3,9 @@ include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new linpha(); -$linpha->sql->startSession(); +$linpha->sql->dbConnect(); + $_SESSION['sys_im_bracket_support'] = $GLOBALS['linpha']->sql->config->value['sys_im_bracket_support']; $_SESSION['sys_im_use_convert'] = $GLOBALS['linpha']->sql->config->value['sys_im_use_convert']; $_SESSION['sys_im_convert_path'] = $GLOBALS['linpha']->sql->config->value['sys_im_convert_path']; @@ -14,32 +15,96 @@ $_SESSION['tmp_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; +/** + * create tables + */ + /** + * get table names and add prefix + */ + include_once(LINPHA_DIR.'/install/sql/sql.tables.php'); + foreach($linpha_tables AS $key=>$value) + { + $linpha_tables[$key] = PREFIX.$value; + } + + /** + * drop tables + */ + echo tr("Drop tables")."... "; + while( list($key,$value) = each($linpha_tables) ) + { + $result = @$linpha->db->Execute("DROP TABLE ".$value); + if(!$result) + { + echo failed_msg(); + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } + } + if(!isset($error_nr)) + { + echo success_msg(); + unset($error_nr); + } -echo "<br /><br />".tr("Truncate Table Data")."... "; -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."config"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."groups"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_category"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_comments"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_data"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_exif"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_fields"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_iptc"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."permissions"); -$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."photos"); + + /** + * include sql strings + */ + include_once(LINPHA_DIR."/install/sql/sql.".DB_TYPE.".php"); + + /** + * finally create tables + */ + echo tr("Creating Tables")."... "; + + $translation_array = array_keys($linpha_tables); // only used in error case + while( list($key,$query) = each($sql_tables) ) + { + $result = $linpha->db->Execute($query); + if(!$result) + { + echo PREFIX.$translation_array[$key].' '; + echo failed_msg(); + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } + } + if(!isset($error_nr)) + { + echo success_msg(); + unset($error_nr); + } -echo "<br /><br />".tr("Inserting Table Data")."... "; -include_once(LINPHA_DIR.'/install/sql/sql.data.php'); -foreach($sql_queries AS $value) -{ - $result = $linpha->db->Execute($value); - if(!$result) + +/** + * insert data + */ + echo "<br /><br />".tr("Inserting Table Data")."... "; + include_once(LINPHA_DIR.'/install/sql/sql.data.php'); + foreach($sql_queries AS $value) { - echo failed_msg(); - echo $value; - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; + $result = $linpha->db->Execute($value); + if(!$result) + { + echo failed_msg(); + echo $value; + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } } -} + if(!isset($error_nr)) + { + echo success_msg(); + unset($error_nr); + } + + + + + + + function failed_msg() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |