<commit_before><?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2008 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*                                                                                                       *
*   class_systemtask_navigationcheck.php                                                                *
*   Checks the navigation-points fpr valid internal links                                               *
*                                                                                                       *
*-------------------------------------------------------------------------------------------------------*
*   $Id$                        *
********************************************************************************************************/

//base class and interface
include_once(_adminpath_."/systemtasks/class_systemtask_base.php");
include_once(_adminpath_."/systemtasks/interface_admin_systemtask.php");

include_once(_systempath_."/class_modul_navigation_point.php");
include_once(_systempath_."/class_modul_navigation_tree.php");
include_once(_systempath_."/class_modul_pages_page.php");

/**
 * Checkes the existing navigation-points for valid internal links.
 *
 * @package modul_navigation
 */
class class_systemtask_navigationcheck extends class_systemtask_base implements interface_admin_systemtask {


    /**
     * contructor to call the base constructor
     */
    public function __construct() {
        parent::__construct();
        //set the correct text-base
        $this->setStrTextBase("navigation");
    }
    
    
    /**
     * @see interface_admin_systemtast::getStrInternalTaskName()
     * @return string
     */
    public function getStrInternalTaskName() {
        return "navigationcheck";
    }
    
    /**
     * @see interface_admin_systemtast::getStrTaskName()
     * @return string
     */
    public function getStrTaskName() {
        return $this->getText("systemtask_navigationcheck_name");
    }
    
    /**
     * @see interface_admin_systemtast::executeTask()
     * @return string
     */
    public function executeTask() {
        $strReturn = "";
        
        //load all navigation points, tree by tree
        $arrTrees = class_modul_navigation_tree::getAllNavis();
        foreach($arrTrees as $objOneTree) {
            $strReturn .= $this->getText("systemtask_navigationcheck_treescan")." ".$objOneTree->getStrName()."...\n";  
            $strReturn .= $this->processLevel($objOneTree->getSystemid(), 0);    
        }
        
        
        return $this->objToolkit->getPreformatted(array($strReturn));
    }
    
    private function processLevel($intParentId, $intLevel) {
        $strReturn = "";
        $arrNaviPoints = class_modul_navigation_point::getNaviLayer($intParentId);
        foreach($arrNaviPoints as $objOnePoint) {
            for($intI = 0; $intI<=$intLevel; $intI++)
                $strReturn .= "  ";
                 
            $strReturn .= $this->processSinglePoint($objOnePoint);
            $strReturn .= $this->processLevel($objOnePoint->getSystemid(), $intLevel+1);
        }
        
        return $strReturn;
    }

    
    private function processSinglePoint($objPoint) {
        $strReturn = "";
        
        $strReturn .= $objPoint->getStrName()." ";
        
        if($objPoint->getStrPageI() == "" && $objPoint->getStrPageE() == "") {
            $strReturn .= $this->getText("systemtask_navigationcheck_invalidEmpty"); 
        }
        else if($objPoint->getStrPageI() != "" && $objPoint->getStrPageE() != "") {
            $strReturn .= $this->getText("systemtask_navigationcheck_invalidBoth");
        }
        else {
            $strReturn .= $this->getText("systemtask_navigationcheck_valid")." (".$objPoint->getStrPageI(). $objPoint->getStrPageE().")";
            
        }
        
        
        return $strReturn."\n";
    
    }
    
    /**
     * @see interface_admin_systemtask::getAdminForm()
     * @return string 
     */
    public function getAdminForm() {
        return "";
    }
    
}
?> <commit_msg>BUG: waste whitespace at end of file tied up header<commit_after><?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2008 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*                                                                                                       *
*   class_systemtask_navigationcheck.php                                                                *
*   Checks the navigation-points fpr valid internal links                                               *
*                                                                                                       *
*-------------------------------------------------------------------------------------------------------*
*   $Id$                        *
********************************************************************************************************/

//base class and interface
include_once(_adminpath_."/systemtasks/class_systemtask_base.php");
include_once(_adminpath_."/systemtasks/interface_admin_systemtask.php");

include_once(_systempath_."/class_modul_navigation_point.php");
include_once(_systempath_."/class_modul_navigation_tree.php");
include_once(_systempath_."/class_modul_pages_page.php");

/**
 * Checkes the existing navigation-points for valid internal links.
 *
 * @package modul_navigation
 */
class class_systemtask_navigationcheck extends class_systemtask_base implements interface_admin_systemtask {


    /**
     * contructor to call the base constructor
     */
    public function __construct() {
        parent::__construct();
        //set the correct text-base
        $this->setStrTextBase("navigation");
    }
    
    
    /**
     * @see interface_admin_systemtast::getStrInternalTaskName()
     * @return string
     */
    public function getStrInternalTaskName() {
        return "navigationcheck";
    }
    
    /**
     * @see interface_admin_systemtast::getStrTaskName()
     * @return string
     */
    public function getStrTaskName() {
        return $this->getText("systemtask_navigationcheck_name");
    }
    
    /**
     * @see interface_admin_systemtast::executeTask()
     * @return string
     */
    public function executeTask() {
        $strReturn = "";
        
        //load all navigation points, tree by tree
        $arrTrees = class_modul_navigation_tree::getAllNavis();
        foreach($arrTrees as $objOneTree) {
            $strReturn .= $this->getText("systemtask_navigationcheck_treescan")." ".$objOneTree->getStrName()."...\n";  
            $strReturn .= $this->processLevel($objOneTree->getSystemid(), 0);    
        }
        
        
        return $this->objToolkit->getPreformatted(array($strReturn));
    }
    
    private function processLevel($intParentId, $intLevel) {
        $strReturn = "";
        $arrNaviPoints = class_modul_navigation_point::getNaviLayer($intParentId);
        foreach($arrNaviPoints as $objOnePoint) {
            for($intI = 0; $intI<=$intLevel; $intI++)
                $strReturn .= "  ";
                 
            $strReturn .= $this->processSinglePoint($objOnePoint);
            $strReturn .= $this->processLevel($objOnePoint->getSystemid(), $intLevel+1);
        }
        
        return $strReturn;
    }

    
    private function processSinglePoint($objPoint) {
        $strReturn = "";
        
        $strReturn .= $objPoint->getStrName()." ";
        
        if($objPoint->getStrPageI() == "" && $objPoint->getStrPageE() == "") {
            $strReturn .= $this->getText("systemtask_navigationcheck_invalidEmpty"); 
        }
        else if($objPoint->getStrPageI() != "" && $objPoint->getStrPageE() != "") {
            $strReturn .= $this->getText("systemtask_navigationcheck_invalidBoth");
        }
        else {
            $strReturn .= $this->getText("systemtask_navigationcheck_valid")." (".$objPoint->getStrPageI(). $objPoint->getStrPageE().")";
            
        }
        
        
        return $strReturn."\n";
    
    }
    
    /**
     * @see interface_admin_systemtask::getAdminForm()
     * @return string 
     */
    public function getAdminForm() {
        return "";
    }
    
}
?>
{'fraction_non_alphanumeric': 0.2000440383133326, 'fraction_numerical': 0.004624022899922933, 'mean_word_length': 1.6694093446958567, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6745174', 'n_tokens_mistral': 2250, 'n_tokens_neox': 2167, 'n_words': 341}