Changeset 4652

Show
Ignore:
Timestamp:
11/05/07 20:58:18 (13 months ago)
Author:
inureyes
Message:

#708

  • Decrease plugin-load time as considering the permission.
Location:
trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/model/blog.entry.php

    r4625 r4652  
    695695        AND draft = 0 LIMIT 1"); 
    696696    if ($result == 0) { // if changed 
    697         $result = DBQuery::queryCount("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = $blogid AND slogan = '$slogan' AND draft = 0 LIMIT 1"); 
    698         for ($i = 1; $result > 0; $i++) { 
     697        $result = DBQuery::queryExistence("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = $blogid AND slogan = '$slogan' AND draft = 0 LIMIT 1"); 
     698        for ($i = 1; $result != false; $i++) { 
    699699            if ($i > 1000) 
    700700                return false; 
    701701            $slogan = tc_escape_string(UTF8::lessenAsEncoding($slogan0, 245) . '-' . $i); 
    702             $result = DBQuery::queryCount("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = $blogid AND slogan = '$slogan' AND draft = 0 LIMIT 1"); 
     702            $result = DBQuery::queryExistence("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = $blogid AND slogan = '$slogan' AND draft = 0 LIMIT 1"); 
    703703        } 
    704704    } 
     
    946946                WHERE blogid = $blogid AND id = {$entry['id']} AND draft = 0"); 
    947947        if ($entry['visibility'] == -3) { 
    948             if ($result && setEntryVisibility($entry['id'], 2)) 
    949                 setEntryVisibility($entry['id'], 3); 
     948            if ($result && setEntryVisibility($entry['id'], 2)) { 
     949                    $updatedEntry = getEntry($blogid, $entry['id']); 
     950                    fireEvent('UpdatePost', $entry['id'], $updatedEntry); 
     951                    setEntryVisibility($entry['id'], 3); 
     952            } 
    950953        } 
    951954        else { 
    952             if ($result) 
     955            if ($result) { 
    953956                setEntryVisibility($entry['id'], abs($entry['visibility'])); 
     957                $updatedEntry = getEntry($blogid, $entry['id']); 
     958                fireEvent('UpdatePost', $entry['id'], $updatedEntry); 
     959            } 
    954960        } 
    955961    } 
  • trunk/lib/plugins.php

    r4637 r4652  
    109109                    unset($tag); 
    110110                } 
    111                 if ($xmls->doesExist('/plugin/binding/center')) { 
     111                if (doesHaveMembership() && $xmls->doesExist('/plugin/binding/center')) { 
    112112                    $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
    113113                    foreach ($xmls->selectNodes('/plugin/binding/center') as $center) { 
     
    161161                        $configMappings[$plugin] = array( 'config' => 'ok') ; 
    162162                } 
    163                 if ($xmls->doesExist('/plugin/binding/adminMenu')) { 
     163                if (doesHaveMembership() && $xmls->doesExist('/plugin/binding/adminMenu')) { 
    164164                    $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
    165165 
     
    229229                    unset($params); 
    230230                 
    231                     if ($xmls->doesExist('/plugin/binding/adminMenu/methods')) { 
     231                    if (doesHaveMembership() &&$xmls->doesExist('/plugin/binding/adminMenu/methods')) { 
    232232                        foreach($xmls->selectNodes('/plugin/binding/adminMenu/methods/method') as $adminMethods) { 
    233233                            $method = array(); 
     
    286286                    unset($usedFor); 
    287287                } 
    288                 if ($xmls->doesExist('/plugin/binding/editor[lang()]')) { 
     288                if (doesHaveMembership() && $xmls->doesExist('/plugin/binding/editor[lang()]')) { 
    289289                    $editorCount = $editorCount + 1; 
    290290                    foreach (array($xmls->selectNode('/plugin/binding/editor[lang()]')) as $editor) { 
     
    313313         
    314314        if ($disablePlugin == true) { 
    315             $query = "DELETE FROM `{$database['prefix']}Plugins`  
    316                 WHERE `blogid` = ".getBlogId()."  
    317                 AND name = '".tc_escape_string($plugin)."'"; 
    318             DBQuery::query($query); 
     315            deactivatePlugin($plugin); 
    319316        } 
    320317    }