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


PHP PHPWS_DB::isTable方法代码示例

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


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

示例1: phatform_uninstall

/**
 * Uninstall file for PhatForm v2
 *
 * Rewritten to work with phpwebsite 1.0
 * @version $Id$
 */
function phatform_uninstall(&$content)
{
    $db = new PHPWS_DB('mod_phatform_forms');
    $db->addColumn('id');
    $db->addColumn('archiveTableName');
    $db->addWhere('saved', 1);
    $result = $db->select();
    if (!empty($result)) {
        foreach ($result as $form) {
            if (empty($form['archiveTableName'])) {
                $table = 'mod_phatform_form_' . $form['id'];
                if (PHPWS_DB::isTable($table)) {
                    PHPWS_DB::dropTable($table);
                }
            } else {
                $table = $form['archiveTableName'];
                PHPWS_DB::dropTable($table);
            }
        }
        $content[] = dgettext('phatform', 'Removed all dynamic Form Generator tables.');
    }
    PHPWS_DB::dropTable('mod_phatform_forms');
    PHPWS_DB::dropTable('mod_phatform_options');
    PHPWS_DB::dropTable('mod_phatform_textfield');
    PHPWS_DB::dropTable('mod_phatform_textarea');
    PHPWS_DB::dropTable('mod_phatform_dropbox');
    PHPWS_DB::dropTable('mod_phatform_multiselect');
    PHPWS_DB::dropTable('mod_phatform_radiobutton');
    PHPWS_DB::dropTable('mod_phatform_checkbox');
    $content[] = dgettext('phatform', 'All Form Generator static tables removed.');
    return TRUE;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:38,代码来源:uninstall.php

示例2: calendar_uninstall

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function calendar_uninstall(&$content)
{
    PHPWS_Core::initModClass('calendar', 'Schedule.php');
    // Need functions to remove old event tables
    $db = new PHPWS_DB('calendar_schedule');
    $schedules = $db->getObjects('Calendar_Schedule');
    if (PHPWS_Error::isError($schedules)) {
        return $schedules;
    } elseif (empty($schedules)) {
        $result = PHPWS_DB::dropTable('calendar_schedule');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_notice');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_suggestions');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        return true;
    }
    $error = false;
    foreach ($schedules as $sch) {
        $result = $sch->delete();
        if (PHPWS_Error::isError($result)) {
            PHPWS_Error::log($result);
            $error = true;
        }
    }
    $result = PHPWS_DB::dropTable('calendar_schedule');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_notice');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_suggestions');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    if (PHPWS_DB::isTable('converted')) {
        $db2 = new PHPWS_DB('converted');
        $db2->addWhere('convert_name', array('schedule', 'calendar'));
        $db2->delete();
        $content[] = dgettext('calendar', 'Removed convert flag.');
    }
    if (!$error) {
        $content[] = dgettext('calendar', 'Calendar tables removed.');
    } else {
        $content[] = dgettext('calendar', 'Some errors occurred when uninstalling Calendar.');
    }
    return true;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:60,代码来源:uninstall.php

