当前位置: 首页>>代码示例>>PHP>>正文


PHP Setup::save方法代码示例

本文整理汇总了PHP中Setup::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::save方法的具体用法?PHP Setup::save怎么用?PHP Setup::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setup的用法示例。


在下文中一共展示了Setup::save方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveConfig

 /**
  * 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();
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:11,代码来源:class.abstract_workflow_backend.php

示例2: actionCreate

 /**
  * 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));
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:17,代码来源:SetupController.php

示例3: getConfig

 /**
  * 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;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:19,代码来源:class.db_helper.php

示例4: Template_Helper

<?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();
开发者ID:dabielkabuto,项目名称:eventum,代码行数:30,代码来源:monitor.php

示例5: file_get_contents

<?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. 
开发者ID:juliogallardo1326,项目名称:proc,代码行数:15,代码来源:fix_setup_file.php

示例6: write_setup

/**
 * 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);
}
开发者ID:dabielkabuto,项目名称:eventum,代码行数:14,代码来源:index.php

示例7:

        $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();
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:general.php

示例8: Template_Helper

<?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();
开发者ID:dabielkabuto,项目名称:eventum,代码行数:29,代码来源:scm.php

示例9: array

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();
开发者ID:dabielkabuto,项目名称:eventum,代码行数:31,代码来源:ldap.php

示例10: Setup

 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');
开发者ID:benjamw,项目名称:pharaoh,代码行数:31,代码来源:setups.php

示例11: getScmCheckinByName

 /**
  * 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]);
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:25,代码来源:class.scm.php

示例12: install


//.........这里部分代码省略.........
                    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';
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:101,代码来源:index.php

示例13: saveConfig

 /**
  * 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);
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:11,代码来源:class.abstract_workflow_backend.php


注:本文中的Setup::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。