Example #1
0
 protected function plugin()
 {
     // functions used as part of constructor
     Mock::wpPassthruFunction('untrailingslashit');
     Mock::wpFunction('plugin_dir_path', array('args' => bootstrap()->get_framework_path() . '/woocommerce/class-sv-wc-plugin.php', 'return' => bootstrap()->get_framework_path() . '/woocommerce'));
     Mock::wpFunction('is_admin', array('return' => true));
     Mock::wpPassthruFunction('plugin_basename');
     Mock::wpFunction('has_action', array('return' => true));
     $args = array('mock', '7.7.7', 'woocommerce-mock', 'args' => array('dependencies' => 'json', 'function_dependencies' => 'ftp_ssl_connect'));
     return $this->getMockBuilder('SV_WC_Plugin')->setConstructorArgs($args)->getMockForAbstractClass();
 }
Example #2
0
/**
 * Perform preflight checks for Mercator
 *
 * Checks that we can actually run SSO, then attaches the relevant actions
 * and filters to make it useful.
 */
function run_preflight()
{
    if (!is_enabled()) {
        return;
    }
    // Check for COOKIE_DOMAIN definition
    //
    // Note that this can't be an admin notice, as you'd never be able to log in
    // to see it.
    if (defined('COOKIE_DOMAIN')) {
        status_header(500);
        header('X-Mercator: COOKIE_DOMAIN');
        wp_die('The constant <code>COOKIE_DOMAIN</code> is defined (probably in <code>wp-config.php</code>). Please remove or comment out that <code>define()</code> line.');
    }
    // E: There's no reason to become alarmed, and we hope you'll enjoy the
    //    rest of your flight.
    //
    // E: By the way, is there anyone on board who knows how to fly a plane?
    bootstrap();
}
Example #3
0
 * @package     Filter Search Community Edition
 * @version 	   v2.1 Final
 *
 */
function bootstrap()
{
    if (isset($_GET['act'])) {
        include realpath(dirname(__FILE__) . '/../../../../') . '/config/config.inc.php';
        include realpath(dirname(__FILE__) . '/../../../../') . '/init.php';
        if (!class_exists('ProCoreApi', FALSE)) {
            include realpath(dirname(__FILE__) . '/../../libraries/') . '/procore.api.php';
        }
        if (!class_exists('FilterSearch', FALSE)) {
            include realpath(dirname(__FILE__) . '/../../modules/') . '/filtersearch/filtersearch.module.php';
        }
        $api = new ProCoreApi();
        $filter = new FilterSearch(TRUE);
        $page = isset($_GET['page']) ? $_GET['page'] : 1;
        $perpage = isset($_GET['page']) ? $_GET['perpage'] : 10;
        $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'newest';
        $orderway = isset($_GET['orderway']) ? $_GET['orderway'] : 'desc';
        if ($_GET['act'] == 'filter') {
            $output = $filter->performSearch($smarty, $page, $perpage, $orderby, $orderway);
        } elseif ($_GET['act'] == 'tabs') {
            $output = array('tabs' => $filter->sortByTabs($smarty));
        }
        return json_encode($output);
    }
}
print bootstrap();
Example #4
0
/**
 * Set HTTP headers in preparation for a page response.
 *
 * TODO: Figure out caching
 */
function ariPageHeader()
{
    bootstrap();
}
<?php

