Esempio n. 1
0
 /**
  * md文件解析
  */
 public function md()
 {
     $file = $this->get('file');
     $p = $this->get('p');
     // 目录
     $directory = MD_FILE_ROOT_PATH . $p . '/';
     // 如果不存在自动创建
     filesystem::mkdir($directory);
     // 遍历文件夹所有内容
     $path = array();
     $dir = filesystem::ls($directory);
     usort($dir, 'compare');
     foreach ($dir as $d) {
         $path[] = trim($d);
     }
     //  解析mk文件
     $file = $directory . $file;
     if (is_file($file)) {
         $md = new markdown($file);
         $html = $md->parse();
         view::assign('html', $html);
     }
     view::assign('path', $path);
     view::assign('p', $p);
     view::assign('file', str_replace($directory, '', $file));
 }
Esempio n. 2
0
 /**
  * 字节数转换
  */
 public function bytes()
 {
     $bytes = $this->post_ufloat('bytes');
     if ($bytes <= 0) {
         return;
     }
     $result = filesystem::bytes($bytes);
     view::assign('result', $result);
     view::assign('input', $bytes);
 }
Esempio n. 3
0
 /**
  * Recursively creates new folders from the specified path or paths
  *
  * @param   mixed   a single path or an array of paths
  * @param   number  initial permissions for 
  * @return  mixed   the cleaned path or array of paths
  */
 public static function make_path($path, $permissions = 0755)
 {
     if (is_array($path)) {
         foreach ($path as $p) {
             $arr = array();
             array_push($arr, filesystem::make_path($p, $permissions));
         }
         return $arr;
     } else {
         $path = preg_replace('%/+%', '/', $path);
         // remove double slashes
         $path = preg_replace('%/$%', '', $path);
         // remove trailing slash
         $folders = preg_split('%(?!^)/%', $path);
         // split into path segments, preserving any initial leading slash
         $path = '';
         foreach ($folders as $folder) {
             $path .= $folder . '/';
             if (!file_exists($path)) {
                 mkdir($path, $permissions);
             }
         }
         return dir($path);
     }
 }
Esempio n. 4
0
<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (($path = trim($_GET['path'])) == "") {
    header("Location: ./404.php");
    exit;
} elseif (!is_file($path) || !is_readable($path)) {
    header("Location: ./404.php");
    exit;
} else {
    $myfs = new filesystem($path);
    $info = $myfs->getpath();
    header("Content-Type: application/force-download");
    header("Content-Disposition: attachment; filename=" . ___basename($path));
    header("Accept-Ranges: bytes");
    header("Content-Length: " . $info['size']);
    $fp = fopen($path, "rb");
    while (!feof($fp)) {
        echo fread($fp, 4096);
    }
    fclose($fp);
}
Esempio n. 5
0
<?php

