Example #1
0
 private function _load_wrfl()
 {
     if ($this->device == null) {
         $wurflDir = Yii::getPathOfAlias($this->wurflDir);
         $persistenceDir = Yii::getPathOfAlias($this->persistenceDir);
         $cacheDir = Yii::getPathOfAlias($this->cacheDir);
         require_once realpath($wurflDir . '/Application.php');
         Yii::registerAutoloader(array('WURFL_ClassLoader', 'loadClass'));
         // Create WURFL Configuration
         $wurflConfig = new WURFL_Configuration_InMemoryConfig();
         // Set location of the WURFL File
         $wurflConfig->wurflFile(realpath(Yii::getPathOfAlias($this->wurflFileDir) . '/wurfl.zip'));
         // Set the match mode for the API ('performance' or 'accuracy')
         $wurflConfig->matchMode($this->matchMode);
         // Setup WURFL Persistence
         $wurflConfig->persistence('file', array('dir' => $persistenceDir));
         // Setup Caching
         $wurflConfig->cache('file', array('dir' => $cacheDir, 'expiration' => $this->expiration));
         // Create a WURFL Manager Factory from the WURFL Configuration
         $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
         // Create a WURFL Manager
         /* @var $wurflManager WURFL_WURFLManager */
         $wurflManager = $wurflManagerFactory->create();
         $this->device = $wurflManager->getDeviceForHttpRequest($_SERVER);
     }
 }
Example #2
0
 /**
  * Calls the registerScripts() method
  */
 public function init()
 {
     Yii::import('ext.swiftmailer2.*');
     require dirname(__FILE__) . '/lib/classes/Swift.php';
     Yii::registerAutoloader(array('Swift', 'autoload'));
     require dirname(__FILE__) . '/lib/swift_init.php';
     parent::init();
 }
Example #3
0
 public function render($html, $filename, $attachment = 1, $paper = 'a4', $orientation = 'portrait')
 {
     Yii::import('ext.vendors.pdf.dompdf.*');
     require_once 'dompdf_config.inc.php';
     Yii::registerAutoloader('DOMPDF_autoload');
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper($paper, $orientation);
     $dompdf->render();
     $dompdf->stream($filename . ".pdf", array("Attachment" => $attachment));
 }
Example #4
0
 /**
  * Inits the command and prepares the base environment.
  */
 public function init()
 {
     Yii::app()->interceptor->intercept($this);
     Yii::import('application.vendors.*');
     EZendAutoloader::$prefixes = array('Zend', 'Custom');
     Yii::import("ext.yiiext.components.zendAutoloader.EZendAutoloader", true);
     Yii::registerAutoloader(array("EZendAutoloader", "loadClass"), true);
     ini_set('max_execution_time', 9000);
     ini_set('memory_limit', '1024M');
     date_default_timezone_set("Europe/Berlin");
     error_reporting(E_ALL ^ E_NOTICE);
     #HSetting::InstallBase();
 }
Example #5
0
 public function init()
 {
     parent::init();
     Yii::$classMap['Smarty'] = $this->smartyPath . '/Smarty.class.php';
     Yii::$classMap['Smarty_Internal_Data'] = $this->smartyPath . '/sysplugins/smarty_internal_data.php';
     $this->_smarty = new Smarty();
     $this->_smarty->template_dir = $this->templateDir ? $this->templateDir : Yii::app()->getViewPath();
     $this->_smarty->compile_dir = $this->compileDir ? $this->compileDir : Yii::app()->getRuntimePath() . '/smarty/compile';
     $this->_smarty->cache_dir = $this->cacheDir ? $this->cacheDir : Yii::app()->getRuntimePath() . '/smarty/cache';
     $this->_smarty->left_delimiter = $this->leftDelimiter;
     $this->_smarty->right_delimiter = $this->rightDelimiter;
     $this->_smarty->force_compile = $this->forceCompile;
     Yii::registerAutoloader('smartyAutoload');
 }
Example #6
0
 public function init()
 {
     parent::init();
     if (@class_exists('AmazonS3', true) == false) {
         include_once 'AWSSDKforPHP/sdk.class.php';
     }
     if (@class_exists('AmazonS3', true) == false) {
         throw CException('This extension require AWSSDKforPHP library');
     }
     if (empty($this->key) || empty($this->secret)) {
         throw CException('This extension need access key and secret access key to be set.');
     }
     Yii::import('ext.amazon.components.*');
     Yii::registerAutoloader(array('CFLoader', 'autoloader'));
 }
