Gibt die Rückgabe des process() von Controller zurück
160038
protected function call() {
    if (isset($this->service) && isset($this->call)) {
      return $this->service->process($this->call);
    }
  }
1296444
public function processar()
    {
        if ($this->isProcessado()) {
            return $this;
        }

        if (method_exists($this, 'init')) {
            call_user_func([$this, 'init']);
        }

        foreach ($this->file as $linha) {
            $inicio = $this->rem(1, 1, $linha);

            if ($inicio == '0') {
                $this->processarHeader($linha);
            } elseif ($inicio == '9') {
                $this->processarTrailer($linha);
            } else {
                $this->incrementDetalhe();
                if ($this->processarDetalhe($linha) === false) {
                    unset($this->detalhe[$this->increment]);
                    $this->increment--;
                }
            }
        }
        if (method_exists($this, 'finalize')) {
            call_user_func([$this, 'finalize']);
        }

        return $this->setProcessado();
    }
443287
public function execute()
	{
		// Incoming task
		$this->_task = strtolower(\Request::getCmd('task', \Request::getWord('layout', '')));

		// Check if the task is in the taskMap
		if (isset($this->_taskMap[$this->_task]))
		{
			$doTask = $this->_taskMap[$this->_task];
		}
		// Check if the default task is set
		elseif (isset($this->_taskMap['__default']))
		{
			$doTask = $this->_taskMap['__default'];
		}
		// Raise an error (hopefully, this shouldn't happen)
		else
		{
			throw new InvalidTaskException(Lang::txt('The requested task "%s" was not found.', $this->_task), 404);
		}

		$name = $this->_controller;
		$layout = preg_replace('/[^A-Z0-9_]/i', '', $doTask);
		if (!$this->_controller)
		{
			$cls = get_class($this);
			// Attempt to parse the controller name from the class name
			if ((ucfirst($this->_name) . 'Controller') != $cls
			 && preg_match('/(\w)Controller(.*)/i', $cls, $r))
			{
				$this->_controller = strtolower($r[2]);
				$name   = $this->_controller;
				$layout = preg_replace('/[^A-Z0-9_]/i', '', $doTask);
			}
			// Namepsaced component
			else if (preg_match('/(.?)Controllers\\\(.*)/i', $cls, $r))
			{
				$this->_controller = strtolower($r[2]);
				$name   = $this->_controller;
				$layout = preg_replace('/[^A-Z0-9_]/i', '', $doTask);
			}
			// No controller name found - single controller component
			else
			{
				$name = $doTask;
			}
		}

		// Instantiate a view with layout the same name as the task
		$this->view = new View(array(
			'base_path' => $this->_basePath,
			'name'      => $name,
			'layout'    => $layout
		));

		// Set some commonly used vars
		$this->view->set('option', $this->_option)
					->set('task', $doTask)
					->set('controller', $this->_controller);

		// Record the actual task being fired
		$doTask .= 'Task';

		// On before do task hook
		$this->_onBeforeDoTask();

		// Call the task
		$this->$doTask();
	}
