Changeset 170

Show
Ignore:
Timestamp:
01/22/06 19:39:43 (3 years ago)
Author:
ben
Message:

Template creation now works, upgrade.php altered to handle files with incorrect paths

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/units/templates/template_actions.php

    r165 r170  
    8989                                                                        if (sizeof($elements) > 0) { 
    9090                                                                                foreach($elements as $element) { 
    91                                                                                         db_query("insert into template_elements set name = '".$element->name."', content = '".$element->content."', template_id = '".$new_template_id."'"); 
     91                                                                                        db_query("insert into template_elements set name = '".addslashes($element->name)."', content = '".addslashes($element->content)."', template_id = '".$new_template_id."'"); 
    9292                                                                                } 
    9393                                                                        } 
  • devel/upgrade.php

    r168 r170  
    1414        // Display message 
    1515                echo "<h1>" . gettext("Upgrading ...") . "</h1>"; 
     16                 
     17        // Alter file repository to remove path information 
     18                echo "<h2>" . gettext("Adjusting file repository information") . "</h2>"; 
     19                 
     20        // Get all files with path in the location 
     21                $files = db_query("select ident, location from files where location like \"".path."%\""); 
     22                 
     23        // If we have any... 
     24                if ($files != false && sizeof($files) > 0) { 
     25                        foreach ($files as $file) { 
     26                                 
     27                                $ident = $file->ident; 
     28                                $filename = str_replace(path, "", $file->location); 
     29                                 
     30                                db_query("update files set location = '$filename' where ident = $ident"); 
     31                                echo "<p>" . sprintf(gettext("Updating file %d: %s"),$ident,$filename) . "</p>"; 
     32                                 
     33                        } 
     34                } 
     35                 
     36        // Publish RSS 
     37                echo "<h2>" . gettext("Publishing RSS") . "</h2>"; 
    1638                 
    1739        // Get all users