Example #7
0
 public function init()
 {
     if (!class_exists('Swift', false)) {
         require_once dirname(__FILE__) . '/lib/classes/Swift.php';
         // Register SwiftMailer's autoloader before Yii for correct class loading.
         Yii::registerAutoloader(array('Swift', 'autoload'));
         // Include the SwiftMailer Dependencies
         require_once dirname(__FILE__) . '/lib/dependency_maps/cache_deps.php';
         require_once dirname(__FILE__) . '/lib/dependency_maps/mime_deps.php';
         require_once dirname(__FILE__) . '/lib/dependency_maps/message_deps.php';
         require_once dirname(__FILE__) . '/lib/dependency_maps/transport_deps.php';
         // Load in global library preferences
         require_once dirname(__FILE__) . '/lib/preferences.php';
     }
 }
Example #8
0
 public function init()
 {
     if (!$this->appName) {
         throw new CException('Invalid application name for daemon.');
     }
     if ($this->logFile == '') {
         $this->logFile = implode(DIRECTORY_SEPARATOR, array(Yii::getPathOfAlias('application'), 'runtime', self::LOG_FILE_NAME));
     }
     if (!file_exists($this->logFile)) {
         if (!touch($this->logFile)) {
             throw new CException('Invalid log file ' . $this->logFile);
         }
     }
     Yii::registerAutoloader(array('System_Daemon', 'autoload'));
     System_Daemon::setOptions(array('appName' => $this->appName, 'appDir' => Yii::getPathOfAlias('application'), 'sysMaxExecutionTime' => $this->sysMaxExecutionTime, 'sysMaxInputTime' => $this->sysMaxInputTime, 'sysMemoryLimit' => $this->sysMemoryLimit, 'appRunAsGID' => $this->runAsGID, 'appRunAsUID' => $this->runAsUID, 'logLocation' => $this->logFile));
 }
 /**
  * Component initialization
  */
 public function init()
 {
     parent::init();
     Yii::import('application.vendors.*');
     // need this to avoid Smarty rely on spl autoload function,
     // this has to be done since we need the Yii autoload handler
     if (!defined('SMARTY_SPL_AUTOLOAD')) {
         define('SMARTY_SPL_AUTOLOAD', 0);
     } elseif (SMARTY_SPL_AUTOLOAD !== 0) {
         throw new CException('ESmartyViewRenderer cannot work with SMARTY_SPL_AUTOLOAD enabled. Set SMARTY_SPL_AUTOLOAD to 0.');
     }
     // including Smarty class and registering autoload handler
     require_once 'Smarty/sysplugins/smarty_internal_data.php';
     require_once 'Smarty/Smarty.class.php';
     // need this since Yii autoload handler raises an error if class is not found
     // Yii autoloader needs to be the last in the autoload chain
     spl_autoload_unregister('smartyAutoload');
     Yii::registerAutoloader('smartyAutoload');
     $this->smarty = new Smarty();
     // configure smarty
     if (is_array($this->config)) {
         foreach ($this->config as $key => $value) {
             if ($key[0] != '_') {
                 // not setting semi-private properties
                 $this->smarty->{$key} = $value;
             }
         }
     }
     $this->smarty->_file_perms = $this->filePermission;
     $this->smarty->_dir_perms = $this->directoryPermission;
     $this->smarty->template_dir = '';
     $compileDir = isset($this->config['compile_dir']) ? $this->config['compile_dir'] : Yii::app()->getRuntimePath() . '/smarty/compiled/';
     // create compiled directory if not exists
     if (!file_exists($compileDir)) {
         mkdir($compileDir, $this->directoryPermission, true);
     }
     $this->smarty->compile_dir = $compileDir;
     // no check for trailing /, smarty does this for us
     $this->smarty->plugins_dir[] = Yii::getPathOfAlias('application.extensions.Smarty.plugins');
     if (!empty($this->pluginsDir)) {
         $this->smarty->plugins_dir[] = Yii::getPathOfAlias($this->pluginsDir);
     }
     if (!empty($this->configDir)) {
         $this->smarty->config_dir = Yii::getPathOfAlias($this->configDir);
     }
 }
 function init()
 {
     require Yii::getPathOfAlias($this->twigPathAlias) . '/Autoloader.php';
     Yii::registerAutoloader(array('Twig_Autoloader', 'autoload'), true);
     $app = Yii::app();
     /** @var $theme CTheme */
     $theme = $app->getTheme();
     $this->_paths = array();
     if ($theme !== null) {
         $this->_paths[] = $theme->getBasePath();
     }
     $this->_paths[] = $app->getBasePath();
     $loader = new Twig_Loader_Filesystem($this->_paths);
     $defaultOptions = array('autoescape' => false, 'auto_reload' => true, 'cache' => $app->getRuntimePath() . '/twig_cache/', 'charset' => $app->charset);
     $this->_twig = new Twig_Environment($loader, array_merge($defaultOptions, $this->options));
     // Adding Yii::app() object to globals
     $this->_twig->addGlobal('App', $app);
     // Adding Yii's core static classes proxy as 'C' shortcut (usage: {{C.Html.tag(...)}})
     $this->_twig->addGlobal('C', new ETwigViewRendererYiiCoreStaticClassesProxy());
     // Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}})
     // (@see ETwigViewRendererVoidFunction below for details)
     $this->_twig->addFunction('void', new Twig_Function_Function('ETwigViewRendererVoidFunction'));
     // Adding custom globals (objects or static classes)
     if (!empty($this->globals)) {
         $this->addGlobals($this->globals);
     }
     // Adding custom functions
     if (!empty($this->functions)) {
         $this->addFunctions($this->functions);
     }
     // Adding custom filters
     if (!empty($this->filters)) {
         $this->addFilters($this->filters);
     }
     // Adding custom extensions
     if (!empty($this->extensions)) {
         $this->addExtensions($this->extensions);
     }
     // Change lexer syntax
     if (!empty($this->lexerOptions)) {
         $this->setLexerOptions($this->lexerOptions);
     }
     return parent::init();
 }
