- Timestamp:
- 05/08/08 17:44:19 (7 months ago)
- Location:
- trunk
- Files:
-
- 13 modified
-
admin/index.php (modified) (1 diff)
-
admin/plog-admin-functions.php (modified) (19 diffs)
-
admin/plog-admin.php (modified) (1 diff)
-
admin/plog-feedback.php (modified) (4 diffs)
-
admin/plog-import.php (modified) (4 diffs)
-
admin/plog-manage.php (modified) (2 diffs)
-
admin/plog-options.php (modified) (1 diff)
-
admin/plog-themes.php (modified) (4 diffs)
-
admin/plog-upload.php (modified) (3 diffs)
-
plog-comment.php (modified) (1 diff)
-
plog-functions.php (modified) (7 diffs)
-
plog-print.php (modified) (2 diffs)
-
plog-rss.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/index.php
r519 r536 1 1 <?php 2 3 session_start();4 5 2 require_once("../plog-functions.php"); 6 3 require_once("../plog-globals.php"); -
trunk/admin/plog-admin-functions.php
r532 r536 71 71 $create_path = $dest_collection_name."/".$dest_album_name; 72 72 73 while (is_file($config['basedir'].'images/'.$create_path."/".$unique_filename_base . "." .$filename_ext)){74 $unique_filename_base = $filename_base ." (" . ++$i .")";73 while (is_file($config['basedir'].'images/'.$create_path."/".$unique_filename_base.".".$filename_ext)){ 74 $unique_filename_base = SmartStripSlashes($filename_base)." (" . ++$i .")"; 75 75 } 76 76 … … 190 190 191 191 $picture_id = intval($picture_id); 192 $value = mysql_real_escape_string( $value);192 $value = mysql_real_escape_string(trim($value)); 193 193 194 194 $query = "UPDATE ".TABLE_PREFIX."pictures SET $field = '$value' WHERE id='$picture_id'"; … … 263 263 264 264 // make sure that the file is actually located inside our images directory 265 $full_path = realpath($config['basedir'] . 'images/' . $picture['path']);265 $full_path = realpath($config['basedir'] . 'images/' . SmartStripSlashes($picture['path'])); 266 266 // also check whether this image is in the correct folder 267 267 $relative_path = substr($full_path,0,strlen($config['basedir'])); 268 $basename = basename($picture['path']);268 $basename = SmartStripSlashes(basename($picture['path'])); 269 269 if ($relative_path == $config['basedir']) { 270 270 foreach($thumbnail_config as $tkey => $tval) { … … 349 349 }; 350 350 351 $target_name = strtolower(sanitize_filename( SmartStripSlashes($name)));351 $target_name = strtolower(sanitize_filename($name)); 352 352 353 353 … … 408 408 while($row = mysql_fetch_assoc($result)) { 409 409 410 $filename = basename( SmartStripSlashes($row['path']));410 $filename = basename($row['path']); 411 411 $album_path = $row['album_path']; 412 412 … … 433 433 434 434 $collection_id = intval($collection_id); 435 $value = mysql_real_escape_string( $value);435 $value = mysql_real_escape_string(trim($value)); 436 436 437 437 $query = "UPDATE ".TABLE_PREFIX."collections SET $field = '$value' WHERE id='$collection_id'"; … … 473 473 // if there are then .. how did they get there? Probably not through plogger and in this case do we 474 474 // really want to delete those? 475 $source_collection_name = $collection["collection_path"];475 $source_collection_name = SmartStripSlashes($collection["collection_path"]); 476 476 477 477 $collection_directory = realpath($config['basedir'] . 'images/'.$source_collection_name); … … 512 512 }; 513 513 514 $album_folder = strtolower(sanitize_filename( SmartStripSlashes($album_name)));514 $album_folder = strtolower(sanitize_filename($album_name)); 515 515 516 516 // first try to create the directory to hold the images, if that fails, then the album 517 517 // will be unusable anyway 518 $create_path = $config["basedir"] . "images/". $row["collection_path"]."/".$album_folder;518 $create_path = $config["basedir"] . "images/".SmartStripSlashes($row["collection_path"])."/".$album_folder; 519 519 520 520 if (!makeDirs($create_path, 0777)) { … … 605 605 606 606 $filename = basename($row['path']); 607 $new_path = $source_collection_name."/".$target_name."/".$filename;607 $new_path = mysql_real_escape_string(SmartStripSlashes($source_collection_name."/".$target_name."/".$filename)); 608 608 609 609 // update database … … 624 624 }; 625 625 626 $value = mysql_real_escape_string( SmartStripSlashes($value));626 $value = mysql_real_escape_string(trim(SmartStripSlashes($value))); 627 627 $errors = $output = ""; 628 628 $album_id = intval($album_id); … … 690 690 691 691 while($row = mysql_fetch_assoc($result)) { 692 $filename = basename($row['path']);692 $filename = SmartStripSlashes(basename($row['path'])); 693 693 694 694 $old_path = $source_path."/".$filename; … … 741 741 // if there are then .. how did they get there? Probably not through plogger and in this case do we 742 742 // really want to delete those? 743 $source_album_name = $album["album_path"];744 $source_collection_name = $album["collection_path"];743 $source_album_name = SmartStripSlashes($album["album_path"]); 744 $source_collection_name = SmartStripSlashes($album["collection_path"]); 745 745 746 746 $album_directory = realpath($config['basedir'] . 'images/'.$source_collection_name."/".$source_album_name); … … 748 748 $album_path = explode('/',substr($album_directory,strlen($config['basedir']))); 749 749 // it needs to have 3 parts - images, collection name and album name, if it doesn't, then there is something 750 // wrong with either collectio or album name and it's probably not safe to try to delete the directory750 // wrong with either collection or album name and it's probably not safe to try to delete the directory 751 751 if ($relative_path == $config['basedir'] && sizeof($album_path) == 3) { 752 752 @chmod($album_directory,0777); … … 769 769 $email = mysql_real_escape_string($email); 770 770 $url = mysql_real_escape_string($url); 771 $comment = mysql_real_escape_string( $comment);771 $comment = mysql_real_escape_string(trim($comment)); 772 772 773 773 $query = "UPDATE ".TABLE_PREFIX."comments SET author = '$author', comment = '$comment', … … 1135 1135 $auto_graphic = "../graphics/auto.gif"; 1136 1136 1137 $output .= '<form class="edit" action="'.$_SERVER["PHP_SELF"].'?level=albums&id='.$album["parent_id"].'" method="post">';1137 $output = '<form class="edit" action="'.$_SERVER["PHP_SELF"].'?level=albums&id='.$album["parent_id"].'" method="post">'; 1138 1138 1139 1139 $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url('.$auto_graphic.'); … … 1170 1170 1171 1171 function plog_picture_manager($id,$from,$limit) { 1172 $output = ''; 1172 1173 1173 1174 plogger_init_pictures(array( … … 1266 1267 1267 1268 function plog_album_manager($id,$from,$limit) { 1268 1269 $output = ''; 1269 1270 1270 1271 plogger_init_albums(array( … … 1343 1344 1344 1345 function plog_collection_manager($from,$limit) { 1346 $output = ''; 1345 1347 1346 1348 plogger_init_collections(array( … … 1412 1414 1413 1415 function plog_comment_manager($id,$from,$limit) { 1416 $output = ''; 1414 1417 1415 1418 plogger_init_picture(array( -
trunk/admin/plog-admin.php
r520 r536 1 1 <?php 2 3 //session_start();4 2 header("Content-Type: text/html; charset=utf-8"); 5 3 global $inHead; -
trunk/admin/plog-feedback.php
r509 r536 16 16 17 17 $possible_values = array("5"=>5, "10"=>10, "20"=>20, "50"=>50); 18 $output = plog_tr('Entries per page') . ' <select onchange="'.$java.'" name="entries_per_page">';18 $output = plog_tr('Entries per page') . ' <select onchange="'.$java.'" name="entries_per_page">'; 19 19 20 20 foreach ($possible_values as $key => $value) … … 37 37 38 38 // perform the delete function on the selected items 39 if (isset($_REQUEST['delete_checked']) || $_REQUEST['action'] == 'delete_checked') {39 if (isset($_REQUEST['delete_checked']) || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete_checked')) { 40 40 41 41 if (isset($_REQUEST["Selected"])) { … … 57 57 }; 58 58 59 if (isset($_REQUEST['approve_checked']) || $_REQUEST['action'] == 'approve_checked') {59 if (isset($_REQUEST['approve_checked']) || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'approve_checked')) { 60 60 // set the approval bit to 1 for all selected comments 61 61 … … 236 236 else { 237 237 if (in_array($key, $allowedCommentKeys)) 238 $output .= "<td><p id=\"comment-$key-" . $row[ id] ."\">$value </p></td>";238 $output .= "<td><p id=\"comment-$key-" . $row['id'] ."\">$value </p></td>"; 239 239 } 240 240 } -
trunk/admin/plog-import.php
r445 r536 51 51 52 52 $output = ''; 53 $counter = $imported = 0; 53 54 54 55 // Check if update has been clicked, handle erroneous conditions, or upload 55 56 //print_r($_POST); 56 57 57 if (isset($_POST["upload"])){ 58 59 $destinations = $_POST["destinations"]; 60 $captions = $_POST["captions"]; 61 $descriptions = $_POST["descriptions"]; 62 $files = $_POST["files"]; 63 $selected = $_POST["Selected"]; 64 65 $counter = $imported = 0; 58 if (isset($_POST['upload'])){ 59 60 $destinations = isset($_POST['destinations']) ? $_POST['destinations'] : ''; 61 $captions = $_POST['captions']; 62 $descriptions = $_POST['descriptions']; 63 $files = $_POST['files']; 64 $selected = $_POST['Selected']; 66 65 67 66 global $config; … … 69 68 $files = get_files($config['basedir'] . 'uploads'); 70 69 71 if ($_POST[ "destination_radio"] == "new" && $_POST["new_album_name"] == ""){70 if ($_POST['destination_radio'] == "new" && $_POST["new_album_name"] == ""){ 72 71 $output .= '<p class="errors">' . plog_tr('New album name not specified!') . '</p>'; 73 72 } … … 145 144 $directories[md5($dirname)] = $dirname; 146 145 } 147 148 // here we will check which group of pictures we are editing, grouped by directory146 147 // here we will check which group of pictures we are editing, grouped by directory 149 148 if (count($directories) > 0) { 150 149 $output .= '<div class="actions">' . plog_tr('Would you like to import anything else?'); … … 155 154 $output .= '<li><a class="folder" href="'.$_SERVER['PHP_SELF']."?directory=$dirkey".'">'.basename($group).'</a></li>'; 156 155 } 157 156 157 $upload_directory = $config['basedir'] . 'uploads'; 158 158 $dirkey = md5($upload_directory); 159 159 $output .= '<li><a class="folder" href="'.$_SERVER['PHP_SELF']."?directory=$dirkey".'">' . plog_tr('All Pictures') . '</a></li>'; -
trunk/admin/plog-manage.php
r509 r536 30 30 31 31 function generate_move_menu($level) { 32 33 32 if ($level == "albums") $parent = "collections"; 34 33 if ($level == "pictures") $parent = "albums"; 35 $output .='<input class="submit" type="submit" name="move_checked" value="' . plog_tr("Move Checked To") . '"/>';34 $output = '<input class="submit" type="submit" name="move_checked" value="' . plog_tr("Move Checked To") . '"/>'; 36 35 37 36 if ($level == "pictures") { … … 52 51 53 52 function generate_albums_menu($albums) { 54 $output .='<select name="group_id">';53 $output = '<select name="group_id">'; 55 54 foreach($albums as $album_id => $album) { 56 if ($_REQUEST["albums_menu"] == $album_id || $_REQUEST["new_album_name"] == $album['album_name']) 57 $selected = " selected"; else $selected = ""; 55 $selected = ''; 56 // if we are on the current album then set it to be the default option 57 if (isset($_REQUEST["albums_menu"]) && isset($_REQUEST["new_album_name"])){ 58 if ($albums_menu == $album_id || $new_album_name == $album['album_name']){ 59 $selected = " selected"; 60 } 61 } 58 62 59 63 $output .= "<option value=\"".$album_id."\"$selected>".SmartStripSlashes($album['collection_name'])." : ".SmartStripSlashes($album['album_name'])."" ; -
trunk/admin/plog-options.php
r530 r536 42 42 `use_mod_rewrite`='".intval(@$_POST["use_mod_rewrite"])."', 43 43 `square_thumbs`='".intval($square_thumbs)."', 44 `comments_notify`='".intval( $_POST["comments_notify"])."',44 `comments_notify`='".intval(@$_POST["comments_notify"])."', 45 45 `comments_moderate`='".intval($comments_moderate)."', 46 46 `gallery_url`='".mysql_real_escape_string($_POST["gallery_url"])."', -
trunk/admin/plog-themes.php
r491 r536 28 28 $inHead = '<script type="text/javascript" src="js/plogger.js"></script>'; 29 29 30 $output .= "<h1>" . plog_tr("Manage Themes") . "</h1>";30 $output = "<h1>" . plog_tr("Manage Themes") . "</h1>"; 31 31 32 $output.= "<p>$theme_url</p>"; 32 // what is this? 33 //$output.= "<p>$theme_url</p>"; 33 34 34 $theme_dir = $config[ "basedir"] . 'themes/';35 $theme_dir = $config['basedir'] . 'themes/'; 35 36 36 37 // scan list of folders within theme directory 37 38 $theme_list = read_dir($theme_dir); 38 39 39 if ( $_REQUEST["activate"]) { // activate new theme by setting configuration dir40 if (isset($_REQUEST['activate'])) { // activate new theme by setting configuration dir 40 41 // insert into database 41 42 $new_theme_dir = basename($_REQUEST["activate"]); … … 49 50 } else { 50 51 $output .= '<p class="errors">' . plog_tr("Error Activating Theme!") . '</p>'; 51 } ;52 } 52 53 53 54 // update config variable if page doesn't refresh … … 55 56 } else { 56 57 $output .= '<p class="errors">' . plog_tr("No such theme") . '</p>'; 57 } ;58 } 58 59 } 59 60 60 61 // Output table header 61 $output .= '<table id="theme-table" cellpadding="5" width="100%"><tr class="header"><td class="table-header-left">Theme</td><td class="table-header-middle">Description</td><td class="table-header-middle">Author</td><td class="table-header-right"> </td></tr>';62 $output .= '<table id="theme-table" cellpadding="5" width="100%"><tr class="header"><td class="table-header-left">Theme</td><td class="table-header-middle">Description</td><td class="table-header-middle">Author</td><td class="table-header-right"> </td></tr>'; 62 63 $counter = 0; 63 64 … … 90 91 $output .= "<td>" .plog_tr("Active Theme") . "</td>"; 91 92 else 92 $output .= "<td><a href=\"${_SERVER[PHP_SELF]}?activate=$theme_folder_basename\">" . plog_tr('Activate') . "</a></td>"; 93 94 93 $output .= "<td><a href=\"${_SERVER['PHP_SELF']}?activate=$theme_folder_basename\">" . plog_tr('Activate') . "</a></td>"; 94 95 95 $output .= "</tr>"; 96 96 -
trunk/admin/plog-upload.php
r530 r536 10 10 11 11 function generate_albums_menu($albums) { 12 $albums_menu = isset($_REQUEST['albums_menu']) ? $_REQUEST['albums_menu'] : ''; 13 $new_album_name = isset($_REQUEST['new_album_name']) ? $_REQUEST['new_album_name'] : ''; 12 14 $output = '<select name="albums_menu" onclick="var k=document.getElementsByName(\'destination_radio\');k[0].checked=true;">'; 13 15 foreach($albums as $album_id => $album) { 14 16 15 if ($ _REQUEST["albums_menu"] == $album_id || $_REQUEST["new_album_name"]== $album['album_name'])17 if ($albums_menu == $album_id || $new_album_name == $album['album_name']) 16 18 $selected = " selected='selected'"; else $selected = ""; 17 19 … … 38 40 } 39 41 42 $output = ''; 43 40 44 // Check if update has been clicked, handle erroneous conditions, or upload 41 if (isset($_REQUEST[ "upload"])){45 if (isset($_REQUEST['upload'])){ 42 46 foreach($_REQUEST as $key => $val) $_REQUEST[$key] = stripslashes($val); 43 47 … … 175 179 else 176 180 display($output_error, "upload"); 177 } ;181 } 178 182 ?> -
trunk/plog-comment.php
r509 r536 53 53 54 54 // redirect back to picture page 55 if ( $rv["errors"]) {55 if (isset($rv['errors'])) { 56 56 // will this work? 57 $_SESSION[ "comment_post_error"] = $rv["errors"];57 $_SESSION['comment_post_error'] = $rv['errors']; 58 58 } 59 59 else if ($config['comments_moderate']) { 60 $_SESSION[ "comment_moderated"] = 1;60 $_SESSION['comment_moderated'] = 1; 61 61 } 62 62 -
trunk/plog-functions.php
r534 r536 961 961 962 962 // try to detect slideshow. Downside is that you cannot have a picture with that name 963 if ( 'slideshow' == $names['picture']) {963 if (isset($names['picture']) && $names['picture'] == 'slideshow') { 964 964 return array('level' => 'album','mode' => 'slideshow','id' => $album['id']); 965 965 } 966 966 967 967 // deal with http://plogger/collection/album/sorted/field/asc and friends 968 if ( 'sorted' == $names['picture']) {968 if (isset($names['picture']) && $names['picture'] == 'sorted') { 969 969 if (isset($names['arg1'])) { 970 970 $_SESSION['plogger_sortby'] = $names['arg1']; … … 1166 1166 } else { 1167 1167 $approved = 1; 1168 $notify_msg = ''; 1168 1169 } 1169 1170 … … 1729 1730 function plogger_rss_link() { 1730 1731 global $config; 1732 $rss_link = ''; 1731 1733 1732 1734 if ($config["use_mod_rewrite"]) { … … 2186 2188 2187 2189 function plogger_collection_album_count() { 2188 if (isset($GLOBALS[ "album_count"][$GLOBALS["current_collection"]["id"]])) {2189 return $GLOBALS[ "album_count"][$GLOBALS["current_collection"]["id"]];2190 if (isset($GLOBALS['album_count']) && isset($GLOBALS['current_collection']['id'])) { 2191 return $GLOBALS['album_count'][$GLOBALS['current_collection']['id']]; 2190 2192 } else { 2191 2193 return 0; … … 2253 2255 2254 2256 function plogger_album_picture_count() { 2255 $row = $GLOBALS["current_album"]; 2256 // XXX: surely this can be optimized? 2257 $numquery = "SELECT COUNT(*) AS `num_pictures` FROM `".TABLE_PREFIX."pictures` WHERE `parent_album`='".$row["id"]."'"; 2258 $numresult = run_query($numquery); 2259 return mysql_result($numresult, 'num_pictures'); 2257 if (isset($GLOBALS['current_album'])) { 2258 $row = $GLOBALS['current_album']; 2259 // XXX: surely this can be optimized? 2260 $numquery = "SELECT COUNT(*) AS `num_pictures` FROM `".TABLE_PREFIX."pictures` WHERE `parent_album`='".$row['id']."'"; 2261 $numresult = run_query($numquery); 2262 return mysql_result($numresult, 'num_pictures'); 2263 } 2260 2264 } 2261 2265 … … 2295 2299 2296 2300 function plogger_get_next_picture_link() { 2301 global $config; 2302 2297 2303 $next_url = plogger_get_next_picture_url(); 2298 2304 2299 2305 if ($next_url) 2300 if ($config[ "embedded"] == 0) {2306 if ($config['embedded'] == 0) { 2301 2307 $next_link = '<a id="next-button" accesskey="." href="'.$next_url.'#prev-button">' . plog_tr('Next') . ' »</a>'; 2302 2308 } else { … … 2310 2316 2311 2317 function plogger_get_prev_picture_link() { 2318 global $config; 2319 2312 2320 $prev_url = plogger_get_prev_picture_url(); 2313 2321 2314 2322 if ($prev_url) 2315 if ($config[ "embedded"] == 0) {2323 if ($config['embedded'] == 0) { 2316 2324 $prev_link = '<a id="prev-button" accesskey="," href="'.$prev_url.'#next-button">« ' . plog_tr('Previous') . '</a>'; 2317 2325 } else { -
trunk/plog-print.php
r496 r536 6 6 7 7 $picture = get_picture_by_id($_GET['id']); 8 $GLOBALS['plogger_level'] = "picture"; 9 $GLOBALS['plogger_id'] = $_GET['id']; 10 $GLOBALS['plogger_mode'] = "print"; 8 11 9 12 ?> … … 18 21 19 22 <body onload="window.print();"> 20 <div><img src="<?php echo $picture[ "url"]; ?>" alt="<?php echo $picture["caption"]; ?>" /></div>23 <div><img src="<?php echo $picture['url']; ?>" alt="<?php echo $picture['caption']; ?>" /></div> 21 24 </body> 22 25 -
trunk/plog-rss.php
r509 r536 131 131 $parts = parse_url($_SERVER["REQUEST_URI"]); 132 132 parse_str($parts["query"],$query_parts); 133 generate_RSS_feed($level, $id, $query_parts["searchterms"]); 133 if (isset($query_parts["searchterms"])) { 134 generate_RSS_feed($level, $id, $query_parts["searchterms"]); 135 } else { 136 generate_RSS_feed($level, $id); 137 } 134 138 135 139 ?>
