Пример #1
0
 function initialize($name, $url)
 {
     global $wgTmpDirectory;
     $local_file = tempnam($wgTmpDirectory, 'WEBUPLOAD');
     $this - initialize($name, $local_file, 0, true);
     $this->mUrl = trim($url);
 }
Пример #2
0
function run()
{
    initialize();
    $fh = fopen('php://output', 'w');
    $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
    if (!empty($rows)) {
        echo "The following records have been processed. If action = Un-linked, that membership has been disconnected from the contribution record.\n";
        echo "Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action \n";
    } else {
        echo "Could not find any records to process.\n";
    }
    foreach ($rows as $row) {
        fputcsv($fh, $row);
    }
}
Пример #3
0
function query_the_swear()
{
    wp_reset_postdata();
    $options = initialize();
    if ($options['max_password_length'] != null) {
        $max = intval($options['max_password_length']);
    } else {
        $max = 18;
    }
    if ($options['number_digits'] != null) {
        $num = intval($options['number_digits']);
    } else {
        $num = 999;
    }
    if ($options['posts_per_page'] != null) {
        $int = intval($options['posts_per_page']);
    } else {
        $int = -1;
    }
    $post_type = 'vulgar-term';
    $end = "";
    $count = 0;
    $i = 0;
    $args = array('post_type' => $post_type, 'posts_per_page' => $int, 'orderby' => 'rand');
    // echo ($int);
    $loop = new WP_Query($args);
    //var_dump($loop);
    while ($end_loop != true && $loop->have_posts()) {
        $loop->the_post();
        //echo the_title();
        $str = get_the_title();
        $term_str = clean_term_string($str, $count);
        $final_str .= $term_str;
        if (strlen($final_str) >= $max) {
            //$final_str .= $term_str;
            $end_loop = true;
        }
        $num = rand(0, $num);
        //echo $count ;
        $count += 1;
    }
    $id = save_term_string($final_str);
    //save_vulgar_password( $final_str );
    return $final_str . $num;
    wp_reset_postdata();
}
Пример #4
0
function done_testing()
{
    global $t;
    $funcs = get_defined_functions();
    $initialize = false;
    $finalize = false;
    if (in_array('initialize', $funcs['user'])) {
        $initialize = true;
    }
    if (in_array('finalize', $funcs['user'])) {
        $finalize = true;
    }
    if (in_array('build', $funcs['user'])) {
        build($t);
    }
    foreach ($funcs['user'] as $func) {
        # 予約された function
        if (in_array($func, array('build', 'destroy', 'initialize', 'finalize', 'done_testing'))) {
            continue;
        }
        # _function( ) は skip
        if (preg_match('/^_/', $func)) {
            continue;
        }
        if ($initialize) {
            initialize($t);
        }
        try {
            $t->diag("in function '{$func}'");
            $func($t);
        } catch (Exception $e) {
            $t->diag($e->getMessage() . " at {$func}( )");
            $t->fail();
        }
        if ($finalize) {
            finalize($t);
        }
    }
    if (in_array('destroy', $funcs['user'])) {
        destroy($t);
    }
}
Пример #5
0
function IsAuthenticated()
{
    if (!session_id()) {
        session_start();
    }
    $dbConnection = initialize();
    $query = $dbConnection->prepare("SELECT `password` " . "FROM `user_info` " . "WHERE `user_id` = ? " . "AND `user_name` = ? " . "AND `type` = ?");
    if ($query && !$query->errno) {
        $query->bind_param("iss", $_SESSION['user_id'], $_SESSION['username'], $_SESSION['type']);
        if ($query->execute()) {
            $result = $query->get_result()->fetch_assoc();
            if (!empty($result) && !empty($result['password'])) {
                $loginString = hash('sha512', $result['password'] . $_SERVER['HTTP_USER_AGENT']);
                if ($_SESSION['login_string'] == $loginString) {
                    return true;
                }
            }
        }
    }
    return false;
}
Пример #6
0
<?php

/**
 *  該程式僅供於 training 環境使用
 *      - 不使用 web hook
 *      - 資料直接取得 https://api.telegram.org/bot???:??????/getUpdates
 *
 */
