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


PHP Path::Insert方法代码示例

本文整理汇总了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);
                     }
                 }
             }
         }
     }
 }
开发者ID:noix,项目名称:qsprog,代码行数:47,代码来源:Module.php

示例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');
 }
开发者ID:etienne,项目名称:jam,代码行数:38,代码来源:Jam.php

示例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');
开发者ID:noix,项目名称:programme,代码行数:31,代码来源:firstrun.php


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