$error = array();
include '../data/config.inc.php';
require_once '../classes/class.filesystem.php';
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$config['ftp_path'] = $config['ftp_path'] . '/install';
$filesystem->set_wd($config['ftp_path']);
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 1) {
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], false, $config['dbprefix']);
    $db->errlogfile = '../' . $db->errlogfile;
    $db->pre = $db->prefix();
    $db->connect(false);
    if (!$db->hasConnection()) {
        ?>
	<div class="bbody">Could not connect to database! Pleasy try again later or check the database settings!</div>
	<div class="bfoot center"><a class="submit" href="index.php?package=install&amp;step=<?php 
        echo $step - 2;
        ?>
">Go back</a> <a class="submit" href="index.php?package=install&amp;step=<?php 
        echo $step;
        ?>
">Refresh</a></div>
		<?php 
    } else {
        if (!$db->select_db()) {
            ?>
	<div class="bbody">Could not find database <em><?php 
            echo $db->database;
            ?>
<?php

namespace rude;

require_once 'rude-globals.php';
require_once 'rude-filesystem.php';
$_source_list = filesystem::search_files(realpath(__DIR__ . '/../'), 'php');
# scan for .php files
function autoload($class_name)
{
    global $_source_list;
    if (!$_source_list) {
        return;
    }
    $class_name = explode('\\', $class_name)[1];
    # rude\warcraft_map => warcraft_map
    $class_name = str_replace('_', '-', $class_name);
    # warcraft_map => warcraft-map
    foreach ($_source_list as $source_path) {
        $source_file = basename($source_path);
        if ($source_file == 'rude-' . $class_name . '.php') {
            if (file_exists($source_path)) {
                require_once $source_path;
                return;
            }
        }
    }
}
spl_autoload_register('rude\\autoload');
# show all errors/warnings/stricts
if (defined('RUDE_DEBUG') and RUDE_DEBUG) {
Esempio n. 7
0
 /**
  * 生成二维码
  * @param string $string 生成二维码的数据
  * @param string $errorCorrentionLevel 容错级别 默认L  L|M|Q|H
  * @param int $matrixPointSize 二维码大小 默认4
  * @param int $margin 旁白大小 默认2
  * @param string $logo logo图片路径
  */
 public static function QRCode($string, $logo = NULL, $errorCorrectionLevel = 'L', $matrixPointSize = 4, $margin = 2)
 {
     $path = ROOT . '/extends/phpqrcode/phpqrcode.php';
     if (file_exists($path)) {
         include_once $path;
     }
     $filename = ROOT . '/application/download/' . md5($string) . '.png';
     \QRcode::png($string, $filename, $errorCorrectionLevel, $matrixPointSize, $margin);
     if (!empty($logo) && filesystem::path($logo) && filesystem::path($filename)) {
         $QR = imagecreatefromstring(file_get_contents($filename));
         $logo = imagecreatefromstring(file_get_contents($logo));
         $QR_width = imagesx($filename);
         //二维码图片宽度
         $QR_height = imagesy($filename);
         //二维码图片高度
         $logo_width = imagesx($logo);
         //logo图片宽度
         $logo_height = imagesy($logo);
         //logo图片高度
         $logo_qr_width = $QR_width / 5;
         $scale = $logo_width / $logo_qr_width;
         $logo_qr_height = $logo_height / $scale;
         $from_width = ($QR_width - $logo_qr_width) / 2;
         //重新组合图片并调整大小
         imagecopyresampled($filename, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
     }
     return $filename;
 }
Esempio n. 8
0
<?php

require '../data/config.inc.php';
require_once '../classes/class.filesystem.php';
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$filesystem->set_wd($config['ftp_path']);
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 1) {
    include '../classes/class.phpconfig.php';
    if (isset($_REQUEST['host'])) {
        $config['host'] = trim($_REQUEST['host']);
    } else {
        $config['host'] = 'localhost';
    }
    if (isset($_REQUEST['dbuser'])) {
        $config['dbuser'] = trim($_REQUEST['dbuser']);
    }
    if (isset($_REQUEST['dbpw'])) {
        $config['dbpw'] = trim($_REQUEST['dbpw']);
    }
    if (isset($_REQUEST['database'])) {
        $config['database'] = trim($_REQUEST['database']);
    }
    if (isset($_REQUEST['pconnect']) && isset($_REQUEST['dbsystem']) && $_REQUEST['dbsystem'] == 'mysql') {
        $config['pconnect'] = $_REQUEST['pconnect'];
    } else {
        $config['pconnect'] = 0;
    }
    if (isset($_REQUEST['dbprefix'])) {
        $config['dbprefix'] = trim($_REQUEST['dbprefix']);
    } else {
        $config['dbprefix'] = '';
Esempio n. 9
0
<?php

include 'data/config.inc.php';
if (!class_exists('filesystem')) {
    require_once 'install/classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path'], $config['fpath']);
}
$tar_packs = array(1 => 'update.admin.tar', 2 => 'update.misc.tar');
if (empty($_REQUEST['sub']) || !isset($tar_packs[$_REQUEST['sub']])) {
    $sub = 1;
} else {
    $sub = $_REQUEST['sub'];
}
require 'install/classes/function.chmod.php';
require 'install/classes/class.tar.php';
$tar = new tar(realpath('install/files/'), $tar_packs[$sub]);
$tar->ignore_chmod();
$error = $tar->extract_files('./');
$files = implode("\n", $tar->list_files());
$dirs = array('language' => null, 'templates' => null, 'designs' => null, 'images' => null);
preg_match_all('~^(' . implode('|', array_keys($dirs)) . ')/(\\d+)/([^\\n]+)$~m', $files, $replicable, PREG_SET_ORDER);
foreach ($replicable as $rep) {
    if ($dirs[$rep[1]] === null) {
        $dirs[$rep[1]] = array();
        $dir = dir($rep[1]);
        while (false !== ($entry = $dir->read())) {
            if (is_id($entry) && is_dir($rep[1] . '/' . $entry)) {
                $dirs[$rep[1]][$entry] = $rep[1] . '/' . $entry . '/';
            }
        }
Esempio n. 10
0
    global $db;
    $l = array();
    $result = $db->query('SELECT id FROM ' . $db->pre . 'language ORDER BY language', __LINE__, __FILE__);
    while ($row = $db->fetch_assoc($result)) {
        $settings = return_array('settings', $row['id']);
        if (!isset($l[$settings['spellcheck_dict']])) {
            $l[$settings['spellcheck_dict']] = array();
        }
        $l[$settings['spellcheck_dict']] = $row['id'];
    }
    return $l;
}
echo "- Source files loaded<br />";
if (!class_exists('filesystem')) {
    require_once '../classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path']);
}
if (!class_exists('DB')) {
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], true, $config['dbprefix']);
    $db->pre = $db->prefix();
    $db->errlogfile = '../' . $db->errlogfile;
}
echo "- FTP class loaded, Database connection started.<br />";
// Config
$c = new manageconfig();
$c->getdata('../data/config.inc.php');
$c->updateconfig('version', str, VISCACHA_VERSION);
$c->updateconfig('syndication_insert_email', int, 0);
$c->savedata();
Esempio n. 11
0
<?php

