Пример #1
0
         */
        define('MIMEICON_RELATIVE', THEME_RELATIVE . 'mimetypes/');
    } else {
        define('MIMEICON_RELATIVE', PATH_RELATIVE . 'iconset/mimetypes/');
    }
}
// Initialize the language subsystem
require_once BASE . 'subsystems/lang.php';
pathos_lang_initialize();
// Initialize the AutoLoader Subsystem
require_once BASE . 'subsystems/autoloader.php';
// Initialize the Core Subsystem
require_once BASE . 'subsystems/core.php';
// Initialize the Database Subsystem
require_once BASE . 'subsystems/database.php';
$db = pathos_database_connect(DB_USER, DB_PASS, DB_HOST . ':' . DB_PORT, DB_NAME);
// Initialize the Modules Subsystem.
require_once BASE . 'subsystems/modules.php';
pathos_modules_initialize();
// Initialize the Template Subsystem.
require_once BASE . 'subsystems/template.php';
// Initialize the Permissions Subsystem.
require_once BASE . 'subsystems/permissions.php';
// Initialize the Flow Subsystem.
if (!defined('SYS_FLOW')) {
    require_once BASE . 'subsystems/flow.php';
}
// Validate session
pathos_sessions_validate();
// Initialize permissions variables
pathos_permissions_initialize();
 function update($values, $object)
 {
     if (isset($values['_db_config'])) {
         pathos_lang_loadDictionary('config', 'database');
         // Test configuration, and return NULL if it doesn't work.
         if (preg_match('/[^A-Za-z0-9]/', $values['db_table_prefix'])) {
             $post = $values;
             $post['_formError'] = TR_CONFIG_DATABASE_ERROR_BADPREFIX . '<br />';
             pathos_sessions_set('last_POST', $post);
             return null;
         }
         $linkdb = pathos_database_connect($values['db_user'], $values['db_pass'], $values['db_host'] . ':' . $values['db_port'], $values['db_name'], $values['db_engine'], true);
         $linkdb->prefix = $values['db_table_prefix'] . '_';
         if (!$linkdb->isValid()) {
             $post = $values;
             $post['_formError'] = TR_CONFIG_DATABASE_ERROR_CANTCONNECT . '<br />';
             pathos_sessions_set('last_POST', $post);
             return null;
         }
         $status = $linkdb->testPrivileges();
         $failed = false;
         $errors = '';
         foreach ($status as $type => $flag) {
             if (!$flag) {
                 $failed = true;
                 $errors .= sprintf(TR_CONFIG_DATABASE_ERROR_PERMDENIED, $type) . '<br />';
             }
         }
         if ($failed) {
             $post = $values;
             $post['_formError'] = $errors;
             pathos_sessions_set('last_POST', $post);
             return null;
         }
     }
     $object->name = $values['name'];
     $object->core_id = $values['core_id'];
     if (!isset($object->id)) {
         $object->path = $values['path'];
         if ($object->path[0] != '/') {
             $object->path = '/' . $object->path;
         }
         if (substr($object->path, -1, 1) != '/') {
             $object->path = $object->path . '/';
         }
         $object->relpath = $values['relpath'];
         if ($object->relpath[0] != '/') {
             $object->relpath = '/' . $object->relpath;
         }
         if (substr($object->relpath, -1, 1) != '/') {
             $object->relpath = $object->relpath . '/';
         }
         $object->host = $values['host'];
         if (substr($object->host, 0, 7) != 'http://' && substr($object->host, 0, 8) != 'https://') {
             $object->host = 'http://' . $object->host;
         }
         if (substr($object->host, -1, 1) == '/') {
             $object->host = substr($object->host, 0, -1);
         }
     }
     return $object;
 }
