Exemplo n.º 1
0
function coloreditor($data, $color_name)
{
    global $dbh;
    global $client;
    $insertvalues = '';
    foreach ($data as $name => $value) {
        $insertvalues .= "('" . mysqli_real_escape_string($dbh, $name) . "', '" . mysqli_real_escape_string($dbh, $value) . "', '" . mysqli_real_escape_string($dbh, $color_name) . "'),";
    }
    $insertvalues = rtrim($insertvalues, ',');
    if (!empty($insertvalues)) {
        $sql = "replace into `cometchat_colors` (`color_key`,`color_value`, `color`) values " . $insertvalues;
        $query = mysqli_query($dbh, $sql);
    }
    removeCachedSettings($client . 'cometchat_color');
    if (is_dir(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'writable' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $client)) {
        clearcache(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'writable' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $client);
    }
}
Exemplo n.º 2
0
function clearcache($pattern)
{
    $files = glob($pattern . "*.xml");
    foreach ((array) $files as $file) {
        if ($file == '..' || $file == '.') {
            continue;
        }
        if (is_file($file)) {
            unlink($file);
        }
    }
    $dirs = glob($pattern . "*");
    foreach ((array) $dirs as $dir) {
        if ($dir == '..' || $dir == '.') {
            continue;
        }
        if (is_dir($dir)) {
            clearcache($dir . '/');
        }
    }
}
Exemplo n.º 3
0
function clearcache($src)
{
    global $client;
    global $server;
    if ($handle = opendir($src)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != "index.html") {
                if (is_dir($src . DIRECTORY_SEPARATOR . $file)) {
                    clearcache($src . DIRECTORY_SEPARATOR . $file);
                } else {
                    @unlink($src . DIRECTORY_SEPARATOR . $file);
                }
            }
        }
    }
}
Exemplo n.º 4
0
    if (strlen($val) == 0) {
        $val = 0;
        $style = "lightblue";
    } else {
        $style = "steelblue";
    }
    echo "     <tr><td style=\"color:" . $style . ";\">" . $s[0] . "</td><td style=\"color:" . $style . ";\">" . $s[$m] . "</td></tr>\n";
    return $val;
}
//! Get a row and display
function unusedRow($fh, $m)
{
    $s = fgetcsv($fh, 256);
    echo "     <tr><td style=\"color: gray;\">" . $s[0] . "</td><td style=\"color: gray;\">" . $s[$m] . "</td></tr>\n";
}
clearcache();
//! Set to 0 if upload successful, != 0 if not
$uploaderror = 1;
//! Display style for serious error messages
$err = "<p style=\"background-color:red; color:beige; font-weight:bold;\">";
echo " <div style=\"color: steelblue; font-family: helvetica; " . "background-color: azure; font-size: 14px;\">\n";
//echo "<center>User:[" . $_SESSION['call'] . "]<br />\n";
//! Remember whether an error message was generated
$errmsg = 0;
//! If we have a valid file.
if (isset($_FILES['myfile'])) {
    if ($_FILES['myfile']['error'] == 0) {
        //Then we need to confirm it is of a file type we want.
        if (in_array($_FILES['myfile']['type'], $GLOBALS['allowedcsvmimetypes'])) {
            //Then we can perform the copy.
            $filename = $GLOBALS['csvfolder'] . "/" . $_FILES['myfile']['name'];
Exemplo n.º 5
0
	function DoImport()
	{
		$this->CheckAdminPrivs('dbimport');
		extract($this->Post);
		extract($this->Get);
		$readerror = 0;
		$datafile = '';
		if($from == 'server') {
			$datafile = ROOT_PATH.'./'.$datafile_server;
		}
		$dbcharset = $this->DatabaseHandler->Charset;

		
		if(@$fp = fopen($datafile, 'rb')) {
			$sqldump = fgets($fp, 256);
			$identify = explode(',', base64_decode(preg_replace("/^# Identify:\s*(\w+).*/s", "\\1", $sqldump)));
			$dumpinfo = array('method' => $identify[3], 'volume' => intval($identify[4]));
			if($dumpinfo['method'] == 'multivol') {
				$sqldump .= fread($fp, filesize($datafile));
			}
			fclose($fp);
		} else {
			if($autoimport) {
				clearcache();
				$this->Messager('分卷数据成功导入数据库。',null);
			} else {
				$this->Messager('数据文件不存在: 可能服务器不允许上传文件或尺寸超过限制。',null);
			}
		}

		if($dumpinfo['method'] == 'multivol') {
			$sqlquery = splitsql($sqldump);
			unset($sqldump);
			$supetablepredot = strpos($supe['tablepre'], '.');
			$supe['dbname'] =  $supetablepredot !== FALSE ? substr($supe['tablepre'], 0, $supetablepredot) : '';

			foreach($sqlquery as $sql) {

				$sql = syntablestruct(trim($sql), $this->DatabaseHandler->GetVersion() > '4.1', $dbcharset);

				if(substr($sql, 0, 11) == 'INSERT INTO') {
					$sqldbname = substr($sql, 12, 20);
					$dotpos = strpos($sqldbname, '.');
					if($dotpos !== FALSE) {
						if(empty($supe['dbmode'])) {
							$sql = 'INSERT INTO `'.$supe['dbname'].'`.'.substr($sql, 13 + $dotpos);
						} else {
													}
					}
				}

				if($sql != '') {
					$this->DatabaseHandler->Query($sql, 'SKIP_ERROR');
					if(($sqlerror = $this->DatabaseHandler->GetLastErrorString()) && $this->DatabaseHandler->GetLastErrorNo() != 1062) {
						die('MySQL Query Error'.$sql);
					}
				}
			}

			if($delunzip) {
				@unlink($datafile_server);
			}

			$datafile_next = preg_replace("/-($dumpinfo[volume])(\..+)$/", "-".($dumpinfo['volume'] + 1)."\\2", $datafile_server);

			if($dumpinfo['volume'] == 1) {
				$to="admin.php?mod=db&code=doimport&from=server&datafile_server=".urlencode($datafile_next)."&autoimport=yes&importsubmit=yes".(!empty($delunzip) ? '&delunzip=yes' : '');
				$msg='            <form method="post" action="'.$to.'">
                    <br /><br /><br />分卷数据成功导入数据库,您需要自动导入本次其它的备份吗?<br /><br /><br /><br />
                    <input type="hidden" name="FORMHASH" value="'.FORMHASH.'"> &nbsp;
                    <input class="button" type="submit" name="confirmed" value=" 确 定 "> &nbsp;
                    <input class="button" type="button" value=" 取 消 " onClick="history.go(-1);">
                  </form><br />';
				$this->Messager($msg,null);
			} elseif($autoimport) {
				$this->Messager("数据文件 #{$dumpinfo['volume']} 成功导入,程序将自动继续。", "admin.php?mod=db&code=doimport&from=server&datafile_server=".urlencode($datafile_next)."&autoimport=yes&importsubmit=yes".(!empty($delunzip) ? '&delunzip=yes' : ''));
			} else {
				clearcache();
				$this->Messager('数据成功导入数据库。',null);
			}
		} elseif($dumpinfo['method'] == 'shell') {
			require './config.inc.php';
			list($dbhost, $dbport) = explode(':', $dbhost);

			$query = $this->DatabaseHandler->Query("SHOW VARIABLES LIKE 'basedir'");
			list(, $mysql_base) = $db->fetch_array($query, MYSQL_NUM);

			$mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base).'bin/';
			shell_exec($mysqlbin.'mysql -h"'.$dbhost.($dbport ? (is_numeric($dbport) ? ' -P'.$dbport : ' -S"'.$dbport.'"') : '').
			'" -u"'.$dbuser.'" -p"'.$dbpw.'" "'.$dbname.'" < '.$datafile);

			clearcache();
			$this->Messager('数据成功导入数据库。',null);
		} else {
			$this->Messager('数据文件非 天天团购 格式,无法导入。');
		}

	}
Exemplo n.º 6
0
	function Signup_request()
	{
		$account = post('account');
		$password = post('password');
		$result = logic('acl')->Signup($account, $password);
		if ($result != 'ok')
		{
			$this->checkErrorNoDATA($result);
			$this->Messager($result, -1);
		}
		$aclData = logic('acl')->Account();
		$uStop = $aclData['upgrade']['stop'];
		if ($uStop)
		{
			$this->Messager($uStop, null);
		}
				clearcache();
				header('Location: admin.php?mod=upgrade');
	}
Exemplo n.º 7
0
	function clearCache()
	{
		$this->CheckAdminPrivs('upgrade');
		clearcache();
		$msg="缓存已清空,升级完成。<br>";
		$this->Messager($msg, 'admin.php?mod=index&code=home');
	}
Exemplo n.º 8
0
	function UpdateCache()
	{
		clearcache();
		$this->Messager("修改成功","admin.php?mod=rewrite");
	}