當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。