$error = array();
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 1) {
    include '../data/config.inc.php';
    require_once '../classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path']);
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], false, $config['dbprefix']);
    $db->errlogfile = '../' . $db->errlogfile;
    $db->pre = $db->prefix();
    $db->connect(false);
    if (!is_resource($db->conn)) {
        ?>
	<div class="bbody">Could not connect to database! Pleasy try again later or check the database settings!</div>
	<div class="bfoot center"><a class="submit" href="index.php?step=<?php 
        echo $step - 2;
        ?>
">Go back</a> <a class="submit" href="index.php?step=<?php 
        echo $step;
        ?>
">Refresh</a></div>
		<?php 
    } else {
        if (!$db->select_db()) {
            ?>
	<div class="bbody">Could not find database <em><?php 
            echo $db->database;
            ?>
</em>! Please create a new database with this name or choose another database!</div>
Esempio n. 12
0
<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (is_dir($path = ___realpath(trim($_GET['path'])))) {
    header("Location: ./404.php");
    exit;
}
$fs = new filesystem($path);
xhtml_head(___shortpath($path));
if (!($data = $fs->getpath($path))) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>]\n";
    echo "</div>\n";
} else {
    echo "<div class=\"love\">\n";
    echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\">[返回]</a>\n<br/>";
    echo "文件名称:" . ___basename($path) . "<br />\n";
    echo "文件大小:" . ___filesize($data['size']) . "<br />\n";
    echo "所有者ID:{$data['uid']}<br />\n";
    echo "所有组ID:{$data['gid']}<br />\n";
    echo "上次访问:" . gmdate("Y-m-d H:i:s", $data['atime'] + TIME) . "<br />\n";
    echo "上次修改:" . gmdate("Y-m-d H:i:s", $data['mtime'] + TIME) . "<br />\n";
    echo "上次改变:" . gmdate("Y-m-d H:i:s", $data['ctime'] + TIME) . "<br />\n";
    echo "</div>\n";
    echo "<div class=\"like\">\n";
    echo "爱特解压<a href=\"./index.php?new&path=" . urlencode(dirname($path)) . "&multiple=unpackdir&getcwd=" . urlencode($path) . "\">目标目录</a>\n";
    echo "</div>\n";
    echo "<div class=\"love\">\n";
    $_SESSION['email_tmp_file'] = $GO_CONFIG->tmpdir . $filename;
    require $GO_CONFIG->class_path . 'filetypes.class.inc';
    $filetypes = new filetypes();
    $extension = get_extension($filename);
    if (!($type = $filetypes->get_type($extension))) {
        $filetypes->add_type($extesnion, $mime);
    }
}
if ($filename == '') {
    $filename = basename($_SESSION['email_tmp_file']);
} else {
    $filename = smartstrip($filename);
}
if (isset($task) && $task == 'GO_HANDLER') {
    require $GO_CONFIG->class_path . 'filesystem.class.inc';
    $fs = new filesystem();
    if (file_exists(smartstrip($_REQUEST['path']) . '/' . $filename)) {
        $feedback = '<p class="Error">' . $fbNameExists . '</p>';
    } elseif (!$fs->has_write_permission($GO_SECURITY->user_id, smartstrip($_REQUEST['path']))) {
        $feedback = '<p class="Error">' . $strAccessDenied . ': ' . smartstrip($_REQUEST['path']) . '</p>';
    } else {
        $new_path = smartstrip($_REQUEST['path']) . '/' . $filename;
        if ($fs->move($_SESSION['email_tmp_file'], $new_path)) {
            $old_umask = umask(00);
            chmod($new_path, $GO_CONFIG->create_mode);
            umask($old_umask);
            unset($_SESSION['tmp_account_id']);
            unset($_SESSION['email_tmp_file']);
            echo "<script type=\"text/javascript\" language=\"javascript\">\n";
            echo "window.close()\n";
            echo "</script>\n";
Esempio n. 14
0
<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (is_dir($path = ___realpath(trim($_GET['path'])))) {
    header("Location: ./404.php");
    exit;
}
$fs = new filesystem($path);
xhtml_head(___shortpath($path));
if (!($data = $fs->getpath($path))) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./dlym.php?path=" . urlencode($getcwd) . "\">返回目录</a>]\n";
    echo "</div>\n";
} else {
    echo "<div class=\"like\">\n";
    echo "<a href=\"./dlym.php?path=" . urlencode(dirname($path)) . "\">返回目录</a>文件详情\n";
    echo "</div>\n";
    echo "<div class=\"love\">\n";
    echo "文件名称:" . ___basename($path) . "<br />\n";
    if ($perms = $fs->getperms()) {
        echo "文件权限:{$perms}<br />\n";
    }
    echo "文件大小:" . ___filesize($data['size']) . "<br />\n";
    echo "所有者ID:{$data['uid']}<br />\n";
    echo "所有组ID:{$data['gid']}<br />\n";
    if (function_exists("mime_content_type")) {
        echo "文件类型:" . mime_content_type($path) . "<br />\n";
    }
Esempio n. 15
0
if (!isset($_GET['getcwd'])) {
    $getcwd = OPEN;
} else {
    $getcwd = ___realpath(trim($_GET['getcwd']));
}
xhtml_head("批量复制");
if (!is_dir($gopath = trim($_GET['gopath']))) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./multiple.php?type=copy&getcwd=" . urlencode($getcwd) . "\">返回</a>]抱歉,目标目录非法!\n";
    echo "</div>\n";
} elseif (count($_SESSION['flist']) < 1) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./dlym.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
    echo "</div>\n";
} else {
    $i = 0;
    $fs = new filesystem();
    echo "<div class=\"like\">\n";
    echo "<a href=\"./dlym.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
    echo "</div>";
    while ($i < count($_SESSION['flist'])) {
        $fs->chpath($_SESSION['flist'][$i]);
        if ($fs->cppath($tmp = $gopath . "/" . ___basename($_SESSION['flist'][$i]))) {
            echo "<div class=\"love\">[{$i}][√]&nbsp;-&nbsp;{$tmp}</div>\n";
        } else {
            echo "<div class=\"error\">[{$i}][×]&nbsp;-&nbsp;{$tmp}</div>\n";
        }
        $i++;
    }
}
xhtml_footer();
Esempio n. 16
0
<?php

require "config.php";
$path = isset($_GET['path']) ? trim($_GET['path']) : OPEN;
if ($path == "" || !is_dir($path)) {
    $path = OPEN;
}
$filesystem = new filesystem($path);
if (!isset($_GET['multiple'])) {
    $multiple = null;
} else {
    if (($multiple = trim($_GET['multiple'])) == "") {
        $multiple = null;
    } else {
        if ($multiple == "unpackdir" && isset($_GET['getcwd'])) {
            if (file_exists($getcwd = trim($_GET['getcwd']))) {
                if (isset($_GET['new'])) {
                    $_SESSION['ffpath'] = $getcwd;
                }
            }
        }
        $multiple = "&multiple={$multiple}";
    }
}
xhtml_head("爱特文件管理器");
echo "<div class=\"love\">\n";
echo "<form action=\"\" method=\"GET\">\n";
echo "路径跳转:<input type=\"text\" name=\"path\" />\n";
if ($multiple != null) {
    echo "<input type=\"hidden\" name=\"multiple\" value=\"{$_GET['multiple']}\" />\n";
}
Esempio n. 17
0
        unset($dependencies[$key]);
        $n++;
        if ($n > 10000) {
            trigger_error("setPackagesInactive(): Your database is inconsistent - Please ask the Viscacha support for help.", E_USER_ERROR);
            // Break loop, Database seems to be inconsistent (or thousands of packages are installed)
        }
    }
    if (count($disable) > 0) {
        $in = implode(',', array_keys($disable));
        $db->query("UPDATE {$db->pre}packages SET active = '0' WHERE id IN ({$in})");
    }
}
echo "- Source files loaded<br />";
if (!class_exists('filesystem')) {
    require_once '../classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path']);
}
if (!class_exists('DB')) {
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['dbprefix']);
    $db->setPersistence($config['pconnect']);
    $db->errlogfile = '../' . $db->errlogfile;
}
echo "- FTP class loaded, Database connection started.<br />";
// Config/Hooks
$c = new manageconfig();
$c->getdata('../data/config.inc.php');
$c->updateconfig('version', str, VISCACHA_VERSION);
$c->delete('asia');
$c->savedata();
Esempio n. 18
0
 /**
  * 写入缓存
  *
  * @param unknown $url        	
  * @param unknown $content        	
  * @return int
  */
 public function write($url, $content)
 {
     $md5 = md5($url);
     $file = filesystem::path($this->_config['path'] . '/' . $md5 . '.' . $this->_config['suffix']);
     return file_put_contents($file, $content);
 }