示例3: _confirmArchive

 function _confirmArchive()
 {
     if (isset($_REQUEST['PHAT_ArchiveConfirm'])) {
         include PHPWS_SOURCE_DIR . 'mod/phatform/inc/Archive.php';
         $error = NULL;
         $error = archive($this->getId());
         if (PHPWS_Error::isError($error)) {
             PHPWS_Error::log($error);
             javascript('alert', array('content' => dgettext('phatform', 'Failed to archive.')));
             unset($_REQUEST['PHAT_ArchiveConfirm']);
             unset($error);
             $_REQUEST['PHAT_FORM_OP'] = 'ArchiveConfirm';
             $this->action();
             return;
         }
         $this->_saved = 0;
         $this->_position = 0;
         $sql = 'UPDATE mod_phatform_forms SET saved=\'' . $this->_saved . "' WHERE id='" . $this->getId() . "'";
         PHPWS_DB::query($sql);
         $sql = 'DROP TABLE mod_phatform_form_' . $this->getId();
         PHPWS_DB::query($sql);
         $table = 'mod_phatform_form_' . $this->getId() . '_seq';
         if (PHPWS_DB::isTable($table)) {
             $sql = 'DROP TABLE ' . $table;
             PHPWS_DB::query($sql);
         }
         $_REQUEST['PHAT_FORM_OP'] = 'EditAction';
         $_REQUEST['PHAT_Submit'] = 1;
         $this->action();
     } else {
         if (isset($_REQUEST['PHAT_ArchiveCancel'])) {
             $_REQUEST['PHAT_MAN_OP'] = 'List';
             $_SESSION['PHAT_FormManager']->action();
         } else {
             $hiddens['module'] = 'phatform';
             $hiddens['PHAT_FORM_OP'] = 'ArchiveConfirm';
             foreach ($hiddens as $key => $value) {
                 $eles[] = PHPWS_Form::formHidden($key, $value);
             }
             $elements[0] = implode("\n", $eles);
             $confirmTags['WARNING_TAG'] = dgettext('phatform', 'WARNING!');
             $confirmTags['MESSAGE'] = dgettext('phatform', 'You have chosen to edit a saved form! All current data will be archived and cleared if you chose to continue!  Make sure you export your data from your form before you continue!');
             $confirmTags['CANCEL_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Cancel'), 'PHAT_ArchiveCancel');
             $confirmTags['CONFIRM_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Confirm'), 'PHAT_ArchiveConfirm');
             $elements[0] .= PHPWS_Template::processTemplate($confirmTags, 'phatform', 'form/archiveConfirm.tpl');
             $content = PHPWS_Form::makeForm('PHAT_FormArchiveConfirm', 'index.php', $elements);
             $GLOBALS['CNT_phatform']['title'] = dgettext('phatform', 'Form') . ': ' . $this->getLabel();
             $GLOBALS['CNT_phatform']['content'] .= $content;
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:51,代码来源:Form.php

示例4: dropTable

 /**
  * Static call only
  * check_existence - of table
  * sequence_table  - if true, drop sequence table as well
  */
 public static function dropTable($table, $check_existence = true, $sequence_table = true)
 {
     PHPWS_DB::touchDB();
     // was using IF EXISTS but not cross compatible
     if ($check_existence && !PHPWS_DB::isTable($table)) {
         return true;
     }
     $result = PHPWS_DB::query("DROP TABLE {$table}");
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if ($sequence_table && PHPWS_DB::isSequence($table)) {
         $result = $GLOBALS['PHPWS_DB']['lib']->dropSequence($table . '_seq');
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     return true;
 }
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:24,代码来源:SubselectDatabase.php

示例5: getVersionInfo

 /**
  * Returns the core version.
  *
  * @param boolean get_file  If true, uses the boost.php file, if false
  *                          uses the database version.
  */
 public static function getVersionInfo($get_file = true)
 {
     $file = PHPWS_SOURCE_DIR . 'core/boost/boost.php';
     include $file;
     if (!$get_file) {
         if (!PHPWS_DB::isTable('core_version')) {
             $version = '1.0.0';
         } else {
             $db = new PHPWS_DB('core_version');
             $db->addColumn('version');
             $version = $db->select('one');
         }
     }
     return array('proper_name' => $proper_name, 'version' => $version, 'version_http' => $version_http);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:21,代码来源:PHPWS_Core.php

示例6: filecabinet_update

/**
 * @author Matthew McNaney
 * @version $Id$
 */
function filecabinet_update(&$content, $version)
{
    $home_dir = PHPWS_Boost::getHomeDir();
    switch ($version) {
        case version_compare($version, '1.0.1', '<'):
            $content[] = '<pre>File Cabinet versions prior to 1.0.1 are not supported.
Please download version 1.0.2.</pre>';
            break;
        case version_compare($version, '1.0.2', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('folders');
            if (!$db->isTableColumn('key_id')) {
                if (PHPWS_Error::logIfError($db->addTableColumn('key_id', 'int NOT NULL default 0'))) {
                    $content[] = '--- An error occurred when trying to add key_id as a column to the folders table.</pre>';
                    return false;
                }
                $content[] = '--- Successfully added key_id column to folders table.';
                $db2 = new PHPWS_DB('phpws_key');
                $db2->addWhere('module', 'filecabinet');
                $db2->delete();
                $content[] = '--- Deleted false folder keys.';
                $db->reset();
                PHPWS_Core::initModClass('filecabinet', 'Folder.php');
                $result = $db->getObjects('Folder');
                if (!empty($result)) {
                    foreach ($result as $folder) {
                        $folder->saveKey(true);
                    }
                }
            }
            $content[] = '
1.0.2 changes
--------------
+ 1.0.0 update was missing key_id column addition to folders table.
</pre>';
        case version_compare($version, '1.1.0', '<'):
            $content[] = '<pre>';
            if (!checkMultimediaDir($content, $home_dir)) {
                return false;
            }
            if (!is_dir($home_dir . 'files/filecabinet/incoming')) {
                if (is_writable($home_dir . 'files/filecabinet') && @mkdir($home_dir . 'files/filecabinet/incoming')) {
                    $content[] = '--- "files/filecabinet/incoming" directory created.';
                } else {
                    $content[] = 'File Cabinet 1.1.0 is unable to create a "filecabinet/incoming" directory.
It is not required but if you want to classify files you will need to create it yourself.
Example: mkdir phpwebsite/files/filecabinet/incoming/</pre>';
                    return false;
                }
            }
            $source_dir = PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/filters/';
            $dest_dir = $home_dir . 'templates/filecabinet/filters/';
            if (!is_dir($dest_dir)) {
                if (!PHPWS_File::copy_directory($source_dir, $dest_dir)) {
                    $content[] = '--- FAILED copying templates/filters/ directory locally.</pre>';
                    return false;
                }
            }
            $files = array('templates/manager/pick.tpl', 'templates/classify_file.tpl', 'templates/classify_list.tpl', 'templates/image_edit.tpl', 'templates/multimedia_edit.tpl', 'templates/multimedia_grid.tpl', 'templates/style.css', 'templates/settings.tpl', 'conf/config.php');
            if (PHPWS_Boost::updateFiles($files, 'filecabinet')) {
                $content[] = '--- Copied the following files:';
            } else {
                $content[] = '--- FAILED copying the following files:';
            }
            $content[] = "    " . implode("\n    ", $files);
            $db = new PHPWS_DB('images');
            if (!$db->isTableColumn('parent_id')) {
                if (PHPWS_Error::logIfError($db->addTableColumn('parent_id', 'int NOT NULL default 0'))) {
                    $content[] = 'Could not create parent_id column in images table.</pre>';
                    return false;
                }
            }
            if (!$db->isTableColumn('url')) {
                if (PHPWS_Error::logIfError($db->addTableColumn('url', 'varchar(255) NULL'))) {
                    $content[] = 'Could not create url column in images table.</pre>';
                    return false;
                }
            }
            if (!PHPWS_DB::isTable('multimedia')) {
                $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/multimedia.sql');
                if (!PHPWS_Error::logIfError($result)) {
                    $content[] = '--- Multimedia table created successfully.';
                } else {
                    $content[] = '--- Failed to create multimedia table.</pre>';
                    return false;
                }
            }
            $content[] = '
1.1.0 changes
--------------
+ Fixed authorized check when unpinning folders
+ Images can now be linked to other pages.
+ Resized images can now be linked to their parent image.
+ Clip option moved outside edit_folder permissions when viewing images.
+ Added writable directory check before allowing new folders to be
  created.
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:update.php

示例7: users_update

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function users_update(&$content, $currentVersion)
{
    $home_dir = PHPWS_Boost::getHomeDir();
    switch ($currentVersion) {
        case version_compare($currentVersion, '2.2.0', '<'):
            $content[] = 'This package does not update versions under 2.2.0';
            return false;
        case version_compare($currentVersion, '2.2.1', '<'):
            $content[] = '+ Fixed a bug causing conflicts between user and group permissions.';
        case version_compare($currentVersion, '2.2.2', '<'):
            $content[] = '+ Set username to the same character size in both users table and user_authorization.';
            $content[] = '+ Fixed typo causing branch installation failure on Postgresql.';
        case version_compare($currentVersion, '2.3.0', '<'):
            $content[] = '<pre>
2.3.0 changes
------------------------
+ Added translate function calls in classes and my_page.php
+ my_page hides translation option if language defines disable selection
+ Added a unrestricted only parameter to Current_User\'s allow and
  authorize functions
+ Dropped references from some constructors
+ Added error check to setPermissions function: won\'t accept empty
  group id
+ Changed id default to zero.
+ Removed unneeded function parameter on getGroups
</pre>
';
        case version_compare($currentVersion, '2.3.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/my_page/user_setting.tpl');
            userUpdateFiles($files, $content);
            $content[] = '
2.3.1 changes
------------------------
+ Added ability for user to set editor preferences
</pre>
';
        case version_compare($currentVersion, '2.3.2', '<'):
            $content[] = '<pre>2.3.2 changes';
            $files = array('img/users.png', 'templates/user_main.tpl');
            userUpdateFiles($files, $content);
            $content[] = '+ Added error check to login.
+ Changed user control panel icon.
+ Fixed template typo that broke IE login.
+ Removed fake French translation (delete mod/users/locale/fr_FR/ directory
+ Permissions are now ordered alphabetically.
+ isUser will now always return false if passed a zero id.
+ Added new function requireLogin that forwards a user to the login
  screen
</pre>';
        case version_compare($currentVersion, '2.4.0', '<'):
            if (!PHPWS_DB::isTable('users_pw_reset')) {
                $new_table = 'CREATE TABLE users_pw_reset (
user_id INT NOT NULL default 0,
authhash CHAR( 32 ) NOT NULL default 0,
timeout INT NOT NULL default 0,
);';
                if (!PHPWS_DB::import($new_table)) {
                    $content[] = 'Unable to create users_pw_reset table.';
                    return false;
                } else {
                    $content[] = 'Created new table: users_pw_reset';
                }
            }
            $files = array('templates/forms/reset_password.tpl', 'templates/forms/forgot.tpl', 'conf/config.php', 'templates/usermenus/top.tpl', 'templates/forms/settings.tpl', 'templates/my_page/user_setting.tpl');
            $content[] = '<pre>';
            userUpdatefiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_0.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '2.4.1', '<'):
            $content[] = '<pre>';
            $files = array('conf/languages.php');
            userUpdateFiles($files, $content);
            $content[] = '
2.4.1 changes
------------------------
+ Default item id on permission check functions is now zero instead of
  null. This will make checking permissions a little easier on new items.
+ Bug #1690657 - Changed group select js property to onclick instead
  of onchange. Thanks singletrack.
+ Changed the language abbreviation for Danish
</pre>
';
        case version_compare($currentVersion, '2.4.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/usermenus/Default.tpl');
            userUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_2.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '2.4.3', '<'):
            $content[] = '<pre>';
            if (!PHPWS_Boost::inBranch()) {
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:update.php

示例8: getBackupTable

 public function getBackupTable($table)
 {
     if (!PHPWS_DB::isTable($table)) {
         return FALSE;
     }
     $backupTable = Backup::getBackupTableName($table);
     if (!PHPWS_DB::isTable($backupTable)) {
         $result = Backup::_buildBackupTable($table);
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     return $backupTable;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:14,代码来源:Backup.php

示例9: save

 /**
  * Saves a schedule and creates a new event table if needed
  */
 public function save()
 {
     $db = $this->getDB();
     if (empty($this->id)) {
         $new_key = TRUE;
     } else {
         $new_key = FALSE;
     }
     $result = $db->saveObject($this);
     if (PHPWS_Error::isError($result)) {
         return false;
     } else {
         if (!PHPWS_DB::isTable($this->getEventTable())) {
             $result = $this->createEventTable();
             if (PHPWS_Error::isError($result)) {
                 $this->delete();
                 return $result;
             }
         }
         $result = $this->saveKey();
         if (PHPWS_Error::isError($result)) {
             $this->delete();
             return $result;
         }
         if ($new_key) {
             $db->saveObject($this);
         }
         return true;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:33,代码来源:Schedule.php

示例10: dropPermissions

 public function dropPermissions()
 {
     $modules = PHPWS_Core::getModules(true, true);
     if (empty($modules)) {
         return false;
     }
     foreach ($modules as $mod) {
         $permTable = Users_Permission::getPermissionTableName($mod);
         $db = new PHPWS_DB($permTable);
         if (!$db->isTable($permTable)) {
             continue;
         }
         $db->addWhere('group_id', $this->id);
         PHPWS_Error::logIfError($db->delete());
         $db = new PHPWS_DB('phpws_key_edit');
         $db->addWhere('group_id', $this->id);
         PHPWS_Error::logIfError($db->delete());
         $db = new PHPWS_DB('phpws_key_view');
         $db->addWhere('group_id', $this->id);
         PHPWS_Error::logIfError($db->delete());
     }
     return true;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:23,代码来源:Group.php

示例11: getPermissionGroups

 /**
  * Returns an associative list of all groups and their levels of permission
  * in reference to the key passed to it
  */
 public static function getPermissionGroups($key, $edit_rights = false)
 {
     if (empty($key) || !is_a($key, 'Key') || $key->isHomeKey() || empty($key->module) || $edit_rights && empty($key->edit_permission)) {
         return NULL;
     }
     $permTable = Users_Permission::getPermissionTableName($key->module);
     if (!PHPWS_DB::isTable($permTable)) {
         return PHPWS_Error::get(USER_ERR_PERM_FILE, 'users', __CLASS__ . '::' . __FUNCTION__);
     }
     $db = new PHPWS_DB('users_groups');
     $db->addColumn('users_groups.*');
     $db->addColumn("{$permTable}.permission_level");
     $db->addWhere('id', "{$permTable}.group_id");
     $db->addWhere("{$permTable}.permission_level", 0, '>');
     $test_db = new PHPWS_DB($permTable);
     if ($edit_rights) {
         if (!$test_db->isTableColumn($key->edit_permission)) {
             return PHPWS_Error::get(KEY_PERM_COLUMN_MISSING, 'core', 'Users_Permission::getRestrictedGroups', $key->edit_permission);
         }
         $db->addWhere($permTable . '.' . $key->edit_permission, 1);
     }
     $db->addOrder('name');
     $result = $db->select();
     if (empty($result) || PHPWS_Error::isError($result)) {
         return $result;
     }
     foreach ($result as $group) {
         if ($group['user_id']) {
             if ($group['permission_level'] == RESTRICTED_PERMISSION) {
                 $glist['restricted']['all'][] = $glist['restricted']['users'][] = $group;
             } else {
                 $glist['unrestricted']['users'][] = $glist['unrestricted']['all'][] = $group;
             }
             $glist['permitted']['users'][] = $group;
         } else {
             if ($group['permission_level'] == RESTRICTED_PERMISSION) {
                 $glist['restricted']['groups'][] = $glist['restricted']['all'][] = $group;
             } else {
                 $glist['unrestricted']['groups'][] = $glist['unrestricted']['all'][] = $group;
             }
             $glist['permitted']['groups'][] = $group;
         }
         $glist['permitted']['all'][] = $group;
     }
     return $glist;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:50,代码来源:Permission.php

示例12: save

 public function save()
 {
     PHPWS_Core::initModClass('search', 'Search.php');
     $table = $this->_schedule->getEventTable();
     if (!PHPWS_DB::isTable($table)) {
         return PHPWS_Error::get(CAL_EVENT_TABLE_MISSING, 'calendar', 'Calendar_Event::save');
     }
     $db = new PHPWS_DB($table);
     $result = $db->saveObject($this);
     if (PHPWS_Error::isError($result)) {
         return $result;
     } elseif (!$this->pid) {
         // only save the key if the pid is 0
         // ie source event not copy
         if (empty($this->key_id)) {
             $save_key = true;
         } else {
             $save_key = false;
         }
         $key = $this->saveKey();
         if (PHPWS_Error::isError($key)) {
             PHPWS_Error::log($key);
             return false;
         }
         if ($save_key) {
             $db->saveObject($this);
         }
         /* save search settings */
         $search = new Search($this->key_id);
         $search->addKeywords($this->summary);
         $search->addKeywords($this->location);
         $search->addKeywords($this->description);
         $search->save();
         return true;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:36,代码来源:Event.php


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