Changes for index.php

index.php in close details

<?php 
# Copyright (c) 2006, 2014 ReFri Software 
# All rights reserved. 

# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following 
# conditions are met: 

#    * Redistributions of source code must retain the above copyright notice, 
#      this list of conditions and the following disclaimer. 
#    * Redistributions in binary form must reproduce the above copyright notice, this 
#      list of conditions and the following disclaimer in the documentation and/or 
#      other materials provided with the distribution. 
#    * Neither the name of ReFri Software & Horzion QCMS  nor the names of its contributors 
#      may be used to endorse or promote products derived from this software without 
#     specific prior written permission. 

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
# THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 


# index.php 
# Author : Cynthia Fridsma <cynthia.fridsma@refrisoftware.com> 
# http://www.refrisoftware.com 
# More info about HNQCMS : http://www.hnqcms.com 

if(
$disk_cache ==true && (cellphone::LoadTemplate()==false) &&$url !="members_only" && $url !="no_cache"){ 
     
    if(
$userlevel>1){ 
        switch(
intval($userlevel)){                                                  
             
            case 
1
            case 
2
            case 
3
            case 
4
            case 
5
                 
                
$browser$_SERVER['HTTP_USER_AGENT']; 
                if(
preg_match('/MSIE/i',$browser) ||preg_match('/trident/i',$browser) ) { 
                    include(
"template/cp_ms_ie.php"); 
                }  
                include(
"cache.php"); 
                
ob_end_clean(); 
                echo 
$content
                break; 
        }  
    } else {  
        
$cacheFile "downloads/cache/page".$page.".qdb"
        if ( (
file_exists($cacheFile)))    { 
            
$content file_get_contents($cacheFile); 
            echo 
$content
        } else    { 
        include_once(
"cache.php");     
        
ob_end_clean(); 
        
file_put_contents($cacheFile,$content); 
        echo 
$content

        } 
   } 

This part of the code decides if we need to load a cached page or not. 

Logged in users and people with cellphones will never get a cached page, but all other visitors do....

<?php 
# Copyright (c) 2006, 2014 ReFri Software 
# All rights reserved. 

# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following 
# conditions are met: 

#    * Redistributions of source code must retain the above copyright notice, 
#      this list of conditions and the following disclaimer. 
#    * Redistributions in binary form must reproduce the above copyright notice, this 
#      list of conditions and the following disclaimer in the documentation and/or 
#      other materials provided with the distribution. 
#    * Neither the name of ReFri Software & Horzion QCMS  nor the names of its contributors 
#      may be used to endorse or promote products derived from this software without 
#     specific prior written permission. 

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
# THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 


# index.php 
# Author : Cynthia Fridsma <cynthia.fridsma@refrisoftware.com> 
# http://www.refrisoftware.com 
# More info about HNQCMS : http://www.hnqcms.com 

    
// --> Load dynamic content 
    #  detect QCMS tags in your article... 

    
if (preg_match(chr(123).$patt_1 chr(125), $article)){ 
        
$article =$qcms->article($patt_1""$article); 
        } 
    if (
preg_match(chr(123).$patt_2 chr(125), $article)){ 
        
$article =$qcms->article($patt_2$pagetitle$article); 
    }  
    if (
preg_match(chr(123).$patt_3 chr(125), $article)){ 
        
$article=$qcms->article($patt_3$pagetitle$article); 
    }  
    if (
preg_match(chr(123).$patt_4 chr(125), $article)){  
        
$keywords str_replace(" "", "$pagetitle); 
        
$article =$qcms->article($patt_4$keywords$article); 
    }  
    if (
preg_match(chr(123).$patt_5 chr(125), $article)){  
        
$datum vandaag(); 
        
$article =$qcms->article($patt_5$datum$article); 
    }  
    if (
preg_match(chr(123).$patt_6 chr(125), $article)){  
        
$path="images/slideshow/"
        
$dh=opendir($path) or die("Pictures not found"); 
         
        while((
$file=readdir($dh))!==false){ 
            
$total=$path $file
            @
$bytes filesize($total); 
             
            if(
is_dir($total)){ 
                
$type="dir"
            } else { 
                
$type="file"
            } 
            if(
$type !="dir"){ 
                if(
preg_match("/.png/"$file)) { 
                    
$image[]= "images/slideshow/$file"
                } 
            } 
        }     
        
$total=count($image); 
        
$start_counter 0
        
$show_picture=""
        if(
$total>0){ 
            while (
$start_counter <$total){ 
                
$picture=$image[$start_counter]; 
                
$show_picture ="<img src='$picture'>n"
                
$start_counter++; 
            } 
        } else { 
            
$show_picture=""
        } 
        
$article =$qcms->article($patt_6$show_picture$article);         
    }   
    if (
preg_match(chr(123).$patt_7 chr(125), $article)){  
                 
        
$article =$qcms->article($patt_7""$article); 
    }  
    if (
preg_match(chr(123).$patt_8 chr(125), $article)){  
             
        
$navigation $database->navigation($site_id,$page);     
        
$article =$qcms->article($patt_8,$navigation$article); 
         
    }  
    if (
preg_match(chr(123).$patt_9 chr(125), $article)){  
                 
        if(isset(
$_GET['category'])){ 
            
$category=$_GET['category']; 
        } else { 
            
$category "0"
        } 
        
$sub_nav $database->sub_category($page,$site_id,$category);         
        
$article =$qcms->article($patt_9$sub_nav$article); 
    }  
    if (
preg_match(chr(123).$patt_10 chr(125), $article)){  
            
$article =$qcms->article($patt_10""$article);         
    }  
    if (
preg_match(chr(123).$patt_11 chr(125), $article)){ 
        
$second_nav $database->new_category($page,$site_id,$category,$from);     
        
$article =$qcms->article($patt_11$second_nav $article); 
         
    }  
    if (
preg_match(chr(123).$patt_12 chr(125), $article)){ 
        
$article =$qcms->article($patt_12""$article); 
    }  
    if (
preg_match(chr(123).$patt_13 chr(125), $article)){  
        
$dropdown $database->dropdown($site_id,$page);                 
        
$article =$qcms->article($patt_13$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_14 chr(125), $article)){ 
        
$article =$qcms->article($patt_14$database->navigation2($page), $article);             
    }  
    if (
preg_match(chr(123).$patt_15 chr(125), $article)){  
        
$article =$qcms->article($patt_15$database->quickmenu(), $article);         
    }  
    if (
preg_match(chr(123).$patt_16 chr(125), $article)){         
        
$dropdown $database->dropdown_url_rewrite($page);                 
        
$article =$qcms->article($patt_16$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_17 chr(125), $article)){ 
        
$button "<input type='submit' name='button' id='button' value='Submit' />";  
        
$article =$qcms->article($patt_17$button$article); 
    }  
    if (
preg_match(chr(123).$patt_18 chr(125), $article)){ 
        
$textarea_open "<textarea ";  
        
$article =$qcms->article($patt_18$textarea_open$article); 
    }  
    if (
preg_match(chr(123).$patt_19 chr(125), $article)){ 
        
$textarea_close "</textarea>";  
        
$article =$qcms->article($patt_19$textarea_close$article); 
    }  
    if (
preg_match(chr(123).$patt_20 chr(125), $article)){ 
        
$navigation $database->pop_navigation($page);         
        
$article =$qcms->article($patt_20,$navigation$article);         
    }     
    if (
preg_match(chr(123).$patt_21 chr(125), $article)){ 
        
$second_nav $database->pop_category($page,$category,$from); 
        
$article =$qcms->article($patt_21$second_nav $article);         
    } 
    if (
preg_match(chr(123).$patt_22 chr(125), $article)){ 
        
$second_nav $database->new_pop_category($page,$category,$from); 
        
$article =$qcms->article($patt_22$second_nav $article);         
    }     
    if (
preg_match(chr(123).$patt_23 chr(125), $article)){ 
        
$navigation $database->q_navigation($page); 
        
$article =$qcms->article($patt_23,$navigation$article);         
    }     
    if (
preg_match(chr(123).$patt_24 chr(125), $article)){          
        
$domain $database->rss();         
        if(!empty(
$fb_id)){ 
            
$facebook$qcms->facebook($category,$fb_id$domain$page$category);  
        } else { 
            
$facebook " "
        } 
        
$article =$qcms->article($patt_24$facebook$article); 
    } 
    if (
preg_match(chr(123).$patt_25 chr(125), $article)){  
        
$navigation $database->navigation_url_rewrite($page); 
        
$article =$qcms->article($patt_25,$navigation$article);         
    }  
    if (
preg_match(chr(123).$patt_26 chr(125), $article)){ 
        if(isset(
$_GET['category'])){ 
            
$category=$_GET['category']; 
        } else { 
            
$category "0"
        } 
        
$sub_nav $database->sub_category_url_rewrite($site_id,$category);         
        
$article =$qcms->article($patt_26$sub_nav$article); 
    } 
    if (
preg_match(chr(123).$patt_27 chr(125), $article)){ 
        
$second_nav $database->new_category_url_rewrite($page,$category,$from); 
        
$article =$qcms->article($patt_27$second_nav $article);         
    } 
    if (
preg_match(chr(123).$patt_28 chr(125), $article)){ 
        
$news_title $database->news_content("title"); 
        
$article =$qcms->article($patt_28$news_title $article);         
    } 
    if (
preg_match(chr(123).$patt_29 chr(125), $article)){ 
        
$news_title stripslashes($database->news_content("content")); 
        
$article =$qcms->article($patt_29$news_title $article);         
    } 
    if (
preg_match(chr(123).$patt_30 chr(125), $article)){ 
        
$footer $database->footer(); 
        
$article =$qcms->article($patt_30$footer $article);         
    }     
    if (
preg_match(chr(123).$patt_31 chr(125), $article)){ 
        
$domain $database->rss(); 
        
$article =$qcms->article($patt_31$domain $article);         
    } 
    if (
preg_match(chr(123).$patt_32 chr(125), $article)){ 
                
$pdf_article "<form name="form2" method="post" action="pdf/pdf.php"> 
            <input type="submit" name="Submit" value="Generate PDF "> 
            <input name="title" type="hidden" id="category" value=""
.$qcms->encode($pagetitle).""> 
            <input name="articles" type="hidden" id="articles" value=""
.$qcms->encode($article)."">                                             
            </form>"
;     
        
$article =$qcms->article($patt_32$pdf_article $article); 
    } 
    if (
preg_match(chr(123).$patt_33 chr(125), $article)){  
        
$pdf_article "<form name="form2" method="post" action="pdf/pdf2html.php"> 
            <input type="submit" name="Submit" value="Generate PDF "> 
            <input name="title" type="hidden" id="category" value=""
.$qcms->encode($pagetitle).""> 
            <input name="articles" type="hidden" id="articles" value=""
.$qcms->encode($article)."">                                             
            </form>"
;     
        
$article =$qcms->article($patt_33$pdf_article$article); 
    }         
    if (
preg_match(chr(123).$patt_34 chr(125), $article)){ 
        
$dropdown $database->maintopicbox($page);                 
        
$article =$qcms->article($patt_34$dropdown$article); 
    }      
    if (
preg_match(chr(123).$patt_35 chr(125), $article)){  
        
$dropdown $database->maintopic($page);                 
        
$article =$qcms->article($patt_35$dropdown$article); 
    } 
    if (
preg_match(chr(123).$patt_36 chr(125), $article)){ 
        
$path="images/pictures/"
        
$dh=opendir($path) or die("Pictures not found"); 
         
        while((
$file=readdir($dh))!==false){ 
            
$total=$path $file
            @
$bytes filesize($total); 
             
            if(
is_dir($total)){ 
                
$type="dir"
            } else { 
                
$type="file"
            } 
            if(
$type !="dir"){ 
                if(
preg_match("/.jpg/"$file)) { 
                    
$image[]= "images/pictures/$file"
                } 
            } 
        }     
         
        
$total=count($image)-1
        if(
$total>0){ 
            
$show rand(0,$total); 
            
$picture=$image[$show]; 
            
$show_picture="<img src='$picture' width='160' height='160' border='0'>"
        } else { 
            
$show_picture=""
        } 
        
$article =$qcms->article($patt_36$show_picture$article);         
    } 
    if (
preg_match(chr(123).$patt_37 chr(125), $article)){  
        
$path="images/slideshow/"
        
$dh=opendir($path) or die("Pictures not found"); 
         
        while((
$file=readdir($dh))!==false){ 
            
$total=$path $file
            @
$bytes filesize($total); 
             
            if(
is_dir($total)){ 
                
$type="dir"
            } else { 
                
$type="file"
            } 
            if(
$type !="dir"){ 
                if(
preg_match("/.jpg/"$file)) { 
                    
$image[]= "images/slideshow/$file"
                } 
                if(
preg_match("/.png/"$file)) { 
                    
$image[]= "images/slideshow/$file"
                } 
            } 
        }     
         
        
$total=count($image)-1
        if(
$total>0){ 
            
$show rand(0,$total); 
            
$picture=$image[$show]; 
            
$show_picture=$picture
        } else { 
            
$show_picture=""
        } 
        
$article =$qcms->article($patt_37$show_picture$article);         
    } 
    if (
preg_match(chr(123).$patt_38 chr(125), $article)){ 
        
$path="images/wallpaper/"
        
$dh=opendir($path) or die("Pictures not found"); 
         
        while((
$file=readdir($dh))!==false){ 
            
$total=$path $file
            @
$bytes filesize($total); 
             
            if(
is_dir($total)){ 
                
$type="dir"
            } else { 
                
$type="file"
            } 
            if(
$type !="dir"){ 
                if(
preg_match("/.jpg/"$file)) {
                    
$image[]= "images/wallpaper/$file"
                } 
                if(
preg_match("/.png/"$file)) { 
                    
$image[]= "images/wallpaper/$file"
                } 
            } 
        }     
         
        
$total=count($image)-1
        if(
$total>0){ 
            
$show rand(0,$total); 
            
$picture=$image[$show]; 
            
$wallpaper=$picture
        } else { 
            
$show_picture=""
        } 
        
$article =$qcms->article($patt_38$wallpaper$article);         
    }           
     
    if (
preg_match(chr(123).$patt_39 chr(125), $article)){  
        
$dropdown $database->fancy_dropdown($page);                 
        
$article =$qcms->article($patt_39$dropdown$article); 
    }  
     
    if (
preg_match(chr(123).$patt_40 chr(125), $article)){ 
        
$dropdown $database->new_maintopic($page);                 
        
$article =$qcms->article($patt_40$dropdown$article); 
    }      
    if (
preg_match(chr(123).$patt_41 chr(125), $article)){  
        
$dropdown $database->main_menu($page);                 
        
$article =$qcms->article($patt_41$dropdown$article); 
    }      
     
    if (
preg_match(chr(123).$patt_42 chr(125), $article)){          
        
$dropdown $database->menubar($page);                 
        
$article =$qcms->article($patt_42$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_43 chr(125), $article)){ 
        
$dropdown $database->topic_navigation($page);                 
        
$article =$qcms->article($patt_43$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_44 chr(125), $article)){ 
        
$dropdown $database->topic_category($page,$category);                 
        
$article =$qcms->article($patt_44$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_45 chr(125), $article)){  
        
$dropdown $database->topic_category($page,$category,$from);                 
        
$article =$qcms->article($patt_45$dropdown$article); 
    } 
    if (
preg_match(chr(123).$patt_46chr(125), $article)){ 
        
$fb_id=$database->facebook();  
        
$domain $database->rss(); 
         
         
        if(!empty(
$fb_id)){ 
            
$facebooklike $qcms->facebooklike($category,$fb_id$domain$page$category); 
        } else { 
            
$facebooklike " "
        } 
         
        
$article =$qcms->article($patt_46$facebooklike$article); 
    }  
    if (
preg_match(chr(123).$patt_47 chr(125), $article)){  
        
$dropdown $database->dropdown_maintopic($page);                 
        
$article =$qcms->article($patt_47$dropdown$article); 
    }  

    if (
preg_match(chr(123).$patt_48 chr(125), $article)){  
        if(isset(
$_GET['category'])){ 
            
$category=intval($_GET['category']); 
        } else { 
            
$category "0"
        }         
        
$dropdown $database->maintopic_category($page,$category);                 
        
$article =$qcms->article($patt_48$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_49 chr(125), $article)){  
        
$dropdown $database->maintopic_sub_article($page,$category,$from);                 
        
$article =$qcms->article($patt_49$dropdown$article); 
    } 
    if (
preg_match(chr(123).$patt_47 chr(125), $article)){ 
        
$dropdown $database->dropdown_maintopic($page);                 
        
$article =$qcms->article($patt_47$dropdown$article); 
    }  

    if (
preg_match(chr(123).$patt_48 chr(125), $article)){  
        
$dropdown $database->maintopic_category($page,$category);                 
        
$article =$qcms->article($patt_48$dropdown$article); 
    }  
    if (
preg_match(chr(123).$patt_49 chr(125), $article)){  
        
$dropdown $database->maintopic_sub_article($page,$category,$from);                 
        
$article =$qcms->article($patt_49$dropdown$article); 
    } 
    if (
preg_match(chr(123).$patt_50 chr(125), $article)){ 
         
        
$domain $database->rss();         
        
$twitter $qcms->twitter_hastag($pagetitle,$domain,$page,$category$url_rewrite);         
        
$article =$qcms->article($patt_50$twitter$article); 
    }  
    if (
preg_match(chr(123).$patt_51 chr(125), $article)){ 
         
        
$twitter_user=$database->twitter(); 
        
$twitter $qcms->twitter_folow_us($twitter_user);         
        
$article =$qcms->article($patt_51$twitter$article); 
    }  

This part of the code will check if you used QCMS tags in your article. Because of this code all QCMS tags are supported in your article.

<?php 
# Copyright (c) 2006, 2014 ReFri Software 
# All rights reserved. 

# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following 
# conditions are met: 

#    * Redistributions of source code must retain the above copyright notice, 
#      this list of conditions and the following disclaimer. 
#    * Redistributions in binary form must reproduce the above copyright notice, this 
#      list of conditions and the following disclaimer in the documentation and/or 
#      other materials provided with the distribution. 
#    * Neither the name of ReFri Software & Horzion QCMS  nor the names of its contributors 
#      may be used to endorse or promote products derived from this software without 
#     specific prior written permission. 

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
# THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 


# index.php 
# Author : Cynthia Fridsma <cynthia.fridsma@refrisoftware.com> 
# http://www.refrisoftware.com 
# More info about HNQCMS : http://www.hnqcms.com 

// Render the HTML template 
      
foreach ($lines as $line) { 
     
    switch(
intval($userlevel)){                                                  
         
                        case 
1:     
                        case 
2
                        case 
3
                        case 
4
                        case 
5
         
            
// Do we need the MS-IE compatibility mode? 
            #  If that's the case then we'll show it in the <body tag 
             
            
if(preg_match('/<body/i',$line)){ 
                
$browser$_SERVER['HTTP_USER_AGENT']; 
                if(
preg_match('/MSIE/i',$browser)|| preg_match('/trident/i',$browser)) { 
                    include_once(
"template/cp_ms_ie.php");     
             
            }                 
     
        } 
    } 
  


This part of the code will load the control panel if a logged in user uses the Internet Explorer. This solves the compatibility issues reported for Horizon QCMS 4.1 and earlier version.... ;-)

<?php 
# Copyright (c) 2006, 2014 ReFri Software 
# All rights reserved. 

# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following 
# conditions are met: 

#    * Redistributions of source code must retain the above copyright notice, 
#      this list of conditions and the following disclaimer. 
#    * Redistributions in binary form must reproduce the above copyright notice, this 
#      list of conditions and the following disclaimer in the documentation and/or 
#      other materials provided with the distribution. 
#    * Neither the name of ReFri Software & Horzion QCMS  nor the names of its contributors 
#      may be used to endorse or promote products derived from this software without 
#     specific prior written permission. 

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
# THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 


# index.php 
# Author : Cynthia Fridsma <cynthia.fridsma@refrisoftware.com> 
# http://www.refrisoftware.com 
# More info about HNQCMS : http://www.hnqcms.com 


    if (
preg_match(chr(123).$patt_1 chr(125), $line)){ 
     
        //--> load the interactive editor panel 
         
            
if(intval($userlevel>=1)){ 
                switch(
intval($userlevel)){ 
                     
                     
                     
                    case 
1:     
                 
                        
//--> Your client                                 
                        
if($page==1){ 
                  echo 
"<p>Welcome "  $qcms->decrypt($username) . ", enjoy your stay on our site.<br></p>"
                        } 
                             
                        echo 
"<br /><br /><hr> 
                            <table width="10%"><tr><td valign="top" align="left"> 
                            <form name="form2" method="post" action="pdf/pdf.php"> 
                            <input type="submit" name="Submit" value="Generate PDF "> 
                            <input name="title" type="hidden" id="category" value=""
.$qcms->encode($pagetitle).""> 
                            <input name="articles" type="hidden" id="articles" value=""
.$qcms->encode($article)."">                                             
                            </form> 
                            </td></tr></table><hr>"
;     
                         
                         
                        
//--> facebooklike button 
                        
$domain $database->rss(); 
                        if(!empty(
$fb_id)){ 
                            echo 
"<br><br>"$qcms->facebooklike($category,$fb_id$domain$page$category)."<br><br>";  
                        } 
                         
                        
//--> display article  
                        
$line =$qcms->article($patt_1,  eval("?>"$article),$line); 
                        break; 
                    case 
2

                        
//--> junior editor                         
                        
if($page==1){ 
                            echo 
"<p>Welcome "  $qcms->decrypt($username) . ", enjoy your stay on our site.<br></p>"
                        } 
                         
                        echo 
"<br /><br /><hr>                     
                            <table width="10%"><tr><td valign="top" align="left"> 
                            <form name="form1" method="post" action="admin/edit_this_page.php"> 
                            <input type="submit" name="Submit" value="Edit this page"> 
                            <input name="page" type="hidden" id="page" value="
$page"> 
                            <input name="category" type="hidden" id="category" value="
$category"> 
                            <input name="from" type="hidden" id="from" value="
$from"> 
                            <input name="cat" type="hidden" id="cat" value="
$category"> 
                            </form> 
                            </td><td valign="top"> 
                            <form name="form2" method="post" action="pdf/pdf.php"> 
                            <input type="submit" name="Submit" value="Generate PDF "> 
                            <input name="title" type="hidden" id="category" value=""
.$qcms->encode($pagetitle).""> 
                            <input name="articles" type="hidden" id="articles" value=""
.$qcms->encode($article).""> 
                            </form> 
                            </td></tr></table>"
;     
                         
                        echo 
"<hr>"
                         
                        
//--> facebooklike button 
                        
$domain $database->rss(); 
                        if(!empty(
$fb_id)){ 
                            echo 
$qcms->facebooklike($category,$fb_id$domain$page$category);  
                        } 
                         
                        
$line =$qcms->article($patt_1,  eval("?>"$article),$line); 
                        break;                 
                     
                    case 
3
                     
                    
//--> Editor 
                     
                        
echo "<br /><br /><hr>                     
                            <table width="10%"><tr><td valign="top" align="left"> 
                            <form name="form1" method="post" action="admin/edit_this_page.php"> 
                            <input type="submit" name="Submit" value="Edit this page"> 
                            <input name="page" type="hidden" id="page" value="
$page"> 
                            <input name="category" type="hidden" id="category" value="
$category"> 
                            <input name="from" type="hidden" id="from" value="
$from"> 
                            <input name="cat" type="hidden" id="cat" value="
$category"> 
                            </form> 
                            </td><td valign="top"> 
                            <form name="form2" method="post" action="pdf/pdf.php"> 
                            <input type="submit" name="Submit" value="Generate PDF "> 
                            <input name="title" type="hidden" id="category" value=""
.$qcms->encode($pagetitle).""> 
                            <input name="articles" type="hidden" id="articles" value=""
.$qcms->encode($article).""> 
                            </form> 
                            </td></tr></table>"
;     
                         
                        echo 
"<hr>"
                         
                        
//--> facebooklike button 
                        
$domain $database->rss(); 
                        if(!empty(
$fb_id)){ 
                            echo 
$qcms->facebooklike($category,$fb_id$domain$page$category);  
                        } 
                        echo 
"<link rel="stylesheet" type="text/css" href="template/users.css" />"
                        echo 
"<div id="tabsH" style="border:2px;">n<ul>"
                        echo 
"<table width="720"><tr><td valign="top" align="left">"
                        echo 
"<li><a href='profile.php'><span>Edit profile</span></a></li>"
                         
                        if(isset(
$_GET['from'])){ 
                            
$start intval($_GET['from']); 
                            
$cat intval($_GET['category']); 
                            if(
$url_rewrite==true){ 
                                echo 
"<li><a  href="index-page-"$cat."-category-".$cat .".html"><span>Enable add subpage</span></a></li>"
                            } else { 
                                echo 
"<li><a  href="index.php?page="$cat."&category=".$cat .""><span>Enable add subpage</span></a></li>"
                            } 
                        } elseif(isset(
$_GET['category'])){ 
                            echo 
"<li><a  href="admin/article.php?category="intval($_GET['category'])."" title="write a new article">"
                            echo 
"<span>Add page</span></a></li>"
                        } 
                         
                        
// write a sub article 
                        
if(isset($_GET['from'])){ 
                            
$start intval($_GET['from']); 
                            
$cat intval($_GET['category']); 
                            echo 
"<li><a  href="admin/sub_article.php?start="$from ."&cat=".$cat ."" title="write a sub article">"
                            echo 
"<span>Add a related sub page</span></a></li>"
                        } 
                         
                        echo 
"</ul>n</td></tr></table></div>"
                         
                        
$line =$qcms->article($patt_1,  eval("?>"$article),$line); 
                         
                        break;         
                     
                     
                    case 
4:                     
                    case 
5
                     
                    
//--> Userlevel 4 : webmaster. Userlevel 5 : administrator 
                     
                        
echo "<br /><br /><hr>                     
                            <table width="10%"><tr><td valign="top" align="left"> 
                            <form name="form1" method="post" action="admin/edit_this_page.php"> 
                            <input type="submit" name="Submit" value="Edit this page"> 
                            <input name="page" type="hidden" id="page" value="
$page"> 
                            <input name="category" type="hidden" id="category" value="
$category"> 
                            <input name="from" type="hidden" id="from" value="
$from"> 
                            <input name="cat" type="hidden" id="cat" value="
$category"> 
                            </form> 
                            </td><td valign="top"> 
                            <form name="form2" method="post" action="pdf/pdf.php"> 
                            <input type="submit" name="Submit" value="Generate PDF "> 
                            <input name="title" type="hidden" id="category" value=""
.$qcms->encode($pagetitle).""> 
                            <input name="articles" type="hidden" id="articles" value=""
.$qcms->encode($article).""> 
                            </form> 
                            </td></tr></table>"
;     
                         
                        echo 
"<hr>"
                         
                        
//--> facebooklike button 
                        
$domain $database->rss(); 
                        if(!empty(
$fb_id)){ 
                            echo 
$qcms->facebooklike($category,$fb_id$domain$page$category);  
                        } 
                         
                        echo 
"<link rel="stylesheet" type="text/css" href="template/users.css" />"
                        echo 
"<div id="tabsH" style="border:2px;">n<ul>"
                        echo 
"<table width="720"><tr><td valign="top" align="left">"
                        echo 
"<li><a href='profile.php'><span>Edit profile</span></a></li>"
                         
                        if(isset(
$_GET['category'])){ 
                            echo 
"<li><a  href="index.php"><span>Enable add main page</span></a></li>"
                        } elseif (isset(
$_GET['from'])){ 
                            echo 
"<li><a  href="index.php"><span>Enable add main page</span></a></li>";     
                        } else { 
                            echo 
"<li><a  href="admin/create_category.php" title="create a category"><span>Add page</span></a></li>"
                        } 

                        
// write an article 
                        
if(isset($_GET['from'])){ 
                            
$start intval($_GET['from']); 
                            
$cat intval($_GET['category']); 
                            if(
$url_rewrite==true){ 
                                echo 
"<li><a  href="index-page-"$cat"-category-".$cat .".html"><span>Enable add subpage</span></a></li>"
                            } else { 
                                echo 
"<li><a  href="index.php?page=".$cat"&category="$cat.""><span>Enable add subpage</span></a></li>"
                            } 
                        } elseif(isset(
$_GET['category'])){ 
                            echo 
"<li><a  href="admin/article.php?category=".intval($_GET['category'])."" title="write a new related article">"
                            echo 
"<span>Add related page</span></a></li>"
                        } 
                         
                        
// write a sub article 
                        
if(isset($_GET['from'])){ 
                            
$start intval($_GET['from'])); 
                            
$cat intval($_GET['category'])); 
                            echo 
"<li><a  href="admin/sub_article.php?start=".$from ."&cat="$cat."" title="write a new related sub article">";  
                            echo 
"<span>Add related sub page</span></a></li>";                                   
                        } 
                        echo 
"</ul>n</td></tr></table></div>"
                         
                        
$line =$qcms->article($patt_1,  eval("?>"$article),$line);                         
                        break;                                 
                         
                        default: 
                        
//--> User is not authorized to edit the page                                 
                        
$line =$qcms->article($patt_1,  eval("?>"$article),$line); 
                }         
                 
            } else { 
                if(
$url =="members_only"){ 
                    
$pagetitle ""
                    
$article =""
                    
$javascript->alert("This section is for authorized users only."); 
                    
$qcms->redirect("index.php");                                     
                } 
                
$line =$qcms->article($patt_1,  eval("?>"$article),$line);             
            } 
    } 
  

This is the part that displays your article on your website. It uses the javascript and the qcms light-weight frameworks  I've programmed.

In earlier release of Horizon QCMS, a username and password of a logged in user were checked various times, now it's checked only twice: after you're logged in and on top of each PHP file, which is more efficient and speeds up Horizon QCMS!

TTFN,
Cyntiha Fridsma
Lead developer of the Horzion QCMS project.