449487
public function run()
	{
		$context = $this->_getContext();

		$jobManager = MAdmin_Job_Manager_Factory::createManager( $context );
		$criteria = $jobManager->createSearch( true );

		$start = 0;

		do
		{
			$items = $jobManager->searchItems( $criteria );

			foreach( $items as $item )
			{
				try
				{
					$job = $item->getMethod();

					if( preg_match( '/^[a-zA-Z0-9\_]+\.[a-zA-Z0-9\_]+$/', $job ) !== 1 ) {
						throw new Controller_Jobs_Exception( sprintf( 'Invalid characters in job name "%1$s"', $job ) );
					}

					$parts = explode( '.', $job );

					if( count( $parts ) !== 2 ) {
						throw new Controller_Jobs_Exception( sprintf( 'Invalid job method "%1$s"', $job ) );
					}

					$name = "Controller_ExtJS_{$parts[0]}_Factory";
					$method = $parts[1];

					if( class_exists( $name ) === false ) {
						throw new Controller_Jobs_Exception( sprintf( 'Class "%1$s" not available', $name ) );
					}

					$name .= '::createController';

					if( ( $controller = call_user_func_array( $name, array( $context ) ) ) === false ) {
						throw new Controller_Jobs_Exception( sprintf( 'Unable to call factory method "%1$s"', $name ) );
					}

					if( method_exists( $controller, $method ) === false ) {
						throw new Controller_Jobs_Exception( sprintf( 'Method "%1$s" not available', $method ) );
					}

					$result = $controller->$method( (object) $item->getParameter() );

					$item->setResult( $result );
					$item->setStatus( -1 );
				}
				catch( Exception $e )
				{
					$str = 'Error while processing job "%1$s": %2$s';
					$context->getLogger()->log( sprintf( $str, $item->getMethod(), $e->getMessage() ) );
					$item->setStatus( 0 );
				}

				$jobManager->saveItem( $item );
			}

			$count = count( $items );
			$start += $count;
			$criteria->setSlice( $start );
		}
		while( $count > 0 );
	}