/**
 * This file is part of the sfSearch package.
 * (c) Carl Vondrick <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require dirname(__FILE__) . '/../bootstrap/functional.php';
bootstrap('frontend');
$b = new xfTestBrowser();
$b->getAndCheck('search', 'search')->checkResponseElement('title', 'Search')->checkResponseElement('h2', 'Search', array('position' => 0))->checkResponseElement('form[method="get"]', true)->checkResponseElement('form label[for="search_query"]', 'Query')->checkResponseElement('form input[id="search_query"]', true)->checkResponseElement('form input[type="submit"]', true);
<?php

include "lib/_inc.php";
class CameraController extends Controller
{
    public function index()
    {
        return $this->renderView("camera/index", array("page" => "camera", "streamUrl" => Storage::get("camera")->streamUrl));
    }
}
bootstrap(CameraController::class);
    print "FATAL: You must be in group 'fossy' to update the FOSSology database.\n";
    exit(1);
}
/* Initialize the program configuration variables */
$SysConf = array();
// fo system configuration variables
$PG_CONN = 0;
// Database connection
$Plugins = array();
/* defaults */
$Verbose = false;
$DatabaseName = "fossology";
$UpdateLiceneseRef = false;
$sysconfdir = '/usr/local/etc/fossology';
/* Set SYSCONFDIR and set global (for backward compatibility) */
$SysConf = bootstrap($sysconfdir);
// don't think we want all the other common libs
require_once "{$MODDIR}/lib/php/common.php";
/* Initialize global system configuration variables $SysConfig[] */
ConfigInit($SYSCONFDIR, $SysConf);
/* migration */
require_once "./dbmigrate_2.1-2.2.php";
print "Migrate data from 2.1 to 2.2 \n";
Migrate_21_22($Verbose);
exit(0);
/************************************************/
/******  From src/lib/php/bootstrap.php  ********/
/** Included here so that fossinit can run from any directory **/
/**
 * \brief Bootstrap the fossology php library.
 *  - Determine SYSCONFDIR
Example #8
0
 *  Sample Output:
 *   $ ./regressiontest.php -w "http://bobg.fc.hp.com/trunk"
 *   Regression found: Baseline is regression/good//?mod=browse&upload=1&item=1, new content is regression/output_29370/?mod=browse&upload=1&item=1
 *   Total files checked: 3
 *   No regression in: 2
 *   Regression found in: 1
 */
// $DATAROOTDIR and $PROJECT come from Makefile
//require_once "$DATAROOTDIR/$PROJECT/lib/php/bootstrap.php";
require_once "/usr/local/share/fossology/lib/php/bootstrap.php";
$SysConf = array();
// fo system configuration variables
$PG_CONN = 0;
// Database connection
/* Set SYSCONFDIR and set global (for backward compatibility) */
$SysConf = bootstrap();
/* Initialize global system configuration variables $SysConfig[] */
ConfigInit($SYSCONFDIR, $SysConf);
/* Directories */
$GoodDir = "regression/good/";
$PostDir = "regression/post/";
$OutputDirTemplate = "regression/output_";
/* output dir is suffixed with pid */
$OutputDir = $OutputDirTemplate . posix_getpid();
/*  -h webhost
 */
$Options = getopt("hw:");
if (array_key_exists('h', $Options)) {
    Usage($argc, $argv);
    exit(0);
}
<?php

include "lib/_inc.php";
use matuck\DelugeApi\Client\HTTPClient;
class TorrentController extends Controller
{
    public function add()
    {
        $page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
        $order = isset($_GET["order"]) ? $_GET["order"] : "date_added";
        $search = isset($_GET["q"]) ? $_GET["q"] : null;
        return $this->renderView("torrent/add", array("movies" => YTS::getMovies($page, 8, $order, "desc", $search), "page" => $page, "order" => $order, "search" => $search));
    }
    public function download()
    {
        $contents = Http::get($_GET["url"]);
        $fileInfo = new SplFileInfo($_GET["fname"]);
        // Add the torrent to deluge using the RPC api
        $tconfig = Storage::get("torrents");
        $client = new HTTPClient((array) $tconfig->deluge);
        $client->core->add_torrent_file($tconfig->dropPath . "/" . $fileInfo->getFilename() . ".torrent", base64_encode($contents), null);
        return $this->redirect("/?alert=" . urlencode("Torrent download started"));
    }
    public function dashboard()
    {
        return $this->renderView("torrent/dashboard");
    }
}
bootstrap(TorrentController::class);
Example #10
0
<?php

// $Id$
/**
 * 脚本开始运行时间
 */
define('DIDA_START_TIME', microtime(true));
/**
 * 工作目录
 * 建议包含文件,使用绝对路径。
 */
define('DIDA_ROOT', getcwd());
require_once DIDA_ROOT . '/includes/bootstrap.inc';
// 程序初始化
bootstrap('full');
// 获取当前路径($_GET['q'])输出
$return = menu_get_item();
// 针对当前路径,所有模块输出完成,触发 hook_exit()
module_invoke_all('exit', 'full');
if (is_int($return)) {
    switch ($return) {
        case MENU_ACCESS_DENIED:
            // 无权限访问
            dd_get_access();
            break;
        case MENU_NOT_FOUND:
            // 路径未定义
            dd_get_not();
    }
    exit;
}
Example #11
0
<?php

