[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

/ -> task.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://mybb.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id: task.php 5683 2011-11-29 15:02:41Z Tomm $
  10   */
  11   
  12  ignore_user_abort(true);
  13  @set_time_limit(0);
  14  
  15  define("IN_MYBB", 1);
  16  define("NO_ONLINE", 1);
  17  define("IN_TASK", 1);
  18  define('THIS_SCRIPT', 'task.php');
  19  
  20  require_once dirname(__FILE__)."/inc/init.php";
  21  
  22  // Load language
  23  $lang->set_language($mybb->settings['bblanguage']);
  24  $lang->load("global");
  25  $lang->load("messages");
  26  
  27  if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset']))
  28  {
  29      @mb_internal_encoding($lang->settings['charset']);
  30  }
  31  
  32  require_once  MYBB_ROOT."inc/functions_task.php";
  33  
  34  // Are tasks set to run via cron instead & are we accessing this file via the CLI?
  35  // php task.php [tid]
  36  if(PHP_SAPI == "cli")
  37  {
  38      // Passing a specific task ID
  39      if($_SERVER['argc'] == 2)
  40      {
  41          $query = $db->simple_select("tasks", "tid", "tid='".intval($_SERVER['argv'][1])."'");
  42          $tid = $db->fetch_field($query, "tid");
  43      }
  44  
  45      if($tid)
  46      {
  47          run_task($tid);
  48      }
  49      else
  50      {
  51          run_task();
  52      }
  53  }
  54  // Otherwise false GIF image, only supports running next available task
  55  else
  56  {
  57      // Send our fake gif image (clear 1x1 transparent image)
  58      header("Content-type: image/gif");
  59      echo base64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
  60      
  61      // If the use shutdown functionality is turned off, run any shutdown related items now.
  62      if($mybb->use_shutdown == true)
  63      {
  64          add_shutdown("run_task");
  65      }
  66      else
  67      {
  68          run_task();
  69      }
  70  }
  71  ?>


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1