$basePath = dirname(__DIR__);
require_once $basePath . '/app/bootstrap.php';
initialize($basePath, 'home');
if (!isTraining()) {
    echo ErrorSupportHelper::getJson('4002');
    exit;
}
$telegram = BotHelper::getTelegram();
try {
    $updates = $telegram->getUpdates();
} catch (\Telegram\Bot\Exceptions\TelegramResponseException $e) {
    put($e->getMessage());
    return;
}
$result = [];
$messages = new Messages();
foreach ($updates as $update) {
    $message = MessageHelper::makeMessageByTelegramUpdate($update);
    // 從 updates 來的資料會有許多重覆資料
    // 該確認之後再寫入
    $existMessage = $messages->getMessageByMessageId($message->getMessageId());
    if ($existMessage) {
        continue;
Пример #7
0
<?php

error_reporting(E_ALL);
setlocale(LC_ALL, 'de_DE');
session_start();
include 'includes/config.php';
include 'library/default/functions/autoload.php';
include 'library/default/functions/initialize.php';
$microtimeFloatStart = microtime(true);
$database = new library_default_classes_database();
$database->connect();
$GLOBALS['user'] = application_frontend_user_controller::getUser();
if (isset($_GET['app']) && !empty($_GET['app'])) {
    $object = initialize($_GET['app']);
    $object->actionController();
} else {
    $object = new application_frontend_index_controller();
    $object->actionController();
}
$microtimeFloat = microtime(true) - $microtimeFloatStart;
//mysql_query("insert into _loadtime (uid, app, referer, ip, browser, microtime, created) values ('".$GLOBALS['user']['myuid']."', '".$_SERVER['REQUEST_URI']."', '".$_SERVER['HTTP_REFERER']."', '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['HTTP_USER_AGENT']."', '".$microtimeFloat."', now())");
Пример #8
0
<?php

/**
 * Created by PhpStorm.
 * User: Nima
 * Date: 7/26/2015
 * Time: 3:08 PM
 */
include_once '../inc/mysqlConn.php';
if (isset($_POST['id']) && isset($_POST['hidden'])) {
    $dbName = '`team_information`';
    if (isset($_POST['type']) && $_POST['type'] == 'player') {
        $dbName = '`player_information`';
    }
    $dbConnection = initialize();
    $query = $dbConnection->prepare("UPDATE {$dbName} " . "SET `hidden` = ? " . "WHERE `id` = ?");
    if ($query && !$query->errno) {
        $query->bind_param('ii', $_POST['hidden'], $_POST['id']);
        if ($query->execute() && $query->affected_rows > 0) {
            die("1");
        }
    }
}
die("0");
Пример #9
0
function main()
{
    date_default_timezone_set('Americas/New_York');
    $shortopts = "i:j:p:w:";
    // Required value
    $longopts = array("industry:", "jobs:", "prospects:", "wages:");
    // initialize
    initialize();
    $options = getopt($shortopts, $longopts);
    $industries = loadTSV($options['industry'], 0, "SocCode");
    $jobs = loadTSV($options['jobs'], 0, "SocCode", ["JobTitle", ""]);
    $prospects = loadTSV($options['prospects'], 1, "SocCode");
    $wages = loadTSV($options['wages'], 1, "SocCode", ["JobTitle", ""]);
    cleanupWages($wages);
    $master = array_merge_recursive($jobs, $prospects, $wages);
    array_walk($master, function (&$item, $key) {
        if (is_array($item)) {
            array_walk($item, function (&$item, $key) {
                if (is_array($item)) {
                    $item = array_unique($item);
                }
            });
        }
    });
    usort($master, function ($a, $b) {
        if ($a == $b) {
            return 0;
        }
        return $a < $b ? -1 : 1;
    });
    calcJobScores($master);
    $industries = createDbQueries($industries, "industry");
    $jobs = createDbQueries($master, "jobs");
    executeQueries(array_merge($industries, $jobs));
}
Пример #10
0
                                $stdout = $case_element->addChild('stdout', PHP_EOL . $line . PHP_EOL);
                            } else {
                                $existing = (string) $stdout[0];
                                $case_element->stdout = $existing . $line . PHP_EOL;
                            }
                        }
                    }
                }
            }
        }
    }
    // write it out again
    $xml->asXML($log_name);
}
if (in_array("--new", $argv)) {
    initialize($installed);
    exit;
}
if (in_array("--reset", $argv)) {
    reinitialize($installed);
    exit;
}
require_once 'conf/saunter.inc';
$GLOBALS['settings']['saunter.base'] = getcwd();
$timestamp = date('Y-m-d-h-i-s');
$GLOBALS['settings']['logdir'] = $GLOBALS['settings']['saunter.base'] . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . $timestamp;
mkdir($GLOBALS['settings']['logdir']);
$GLOBALS['settings']['logname'] = $GLOBALS['settings']['logdir'] . DIRECTORY_SEPARATOR . $timestamp . '.xml';
array_push($_SERVER['argv'], "--log-junit");
array_push($_SERVER['argv'], $GLOBALS['settings']['logname']);
array_push($_SERVER['argv'], "scripts");
Пример #11
0
 in case of of failure the action is repeated up to "$repeat" times;
 OAI errors will be reported and the execution of the script is aborted.

 Example:
 php ./oai_harvest.php http://gdz.sub.uni-goettingen.de/oai2/ ListRecords ./gdzNeu/ metadataPrefix=mets set=mathematica  from=2011-05-10
 Example for a call using an Internet browser:
 http://gdz.sub.uni-goettingen.de/oai2/?verb=GetRecord&metadataPrefix=oai_dc&identifier=gdz.sub.uni-goettingen.de:PPN623147521

 Note: Some of the calls, in particular ListRecords, may need a broadband internet connection and
 still may take a long time (up to hours) and collect large amounts of data (Gigabytes!).
 So beware and be patient, watch the output to observe if the call does what you want!
 Note: The files are downloaded as <verb>.xml and then copied to another name with tags on separate lines.
 In particular, the last file is always present as <verb>.xml and in an edited version.
 If this is undesirable then comment the line: file_put_contents($targetdir.$theVerb.'.xml',$data);