include "lib/_inc.php";
use matuck\DelugeApi\Client\HTTPClient;
class DashboardController extends Controller
{
    private function _getTorrents()
    {
        $tconfig = Storage::get("torrents");
        $client = new HTTPClient((array) $tconfig->deluge);
        return $client->core->get_torrents_status([], ["name", "total_size", "files", "progress"]);
    }
    public function index()
    {
        return $this->renderView("dashboard/index", array("volumes" => Storage::get("volumes"), "torrents" => $this->_getTorrents(), "page" => "dashboard", "alertEnabled" => isset($_GET["alert"]), "alertText" => isset($_GET["alert"]) ? urldecode($_GET["alert"]) : null));
    }
}
bootstrap(DashboardController::class);
Example #12
0
        break;
    case 'cli-server':
        if (is_file($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) {
            return FALSE;
        }
        header('HTTP/1.0 500 Internal Server Error');
        $_SERVER['SCRIPT_URL'] = substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], '?#'));
        $_SERVER['SERVER_PROFILE'] = getenv('SERVER_PROFILE');
        define('STDIN', fopen('php://stdin', 'rb'));
        define('STDOUT', fopen('php://stdout', 'wb'));
        define('STDERR', fopen('php://stderr', 'wb'));
        break;
    default:
        header('HTTP/1.0 500 Internal Server Error');
}
ini_set('error_prepend_string', '<xmp>');
ini_set('error_append_string', '</xmp>');
ini_set('html_errors', 0);
// Bootstrap
if (!(include __DIR__ . DIRECTORY_SEPARATOR . 'lang.base.php')) {
    trigger_error('[bootstrap] Cannot determine boot class path', E_USER_ERROR);
    exit(0x3d);
}
// Set up class path
$paths = array();
$scan = explode(PATH_SEPARATOR . PATH_SEPARATOR, get_include_path());
foreach (explode(PATH_SEPARATOR, $scan[0]) as $path) {
    $paths[] = '~' === $path[0] ? str_replace('~', $webroot, $path) : $path;
}
bootstrap(scanpath($paths, $webroot) . (isset($scan[1]) ? $scan[1] : ''));
exit(\xp\scriptlet\Runner::main(array($webroot, $configd, $_SERVER['SERVER_PROFILE'], $_SERVER['SCRIPT_URL'])));
Example #13
0
/**
 * Set HTTP headers in preparation for a page response.
 *
 * TODO: Figure out caching
 */
