Changeset 574 for trunk

Show
Ignore:
Timestamp:
09/02/08 14:19:52 (3 months ago)
Author:
sidtheduck
Message:

+ Fix for ticket #192
+ Small cleanup of plog-globals.php and plog-load-config.php

Location:
trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-admin/js/ajax_editing.js

    r555 r574  
    1  
    21function makeEditable(id){ 
    32        Event.observe(id, 'click', function(){edit($(id))}, false); 
     
    1716        Element.hide(obj); 
    1817 
    19         var textarea ='<div id="' + obj.id + '_editor"><textarea id="' + obj.id + '_edit" name="' + obj.id + '" rows="4" cols="60">'+ obj.innerHTML + '</textarea>'; 
     18        var textarea ='<div id="' + obj.id + '_editor"><textarea id="' + obj.id + '_edit" name="' + obj.id + '" rows="4" cols="60">'+ obj.innerHTML.replace(/&nbsp;/gi,' ') + '</textarea>'; 
    2019 
    2120        var button = '<br /><input id="' + obj.id + '_save" type="button" value="Save" /> <input id="' + obj.id + '_cancel" type="button" value="Cancel" /></div>'; 
  • trunk/plog-admin/plog-admin-functions.php

    r572 r574  
    13821382                        $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>'; 
    13831383                        $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><br /><span style="margin-left: 20px;">' . sprintf(plog_tr('Comments: %d'), plogger_picture_comment_count()) . '</span></td>'; 
    1384                         $output .= "\n\t\t\t\t<td><p id=\"picture-caption-" . plogger_get_picture_id() ."\">" . plogger_get_picture_caption() . "&nbsp;</p></td>"; 
    1385                         $output .= "\n\t\t\t\t<td><p id=\"picture-description-" . plogger_get_picture_id() ."\">" . plogger_get_picture_description() . "&nbsp;</p></td>"; 
     1384                        $output .= "\n\t\t\t\t<td><p id=\"picture-caption-" . plogger_get_picture_id() ."\">" . plogger_get_picture_caption() . "</p></td>"; 
     1385                        $output .= "\n\t\t\t\t<td><p id=\"picture-description-" . plogger_get_picture_id() ."\">" . plogger_get_picture_description() . "</p></td>"; 
    13861386                        $allow_comments = (1 == plogger_picture_allows_comments()) ? plog_tr("Yes") : plog_tr("No"); 
    13871387                        $output .= "\n\t\t\t\t<td>" . $allow_comments . "</td>"; 
     
    14671467                        $output .= "\n\t\t\t\t".'<td><input type="checkbox" name="selected[]" value="'.$id.'" /></td>'; 
    14681468                        $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>'; 
    1469                         $output .= "\n\t\t\t\t".'<td><p id="album-description-'.plogger_get_album_id().'">'.plogger_get_album_description().'&nbsp;</p></td>'; 
     1469                        $output .= "\n\t\t\t\t".'<td><p id="album-description-'.plogger_get_album_id().'">'.plogger_get_album_description().'</p></td>'; 
    14701470                        $output .= "\n\t\t\t\t".'<td style="text-align: center;"><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>'; 
    14711471                        $output .= '&nbsp;&nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=move-delete&amp;selected%5B%5D='.$id.'&amp;level=albums&amp;delete_checked=1&amp;id='.$_REQUEST['id']; 
     
    15401540                        $output .= "\n\t\t\t\t<td><input type='checkbox' name='selected[]' value='" . $id . "' /></td>"; 
    15411541                        $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>"; 
    1542                         $output .= "\n\t\t\t\t<td><p id='collection-description-" . plogger_get_collection_id() . "'>" . plogger_get_collection_description()."&nbsp;</p></td>"; 
     1542                        $output .= "\n\t\t\t\t<td><p id='collection-description-" . plogger_get_collection_id() . "'>" . plogger_get_collection_description()."</p></td>"; 
    15431543                        $output .= "\n\t\t\t\t" . '<td style="text-align: center;"><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>'; 
    15441544                        $output .= '&nbsp;&nbsp;&nbsp;<a href="?action=move-delete&amp;selected%5B%5D=' . $id . '&amp;level=collections&amp;delete_checked=1&amp;'; 
     
    16101610                        $output .= "\n\t\t\t<tr class=\"$table_row_color\">"; 
    16111611                        $output .= "\n\t\t\t\t<td><input type=\"checkbox\" name=\"selected%5B%5D\" value=\"' . $id . '\" /></td>"; 
    1612                         $output .= "\n\t\t\t\t<td><p id=\"comment-author-" . $id ."\">" . plogger_get_comment_author() . "&nbsp;</p></td>"; 
    1613                         $email = plogger_get_comment_email(); 
    1614                         $output .= "\n\t\t\t\t<td><p id=\"comment-email-" . $id ."\">" . $email . "&nbsp;</p></td>"; 
    1615                         $output .= "\n\t\t\t\t<td><p id=\"comment-url-" . $id ."\">" . plogger_get_comment_url() . "&nbsp;</p></td>"; 
     1612                        $output .= "\n\t\t\t\t<td><p id=\"comment-author-" . $id ."\">" . plogger_get_comment_author() . "</p></td>"; 
     1613                        $output .= "\n\t\t\t\t<td><p id=\"comment-email-" . $id ."\">" . plogger_get_comment_email() . "</p></td>"; 
     1614                        $output .= "\n\t\t\t\t<td><p id=\"comment-url-" . $id ."\">" . plogger_get_comment_url() . "</p></td>"; 
    16161615                        $output .= "\n\t\t\t\t<td>" . plogger_get_comment_date("n.j.Y H:i:s") . "</td>"; 
    1617                         $output .= "\n\t\t\t\t<td><p id=\"comment-comment-" . $id ."\">" . plogger_get_comment_text() . "&nbsp;</p></td>"; 
     1616                        $output .= "\n\t\t\t\t<td><p id=\"comment-comment-" . $id ."\">" . plogger_get_comment_text() . "</p></td>"; 
    16181617                        $output .= "\n\t\t\t\t" . '<td style="text-align: center;"><a href="?action=edit-comment&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>'; 
    16191618                $output .= '&nbsp;&nbsp;&nbsp;<a href="?action=delete-comment&amp;id=' . $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>'; 
  • trunk/plog-admin/plog-feedback.php

    r571 r574  
    213213 
    214214                        foreach ($row as $key => $value) { 
    215                                 $value = htmlspecialchars($value); 
    216                                 $value = SmartStripSlashes($value); 
     215                                $value = SmartStripSlashes(htmlspecialchars($value)); 
     216                                if ($value == '') { 
     217                                        $value = '&nbsp;'; 
     218                                } 
    217219 
    218220                                if ($key == "unix_date") { 
     
    230232                                else { 
    231233                                        if (in_array($key, $allowedCommentKeys)) 
    232                                                         $output .= "\n\t\t\t\t".'<td><p id="comment-'.$key.'-'.$row['id'].'">'.$value.'&nbsp;</p></td>'; 
     234                                                        $output .= "\n\t\t\t\t".'<td><p id="comment-'.$key.'-'.$row['id'].'">'.$value.'</p></td>'; 
    233235                                } 
    234236                        } 
  • trunk/plog-admin/plog-rpc.php

    r555 r574  
    1515 
    1616        // With what? 
    17         $content = trim($_POST['content']); 
     17        $content = str_replace(array('&nbsp;', '%20', '%26nbsp%3B'), ' ', $_POST['content']); 
     18        $content = trim($content); 
    1819 
    1920        // Now we parse the field to be updated and the id number from the field variable 
     
    2829                $result = update_picture_field($id, $field, $content); 
    2930                if ($result['output']) { 
     31                        if (empty($content)) { 
     32                                $content = '&nbsp;'; 
     33                        } 
    3034                        print stripslashes($content); 
    3135                } else { 
     
    3640                $result = update_album_field($id, $field, $content); 
    3741                if ($result['output']) { 
     42                        if (empty($content)) { 
     43                                $content = '&nbsp;'; 
     44                        } 
    3845                        print stripslashes($content); 
    3946                } else { 
     
    4451                $result = update_collection_field($id, $field, $content); 
    4552                if ($result['output']) { 
     53                        if (empty($content)) { 
     54                                $content = '&nbsp;'; 
     55                        } 
    4656                        print stripslashes($content); 
    4757                } else { 
     
    5262                $result = update_comment_field($id, $field, $content); 
    5363                if ($result['output']) { 
     64                        if (empty($content)) { 
     65                                $content = '&nbsp;'; 
     66                        } 
    5467                        print stripslashes($content); 
    5568                } else { 
  • trunk/plog-globals.php

    r568 r574  
    3737$language = strtolower(substr($locale,0,2)); 
    3838 
    39 $mofile = dirname(__FILE__)."/plog-content/translations/".$locale.".mo"; 
     39$mofile = PLOGGER_DIR."plog-content/translations/".$locale.".mo"; 
    4040 
    4141// If the mo file does not exist or is not readable, or if the locale is 
  • trunk/plog-includes/plog-functions.php

    r573 r574  
    21742174function plogger_get_comment_email() { 
    21752175        $comment = $GLOBALS["current_comment"]; 
     2176        if ($comment['email'] == '') { 
     2177                return '&nbsp;'; 
     2178        } 
    21762179        return $comment["email"]; 
    21772180} 
     
    21792182function plogger_get_comment_url() { 
    21802183        $comment = $GLOBALS["current_comment"]; 
     2184        if ($comment['url'] == '') { 
     2185                return '&nbsp;'; 
     2186        } 
    21812187        return htmlspecialchars($comment["url"]); 
    21822188} 
     
    21842190function plogger_get_comment_author() { 
    21852191        $comment = $GLOBALS["current_comment"]; 
    2186         return htmlspecialchars(SmartStripSlashes($comment["author"])); 
     2192        if ($comment['author'] == '') { 
     2193                return '&nbsp;'; 
     2194        } 
     2195        return htmlspecialchars(SmartStripSlashes($comment['author'])); 
    21872196} 
    21882197 
    21892198function plogger_get_comment_text($specialchars = false) { 
    21902199        $comment = $GLOBALS["current_comment"]; 
    2191         return htmlspecialchars(SmartStripSlashes($comment["comment"])); 
     2200        if ($comment['comment'] == '') { 
     2201                return '&nbsp;'; 
     2202        } 
     2203        return htmlspecialchars(SmartStripSlashes($comment['comment'])); 
    21922204} 
    21932205 
     
    22472259                return SmartStripSlashes($GLOBALS['current_picture']['caption']); 
    22482260        } else { 
    2249                 return "&nbsp;"; 
     2261                return '&nbsp;'; 
    22502262        } 
    22512263} 
     
    22812293 
    22822294function plogger_get_picture_description($specialchars = false) { 
    2283         if (isset($GLOBALS['current_picture']['description'])){ 
     2295        if (!empty($GLOBALS['current_picture']['description'])){ 
    22842296                if ($specialchars) { 
    22852297                        return htmlspecialchars(SmartStripSlashes($GLOBALS['current_picture']['description'])); 
     
    22872299                return SmartStripSlashes($GLOBALS['current_picture']['description']); 
    22882300        } else { 
    2289                 return false; 
     2301                return '&nbsp;'; 
    22902302        } 
    22912303} 
     
    25022514 
    25032515function plogger_get_collection_description($specialchars = false) { 
     2516        if ($GLOBALS['current_collection']['description'] == '') { 
     2517                return '&nbsp;'; 
     2518        } 
    25042519        if ($specialchars){ 
    25052520                return htmlspecialchars(SmartStripSlashes($GLOBALS['current_collection']['description'])); 
     
    25812596 
    25822597function plogger_get_album_description($specialchars = false) { 
     2598        if ($GLOBALS['current_album']['description'] == '') { 
     2599                return '&nbsp;'; 
     2600        } 
    25832601        if ($specialchars) { 
    25842602                return htmlspecialchars(SmartStripSlashes($GLOBALS['current_album']['description'])); 
  • trunk/plog-load-config.php

    r567 r574  
    2020$thumbnail_config = array(); 
    2121 
    22 $plog_basedir = dirname(__FILE__)."/"; 
    23  
    24 if (is_file($plog_basedir."plog-config.php")){ 
    25         require_once($plog_basedir."plog-config.php"); 
    26 } else if (is_file($plog_basedir."plog-config-sample.php")) { 
    27         require_once($plog_basedir."plog-config-sample.php"); 
     22require_once(PLOGGER_DIR."/plog-globals.php"); 
     23if (is_file(PLOGGER_DIR."plog-config.php")){ 
     24        require_once(PLOGGER_DIR."plog-config.php"); 
     25} else if (is_file(PLOGGER_DIR."plog-config-sample.php")) { 
     26        require_once(PLOGGER_DIR."plog-config-sample.php"); 
    2827} else { 
    2928        die("Could not find any config file!"); 
    3029} 
    31 require_once($plog_basedir."plog-globals.php"); 
    32 require_once($plog_basedir."plog-includes/plog-functions.php"); 
     30require_once(PLOGGER_DIR."plog-includes/plog-functions.php"); 
    3331connect_db(); 
    3432 
    3533$query = "SELECT * FROM `".TABLE_PREFIX."config`"; 
    36 $result = mysql_query($query) or die(mysql_error() .'<br /><br />'.$query); 
     34$result = run_query($query); 
    3735 
    3836if (mysql_num_rows($result) == 0){ 
     
    4240$config = mysql_fetch_assoc($result); 
    4341 
    44 $config['basedir'] = $plog_basedir; 
     42$config['basedir'] = PLOGGER_DIR; 
    4543 
    4644$url_parts = parse_url($_SERVER['REQUEST_URI']); 
     
    8583// remove plog-admin/ from the end, if present .. is there a better way to determine the full url? 
    8684// had to update this for new use of links without mod_rewrite turned on (only affects the View gallery greybox in Admin) 
    87 if (strpos($config['baseurl'], "plog-admin/")) { 
    88         $config['baseurl'] = substr($config['baseurl'], 0, strpos($config['baseurl'], "plog-admin/")); 
     85if (strpos($config['baseurl'], 'plog-admin/')) { 
     86        $config['baseurl'] = substr($config['baseurl'], 0, strpos($config['baseurl'], 'plog-admin/')); 
    8987} 
    9088 
     
    111109 
    112110$query = "SELECT * FROM `".TABLE_PREFIX."thumbnail_config`"; 
    113 $result = mysql_query($query) or die(mysql_error() .'<br /><br />'.$query); 
     111$result = run_query($query); 
    114112 
    115113if (mysql_num_rows($result) == 0){