コード例 #1
0
 /**
  * If you made changes to config, you may call this to persist the changes
  * back to disk
  */
 protected function saveConfig()
 {
     if (!isset($this->config)) {
         return;
     }
     Setup::save();
 }
コード例 #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Setup();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Setup'])) {
         $model->attributes = $_POST['Setup'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #3
0
 /**
  * Get database config.
  * load it from setup, fall back to legacy config.php constants
  *
  * @return array
  */
 public static function getConfig()
 {
     $setup = Setup::get();
     if (isset($setup['database'])) {
         $config = $setup['database']->toArray();
     } else {
         // legacy: import from constants
         $config = array('driver' => APP_SQL_DBTYPE, 'hostname' => APP_SQL_DBHOST, 'database' => APP_SQL_DBNAME, 'username' => APP_SQL_DBUSER, 'password' => APP_SQL_DBPASS, 'port' => APP_SQL_DBPORT, 'table_prefix' => APP_TABLE_PREFIX);
         // save it back. this will effectively do the migration
         Setup::save(array('database' => $config));
     }
     return $config;
 }
コード例 #4
0
ファイル: monitor.php プロジェクト: dabielkabuto/eventum
<?php

/*
 * This file is part of the Eventum (Issue Tracking System) package.
 *
 * @copyright (c) Eventum Team
 * @license GNU General Public License, version 2 or later (GPL-2+)
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/monitor.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
$tpl->assign('project_list', Project::getAll());
if (!empty($_POST['cat']) && $_POST['cat'] == 'update') {
    $setup = array('diskcheck' => $_POST['diskcheck'], 'paths' => $_POST['paths'], 'ircbot' => $_POST['ircbot']);
    $res = Setup::save(array('monitor' => $setup));
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the setup information was saved successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to create the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided path.', APP_CONFIG_PATH), Misc::MSG_NOTE_BOX), -2 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to update the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided filename.', APP_SETUP_FILE), Misc::MSG_NOTE_BOX)));
}
$tpl->assign(array('enable_disable', array('enabled' => ev_gettext('Enabled'), 'disabled' => ev_gettext('Disabled')), 'setup' => Setup::get()));
$tpl->displayTemplate();
コード例 #5
0
<?php

// changes the setup file from just containing the setup string, to be a php file with an array.
include_once "../../../config.inc.php";
include_once APP_INC_PATH . "class.setup.php";
include_once APP_INC_PATH . "db_access.php";
$contents = file_get_contents(APP_SETUP_FILE);
$array = unserialize(base64_decode($contents));
$res = Setup::save($array);
if ($res != 1) {
    echo "Unable to write to file '" . APP_SETUP_FILE . "'.<br />\nPlease verify this file is writeable and try again.";
    exit(1);
}
?>
Done. 
コード例 #6
0
ファイル: index.php プロジェクト: dabielkabuto/eventum
/**
 * write initial values for setup file
 */
function write_setup()
{
    $setup = $_REQUEST['setup'];
    $setup['update'] = 1;
    $setup['closed'] = 1;
    $setup['emails'] = 1;
    $setup['files'] = 1;
    $setup['support_email'] = 'enabled';
    $setup['database'] = array('driver' => 'mysqli', 'hostname' => $_POST['db_hostname'], 'database' => '', 'username' => $_POST['db_username'], 'password' => $_POST['db_password'], 'port' => 3306, 'table_prefix' => $_POST['db_table_prefix']);
    Setup::save($setup);
}
コード例 #7
0
ファイル: general.php プロジェクト: juliogallardo1326/proc
        $setup["allow_unassigned_issues"] = $HTTP_POST_VARS["allow_unassigned_issues"];
        @($setup["update"] = $HTTP_POST_VARS["update"]);
        @($setup["closed"] = $HTTP_POST_VARS["closed"]);
        @($setup["notes"] = $HTTP_POST_VARS["notes"]);
        @($setup["emails"] = $HTTP_POST_VARS["emails"]);
        @($setup["files"] = $HTTP_POST_VARS["files"]);
        @($setup["smtp"] = $HTTP_POST_VARS["smtp"]);
        @($setup["scm_integration"] = $HTTP_POST_VARS["scm_integration"]);
        @($setup["checkout_url"] = $HTTP_POST_VARS["checkout_url"]);
        @($setup["diff_url"] = $HTTP_POST_VARS["diff_url"]);
        @($setup["open_signup"] = $HTTP_POST_VARS["open_signup"]);
        @($setup["accounts_projects"] = $HTTP_POST_VARS["accounts_projects"]);
        @($setup["accounts_role"] = $HTTP_POST_VARS["accounts_role"]);
        @($setup['subject_based_routing'] = $HTTP_POST_VARS['subject_based_routing']);
        @($setup['email_routing'] = $HTTP_POST_VARS['email_routing']);
        @($setup['note_routing'] = $HTTP_POST_VARS['note_routing']);
        @($setup['draft_routing'] = $HTTP_POST_VARS['draft_routing']);
        @($setup['email_error'] = $HTTP_POST_VARS['email_error']);
        @($setup['email_reminder'] = $HTTP_POST_VARS['email_reminder']);
        $options = Setup::load();
        @($setup['downloading_emails'] = $options['downloading_emails']);
        $res = Setup::save($setup);
        $tpl->assign("result", $res);
    }
    $options = Setup::load(true);
    $tpl->assign("setup", $options);
    $tpl->assign("user_roles", User::getRoles(array('Customer')));
} else {
    $tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();
コード例 #8
0
ファイル: scm.php プロジェクト: dabielkabuto/eventum
<?php

/*
 * This file is part of the Eventum (Issue Tracking System) package.
 *
 * @copyright (c) Eventum Team
 * @license GNU General Public License, version 2 or later (GPL-2+)
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/scm.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'update') {
    $res = Setup::save(array('scm_integration' => $_POST['scm_integration']));
    $tpl->assign('result', $res);
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the setup information was saved successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to create the configuration file in the setup directory (%1\$s). " . 'Please contact your local system administrator and ask for write privileges on the provided path.', APP_CONFIG_PATH), Misc::MSG_NOTE_BOX), -2 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to update the configuration file in the setup directory (%1\$s). " . 'Please contact your local system administrator and ask for write privileges on the provided filename.', APP_SETUP_FILE), Misc::MSG_NOTE_BOX)));
}
$tpl->assign('setup', Setup::get());
$tpl->displayTemplate();
コード例 #9
0
ファイル: ldap.php プロジェクト: dabielkabuto/eventum
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
    Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'update') {
    $setup['host'] = $_POST['host'];
    $setup['port'] = $_POST['port'];
    $setup['binddn'] = $_POST['binddn'];
    $setup['bindpw'] = $_POST['bindpw'];
    $setup['basedn'] = $_POST['basedn'];
    $setup['userdn'] = $_POST['userdn'];
    $setup['user_filter'] = $_POST['user_filter'];
    $setup['customer_id_attribute'] = $_POST['customer_id_attribute'];
    $setup['contact_id_attribute'] = $_POST['contact_id_attribute'];
    $setup['create_users'] = $_POST['create_users'];
    $setup['default_role'] = $_POST['default_role'];
    $res = Setup::save(array('ldap' => $setup));
    Misc::mapMessages($res, array(1 => array('Thank you, the setup information was saved successfully.', Misc::MSG_INFO), -1 => array("ERROR: The system doesn't have the appropriate permissions to create the configuration file\n                            in the setup directory (" . APP_CONFIG_PATH . '). Please contact your local system
                            administrator and ask for write privileges on the provided path.', Misc::MSG_HTML_BOX), -2 => array("ERROR: The system doesn't have the appropriate permissions to update the configuration file\n                            in the setup directory (" . APP_CONFIG_PATH . '/ldap.php). Please contact your local system
                            administrator and ask for write privileges on the provided filename.', Misc::MSG_HTML_BOX)));
    $tpl->assign('result', $res);
}
$setup = Setup::setDefaults('ldap', LDAP_Auth_Backend::getDefaults());
$tpl->assign('setup', $setup);
$tpl->assign('project_list', Project::getAll());
$tpl->assign('project_roles', array(0 => 'No Access') + User::getRoles());
$tpl->assign('user_roles', User::getRoles(array('Customer')));
$tpl->displayTemplate();
コード例 #10
0
ファイル: setups.php プロジェクト: benjamw/pharaoh
 case 'clone':
     if (isset($_POST['setup'])) {
         test_token();
         $edit = false;
         try {
             if (isset($_POST['id'])) {
                 $edit = true;
                 // make sure this user can edit this setup
                 $Setup = new Setup((int) $_POST['id']);
                 if ((string) $_SESSION['player_id'] !== (string) $Setup->creator && !$GLOBALS['Player']->is_admin) {
                     Flash::store('You are not allowed to perform this action', 'setups.php');
                 }
             } else {
                 $Setup = new Setup();
             }
             $setup_id = $Setup->save();
             Flash::store('Setup ' . ($edit ? 'Edited' : 'Created') . ' Successfully');
         } catch (MyException $e) {
             Flash::store('Setup ' . ($edit ? 'Edit' : 'Creation') . ' FAILED !\\n' . $e->outputMessage(), false);
             // it will just continue on here...
         }
     }
     $hints = array('Click on a piece to select it, and then click anywhere on the board to place that piece.', 'Click on the Cancel button to cancel piece selection.', 'Click on the Delete button, and then click on the piece to delete an existing piece.', 'The reflection setting will also place the reflected pieces along with the pieces you place, making board creation faster and less prone to errors.', 'The reflections setting will also validate, so if you have a few non-reflected pieces in your layout, set reflection to "None" before submitting.', 'Setups will be immediately available for use after successful creation.');
     $edit = false;
     if (!empty($_REQUEST['id'])) {
         $hints[] = 'Only unique names and layouts will be accepted.';
         $Setup = new Setup((int) $_REQUEST['id']);
         // make sure this user can edit this setup
         if ('edit' == $act) {
             if ((string) $_SESSION['player_id'] !== (string) $Setup->creator && !$GLOBALS['Player']->is_admin) {
                 Flash::store('You are not allowed to perform this action', 'setups.php');
コード例 #11
0
ファイル: class.scm.php プロジェクト: korusdipl/eventum
 /**
  * Get ScmCheckin based on SCM name
  *
  * @param string $scm_name
  * @return ScmCheckin
  * @throws Exception
  */
 private static function getScmCheckinByName($scm_name)
 {
     static $instances;
     if (isset($instances[$scm_name])) {
         return $instances[$scm_name];
     }
     $setup =& Setup::load();
     // handle legacy setup, convert existing config to be known under name 'default'
     if (!isset($setup['scm'])) {
         $scm = array('name' => 'default', 'checkout_url' => $setup['checkout_url'], 'diff_url' => $setup['diff_url'], 'log_url' => $setup['scm_log_url']);
         $setup['scm'][$scm['name']] = $scm;
         Setup::save($setup);
     }
     if (!isset($setup['scm'][$scm_name])) {
         throw new Exception("SCM '{$scm_name}' not defined");
     }
     return $instances[$scm_name] = new ScmCheckin($setup['scm'][$scm_name]);
 }
コード例 #12
0
ファイル: index.php プロジェクト: juliogallardo1326/proc
function install()
{
    global $HTTP_POST_VARS;
    clearstatcache();
    // check if config.inc.php in the root directory is writable
    if (!is_writable('../config.inc.php')) {
        return "The file 'config.inc.php' in Eventum's root directory needs to be writable by the web server user. Please correct this problem and try again.";
    }
    // gotta check and see if the provided installation path really exists...
    if (!file_exists($HTTP_POST_VARS['path'])) {
        return "The provided installation path could not be found. Please review your information and try again.";
    }
    // need to create a random private key variable
    $private_key = '<?php
$private_key = "' . md5(microtime()) . '";
?>';
    if (!is_writable('../include/private_key.php')) {
        return "The file 'include/private_key.php' needs to be writable by the web server user. Please correct this problem and try again.";
    }
    $fp = @fopen('../include/private_key.php', 'w');
    if ($fp === FALSE) {
        return "Could not open the file 'include/private_key.php' for writing. The permissions on the file should be set as to allow the user that the web server runs as to open it. Please correct this problem and try again.";
    }
    $res = fwrite($fp, $private_key);
    if ($fp === FALSE) {
        return "Could not write the configuration information to 'include/private_key.php'. The file should be writable by the user that the web server runs as. Please correct this problem and try again.";
    }
    fclose($fp);
    // check if we can connect
    $conn = @mysql_connect($HTTP_POST_VARS['db_hostname'], $HTTP_POST_VARS['db_username'], $HTTP_POST_VARS['db_password']);
    if (!$conn) {
        return getErrorMessage('connect', mysql_error());
    }
    $db_list = getDatabaseList($conn);
    $db_list = array_map('strtolower', $db_list);
    if (@$HTTP_POST_VARS['create_db'] == 'yes') {
        if (!in_array(strtolower($HTTP_POST_VARS['db_name']), $db_list)) {
            if (!mysql_query('CREATE DATABASE ' . $HTTP_POST_VARS['db_name'], $conn)) {
                return getErrorMessage('create_db', mysql_error());
            }
        }
    } else {
        if (count($db_list) > 0 && !in_array(strtolower($HTTP_POST_VARS['db_name']), $db_list)) {
            return "The provided database name could not be found. Review your information or specify that the database should be created in the form below.";
        }
    }
    // create the new user, if needed
    if (@$HTTP_POST_VARS["alternate_user"] == 'yes') {
        $user_list = getUserList($conn);
        if (count($user_list) > 0) {
            $user_list = array_map('strtolower', $user_list);
            if (@$HTTP_POST_VARS["create_user"] == 'yes') {
                if (!in_array(strtolower(@$HTTP_POST_VARS['eventum_user']), $user_list)) {
                    $stmt = "GRANT SELECT, UPDATE, DELETE, INSERT, ALTER, DROP, CREATE, INDEX ON " . $HTTP_POST_VARS['db_name'] . ".* TO '" . $HTTP_POST_VARS["eventum_user"] . "'@'%' IDENTIFIED BY '" . $HTTP_POST_VARS["eventum_password"] . "'";
                    if (!mysql_query($stmt, $conn)) {
                        return getErrorMessage('create_user', mysql_error());
                    }
                }
            } else {
                if (!in_array(strtolower(@$HTTP_POST_VARS['eventum_user']), $user_list)) {
                    return "The provided MySQL username could not be found. Review your information or specify that the username should be created in the form below.";
                }
            }
        }
    }
    // check if we can use the database
    if (!mysql_select_db($HTTP_POST_VARS['db_name'])) {
        return getErrorMessage('select_db', mysql_error());
    }
    // check the CREATE and DROP privileges by trying to create and drop a test table
    $table_list = getTableList($conn);
    $table_list = array_map('strtolower', $table_list);
    if (!in_array('eventum_test', $table_list)) {
        if (!mysql_query('CREATE TABLE eventum_test (test char(1))', $conn)) {
            return getErrorMessage('create_test', mysql_error());
        }
    }
    if (!mysql_query('DROP TABLE eventum_test', $conn)) {
        return getErrorMessage('drop_test', mysql_error());
    }
    $contents = implode("", file("schema.sql"));
    $queries = explode(";", $contents);
    unset($queries[count($queries) - 1]);
    // COMPAT: the next line requires PHP >= 4.0.6
    $queries = array_map("trim", $queries);
    $queries = array_map("replace_table_prefix", $queries);
    foreach ($queries as $stmt) {
        if (stristr($stmt, 'DROP TABLE') && @$HTTP_POST_VARS['drop_tables'] != 'yes') {
            continue;
        }
        // need to check if a CREATE TABLE on an existing table throws an error
        if (!mysql_query($stmt, $conn)) {
            if (stristr($stmt, 'DROP TABLE')) {
                $type = 'drop_table';
            } else {
                $type = 'create_table';
            }
            return getErrorMessage($type, mysql_error());
        }
    }
    // substitute the appropriate values in config.inc.php!!!
    if (@$HTTP_POST_VARS['alternate_user'] == 'yes') {
        $HTTP_POST_VARS['db_username'] = $HTTP_POST_VARS['eventum_user'];
        $HTTP_POST_VARS['db_password'] = $HTTP_POST_VARS['eventum_password'];
    }
    // make sure there is a / in the end of the APP_PATH constant
    if (substr($HTTP_POST_VARS['path'], 0, -1) != '/') {
        $HTTP_POST_VARS['path'] .= '/';
    }
    $config_contents = implode("", file("config.inc.php"));
    $config_contents = str_replace("%{APP_PATH}%", $HTTP_POST_VARS['path'], $config_contents);
    $config_contents = str_replace("%{APP_SQL_DBHOST}%", $HTTP_POST_VARS['db_hostname'], $config_contents);
    $config_contents = str_replace("%{APP_SQL_DBNAME}%", $HTTP_POST_VARS['db_name'], $config_contents);
    $config_contents = str_replace("%{APP_SQL_DBUSER}%", $HTTP_POST_VARS['db_username'], $config_contents);
    $config_contents = str_replace("%{APP_SQL_DBPASS}%", $HTTP_POST_VARS['db_password'], $config_contents);
    $config_contents = str_replace("%{APP_TABLE_PREFIX}%", $HTTP_POST_VARS['db_table_prefix'], $config_contents);
    $config_contents = str_replace("%{APP_HOSTNAME}%", $HTTP_POST_VARS['hostname'], $config_contents);
    $config_contents = str_replace("%{APP_RELATIVE_URL}%", $HTTP_POST_VARS['relative_url'], $config_contents);
    $config_contents = str_replace("%{APP_VERSION}%", "1.7.0", $config_contents);
    if (@$HTTP_POST_VARS['is_ssl'] == 'yes') {
        $protocol_type = 'https://';
    } else {
        $protocol_type = 'http://';
    }
    $config_contents = str_replace("%{PROTOCOL_TYPE}%", $protocol_type, $config_contents);
    // disable the full-text search feature for certain mysql server users
    $stmt = "SELECT VERSION();";
    $res = mysql_query($stmt, $conn);
    $mysql_version = mysql_result($res, 0, 0);
    preg_match('/(\\d{1,2}\\.\\d{1,2}\\.\\d{1,2})/', $mysql_version, $matches);
    if ($matches[1] > '4.0.23') {
        $config_contents = str_replace("'%{APP_ENABLE_FULLTEXT}%'", "true", $config_contents);
    } else {
        $config_contents = str_replace("'%{APP_ENABLE_FULLTEXT}%'", "false", $config_contents);
    }
    $fp = @fopen('../config.inc.php', 'w');
    if ($fp === FALSE) {
        return "Could not open the file 'config.inc.php' for writing. The permissions on the file should be set as to allow the user that the web server runs as to open it. Please correct this problem and try again.";
    }
    $res = fwrite($fp, $config_contents);
    if ($fp === FALSE) {
        return "Could not write the configuration information to 'config.inc.php'. The file should be writable by the user that the web server runs as. Please correct this problem and try again.";
    }
    fclose($fp);
    // write setup file
    include_once "../config.inc.php";
    include_once APP_INC_PATH . "class.setup.php";
    $_REQUEST['setup']['update'] = 1;
    $_REQUEST['setup']['closed'] = 1;
    $_REQUEST['setup']['emails'] = 1;
    $_REQUEST['setup']['files'] = 1;
    Setup::save($_REQUEST['setup']);
    return 'success';
}
コード例 #13
0
 /**
  * If you made changes to config, you may call this to persist the changes
  * back to disk
  */
 protected function saveConfig()
 {
     if (!$this->configLoaded || !$this->config_setup_copy) {
         return;
     }
     Setup::save($this->config_setup_copy);
 }