Example #11
0
 public function __construct()
 {
     $startTime = microtime(true);
     $xf_path = Yii::getPathOfAlias('webroot') . '/forum';
     Yii::registerAutoloader(array('XenforeLoader', 'autoload'), true);
     XenForo_Autoloader::getInstance()->setupAutoloader($xf_path . '/library');
     XenForo_Application::initialize($xf_path . '/library', $xf_path);
     XenForo_Application::set('page_start_time', $startTime);
     XenForo_Application::disablePhpErrorHandler();
     error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE ^ E_WARNING);
     $dependencies = new XenForo_Dependencies_Public();
     $dependencies->preLoadData();
     XenForo_Session::startPublicSession();
     $this->visitor = XenForo_Visitor::getInstance();
     /*$fc = new XenForo_FrontController(new XenForo_Dependencies_Public());
       ob_start();
       $fc->run();
       $content = ob_get_clean();*/
 }
Example #12
0
 public function __construct()
 {
     /**
      * load config from module
      */
     $module = Yii::app()->getModule('d2mailer');
     $this->fromEmail = $module->fromEmail;
     $this->fromName = $module->fromName;
     $this->smtp_host = $module->smtp_host;
     $this->smtp_port = $module->smtp_port;
     $this->smtp_username = $module->smtp_username;
     $this->smtp_password = $module->smtp_password;
     $this->logging = $module->logging;
     if (class_exists('Swift', false)) {
         return true;
     }
     require_once Yii::getPathOfAlias('swiftMailer') . '/classes/Swift.php';
     Yii::registerAutoloader(array('Swift', 'autoload'));
     require_once Yii::getPathOfAlias('swiftMailer') . '/swift_init.php';
     return true;
 }
 /**
  * Prints a JSON with URL for form action and the needed token, and dies.<br />
  * Used with JSON POST requests.<br />
  * <p>Asks for the following POST fields:
  * <ul>
  *		<li>title</li>
  *		<li>description</li>
  *		<li>category (only one)</li>
  *		<li>keywords (comma-separated)</li>
  * </ul>
  * </p>
  * @return JSON
  */
 public function actionFormData()
 {
     Yii::import('system.collections.*');
     Yii::import('system.base.*');
     Yii::import('ext.*');
     Yii::import('ext.Zend.Gdata.*');
     require_once 'Zend/Loader.php';
     Yii::registerAutoloader(array('Zend_Loader', 'loadClass'));
     $login = Zend_Gdata_ClientLogin::getHttpClient($this->youtubeLogin, $this->youtubePassword, 'youtube', null, Yii::app()->name);
     $login->setHeaders('X-GData-Key', 'key=' . $this->youtubeDevKey);
     $utub = new Zend_Gdata_YouTube($login);
     $video = new Zend_Gdata_YouTube_VideoEntry();
     $media = $utub->newMediaGroup();
     $media->title = $utub->newMediaTitle()->setText($_POST['title']);
     $media->description = $utub->newMediaDescription()->setText($_POST['description']);
     $media->keywords = $utub->newMediaKeywords()->setText($_POST['keywords']);
     $media->category = array($utub->newMediaCategory()->setText($_POST['category'])->setScheme(self::CAT_SCHEME), $utub->newMediaCategory()->setText(preg_replace('/\\s/', '', Yii::app()->name) . 'Site')->setScheme(self::TAG_SCHEME));
     $video->mediaGroup = $media;
     $data = $utub->getFormUploadToken($video);
     exit(json_encode($data));
 }
