Exemplo n.º 1
0
function sql_fetch_array_($result, $db = G5_MYSQL_ROOT)
{
    global $connect_db;
    $select_db = sql_select_db($db, $connect_db);
    $row = @mysql_fetch_assoc($result);
    $select_db = sql_select_db(G5_MYSQL_DB, $connect_db);
    return $row;
}
Exemplo n.º 2
0
/**
 * simplified common.php by wkpark @ gmail.com
 * since 2015/04/29
 */
function g4_get_member()
{
    global $g4, $g5, $g4_root_dir;
    // init
    $member = array();
    if (!defined('G5_VERSION')) {
        include_once "{$g4_root_dir}/lib/constant.php";
        // constants
    }
    include_once "{$g4_root_dir}/lib/common.lib.php";
    // common library
    if (defined('G5_VERSION')) {
        include_once "{$g4_root_dir}/data/dbconfig.php";
        // db configs
    } else {
        include_once "{$g4_root_dir}/dbconfig.php";
        // db configs
    }
    if (defined('G5_VERSION')) {
        $connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD);
        $select_db = sql_select_db(G5_MYSQL_DB, $connect_db);
        $g5['connect_db'] = $connect_db;
        sql_query(" set names utf8 ");
    } else {
        $connect_db = sql_connect($mysql_host, $mysql_user, $mysql_password);
        $select_db = sql_select_db($mysql_db, $connect_db);
    }
    // is it a valid PHPSESSID ?
    if ($_REQUEST['PHPSESSID'] && $_REQUEST['PHPSESSID'] != session_id()) {
        $member['mb_id'] = '';
        return $member;
    }
    // already logged in
    if (!empty($_SESSION['ss_mb_id'])) {
        $member = get_member($_SESSION['ss_mb_id']);
    }
    return $member;
}
Exemplo n.º 3
0
    return $result;
}
$g5_path = g5_path();
include_once $g5_path['path'] . '/config.php';
// 설정 파일
unset($g5_path);
//==============================================================================
// 공통
//------------------------------------------------------------------------------
$dbconfig_file = G5_DATA_PATH . '/' . G5_DBCONFIG_FILE;
if (file_exists($dbconfig_file)) {
    include_once $dbconfig_file;
    include_once G5_LIB_PATH . '/common.lib.php';
    // 공통 라이브러리
    $connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD) or die('MySQL Connect Error!!!');
    $select_db = sql_select_db(G5_MYSQL_DB, $connect_db) or die('MySQL DB Error!!!');
    @mysql_query(" set names utf8 ");
    if (defined('G5_MYSQL_SET_MODE') && G5_MYSQL_SET_MODE) {
        @mysql_query("SET SESSION sql_mode = ''");
    }
    if (defined(G5_TIMEZONE)) {
        @mysql_query(" set time_zone = '" . G5_TIMEZONE . "'");
    }
} else {
    ?>

<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>오류! <?php 
Exemplo n.º 4
0
$g5_shop_prefix = $_POST['g5_shop_prefix'];
$g5_shop_install = $_POST['g5_shop_install'];
$dblink = sql_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
if (!$dblink) {
    ?>

<div class="ins_inner">
    <p>MySQL Host, User, Password 를 확인해 주십시오.</p>
    <div class="inner_btn"><a href="./install_config.php">뒤로가기</a></div>
</div>

<?php 
    include_once './install.inc2.php';
    exit;
}
$select_db = sql_select_db($mysql_db, $dblink);
if (!$select_db) {
    ?>

<div class="ins_inner">
    <p>MySQL DB 를 확인해 주십시오.</p>
    <div class="inner_btn"><a href="./install_config.php">뒤로가기</a></div>
</div>

<?php 
    include_once './install.inc2.php';
    exit;
}
$mysql_set_mode = 'false';
sql_set_charset('utf8', $dblink);
$result = sql_query(" SELECT @@sql_mode as mode ", true, $dblink);
Exemplo n.º 5
0
function pDataConnect()
{
    $connection = sql_connect("127.0.0.1", $_SESSION["localUser"], $_SESSION["localPass"]);
    sql_select_db($_SESSION["pDatabase"], $connection);
    return $connection;
}
Exemplo n.º 6
0
// \ 를 / 롤 변경
$g4['url'] = strtr($g4['url'], "\\", "/");
// url 의 끝에 있는 / 를 삭제한다.
$g4['url'] = preg_replace("/\\/\$/", "", $g4['url']);
// _COMMON_SIMPLE_ 상수가 정의되어있지 않으면 디비와 세션을 모두 사용
if (!defined('_COMMON_SIMPLE_')) {
    //==============================================================================
    // 공통
    //==============================================================================
    $dirname = dirname(__FILE__) . '/';
    $dbconfig_file = 'data/dbconfig.php';
    if (file_exists($g4['path'] . '/' . $dbconfig_file)) {
        //if (is_dir("$g4[path]/install")) die("<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'><script type='text/javascript'> alert('install 디렉토리를 삭제하여야 정상 실행됩니다.'); </script>");
        include_once $g4['path'] . '/' . $dbconfig_file;
        $connect_db = sql_connect($mysql_host, $mysql_user, $mysql_password);
        $select_db = sql_select_db($mysql_db, $connect_db);
        if (!$select_db) {
            die("<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'><script type='text/javascript'> alert('DB 접속 오류'); </script>");
        }
    } else {
        echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
        echo <<<HEREDOC
        <script type="text/javascript">
        alert("DB 설정 파일이 존재하지 않습니다.\\n\\n프로그램 설치 후 실행하시기 바랍니다.");
        location.href = "./install/";
        </script>
HEREDOC;
        exit;
    }
    unset($my);
    // DB 설정값을 클리어 해줍니다.
Exemplo n.º 7
0
    $query = "SELECT * FROM configure";
    $result = sql_query($query, $db);
    $row = sql_fetch_array($result);
    foreach ($array as $key => $value) {
        $num = $value[3];
        if ($value[1] == "text") {
            echo "<tr><td>&nbsp;</td><td align=right><font face=arial>{$value['0']}:</font></td>\r\n\t\t\t<td><input type={$value['1']} value='" . $row[$num] . "' size={$value['2']} name={$value['3']}></td></tr>";
        } elseif ($row[$num] == 1) {
            echo "<tr><td>&nbsp;</td><td align=right><font face=arial>{$value['0']}:</font></td>\r\n\t\t\t<td><input type={$value['1']} value=1 checked={$value['2']} name={$value['3']}></td></tr>";
        } else {
            echo "<tr><td>&nbsp;</td><td align=right><font face=arial>{$value['0']}:</font></td>\r\n\t\t\t<td><input type={$value['1']} value=1 name={$value['3']}></td></tr>";
        }
    }
} else {
    $db = pDataconnect();
    sql_select_db("opData", $db);
    $query = "SELECT * FROM configure";
    $result = sql_query($query, $db);
    $row = sql_fetch_array($result);
    $numRow = sql_num_rows($result);
    if ($numRow != 0) {
        foreach ($array as $key => $value) {
            $num = $value[3];
            if ($value[1] == "text") {
                echo "<tr><td>&nbsp;</td><td align=right><font face=arial>{$value['0']}:</font></td>\r\n\t\t\t<td><input type={$value['1']} value='" . $row[$num] . "' size={$value['2']} name={$value['3']}></td></tr>";
            } elseif ($row[$num] == 1) {
                echo "<tr><td>&nbsp;</td><td align=right><font face=arial>{$value['0']}:</font></td>\r\n\t\t\t<td><input type={$value['1']} value=1 checked={$value['2']} name={$value['3']}></td></tr>";
            } else {
                echo "<tr><td>&nbsp;</td><td align=right><font face=arial>{$value['0']}:</font></td>\r\n\t\t\t<td><input type={$value['1']} value=1 name={$value['3']}></td></tr>";
            }
        }
Exemplo n.º 8
0
function doInstall()
{
    global $mysql_usePrefix, $mysql_prefix, $weblog_ping;
    // 0. put all POST-vars into vars
    $mysql_host = postVar('mySQL_host');
    $mysql_user = postVar('mySQL_user');
    $mysql_password = postVar('mySQL_password');
    $mysql_database = postVar('mySQL_database');
    $mysql_create = postVar('mySQL_create');
    $mysql_usePrefix = postVar('mySQL_usePrefix');
    $mysql_prefix = postVar('mySQL_tablePrefix');
    $config_indexurl = postVar('IndexURL');
    $config_adminurl = postVar('AdminURL');
    $config_adminpath = postVar('AdminPath');
    $config_mediaurl = postVar('MediaURL');
    $config_skinsurl = postVar('SkinsURL');
    $config_pluginurl = postVar('PluginURL');
    $config_actionurl = postVar('ActionURL');
    $config_mediapath = postVar('MediaPath');
    $config_skinspath = postVar('SkinsPath');
    $user_name = postVar('User_name');
    $user_realname = postVar('User_realname');
    $user_password = postVar('User_password');
    $user_password2 = postVar('User_password2');
    $user_email = postVar('User_email');
    $blog_name = postVar('Blog_name');
    $blog_shortname = postVar('Blog_shortname');
    $charset = postVar('charset');
    $config_adminemail = $user_email;
    $config_sitename = $blog_name;
    $weblog_ping = postVar('Weblog_ping');
    $_POST = array();
    $config_indexurl = replaceDoubleBackslash($config_indexurl);
    $config_adminurl = replaceDoubleBackslash($config_adminurl);
    $config_mediaurl = replaceDoubleBackslash($config_mediaurl);
    $config_skinsurl = replaceDoubleBackslash($config_skinsurl);
    $config_pluginurl = replaceDoubleBackslash($config_pluginurl);
    $config_actionurl = replaceDoubleBackslash($config_actionurl);
    $config_adminpath = replaceDoubleBackslash($config_adminpath);
    $config_skinspath = replaceDoubleBackslash($config_skinspath);
    $config_mediapath = replaceDoubleBackslash($config_mediapath);
    /**
     * Include and initialize multibyte functions as a replacement for mbstring extension
     *  if mbstring extension is not loaded.
     * Jan.28, 2011. Japanese Package Release Team
     */
    if (!function_exists('mb_convert_encoding')) {
        global $mbemu_internals;
        include_once $config_adminpath . 'libs/mb_emulator/mb-emulator.php';
    }
    if (function_exists('date_default_timezone_set')) {
        @date_default_timezone_set(function_exists('date_default_timezone_get') ? @date_default_timezone_get() : 'UTC');
    }
    if ($charset == 'ujis') {
        define('_CHARSET', 'EUC-JP');
        $config_sitename = mb_convert_encoding($config_sitename, _CHARSET, 'UTF-8');
        $user_realname = mb_convert_encoding($user_realname, _CHARSET, 'UTF-8');
        $blog_name = mb_convert_encoding($blog_name, _CHARSET, 'UTF-8');
    } else {
        define('_CHARSET', 'UTF-8');
    }
    // 1. check all the data
    $errors = array();
    if (!$mysql_database) {
        array_push($errors, _ERROR2);
    }
    if ($mysql_usePrefix == 1 && strlen($mysql_prefix) == 0) {
        array_push($errors, _ERROR3);
    }
    if ($mysql_usePrefix == 1 && !preg_match('#^[a-zA-Z0-9_]+$#', $mysql_prefix)) {
        array_push($errors, _ERROR4);
    }
    // TODO: add action.php check
    if (!endsWithSlash($config_indexurl) || !endsWithSlash($config_adminurl) || !endsWithSlash($config_mediaurl) || !endsWithSlash($config_pluginurl) || !endsWithSlash($config_skinsurl)) {
        array_push($errors, _ERROR5);
    }
    if (!endsWithSlash($config_adminpath)) {
        array_push($errors, _ERROR6);
    }
    if (!endsWithSlash($config_mediapath)) {
        array_push($errors, _ERROR7);
    }
    if (!endsWithSlash($config_skinspath)) {
        array_push($errors, _ERROR8);
    }
    if (!is_dir($config_adminpath)) {
        array_push($errors, _ERROR9);
    }
    if (!_isValidMailAddress($user_email)) {
        array_push($errors, _ERROR10);
    }
    if (!_isValidDisplayName($user_name)) {
        array_push($errors, _ERROR11);
    }
    if (!$user_password || !$user_password2) {
        array_push($errors, _ERROR12);
    }
    if ($user_password != $user_password2) {
        array_push($errors, _ERROR13);
    }
    if (!_isValidShortName($blog_shortname)) {
        array_push($errors, _ERROR14);
    }
    if (sizeof($errors) > 0) {
        showErrorMessages($errors);
    }
    // 2. try to log in to mySQL
    global $MYSQL_CONN;
    // this will need to be changed if we ever allow
    $MYSQL_CONN = @sql_connect_args($mysql_host, $mysql_user, $mysql_password);
    if ($MYSQL_CONN == false) {
        _doError(_ERROR15 . ': ' . sql_error());
    }
    // 3. try to create database (if needed)
    $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info())));
    $collation = $charset == 'utf8' ? 'utf8_general_ci' : 'ujis_japanese_ci';
    if ($mysql_create == 1) {
        $sql = 'CREATE DATABASE ' . $mysql_database;
        // <add for garble measure>
        if (version_compare($mySqlVer, '4.1.0', '>=')) {
            $sql .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;
        }
        // </add for garble measure>*/
        sql_query($sql, $MYSQL_CONN) or _doError(_ERROR16 . ': ' . sql_error($MYSQL_CONN));
    }
    // 4. try to select database
    sql_select_db($mysql_database, $MYSQL_CONN) or _doError(_ERROR17);
    /*
     * 4.5. set character set to this database in MySQL server
     * This processing is added by Nucleus CMS Japanese Package Release Team as of Mar.30, 2011
     */
    sql_set_charset_jp($charset);
    // 5. execute queries
    $filename = 'install.sql';
    $fd = fopen($filename, 'r');
    $queries = fread($fd, filesize($filename));
    fclose($fd);
    $queries = split("(;\n|;\r)", $queries);
    $aTableNames = array('nucleus_actionlog', 'nucleus_ban', 'nucleus_blog', 'nucleus_category', 'nucleus_comment', 'nucleus_config', 'nucleus_item', 'nucleus_karma', 'nucleus_member', 'nucleus_plugin', 'nucleus_skin', 'nucleus_template', 'nucleus_team', 'nucleus_activation', 'nucleus_tickets');
    // these are unneeded (one of the replacements above takes care of them)
    //			'nucleus_plugin_event',
    //			'nucleus_plugin_option',
    //			'nucleus_plugin_option_desc',
    //			'nucleus_skin_desc',
    //			'nucleus_template_desc',
    $aTableNamesPrefixed = array($mysql_prefix . 'nucleus_actionlog', $mysql_prefix . 'nucleus_ban', $mysql_prefix . 'nucleus_blog', $mysql_prefix . 'nucleus_category', $mysql_prefix . 'nucleus_comment', $mysql_prefix . 'nucleus_config', $mysql_prefix . 'nucleus_item', $mysql_prefix . 'nucleus_karma', $mysql_prefix . 'nucleus_member', $mysql_prefix . 'nucleus_plugin', $mysql_prefix . 'nucleus_skin', $mysql_prefix . 'nucleus_template', $mysql_prefix . 'nucleus_team', $mysql_prefix . 'nucleus_activation', $mysql_prefix . 'nucleus_tickets');
    // these are unneeded (one of the replacements above takes care of them)
    //			$mysql_prefix . 'nucleus_plugin_event',
    //			$mysql_prefix . 'nucleus_plugin_option',
    //			$mysql_prefix . 'nucleus_plugin_option_desc',
    //			$mysql_prefix . 'nucleus_skin_desc',
    //			$mysql_prefix . 'nucleus_template_desc',
    $count = count($queries);
    for ($idx = 0; $idx < $count; $idx++) {
        $query = trim($queries[$idx]);
        // echo "QUERY = " . htmlspecialchars($query) . "<p>";
        if ($query) {
            if ($mysql_usePrefix == 1) {
                $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);
            }
            // <add for garble measure>
            if ($mysql_create != 1 && strpos($query, 'CREATE TABLE') === 0 && version_compare($mySqlVer, '4.1.0', '>=')) {
                $query .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;
            }
            // </add for garble measure>*/
            sql_query($query, $MYSQL_CONN) or _doError(_ERROR30 . ' (' . htmlspecialchars($query) . '): ' . sql_error($MYSQL_CONN));
        }
    }
    // 5a make first post
    if (strtoupper(_CHARSET) != 'UTF-8') {
        $itm_title = mb_convert_encoding(_1ST_POST_TITLE, _CHARSET, 'UTF-8');
        $itm_body = mb_convert_encoding(_1ST_POST, _CHARSET, 'UTF-8');
        $itm_more = mb_convert_encoding(_1ST_POST2, _CHARSET, 'UTF-8');
    } else {
        $itm_title = _1ST_POST_TITLE;
        $itm_body = _1ST_POST;
        $itm_more = _1ST_POST2;
    }
    $newpost = "INSERT INTO " . tableName('nucleus_item') . " VALUES (" . "1, " . "'" . $itm_title . "'," . " '" . $itm_body . "'," . " '" . $itm_more . "'," . " 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);";
    sql_query($newpost, $MYSQL_CONN) or _doError(_ERROR18 . ' (' . htmlspecialchars($newpost) . '): ' . sql_error($MYSQL_CONN));
    // 6. update global settings
    updateConfig('IndexURL', $config_indexurl);
    updateConfig('AdminURL', $config_adminurl);
    updateConfig('MediaURL', $config_mediaurl);
    updateConfig('SkinsURL', $config_skinsurl);
    updateConfig('PluginURL', $config_pluginurl);
    updateConfig('ActionURL', $config_actionurl);
    updateConfig('AdminEmail', $config_adminemail);
    updateConfig('SiteName', $config_sitename);
    if ($charset == 'ujis') {
        updateConfig('Language', 'japanese-euc');
    }
    // 7. update GOD member
    $query = 'UPDATE ' . tableName('nucleus_member') . " SET mname\t = '" . addslashes($user_name) . "'," . " mrealname\t = '" . addslashes($user_realname) . "'," . " mpassword\t = '" . md5(addslashes($user_password)) . "'," . " murl\t\t  = '" . addslashes($config_indexurl) . "'," . " memail\t\t= '" . addslashes($user_email) . "'," . " madmin\t\t= 1," . " mcanlogin\t = 1" . " WHERE" . " mnumber\t   = 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR19 . ': ' . sql_error($MYSQL_CONN));
    // 8. update weblog settings
    $query = 'UPDATE ' . tableName('nucleus_blog') . " SET bname  = '" . addslashes($blog_name) . "'," . " bshortname = '" . addslashes($blog_shortname) . "'," . " burl\t   = '" . addslashes($config_indexurl) . "'" . " WHERE" . " bnumber\t= 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN));
    // 8-2. update category settings
    if (strtoupper(_CHARSET) != 'UTF-8') {
        $cat_name = mb_convert_encoding(_GENERALCAT_NAME, _CHARSET, 'UTF-8');
        $cat_desc = mb_convert_encoding(_GENERALCAT_DESC, _CHARSET, 'UTF-8');
    } else {
        $cat_name = _GENERALCAT_NAME;
        $cat_desc = _GENERALCAT_DESC;
    }
    $query = 'UPDATE ' . tableName('nucleus_category') . " SET cname  = '" . $cat_name . "'," . " cdesc\t  = '" . $cat_desc . "'" . " WHERE" . " catid\t  = 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN));
    // 9. update item date
    $query = 'UPDATE ' . tableName('nucleus_item') . " SET   itime   = '" . date('Y-m-d H:i:s', time()) . "'" . " WHERE inumber = 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR21 . ': ' . sql_error($MYSQL_CONN));
    global $aConfPlugsToInstall, $aConfSkinsToImport;
    $aSkinErrors = array();
    $aPlugErrors = array();
    if (count($aConfPlugsToInstall) > 0 || count($aConfSkinsToImport) > 0) {
        // 10. set global variables
        global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX;
        $MYSQL_HOST = $mysql_host;
        $MYSQL_USER = $mysql_user;
        $MYSQL_PASSWORD = $mysql_password;
        $MYSQL_DATABASE = $mysql_database;
        $MYSQL_PREFIX = $mysql_usePrefix == 1 ? $mysql_prefix : '';
        global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;
        $DIR_NUCLEUS = $config_adminpath;
        $DIR_MEDIA = $config_mediapath;
        $DIR_SKINS = $config_skinspath;
        $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
        $DIR_LANG = $DIR_NUCLEUS . 'language/';
        $DIR_LIBS = $DIR_NUCLEUS . 'libs/';
        // close database connection (needs to be closed if we want to include globalfunctions.php)
        sql_close($MYSQL_CONN);
        $manager = '';
        include_once $DIR_LIBS . 'globalfunctions.php';
        // 11. install custom skins
        $aSkinErrors = installCustomSkins($manager);
        $defskinQue = 'SELECT `sdnumber` as result FROM ' . sql_table('skin_desc') . ' WHERE `sdname` = "default"';
        $defSkinID = quickQuery($defskinQue);
        $updateQuery = 'UPDATE ' . sql_table('blog') . ' SET `bdefskin` = ' . intval($defSkinID) . ' WHERE `bnumber` = 1';
        sql_query($updateQuery);
        $updateQuery = 'UPDATE ' . sql_table('config') . ' SET `value` = ' . intval($defSkinID) . ' WHERE `name` = "BaseSkin"';
        sql_query($updateQuery);
        // 12. install NP_Ping, if decided
        if ($weblog_ping == 1) {
            global $aConfPlugsToInstall;
            array_push($aConfPlugsToInstall, "NP_Ping");
        }
        // 13. install custom plugins
        $aPlugErrors = installCustomPlugs($manager);
    }
    // 14. Write config file ourselves (if possible)
    $bConfigWritten = 0;
    if (@file_exists('../config.php') && is_writable('../config.php') && ($fp = @fopen('../config.php', 'w'))) {
        $config_data = '<' . '?php' . "\n\n";
        //$config_data .= "\n"; (extraneous, just added extra \n to previous line
        $config_data .= "   // mySQL connection information\n";
        $config_data .= "   \$MYSQL_HOST\t = '" . $mysql_host . "';\n";
        $config_data .= "   \$MYSQL_USER\t = '" . $mysql_user . "';\n";
        $config_data .= "   \$MYSQL_PASSWORD = '******';\n";
        $config_data .= "   \$MYSQL_DATABASE = '" . $mysql_database . "';\n";
        $config_data .= "   \$MYSQL_PREFIX   = '" . ($mysql_usePrefix == 1 ? $mysql_prefix : '') . "';\n";
        $config_data .= "   // new in 3.50. first element is db handler, the second is the db driver used by the handler\n";
        $config_data .= "   // default is \$MYSQL_HANDLER = array('mysql','');\n";
        $config_data .= "   //\$MYSQL_HANDLER = array('mysql','mysql');\n";
        $config_data .= "   //\$MYSQL_HANDLER = array('pdo','mysql');\n";
        $config_data .= "   \$MYSQL_HANDLER = array('" . $MYSQL_HANDLER[0] . "','" . $MYSQL_HANDLER[1] . "');\n";
        $config_data .= "\n";
        $config_data .= "   // main nucleus directory\n";
        $config_data .= "   \$DIR_NUCLEUS = '" . $config_adminpath . "';\n";
        $config_data .= "\n";
        $config_data .= "   // path to media dir\n";
        $config_data .= "   \$DIR_MEDIA   = '" . $config_mediapath . "';\n";
        $config_data .= "\n";
        $config_data .= "   // extra skin files for imported skins\n";
        $config_data .= "   \$DIR_SKINS   = '" . $config_skinspath . "';\n";
        $config_data .= "\n";
        $config_data .= "   // these dirs are normally sub dirs of the nucleus dir, but \n";
        $config_data .= "   // you can redefine them if you wish\n";
        $config_data .= "   \$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";
        $config_data .= "   \$DIR_LANG\t= \$DIR_NUCLEUS . 'language/';\n";
        $config_data .= "   \$DIR_LIBS\t= \$DIR_NUCLEUS . 'libs/';\n";
        $config_data .= "\n";
        $config_data .= "   // include libs\n";
        $config_data .= "   include(\$DIR_LIBS . 'globalfunctions.php');\n";
        $config_data .= "?" . ">";
        $result = @fputs($fp, $config_data, strlen($config_data));
        fclose($fp);
        if ($result) {
            $bConfigWritten = 1;
        }
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><?php 
    echo _TITLE;
    ?>
</title>
	<style>@import url('../nucleus/styles/manual.css');</style>
</head>
<body>
	<div style="text-align:center"><img src="../nucleus/styles/logo.gif" alt="<?php 
    echo _ALT_NUCLEUS_CMS_LOGO;
    ?>
" /></div> <!-- Nucleus logo -->

<?php 
    $aAllErrors = array_merge($aSkinErrors, $aPlugErrors);
    if (count($aAllErrors) > 0) {
        echo '<h1>' . _TITLE2 . '</h1>';
        echo '<ul><li>' . implode('</li><li>', $aAllErrors) . '</li></ul>';
    }
    if (!$bConfigWritten) {
        ?>
		<h1><?php 
        echo _TITLE3;
        ?>
</h1>

		<?php 
        echo _TEXT10;
        ?>

		<pre><code>&lt;?php
	// mySQL connection information
	$MYSQL_HOST	 = '<b><?php 
        echo $mysql_host;
        ?>
</b>';
	$MYSQL_USER	 = '******';
	$MYSQL_PASSWORD = '******';
	$MYSQL_DATABASE = '<b><?php 
        echo $mysql_database;
        ?>
</b>';
	$MYSQL_PREFIX   = '<b><?php 
        echo $mysql_usePrefix == 1 ? $mysql_prefix : '';
        ?>
</b>';

	// new in 3.50. first element is db handler, the second is the db driver used by the handler
	// default is $MYSQL_HANDLER = array('mysql','');
	$MYSQL_HANDLER = array('<?php 
        echo $MYSQL_HANDLER[0];
        ?>
','<?php 
        echo $MYSQL_HANDLER[1];
        ?>
');

	// main nucleus directory
	$DIR_NUCLEUS = '<b><?php 
        echo $config_adminpath;
        ?>
</b>';

	// path to media dir
	$DIR_MEDIA   = '<b><?php 
        echo $config_mediapath;
        ?>
</b>';

	// extra skin files for imported skins
	$DIR_SKINS   = '<b><?php 
        echo $config_skinspath;
        ?>
</b>';

	// these dirs are normally sub dirs of the nucleus dir, but
	// you can redefine them if you wish
	$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
	$DIR_LANG	= $DIR_NUCLEUS . 'language/';
	$DIR_LIBS	= $DIR_NUCLEUS . 'libs/';

	// include libs
	include($DIR_LIBS . 'globalfunctions.php');
?&gt;</code></pre>

	<?php 
        echo _TEXT11;
        ?>

	<div class="note">
	<?php 
        echo _TEXT12;
        ?>
	</div>

<?php 
    } else {
        ?>

	<h1><?php 
        echo _TITLE4;
        ?>
</h1>

	<?php 
        echo _TEXT13;
        ?>

<?php 
    }
    ?>

	<h1><?php 
    echo _TITLE5;
    ?>
</h1>
	
	<?php 
    echo _TEXT14;
    ?>

	<ul>
		<li><?php 
    echo _TEXT14_L1;
    ?>
</li>
		<li><?php 
    echo _TEXT14_L2;
    ?>
</li>
	</ul>

	<h1><?php 
    echo _HEADER10;
    ?>
</h1>

	<?php 
    echo _TEXT15;
    ?>

		<ul>
		<li><?php 
    echo _TEXT15_L1;
    ?>
</li>
		<li><?php 
    echo _TEXT15_L2;
    ?>
</li>
		<li><?php 
    echo _TEXT15_L3;
    ?>
</li>
		</ul>

	<?php 
    echo _TEXT16;
    ?>

	<h1><?php 
    echo _HEADER11;
    ?>
</h1>

	<p><?php 
    echo _TEXT16_H;
    ?>
		<ul>
			<li><a href="<?php 
    echo $config_adminurl;
    ?>
"><?php 
    echo _TEXT16_L1;
    ?>
</a></li>
			<li><a href="<?php 
    echo $config_indexurl;
    ?>
"><?php 
    echo _TEXT16_L2;
    ?>
</a></li>
		</ul>
	</p>

</body>
</html>

<?php 
}
Exemplo n.º 9
0
 * Syndi_getArticleList	: 게시물
 * Syndi_getDeletedList	: 삭제 게시물
 * Syndi_getChannelNextPage	: Syndi_getChannelList 의 페이징시 다음 페이지
 * Syndi_getArticleNextPage	: Syndi_getArticleList 의 페이징시 다음 페이지
 * Syndi_getDeletedNextPage	: Syndi_getDeletedList 의 페이징시 다음 페이지
 */
// include gnuboard config & lib
//include G5_PATH.'/config.php';
//include G5_LIB_PATH.'/common.lib.php';
//include G5_DATA_PATH.'/dbconfig.php';
$connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD);
if (!$connect_db) {
    return;
}
$GLOBALS['connect_db'] = $connect_db;
sql_select_db(G5_MYSQL_DB, $connect_db);
/**
 * @brief 사이트 정보
 **/