function ariPageHeader()
{
    header('Content-type: text/html; charset=utf-8');
    bootstrap();
}
Example #14
0
    case 'cli-server':
        if (is_file($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) {
            return FALSE;
        }
        header('HTTP/1.0 500 Internal Server Error');
        $_SERVER['SCRIPT_URL'] = substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], '?#'));
        $_SERVER['SERVER_PROFILE'] = getenv('SERVER_PROFILE');
        define('STDIN', fopen('php://stdin', 'rb'));
        define('STDOUT', fopen('php://stdout', 'wb'));
        define('STDERR', fopen('php://stderr', 'wb'));
        break;
    default:
        header('HTTP/1.0 500 Internal Server Error');
}
ini_set('error_prepend_string', '<xmp>');
ini_set('error_append_string', '</xmp>');
ini_set('html_errors', 0);
// Bootstrap
if (!(include __DIR__ . DIRECTORY_SEPARATOR . 'lang.base.php')) {
    trigger_error('[bootstrap] Cannot determine boot class path', E_USER_ERROR);
    exit(0x3d);
}
// Set up class path
$paths = array();
list($use, $include) = explode(PATH_SEPARATOR . PATH_SEPARATOR, get_include_path());
foreach (explode(PATH_SEPARATOR, $use) as $path) {
    $paths[] = '~' == $path[0] ? str_replace('~', $webroot, $path) : $path;
}
bootstrap(scanpath($paths, $webroot) . $include);
uses('xp.scriptlet.Runner');
exit(xp·scriptlet·Runner::main(array($webroot, $configd, $_SERVER['SERVER_PROFILE'], $_SERVER['SCRIPT_URL'])));
Example #15
0
    }
    public function markdownfile($data, $file)
    {
        $parser = new \cebe\markdown\GithubMarkdown();
        $parser->html5 = true;
        $data["contents"] = $parser->parse(file_get_contents($file->getRealPath()));
        return $this->renderView("file/text", $data);
    }
    public function excelFile($data, $file)
    {
        try {
            $inputFileType = PHPExcel_IOFactory::identify($file->getRealPath());
            $objReader = PHPExcel_IOFactory::createReader("Excel2007");
            $objReader->setReadDataOnly(true);
            $objPHPExcel = $objReader->load($file->getRealPath());
        } catch (Exception $e) {
            exit("Error loading file..");
        }
        $sheet = $objPHPExcel->getSheet(0);
        $highestRow = $sheet->getHighestRow();
        $highestColumn = $sheet->getHighestColumn();
        $rows = [];
        for ($row = 1; $row <= $highestRow; $row++) {
            $rows[] = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, null, true, false)[0];
        }
        $data["rows"] = array("headers" => array_shift($rows), "data" => $rows);
        return $this->renderView("file/table", $data);
    }
}
bootstrap(FileController::class);
Example #16
0
$settings['enabled_modules'] = array('admin', 'user', 'schemaManager', 'fieldManager', 'themer', 'fileManager');
$settings['installed_modules'] = array('admin', 'user', 'schemaManager', 'fieldManager', 'themer', 'fileManager');
$settings['module_versions'] = array('admin' => '.1', 'user' => '.1', 'schemaManager' => '.3', 'fieldManager' => '.2', 'fileManager' => '.3', 'themer' => '.1');
$settings['module_data']['admin']['path'] = 'modules/admin/';
$settings['module_data']['user']['path'] = 'modules/user/';
$settings['module_data']['schemaManager']['path'] = 'modules/schemaManager/';
$settings['module_data']['fieldManager']['path'] = 'modules/fieldManager/';
$settings['module_data']['fileManager']['path'] = 'modules/fileManager/';
$settings['module_data']['themer']['path'] = 'modules/themer/';
$settings['home_page'] = 'user/login';
$settings['default_theme'] = 'default';
$settings['clean_urls'] = FALSE;
$settings['footer_message'] = "running_on_agave();";
$settings['sess_method'] = 'database';
//ROUTE INSTALL PROCESS
if (bootstrap()) {
    $mode = $_SESSION['install-mode'];
    if (!isset($mode)) {
        install_begin();
    } else {
        switch ($mode) {
            case 'core':
                install_core();
                break;
            case 'user':
                install_user();
                break;
            case 'info':
                install_site_info();
                break;
            case 'finish':
Example #17
0
 */
function bootstrap($configuration_array)
{
    $config = new \Pste\Config($configuration_array);
    \Pste\Registry::getInstance()->config = $config;
    $route = new \Pste\Route();
    $route->setTemplatePath($config->template);
    \Pste\Registry::getInstance()->route = $route;
}
function __autoload($class)
{
    $nsSplit = explode('\\', $class);
    if (count($nsSplit) >= 2 && $nsSplit[0] == 'Pste') {
        if (count($nsSplit) == 3) {
            // some special rules for components and models
            if ($nsSplit[1] == 'Component') {
                require_once 'components/' . $nsSplit[2] . '.php';
            } else {
                if ($nsSplit[1] == 'Model') {
                    require_once 'models/' . $nsSplit[2] . '.php';
                } else {
                    require_once implode('/', $nsSplit) . '.php';
                }
            }
        } else {
            require_once implode('/', $nsSplit) . '.php';
        }
    }
}
bootstrap($CONF);
Example #18
0
if ('cgi' === PHP_SAPI || 'cgi-fcgi' === PHP_SAPI) {
    ini_set('html_errors', 0);
    define('STDIN', fopen('php://stdin', 'rb'));
    define('STDOUT', fopen('php://stdout', 'wb'));
    define('STDERR', fopen('php://stderr', 'wb'));
} else {
    if ('cli' !== PHP_SAPI) {
        trigger_error('[bootstrap] Cannot be run under ' . PHP_SAPI . ' SAPI', E_USER_ERROR);
        exit(0x3d);
    }
}
if (!(include __DIR__ . DIRECTORY_SEPARATOR . 'lang.base.php')) {
    trigger_error('[bootstrap] Cannot determine boot class path', E_USER_ERROR);
    exit(0x3d);
}
$home = getenv('HOME');
list($use, $include) = explode(PATH_SEPARATOR . PATH_SEPARATOR, get_include_path());
bootstrap(scanpath(explode(PATH_SEPARATOR, substr($use, 2) . PATH_SEPARATOR . '.'), $home) . $include);
uses('util.cmd.ParamString', 'util.cmd.Console');
ini_set('error_prepend_string', EPREPEND_IDENTIFIER);
set_exception_handler('__except');
ob_start('__output');
array_shift($_SERVER['argv']);
try {
    exit(XPClass::forName($argv[1])->getMethod('main')->invoke(NULL, array(array_slice($argv, 2))));
} catch (SystemExit $e) {
    if ($message = $e->getMessage()) {
        echo $message, "\n";
    }
    exit($e->getCode());
}
            }
        }
        $folder = new DirectoryIterator($volume->path . $root);
        $files = array();
        foreach ($folder as $file) {
            if ($file->isDot()) {
                continue;
            }
            $icon = "file-o";
            $iconMap = array("pdf" => "file-pdf-o", "jpg" => "file-image-o", "png" => "file-image-o", "jpeg" => "file-image-o", "gif" => "file-image-o", "bmp" => "file-image-o", "php" => "file-code-o", "xml" => "file-code-o", "html" => "file-code-o", "cs" => "file-code-o", "js" => "file-code-o", "ts" => "file-code-o", "xls" => "file-excel-o", "xlsx" => "file-excel-o", "doc" => "file-word-o", "docx" => "file-word-o", "ppt" => "file-powerpoint-o", "pptx" => "file-powerpoint-o", "mp3" => "file-audio-o", "mpeg" => "file-audio-o", "flac" => "file-audio-o", "txt" => "file-text-o");
            if ($file->isDir()) {
                $icon = "folder-o";
            } else {
                if (isset($iconMap[$file->getExtension()])) {
                    $icon = $iconMap[$file->getExtension()];
                }
            }
            $files[] = array("name" => $file->getBasename(), "type" => $file->isDir() ? "dir" : "file", "icon" => $icon, "path" => $root . $file->getFilename(), "is_image" => strrpos($icon, "image") > -1);
        }
        usort($files, function ($a, $b) {
            return $b["type"] === "dir";
        });
        $up_path = pathinfo($root)["dirname"];
        if (substr($up_path, strlen($up_path) - 1, 1) !== "/") {
            $up_path .= "/";
        }
        return $this->renderView("volume/details", array("volume" => $volume, "page" => "volume", "files" => $files, "path" => $root, "up_path" => $up_path));
    }
}
bootstrap(VolumeController::class);
Example #20
0
header('Content-Type: text/plain; charset=utf8');
if (version_compare('5.5.0', PHP_VERSION, '<=')) {
    exit('Версия PHP: ' . PHP_VERSION . ' необходимо 5.5.0 и ниже.');
}
define('CURRENT_VERSION', '1.1.beta');
$config = array();
$config_js = array();
$menu = array();
$user = new stdClass();
define('DROOT', __DIR__);
include DROOT . '/config.php';
$config = !empty($config[$_SERVER['HTTP_HOST']]) ? $config[$_SERVER['HTTP_HOST']] : $config['default'];
$request_path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
include DROOT . '/tools/common.php';
include DROOT . '/src/menu.php';
bootstrap();
if ($request_path != FALSE) {
    $args = explode('/', $request_path);
    $data = array();
    $item = get_menu();
    if ($item === FALSE) {
        header('HTTP/1.1 404 Not Found');
        exit;
    }
    menu_execute($item);
    ob_clean();
    header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
    header('Cache-Control: post-check=0, pre-check=0', FALSE);
    header('Pragma: no-cache');
    header('Content-Type: application/javascript; charset=utf8');
    exit(json_encode($data));
Example #21
0
<?php

//for single installation projects - fill these in
//$settings['proj_root'] = "sites/localhost.agave/";
//$settings['proj_url'] = "http://localhost/agave/";
//Added useless comment
require './core/bootstrap.inc';
agave_timer_start();
$status = bootstrap();
switch ($status) {
    case SITE_NOT_FOUND:
        site_not_found();
        break;
    case SITE_OFFLINE:
        site_offline();
        break;
    case ACCESS_DENIED:
        agave_error_page("403");
        break;
    case DESTINATION_UNKNOWN:
        agave_error_page("404");
        break;
    case VALID_REQUEST:
        $output = $GLOBALS['objects']['dispatcher']->route($agave->uri);
        //TODO: change request functions to RETURN output, rather than set globally
        //assemble final page output with an invoke to 'page_render'
        if (!empty($GLOBALS['objects']['themer']->output)) {
            $agave->invoke('pre_page_render');
            $GLOBALS['objects']['themer']->output = $GLOBALS['objects']['themer']->theme(NULL, $GLOBALS['objects']['themer']->pageTemplate);
            //change to send $output as variable
            $agave->invoke('post_page_render');