Changeset 569 for trunk

Show
Ignore:
Timestamp:
07/29/08 16:01:29 (4 months ago)
Author:
sidtheduck
Message:

+ Fix for ticket #185 - special characters in album name
+ Fix for ticket #181 - Edit comment form
+ Fix for ticket #180 - Manage Feedback notification issues
+ Fix for possible SQL injection vulnerability found by security tester (Thanks James of GulfTech?!)
+ Redirect to plog-upload if already logged in and navigating to plog-admin/index.php

Location:
trunk
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-admin/index.php

    r555 r569  
    22// load configuration variables from database, plog-globals, & plog-includes/plog-functions 
    33require_once(dirname(dirname(__FILE__))."/plog-load-config.php"); 
     4 
     5// if we're already logged in, redirect to the upload page 
     6if (isset($_SESSION['plogger_logged_in']) && $_SESSION['plogger_logged_in'] === true) { 
     7        header("Location: plog-upload.php"); 
     8        exit; 
     9} 
    410 
    511$output = ''; 
  • trunk/plog-admin/plog-admin-functions.php

    r568 r569  
    3333} 
    3434 
     35function generate_pagination_view_menu() { 
     36        $url_query = "?"; 
     37        $url_parts = parse_url($_SERVER['REQUEST_URI']); 
     38        if (isset($url_parts['query'])) { 
     39                // if entries_per_page is already present in URL, remove it 
     40                if (strpos($url_parts['query'], "entries_per_page") !== false || strpos($url_parts['query'], "plog_page") !== false) { 
     41                        parse_str($url_parts['query'], $query_parts); 
     42                        foreach ($query_parts as $qkey => $qval) { 
     43                                if ($qkey != "entries_per_page" && $qkey != "plog_page") { 
     44                                        $url_query .= $qkey."=".$qval."&"; 
     45                                } 
     46                        } 
     47                } else { 
     48                        $url_query .= $url_parts['query']."&"; 
     49                } 
     50        } 
     51 
     52        $java = 'document.location.href = \''.$url_parts['path'].$url_query.'entries_per_page=\'+this.options[this.selectedIndex].value'; 
     53 
     54        $possible_values = array("1"=>1, "5"=>5, "10"=>10, "20"=>20, "50"=>50, "100"=>100, "250"=>250, "500"=>500); 
     55        $output= "\n\t\t\t" . '<label accesskey="e" for="entries_on_page">' .plog_tr('<em>E</em>ntries per page') . '</label> 
     56                        <select class="entries-page" onchange="'.$java.'" name="entries_per_page" style="width: 60px;">'; 
     57        foreach ($possible_values as $key => $value) { 
     58                if ($_SESSION['entries_per_page'] == $key) { 
     59                        $output .= "\n\t\t\t\t".'<option value="'.$value.'" selected="selected">'.$key.'</option>'; 
     60                } else { 
     61                        $output .= "\n\t\t\t\t".'<option value="'.$value.'">'.$key.'</option>'; 
     62                } 
     63        } 
     64        $output.= "\n\t\t\t".'</select>'; 
     65        return $output; 
     66} 
     67 
    3568function add_picture($album_id,$tmpname,$filename,$caption,$desc) { 
    3669        global $config; 
     
    72105 
    73106        while (is_file($config['basedir'].'plog-content/images/'.$create_path."/".$unique_filename_base.".".$filename_ext)){ 
    74                 $unique_filename_base = SmartStripSlashes($filename_base)." (" . ++$i .")"; 
    75         } 
    76  
    77         $final_filename = $unique_filename_base . "." . $filename_ext; 
     107                $unique_filename_base = SmartStripSlashes($filename_base)."(" . ++$i .")"; 
     108        } 
     109 
     110        $final_filename = sanitize_filename($unique_filename_base) . "." . $filename_ext; 
    78111 
    79112        // final fully qualified file name 
    80         $final_fqfn = $config["basedir"].'plog-content/images/'.$create_path.'/'.$final_filename; 
     113        $final_fqfn = $config['basedir'].'plog-content/images/'.$create_path.'/'.$final_filename; 
    81114 
    82115        if (!makeDirs($config['basedir'].'plog-content/images/'.$create_path, 0777)) { 
     
    164197}; 
    165198 
    166 function update_picture($id,$caption,$allow_comments,$description) { 
     199function update_picture($id, $caption, $allow_comments, $description) { 
    167200        $id = intval($id); 
    168201        $caption = mysql_real_escape_string($caption); 
     
    175208                WHERE id='$id'"; 
    176209        $result = mysql_query($query); 
    177         if ($result)  
     210        if ($result) { 
    178211                return array('output' => plog_tr('You have successfully modified the selected picture.')); 
    179         else 
     212        } else { 
    180213                return array('errors' => mysql_error()); 
     214        } 
    181215} 
    182216 
     
    235269        $i = 0; 
    236270        while ($to_album != $picture['parent_album'] && is_file($config['basedir'].'plog-content/images/'.$target_path."/".$unique_filename_base.".".$filename_ext)){ 
    237                 $unique_filename_base = $filename_base." (" . ++$i . ")"; 
     271                $unique_filename_base = $filename_base."(" . ++$i . ")"; 
    238272        } 
    239273 
    240274        // final fully qualified file name 
    241         $picture_path = $target_path.'/'.$unique_filename_base.".".$filename_ext; 
     275        $picture_path = $target_path.'/'.sanitize_filename($unique_filename_base).".".$filename_ext; 
    242276        $final_fqfn = $config['basedir'].'plog-content/images/'.$picture_path; 
    243277 
     
    392426        $target_path = $config["basedir"] . "plog-content/images/".$target_name; 
    393427 
    394         // do not allow collections with duplicate names, otherwise mod_rewritten links will start 
    395         // to behave weird. 
    396         if ($row["name"] != $name && is_dir($target_path)) { 
    397                 // if there is already a directory, check to see if it's in the database 
    398                 $collection_data = get_collection_by_name($name); 
    399                 if ($collection_data){ 
    400                         // it's in the database, so throw duplicate collection error 
    401                         return array("errors" => sprintf(plog_tr('Collection `%s` could not be renamed to `%s`, because there is another collection with that name'),$row['name'],$name)); 
    402                 } else{ 
    403                         // it's not in the database so attempt to delete the directory 
    404                         if (!@rmdir($target_path)){ 
    405                                 // could not delete the directory, so prompt the user to delete it manually 
    406                                 return array("errors" => sprintf(plog_tr('Collection directory `%s` exists, but no collection exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path)); 
     428        // check for self-re-naming collection instance 
     429        if ($source_path != $target_path) { 
     430                // do not allow collections with duplicate names, otherwise mod_rewritten links will start 
     431                // to behave weird. 
     432                if (is_dir($target_path)) { 
     433                        // if there is already a directory, check to see if it's in the database 
     434                        $collection_data = get_collection_by_name($name); 
     435                        if ($collection_data){ 
     436                                // it's in the database, so throw duplicate collection error 
     437                                return array("errors" => sprintf(plog_tr('Collection `%s` could not be renamed to `%s`, because there is another collection with that name'),$row['name'],$name)); 
     438                        } else{ 
     439                                // it's not in the database so attempt to delete the directory 
     440                                if (!@rmdir($target_path)){ 
     441                                        // could not delete the directory, so prompt the user to delete it manually 
     442                                        return array("errors" => sprintf(plog_tr('Collection directory `%s` exists, but no collection exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path)); 
     443                                } 
    407444                        } 
    408445                } 
    409         } 
    410  
    411         // perform the rename on the directory 
    412         if (!rename($source_path, $target_path)) { 
    413                 return array("errors" => sprintf(plog_tr("Error renaming directory! (%s to %s)"),$source_path,$target_path)); 
     446 
     447                // perform the rename on the directory 
     448                if (!rename($source_path, $target_path)) { 
     449                        return array("errors" => sprintf(plog_tr("Error renaming directory! (%s to %s)"),$source_path,$target_path)); 
     450                } 
    414451        } 
    415452 
     
    470507        } else { 
    471508                return array('errors' => plog_tr('Could not modify selected collection')); 
    472         }; 
     509        } 
    473510 
    474511} 
     
    541578        // first try to create the directory to hold the images, if that fails, then the album 
    542579        // will be unusable anyway 
    543         $create_path = $config["basedir"] . "plog-content/images/".SmartStripSlashes($row["collection_path"])."/".$album_folder; 
     580        $create_path = $config['basedir'] . "plog-content/images/".SmartStripSlashes($row['collection_path'])."/".$album_folder; 
    544581 
    545582        // check path so we are not creating duplicate albums within the same collection 
     
    582619} 
    583620 
    584 function update_album($album_id,$name,$description,$thumbnail_id = 0) { 
    585         global $config; 
    586  
     621function update_album($album_id, $name, $description, $thumbnail_id = 0) { 
     622        global $config; 
    587623        $errors = $output = ""; 
    588  
    589         $target_name = strtolower(sanitize_filename(SmartStripSlashes($name))); 
    590  
     624         
    591625        $album_id = intval($album_id); 
    592626        $thumbnail_id = intval($thumbnail_id); 
    593         $name = mysql_real_escape_string(SmartStripSlashes($name)); 
     627        $name = mysql_real_escape_string(SmartStripSlashes(trim($name))); 
    594628        $description = mysql_real_escape_string(SmartStripSlashes($description)); 
     629        if (empty($name)) { 
     630                return array("errors" => plog_tr("Please enter a valid name for the album")); 
     631        } 
     632 
     633        $target_name = strtolower(sanitize_filename(SmartStripSlashes($name))); 
    595634 
    596635         // first, get the album name and collection name of our source album 
    597         $sql = "SELECT c.path AS collection_path, a.path AS album_path 
     636        $sql = "SELECT c.path AS collection_path, a.path AS album_path, a.parent_id AS collection_id 
    598637                        FROM ".TABLE_PREFIX."albums a, ".TABLE_PREFIX."collections c 
    599                         WHERE c.id = a.parent_id AND a.id = '$album_id'"; 
     638                        WHERE c.id = a.parent_id AND a.id = ".$album_id; 
    600639 
    601640        $result = run_query($sql); 
    602641        $row = mysql_fetch_assoc($result); 
    603642 
    604         $source_album_name = SmartStripSlashes($row["album_path"]); 
    605         $source_collection_name = SmartStripSlashes($row["collection_path"]);      
     643        $source_album_name = SmartStripSlashes($row['album_path']); 
     644        $source_collection_name = SmartStripSlashes($row['collection_path']);      
    606645 
    607646        $source_path = $config['basedir'] . "plog-content/images/".$source_collection_name."/".$source_album_name; 
    608647        $target_path = $config['basedir'] . "plog-content/images/".$source_collection_name."/".$target_name; 
    609648 
    610         // check path so we are not creating duplicate albums within the same collection 
    611         if (is_dir($target_path)){ 
    612                 // if there is already a directory, check to see if it's in the database 
    613                 $album_data = get_album_by_name($album_name, $to_collection); 
    614                 if ($album_data) { 
    615                         // it's in the database, so throw duplicate album error 
    616                         return array("errors" => sprintf(plog_tr('New album could not be created, because there already is one named `%s` in the collection `%s`!'), $target_name, $source_collection_name)); 
    617                 } else { 
    618                         // it's not in the database so attempt to delete the directory 
    619                         if (!@rmdir($target_path)){ 
    620                                 // could not delete the directory, so prompt the user to delete it manually 
    621                                 return array("errors" => sprintf(plog_tr('Album directory `%s` exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path)); 
     649        // check for self-re-naming album instance 
     650        if ($source_path != $target_path) { 
     651                // check path so we are not creating duplicate albums within the same collection 
     652                if (is_dir($target_path)) { 
     653                        // if there is already a directory, check to see if it's in the database 
     654                        $album_data = get_album_by_name($name, $row['collection_id']); 
     655                        if ($album_data) { 
     656                                // it's in the database, so throw duplicate album error 
     657                                return array("errors" => sprintf(plog_tr('New album could not be created, because there already is one named `%s` in the collection `%s`!'), $target_name, $source_collection_name)); 
     658                        } else { 
     659                                // it's not in the database so attempt to delete the directory 
     660                                if (!@rmdir($target_path)){ 
     661                                        // could not delete the directory, so prompt the user to delete it manually 
     662                                        return array("errors" => sprintf(plog_tr('Album directory `%s` exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path)); 
     663                                } 
    622664                        } 
    623665                } 
    624         } 
    625  
    626         // perform the rename on the directory 
    627         if (!rename($source_path, $target_path)) 
    628         { 
    629                 return array( 
    630                         "errors" => sprintf(plog_tr("Error renaming directory! (%s to %s)"),$source_path,$target_path)); 
     666 
     667                // perform the rename on the directory 
     668                if (!rename($source_path, $target_path)) 
     669                { 
     670                        return array( 
     671                                "errors" => sprintf(plog_tr("Error renaming directory! (%s to %s)"),$source_path,$target_path)); 
     672                } 
    631673        } 
    632674 
     
    925967                return false; 
    926968        } 
    927         $output .= "\n\t" . '<form class="edit" action="'.$_SERVER["PHP_SELF"].'" method="post"> 
    928                 <table>'; 
     969        $query = ""; 
     970        if (strpos($_SERVER['PHP_SELF'], "plog-manage") !== false) { 
     971                $query = "?level=comments&amp;id=".$comment['parent_id']; 
     972        } 
     973 
     974        $output .= "\n\t" . '<form class="edit" action="'.$_SERVER['PHP_SELF'].$query.'" method="post">'; 
     975 
     976        // get the thumbnail 
     977        $photo = get_picture_by_id($comment['parent_id']); 
     978        $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'],THUMB_SMALL); 
     979        $output .= "\n\t\t" . '<div style="float: right;"><img src="'.$thumbpath.'" alt="" /></div>'; 
     980 
     981        $output .= "\n\t\t<table>"; 
    929982        $output .= "\n\t\t\t" . '<tr> 
    930983                                <td>' . plog_tr('Author:') . '<br /><input size="30" name="author" id="author" value="'.SmartStripSlashes($comment['author']).'"/ ></td> 
     
    940993                        <input type="hidden" name="pid" value="'.$comment['id'].'" > 
    941994                        <input type="hidden" name="action" value="update-comment" > 
    942                         <button class="submit" type="submit">' . plog_tr('Update') . '</button>'; 
    943  
    944                 if (isset($_REQUEST["level"])) 
    945                 { 
    946                         $output .= "\n\t\t\t" . '<input type="hidden" name="level" value="'.$_REQUEST['level'].'" />'; 
    947                 } 
    948  
    949                 if (isset($_REQUEST["id"])) 
    950                 { 
    951                         $output .= "\n\t\t\t" . '<input type="hidden" name="id" value="'.$_REQUEST['id'].'" />'; 
    952                 } 
     995                        <input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" /> 
     996                        <input class="submit" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" />'; 
    953997 
    954998                        $output .= "\n\n\t\t" . '</form>'; 
     
    11351179 
    11361180/// XXX: something for the future: perhaps hooks for plugins should be implemented, 
    1137 // so plugis could add new fields to all those forms. 
     1181// so plugins could add new fields to all those forms. 
    11381182function plog_add_collection_form() { 
    11391183        $output = "\n\t\t" . '<input type="button" class="submit" id="show-collection" onclick="toggle(\'create-collection\'); toggle(\'show-collection\')" value="' . plog_tr('Create a Collection') . '" />'; 
     
    11781222        $output = ''; 
    11791223        $collection_id = intval($collection_id); 
    1180         $output .= "\n\t\t" . '<form class="edit" action="'.$_SERVER["REQUEST_URI"].'" method="post">'; 
     1224        $output .= "\n\t\t" . '<form class="edit" action="'.$_SERVER['PHP_SELF'].'" method="post">'; 
    11811225        $collection = get_collection_by_id($collection_id); 
    11821226 
     
    12051249        $output .= "\n\t\t\t" . '<div> 
    12061250                        <label accesskey="n" for="name">' . plog_tr('<em>N</em>ame') . ':</label><br /> 
    1207                         <input size="30" name="name" id="name" value="'.SmartStripSlashes($collection['name']).'" /><br /> 
     1251                        <input size="30" name="name" id="name" value="'.htmlspecialchars(SmartStripSlashes($collection['name'])).'" /><br /> 
    12081252                        <label accesskey="d" for="description">' . plog_tr('<em>D</em>escription') . ':</label><br /> 
    1209                         <input size="80" name="description" id="description" value="'.SmartStripSlashes($collection['description']).'" /><br /> 
     1253                        <input size="80" name="description" id="description" value="'.htmlspecialchars(SmartStripSlashes($collection['description'])).'" /><br /> 
    12101254                        Thumbnail:<br /> 
    12111255                                <select name="thumbnail_id" onchange="updateThumbPreview(this)" class="thumbselect" id="thumbselect"> 
     
    12161260                                <input type="hidden" name="action" value="update-collection" /> 
    12171261                                <br /> 
    1218                                 <button class="submit" type="submit">' . plog_tr('Update') . '</button> 
     1262                                <input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" /> 
     1263                                <input class="submit" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" /> 
    12191264                        </div>'; 
    12201265 
     
    12311276        $auto_graphic = $config['gallery_url']."plog-admin/images/auto.gif"; 
    12321277 
    1233         $output = "\n\t\t" . '<form class="edit" action="'.$_SERVER["PHP_SELF"].'?level=albums&amp;id='.$album["parent_id"].'" method="post">'; 
     1278        $output = "\n\t\t" . '<form class="edit" action="'.$_SERVER['PHP_SELF'].'?level=albums&amp;id='.$album['parent_id'].'" method="post">'; 
    12341279 
    12351280        $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url('.$auto_graphic.'); background-repeat: no-repeat;">' . plog_tr('automatic') . '</option>'; 
     
    12421287                        $style = 'class="thumboption" style="padding-left: '.($thumbnail_config[THUMB_SMALL]["size"] + 5).'px; background-image: url('.generate_thumb(SmartStripSlashes($row["path"]), $row["id"]).'); background-repeat: no-repeat;"'; 
    12431288 
    1244                         $images .= "\n\t\t\t\t<option $style value='" . $row["id"] . "'" . $selected . ">"; 
     1289                        $images .= "\n\t\t\t\t<option ".$style." value='" . $row["id"] . "'" . $selected . ">"; 
    12451290                        $images .= !empty($row["caption"]) ? SmartStripSlashes($row["caption"]) : SmartStripSlashes(basename($row["path"])); 
    12461291                        $images .= "</option>"; 
     
    12491294                $output .= "\n\t\t\t" . '<div> 
    12501295                        <label for="name" accesskey="n">' . plog_tr('<em>N</em>ame') . ':</label><br /> 
    1251                         <input size="30" name="name" id="name" value="'.SmartStripSlashes($album['name']).'" /><br /> 
     1296                        <input size="30" name="name" id="name" value="'.htmlspecialchars(SmartStripSlashes($album['name'])).'" /><br /> 
    12521297                        <label for="description" accesskey="d">' . plog_tr('<em>D</em>escription') . ':</label><br /> 
    1253                         <input size="80" name="description" id="description" value="'.SmartStripSlashes($album['description']).'" /><br /> 
     1298                        <input size="80" name="description" id="description" value="'.htmlspecialchars(SmartStripSlashes($album['description'])).'" /><br /> 
    12541299                        Thumbnail:<br /> 
    12551300                                <select name="thumbnail_id" class="thumbselect" id="thumbselect" onchange="updateThumbPreview(this)"> 
     
    12601305                                <input type="hidden" name="action" value="update-album" /> 
    12611306                                <br /> 
    1262                                 <button class="submit" type="submit">' . plog_tr('Update') . '</button> 
     1307                                <input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" /> 
     1308                                <input class="submit" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" /> 
    12631309                        </div>'; 
    12641310                $output .= "\n\t\t" . '</form>' . "\n"; 
     
    13311377                        //$java = "javascript:this.ThumbPreviewPopup('$target')"; 
    13321378                        $output .= "\n\t\t\t\t" . '<td><div class="img-shadow"><a href="'.plogger_get_picture_thumb(THUMB_LARGE).'" rel="lightbox" title="'.plogger_get_picture_caption().'">'.$imgtag.'</a></div></td>'; 
    1333                         $output .= "\n\t\t\t\t<td><strong><a class='folder' href='?level=comments&amp;id=" . $id . "'>" . basename(plogger_get_source_picture_path()) . "</a></strong></td>"; 
     1379                        $output .= "\n\t\t\t\t".'<td><strong><a class="folder" href="'.$_SERVER['PHP_SELF'].'?level=comments&amp;id=' . $id . '">' . basename(plogger_get_source_picture_path()) . '</a></strong> &#8212; ' . sprintf(plog_tr('contains %d comment(s)'), plogger_picture_comment_count()) . '</td>'; 
    13341380                        $output .= "\n\t\t\t\t<td><p id=\"picture-caption-" . plogger_get_picture_id() ."\">" . plogger_get_picture_caption() . "&nbsp;</p></td>"; 
    13351381                        $output .= "\n\t\t\t\t<td><p id=\"picture-description-" . plogger_get_picture_id() ."\">" . plogger_get_picture_description() . "&nbsp;</p></td>"; 
     
    13421388 
    13431389                        $parent_id = $_REQUEST["id"]; 
    1344                         $output .= '<a href="?action=1&amp;selected%5B%5D=' . $id . '&amp;level=pictures&amp;delete_checked=1&amp;id='.$parent_id; 
    1345                         if (isset($_GET["entries_per_page"])) $output .= '&amp;entries_per_page=' . intval($_GET["entries_per_page"]); 
    1346                         if (isset($_GET["plog_page"])) $output .= '&amp;plog_page=' . intval($_GET["plog_page"]); 
     1390                        $output .= '<a href="?action=move-delete&amp;selected%5B%5D=' . $id . '&amp;level=pictures&amp;delete_checked=1&amp;id='.$parent_id; 
     1391                        if (isset($_GET['plog_page'])) $output .= '&amp;plog_page=' . intval($_GET['plog_page']); 
    13471392                        $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 
    13481393                        $output .= "\n\t\t\t</tr>"; 
     
    14151460                        $counter++; 
    14161461 
    1417                         $output .= "\n\t\t\t<tr class='$table_row_color'>"; 
    1418                         $output .= "\n\t\t\t\t<td><input type='checkbox' name='selected[]' value='" . $id . "' /></td>"; 
    1419                         $output .= "\n\t\t\t\t<td><a class='folder' href='?level=pictures&amp;id=" .$id . "'><span id='album-name-" . plogger_get_album_id(). "'><strong>" . plogger_get_album_name() . "</strong></span></a> &#8212; " . sprintf(plog_tr('contains %d picture(s)'),plogger_album_picture_count()) . "</td>"; 
    1420                         $output .= "\n\t\t\t\t<td><p id='album-description-" . plogger_get_album_id() . "'>" . plogger_get_album_description() . "&nbsp;</p></td>"; 
    1421                         $output .= "\n\t\t\t\t" . '<td><a href="?action=edit-album&amp;id=' . $id . '"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 
    1422                         $output .= '<a href="?action=1&amp;selected%5B%5D=' . $id . '&amp;level=albums&amp;delete_checked=1&amp;id='.$_REQUEST["id"].'" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 
     1462                        $output .= "\n\t\t\t".'<tr class="'.$table_row_color.'">'; 
     1463                        $output .= "\n\t\t\t\t".'<td><input type="checkbox" name="selected[]" value="'.$id.'" /></td>'; 
     1464                        $output .= "\n\t\t\t\t".'<td><a class="folder" href="'.$_SERVER['PHP_SELF'].'?level=pictures&amp;id='.$id.'"><span id="album-name-'.plogger_get_album_id().'"><strong>'.plogger_get_album_name().'</strong></span></a> &#8212; ' . sprintf(plog_tr('contains %d picture(s)'), plogger_album_picture_count()) . '</td>'; 
     1465                        $output .= "\n\t\t\t\t".'<td><p id="album-description-'.plogger_get_album_id().'">'.plogger_get_album_description().'&nbsp;</p></td>'; 
     1466                        $output .= "\n\t\t\t\t".'<td><a href="'.$_SERVER['PHP_SELF'].'?action=edit-album&amp;id='.$id.'"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 
     1467                        $output .= '<a href="'.$_SERVER['PHP_SELF'].'?action=move-delete&amp;selected%5B%5D='.$id.'&amp;level=albums&amp;delete_checked=1&amp;id='.$_REQUEST['id']; 
     1468                        if (isset($_GET['plog_page'])) { $output .= '&amp;plog_page='.intval($_GET['plog_page']); } 
     1469                        $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 
    14231470                        $output .= "\n\t\t\t</tr>"; 
    14241471 
    1425                 }; 
    1426                 $output .= "\n\t\t\t" . '<tr class="footer"> 
     1472                } 
     1473                $output .= "\n\t\t\t".'<tr class="footer"> 
    14271474                                <td colspan="7"></td> 
    14281475                        </tr> 
    1429                 </table>' . "\n"; 
     1476                </table>'."\n"; 
    14301477        } else { 
    14311478                $output .= "\n\n\t\t<p class=\"actions\">" . plog_tr("There are no albums in this collection yet, why don't you create one?") . "</p>\n"; 
    1432         }; 
     1479        } 
    14331480        return $output; 
    14341481 
     
    14881535                        $output .= "\n\t\t\t<tr class=\"$table_row_color\">"; 
    14891536                        $output .= "\n\t\t\t\t<td><input type='checkbox' name='selected[]' value='" . $id . "' /></td>"; 
    1490                         $output .= "\n\t\t\t\t<td><a class='folder' href='?level=albums&amp;id=" .$id . "'><span id='collection-name-" . plogger_get_collection_id() . "'><strong>" . plogger_get_collection_name() . "</strong></span></a> &#8212; " . sprintf(plog_tr('contains %d albums'),plogger_collection_album_count()) . "</td>"; 
    1491                         $output .= "\n\t\t\t\t<td><p id='collection-description-" . plogger_get_collection_id() . "'>" . plogger_get_collection_description() . "&nbsp;</p></td>"; 
     1537                        $output .= "\n\t\t\t\t<td><a class='folder' href='?level=albums&amp;id=" .$id . "'><span id='collection-name-" . plogger_get_collection_id()."'><strong>".plogger_get_collection_name()."</strong></span></a> &#8212; " . sprintf(plog_tr('contains %d albums'), plogger_collection_album_count()) . "</td>"; 
     1538                        $output .= "\n\t\t\t\t<td><p id='collection-description-" . plogger_get_collection_id() . "'>" . plogger_get_collection_description()."&nbsp;</p></td>"; 
    14921539                        $output .= "\n\t\t\t\t" . '<td><a href="?action=edit-collection&amp;id=' . $id . '"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 
    1493                         $output .= '<a href="?action=1&amp;selected%5B%5D=' . $id . '&amp;level=collections&amp;delete_checked=1&amp;id='.@$_REQUEST["id"].'" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 
     1540                        $output .= '<a href="?action=move-delete&amp;selected%5B%5D=' . $id . '&amp;level=collections&amp;delete_checked=1&amp;'; 
     1541                        if (isset($_REQUEST['id'])) { $output .= 'id='.intval($_REQUEST['id']); } 
     1542                        if (isset($_GET['plog_page'])) { $output .= '&amp;plog_page=' . intval($_GET['plog_page']); } 
     1543                        $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 
    14941544                        $output .= "\n\t\t\t</tr>"; 
    1495                 }; 
     1545                } 
    14961546                $output .= "\n\t\t\t" . '<tr class="footer"> 
    14971547                                <td colspan="7"></td> 
     
    15001550        } else { 
    15011551                $output .= "\n\n\t\t<p class=\"actions\">" . plog_tr('There are no collections yet') . "</p>\n"; 
    1502         }; 
     1552        } 
    15031553        return $output; 
    15041554} 
  • trunk/plog-admin/plog-admin.php

    r567 r569  
    2222} 
    2323 
    24 if (!isset($_SESSION["plogger_logged_in"])){  
     24if (!isset($_SESSION['plogger_logged_in']) || $_SESSION['plogger_logged_in'] !== true){  
    2525        header("Location: index.php"); 
    2626        exit; 
     
    6363        <script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/plogger.js"></script> 
    6464        <script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/lightbox.js"></script> 
    65         <script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/AmiJS.js"></script> 
    66         <script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/greybox.js"></script> 
    6765        '.$inHead.' 
    68         <script type="text/javascript"> 
    69                 //GreyBox configuration 
    70                 //Use animation? 
    71                 var GB_ANIMATION = true; 
    72                 var GB_IMG_DIR = "'.$config['gallery_url'].'plog-admin/images/"; 
    73                 //Clicking on the transparent overlay closes the GreyBox window? 
    74                 var GB_overlay_click_close = false; 
    75         </script> 
    7666</head> 
    7767 
  • trunk/plog-admin/plog-feedback.php

    <
    r568 r569  
    99$inHead = '<script src="js/ajax_editing.js" type="text/javascript"></script>'; 
    1010 
    11 function generate_pagination_view_menu() { 
    12  
    13         $java = 'document.location.href = \''.$_SERVER["PHP_SELF"].'?'.'&amp;entries_per_page=\'+this.options[this.selectedIndex].value'; 
    14  
    15         $possible_values = array("5"=>5, "10"=>10, "20"=>20, "50"=>50); 
    16         $output = "\n\t\t\t\t\t" . '<label accesskey="e" for="entries_on_page">' .plog_tr('<em>E</em>ntries per page') . '</label> 
    17                                         <select class="entries-page" onchange="'.$java.'" name="entries_per_page" style="width: 60px;">'; 
    18         foreach ($possible_values as $key => $value) 
    19                 if ($_SESSION['entries_per_page'] == $key) 
    20                         $output .= "\n\t\t\t\t\t\t<option value=\"$value\" selected=\"selected\">$key</option>"; 
    21                 else 
    22                         $output .= "\n\t\t\t\t\t\t<option value=\"$value\">$key</option>"; 
    23         $output.= "\n\t\t\t\t\t</select>"; 
    24  
    25         return $output;