Пример #3
0
$opt = $_POST['user_config'];
//Set option from previous page
$post = array_merge($_POST, pathos_sessions_get("post"));
//Stores POST information in an array
if ($opt == -1) {
    //User did not select a username conflict resolution option
    //Sets error messages
    $post['_formError'] = "Please select an option to handle the username conflicts!";
    pathos_sessions_set("last_POST", $post);
    //Puts $post array in the session for later retrieval
    header("Location: " . $_SERVER['HTTP_REFERER']);
    //Sends user to username conflict page
    exit;
}
//Grabs pMachine database
$pm_db = pathos_database_connect($post['username'], $post['pwd'], $post['host'] . ":" . $post['port'], $post['dbname'], $post['dbengine'], 1);
//Sets pMachine database prefix
$pm_db->prefix = $post['pm_prefix'];
//Creates new user object and assigns default values
$new_user = null;
$new_user->is_admin = 0;
$new_user->is_locked = 0;
$new_user->firstname = "";
$new_user->lastname = "";
$new_user->recv_html = 0;
//Creates array to store user ID mappings
$id_map = array();
//Assigns values from pMachine database to new user object
foreach ($pm_db->selectObjects("members") as $pm_user) {
    $new_user->username = $pm_user->username;
    $new_user->password = $pm_user->password;
Пример #4
0
    }
    echo '</td></tr>';
}
function isAllGood($str)
{
    return !preg_match("/[^A-Za-z0-9]/", $str);
}
pathos_sessions_set("installer_config", $_POST['c']);
$config = $_POST['c'];
$passed = true;
if (!isAllGood($config["db_table_prefix"])) {
    echoFailure("Invalid table prefix.  The table prefix can only contain alphanumeric characters.");
    $passed = false;
}
if ($passed) {
    $db = pathos_database_connect($config['db_user'], $config['db_pass'], $config['db_host'], $config['db_name'], $config['db_engine'], 1);
    $db->prefix = $config['db_table_prefix'] . '_';
    $status = array();
    echoStart("Connecting to database:");
    if ($db->connection == null) {
        echoFailure($db->error());
        // BETTER ERROR CHECKING
        $passed = false;
    }
}
if ($passed) {
    $tables = $db->getTables();
    if ($db->inError()) {
        echoFailure($db->error());
        $passed = false;
    } else {
if (pathos_permissions_check('configuration', pathos_core_makeLocation('administrationmodule'))) {
    if (!defined('SYS_CONFIG')) {
        require_once BASE . 'subsystems/config.php';
    }
    $continue = true;
    if ($user->is_admin == 1) {
        // Only do the database stuff if we are a super admin
        $errors = '';
        pathos_lang_loadDictionary('config', 'database');
        // Test the prefix
        if (preg_match("/[^A-Za-z0-9]/", $_POST['c']['DB_TABLE_PREFIX'])) {
            $continue = false;
            $errors .= TR_CONFIG_DATABASE_ERROR_BADPREFIX;
        }
        // Test the database connection
        $newdb = pathos_database_connect($_POST['c']['DB_USER'], $_POST['c']['DB_PASS'], $_POST['c']['DB_HOST'] . ":" . $_POST['c']['DB_PORT'], $_POST['c']['DB_NAME'], $_POST['c']['DB_ENGINE']);
        $newdb->prefix = $_POST['c']['DB_TABLE_PREFIX'] . '_';
        if (!$newdb->isValid()) {
            $continue = false;
            $errors .= TR_CONFIG_DATABASE_ERROR_CANTCONNECT;
        }
        if ($continue) {
            $status = $newdb->testPrivileges();
            foreach ($status as $type => $flag) {
                if (!$flag) {
                    $continue = false;
                    $errors .= sprintf(TR_CONFIG_DATABASE_ERROR_PERMDENIED, $type);
                }
            }
        }
    }
Пример #6
0
     if (!in_array($d['name'], $used[$d['type']])) {
         $extension->name = $d['name'];
         $extension->type = $d['type'];
         $db->insertObject($extension, "sharedcore_extension");
         $used[$d['type']][] = $d['name'];
     }
 }
 pathos_sharedcore_link($core, $site, $used);
 // Save database config.
 $values = array("c" => array("db_engine" => $_POST['db_engine'], "db_name" => $_POST['db_name'], "db_user" => $_POST['db_user'], "db_pass" => $_POST['db_pass'], "db_host" => $_POST['db_host'], "db_port" => $_POST['db_port'], "db_table_prefix" => $_POST['db_table_prefix']), "opts" => array(), "activate" => 1, "configname" => "Default");
 if (!defined("SYS_CONFIG")) {
     require_once BASE . "subsystems/config.php";
 }
 pathos_config_saveConfiguration($values, $site->path);
 // Install database for base system
 $newdb = pathos_database_connect($_POST['db_user'], $_POST['db_pass'], $_POST['db_host'] . ':' . $_POST['db_port'], $_POST['db_name'], $_POST['db_engine'], true);
 $newdb->prefix = $_POST['db_table_prefix'] . '_';
 // Following code snipped from modules/administrationmodule/actions/installtables.php
 $dir = $site->path . "datatypes/definitions";
 if (is_readable($dir)) {
     $tables = array();
     $dh = opendir($dir);
     while (($file = readdir($dh)) !== false) {
         if (is_readable("{$dir}/{$file}") && is_file("{$dir}/{$file}") && substr($file, -4, 4) == ".php" && substr($file, -9, 9) != ".info.php") {
             $tablename = substr($file, 0, -4);
             $dd = (include "{$dir}/{$file}");
             $info = null;
             if (is_readable("{$dir}/{$tablename}.info.php")) {
                 $info = (include "{$dir}/{$tablename}.info.php");
             }
             if (!$newdb->tableExists($tablename)) {
Пример #7
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: db_connect.php,v 1.2 2005/02/19 16:53:35 filetreefrog Exp $
##################################################
$temp_db = pathos_database_connect($_POST['username'], $_POST['pwd'], $_POST['host'] . ":" . $_POST['port'], $_POST['dbname'], $_POST['dbengine'], 1);
//Merge $_POST with session "post" array
$post = array_merge($_POST, pathos_sessions_get("post"));
if ($temp_db->isValid() == false) {
    //FAILURE - Could not connect to database - you're screwed
    unset($post['pwd']);
    $post['_formError'] = $temp_db->error();
    pathos_sessions_set("last_POST", $post);
    header("Location: " . $_SERVER['HTTP_REFERER']);
} else {
    //SUCCESS - Connection database was good
    //User didn't select anything to import - user_imp & blog_imp is empty
    if (isset($_POST['blog_imp']) == false && isset($_POST['user_imp']) == false) {
        $post = $_POST;
        $post['_formError'] = "You must select something to import from the pMachine Free database";
        pathos_sessions_set("last_POST", $post);