function Syndi_getSiteInfo($args)
{
    $title = $GLOBALS['syndi_homepage_title'];
    $tag = SyndicationHandler::getTag('site');
    $oSite = new SyndicationSite();
    $oSite->setId($tag);
    $oSite->setTitle($title);
    $oSite->setUpdated(date('YmdHis'));
    // 홈페이지 주소
    $link_alternative = sprintf('%s', G5_URL);
    $oSite->setLinkAlternative($link_alternative);
    $link_self = sprintf('%s?id=%s&type=%s', $GLOBALS['syndi_echo_url'], $tag, $args->type);
Exemplo n.º 10
0
function connect_to_db($db_name)
{
    global $DB_FUNC_PREFIX;
    if ($_SERVER["SERVER_ADDR"] == "127.0.0.1") {
        // IF MY PC
        if ($DB_FUNC_PREFIX == "ms") {
            // IF SQL
            //$Connection = sql_connect("DANA_PC","sa","");
            $Connection = sql_connect("SATELLITE-A75", "sa", "");
            sql_select_db($db_name, $Connection) or die("ERROR: NO SUCH DATABASE");
        } else {
            // IF MYSQL
            $Connection = sql_connect("pocketcampus.epfl.ch", "pocketcampus", "XXXXXXX");
            sql_select_db($db_name, $Connection) or die("ERROR: NO SUCH DATABASE");
        }
    } else {
        // IF LIVE SERVER
        if ($DB_FUNC_PREFIX == "ms") {
            // IF SQL
            $Connection = sql_connect("ASB00D11", "sa", "");
            sql_select_db($db_name, $Connection) or die("ERROR: NO SUCH DATABASE");
        } else {
            // IF MYSQL
            $config = parse_ini_file("/var/www/vhosts/pocketcampus/private/pocketcampus-server.config");
            $config or die("CANNOT FIND OR OPEN CONFIG FILE");
            $db_url = parse_url(str_replace("jdbc:", "", stripslashes("{$config["DB_URL"]}")));
            $Connection = sql_connect("{$db_url["host"]}:{$db_url["port"]}", "{$config["DB_USERNAME"]}", "{$config["DB_PASSWORD"]}");
            $db_name = array_pop(explode("/", "{$db_url["path"]}"));
            sql_select_db("{$db_name}", $Connection) or die("ERROR: NO SUCH DATABASE");
        }
    }
    return $Connection;
}