]> git.mjollnir.org Git - s9y.git/commitdiff
Add image HTML selectors, fix some permission issues
authorgarvinhicking <garvinhicking>
Thu, 9 Feb 2006 14:04:36 +0000 (14:04 +0000)
committergarvinhicking <garvinhicking>
Thu, 9 Feb 2006 14:04:36 +0000 (14:04 +0000)
include/admin/images.inc.php
include/functions_images.inc.php

index 270588d17374d8528bd00251d1d9b7d6be4a0ca5..e2fa77841708ab1990f5ea03b573440e970c7fe3 100644 (file)
@@ -18,13 +18,13 @@ switch ($serendipity['GET']['adminAction']) {
         @set_time_limit(0);
         @ignore_user_abort();
 
-        echo '<p><b>' . SYNCING . '</b><br /><br />';
+        echo '<p class="image_synch"><b>' . SYNCING . '</b><br /><br />';
         flush();
 
         $i = serendipity_syncThumbs();
         printf(SYNC_DONE, $i);
 
-        echo '<p><b>' . RESIZING . '</b><br /><br />';
+        echo '<p class="image_resize"><b>' . RESIZING . '</b><br /><br />';
         flush();
 
         $i = serendipity_generateThumbs();
@@ -54,9 +54,9 @@ switch ($serendipity['GET']['adminAction']) {
         $abortLoc = $serendipity['serendipityHTTPPath'] . $serendipity['adminFile'] . '?serendipity[adminModule]=images';
         $newLoc   = $abortLoc . '&serendipity[adminAction]=DoDelete&serendipity[fid]=' . (int)$serendipity['GET']['fid'] . '&' . serendipity_setFormToken('url');
 
-        printf(ABOUT_TO_DELETE_FILE, $file['name'] .'.'. $file['extension']);
+        printf('<div class="image_notify_delete">' . ABOUT_TO_DELETE_FILE . '</div>', $file['name'] .'.'. $file['extension']);
 ?>
-    <form method="get" name="delete_image">
+    <form method="get" id="delete_image">
         <div>
               <a href="<?php echo $newLoc; ?>" class="serendipityPrettyButton"><?php echo DUMP_IT ?></a>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@ -139,7 +139,7 @@ switch ($serendipity['GET']['adminAction']) {
         }
 
 ?>
-    <b><?php echo ADDING_IMAGE; ?></b>
+    <div class="image_add"><b><?php echo ADDING_IMAGE; ?></b></div>
     <br /><br />
 <?php
 
@@ -327,13 +327,11 @@ switch ($serendipity['GET']['adminAction']) {
         $groups = serendipity_getAllGroups();
         $read_groups  = serendipity_ACLGet(0, 'directory', 'read', $use_dir);
         $write_groups = serendipity_ACLGet(0, 'directory', 'write', $use_dir);
-        print_r($read_groups);
-        print_r($write_groups);
 ?>
 
-    <strong><?php echo MANAGE_DIRECTORIES ?></strong><br />
+    <div class="image_directory_edit"><strong><?php echo MANAGE_DIRECTORIES ?></strong></div>
     <br />
-    <form method="POST" action="?serendipity[adminModule]=images&amp;serendipity[adminAction]=directoryEdit&amp;serendipity[dir]=<?php echo htmlspecialchars($serendipity['GET']['dir']) ?>">
+    <form id="image_directory_edit_form" method="POST" action="?serendipity[adminModule]=images&amp;serendipity[adminAction]=directoryEdit&amp;serendipity[dir]=<?php echo htmlspecialchars($serendipity['GET']['dir']) ?>">
     <?php echo serendipity_setFormToken(); ?> 
     <input type="hidden" name="serendipity[oldDir]" value="<?php echo $use_dir; ?>" />
     <table cellpadding="5">
@@ -385,11 +383,11 @@ switch ($serendipity['GET']['adminAction']) {
         }
 ?>
 
-    <strong><?php echo DELETE_DIRECTORY ?></strong><br />
-    <?php echo DELETE_DIRECTORY_DESC ?>
+    <div class="image_directory_delete"><strong><?php echo DELETE_DIRECTORY ?></strong></div>
+    <div class="image_directory_delete_desc"><?php echo DELETE_DIRECTORY_DESC ?></div>
     <br />
     <br />
-    <form method="POST" action="?serendipity[adminModule]=images&amp;serendipity[adminAction]=directoryDoDelete&amp;serendipity[dir]=<?php echo htmlspecialchars($serendipity['GET']['dir']) ?>">
+    <form id="image_directory_delete_form" method="POST" action="?serendipity[adminModule]=images&amp;serendipity[adminAction]=directoryDoDelete&amp;serendipity[dir]=<?php echo htmlspecialchars($serendipity['GET']['dir']) ?>">
     <?php echo serendipity_setFormToken(); ?> 
     <table cellpadding="5">
         <tr>
@@ -445,11 +443,11 @@ switch ($serendipity['GET']['adminAction']) {
             'write'
         );
 ?>
-    <strong><?php echo CREATE_DIRECTORY ?></strong><br />
-    <?php echo CREATE_DIRECTORY_DESC ?>
+    <div class="image_directory_create"><strong><?php echo CREATE_DIRECTORY ?></strong></div>
+    <div class="image_directory_create_desc"><?php echo CREATE_DIRECTORY_DESC ?></div>
     <br />
     <br />
-    <form method="POST" action="?serendipity[adminModule]=images&amp;serendipity[adminAction]=directoryDoCreate">
+    <form id="image_directory_create_form" method="POST" action="?serendipity[adminModule]=images&amp;serendipity[adminAction]=directoryDoCreate">
     <?php echo serendipity_setFormToken(); ?> 
     <table cellpadding="5">
         <tr>
@@ -488,10 +486,9 @@ switch ($serendipity['GET']['adminAction']) {
         );
 
 ?>
+    <div class="image_directory_list"><?php echo DIRECTORIES_AVAILABLE; ?></div>
     <br />
-    <?php echo DIRECTORIES_AVAILABLE; ?>
-    <br />
-    <table border="0" cellspacing="0" cellpadding="4" width="100%">
+    <table id="image_directory_listing" border="0" cellspacing="0" cellpadding="4" width="100%">
         <tr>
             <td colspan="3"><strong><?php echo BASE_DIRECTORY ?></strong></td>
         </tr>
@@ -525,7 +522,7 @@ switch ($serendipity['GET']['adminAction']) {
             'write'
         );
 ?>
-    <?php echo ADD_MEDIA_BLAHBLAH; ?>
+    <div class="image_add_form"><?php echo ADD_MEDIA_BLAHBLAH; ?></a>
 
     <script type="text/javascript">
     // Function prototype inspired by http://molily.de/javascript-nodelist
@@ -711,7 +708,7 @@ switch ($serendipity['GET']['adminAction']) {
             }
         }
 ?>
-            <table id="foreign_upload">
+            <table id="foreign_upload" class="image_add_foreign">
                 <tr>
                     <td nowrap="nowrap"><?php echo ENTER_MEDIA_URL; ?></td>
                     <td><input type="text" id="imageurl" name="serendipity[imageurl]" 
@@ -736,7 +733,7 @@ switch ($serendipity['GET']['adminAction']) {
 
             <!-- WARNING: Do not change spacing or breaks below. If you do, the JavaScript childNodes need to be edited. Newlines count as nodes! -->
             <div id="upload_template">
-            <table style="margin-top: 35px" id="upload_table">
+            <table style="margin-top: 35px" id="upload_table" class="image_add_local">
                 <tr>
                     <td nowrap='nowrap'><?php echo ENTER_MEDIA_UPLOAD; ?></td>
                     <td><input id="userfile_1" name="serendipity[userfile][1]" 
@@ -782,10 +779,10 @@ switch ($serendipity['GET']['adminAction']) {
                 <script type="text/javascript">
                     document.write('<input class="serendipityPrettyButton" type="button" value="<?php echo IMAGE_MORE_INPUT; ?>" onclick="hideForeign(); addField()"' + '/><br' + '/>');
                 </script>
-                <input type="checkbox" name="serendipity[all_authors]" value="true" checked="checked" id="all_authors" /><label for="all_authors"><?php echo ALL_AUTHORS; ?></label> <input onclick="checkInputs();" type="submit" value="<?php echo GO; ?>" class="serendipityPrettyButton" />
+                <input type="checkbox" name="serendipity[all_authors]" value="true" checked="checked" id="all_authors" /><label id="all_authors_label" for="all_authors"><?php echo ALL_AUTHORS; ?></label> <input onclick="checkInputs();" type="submit" value="<?php echo GO; ?>" class="serendipityPrettyButton" />
             </div>
         </div>
-        <div><?php echo ADD_MEDIA_BLAHBLAH_NOTE; ?></div>
+        <div class="image_add_note"><?php echo ADD_MEDIA_BLAHBLAH_NOTE; ?></div>
     </form>
 <?php
     break;
index 0f08d5af4ab17374eeb481a6a37e8415f4144434..a5e6b51223f4e9e28b8c57d6771f4e3641e37198 100644 (file)
@@ -1681,12 +1681,17 @@ function serendipity_dirSlash($type, $dir) {
  */
 function serendipity_directoryACL(&$paths, $type = 'read') {
     global $serendipity;
-    static $debug = true;
+    static $debug = false;
     
     if ($debug) {
         echo "Applying ACL for mode '$type'.<br />\n";
     }
     
+    if (!is_array($paths)) {
+        return true;
+    }
+
+    $startCount = count($paths);
     if (serendipity_userLoggedIn() && (!isset($serendipity['enableACL']) || $serendipity['enableACL'] == true)) {
         // Check if we are a cool superuser. Bail out if we are.
         if (serendipity_checkPermission('adminImagesMaintainOthers') && serendipity_checkPermission('adminImagesDirectories')) {
@@ -1703,7 +1708,7 @@ function serendipity_directoryACL(&$paths, $type = 'read') {
                  AND a.artifact_mode = '" . serendipity_db_escape_string($type) . "'";
         $allowed = serendipity_db_query($q);
         if (!is_array($allowed)) {
-            return false;
+            return true;
         }
         
         // Get a list of all the groups for this user. Pipe it into a usable array.
@@ -1748,7 +1753,10 @@ function serendipity_directoryACL(&$paths, $type = 'read') {
             }
         }
         
-        if (count($paths) < 1) {
+        if (count($paths) < $startCount) {
+            if ($debug) {
+                echo "ACL denied all.<br />\n";
+            }
             return false;
         }
     }