本文整理汇总了PHP中License::update方法的典型用法代码示例。如果您正苦于以下问题:PHP License::update方法的具体用法?PHP License::update怎么用?PHP License::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类License
的用法示例。
在下文中一共展示了License::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_comic_db
/**
* Handles both creating of new comics in the database and editing old ones.
* It determines if it should update or not by checking if $this->id has
* been set. It can get the values from both the $data array and direct
* variable assignation. Be aware that array > variables. The latter ones
* will be overwritten. Particularly, the variables that the user isn't
* allowed to set personally are unset and reset with the automated values.
* It's quite safe to throw stuff at it.
*
* @author Woxxy
* @param array $data contains the minimal data
* @return boolean true on success, false on failure
*/
public function update_comic_db($data = array()) {
// Check if we're updating or creating a new comic by looking at $data["id"].
// False is returned if the chapter ID was not found.
if (isset($data["id"]) && $data['id'] != '') {
$this->where("id", $data["id"])->get();
if ($this->result_count() == 0) {
set_notice('error', _('The comic you wanted to edit doesn\'t exist.'));
log_message('error', 'update_comic_db: failed to find requested id');
return false;
}
// Save the stub in a variable in case it gets changed, so we can change folder name
$old_stub = $this->stub;
$old_name = $this->name;
}
else {
// let's set the creator name if it's a new entry
$this->creator = $this->logged_id();
}
// always set the editor name
$this->editor = $this->logged_id();
// Unset sensible variables
unset($data["creator"]);
unset($data["editor"]);
unset($data["uniqid"]);
unset($data["stub"]);
// Allow only admins and mods to arbitrarily change the release date
$CI = & get_instance();
if (!$CI->tank_auth->is_allowed())
unset($data["created"]);
if (!$CI->tank_auth->is_allowed())
unset($data["edited"]);
// Loop over the array and assign values to the variables.
foreach ($data as $key => $value) {
$this->$key = $value;
}
// Double check that we have all the necessary automated variables
if (!isset($this->uniqid))
$this->uniqid = uniqid();
if (!isset($this->stub))
$this->stub = $this->stub();
// Create a new stub if the name has changed
if(isset($old_name) && isset($old_stub) && ($old_name != $this->name))
{
// Prepare a new stub.
$this->stub = $this->name;
// stub() is also able to restub the $this->stub. Already stubbed values won't change.
$this->stub = $this->stub();
}
// Make so there's no intersecting stubs, and make a stub with a number in case of duplicates
// In case this chapter already has a stub and it wasn't changed, don't change it!
if ((!isset($this->id) || $this->id == '') || (isset($old_stub) && $old_stub != $this->stub)) {
$i = 1;
$found = FALSE;
$comic = new Comic();
$comic->where('stub', $this->stub)->get();
if ($comic->result_count() == 0) {
$found = TRUE;
}
while (!$found) {
$i++;
$pre_stub = $this->stub . '_' . $i;
$comic = new Comic();
$comic->where('stub', $pre_stub)->get();
if ($comic->result_count() == 0) {
$this->stub = $pre_stub;
$found = TRUE;
}
}
}
// This is necessary to make the checkbox work.
/**
* @todo make the checkbox work consistently across the whole framework
*/
if (!isset($data['hidden']) || $data['hidden'] != 1)
//.........这里部分代码省略.........
示例2: License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface', '100')) {
UI::access_denied();
exit;
}
UI::show_header();
switch ($_REQUEST['action']) {
case 'edit':
if (isset($_POST['license_id'])) {
$license = new License($_POST['license_id']);
if ($license->id) {
$license->update($_POST);
}
$text = T_('License Updated');
} else {
License::create($_POST);
$text = T_('License Created');
}
show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php');
break;
case 'show_edit':
$license = new License($_REQUEST['license_id']);
case 'show_create':
require_once AmpConfig::get('prefix') . '/templates/show_edit_license.inc.php';
break;
case 'delete':
License::delete($_REQUEST['license_id']);
示例3: executeContrexxUpdate
function executeContrexxUpdate()
{
global $_CORELANG, $_CONFIG, $objDatabase, $objUpdate, $_DBCONFIG;
/**
* These are the modules which MUST have new template in order for Cloudrexx
* to work correctly. CSS definitions for these modules will get updated too.
*/
$viewUpdateTable = array('newsletter' => array('version' => '3.1.0.0', 'dependencies' => array('forms')), 'calendar' => array('version' => '3.1.0.0', 'dependencies' => array()), 'shop' => array('version' => '3.0.0.0', 'dependencies' => array('forms')), 'voting' => array('version' => '2.1.0.0', 'dependencies' => array()), 'access' => array('version' => '2.0.0.0', 'dependencies' => array('forms', 'captcha', 'uploader')), 'podcast' => array('version' => '2.0.0.0', 'dependencies' => array()), 'login' => array('version' => '3.0.2.0', 'dependencies' => array('forms', 'captcha')), 'media1' => array('version' => '3.0.0.0', 'dependencies' => array()), 'media2' => array('version' => '3.0.0.0', 'dependencies' => array()), 'media3' => array('version' => '3.0.0.0', 'dependencies' => array()), 'media4' => array('version' => '3.0.0.0', 'dependencies' => array()));
$_SESSION['contrexx_update']['copyFilesFinished'] = !empty($_SESSION['contrexx_update']['copyFilesFinished']) ? $_SESSION['contrexx_update']['copyFilesFinished'] : false;
// Copy cx files to the root directory
if (!$_SESSION['contrexx_update']['copyFilesFinished']) {
if (!loadMd5SumOfOriginalCxFiles()) {
return false;
}
$copyFilesStatus = copyCxFilesToRoot(dirname(__FILE__) . '/cx_files', ASCMS_PATH . ASCMS_PATH_OFFSET);
if ($copyFilesStatus !== true) {
if ($copyFilesStatus === 'timeout') {
setUpdateMsg(1, 'timeout');
}
return false;
}
if (extension_loaded('apc') && ini_get('apc.enabled')) {
apc_clear_cache();
}
$_SESSION['contrexx_update']['copyFilesFinished'] = true;
// log modified files
DBG::msg('MODIFIED FILES:');
if (isset($_SESSION['contrexx_update']['modified_files'])) {
DBG::dump($_SESSION['contrexx_update']['modified_files']);
}
// we need to stop the script here to force a reinitialization of the update system
// this is required so that the new constants from config/set_constants.php are loaded
//setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED'], 'title');
//setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED_TIME_MSG'].'<br />', 'msg');
//setUpdateMsg('Installation der neuen Dateien abgeschlossen.<br /><br />', 'msg');
//setUpdateMsg('<input type="submit" value="'.$_CORELANG['TXT_CONTINUE_UPDATE'].'" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
setUpdateMsg(1, 'timeout');
return false;
}
unset($_SESSION['contrexx_update']['copiedCxFilesIndex']);
/**
* This needs to be initialized before loading config/doctrine.php
* Because we overwrite the Gedmo model (so we need to load our model
* before doctrine loads the Gedmo one)
*/
require_once ASCMS_CORE_PATH . '/ClassLoader/ClassLoader.class.php';
$cl = new \Cx\Core\ClassLoader\ClassLoader(ASCMS_DOCUMENT_ROOT, true);
Env::set('ClassLoader', $cl);
FWLanguage::init();
if (!isset($_SESSION['contrexx_update']['update'])) {
$_SESSION['contrexx_update']['update'] = array();
}
if (!isset($_SESSION['contrexx_update']['update']['done'])) {
$_SESSION['contrexx_update']['update']['done'] = array();
}
/////////////////////
// UTF-8 MIGRATION //
/////////////////////
if (!(include_once dirname(__FILE__) . '/components/core/core.php')) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/core.php'));
return false;
}
if (!(include_once dirname(__FILE__) . '/components/core/utf8.php')) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/utf8.php'));
return false;
}
if (!in_array('utf8', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
$result = _utf8Update();
if ($result === 'timeout') {
setUpdateMsg(1, 'timeout');
return false;
} elseif (!$result) {
if (empty($objUpdate->arrStatusMsg['title'])) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UTF_CONVERSION']), 'title');
}
return false;
}
if ($result === 'charset_changed') {
// write new charset/collation definition to config file
if (!_writeNewConfigurationFile()) {
return false;
}
}
$_SESSION['contrexx_update']['update']['done'][] = 'utf8';
// _utf8Update() might have changed the charset/collation and migrated some tables,
// therefore, we will force a reinitialization of the update system
// to ensure that all db-connections are using the proper charset/collation
\DBG::msg('Changed collation to: ' . $_DBCONFIG['collation']);
\DBG::msg('Force reinitialization of update...');
setUpdateMsg(1, 'timeout');
return false;
}
/////////////////////
/////////////////////////////
// Session Table MIGRATION //
/////////////////////////////
$isSessionVariableTableExists = \Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'session_variable');
if ($isSessionVariableTableExists) {
createOrAlterSessionVariableTable();
}
//.........这里部分代码省略.........