function ToPhp()
{
    $domains = Import();
    while (list($indx, $dom) = each($domains)) {
        $count = count(explode('.', $dom));
        $dom = str_replace(".", "\\.", $dom);
        if ($count > 2) {
            $dom = "{$dom}\$";
        } else {
            $dom = "\\.{$dom}\$";
        }
        echo "if(preg_match(\"#{$dom}#\", \$www)){return \"tracker\";}\n";
    }
}
示例#2
0
        $misc = Query("select * from misc");
        if (NumRows($misc) == 0) {
            Query("INSERT INTO `misc` (`views`, `hotcount`, `porabox`, `poratitle`, `milestone`, `maxuserstext`) VALUES (0, 30, '', 'Points of Required Attention', 'Nothing yet.', 'Nobody yet.');");
        }
        Query("UPDATE `misc` SET `version` = 226");
        $smilies = Query("select * from smilies");
        if (NumRows($smilies) == 0) {
            Query("\n\tINSERT INTO `smilies` (`code`, `image`) VALUES\n\t(':)', 'smile.png'),\n\t(';)', 'wink.png'),\n\t(':D', 'biggrin.png'),\n\t('o_o', 'blank.png'),\n\t(':awsum:', 'awsum.png'),\n\t('-_-', 'annoyed.png'),\n\t('o_O', 'bigeyes.png'),\n\t(':LOL:', 'lol.png'),\n\t(':O', 'jawdrop.png'),\n\t(':(', 'frown.png'),\n\t(';_;', 'cry.png'),\n\t('>:', 'mad.png'),\n\t('O_O', 'eek.png'),\n\t('8-)', 'glasses.png'),\n\t('^_^', 'cute.png'),\n\t('^^;;;', 'cute2.png'),\n\t('>_<', 'yuck.png'),\n\t('<_<', 'shiftleft.png'),\n\t('>_>', 'shiftright.png'),\n\t('@_@', 'dizzy.png'),\n\t('^~^', 'angel.png'),\n\t('>:)', 'evil.png'),\n\t('x_x', 'sick.png'),\n\t(':P', 'tongue.png'),\n\t(':S', 'wobbly.png'),\n\t(':[', 'vamp.png'),\n\t('~:o', 'baby.png'),\n\t(':YES:', 'yes.png'),\n\t(':NO:', 'no.png'),\n\t('<3', 'heart.png'),\n\t(':3', 'colonthree.png'),\n\t(':up:', 'approve.png'),\n\t(':down:', 'deny.png'),\n\t(':durr:', 'durrr.png'),\n\t('^^;', 'embarras.png'),\n\t(':barf:', 'barf.png'),\n\t('._.', 'ashamed.png'),\n\t('''.''', 'umm.png'),\n\t('''_''', 'downcast.png'),\n\t(':big:', 'teeth.png'),\n\t(':lawl:', 'lawl.png'),\n\t(':ninja:', 'ninja.png'),\n\t(':pirate:', 'pirate.png'),\n\t('D:', 'outrage.png'),\n\t(':sob:', 'sob.png'),\n\t(':XD:', 'xd.png'),\n\t(':yum:', 'yum.png');\n");
        }
        print "Reticulating uploader and usercomments where needed&hellip;<br />";
        Query("update `uploader` set `date` = `id` where `date` = 0;");
        Query("update `usercomments` set `date` = `id` where `date` = 0;");
        //Import("installTables.sql");
        if ($_POST['addbase']) {
            print "Creating starting fora&hellip;<br />";
            Import("installDefaults.sql");
        }
        print "<h3>Your board has been set up.</h3>";
        print "Things for you to do now:";
        print "<ul>";
        print "<li><a href=\"register.php\">Register your account</a> &mdash; the first to register gets to be Root.</li>";
        print "<li>Check out the <a href=\"admin.php\">administrator's toolkit</a>.</li>";
        print "<li><a href=\"install.php?delete=1\">Delete</a> the installation script.</li>";
        print "</ul>";
        //print "The installation script, being a security hazard if left alone, has been removed and replaced by the actual board index.";
        print "</div>";
    }
}
//SQL importer based on KusabaX installer
function Import($sqlFile)
{
示例#3
0
<? include_once("include/head.php");?> 
<? include_once("include/form.php");?> 
<? include_once("include/left_menu.php");?>  
<? include_once("include/search.php");?> 
  <h4>Страница импорта каталогов</h4>
    <?
$a = Import();
echo $a;
 $filename = $_POST['filename'];
echo $filename; 
  ?>
  <form method="post" action="">
  <input name="filename" type="file"/>
  <input type="submit" value="Импорт" />
  </form>
  

    <?
    foreach($s as $key => $val){
    ?>

<div class="accordion" id="accordion2">
  <div class="accordion-group">
    <div class="accordion-heading">
            <div class="accordion-toggle">
      <a data-toggle="collapse" data-parent="#accordion2" href="#collapse<?php 
echo $val["ELEMENT_ID"];
?>
">
<!-- Имя -->   
        <img src="http://chimmed/bitrix/templates/himed/images/plus.png" alt="" title="" />
<?php

Import('@.Unit.Common');
/**
 * BlogModel 
 * 迷你博客Model层。操作相关迷你博客的数据业务逻辑
 * @package Model::Blog
 * @version $id$
 * @copyright 2009-2011 SamPeng 
 * @author SamPeng <*****@*****.**> 
 * @license PHP Version 5.2 {@link www.sampeng.cn}
 */
class BlogModel extends BaseModel
{
    /**
     * _type 
     * 日志的种类。默认为0
     * @var float
     * @access public
     */
    public $_type = 0;
    /**
     * limit 
     * 每页显示多少条
     * @var float
     * @access public
     */
    private $limit = 10;
    private static $uid = 0;
    public function _initialize()
    {
示例#5
0
$logSqlErrors = 0;
?>';
    if (file_put_contents('config/database.php', $dbconfig) === FALSE) {
        die('Error: failed to create the config file. Check the permissions of the user running PHP.' . $footer);
    }
    $salt = Shake(24);
    define('SALT', $salt);
    $saltfile = '<?php define(\'SALT\', ' . phpescape($salt) . '); ?>';
    file_put_contents('config/salt.php', $saltfile);
    $kurifile = '<?php define(\'KURIKEY\', ' . phpescape(Shake(32)) . '); ?>';
    file_put_contents('config/kurikey.php', $kurifile);
    require 'lib/mysql.php';
    require 'lib/mysqlfunctions.php';
    $debugMode = 1;
    Upgrade();
    Import('database.sql');
    $pss = Shake(16);
    $sha = hash('sha256', $boardpassword . $salt . $pss, FALSE);
    Query("insert into {users} (id, name, password, pss, primarygroup, regdate, lastactivity, lastip, email, sex, theme) values ({0}, {1}, {2}, {3}, {4}, {5}, {5}, {6}, {7}, {8}, {9})", 1, $boardusername, $sha, $pss, 4, time(), $_SERVER['REMOTE_ADDR'], '', 2, 'blargboard');
    ?>
	<h3>Your new Blargboard board has been successfully installed!</h3>
	<br>
	You should now:
	<ul>
		<li>delete install.php and database.sql
		<li><a href="./?page=login">log in to your board</a> and configure it
	</ul>
	<br>
	Thank you for choosing Blargboard!<br>
	<br>
<?php 
 /**
  * setConfig 
  * 设置配置控制器
  * @param mixed $model 
  * @access protected
  * @return void
  */
 protected function setConfig($data)
 {
     //引入配置管理类
     Import('@.Unit.Config');
     //引入配置信息
     //配置管理对象,把配置数组交给配置管理对象处理
     $config = new Config($data);
     $this->config = $config;
 }
<?
	//require "config.php";
	require "functions.php";
	require "includes.php";
	require "menu.php";

	//print_r($_POST);
	
	/* ----- setup variables ----- */
	$action = GetVariable("action");
	$data = GetVariable("data");

	
	/* determine action */
	switch ($action) {
		case 'import': Import($data); break;
		default: DisplayImportForm();
	}
	
	
	/* ------------------------------------ functions ------------------------------------ */

	
	/* -------------------------------------------- */
	/* ------- Import ----------------------------- */
	/* -------------------------------------------- */
	function Import($data) {
		$lines = explode("\n", $data);
		$lastfilegroupid = 0;
		$groupid = 0;
		foreach($lines as $line) {
示例#8
0
function install()
{
    global $dblink, $dbserv, $dbuser, $dbpass, $dbname, $dbpref, $dberror, $abxd_version;
    doSanityChecks();
    if (file_exists("config/database.php")) {
        //TODO: Check for errors when parsing this file (It may be corrupted or wrong or whatever.
        //If it fails, fail gracefully and instruct the user to fix or delete database.php
        include "config/database.php";
    } else {
        $dbserv = $_POST['dbserv'];
        $dbuser = $_POST['dbuser'];
        $dbpass = $_POST['dbpass'];
        $dbname = $_POST['dbname'];
        $dbpref = $_POST['dbpref'];
    }
    $convert = $_POST["convert"] == "true";
    $convertFrom = $_POST["convertFrom"];
    $convertDbName = $_POST["convertDbName"];
    $convertDbPrefix = $_POST["convertDbPrefix"];
    if (!sqlConnect()) {
        installationError("Could not connect to the database. Error was: " . $dberror);
    }
    $currVersion = getInstalledVersion();
    if ($currVersion == $abxd_version) {
        installationError("The board is already installed and updated (Database version {$currVersion}). You don't need to run the installer!\n");
    }
    if ($currVersion != -1 && $convert) {
        die("ERROR: You asked to convert a forum database, but an ABXD installation was already found in the installation DB. Converting is only possible when doing a new installation.");
    }
    echo "Setting utf8_unicode_ci collation to the database...\n";
    query("ALTER DATABASE {$dbname} COLLATE utf8_unicode_ci");
    if ($currVersion == -1) {
        echo "Installing database version {$abxd_version}...\n";
    } else {
        echo "Upgrading database from version {$currVersion} to {$abxd_version}...\n";
    }
    upgrade();
    $misc = Query("select * from {misc}");
    if (NumRows($misc) == 0) {
        Query("INSERT INTO `{misc}` (`views`, `hotcount`, `milestone`, `maxuserstext`) VALUES (0, 30, 'Nothing yet.', 'Nobody yet.');");
    }
    Query("UPDATE `{misc}` SET `version` = {0}", $abxd_version);
    if (!is_dir("config")) {
        mkdir("config");
    }
    if ($currVersion == -1) {
        //Stuff to do on new installation (Not upgrade)
        Import("install/smilies.sql");
        if ($convert) {
            runConverter($convertFrom, $convertDbName, $convertPrefix);
        } else {
            Import("install/installDefaults.sql");
        }
        if (file_exists("config/salt.php")) {
            echo "Not generating new salt.php as it's already present...\n";
        } else {
            echo "Generating new salt.php...\n";
            writeConfigSalt();
        }
    }
    if (!file_exists("config/database.php")) {
        writeConfigDatabase();
    }
}
<?php

include 'PDO_Conn.php';
//Include the Connection File
Import();
echo "Successfully Imported all Insert Statements .Exit";
//Import Functions Begins Below
function Creat_Applications()
{
    get_Groups();
    /*
    1)It Gets the Statement row ID.Checks if the ID is Unique or not .If not then removes the ID and let the row use the Auto-increment to assign an ID 
    2)The only process is done before the Import is to check if the row contains Table handle.If it's text ,also  Uniq or not in the DB ,so to avoid multiple duplicates after Insert.If it was ID then updated after we get the New ID 
    3)Usually post Process for each table is done after each insert .Unless the Post process involves a global process ,for example Ele_Value might contain groups ID so we need to wait till we are done with the Group Insert  
    */
    //Those  variables will store the New AppID/Form ID  if Needed.
    global $Element_ID;
    //Every time ID is Inserted in the DB it will be pushed here to be used later on for the Ele_Filter settings and Ele_Value
    global $Calc_ID;
    //To store the Calculation IDs
    $Calc_ID = array();
    $Element_ID = array();
    session_start();
    $file = $_SESSION['file'];
    //Gets the String of inserts from grp33.php file
    $getlines = file_get_contents($file);
    $get_line = explode(';', $getlines);
    set_time_limit(0);
    foreach ($get_line as $statement) {
        if (strstr($statement, "Create table")) {
            Create_table($statement);
示例#10
0
$logSqlErrors = 0;
?>';
    if (file_put_contents(__DIR__ . '/config/database.php', $dbconfig) === FALSE) {
        die('Error: failed to create the config file. Check the permissions of the user running PHP.' . $footer);
    }
    $salt = Shake(24);
    define('SALT', $salt);
    $saltfile = '<?php define(\'SALT\', ' . phpescape($salt) . '); ?>';
    file_put_contents(__DIR__ . '/config/salt.php', $saltfile);
    $kurifile = '<?php define(\'KURIKEY\', ' . phpescape(Shake(32)) . '); ?>';
    file_put_contents(__DIR__ . '/config/kurikey.php', $kurifile);
    require __DIR__ . '/lib/mysql.php';
    require __DIR__ . '/db/functions.php';
    $debugMode = 1;
    Upgrade();
    Import(__DIR__ . '/db/install.sql');
    $pss = Shake(16);
    $sha = hash('sha256', $boardpassword . $salt . $pss, FALSE);
    Query("insert into {users} (id, name, password, pss, primarygroup, regdate, lastactivity, lastip, email, sex, theme) values ({0}, {1}, {2}, {3}, {4}, {5}, {5}, {6}, {7}, {8}, {9})", 1, $boardusername, $sha, $pss, 4, time(), $_SERVER['REMOTE_ADDR'], '', 2, 'blargboard');
    ?>
	<h3>Your new Blargboard board has been successfully installed!</h3>
	<br>
	You should now log in to your board</a> and configure it.<br>
	<br>
	Thank you for choosing Blargboard!<br>
	<br>
<?php 
    unlink(__DIR__ . '/db/install.sql');
    unlink(__DIR__ . '/install.php');
} else {
    ?>
 /**
  * _getWiget 
  * 获得widget
  * @param mixed $link 
  * @param mixed $map 
  * @access private
  * @return void
  */
 private function _getWiget($link, $map)
 {
     Import('@.Widget.FileAwayWidget');
     $wiget = new FileAwayWidget();
     $wiget->assign('link', $link);
     $wiget->assign('condition', $map);
     $wiget->assign('instance', $this->mini);
     $wiget->assign('APP', __APP__);
     return $wiget->render();
 }
示例#12
0
/**
 * fda 
 * SamPeng封装的FirePHP批量调试
 * @access public
 * @return void
 */
function fda($var_array, $null = true, $filter = null, $all = false)
{
    Import("@.Unit.FirePHPCore.FirePHP");
    $firephp = FirePHP::getInstance(true);
    if (is_array($var_array)) {
        foreach ($var_array as $key => $value) {
            if (is_string($key)) {
                !is_object($value) && $filter == null;
                fd($value, $null, $filter, $firephp, $key);
            }
        }
        if ($all == true) {
            $firephp->logo(debug_backtrace());
        }
        $firephp->trace("Trace Label");
        $firephp->group("全部系统变量");
        $firephp->fb($_SERVER, "SERVER变量");
        $firephp->groupEnd();
        $firephp->group("全部Session");
        $firephp->fb($_SESSION, "SESSION变量");
        $firephp->groupEnd();
        $firephp->group("全部请求变量");
        isset($_GET) && $firephp->fb($_GET, "GET传值");
        isset($_POST) && $firephp->fb($_POST, "POST传值");
        isset($_REQUEST) && $firephp->fb($_REQUEST, "REQUEST请求");
        $firephp->groupEnd();
        return;
    }
    fd($value, $null, $filter, $firephp);
    $firephp->group("全部系统变量");
    $firephp->fb($_SERVER, "SERVER变量");
    $firephp->groupEnd();
    $firephp->group("全部Session");
    $firephp->fb($_SESSION, "SESSION变量");
    $firephp->groupEnd();
    $firephp->group("全部请求变量");
    isset($_GET) && $firephp->fb($_GET, "GET传值");
    isset($_POST) && $firephp->fb($_POST, "POST传值");
    isset($_REQUEST) && $firephp->fb($_REQUEST, "REQUEST请求");
    $firephp->groupEnd();
    if ($all == true) {
        $firephp->log(debug_backtrace());
    }
    $firephp->trace("Trace Label");
}
 /**
  * doDeleteSubscribe
  * 删除订阅源
  * @access public
  * @return void
  */
 public function doDeleteSubscribe()
 {
     Import('@.Unit.LeadIn');
     $sourceId = array_filter(explode(',', $_POST['sourceId']));
     if (empty($sourceId)) {
         echo -1;
         exit;
     }
     $leadIn = new LeadIn();
     if ($leadIn->deleSubscribe($sourceId, $this->mid)) {
         echo 1;
         exit;
     }
 }
示例#14
0
<body>
	<div id="wrapper">
<?php 
//require "config.php";
require "functions.php";
require "includes.php";
require "menu.php";
//print_r($_POST);
/* ----- setup variables ----- */
$action = GetVariable("action");
$data = GetVariable("data");
/* determine action */
switch ($action) {
    case 'import':
        Import($data);
        break;
    default:
        DisplayImportForm();
}
/* ------------------------------------ functions ------------------------------------ */
/* -------------------------------------------- */
/* ------- Import ----------------------------- */
/* -------------------------------------------- */
function Import($data)
{
    $lines = explode("\n", $data);
    $lastfilegroupid = 0;
    $groupid = 0;
    foreach ($lines as $line) {
        ?>