class_STRunRecursive.inc.php 18.7 KB
<?php
/**
 * @file	STRunRecursive.inc.php
 * @category freeSN
 * @mailto	code [at] netz.coop
 * @version 0.4.200901
 * @link http://netz.coop
 * 
 *  @copyright Copyright by netz.coop e.G. 2015
 *  
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
class STRunRecursive extends STTree {
    /**
     *
     * @return
     * @access private
     */
     private static $var_Inbox = null;



    /** Creates $_POST */
    protected function callback_makeNew($param_ary) {
        $var_CASE = array('MCase' => 'makeNew');
        STMANAGEData::setGenCfgSTStd($var_CASE, '1');
        STMANAGEData::setAllTests('  ' . $param_ary['current'] . ' ' . $param_ary['current'] . ' makeNew   ');
        $param_ary['return']['cur']['MCase'] = $var_CASE['MCase'];
        $param_ary['return'] = $this->makeEdithelper($param_ary);
        $param_ary['return'] = $this->dbhelper($param_ary);
        $param_ary['return'] = $this->showSingle($param_ary);
        if ($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'DBXml' | $this->ary_testPar['0']['wichTests'] == 'DB') {
            $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'] = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['testAry']['MTextID'];
            $this->assertTests($param_ary, 'Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
        }
        if ($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'ExpXml' | $this->ary_testPar['0']['wichTests'] == 'Exp') {


            $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'] = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['testAry']['MTextID'];
            //			$var_search_array=$param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['POST'];
            $var_search_array = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check'];
            $var_site = $param_ary['return']['curl'];
            $param_ary['return'] = $this->searchRegExpInArray($var_site, $var_search_array, $param_ary['return'], ' Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
            $var_cfgSTStd = STMANAGEData::getGenCfgSTStd();
            $var_cfgSTStd = $var_cfgSTStd['0'];
            $this->searchForbiddenRegExpInArray($var_site, $var_cfgSTStd['Errors'], $param_ary['return']);
        }
        $this->manageDatahelper($param_ary);
        /**
         * for checking rights with CUrl
         */
        $var_currentElement = STTree::$var_numCurWalkAry;
        $array_currentElement = STTree::$ary_walkFnc[$var_currentElement];
        $array_currentelementConf = STTree::$ary_walkCnf[$var_currentElement];
        /**
         * for tagcloud check
         */
        if ($this->ary_testPar['0']['TestTagcloud'] === 'TRUE') {
            $ary_notInTagcloud = STMANAGEData::getnotInTagcloud();
            if (array_search($param_ary['url']['1'], $ary_notInTagcloud['0']) | array_search($param_ary['url']['0'], $ary_notInTagcloud['0']) | array_search($param_ary['url']['2'], $ary_notInTagcloud['0'])) { //array_search($param_ary['url']['0'],$ary_notInTagcloud['0']) |
            } else {
                $var_tagname = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['TagName'];
                $ary_taginfo = $this->returnTagCategoryItem($var_tagname, null, 'TagID', 'TagName', 'losp_BasisElement_tagnamelist');
                $param_urla = SendReceiveTools::createUrlForCloudCategory($param_ary['url'], $param_ary['return']['cur']['MTextID'], $ary_taginfo['Ident']['ID'], 'Tagcloud');
                if (!STTree::$ary_usedTagCloud['Ident'][$ary_taginfo['Ident']['ID']]) {
                    STTree::$ary_usedTagCloud['Ident'][$ary_taginfo['Ident']['ID']] = $ary_taginfo['Ident']['Name'];
                }
                $varUrlStringa = SendReceiveTools::makeLinkFromGET($param_urla, ' ');
                STTree::$ary_usedTagCloud['Testobj'][$ary_taginfo['Ident']['Name']][$param_urla['0'] . $param_urla['1']][] = array(
                    //					'Subject' => $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['POST']['Subject'],
                    'Subject' => $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check']['Subject'],
                    'url' => $param_urla,
                    'urlstring' => $varUrlStringa,
                    'ID' => $param_ary['return']['cur']['MTextID'],
                    'Case' => $param_ary['url']['0'] . ' ' . $param_ary['url']['1'],
                    'CurWalkAry' => STTree::$var_numCurWalkAry
                );
            }
        }

        /**
         * for category check
         */
        if ($this->ary_testPar['0']['TestCategory'] === 'TRUE') {
            $ary_notInCategory = STMANAGEData::getnotInCategory();
            if (array_search($param_ary['url']['1'], $ary_notInCategory['0']) | array_search($param_ary['url']['0'], $ary_notInCategory['0']) | array_search($param_ary['url']['2'], $ary_notInCategory['0']) | (isset($param_ary['url']['13']) && $param_ary['url']['13']) == 'ThreadBC') {
                
            } else {
                $var_catname = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Category'];
                $ary_taginfoCat = $this->returnTagCategoryItem($var_catname, null, 'BECategoryID', 'BECategoryName', 'losp_BasisElement_categorynamelist');
                $param_urlb = SendReceiveTools::createUrlForCloudCategory($param_ary['url'], $param_ary['return']['cur']['MTextID'], $ary_taginfoCat['Ident']['ID'], 'Category');
                if (!STTree::$ary_usedCategory['Ident'][$ary_taginfoCat['Ident']['ID']]) {
                    STTree::$ary_usedCategory['Ident'][$ary_taginfoCat['Ident']['ID']] = $ary_taginfoCat['Ident']['Name'];
                }
                $varUrlStringb = SendReceiveTools::makeLinkFromGET($param_urlb, ' ');
                STTree::$ary_usedCategory['Testobj'][$ary_taginfoCat['Ident']['Name']][$param_urlb['0'] . $param_urlb['1']][] = array(
                    //					'Subject' => $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['POST']['Subject'],
                    'Subject' => $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check']['Subject'],
                    'url' => $param_urlb,
                    'urlstring' => $varUrlStringb,
                    'ID' => $param_ary['return']['cur']['MTextID'],
                    'Case' => $param_ary['url']['0'] . ' ' . $param_ary['url']['1'],
                    'CurWalkAry' => STTree::$var_numCurWalkAry
                );
            }
        }


        /**
         * check basic rights
         */
        if ($this->ary_testPar['0']['AssertRights'] === 'TRUE') {
            $ary_not_inRights = STMANAGEData::getnotInRightsTest();
            if (!array_search($param_ary['url']['1'], $ary_not_inRights['0'])) {
                $var_numUrl = count($param_ary['url']);
                $ary_stdIn = STMANAGEData::getGenCfgSTStd('0');
                $var_RigthsLevel = ($ary_stdIn['RightsDepthLevel'] * 4) + 1;
                $var_currentElement = STTree::$var_numCurWalkAry;
                $array_currentElement = STTree::$ary_walkFnc[$var_currentElement];
                $array_currentelementConf = STTree::$ary_walkCnf[$var_currentElement];
                $var_num_of_elements = count($array_currentElement) - 1;
                $ary_urlboth = SendReceiveTools::changeUrlForRights($param_ary['url'], $param_ary['return']['cur']['MTextID']);
                $varUrlStringcshow = SendReceiveTools::makeLinkFromGET($ary_urlboth['show'], ' ');
                $varUrlStringcedit = SendReceiveTools::makeLinkFromGET($ary_urlboth['show'], ' ');
                $ary_check = array(
                    'Subject' => $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check']['Subject'],
                    'User' => $ary_stdIn['User2']['profile'],
                    'Urlshow' => $ary_urlboth['show'],
                    'Urledit' => $ary_urlboth['edit'],
                    'Urlshowstring' => $varUrlStringcshow,
                    'Urleditstring' => $varUrlStringcshow,
                    'Write' => $array_currentelementConf['WriteNickName'],
                    'Read' => $array_currentelementConf['ReadNickName'],
                    'Post' => $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check'],
                    'CurWalkAry' => STTree::$var_numCurWalkAry
                );
                if (true && $var_numUrl < $var_RigthsLevel) {//$array_currentelementConf['checkReadRightsTrue'] && $var_numUrl < '5'
                    $ary_checkTrue = $ary_check;
                    $ary_checkTrue['User'] = $ary_stdIn['User3']['profile'];
                    STTree::$ary_checkRights['checkReadRightsTrue'][] = $ary_checkTrue;
                }
                if (true && $var_numUrl < $var_RigthsLevel) { //$array_currentelementConf['checkWriteRightsTrue'] && $var_numUrl < '5'
                    $ary_checkTrue = $ary_check;
                    $ary_checkTrue['User'] = $ary_stdIn['User3']['profile'];
                    STTree::$ary_checkRights['checkWriteRightsTrue'][] = $ary_checkTrue;
                }
                if (true && $var_numUrl < $var_RigthsLevel) {//$array_currentelementConf['checkReadRightsFalse']&& $var_numUrl < '5'
                    STTree::$ary_checkRights['checkReadRightsFalse'][] = $ary_check;
                }
                if (true && $var_numUrl < $var_RigthsLevel) { //$array_currentelementConf['checkWriteRightsFalse']&& $var_numUrl < '5'
                    STTree::$ary_checkRights['checkWriteRightsFalse'][] = $ary_check;
                }
            }
        }
    }

    /**
     *
     * @return
     * @access private
     */
    protected function callback_edit($param_ary) {
        $var_CASE = array('MCase' => 'edit');
        STMANAGEData::setAllTests('  ' . $param_ary['current'] . ' ' . $param_ary['current'] . ' edit   ');
        STMANAGEData::setGenCfgSTStd($var_CASE, '1');
        $param_ary['return']['cur']['MCase'] = $var_CASE['MCase'];
        $param_ary['return'] = $this->makeEdithelper($param_ary);
        $param_ary['return'] = $this->dbhelper($param_ary);
        $param_ary['return'] = $this->showSingle($param_ary);
        if ($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'DBXml' | $this->ary_testPar['0']['wichTests'] == 'DB') {
            $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'] = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['testAry']['MTextID'];
            $this->assertTests($param_ary, ' Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);

            if (isset($param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['TestDesign']) && $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['TestDesign'] == true) {
                $this->assertDesignfromDB($param_ary, 'Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
            }
        }
        if (($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'ExpXml' | $this->ary_testPar['0']['wichTests'] == 'Exp')) {
            $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'] = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['testAry']['MTextID'];
            $var_search_array = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check'];
            $var_site = $param_ary['return']['curl'];
            $param_ary['return'] = $this->searchRegExpInArray($var_site, $var_search_array, $param_ary['return'], ' Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
            $var_cfgSTStd = STMANAGEData::getGenCfgSTStd();
            $var_cfgSTStd = $var_cfgSTStd['0'];
            $this->searchForbiddenRegExpInArray($var_site, $var_cfgSTStd['Errors'], $param_ary['return']);
        }
        $this->manageDatahelper($param_ary);
    }

    /**
     *
     * @return
     * @access private
     */
    protected function callback_remove($param_ary) {
//        D::show($param_ary['current'],'remove',1,1);
        if (array_search($param_ary['current'], STTree::$ary_notInclremove)) {
            self::$ary_walkFncNotTested[$param_ary['current'] . '_remove'] = 'Not in Testsystem right now';
        }
        $var_CASE = array('MCase' => 'remove');
        STMANAGEData::setAllTests('  ' . $param_ary['current'] . ' ' . $param_ary['current'] . ' remove   ');
        STMANAGEData::setGenCfgSTStd($var_CASE, '1');
        $param_ary['return']['cur']['MCase'] = $var_CASE['MCase'];
        $param_ary['return'] = $this->makeEdithelper($param_ary);
        $param_ary['return'] = $this->dbhelper($param_ary);
        if ($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'DBXml' | $this->ary_testPar['0']['wichTests'] == 'DB') {
            
        }
        $param_ary['return'] = $this->manageDatahelper($param_ary);
    }

    protected function callback_Menu_newMessage($param_ary) {




        if($param_ary['current'] == 'InBox'){

            return;
//                D::show($param_ary,'$param_directAryPath INBOX',1,1);
        }elseif($param_ary['current'] == 'OutBox' ){
        
        $var_Inbox = 1;
        $var_CASE = array('MCase' => 'newMessage');
        STMANAGEData::setGenCfgSTStd($var_CASE, '1');
        STMANAGEData::setAllTests('  ' . $param_ary['current'] . ' ' . $param_ary['current'] . ' newMessage   ');
        $param_ary['return']['cur']['MCase'] = $var_CASE['MCase'];
        $param_ary['return'] = $this->makeEdithelper($param_ary);
        $param_ary['return'] = $this->dbhelper($param_ary);
        $param_ary['return'] = $this->showSingle($param_ary);




        if ($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'DBXml' | $this->ary_testPar['0']['wichTests'] == 'DB') {

            $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'] = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['testAry']['MTextID'];
//            D::show($param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'],'jalla',1,1);
            $this->assertTests($param_ary, 'Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
        }
        if ($this->ary_testPar['0']['wichTests'] == 'All' | $this->ary_testPar['0']['wichTests'] == 'DBExp' | $this->ary_testPar['0']['wichTests'] == 'ExpXml' | $this->ary_testPar['0']['wichTests'] == 'Exp') {


            $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['MTextID'] = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['testAry']['MTextID'];
            //			$var_search_array=$param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['POST'];
            $var_search_array = $param_ary['return'][$param_ary['return']['cur']['MCase']][$param_ary['return']['cur']['BC']][$param_ary['return']['cur']['MT']]['Check'];
            /**
             * Sender
             *  */
            $var_site = $param_ary['return']['curl'];
             $param_ary['return']['cur']['comment']='Outbox -> Sender';
            $param_ary['return'] = $this->searchRegExpInArray($var_site, $var_search_array, $param_ary['return'], ' Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
            /**
             * Empfänger
             */
            $var_site2 = $param_ary['return']['curl2'];
             $param_ary['return']['cur']['comment']='Inbox ->Recipient';
            $param_ary['return2'] = $this->searchRegExpInArray($var_site2, $var_search_array, $param_ary['return'], ' Method: ' . __METHOD__ . ' Zeile: ' . __LINE__);
            unset($param_ary['cur']['comment']);

            $var_cfgSTStd = STMANAGEData::getGenCfgSTStd();
            $var_cfgSTStd = $var_cfgSTStd['0'];
            $param_ary['return']['cur']['comment']='Outbox -> Sender';
            $this->searchForbiddenRegExpInArray($var_site, $var_cfgSTStd['Errors'], $param_ary['return']);
          //  D::show($var_site2,'$var_site2',1,1);
            $param_ary['return']['cur']['comment']='Inbox ->Recipient';
            $this->searchForbiddenRegExpInArray($var_site2, $var_cfgSTStd['Errors'], $param_ary['return']);
            unset($param_ary['return']['cur']['comment']);
        }
        $this->manageDatahelper($param_ary);

            //    D::show($param_ary,'$param_directAryPath OutBox',1,1);
        }
		
    }

}
?>