if (empty($config['cryptkey']) || empty($config['database']) || empty($config['dbsystem'])) {
    trigger_error('Viscacha is currently not installed. How to install Viscacha is described in the file "_docs/readme.txt"!', E_USER_ERROR);
}
if ((empty($config['dbpw']) || empty($config['dbuser'])) && $config['local_mode'] == 0) {
    trigger_error('You have specified database authentification data that is not safe. Please change your database user and the database password!', E_USER_ERROR);
}
// Debugging / Error Handling things
require_once "classes/function.errorhandler.php";
// Variables
require_once "classes/function.gpc.php";
// A class for Languages
require_once "classes/class.language.php";
$lang = new lang();
// Filesystem
require_once "classes/class.filesystem.php";
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$filesystem->set_wd($config['ftp_path'], $config['fpath']);
// Database functions
require_once 'classes/database/' . $config['dbsystem'] . '.inc.php';
$db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['dbprefix']);
$db->setPersistence($config['pconnect']);
/* 	Handling of _GET, _POST, _REQUEST, _COOKIE, _SERVER, _ENV
 	_ENV, _SERVER: Won't be checked, but null-byte is deleted
 	_COOKIE: You can check them in the script ( getcookie() ), won't be checked
 	_REQUEST: Won't be checked - array has the original values (but without magic_quotes)
 	_POST, _GET with keys specified in http_vars are checked and save
*/
$http_vars = array('action' => str, 'job' => str, 'name' => str, 'email' => db_esc, 'topic' => str, 'comment' => str, 'pw' => str, 'pwx' => str, 'order' => str, 'sort' => str, 'letter' => str, 'fullname' => str, 'about' => str, 'location' => str, 'signature' => str, 'hp' => str, 'icq' => str, 'pic' => db_esc, 'question' => str, 'type' => str, 'gender' => str, 'aol' => db_esc, 'msn' => db_esc, 'skype' => db_esc, 'yahoo' => db_esc, 'jabber' => db_esc, 'board' => int, 'topic_id' => int, 'id' => int, 'page' => int, 'temp' => int, 'temp2' => int, 'dosmileys' => int, 'dowords' => int, 'birthday' => int, 'birthmonth' => int, 'birthyear' => int, 'opt_0' => int, 'opt_1' => int, 'opt_2' => int, 'opt_3' => int, 'opt_4' => int, 'opt_5' => int, 'opt_6' => int, 'opt_7' => int, 'notice' => arr_str, 'delete' => arr_int);
$http_all = array_merge(array_keys($http_vars), is_array($_POST) ? array_keys($_POST) : array(), is_array($_GET) ? array_keys($_GET) : array());
$http_all = array_unique($http_all);
foreach ($http_all as $key) {
Esempio n. 20
0
 } else {
     $full_publish_path = '';
     $dirs = explode($GO_CONFIG->slash, $publish_path);
     while ($dir = array_shift($dirs)) {
         $full_publish_path = $full_publish_path . $dir . $GO_CONFIG->slash;
         $existing_site = $cms->get_site_by_publish_path(addslashes($full_publish_path));
         if ($existing_site && $existing_site['id'] != $site_id) {
             $path_used = true;
             break;
         }
     }
     if (isset($path_used)) {
         $feedback = '<p class="Error">' . $cms_path_already_used . '</p>';
     } else {
         require_once $GO_CONFIG->class_path . 'filesystem.class.inc';
         $fs = new filesystem(true);
         $site = $cms->get_site($site_id);
         if ($site['publish_path'] != '' && file_exists($root_publish_path . $site['publish_path']) && $site['publish_path'] != $publish_path) {
             $publish_dir = $root_publish_path;
             $dirs = explode($GO_CONFIG->slash, $site['publish_path']);
             while ($dir = array_shift($dirs)) {
                 $publish_dir = $publish_dir . $dir . $GO_CONFIG->slash;
                 $fs->delete($publish_dir);
             }
         }
         $full_publish_path = $root_publish_path;
         $dirs = explode($GO_CONFIG->slash, $publish_path);
         while ($dir = array_shift($dirs)) {
             $full_publish_path = $full_publish_path . $dir . $GO_CONFIG->slash;
             if (!file_exists($full_publish_path)) {
                 @mkdir($full_publish_path);
Esempio n. 21
0
 private function autoinstall()
 {
     $q = new mysql();
     writelogs("FREEWEB: running autoinstall()", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
     if (!$q->DATABASE_EXISTS($this->database)) {
         writelogs("[{$this->servername}] DATABASE DOES NOT EXISTS Create e new one", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
         $q->CREATE_DATABASE($this->database);
     }
     global $GO_LANGUAGE, $lang, $GO_EVENTS;
     require "{$this->www_dir}/Group-Office.php";
     require_once "{$this->www_dir}/classes/filesystem.class.inc";
     require_once "{$this->www_dir}/install/gotest.php";
     include_once "{$this->www_dir}/classes/base/events.class.inc.php";
     require "{$this->www_dir}/language/languages.inc.php";
     require "{$this->www_dir}/install/sql/updates.inc.php";
     require_once "{$this->www_dir}/classes/base/users.class.inc.php";
     require_once "{$this->www_dir}/classes/base/groups.class.inc.php";
     require $GO_LANGUAGE->get_base_language_file('countries');
     require_once "{$this->www_dir}/classes/base/theme.class.inc.php";
     $GO_THEME = new GO_THEME();
     $db = new db();
     $GO_EVENTS = new GO_EVENTS();
     $GO_CONFIG->save_setting('version', count($updates));
     $GO_LANGUAGE->set_language($GO_CONFIG->language);
     $GO_USERS = new GO_USERS();
     $user['id'] = $GO_USERS->nextid("go_users");
     echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" userid \"{$user['id']}\"\n";
     $GO_GROUPS = new GO_GROUPS();
     $GO_GROUPS->query("DELETE FROM go_db_sequence WHERE seq_name='groups'");
     $GO_GROUPS->query("DELETE FROM go_groups");
     $admin_group_id = $GO_GROUPS->add_group(1, $lang['common']['group_admins']);
     $everyone_group_id = $GO_GROUPS->add_group(1, $lang['common']['group_everyone']);
     $internal_group_id = $GO_GROUPS->add_group(1, $lang['common']['group_internal']);
     $GO_MODULES->load_modules();
     require_once "{$this->www_dir}/install/upgrade.php";
     $fs = new filesystem();
     $module_folders = $fs->get_folders($GO_CONFIG->root_path . 'modules/');
     $available_modules = array();
     foreach ($module_folders as $folder) {
         if (!file_exists($folder['path'] . '/install/noautoinstall')) {
             echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" checking module {$folder['name']}\n";
             $available_modules[] = $folder['name'];
         }
     }
     $priority_modules = array('summary', 'email', 'calendar', 'tasks', 'addressbook', 'files', 'notes', 'projects', 'ldapauth');
     for ($i = 0; $i < count($priority_modules); $i++) {
         if (in_array($priority_modules[$i], $available_modules)) {
             echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" add module \"{$priority_modules[$i]}\" [" . $i . "/" . count($priority_modules) . "]\n";
             $GO_MODULES->add_module($priority_modules[$i]);
         }
     }
     for ($i = 0; $i < count($available_modules); $i++) {
         if (!in_array($available_modules[$i], $priority_modules)) {
             if ($available_modules[$i] == "mailings") {
                 continue;
             }
             /*
             if($available_modules[$i]=="blacklist"){continue;}
             if($available_modules[$i]=="search"){continue;}
             if($available_modules[$i]=="modules"){continue;}
             //if($available_modules[$i]=="users"){continue;}
             //if($available_modules[$i]=="comments"){continue;}
             //if($available_modules[$i]=="sieve"){continue;}
             //if($available_modules[$i]=="bookmarks"){continue;}
             //if($available_modules[$i]=="links"){continue;}
             */
             echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" add module \"{$available_modules[$i]}\" [" . $i . "/" . count($available_modules) . "]\n";
             try {
                 $GO_MODULES->add_module($available_modules[$i]);
             } catch (Exception $e) {
                 echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" failed adding \"{$available_modules[$i]}\" module\n";
             }
         }
     }
     writelogs("Adding LDAPAUTH Module GO_MODULES->add_module('ldapauth')", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
     $GO_MODULES->add_module('ldapauth');
     echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" save_setting upgrade_mtime\n";
     $GO_CONFIG->save_setting('upgrade_mtime', $GO_CONFIG->mtime);
     if ($this->uid != null) {
         $u = new user($this->uid);
         $password = $u->password;
         $mail = $u->mail;
         $uid = $this->uid;
         writelogs("Adding {$this->uid}/{$u->password}/{$mail} Module GO_USERS->add_user", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
     } else {
         $ldap = new clladp();
         $uid = $ldap->ldap_admin;
         $password = $ldap->ldap_password;
         $mail = "*****@*****.**";
     }
     $GO_USERS->nextid('go_users');
     writelogs("Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" adding \"{$uid}\" language {$GO_LANGUAGE->language} user {$mail}", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
     $user['id'] = 1;
     $user['language'] = $GO_LANGUAGE->language;
     $user['first_name'] = $GO_CONFIG->product_name;
     $user['middle_name'] = '';
     $user['last_name'] = "en";
     $user['username'] = "******";
     $user['password'] = "******";
     $user['email'] = "{$mail}";
     $user['sex'] = 'M';
     $user['enabled'] = '1';
     $user['country'] = $GO_CONFIG->default_country;
     $user['work_country'] = $GO_CONFIG->default_country;
     //$GO_USERS->debug=true;
     $GO_USERS->add_user($user, array(1, 2, 3), array($GO_CONFIG->group_everyone));
     writelogs("Starting......: " . date("H:i:s") . " Apache installtion of group office success", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
 }
    die('Error: Hacking Attempt');
}
if (in_array('config', array_keys(array_change_key_case($_REQUEST)))) {
    die('Error: Hacking Attemp (Config variable)');
}
// Gets a file with php-functions
@(include_once "classes/function.phpcore.php");
if (empty($config['cryptkey']) || empty($config['database']) || empty($config['dbsystem'])) {
    trigger_error('Viscacha is currently not installed. How to install Viscacha is described in the file "_docs/readme.txt"!', E_USER_ERROR);
}
if (empty($config['dbpw']) || empty($config['dbuser'])) {
    trigger_error('You have specified database authentification data that is not safe. Please change your database user and the database password!', E_USER_ERROR);
}
// Filesystem
require_once "classes/class.filesystem.php";
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$filesystem->set_wd($config['ftp_path']);
// Variables
require_once "classes/function.gpc.php";
/* 	Handling of _GET, _POST, _REQUEST, _COOKIE, _SERVER, _ENV
 	_ENV, _SERVER: Won't be checked, but null-byte is deleted
 	_COOKIE: You can check them in the script ( getcookie() ), won't be checked
 	_REQUEST: Won't be checked - array has the original values (but without magic_quotes)
 	_POST, _GET with heysk specified in http_vars are checked and save
*/
$http_vars = array('action' => str, 'job' => str, 'search' => str, 'name' => str, 'email' => str, 'topic' => str, 'comment' => str, 'error' => str, 'pw' => str, 'pwx' => str, 'order' => str, 'sort' => str, 'letter' => str, 'fullname' => str, 'about' => str, 'location' => str, 'signature' => str, 'hp' => str, 'icq' => str, 'pic' => str, 'question' => str, 'type' => str, 'gender' => str, 'aol' => str, 'msn' => str, 'skype' => str, 'yahoo' => str, 'jabber' => str, 'fid' => str, 'file' => str, 'groups' => str, 'captcha' => str, 'board' => int, 'topic_id' => int, 'id' => int, 'page' => int, 'temp' => int, 'temp2' => int, 'dosmileys' => int, 'dowords' => int, 'birthday' => int, 'birthmonth' => int, 'birthyear' => int, 'opt_0' => int, 'opt_1' => int, 'opt_2' => int, 'opt_3' => int, 'opt_4' => int, 'opt_5' => int, 'opt_6' => int, 'opt_7' => int, 'notice' => arr_str, 'boards' => arr_int, 'delete' => arr_int);
$http_all = array_merge(array_keys($http_vars), is_array($_POST) ? array_keys($_POST) : array(), is_array($_GET) ? array_keys($_GET) : array());
$http_all = array_unique($http_all);
$http_std = array(int => 0, arr_int => array(), arr_str => array(), str => '', none => null);
foreach ($http_all as $key) {
    if (isset($http_vars[$key])) {
Esempio n. 23
0
<?php

require "config.php";
$path = isset($_GET['path']) ? trim($_GET['path']) : OPEN;
if ($path == "" || !is_dir($path)) {
    $path = OPEN;
}
$filesystem = new filesystem($path);
if (!isset($_GET['multiple'])) {
    $multiple = null;
} else {
    if (($multiple = trim($_GET['multiple'])) == "") {
        $multiple = null;
    } else {
        if (($multiple == "unzipdir" || $multiple == "unpackdir") && isset($_GET['getcwd'])) {
            if (file_exists($getcwd = trim($_GET['getcwd']))) {
                if (isset($_GET['new'])) {
                    $_SESSION['ffpath'] = $getcwd;
                }
            }
        }
        $multiple = "&multiple={$multiple}";
    }
}
xhtml_head("文件管理器");
echo "<div class=\"love\">\n";
echo "<form action=\"\" method=\"GET\">\n";
echo "路径跳转:<input type=\"text\" name=\"path\" />\n";
if ($multiple != null) {
    echo "<input type=\"hidden\" name=\"multiple\" value=\"{$_GET['multiple']}\" />\n";
}
Esempio n. 24
0
  Copyright Intermesh 2003
  Author: Merijn Schering <*****@*****.**>
  Version: 1.0 Release date: 08 July 2003

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate(true);
require $GO_LANGUAGE->get_base_language_file('modules');
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$return_to = $GO_CONFIG->host . 'configuration/';
require_once $GO_CONFIG->class_path . 'filesystem.class.inc';
$fs = new filesystem();
$modules = $fs->get_folders($GO_CONFIG->module_path);
$existing_modules = array();
$selected_modules = isset($_POST['selected_modules']) ? $_POST['selected_modules'] : array();
$page_title = $menu_modules;
require $GO_THEME->theme_path . "header.inc";
switch ($task) {
    case 'install':
        $module_id = $_POST['module_id'];
        $acl_read = $GO_SECURITY->get_new_acl('Module read: ' . $module_id, 0);
        $acl_write = $GO_SECURITY->get_new_acl('Module write: ' . $module_id, 0);
        if ($acl_read > 0 && $acl_write > 0) {
            if ($GO_SECURITY->add_user_to_acl($GO_SECURITY->user_id, $acl_write) && $GO_SECURITY->add_user_to_acl($GO_SECURITY->user_id, $acl_read)) {
                if (!$GO_MODULES->add_module($module_id, $_REQUEST['version'], $acl_read, $acl_write)) {
                    $feedback = '<p class="Error">' . $strSaveError . '</p>';
                }
Esempio n. 25
0
<div class="bbody">
Preparing update...<br />
<?php 
include '../data/config.inc.php';
require_once 'lib/function.variables.php';
include '../classes/class.phpconfig.php';
if (!class_exists('filesystem')) {
    require_once '../classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path']);
}
if (!class_exists('DB')) {
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], true, $config['dbprefix']);
    $db->pre = $db->prefix();
    $db->errlogfile = '../' . $db->errlogfile;
}
// admin
$file = '../admin/data/hooks.txt';
$edit = file_get_contents($file);
$edit = preg_replace("~(-editprofile_abos_end[\r\n]+)~i", "\\1-editprofile_pic3_start\r\n-editprofile_pic3_end\r\n", $edit);
$edit = preg_replace("~(-misc_rules_end[\r\n]+)~i", "\\1-misc_board_rules_start\r\n-misc_board_rules_prepared\r\n-misc_board_rules_end\r\n", $edit);
$filesystem->chmod($file, 0666);
$filesystem->file_put_contents($file, $edit);
$file = '../admin/data/lang_email.php';
$edit = file($file);
$edit = array_map("trim", $edit);
$edit[] = "new_topic\tNotification about new topics for the board team";
$edit[] = "new_reply\tNotification about new replies for the board team";
$filesystem->chmod($file, 0666);
$filesystem->file_put_contents($file, implode("\n", $edit));
Esempio n. 26
0
<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (!file_exists($path = trim($_GET['path']))) {
    header("Location: ./404.php");
    exit;
}
xhtml_head("创建复件");
echo "[<a href=\"./dlym.php?path=" . urlencode(dirname($path)) . "\">返回目录</a>]\n";
if (isset($_GET['yes'])) {
    $to = dirname($path) . "/" . ___basename($path) . "-copy";
    if (file_exists($to)) {
        echo "目标复件已经存在!";
    } else {
        $fs = new filesystem($path);
        if ($fs->cppath($to)) {
            echo "成功为您创建复件!";
        } else {
            echo "无法为您创建复件!";
        }
    }
} else {
    echo "需要复件,<a href=\"?yes&path=" . urlencode($path) . "\">确认创建</a>?";
}
xhtml_footer();
Esempio n. 27
0
if (!isset($_GET['dirperms']) || !isset($_GET['fileperms']) || !isset($_SESSION['flist'])) {
    header("Location: ./404.php");
    exit;
}
if (!isset($_GET['getcwd'])) {
    $getcwd = OPEN;
} else {
    $getcwd = ___realpath(trim($_GET['getcwd']));
}
xhtml_head("批量改权");
if (count($_SESSION['flist']) < 1) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
    echo "</div>\n";
} else {
    $i = 0;
    $fs = new filesystem();
    echo "<div class=\"like\">\n";
    echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
    echo "</div>";
    while ($i < count($_SESSION['flist'])) {
        $fs->chpath($tmp = $_SESSION['flist'][$i]);
        if ($fs->chmod(trim($_GET['dirperms']), trim($_GET['fileperms']))) {
            echo "<div class=\"love\">[{$i}][√]&nbsp;-&nbsp;{$tmp}</div>\n";
        } else {
            echo "<div class=\"error\">[{$i}][×]&nbsp;-&nbsp;{$tmp}</div>\n";
        }
        $i++;
    }
}
xhtml_footer();
Esempio n. 28
0
 /**
  * Helper function to create a directory if it doesn't exist.
  * @param <type> $path Path to dir to create
  * @return <type>
  */
 private function createFolder($path)
 {
     /* check if folder exists */
     return is_dir($path) or filesystem::createDirectory($path);
 }
<?php

if (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) == "function.viscacha_backend.php") {
    die('Error: Hacking Attempt');
}
// Gets a file with php-functions
@(include_once "classes/function.phpcore.php");
require_once "classes/class.filesystem.php";
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$filesystem->set_wd($config['ftp_path']);
@(include_once "classes/function.chmod.php");
if ($config['check_filesystem'] == 1) {
    check_writable('admin/data/notes.php');
    check_writable_r('docs');
    check_writable_r('language');
    check_executable_r('admin/backup');
    check_executable_r('admin/data');
    check_executable_r('designs');
    check_executable_r('docs');
    check_executable_r('images');
    check_executable_r('templates');
    check_executable_r('components');
    check_executable_r('language');
    check_executable('classes/cron/jobs');
    check_executable('classes/feedcreator');
    check_executable('classes/fonts');
    check_executable('classes/geshi');
    check_executable('classes/graphic/noises');
    check_writable_r('templates');
}
@ini_set('default_charset', '');
Esempio n. 30
0
echo "<strong>Starting Update:</strong><br />";
require 'data/config.inc.php';
require_once 'install/classes/class.phpconfig.php';
function loadSettingArray($path)
{
    include "{$path}/settings.lng.php";
    if (isset($lang['lang_code'])) {
        return $lang;
    } else {
        return array('lang_code' => 'en');
    }
}
echo "- Source files loaded<br />";
if (!class_exists('filesystem')) {
    require_once 'install/classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path'], $config['fpath']);
}
echo "- FTP class loaded and initialized.<br />";
if (!class_exists('DB')) {
    require_once 'install/classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['dbprefix']);
    $db->setPersistence($config['pconnect']);
}
echo "- Database class loaded and initialized.<br />";
// Config
$c = new manageconfig();
$c->getdata('data/config.inc.php');
$c->updateconfig('version', str, VISCACHA_VERSION);
$c->savedata();
echo "- Configuration updated.<br />";