Пример #1
0
<div class="breadcrumbs"><a href="index.php?act=socialids" title="Social IDs">Social IDs</a></div>
</div><br />
<div class="select-bar">
<label>
<h3>Social App IDs for Login</h3>
</label>
</div>
<?php 
if (isset($_POST['edit_social'])) {
    $fbid = yasDB_clean($_POST['fbAppId']);
    $fbsecret = yasDB_clean($_POST['fbAppSecret']);
    $twid = yasDB_clean($_POST['twAppId']);
    $twsecret = yasDB_clean($_POST['twAppSecret']);
    yasDB_update("UPDATE `settings` SET `fb_app_id` = '{$fbid}', `fb_app_secret` = '{$fbsecret}', `tw_app_id` = '{$twid}', `tw_app_secret` = '{$twsecret}' WHERE id = 1", false);
    include "../includes/settings_function.inc.php";
    createConfigFile();
    echo '<center>Updated!';
    echo '<br/><a href="index.php?act=socialids">Click to continue.</a></center>';
} else {
    echo '<br/>';
    $query = yasDB_select("SELECT `fb_app_id`, `fb_app_secret`, `tw_app_id`, `tw_app_secret` FROM `settings` WHERE `id` = 1");
    $social = $query->fetch_array(MYSQLI_ASSOC);
    ?>
	<div class="table">
	<img src="img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
	<img src="img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
	<form name="app_ids" method="post" action="index.php?act=socialids">
	<table class="listing form" cellpadding="0" cellspacing="0">
	<tr>
		<th class="full" colspan="2">Social App IDs</th>
	</tr>
Пример #2
0
if ('1' == $isProxyEnabled) {
    $proxy_host = (string) getHttpVariable(INPUT_POST, 'proxy_host', '');
    $proxy_port = (string) getHttpVariable(INPUT_POST, 'proxy_port', '');
} else {
    $proxy_host = NULL;
    $proxy_port = NULL;
}
displayDatabaseForm($originPage, $db_mantis_host, $db_mantis_database, $db_mantis_user, $db_mantis_pass);
$action = (string) getHttpVariable(INPUT_POST, 'action', 'none');
if ("setDatabaseInfo" == $action) {
    try {
        $database_version = checkDBConnection($db_mantis_host, $db_mantis_user, $db_mantis_pass, $db_mantis_database);
        echo "<script type=\"text/javascript\">console.log(\"DEBUG: Mantis database_version = {$database_version}\");</script>";
        checkDBprivileges($db_mantis_database);
        echo "<script type=\"text/javascript\">console.log(\"Step 1/4 create config.ini file\");</script>";
        createConfigFile($db_mantis_host, $db_mantis_user, $db_mantis_pass, $db_mantis_database, $proxy_host, $proxy_port);
        echo "<script type=\"text/javascript\">console.log(\"Step 2/4 execSQLscript2 - create Tables\");</script>";
        //$retCode = Tools::execSQLscript2(Install::FILENAME_TABLES);
        $retCode = SqlParser::execSqlScript(Install::FILENAME_TABLES);
        if (0 != $retCode) {
            throw new Exception('ERROR: Could not execute SQL script: ' . Install::FILENAME_TABLES);
        }
        $request = "SELECT value from `codev_config_table` WHERE `config_id` = 'database_version' ";
        if (!SqlWrapper::getInstance()->sql_query($request)) {
            throw new Exception('ERROR: CodevTT database tables not created.');
        }
        echo "<script type=\"text/javascript\">console.log(\"Step 3/4 execSQLscript2 - create Procedures\");</script>";
        // procedures are defined in install/codevtt_procedures.php
        foreach ($codevtt_sqlProcedures as $query) {
            $result = SqlWrapper::getInstance()->sql_query(trim($query));
            if (!$result) {
Пример #3
0
function setConfigValue($key, $value)
{
    $contents = file_get_contents("config.php");
    preg_match("/\n" . $key . "=([^\n]*)/", $contents, $match);
    if (!$match) {
        createConfigFile();
        $contents = file_get_contents("config.php");
        preg_match("/\n" . $key . "=([^\n]*)/", $contents, $match);
    }
    $contents = str_replace($match[0], "\n{$key}={$value}", $contents);
    saveFile("config.php", $contents);
    return true;
}
Пример #4
0
    } catch (Exception $ex) {
        echo "<br/>Could not create administrator user!";
        echo "<br/>Details: " . $ex->getMessage();
        $continue = false;
    }
}
// create config file
if ($continue) {
    $step++;
    if ($overConfig == 'true') {
        try {
            if (file_exists($cfgFile)) {
                unlink($cfgFile);
                echo "<br/>Old config file deleted.";
            }
            if (createConfigFile($cfgFile, $dbConnectionInfo)) {
                //echo "<br/>New Config file created.";
            }
        } catch (Exception $e) {
            echo "<br/>Could not delete config file!";
            echo "<br/>Please check file permissions !";
            $continue = false;
        }
    } else {
        echo "<br/>Config file unchanged !";
    }
} else {
    echo "<br/> Config file not updated!";
}
if ($continue) {
    $showBtBack = false;
Пример #5
0
<?php

error_reporting(0);
require "createConfig.php";
$pdfURL = $_POST['pdfUrl'];
$numOfColumns = $_POST['numOfColumns'];
// Create the config.ini
$configPath = "/usr/local/bin/config.ini";
createConfigFile("/usr/local/bin/config.ini", $pdfURL, $numOfColumns);
$command = "python /usr/local/bin/do_ocr.py";
$output = shell_exec($command);
//echo $output;
echo basename($pdfURL);
Пример #6
0
function getTranslatableConfigs($create)
{
    global $found_modules;
    global $storage;
    global $booleans;
    getAvailableModules();
    $translatable = array();
    foreach ($found_modules as $module => $top_module) {
        $file = null;
        if (!$storage->setIfIsSet($file, "/config/data/{$module}/file")) {
            I2CE::raiseError("No config file for {$module} -- Skipping");
            continue;
        }
        if (!is_readable($file)) {
            I2CE::raiseError("Config file ({$file}) for {$module} is not readable -- Skipping");
            continue;
        }
        $config_dirs = array();
        $storage->setIfIsSet($config_dirs, "/config/data/{$module}/paths/CONFIGS", true);
        if (count($config_dirs) > 1) {
            I2CE::raiseError("Found more than one configs directory for {$module}. -- Skipping");
            continue;
        }
        $config_dir = dirname($file) . DIRECTORY_SEPARATOR . "configs";
        $config_dir_en = $config_dir . DIRECTORY_SEPARATOR . I2CE_Locales::DEFAULT_LOCALE;
        if (!$create) {
            if (count($config_dirs) == 1) {
                //echo "Module $module has configuration translations\n";
                $translatable[$module] = $config_dir;
            }
            continue;
        }
        //check to see if there are translatable strings in the main config file
        $dom = new DOMDocument('1.0', 'UTF-8');
        $dom->substituteEntities = false;
        $dom->encoding = 'UTF-8';
        $dom->preserveWhiteSpace = true;
        $dom->formatOuput = false;
        //        $dom = new DOMDocument();
        if (!$dom->load($file)) {
            I2CE::raiseError("Could not load config file {$file} -- Skipiing");
        }
        $xpath = new DOMXPath($dom);
        $qry = '/I2CEConfiguration/configurationGroup//value[@locale="' . I2CE_Locales::DEFAULT_LOCALE . '"] ' . '| /I2CEConfiguration/configurationGroup/descendant-or-self::node()[@locale="' . I2CE_Locales::DEFAULT_LOCALE . '"]//value' . '| /I2CEConfiguration/metadata/description[@locale="' . I2CE_Locales::DEFAULT_LOCALE . '"]' . '| /I2CEConfigurUation/metadata/displayName[@locale="' . I2CE_Locales::DEFAULT_LOCALE . '"]' . '| /I2CEConfiguration/metadata/category[@locale="' . I2CE_Locales::DEFAULT_LOCALE . '"]';
        $results = $xpath->query($qry);
        if ($results->length == 0) {
            continue;
        }
        I2CE::raiseError("Module {$module} has configuration translations");
        if (count($config_dirs) == 0) {
            //we found some translation but no translation exists for congigs
            if (!prompt("There are translatable nodes (for the module {$module}), but no configurations  directory.\nShould we create one if needed:\n\t(as " . $config_dir_en . ")\nand add it to the config file?", $booleans['create-configs'])) {
                continue;
            }
            //we need to (possibly) create the config directory
            if (!is_dir($config_dir_en)) {
                if (!mkdir($config_dir_en, 0775, true)) {
                    I2CE::raiseError("Could not make {$config_dir_en} for {$module}. -- Skipping");
                    continue;
                }
            }
        } else {
            if (!is_dir($config_dir_en) || !is_readable($config_dir_en)) {
                if ($create) {
                    if (!mkdir($config_dir_en, 0775, true)) {
                        I2CE::raiseError("Could not make {$config_dir_en} for {$module}. -- Skipping");
                        continue;
                    }
                } else {
                    I2CE::raiseError("Module {$module} has a configuration directory set in magic data as:\n\t{$config_dir_en}\n\tbut it does not exist or is not readable -- Skipping");
                    continue;
                }
            }
        }
        //now we need to double check permissions that i messed up before
        chmod($config_dir, 0775);
        chmod($config_dir_en, 0775);
        //now create the config file in the default locale with thr translation strings. and make sure locale is only set at the top level configuration
        $config = $config_dir_en . DIRECTORY_SEPARATOR . basename($file);
        if (!file_exists($config) || prompt("The config file:\n\t({$config} for the module {$module})\nalready exists.  Should we overwrite?", $booleans['overwrite-configs'])) {
            if (!createConfigFile($module, $results, $config, $dom)) {
                I2CE::raiseError("Could not create {$config} for {$module} -- Skipping");
                continue;
            }
        }
        if (count($config_dirs) == 0) {
            //now we need to add the config directory to the existing config xml just after the version information and save it.
            $results = $xpath->query('/I2CEConfiguration/metadata/version');
            if ($results->length != 1) {
                I2CE::raiseError("Weirdness in config file {$file} for {$module} -- Skipping");
                continue;
            }
            $versionNode = $results->item(0);
            $pathNode = $dom->createElement('path');
            $pathNode->setAttribute('name', 'configs');
            $pathNode->appendChild($dom->createElement('value', './configs'));
            if ($versionNode->nextSibling instanceof DOMNode) {
                $versionNode->parentNode->insertBefore($pathNode, $versionNode->nextSibling);
            } else {
                $versionNode->parentNode->appendChild($pathNode);
            }
            $imports = $xpath->query('//*[@import_index]');
            for ($i = 0; $i < $imports->length; $i++) {
                $imports->item($i)->removeAttribute('import_index');
            }
            $out = $dom->saveXML();
            if (function_exists('tidy_get_output')) {
                $tidy = new tidy();
                $tidy_config = array('input-xml' => true, 'output-xml' => true, 'indent' => true, 'wrap' => 0);
                $tidy->isXML();
                $tidy->parseString($out, $tidy_config, 'UTF8');
                $tidy->cleanRepair();
                $out = tidy_get_output($tidy);
            }
            if (!file_put_contents($file, $out)) {
                I2CE::raiseError("Could not save config file {$file} with updated configs directory");
                continue;
            }
        }
        $translatable[$module] = $config_dir;
    }
    if (count($translatable) > 0) {
        I2CE::raiseError("The following modules has translatable configuration strings:\n\t" . implode(",", array_keys($translatable)));
    } else {
        I2CE::raiseError("There were no modules found with translatable configuration strings\n");
    }
    return $translatable;
}
Пример #7
0
    mkdir($PattenDataDir, 0777);
}
//http://www.sznet.com.cn/company_contact.php?userid=683
//$site="www.sznet.com.cn";
//$url="http://www.sznet.com.cn/company_contact.php?userid=683";
//http://yp.sz.net.cn/Enterprise/Enterprise_View.asp?MemberID=134156
//http://yp.sz.net.cn/Enterprise/Enterprise_View.asp?MemberID=134156
//http://company.gdfz.com/CompanySearch.php?arzen_next_page=1&
$site = "www.chaqiye.com";
$url = "http://www.chaqiye.com/guangxi/1/1001.htm";
$file_type = "GenericConf";
$conf = array('mode' => 0777, 'timeFormat' => '%X %x');
$logger =& Log::singleton('file', $PattenLogDir . $site . date("Y_m_d_H_i") . '.log', 'ident', $conf);
$conf = array('fields' => 15, 'sep' => ";", 'quote' => '"', 'header' => false, 'crlf' => "\r\n");
$filename = $PattenDataDir . date("Y_m_d_H_i") . ".txt";
createConfigFile($site, $file_type);
exit;
function getListingUrl($url, $patten, $data, &$x)
{
    global $site;
    $content = getContent($url);
    $url_arr = parseTagAll($patten, $content);
    foreach ($url_arr as $key => $value) {
        $url = "http://" . $site . "/" . $value;
        parseContenDetail($url, $data, &$x);
    }
}
function parseContenDetail($url, $data, &$x)
{
    global $logger, $filename, $conf;
    $content = getContent($url);
Пример #8
0
function get_mochifeed()
{
    $Start = getTime();
    $mem_limit = substr(ini_get("memory_limit"), 0, -1);
    global $mysqli;
    global $setting;
    error_reporting(E_ALL ^ E_NOTICE);
    set_time_limit(0);
    @ini_set("max_execution_time", 1000);
    @ini_set("default_socket_timeout", 240);
    $mochipubid = $setting['mochi_pub_key'];
    // Retrieve our Mochi key
    if (!$mochipubid) {
        echo 'You need a Mochimedia Publisher ID to continue.';
        return false;
    }
    $limit = '1500';
    $offset = $setting['mochi_offset'] >= 0 ? $setting['mochi_offset'] : 0;
    $no_errors = 0;
    $new_games = 0;
    //$feedUrl = 'http://www.mochimedia.com/feeds/games/'.$mochipubid.'/all/all?limit='.$limit.'&offset='.$offset.'&format=json';
    $query = yasDB_select("SELECT `gametagid`, `uuid` FROM mochigames", false);
    $tags = array();
    //$uid_array = array();
    $i = 0;
    // create array of game tags for duplicate checking
    while ($alltags = $query->fetch_array(MYSQLI_ASSOC)) {
        $tags[$i] = $alltags['gametagid'];
        //$uid_array[$i] = $alltags['uuid'];
        $i++;
    }
    unset($alltags);
    $query->close();
    do {
        // This is the Mochiads feed url. For more info go here: https://www.mochimedia.com/support/pub_docs#feed_3 ...when signed in
        $feedUrl = 'http://catalog.mochimedia.com/feeds/query/?partner_id=' . $mochipubid . '&limit=' . $limit . '&offset=' . $offset;
        $data = get_content_of_url($feedUrl);
        $json_data = json_decode($data, true);
        unset($data);
        $json_count = count($json_data["games"]);
        if ($json_count < 1) {
            break;
        }
        foreach ($json_data["games"] as $json) {
            if ($json['name'] == NULL) {
                break;
            }
            if (!in_array($json['game_tag'], $tags)) {
                // && !in_array($json['uuid'],$uid_array)) {
                $gamename = yasDB_clean($json['name']);
                $gametagkey = yasDB_clean($json['game_tag']);
                $gameurl = yasDB_clean($json['swf_url']);
                $gamewidth = yasDB_clean($json['width']);
                $gameheight = yasDB_clean($json['height']);
                $gamedesc = yasDB_clean($json['description']);
                $gamekeywords_array = $json['tags'];
                $gamekeywords = yasDB_clean(implode(", ", $gamekeywords_array));
                //  Game keywords comma delimited i.e. "dressup,makeover,barbie"
                unset($gamekeywords_array);
                $thumburl = yasDB_clean($json['thumbnail_url']);
                $gamecat_array = $json['categories'];
                $gamecats = yasDB_clean(implode(", ", $gamecat_array));
                // All categories comma delimited
                unset($gamecat_array);
                $instructions = yasDB_clean($json['instructions']);
                $rating = yasDB_clean($json['rating']);
                $leaderboard = yasDB_clean($json['leaderboard_enabled']);
                $coinsenabled = yasDB_clean($json['coins_enabled']);
                $coins_rev_enabled = yasDB_clean($json['coins_revshare_enabled']);
                $recommended = yasDB_clean($json['recommended']);
                $controls = yasDB_clean($json['control_scheme']);
                $slug = yasDB_clean($json['slug']);
                $thumburl_200x200 = yasDB_clean($json['thumbnail_large_url']);
                $screen_thumb_url = yasDB_clean($json['screen1_thumb']);
                $screen_thumb_url2 = yasDB_clean($json['screen2_thumb']);
                $screen_thumb_url3 = yasDB_clean($json['screen3_thumb']);
                $screen_thumb_url4 = yasDB_clean($json['screen4_thumb']);
                $uuid = yasDB_clean($json['uuid']);
                $author = yasDB_clean($json['author']);
                // As of now we do not need all these fields.  But this will allow for future script growth, ie : Building a leaderboard mod.
                $sql = "INSERT INTO mochigames (`id`, `name`, `gameurl`, `width`, `height`, `description`, `keywords`, `thumburl`, `categories`, `gametagid`, `screenthumburl1`, `instructions`, `rating`, `leaderboard`, `coinsenabled`, `revshareenabled`, `recommended`, `isinstalled`, `slug`, `thumbnail_200x200`, `screenthumburl2`, `screenthumburl3`, `screenthumburl4`, `uuid`, `author`) \n\t\t\t\tVALUES (NULL, '{$gamename}', '{$gameurl}', '{$gamewidth}', '{$gameheight}', '{$gamedesc}', '{$gamekeywords}', '{$thumburl}', '{$gamecats}', '{$gametagkey}', '{$screen_thumb_url}', '{$instructions}', '{$rating}', '{$leaderboard}', '{$coinsenabled}', '{$coins_rev_enabled}', '{$recommended}', 0, '{$slug}', '{$thumburl_200x200}', '{$screen_thumb_url2}', '{$screen_thumb_url3}', '{$screen_thumb_url4}', '{$uuid}', '{$author}')";
                $return = yasDB_insert($sql, false);
                if ($return === false) {
                    $no_errors++;
                    // if there is a db insert error just keep going. A duplicate may have snuck in as the limit/offset of the feed is not 100% accurate
                } else {
                    $new_games++;
                }
            }
        }
        unset($json);
        unset($json_data);
        $offset = $offset + $limit;
    } while ($json_count > 0);
    echo 'Available script memory: ' . $mem_limit . ' MB<br/>';
    echo 'Peak memory usage: ' . memory_get_peak_usage(true) / 1024 / 1024 . ' MB<br/>';
    $End = getTime();
    echo "Time taken = " . number_format($End - $Start, 2) . " secs<br/>";
    echo "Errors encountered: " . $no_errors . "<br/>";
    echo "New games added: " . $new_games . "<br/>Finished!";
    $offset = intval($offset - 2 * $limit);
    $offset = $offset > 0 ? $offset : 0;
    if ($offset != $setting['mochi_offset']) {
        yasDB_update("UPDATE `settings` SET `mochi_offset` = {$offset} WHERE `id` = 1");
        include "../includes/settings_function.inc.php";
        createConfigFile();
    }
    return true;
}