- Timestamp:
- 06/05/08 17:18:12 (6 months ago)
- Location:
- trunk
- Files:
-
- 20 modified
-
_install.php (modified) (1 diff)
-
admin/index.php (modified) (1 diff)
-
admin/plog-admin-functions.php (modified) (12 diffs)
-
admin/plog-admin.php (modified) (1 diff)
-
admin/plog-feedback.php (modified) (1 diff)
-
admin/plog-import.php (modified) (1 diff)
-
admin/plog-manage.php (modified) (1 diff)
-
admin/plog-options.php (modified) (1 diff)
-
admin/plog-rpc.php (modified) (1 diff)
-
admin/plog-themes.php (modified) (1 diff)
-
admin/plog-thumb.php (modified) (1 diff)
-
admin/plog-thumbpopup.php (modified) (1 diff)
-
admin/plog-upload.php (modified) (1 diff)
-
gallery.php (modified) (1 diff)
-
lib/plogger/form_setup.php (modified) (1 diff)
-
lib/plogger/form_setup_complete.php (modified) (1 diff)
-
lib/plogger/install_functions.php (modified) (4 diffs)
-
plog-functions.php (modified) (14 diffs)
-
plog-globals.php (modified) (3 diffs)
-
plog-load_config.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/_install.php
r533 r546 1 1 <?php 2 error_reporting(E_ ALL);2 error_reporting(E_ERROR); 3 3 require(dirname(__FILE__) . '/plog-globals.php'); 4 4 require(PLOGGER_DIR . 'plog-functions.php'); -
trunk/admin/index.php
r536 r546 1 1 <?php 2 require_once("../plog-functions.php"); 3 require_once("../plog-globals.php"); 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 4 4 5 5 6 $output = ''; -
trunk/admin/plog-admin-functions.php
r538 r546 29 29 // Finish off the function 30 30 closedir($dir); 31 sort($tmp); 31 32 return $tmp; 32 33 } … … 35 36 function add_picture($album_id,$tmpname,$filename,$caption,$desc) { 36 37 global $config; 37 38 38 39 39 $filename_parts = explode(".",strrev($filename),2); … … 881 881 function makeDirs($strPath, $mode = 0777) //creates directory tree recursively 882 882 { 883 if (ini_get('safe_mode') ==1){883 if (ini_get('safe_mode') && function_exists('ftp_connect')){ 884 884 return is_dir($strPath) or ( makeDirs(dirname($strPath), $mode) and FTP_makeDirs($strPath) ); 885 885 }else{ … … 1170 1170 1171 1171 function plog_picture_manager($id,$from,$limit) { 1172 $output = ''; 1172 global $config; 1173 $output = ''; 1173 1174 1174 1175 plogger_init_pictures(array( … … 1177 1178 'from' => $from, 1178 1179 'limit' => $limit, 1180 'sortby' => !empty($config['default_sortby']) ? $config['default_sortby'] : 'id', 1181 'sortdir' => !empty($config['default_sortdir']) ? $config['default_sortdir'] : 'ASC' 1179 1182 )); 1180 1183 … … 1199 1202 'from' => $from, 1200 1203 'limit' => $limit, 1204 'sortby' => !empty($config['default_sortby']) ? $config['default_sortby'] : 'id', 1205 'sortdir' => !empty($config['default_sortdir']) ? $config['default_sortdir'] : 'ASC' 1201 1206 )); 1202 1207 … … 1267 1272 1268 1273 function plog_album_manager($id,$from,$limit) { 1274 global $config; 1269 1275 $output = ''; 1270 1276 … … 1274 1280 'limit' => $limit, 1275 1281 'all_albums' => 1, 1276 'sortby' =>'id',1277 'sortdir' => 'asc'1282 'sortby' => !empty($config['album_sortby']) ? $config['album_sortby'] : 'id', 1283 'sortdir' => !empty($config['album_sortdir']) ? $config['album_sortdir'] : 'ASC' 1278 1284 )); 1279 1285 … … 1298 1304 'limit' => $limit, 1299 1305 'all_albums' => 1, 1300 'sortby' =>'id',1301 'sortdir' => 'asc'1306 'sortby' => !empty($config['album_sortby']) ? $config['album_sortby'] : 'id', 1307 'sortdir' => !empty($config['album_sortdir']) ? $config['album_sortdir'] : 'ASC' 1302 1308 )); 1303 1309 … … 1344 1350 1345 1351 function plog_collection_manager($from,$limit) { 1346 $output = ''; 1352 global $config; 1353 $output = ''; 1347 1354 1348 1355 plogger_init_collections(array( … … 1350 1357 'limit' => $limit, 1351 1358 'all_collections' => 1, 1352 'sortby' =>'id',1353 'sortdir' => 'asc'1359 'sortby' => !empty($config['collection_sortby']) ? $config['collection_sortby'] : 'id', 1360 'sortdir' => !empty($config['collection_sortdir']) ? $config['collection_sortdir'] : 'ASC' 1354 1361 )); 1355 1362 … … 1373 1380 'limit' => $limit, 1374 1381 'all_collections' => 1, 1375 'sortby' =>'id',1376 'sortdir' => 'asc'1382 'sortby' => !empty($config['collection_sortby']) ? $config['collection_sortby'] : 'id', 1383 'sortdir' => !empty($config['collection_sortdir']) ? $config['collection_sortdir'] : 'ASC' 1377 1384 )); 1378 1385 -
trunk/admin/plog-admin.php
r536 r546 5 5 //session_register ("entries_per_page"); 6 6 7 require_once("../plog-load_config.php"); // load configuration variables from database 8 //require_once("../plog-functions.php");9 //require_once("../plog-globals.php"); 7 // load configuration variables from database, plog-globals, & plog-functions 8 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 9 10 10 11 11 if (isset($_REQUEST['action']) && $_REQUEST["action"] == "log_in"){ 12 12 // TODO: leiuta generic login funktsioon 13 13 14 if ( ($_REQUEST["plog-username"] == $config["admin_username"]) && (md5($_REQUEST["plog-password"]) == $config["admin_password"])){14 if ( (isset($_REQUEST["plog-username"]) && $_REQUEST["plog-username"] == $config["admin_username"]) && (isset($_REQUEST["plog-password"]) && md5($_REQUEST["plog-password"]) == $config["admin_password"]) ){ 15 15 $_SESSION["plogger_logged_in"] = true; 16 } 17 else{ 16 } else { 18 17 header("Location: index.php?errorcode=1"); 19 18 exit; 20 19 } 21 } 22 elseif(isset($_REQUEST['action']) && $_REQUEST["action"] == "log_out"){ 20 } elseif(isset($_REQUEST['action']) && $_REQUEST["action"] == "log_out") { 23 21 $_SESSION = array(); 24 22 session_destroy(); -
trunk/admin/plog-feedback.php
r536 r546 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 3 4 require("plog-admin.php"); 4 require_once("../plog-load_config.php");5 require_once("../plog-functions.php");6 5 require_once("plog-admin-functions.php"); 6 7 7 8 8 global $inHead; -
trunk/admin/plog-import.php
r539 r546 238 238 $queue_func = ""; 239 239 $keys = array(); 240 sort($files); 240 241 for($i=0; $i<count($files); $i++) { 241 242 $file_key = md5($files[$i]); -
trunk/admin/plog-manage.php
r536 r546 1 1 <?php 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 2 4 require("plog-admin.php"); 3 // load configuration variables from database4 require_once("../plog-load_config.php");5 5 require_once("plog-admin-functions.php"); 6 6 7 7 8 global $inHead; -
trunk/admin/plog-options.php
r536 r546 1 1 <?php 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 2 4 require("plog-admin.php"); 3 require_once("../plog-load_config.php");4 5 require_once("plog-admin-functions.php"); 6 5 7 6 8 $output = ''; -
trunk/admin/plog-rpc.php
r425 r546 1 1 <?php 2 require_once("plog-admin.php"); 3 require_once("../plog-load_config.php"); 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 4 require("plog-admin.php"); 4 5 require_once("plog-admin-functions.php"); 6 5 7 6 8 $action_result = array(); -
trunk/admin/plog-themes.php
r536 r546 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 3 4 require("plog-admin.php"); 4 require_once("../plog-load_config.php"); // load configuration variables from database5 5 require_once("plog-admin-functions.php"); 6 6 -
trunk/admin/plog-thumb.php
r539 r546 7 7 } 8 8 9 require_once("../plog-functions.php"); 10 require_once("../plog-globals.php"); 11 require_once("../plog-load_config.php"); 9 // load configuration variables from database, plog-globals, & plog-functions 10 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 12 11 require_once("plog-admin-functions.php"); 13 12 14 13 15 14 $files = get_files($config['basedir'] . "uploads"); 16 17 15 18 16 -
trunk/admin/plog-thumbpopup.php
r297 r546 1 <?php 2 // load configuration variables from database, plog-globals, & plog-functions 3 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 4 require("plog-admin.php"); 5 require_once("plog-admin-functions.php"); 1 6 2 <?php 3 require_once("plog-admin.php"); 4 require_once("../plog-load_config.php"); // load configuration variables from database 5 require_once("../plog-functions.php"); 7 6 8 // this script will just show a small preview of the thumbnail in admin view if 7 9 // you can't differentiate the small pics. -
trunk/admin/plog-upload.php
r536 r546 5 5 // The initial tab is UPLOAD function. 6 6 7 require_once( "../plog-load_config.php");7 require_once(dirname(dirname(__FILE__))."/plog-load_config.php"); 8 8 require("plog-admin.php"); 9 9 include("plog-admin-functions.php"); -
trunk/gallery.php
r538 r546 1 1 <?php 2 2 #error_reporting(E_ALL); 3 include_once( "plog-load_config.php");3 include_once(dirname(__FILE__)."/plog-load_config.php"); 4 4 //include("plog-globals.php"); 5 5 //include_once("plog-functions.php"); -
trunk/lib/plogger/form_setup.php
r543 r546 51 51 <?php 52 52 //if server is safe_mode enabled, prompt user for FTP info for FTP workaround 53 if (ini_get('safe_mode') ==1){?>53 if (ini_get('safe_mode') && function_exists('ftp_connect')){?> 54 54 <tr> 55 55 <td colspan="2"> 56 56 <div id="navcontainer"> 57 57 <h1>Safe_mode FTP workaround</h1> 58 <br />Safe mode has been detected on your server. FTP access is needed to allow Plogger to work correctly with safe_mode=on.58 <br />Safe mode has been detected on your server. FTP access is needed to allow Plogger to work correctly with safe_mode enabled. 59 59 </div> 60 60 </td> -
trunk/lib/plogger/form_setup_complete.php
r543 r546 12 12 <?php } ?> 13 13 <p> 14 <input type="submit" name="proceed" value="Install"/>14 <input type="submit" name="proceed" id="proceed" value="Install"/> 15 15 </p> 16 16 </form> -
trunk/lib/plogger/install_functions.php
r542 r546 56 56 } 57 57 58 if (ini_get('safe_mode') ==1) {58 if (ini_get('safe_mode') && function_exists('ftp_connect')) { 59 59 //if safe_mode enabled, check the FTP information form inputs 60 60 if (empty($form['ftp_host'])) { … … 82 82 if (empty($errors)) { 83 83 $mysql_errors = check_mysql($form['db_host'],$form['db_user'],$form['db_pass'],$form['db_name']); 84 if (ini_get('safe_mode') ==1) {84 if (ini_get('safe_mode') && function_exists('ftp_connect')) { 85 85 $ftp_errors = check_FTP($form['ftp_host'], $form['ftp_user'], $form['ftp_pass'], $form['ftp_path']); 86 86 }else{ … … 104 104 ); 105 105 106 if (ini_get('safe_mode') ==1) {106 if (ini_get('safe_mode') && function_exists('ftp_connect')) { 107 107 $conf = create_config_file($form['db_host'],$form['db_user'],$form['db_pass'],$form['db_name'],$form['ftp_host'],$form['ftp_user'],$form['ftp_pass'],$form['ftp_path']); 108 108 } else { … … 366 366 $cfg_file .= '// define("PLOGGER_EMBEDDED",""); // 1/0 (True/False) if set will overrule automatic check'."\n"; 367 367 $cfg_file .= '// define("PLOGGER_LOCALE",""); // da_DK de et fr pl ro_RO tr ...etc.'."\n"; 368 if (ini_get('safe_mode') ==1&& !empty($ftp_host)) {368 if (ini_get('safe_mode') && function_exists('ftp_connect') && !empty($ftp_host)) { 369 369 //if safe_mode enabled, write the FTP workaround information to plog-config.php with db information 370 370 $cfg_file .= "\n"; -
trunk/plog-functions.php
r538 r546 1075 1075 $result = run_query($query); 1076 1076 $row = mysql_fetch_assoc($result); 1077 $rv = $config["baseurl"].rawurlencode(SmartStripSlashes($row["path"])) ;1077 $rv = $config["baseurl"].rawurlencode(SmartStripSlashes($row["path"]))."/"; 1078 1078 } else if ($level == "album") { 1079 1079 $query = "SELECT … … 1086 1086 $row = mysql_fetch_assoc($result); 1087 1087 1088 $rv = $config["baseurl"].rawurlencode(SmartStripSlashes($row["collection_path"])) . '/' . rawurlencode(SmartStripSlashes($row["album_path"])) ;1088 $rv = $config["baseurl"].rawurlencode(SmartStripSlashes($row["collection_path"])) . '/' . rawurlencode(SmartStripSlashes($row["album_path"]))."/"; 1089 1089 1090 1090 // I need to give additional arguments to the url-s 1091 1091 if (sizeof($arg) > 0) { 1092 1092 foreach($arg as $aval) { 1093 $rv .= "/".$aval;1093 $rv .= $aval."/"; 1094 1094 } 1095 1095 } … … 1097 1097 $pic = get_picture_by_id($id); 1098 1098 $album = $pic["parent_album"]; 1099 $rv = $config["baseurl"].str_replace("%2F", "/", rawurlencode(substr(SmartStripSlashes($pic['path']), 0, -4))) ;1099 $rv = $config["baseurl"].str_replace("%2F", "/", rawurlencode(substr(SmartStripSlashes($pic['path']), 0, -4)))."/"; 1100 1100 } 1101 1101 } else { … … 1322 1322 1323 1323 // determine sort ordering 1324 switch ($_SESSION[ "plogger_sortby"]){1324 switch ($_SESSION['plogger_sortby']){ 1325 1325 case 'number_of_comments': 1326 1326 $sql = "SELECT … … 1343 1343 break; 1344 1344 case 'date': 1345 $sql .= " ORDER BY `date_submitted` "; 1346 break; 1345 1347 default: 1346 $sql .= " ORDER BY ` date_submitted` ";1348 $sql .= " ORDER BY `id` "; 1347 1349 break; 1348 1350 } … … 1357 1359 break; 1358 1360 } 1361 1362 // if sorting by number_of_comments, we sub-sort by 'id' DESC 1363 if ($_SESSION['plogger_sortby']=="number_of_comments"){ 1364 $sql .= ",`p`.`id` DESC"; 1365 } 1359 1366 1360 1367 $result = run_query($sql); … … 1401 1408 1402 1409 function plogger_init_pictures($arr) { 1403 $sql = " 1404 FROM `".TABLE_PREFIX."pictures` `p` 1405 LEFT JOIN `".TABLE_PREFIX."comments` `c` ON `p`.`id`=`c`.`parent_id`"; 1406 1407 $type = $arr['type']; 1410 $sql = " FROM `".TABLE_PREFIX."pictures` AS `p`"; 1411 1412 // if sorting by number_of_comments, we need to join the comments table 1413 if (isset($arr['sortby']) && $arr['sortby']=="number_of_comments"){ 1414 $sql .= " LEFT JOIN `".TABLE_PREFIX."comments` AS `c` ON `p`.`id`=`c`.`parent_id`"; 1415 } 1408 1416 1409 1417 // right now only single id is supported, maybe I want to specify multiple id-s as well 1410 1418 $value = (isset($arr['value']) && $arr['value'] > 0) ? $arr['value'] : -1; 1411 1419 1412 if ('collection' == $type) { 1413 $sql .= " WHERE p.`parent_collection` = ".$value; 1414 } elseif ('id' == $type) { 1415 $sql .= " WHERE p.`id` = ".$value; 1416 } elseif ('album' == $type) { 1417 $sql .= " WHERE p.`parent_album` = ".$value; 1418 } elseif ('latest' == $type) { 1419 // add nothing, only limit takes effect 1420 } else { 1421 // so what do you want anyway? 1422 return 0; 1423 } 1424 1425 $from = 0; 1426 $limit = 20; // Default limit if nothing is set 1427 $max_limit = 1000; // Hard-coded max limit, no matter what you do you cannot 1428 // go beyond this limit for number of pictures in thumbnails, 1429 // slideshow etc. 1430 1431 if (isset($arr["from"]) && $arr["from"] > 0) { 1432 $from = $arr["from"]; 1433 } 1434 1435 // Enforce hard-coded max limit if the provided limit is extreme 1436 if (isset($arr['limit']) && $arr['limit'] > 0 && $arr['limit'] <= $max_limit) { 1437 $limit = $arr['limit']; 1438 } elseif (isset($arr['limit']) && $arr['limit'] == -1) { 1439 $limit = -1; // Set to -1 for slideshow, so limit will not be used 1440 } 1441 1420 switch ($arr['type']) { 1421 case 'collection': 1422 $sql .= " WHERE `p`.`parent_collection` = ".$value; 1423 break; 1424 case 'album': 1425 $sql .= " WHERE `p`.`parent_album` = ".$value; 1426 break; 1427 case 'id': 1428 $sql .= " WHERE `p`.`id` = ".$value; 1429 break; 1430 case 'latest': 1431 break; 1432 default: 1433 return 0; 1434 } 1435 1442 1436 $result = run_query("SELECT COUNT(DISTINCT p.`id`) AS cnt " . $sql); 1443 1437 $row = mysql_fetch_assoc($result); 1444 1438 1445 1439 $GLOBALS["total_pictures"] = $row["cnt"]; 1446 1447 // grouping is needed to get comment count 1448 $sql .= " GROUP BY p.`id`"; 1440 1441 1442 // if sorting by number_of_comments, we need group and count the results 1443 if (isset($arr['sortby']) && $arr['sortby']=="number_of_comments"){ 1444 $sql = ",COUNT(`comment`) AS `num_comments` ".$sql." GROUP BY `p`.`id`"; 1445 } 1446 1449 1447 1450 1448 // query database and retreive all pictures withing selected album … … 1456 1454 'filename' => 'path', 1457 1455 'date' => 'date_submitted', 1458 'id' => 'id' ,1456 'id' => 'id' 1459 1457 ); 1460 1458 … … 1462 1460 $sortby = $arr['sortby']; 1463 1461 } else { 1464 $sortby = 'date'; // Default sort, is to sort by date1462 $sortby = "id"; // Default sort, is to sort by id 1465 1463 } 1466 1464 1467 1465 $sortby = $sort_fields[$sortby]; 1468 $sql .= " ORDER BY `$sortby` "; 1469 1470 if (isset($arr['sortdir']) && (strcasecmp('asc',$arr['sortdir']) === 0)) { 1471 $sortdir = ' ASC'; 1472 } else { 1473 $sortdir = ' DESC'; // Default sort direction is descending 1466 $sql .= " ORDER BY `".$sortby."`"; 1467 1468 // determine sort direction 1469 if (isset($arr['sortdir']) && (strtoupper($arr['sortdir']) == 'ASC')) { 1470 $sortdir = " ASC"; 1471 } else { 1472 $sortdir = " DESC"; // Default sort direction is descending 1474 1473 } 1475 1476 1474 $sql .= $sortdir; 1477 1478 // again, this is needed because of the comment counting 1479 $sql .= ",p.`id` DESC "; 1480 1475 1476 1477 // if sorting by number_of_comments, we sub-sort by 'id' DESC 1478 if (isset($arr['sortby']) && $arr['sortby']=="number_of_comments"){ 1479 $sql .= ",`p`.`id` DESC"; 1480 } 1481 1482 1483 // set up limits, if needed 1484 $from = 0; 1485 $limit = 20; // Default limit if nothing is set 1486 $max_limit = 1000; // Hard-coded max limit, no matter what you do you cannot 1487 // go beyond this limit for number of pictures in thumbnails, 1488 // slideshow etc. 1489 1490 if (isset($arr['from']) && $arr['from'] > 0) { 1491 $from = $arr['from']; 1492 } 1493 1494 // Enforce hard-coded max limit if the provided limit is extreme 1495 if (isset($arr['limit']) && $arr['limit'] > 0 && $arr['limit'] <= $max_limit) { 1496 $limit = $arr['limit']; 1497 } elseif (isset($arr['limit']) && $arr['limit'] == -1) { 1498 $limit = -1; // Set to -1 for slideshow, so limit will not be used 1499 } 1500 1481 1501 if (($from >= 0) && ($limit >= 0)) $sq
