本文整理汇总了PHP中Path::Insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::Insert方法的具体用法?PHP Path::Insert怎么用?PHP Path::Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::Insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdatePath
function UpdatePath($id = null)
{
global $_JAM;
// Check whether we have data
if (!$this->item) {
// We don't; we need to fetch data
$itemID = $_POST['master'] ? $_POST['master'] : $id;
// FIXME: Again, fucking kludge for translations.
if ($_POST['language']) {
$originalLanguage = $_JAM->language;
$_JAM->language = $_POST['language'];
}
if (!$this->FetchItem($itemID)) {
return false;
}
if ($originalLanguage) {
$_JAM->language = $originalLanguage;
}
}
$safeInsert = $this->config['forbidObsoletePaths'] ? false : true;
// Update path for module item
if ($path = $this->GetPath()) {
$pathItemID = $_POST['master'] ? $_POST['master'] : $id;
$language = $_POST['language'];
if ($insertedPath = Path::Insert($path, $this->moduleID, $pathItemID, $safeInsert, $language)) {
$this->item['path'] = $insertedPath;
} else {
trigger_error("Couldn't insert path in database", E_USER_ERROR);
return false;
}
}
// Update path for files
if ($this->files) {
foreach ($this->schema as $name => $info) {
if ($info['type'] == 'file') {
if (!is_object($this->item[$name])) {
$this->item[$name] = $this->NestModule('files', $this->item[$name]);
}
if ($filePath = $this->item[$name]->GetPath($name)) {
if (!Path::Insert($filePath, $this->files->moduleID, $this->item[$name]->itemID, $safeInsert)) {
trigger_error("Couldn't insert path for file associated with field " . $name . " in module " . $this->name, E_USER_ERROR);
}
}
}
}
}
}
示例2: FirstRun
function FirstRun()
{
// Load table structure for required tables
$tables = IniFile::Parse('engine/database/tables.ini', true);
// Create tables
foreach ($tables as $name => $schema) {
if (!Database::CreateTable($name, $schema)) {
trigger_error("Couldn't create table " . $name, E_USER_ERROR);
}
}
// Manually add admin module to _modules table
if (Query::TableIsEmpty('_modules')) {
$adminModule = array('name' => 'admin');
if (!Database::Insert('_modules', $adminModule)) {
trigger_error("Couldn't install core modules", E_USER_ERROR);
}
}
// Install required modules
$requiredModules = array('users', 'files');
foreach ($requiredModules as $moduleName) {
$module = Module::GetNewModule($moduleName);
$module->Install();
}
// Add default admin user
if (Query::TableIsEmpty('users')) {
$adminUserParams = array('created' => $this->databaseTime, 'login' => 'admin', 'name' => 'Admin', 'password' => 'admin', 'status' => 3);
if (!Database::Insert('users', $adminUserParams)) {
trigger_error("Couldn't create admin user", E_USER_ERROR);
}
}
// Add admin path
$adminModuleId = Query::SingleValue('_modules', 'id', "name = 'admin'");
if (!Path::Insert('admin', $adminModuleId, false)) {
trigger_error("Couldn't add admin path", E_USER_ERROR);
}
// Redirect to admin interface
HTTP::RedirectLocal('admin');
}
示例3: trigger_error
if (!Database::CreateTable($name, $schema)) {
trigger_error("Couldn't create table " . $name, E_USER_ERROR);
}
}
// Manually add admin module to _modules table
if (Query::TableIsEmpty('_modules')) {
$adminModule = array('name' => 'admin');
if (!Database::Insert('_modules', $adminModule)) {
trigger_error("Couldn't install core modules", E_USER_ERROR);
}
}
// Install required modules
$requiredModules = array('users', 'files');
foreach ($requiredModules as $moduleName) {
$module = Module::GetNewModule($moduleName);
$module->Install();
}
// Add default admin user
if (Query::TableIsEmpty('users')) {
$adminUserParams = array('created' => $_JAM->databaseTime, 'login' => 'admin', 'name' => 'Admin', 'password' => 'admin', 'status' => 3);
if (!Database::Insert('users', $adminUserParams)) {
trigger_error("Couldn't create admin user", E_USER_ERROR);
}
}
// Add admin path
$adminModuleId = Query::SingleValue('_modules', 'id', "name = 'admin'");
if (!Path::Insert('admin', $adminModuleId, false)) {
trigger_error("Couldn't add admin path", E_USER_ERROR);
}
// Redirect to admin interface
HTTP::RedirectLocal('admin');