/**
  *	The execute function will start the YDExecutor class and process the request.
  */
 function execute()
 {
     // Do nothing if we already processed a request
     if (defined('YD_REQ_PROCESSED')) {
         return;
     }
     // Construct the name of the request class
     $clsName = basename($this->_file, YD_SCR_EXT);
     $this->clsInst = new $clsName();
     // Check if the object a YDRequest object
     if (!YDObjectUtil::isSubClass($this->clsInst, 'YDRequest')) {
         $ancestors = YDObjectUtil::getAncestors($this->clsInst);
         trigger_error('Class "' . $clsName . '" should be derived from the YDRequest class. Currently, this class has the ' . 'following ancestors: ' . implode(' -> ', $ancestors), YD_ERROR);
     }
     // Check if the class is properly initialized
     if ($this->clsInst->isInitialized() != true) {
         trigger_error('Class "' . $clsName . '" is not initialized properly. Make  sure loaded the base class YDRequest ' . 'and initialized it.', YD_ERROR);
     }
     // Only if authentication is required
     if ($this->clsInst->getRequiresAuthentication()) {
         $result = $this->clsInst->isAuthenticated();
         if ($result) {
             $this->clsInst->authenticationSucceeded();
         } else {
             $this->clsInst->authenticationFailed();
             $this->finish();
         }
     }
     // Get the action name
     $action = 'action' . $this->clsInst->getActionName();
     // Check if the action exists
     if (!$this->clsInst->hasMethod($action)) {
         $this->clsInst->errorMissingAction($action);
         $this->finish();
     }
     // Check if the current action is allowed or not and execute errorActionNotAllowed if failed
     if (!$this->clsInst->isActionAllowed()) {
         $this->clsInst->errorActionNotAllowed();
         $this->finish();
     }
     // Process the request
     $this->clsInst->process();
     $this->finish();
 }
 /**
  *	Function to get all the ancestors of a class. The list will contain the parent class first, and then it's
  *	parent class, etc. You can pass both the name of the class or an object instance to this function
  *
  *	@param $classname	Name of the class or object.
  *
  *	@returns	Array with all the ancestors.
  */
 function getAncestors($classname)
 {
     if (is_object($classname)) {
         $classname = strtolower(get_class($classname));
     }
     $ancestors = array();
     $father = get_parent_class($classname);
     if ($father != '') {
         $ancestors = YDObjectUtil::getAncestors($father);
         $ancestors[] = $father;
     }
     return array_reverse($ancestors);
 }
 function actionDefault()
 {
     YDDebugUtil::dump(YDObjectUtil::getAncestors($this), 'ancestors of this request:');
 }
 /**
  *	Function to get all the ancestors of this class. The list will contain the parent class first, and then it's
  *	parent class, etc. You can pass both the name of the class or an object instance to this function
  *
  *	@returns	Array with all the ancestors.
  */
 function getAncestors()
 {
     return YDObjectUtil::getAncestors($this->getClassName());
 }