Show
Ignore:
Timestamp:
04/25/08 12:34:53 (19 months ago)
Author:
takayama
Message:

Implemented BugId:71811, BugId:79438
* Added SSI support into the Dynamic Publishing
* Added cache option support

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-36/php/lib/mtdb_base.php

    r2103 r2104  
    152152        $result = $this->get_results($sql, ARRAY_A); 
    153153        return $result; 
     154    } 
     155 
     156    function fetch_template_meta($type, $name, $blog_id, $global) { 
     157        if ($type === 'identifier') { 
     158            $col = 'template_identifier'; 
     159            $type_filter = ""; 
     160        } else { 
     161            $col = 'template_name'; 
     162            $type_filter = "and template_type='$type'"; 
     163        } 
     164        if (!isset($global)) { 
     165            $blog_filter = "and template_blog_id in (".$this->escape($blog_id).",0)"; 
     166        } elseif ($global) { 
     167            $blog_filter = "and template_blog_id=0"; 
     168        } else { 
     169            $blog_filter = "and template_blog_id=".$this->escape($blog_id); 
     170        } 
     171 
     172        $tmpl_name = $this->escape($name); 
     173 
     174        $sql = " 
     175            select 
     176                template_id, template_name, template_modified_on 
     177            from 
     178                mt_template 
     179            where 
     180                $col = '$tmpl_name' 
     181                $blog_filter 
     182                $type_filter 
     183            order by 
     184                template_blog_id desc"; 
     185        $row = $this->get_row($sql, ARRAY_A); 
     186        if (!$row) return ''; 
     187 
     188        $data = $this->get_meta('template', $row['template_id']); 
     189        return array_merge($row, $data); 
    154190    } 
    155191 
     
    30973133        $this->query($sql); 
    30983134    } 
     3135 
     3136    function get_latest_touch($blog_id, $types) { 
     3137        $type_user = false; 
     3138        if (is_array($types)) { 
     3139            $array = preg_grep('/author/', $types); 
     3140            if (!empty($array)) $type_user = true; 
     3141        } else { 
     3142            $type_user = $types == 'author'; 
     3143        } 
     3144 
     3145        $blog_filter = ''; 
     3146        if (!empty($blog_id)) { 
     3147            if ($type_user) 
     3148                $blog_filter = 'and touch_blog_id = 0'; 
     3149            else 
     3150                $blog_filter = 'and touch_blog_id = ' . $blog_id; 
     3151        } 
     3152 
     3153        $type_filter = ''; 
     3154        if (!empty($types)) { 
     3155            if ($type_user) { 
     3156                $type_filter = 'and touch_object_type ="author"'; 
     3157            } else { 
     3158                if (is_array($types)) { 
     3159                    foreach ($types as $type) { 
     3160                        if ($type_filter != '') $type_filter .= ','; 
     3161                        $type_filter .= "'$type'"; 
     3162                    } 
     3163                    $type_filter = 'and touch_object_type in (' . $type_filter . ')'; 
     3164                } else { 
     3165                    $type_filter = 'and touch_object_type ="' . $type_filter . '"'; 
     3166                } 
     3167            } 
     3168        } 
     3169 
     3170        $sql = " 
     3171            select 
     3172                touch_modified_on 
     3173            from 
     3174                mt_touch 
     3175            where 
     3176                1 = 1 
     3177                $blog_filter 
     3178                $type_filter 
     3179            order by 
     3180                touch_modified_on desc 
     3181            <LIMIT>"; 
     3182 
     3183        $sql = $this->apply_limit_sql($sql, 1); 
     3184        $result = $this->get_row($sql, ARRAY_N); 
     3185 
     3186        if (!empty($result)) 
     3187            return $result[0]; 
     3188 
     3189        return false; 
     3190    } 
     3191 
    30993192}