*/
list($arrArgs, $arrArgs2, $targetdir, $sets, $theExtension, $testmode) = initialize($defaultDir, $testFile);
$errorlog = $targetdir . 'error.log';
$harvestlog = $targetdir . 'harvest.log';
$theBaseUrl = $arrArgs['oaiURL'];
$theVerb = $arrArgs['verb'];
if (!$testmode) {
    $theBaseUrl .= '?verb=' . $theVerb;
}
if (!($errorHandle = fopen($errorlog, 'a'))) {
    echo $errorlog . ' is not writeable!' . "\n";
    exit;
}
if (!($logHandle = fopen($harvestlog, 'a'))) {
    echo $harvestlog . ' is not writeable!' . "\n";
    exit;
}
Пример #12
0
    $json = shell_exec("fedmsg-config");
    $config = json_decode($json, true);
    /* Just make sure everything is sane with the fedmsg config */
    if (!array_key_exists('relay_inbound', $config)) {
        echo "fedmsg-config has no 'relay_inbound'";
        return false;
    }
    $context = new ZMQContext(1, true);
    $queue = $context->getSocket(ZMQ::SOCKET_PUB, "pub-a-dub-dub");
    $queue->connect($config['relay_inbound']);
    return true;
}
# If we can successfully initialize a zmq socket, then we'll go ahead and
# register our hooks with mediawiki.  If we fail for some reason, we don't want
# mediawiki calling us, so we'll fail quietly.
if (initialize()) {
    $wgHooks['ArticleSaveComplete'][] = 'article_save';
    $wgHooks['UploadComplete'][] = 'upload_complete';
}
# This is a reimplementation of the python code in fedmsg/crypto.py
# That file is authoritative.  Changes there should be reflected here.
function sign_message($message_obj)
{
    global $config;
    $message = json_encode($message_obj);
    # Step 0) - Find our cert.
    $fqdn = gethostname();
    $tokens = explode('.', $fqdn);
    $hostname = $tokens[0];
    $ssldir = $config['ssldir'];
    $certname = $config['certnames']['mediawiki.' . $hostname];
Пример #13
0
/**
 * Running application
 *
 * @param string $env 
 * @return void
 */
function run($env = null)
{
    if (is_null($env)) {
        $env = env();
    }
    # 0. Set default configuration
    $root_dir = dirname(app_file());
    $lim_dir = dirname(__FILE__);
    $base_path = dirname(file_path($env['SERVER']['SCRIPT_NAME']));
    $base_file = basename($env['SERVER']['SCRIPT_NAME']);
    $base_uri = file_path($base_path, $base_file == 'index.php' ? '?' : $base_file . '?');
    option('root_dir', $root_dir);
    //option('limonade_dir',       file_path($lim_dir));
    //option('limonade_views_dir', file_path($lim_dir, 'limonade', 'views'));
    //option('limonade_public_dir',file_path($lim_dir, 'limonade', 'public'));
    option('public_dir', file_path($root_dir, 'public'));
    option('views_dir', file_path($root_dir, 'views'));
    option('controllers_dir', file_path($root_dir, 'controllers'));
    option('lib_dir', file_path($root_dir, 'lib'));
    //option('error_views_dir',    option('limonade_views_dir'));
    //option('base_path',          $base_path);
    option('base_uri', $base_uri);
    // set it manually if you use url_rewriting
    //  option('env',                ENV_PRODUCTION);
    option('debug', true);
    //option('session',            LIM_SESSION_NAME); // true, false or the name of your session
    option('encoding', 'utf-8');
    //option('signature',          LIM_NAME); // X-Limonade header value or false to hide it
    option('gzip', false);
    option('x-sendfile', 0);
    // 0: disabled,
    // X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
    // X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
    # 1. Set handlers
    # 1.1 Set error handling
    #ifndef KittenPHP
    ini_set('display_errors', 1);
    #endif
    //set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
    # 1.2 Register shutdown function
    register_shutdown_function('stop_and_exit');
    # 2. Set user configuration
    if (!function_exists('configure')) {
        function configure()
        {
        }
    }
    configure();
    # 2.1 Set gzip compression if defined
    if (is_bool(option('gzip')) && option('gzip')) {
        ini_set('zlib.output_compression', '1');
    }
    # 2.2 Set X-Limonade header
    //if($signature = option('signature')) send_header("X-Limonade: $signature");
    # 3. Loading libs
    //fallbacks_for_not_implemented_functions();
    # 4. Starting session
    //if(!defined('SID') && option('session'))
    //  {
    //    if(!is_bool(option('session'))) session_name(option('session'));
    //    if(!session_start()) trigger_error("An error occured while trying to start the session", E_USER_WARNING);
    //  }
    # 5. Set some default methods if needed
    if (!function_exists('route_missing')) {
        function route_missing($request_method, $request_uri)
        {
            halt(NOT_FOUND, "({$request_method}) {$request_uri}");
        }
    }
    if (!function_exists('initialize')) {
        function initialize()
        {
        }
    }
    initialize();
    # 6. Check request
    if ($rm = request_method($env)) {
        if (request_is_head($env)) {
            ob_start();
        }
        // then no output
        if (!request_method_is_allowed($rm)) {
            halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
        }
        # 6.1 Check matching route
        if ($route = route_find($rm, request_uri($env))) {
            params($route['params']);
            # 6.3 Call before function
            if (!function_exists('before')) {
                function before($route)
                {
                }
            }
            before($route);
            # 6.4 Call matching controller function and output result
            return $route;
        } else {
            route_missing($rm, request_uri($env));
        }
    } else {
        halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
    }
}
Пример #14
0
 */
ini_set('default_charset', 'utf-8');
require_once "Utility.class.inc";
require_once "NDB_Config.class.inc";
require_once "MincEnv.php.inc";
$headers = array();
$query = "select File from files where FileID = :MincID";
$minc_file = $DB->pselectOne($query, array('MincID' => $_REQUEST['minc_id']));
$minc_file = getMincLocation() . $minc_file;
$header = $_REQUEST['minc_headers'];
$header_data = $_REQUEST['raw_data'];
if ($header_data) {
    passthru("minctoraw -double -normalize {$minc_file}");
}
if ($header == 'true' && $minc_file != null) {
    print initialize($minc_file);
}
/**
 * Extracts the values required for a specific dimension from a minc file
 *
 * @param string $dimension A string representing the dimension to extract
 * @param string $minc_file The filename to run mincinfo on to extract
 *                          information
 *
 * @return array with elements start, space_length, and step populated
 */
function extractDimension($dimension, $minc_file)
{
    return array('start' => exec("mincinfo -attval {$dimension}:start {$minc_file}"), 'space_length' => exec("mincinfo -dimlength {$dimension} {$minc_file}"), 'step' => exec("mincinfo -attval {$dimension}:step {$minc_file}"), 'dir_cosines' => explode(" ", exec("mincinfo -attval {$dimension}:direction_cosines {$minc_file}")));
}
/**
Пример #15
0
<?php

header('Content-Type: text/html; charset=UTF-8');
ini_set('date.timezone', 'UTC');
include_once 'inc/auth.php';
CheckAuthentication();
require_once 'inc/utils.php';
require_once 'inc/mysqlConn.php';
require_once 'inc/relativeTime.php';
$dbConn = initialize();
function revString($s)
{
    if ($s == '1') {
        return '0';
    }
    return '1';
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"" http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <link rel="icon" href="favicon.ico">

    <title>LoL Statbot - Dashboard</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
Пример #16
0
function getExperiment()
{
    global $title, $header;
    $title = $header = 'IREval';
    checkAdmin();
    initialize();
    if (!isset($_GET['id'])) {
        error('Nenhum experimento especificado.');
    }
    $experiment_id = clean($_GET['id']);
    $experiment = first("SELECT * FROM experiment WHERE id = {$experiment_id}");
    if (!$experiment) {
        error('Experimento inexistente.');
    }
    return $experiment;
}
Пример #17
0
function upload_complete(&$image)
{
    # If for some reason or another we can't create our socket, then bail.
    if (!initialize()) {
        return false;
    }
    $topic = "upload.complete";
    $msg = array("file_exists" => $image->getLocalFile()->fileExists, "media_type" => $image->getLocalFile()->media_type, "mime" => $image->getLocalFile()->mime, "major_mime" => $image->getLocalFile()->major_mime, "minor_mime" => $image->getLocalFile()->minor_mime, "size" => $image->getLocalFile()->size, "user_id" => $image->getLocalFile()->user, "user_text" => $image->getLocalFile()->user_text, "description" => $image->getLocalFile()->description, "url" => $image->getLocalFile()->url);
    # I know it seems peculiar to have an array here with only one element.
    # https://github.com/fedora-infra/fedmsg_meta_fedora_infrastructure/pull/174
    $msg['title'] = array("mPrefixedText" => $image->getLocalFile()->getTitle()->getPrefixedText());
    emit_message($topic, $msg);
    return true;
}
Пример #18
0
 public function __construct()
 {
     parent::__construct();
     initialize();
 }
Пример #19
0
<!DOCTYPE html>
<?php 
include_once "../includes/general.php";
include_once "../includes/db.php";
initialize();
loggedIn();
//db_connect();
loadVocabulary();
?>


<head>
<?php 
head_tag("LACTOR - " . _("Inbox"));
?>
</head>

<body>
<div id="maincontainer">

<?php 
page_header();
admin_menu(ADMIN_PAGE_INBOX);
?>

		
<!-- Page Content -->
<div id="pagecontent">
<div class='message dynamic' style='display:none'></div>
<?php 
if (isset($_SESSION['s_mid'])) {
Пример #20
0
function upload_complete(&$image)
{
    # If for some reason or another we can't create our socket, then bail.
    if (!initialize()) {
        return false;
    }
    $topic = "upload.complete";
    $msg = array("file_exists" => $image->getLocalFile()->fileExists, "media_type" => $image->getLocalFile()->media_type, "mime" => $image->getLocalFile()->mime, "major_mime" => $image->getLocalFile()->major_mime, "minor_mime" => $image->getLocalFile()->minor_mime, "size" => $image->getLocalFile()->size, "user_id" => $image->getLocalFile()->user, "user_text" => $image->getLocalFile()->user_text, "description" => $image->getLocalFile()->description, "url" => $image->getLocalFile()->url, "title" => $image->getLocalFile()->getTitle());
    emit_message($topic, $msg);
    return true;
}