Example #14
0
 /**
  *
  */
 public function initAutoloader()
 {
     Yii::registerAutoloader(array(__CLASS__, 'autoload'));
 }
Example #15
0
 /**
  * Registers swiftMailer autoloader and includes the required files
  */
 public function registerScripts()
 {
     if (self::$registeredScripts) {
         return;
     }
     self::$registeredScripts = true;
     require dirname(__FILE__) . '/vendors/swiftMailer/classes/Swift.php';
     Yii::registerAutoloader(array('Swift', 'autoload'));
     require dirname(__FILE__) . '/vendors/swiftMailer/swift_init.php';
 }
Example #16
0
 /**
  * Component initialization.
  *
  * This method registers doctrine's autoloaders by pushing them on the
  * current autoloader stack.
  *
  * @return null
  * @see    CApplicationComponent::init()
  */
 public function init()
 {
     $classLoader = new ClassLoader('Doctrine', dirname(__FILE__) . '/vendor');
     \Yii::registerAutoloader(array($classLoader, 'loadClass'));
     $classLoader = new ClassLoader('Symfony', dirname(__FILE__) . '/vendor');
     \Yii::registerAutoloader(array($classLoader, 'loadClass'));
 }
Example #17
0
            } else {
                $this->keys['memory_system_keys'] = true;
                foreach ($this->keys as $k => $v) {
                    $this->memory->rm($this->_key($k));
                }
            }
        }
        $this->keys = array();
        return true;
    }
    function _key($str)
    {
        return $this->prefix . $str;
    }
}
Yii::registerAutoloader(array('core', 'autoload'));
class discuz_application extends discuz_core
{
}
class MobcentDiscuzApp extends discuz_application
{
    public function __construct()
    {
        $this->_initEnv();
    }
    public function init()
    {
        global $_G;
        $_G['siteurl'] = substr($_G['siteurl'], 0, -16);
        $_G['siteroot'] = substr($_G['siteroot'], 0, -16);
        $this->_initUser();
Example #18
0
<?php

date_default_timezone_set('Asia/Shanghai');
// change the following paths if necessary
$yii = dirname(__FILE__) . '/framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
require_once $yii;
$app = Yii::createWebApplication($config);
//========加载phpexcel类=======//
Yii::import('ext.yiiexcel.YiiExcel', true);
Yii::registerAutoloader(array('YiiExcel', 'autoload'), true);
// Optional:
//  As we always try to run the autoloader before anything else, we can use it to do a few
//      simple checks and initialisations
PHPExcel_Shared_ZipStreamWrapper::register();
if (ini_get('mbstring.func_overload') & 2) {
    throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
PHPExcel_Shared_String::buildCharacterSets();
//========加载phpexcel类=======//
$app->run();
<?php

// change the following paths if necessary
$yii = dirname(__FILE__) . '/../framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
require_once $yii;
$app = Yii::createWebApplication($config);
// adding custom Kohana autoloader
Yii::import("application.components.EKohanaAutoloader", true);
EKohanaAutoloader::$paths = array(Yii::getPathOfAlias("application.vendors.Kohana.modules.image"));
Yii::registerAutoloader(array('EKohanaAutoloader', 'loadClass'), true);
$app->run();
Example #20
0
 * HumHub
 * Copyright © 2014 The HumHub Project
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * 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 Affero General Public License for more details.
 */
$yii = dirname(__FILE__) . '/protected/vendors/yii/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
$appClass = dirname(__FILE__) . '/protected/components/WebApplication.php';
// Disable these 3 lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 5);
ini_set('error_reporting', E_ALL);
require_once $yii;
require_once $appClass;
$app = Yii::createApplication('WebApplication', $config);
Yii::import('application.vendors.*');
EZendAutoloader::$prefixes = array('Zend', 'Custom');
Yii::import("ext.yiiext.components.zendAutoloader.EZendAutoloader", true);
Yii::registerAutoloader(array("EZendAutoloader", "loadClass"), true);
$app->run();
Example #21
0
 /**
  * Initialize the plugin
  */
 public function init()
 {
     // Only init once
     if (!$this->getIsInitialized()) {
         // Register the autoloader
         Yii::registerAutoloader(array('GeoCoder', 'autoload'));
         // Initialize the driver
         $this->setDriver($this->api_driver);
         // Cascade
         parent::init();
     }
 }
Example #22
0
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category   PHPExcel
 * @package    PHPExcel
 * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
 * @version    1.7.8, 2012-10-12
 */
/*
PHPExcel_Autoloader::Register();
//	As we always try to run the autoloader before anything else, we can use it to do a few
//		simple checks and initialisations
PHPExcel_Shared_ZipStreamWrapper::register();
*/
Yii::registerAutoloader(array('PHPExcel_Autoloader', 'Register'), true);
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
    throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
PHPExcel_Shared_String::buildCharacterSets();
/**
 * PHPExcel_Autoloader
 *
 * @category	PHPExcel
 * @package		PHPExcel
 * @copyright	Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
 */
class PHPExcel_Autoloader
{
    /**
Example #23
0
<?php

/**
 * This file contains the CTestCase class.
 *
 * @author Qiang Xue <*****@*****.**>
 * @link http://www.yiiframework.com/
 * @copyright Copyright &copy; 2008-2011 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */
require_once 'PHPUnit/Util/Filesystem.php';
// workaround for PHPUnit <= 3.6.11
require_once 'PHPUnit/Autoload.php';
spl_autoload_unregister('phpunit_autoload');
Yii::registerAutoloader('phpunit_autoload');
/**
 * CTestCase is the base class for all test case classes.
 *
 * @author Qiang Xue <*****@*****.**>
 * @version $Id$
 * @package system.test
 * @since 1.1
 */
abstract class CTestCase extends PHPUnit_Framework_TestCase
{
}
<?php

// change the following paths if necessary
$yii = dirname(__FILE__) . '/../framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
require_once $yii;
$app = Yii::createWebApplication($config);
// adding custom Zend Framework autoloader
Yii::import("application.components.EZendAutoloader", true);
Yii::registerAutoloader(array('EZendAutoloader', 'loadClass'), true);
$app->run();
Example #25
0
 function init()
 {
     Yii::registerAutoloader('smartyAutoload');
 }
 /**
  * Registers the Mustache autoloader
  */
 private function registerMustacheAutoloader()
 {
     if ($this->templateType != 'db') {
         return;
     }
     if ($this->mustachePath === null) {
         $this->mustachePath = Yii::getPathOfAlias('vendor.mustache.mustache.src');
     }
     $path = realpath($this->mustachePath);
     if (!$this->mustachePath || !$path) {
         throw new CException('The EmailManager.mustachePath is invalid.');
     }
     require_once $path . '/Mustache/Autoloader.php';
     $autoloader = new Mustache_Autoloader();
     Yii::registerAutoloader(array($autoloader, 'autoload'), true);
 }
Example #27
0
// change the following paths if necessary
$constants = __DIR__ . DIRECTORY_SEPARATOR . 'constants.php';
$yii = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'framework', 'yii.php'));
require_once $constants;
require_once $yii;
Yii::$enableIncludePath = false;
if (YII_DEBUG && X2_TRANSLATION_LOGGING) {
    exec('pwd', $output);
    preg_match('|/home/(.*?)/|', $output[0], $matches);
    $username = '';
    if (isset($matches[1])) {
        $username = $matches[1];
    }
    Yii::$systemuser = $username;
}
Yii::registerAutoloader(array('Yii', 'x2_autoload'));
if (!empty($_SERVER['REMOTE_ADDR'])) {
    $matches = array();
    $indexReq = preg_match('/(.+)index.php/', $_SERVER["REQUEST_URI"], $matches);
    $filename = 'install.php';
    if (file_exists($filename)) {
        header('Location: ' . (!$indexReq ? $_SERVER['REQUEST_URI'] : $matches[1]) . $filename);
        exit;
    }
    $config = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'protected', 'config', 'web.php'));
    Yii::createWebApplication($config)->run();
}
function printR($obj, $die = false)
{
    echo "<pre>" . print_r($obj, true) . "</pre>";
    if ($die) {
Example #28
0
<?php

Yii::import('application.vendors.ezcomponents.*');
require_once "Base/src/base.php";
Yii::registerAutoloader(array('ezcBase', 'autoload'), true);
class CrashReportController extends Controller
{
    /**
     * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
     * using two-column layout. See 'protected/views/layouts/column2.php'.
     */
    public $layout = '//layouts/column2';
    /**
     * @var string the active item for sidebar menu.
     */
    public $sidebarActiveItem = 'CrashReports';
    /**
     * @return array action filters
     */
    public function filters()
    {
        return array('accessControl');
    }
    /**
     * Specifies the access control rules.
     * This method is used by the 'accessControl' filter.
     * @return array access control rules
     */
    public function accessRules()
    {
        return array(array('allow', 'actions' => array('uploadExternal'), 'users' => array('?')), array('allow', 'actions' => array('index', 'view', 'extractFile', 'download', 'viewScreenshot', 'viewScreenshotThumbnail', 'viewVideo', 'uploadStat', 'versionDist', 'osVersionDist', 'geoLocationDist', 'processAgain', 'reprocessMultiple', 'reprocessAll', 'delete', 'deleteMultiple', 'uploadFile'), 'users' => array('@')), array('deny', 'users' => array('*')));
Example #29
0
 /**
  * Registers Raven_Autoloader as an SPL autoloader.
  */
 public static function register()
 {
     Yii::registerAutoloader(array(new self(), 'autoload'), true);
 }
Example #30
-2
 public function actionIndex()
 {
     Yii::import('ext.yiiexcel.YiiExcel', true);
     Yii::registerAutoloader(array('YiiExcel', 'autoload'), true);
     echo "run dump\n";
     $root = dirname(dirname(dirname(__FILE__)));
     $ts = (int) (time() / 1000);
     $filePath = $root . "/download/{$ts}.xlsx";
     if (file_exists($filePath)) {
         echo "Location: /download/{$ts}.xlsx";
         echo "Cache: hit";
         exit;
     }
     $model = new Jmuser('search');
     $model->unsetAttributes();
     // clear any default values
     $model->attributes = array();
     $data = $model->search();
     $data->setPagination(false);
     $objPHPExcel = new PHPExcel();
     $row = 1;
     foreach (Jmuser::fields() as $col => $field) {
         $labels = $model->attributeLabels();
         $name = isset($labels[$field]) ? $labels[$field] : $field;
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $name);
     }
     //var_dump($cnt, $data->getItemCount(),  $data->getTotalItemCount());
     $users = $data->getData(array("order" => "sysID"));
     foreach ($users as $key => $user) {
         echo "{$row}/" . count($users) . " " . $user->oa . "\n";
         $row += 1;
         foreach (Jmuser::fields() as $col => $field) {
             $val = $user->{$field};
             $cell = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col, $row);
             $cell->setValueExplicit($val, PHPExcel_Cell_DataType::TYPE_STRING);
         }
     }
     $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
     $objWriter->save($filePath);
     echo "Location: /downloads/{$ts}.xlsx";
 }