1029322
protected function setZero()
	{
	    if (false === $this->boolAllowReset)
	    {
	        return ;
	    }
	    $intCID = preg_replace('@\D@', '', \Input::get('zid')); //  only digits 
	    if ($intCID>0) 
	    {
	        // mal sehen ob ein Startdatum gesetzt war
    	    $objVisitorsDate = \Database::getInstance()
    	            ->prepare("SELECT 
                                    visitors_startdate 
                                FROM 
                                    tl_visitors 
                                WHERE 
                                    id=?")
                    ->execute($intCID);
    	    $objVisitorsDate->next();
    	    if (0 < (int)$objVisitorsDate->visitors_startdate) 
    	    {
    	        // ok es war eins gesetzt, dann setzen wir es wieder
                \Database::getInstance()
                        ->prepare("UPDATE tl_visitors 
                                    SET 
                                        tstamp=?, 
                                        visitors_startdate=? 
                                    WHERE 
                                        id=?")
                        ->execute( time(), strtotime(date('Y-m-d')), $intCID );
    	    }
    	    // und nun die eigendlichen counter
    	    \Database::getInstance()
    	            ->prepare("DELETE FROM tl_visitors_counter WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_blocker WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_browser WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_pages WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_screen_counter WHERE vid=?")
                    ->execute($intCID);
	    }
	    return ;
	}
940472
public function run()
    {
        if (!$this->overrideFile()) {
            $this->output->writeln("<info>File was skipped. The controller was not created.</info>");
            return true;
        }
        $data = $this->getControllerMetaData()->getData();
        $data = array_merge(
            $data,
            [
                'controllerName' => $this->controllerName,
                'namespace' => $this->namespace,
                'basePath' => $this->getBasePath()
            ]
        );
        $content = $this->getTemplateEngine()
            ->parse($this->template)
            ->process($data);
        file_put_contents($this->getControllerFile(), $content);
        return true;
    }
191037
public function run()
    {
        $data       = $this->parseRequestUri();
        $controller = $data['controller'];
        $method     = $data['method'];
        $params     = $data['params'];

        $subModule  = $this->subModule;
        if ("" != $subModule) {
            $subModule = "\\" . $subModule;
        }

        $class      = sprintf("%s\\Controller%s\\%sController", $this->appNameSpace, $subModule, $controller);
        if (!(class_exists($class) && method_exists($class, $method))) {
            $this->fileNotFound();
        } else {
            $class  = new $class;
            $pipe = new Pipeline();
            $pipe->through($class->getMiddleWare())->then(function () use ($class, $method, $params) {
                call_user_func_array(array($class, $method), $params);
            });

            //call_user_func_array(array($class, $method), $params);
        }
    }
1040317
public function actionProcess()
    {
        ini_set("memory_limit", "512M");

        $imaging = \Yii::$app->imaging;
        if (!$imaging) {
            //TODO: можно добавить проверку YII ensure...
            throw new \yii\base\Exception("Component Imaging not found");
        }

        $newFileSrc = \Yii::$app->request->getPathInfo();
        $extension = Imaging::getExtension($newFileSrc);

        if (!$extension) {
            throw new \yii\base\Exception("Extension not found: ".$newFileSrc);
        }


        if (!$imaging->isAllowExtension($extension)) {
            throw new \yii\base\Exception("Extension '{$extension}' not supported in Imaging component");
        }


        $newFile = File::object($newFileSrc);
        $strposFilter = strpos($newFileSrc, "/".Imaging::THUMBNAIL_PREFIX);
        if (!$strposFilter) {
            throw new NotFoundHttpException("This is not a filter thumbnail: ".$newFileSrc);
        }

        $originalFileSrc = substr($newFileSrc, 0, $strposFilter).".".$newFile->getExtension();

        //TODO: hardcode delete it in the future
        $webRoot = \Yii::getAlias('@webroot');

        $originalFileRoot = $webRoot.DIRECTORY_SEPARATOR.$originalFileSrc;
        $newFileRoot = $webRoot.DIRECTORY_SEPARATOR.$newFileSrc;
        $newFileRootDefault = $webRoot.DIRECTORY_SEPARATOR.str_replace($newFile->getBaseName(),
                Imaging::DEFAULT_THUMBNAIL_FILENAME.".".$extension, $newFileSrc);

        $originalFile = new File($originalFileRoot);

        if (!$originalFile->isExist()) {
            throw new NotFoundHttpException("The original file is not found: ".$newFileSrc);
        }

        //Проверено наличие оригинального файла, есть пути к оригиналу, и результирующему файлу.
        //Отслось собрать фильтр, и проверить наличие параметров. А так же проверить разрешены ли эти параметры, для этого в строке есть захэшированный ключь

        $filterSting = substr($newFileSrc, ($strposFilter + strlen(DIRECTORY_SEPARATOR.Imaging::THUMBNAIL_PREFIX)),
            strlen($newFileSrc));
        $filterCode = explode("/", $filterSting);
        $filterCode = $filterCode[0]; //Код фильтра

        //Если указаны парамтры, то ноужно проверить контрольную строчку, и если они не соответствуют ей, то ничего делать не будем
        if ($params = \Yii::$app->request->get()) {
            $pramsCheckArray = explode(DIRECTORY_SEPARATOR, $filterSting);
            if (count($pramsCheckArray) < 3) {
                throw new \yii\base\Exception("the control line not found: ".$newFileSrc);
            }

            $string = $imaging->getParamsCheckString($params);
            if ($pramsCheckArray[1] != $string) {
                throw new \yii\base\Exception("Parameters invalid: ".$newFileSrc);
            }
        }

        $filterClass = str_replace("-", "\\", $filterCode);


        if (!class_exists($filterClass)) {
            throw new \ErrorException("Filter class is not created: ".$newFileSrc);
        }

        /**
         * @var Filter $filter
         */
        $filter = new $filterClass((array)$params);
        if (!is_subclass_of($filter, Filter::className())) {
            throw new NotFoundHttpException("No child filter class: ".$newFileSrc);
        }

        try {
            //Проверяем а создан ли уже файл, и если да то просто делаем на него ссылку.
            $filter
                ->setOriginalRootFilePath($originalFileRoot)
                ->setNewRootFilePath($newFileRootDefault)
                ->save();

            if (PHP_OS === 'Windows') {
                if ($newFileRoot != $newFileRootDefault) {
                    //Не тестировалось
                    copy($newFileRootDefault, $newFileRoot);
                }
            } else {
                if ($newFileRoot != $newFileRootDefault) {
                    symlink($newFileRootDefault, $newFileRoot);
                }
            }

            $url = \Yii::$app->request->getUrl().($params ?
                    ""//"?" . http_build_query($params) . '&sx-refresh'
                    : '?sx-refresh');

            /*Header("HTTP/1.0 200 OK");
            Image::getImagine()->open($newFileRootDefault)->show('png');
            return '';*/

            return \Yii::$app->response->redirect($url, 302);

        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }
1336713
function transform(input, process = () => undefined, finish = () => undefined) {
  if (isStream(input)) {
    return transformRaw(input, {
      async transform(value, controller) {
        try {
          const result = await process(value);
          if (result !== undefined) controller.enqueue(result);
        } catch(e) {
          controller.error(e);
        }
      },
      async flush(controller) {
        try {
          const result = await finish();
          if (result !== undefined) controller.enqueue(result);
        } catch(e) {
          controller.error(e);
        }
      }
    });
  }
  const result1 = process(input);
  const result2 = finish();
  if (result1 !== undefined && result2 !== undefined) return concat([result1, result2]);
  return result1 !== undefined ? result1 : result2;
}
985991
public function jsonDataAction()
    {
        $limit = null; $start = null; $order = 0;
        if ($this->_paging) {
            $limit = $this->getRequest()->getParam('limit');
            $start = $this->getRequest()->getParam('start');
            if (!$limit) {
                if (!is_array($this->_paging) && $this->_paging > 0) {
                    $limit = $this->_paging;
                } else if (is_array($this->_paging) && isset($this->_paging['pageSize'])) {
                    $limit = $this->_paging['pageSize'];
                } else {
                    $limit = $this->_paging;
                }
            }

// wird vermutlich nicht benötigt, da beim ersten laden 'sortInfo' in den metadaten drin ist
// falls es irgendwo benötigt wird wieder einkommentieren
//             $this->view->order = $order;
        }

        //TODO: dieser code sollte in _getOrder liegen
        $order = $this->_defaultOrder;
        if ($this->getRequest()->getParam('sort')) {
            $order['field'] = $this->getRequest()->getParam('sort');
        }
        if ($this->_getParam("direction") && $this->_getParam('direction') != 'undefined') {
            $order['direction'] = $this->_getParam('direction');
        }

        $primaryKey = $this->_primaryKey;

        $rowSet = $this->_fetchData($order, $limit, $start);
        if (!is_null($rowSet)) {
            if (isset($this->_paging['type']) && $this->_paging['type'] == 'Date') {
                //nothing to do, we don't know the total
            } else if ($this->_paging) {
                $this->view->total = $this->_fetchCount();
            } else {
                $this->view->total = sizeof($rowSet);
            }

            $number = 0;
            if ($start) $number = $start;
            $rows = array();
            foreach ($rowSet as $row) {
                $r = array();
                if (is_array($row)) {
                    $row = (object)$row;
                }
                if (!$this->_hasPermissions($row, 'load')) {
                    throw new Kwf_Exception("You don't have the permissions to load this row");
                }
                foreach ($this->_columns as $column) {
                    if ($column instanceof Kwf_Grid_Column_RowNumberer) continue;
                    if ($column->getShowIn() & Kwf_Grid_Column::SHOW_IN_GRID) {
                        $data = $column->load($row, Kwf_Grid_Column::ROLE_DISPLAY, array(
                                                    'number' => $number,
                                                    'total' => $this->view->total,
                                                ));
                        $r[$column->getDataIndex()] = $data;
                    }
                }
                if (!isset($r[$primaryKey]) && isset($row->$primaryKey)) {
                    $r[$primaryKey] = $row->$primaryKey;
                }
                $rows[] = $r;
                $number++;
            }

            $this->view->rows = $rows;
        } else {
            $this->view->total = 0;
            $this->view->rows = array();
        }

        if ($this->getRequest()->getParam('meta')) {
            $this->_appendMetaData();
        }
    }
1062220
protected function setStatViewUpdate()
	{
	    if ($this->bannerCheckBot() === true)
	    {
	        return; //Bot gefunden, wird nicht gezaehlt
	    }
	    if ($this->checkUserAgent() === true)
	    {
	        return ; //User Agent Filterung
	    }
	    
	    // Blocker
	    $lastBanner = array_pop($this->arrBannerData);
	    $BannerID = $lastBanner['banner_id'];
	    if ($BannerID==0)
	    { // kein Banner, nichts zu tun
	        return;
	    }
	    
	    if ( $this->getStatViewUpdateBlockerId($BannerID) === true )
	    {
	        // Eintrag innerhalb der Blockzeit
	        return; // blocken, nicht zählen, raus hier
	    }
	    else
	    {
	        // nichts geblockt, also blocken fürs den nächsten Aufrufs
	        $this->setStatViewUpdateBlockerId($BannerID);
	    }
	    
	    //Zählung, Insert
	    $arrSet = array
	    (
            'id' => $BannerID,
            'tstamp' => time(),
            'banner_views' => 1
	    );
	    $objInsert = \Database::getInstance()->prepare("INSERT IGNORE INTO tl_banner_stat %s")
                                             ->set($arrSet)
                                             ->executeUncached();
	    if ($objInsert->insertId == 0)
	    {
	        //Zählung, Update
	        \Database::getInstance()->prepare("UPDATE 
                                                    `tl_banner_stat` 
                                               SET 
                                                    `tstamp`=?
                                                  , `banner_views` = `banner_views`+1 
                                               WHERE 
                                                    `id`=?")
                                    ->executeUncached(time(), $BannerID);
	    }
	    
	}
310072
public function handleRequest()
    {
        //obsługa danych z POST
        $post = FrontController::getInstance()->getRequest()->getPost();
        //brak posta
        if ($post->isEmpty()) {
            return;
        }
        //niedozwolone na ACL (w edycji na polu operacje)
        if ($this->_checkbox->getGrid()->getColumn('_operation_') && !(new AclAllowed)->aclAllowed($this->_checkbox->getGrid()->getColumn('_operation_')->getOption('editParams'))) {
            return;
        }
        if ($this->_changeRecord($post)) {
            exit;
        }
    }
242029
function run()
    {
        $res = $this->resolve();

        $ctrl = isset($res['controller']) && $res['controller'] !== null ? $res['controller'] : $this->defaultController;
        $action = isset($res['action']) && $res['action'] !== null ? $res['action'] : $this->defaultAction;

        //Name format to Controller namespace
        $tmp = explode('\\', str_replace('/', '\\', $ctrl));
        $ctrl = '\\Controller';
        foreach($tmp as $tmp1){
            $ctrl .= '\\'.ucfirst($tmp1);
        }

        //instantiate the controller
        $controller = new $ctrl(['params' => $res['params'], 'request' => $this->request]);

        $this->params = $res['params'];

        if (method_exists($controller, $action))
            return $controller->$action();
        else
            return $controller->{static::$defaultAction}();
    }
933654
public function work()
    {
        $workerNeed = self::WORKER_MIN * $this->workerMultiplier;
        $workerCount = count($this->workerPool);

        if (
            ($workerCount < $workerNeed && $workerCount < $this->workerMaxCount)
            && !$this->running
        ) {
            // run new worker
            $this->workerRun = $this->workerStarter->start();
            $this->running = time();
        } elseif ($this->running && $this->running < time() - 10) {
            // timeout 10 sec - не удалось запустить воркер
            $this->running = 0;
            if ($this->workerRun->isRunning()) {
                // убиваем запущенный процесс, если он ещё работает
                $this->workerRun->kill();
            }
        }
    }
172504
function main(args, pid) {
  if (args.length <3) {
    console.log('Usage: fuck [you] PROCESS_NAME');
    process.exit(1);
  }

  var pattern   = last(args).get();
  var processes = ps.list();
  var killed    = processes.map(function(data) {
                    return data.filter(match(pid, pattern))
                               .map(kill);
                  });

  killed.chain(sequence(Task)).map(collectUnique).fork(
    function onError(e) {
      console.log('');
      shock('It’s not very effective...');
    },
    function onSuccess(xs) {
      console.log('');
      if (xs.length > 0)
        xs.forEach(function(process){
          rage(flip(process.name), '(x', process.pids.length, ': ', process.pids.join(', '), ')');
        });
      else
        shock('I’ve got nothing on ', pattern);
    }
  );
}
840896
protected function processMapping(Request $request, Response $response) {
        // Pfad fuer die Mappingauswahl ermitteln ...
        $requestPath = '/'.trim(preg_replace('|/{2,}|', '/', $request->getPath()), '/').'/';   // normalize request path
        if ($requestPath=='//') $requestPath = '/';
        // /
        // /controller/action/
        // /module/
        // /module/controller/action/

        $moduleUri = $request->getApplicationBaseUri().$this->module->getPrefix();
        // /
        // /app/
        // /module/
        // /app/module/

        $mappingPath = '/'.substr($requestPath, strlen($moduleUri));
        // /
        // /controller/action/

        // Mapping suchen und im Request speichern
        if (($mapping=$this->module->findMapping($mappingPath)) || ($mapping=$this->module->getDefaultMapping())) {
            $request->setAttribute(ACTION_MAPPING_KEY, $mapping);
            return $mapping;
        }

        // kein Mapping gefunden
        $response->setStatus(HttpResponse::SC_NOT_FOUND);

        if (isset($this->options['status-404']) && $this->options['status-404']=='pass-through')
            return null;

        header('HTTP/1.1 404 Not Found', true, HttpResponse::SC_NOT_FOUND);

        // konfiguriertes 404-Layout suchen
        if ($forward = $this->module->findForward((string) HttpResponse::SC_NOT_FOUND)) {
            // falls vorhanden, einbinden...
            $this->processActionForward($request, $response, $forward);
        }
        else {
            // ...andererseits einfache Fehlermeldung ausgeben
            echo <<<PROCESS_MAPPING_ERROR_SC_404
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>...lamented the MiniStruts.</address>
</body></html>
PROCESS_MAPPING_ERROR_SC_404;
        }
        return null;
    }
639179
public function outputController(): self
    {
        // Do nothing
        if (!$this->controller) {
            return $this;
        }

        /**
         * @var Controller $controller
         */

        // We init every Controller only once
        if (!isset(self::$controllers[$this->controller])) {
            if (!class_exists($this->controller)) {
                $this->controller = str_replace('_', '', $this->controller);
            }

            $controller = new $this->controller($this);
            // Set up shared data
            // Using autowiring for DI
            $reflector = new ReflectionClass($controller);
            // Get arguments
            $controller_arguments = $reflector->getMethod('__construct')->getParameters();
            foreach ($controller_arguments as $argumentIndex => $constructorArgument) {
                // TODO autowire and create dependency container to get classes
                $argument_class_hint = $constructorArgument->getType();
            }

            $controller->setUp();
            self::$controllers[$this->controller] = $controller;
        }
        $method = $this->method;

        if (!method_exists(self::$controllers[$this->controller], $method)) {
            dump('Method "'. $method .'" in class "'. $this->controller .'" not found.');
        }

        // Execute controller method
        $data = self::$controllers[$this->controller]->$method($this->getModifiers());

        // Require file with data
        $method_file = DIR_FRONT_CONTROLLERS . $this->getComponentName() . '.' . $method . '.php';
        if (is_file($method_file)) {
            require_once $method_file;
        }
        // Require file with data in sub folder
        $method_file = DIR_FRONT_CONTROLLERS . $this->getComponentName() . '/' . $method . '.php';
        if (is_file($method_file)) {
            require_once $method_file;
        }

        // Merge returned data
        if ($data) {
            $this->data += $data;
        }

        return $this;
    }